Apply the astyle-kdelibs script

This commit is contained in:
Kevin Ottens 2014-04-26 01:45:47 +02:00
parent c2aa81e2d4
commit 72ba7b4146
210 changed files with 4821 additions and 4923 deletions

View File

@ -54,70 +54,70 @@ void ConfigLoaderTest::cleanup()
void ConfigLoaderTest::boolDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemBool*, "DefaultBoolItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemBool *, "DefaultBoolItem");
QVERIFY(typeItem->isEqual(true));
}
void ConfigLoaderTest::colorDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemColor*, "DefaultColorItem");
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemColor *, "DefaultColorItem");
QVERIFY(typeItem->isEqual(QColor("#00FF00")));
}
void ConfigLoaderTest::dateTimeDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemDateTime*, "DefaultDateTimeItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemDateTime *, "DefaultDateTimeItem");
QVERIFY(typeItem->isEqual(QDateTime::fromString("Thu Sep 09 2010")));
}
void ConfigLoaderTest::enumDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemEnum*, "DefaultEnumItem");
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemEnum *, "DefaultEnumItem");
QVERIFY(typeItem->isEqual(3));
}
void ConfigLoaderTest::fontDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemFont*, "DefaultFontItem");
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemFont *, "DefaultFontItem");
QVERIFY(typeItem->isEqual(QFont("DejaVu Sans")));
}
void ConfigLoaderTest::intDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemInt*, "DefaultIntItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemInt *, "DefaultIntItem");
QVERIFY(typeItem->isEqual(27));
}
void ConfigLoaderTest::passwordDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemPassword*, "DefaultPasswordItem");
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemPassword *, "DefaultPasswordItem");
QVERIFY(typeItem->isEqual(QString::fromLatin1("h4x.")));
}
void ConfigLoaderTest::pathDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemPath*, "DefaultPathItem");
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemPath *, "DefaultPathItem");
QVERIFY(typeItem->isEqual(QString::fromLatin1("/dev/null")));
}
void ConfigLoaderTest::stringDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemString*, "DefaultStringItem");
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemString *, "DefaultStringItem");
QVERIFY(typeItem->isEqual(QString::fromLatin1("TestString")));
}
void ConfigLoaderTest::stringListDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemStringList*, "DefaultStringListItem");
GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemStringList *, "DefaultStringListItem");
// Create a string list with the expected values.
QStringList expected;
@ -132,28 +132,28 @@ void ConfigLoaderTest::stringListDefaultValue()
void ConfigLoaderTest::uintDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemUInt*, "DefaultUIntItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemUInt *, "DefaultUIntItem");
QVERIFY(typeItem->isEqual(7U));
}
void ConfigLoaderTest::urlDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemUrl*, "DefaultUrlItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemUrl *, "DefaultUrlItem");
QVERIFY(typeItem->isEqual(QUrl("http://kde.org")));
}
void ConfigLoaderTest::doubleDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemDouble*, "DefaultDoubleItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemDouble *, "DefaultDoubleItem");
QVERIFY(typeItem->isEqual(13.37));
}
void ConfigLoaderTest::intListDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemIntList*, "DefaultIntListItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemIntList *, "DefaultIntListItem");
// Create a int list with the expected values.
QList<int> expected;
@ -169,21 +169,21 @@ void ConfigLoaderTest::intListDefaultValue()
void ConfigLoaderTest::longLongDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemLongLong*, "DefaultLongLongItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemLongLong *, "DefaultLongLongItem");
QVERIFY(typeItem->isEqual(Q_INT64_C(-9211372036854775808)));
}
void ConfigLoaderTest::pointDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemPoint*, "DefaultPointItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemPoint *, "DefaultPointItem");
QVERIFY(typeItem->isEqual(QPoint(185, 857)));
}
void ConfigLoaderTest::rectDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemRect*, "DefaultRectItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemRect *, "DefaultRectItem");
// Create a new QRect with the expected value.
QRect expected;
@ -194,19 +194,17 @@ void ConfigLoaderTest::rectDefaultValue()
void ConfigLoaderTest::sizeDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemSize*, "DefaultSizeItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemSize *, "DefaultSizeItem");
QVERIFY(typeItem->isEqual(QSize(640, 480)));
}
void ConfigLoaderTest::ulongLongDefaultValue()
{
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemULongLong*, "DefaultULongLongItem");
GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemULongLong *, "DefaultULongLongItem");
QVERIFY(typeItem->isEqual(Q_UINT64_C(9223372036854775806)));
}
QTEST_MAIN(ConfigLoaderTest)

View File

@ -24,7 +24,7 @@
namespace Plasma
{
class ConfigLoader;
class ConfigLoader;
}
class QFile;
@ -59,8 +59,8 @@ private Q_SLOTS:
void ulongLongDefaultValue();
private:
Plasma::ConfigLoader* cl;
QFile* configFile;
Plasma::ConfigLoader *cl;
QFile *configFile;
};
#endif

View File

@ -45,10 +45,9 @@
#include <QtCore/QList>
#include <QtCore/QTimer>
DynamicTreeModel::DynamicTreeModel(QObject *parent)
: QAbstractItemModel(parent),
nextId(1)
: QAbstractItemModel(parent),
nextId(1)
{
}
@ -57,125 +56,130 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare
// if (column != 0)
// return QModelIndex();
if (column < 0 || row < 0) {
return QModelIndex();
}
if ( column < 0 || row < 0 )
return QModelIndex();
QList<QList<qint64> > childIdColumns = m_childItems.value(parent.internalId());
QList<QList<qint64> > childIdColumns = m_childItems.value(parent.internalId());
const qint64 grandParent = findParentId(parent.internalId());
if (grandParent >= 0) {
QList<QList<qint64> > parentTable = m_childItems.value(grandParent);
Q_ASSERT(parent.column() < parentTable.size());
QList<qint64> parentSiblings = parentTable.at(parent.column());
Q_ASSERT(parent.row() < parentSiblings.size());
}
const qint64 grandParent = findParentId(parent.internalId());
if (grandParent >= 0) {
QList<QList<qint64> > parentTable = m_childItems.value(grandParent);
Q_ASSERT(parent.column() < parentTable.size());
QList<qint64> parentSiblings = parentTable.at(parent.column());
Q_ASSERT(parent.row() < parentSiblings.size());
}
if (childIdColumns.size() == 0) {
return QModelIndex();
}
if (childIdColumns.size() == 0)
return QModelIndex();
if (column >= childIdColumns.size()) {
return QModelIndex();
}
if (column >= childIdColumns.size())
return QModelIndex();
QList<qint64> rowIds = childIdColumns.at(column);
QList<qint64> rowIds = childIdColumns.at(column);
if (row >= rowIds.size()) {
return QModelIndex();
}
if ( row >= rowIds.size())
return QModelIndex();
qint64 id = rowIds.at(row);
qint64 id = rowIds.at(row);
return createIndex(row, column, reinterpret_cast<void *>(id));
return createIndex(row, column, reinterpret_cast<void *>(id));
}
qint64 DynamicTreeModel::findParentId(qint64 searchId) const
{
if (searchId <= 0)
return -1;
QHashIterator<qint64, QList<QList<qint64> > > i(m_childItems);
while (i.hasNext())
{
i.next();
QListIterator<QList<qint64> > j(i.value());
while (j.hasNext())
{
QList<qint64> l = j.next();
if (l.contains(searchId))
{
return i.key();
}
if (searchId <= 0) {
return -1;
}
}
return -1;
QHashIterator<qint64, QList<QList<qint64> > > i(m_childItems);
while (i.hasNext()) {
i.next();
QListIterator<QList<qint64> > j(i.value());
while (j.hasNext()) {
QList<qint64> l = j.next();
if (l.contains(searchId)) {
return i.key();
}
}
}
return -1;
}
QModelIndex DynamicTreeModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
if (!index.isValid()) {
return QModelIndex();
}
qint64 searchId = index.internalId();
qint64 parentId = findParentId(searchId);
// Will never happen for valid index, but what the hey...
if (parentId <= 0)
return QModelIndex();
qint64 searchId = index.internalId();
qint64 parentId = findParentId(searchId);
// Will never happen for valid index, but what the hey...
if (parentId <= 0) {
return QModelIndex();
}
qint64 grandParentId = findParentId(parentId);
if (grandParentId < 0)
grandParentId = 0;
qint64 grandParentId = findParentId(parentId);
if (grandParentId < 0) {
grandParentId = 0;
}
int column = 0;
QList<qint64> childList = m_childItems.value(grandParentId).at(column);
int column = 0;
QList<qint64> childList = m_childItems.value(grandParentId).at(column);
int row = childList.indexOf(parentId);
int row = childList.indexOf(parentId);
return createIndex(row, column, reinterpret_cast<void *>(parentId));
return createIndex(row, column, reinterpret_cast<void *>(parentId));
}
int DynamicTreeModel::rowCount(const QModelIndex &index ) const
int DynamicTreeModel::rowCount(const QModelIndex &index) const
{
QList<QList<qint64> > cols = m_childItems.value(index.internalId());
QList<QList<qint64> > cols = m_childItems.value(index.internalId());
if (cols.size() == 0 )
return 0;
if (cols.size() == 0) {
return 0;
}
if (index.column() > 0)
return 0;
if (index.column() > 0) {
return 0;
}
return cols.at(0).size();
return cols.at(0).size();
}
int DynamicTreeModel::columnCount(const QModelIndex &index ) const
int DynamicTreeModel::columnCount(const QModelIndex &index) const
{
// Q_UNUSED(index);
return m_childItems.value(index.internalId()).size();
return m_childItems.value(index.internalId()).size();
}
QVariant DynamicTreeModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (!index.isValid()) {
return QVariant();
}
if (Qt::DisplayRole == role)
{
return m_items.value(index.internalId());
}
return QVariant();
if (Qt::DisplayRole == role) {
return m_items.value(index.internalId());
}
return QVariant();
}
void DynamicTreeModel::clear()
{
beginResetModel();
m_items.clear();
m_childItems.clear();
nextId = 1;
endResetModel();
beginResetModel();
m_items.clear();
m_childItems.clear();
nextId = 1;
endResetModel();
}
ModelChangeCommand::ModelChangeCommand( DynamicTreeModel *model, QObject *parent )
ModelChangeCommand::ModelChangeCommand(DynamicTreeModel *model, QObject *parent)
: QObject(parent), m_model(model), m_numCols(1), m_startRow(-1), m_endRow(-1)
{
@ -183,18 +187,17 @@ ModelChangeCommand::ModelChangeCommand( DynamicTreeModel *model, QObject *parent
QModelIndex ModelChangeCommand::findIndex(QList<int> rows)
{
const int col = 0;
QModelIndex parent = QModelIndex();
QListIterator<int> i(rows);
while (i.hasNext())
{
parent = m_model->index(i.next(), col, parent);
Q_ASSERT(parent.isValid());
}
return parent;
const int col = 0;
QModelIndex parent = QModelIndex();
QListIterator<int> i(rows);
while (i.hasNext()) {
parent = m_model->index(i.next(), col, parent);
Q_ASSERT(parent.isValid());
}
return parent;
}
ModelInsertCommand::ModelInsertCommand(DynamicTreeModel *model, QObject *parent )
ModelInsertCommand::ModelInsertCommand(DynamicTreeModel *model, QObject *parent)
: ModelChangeCommand(model, parent)
{
@ -202,38 +205,34 @@ ModelInsertCommand::ModelInsertCommand(DynamicTreeModel *model, QObject *parent
void ModelInsertCommand::doCommand()
{
QModelIndex parent = findIndex(m_rowNumbers);
m_model->beginInsertRows(parent, m_startRow, m_endRow);
qint64 parentId = parent.internalId();
for (int row = m_startRow; row <= m_endRow; row++)
{
for(int col = 0; col < m_numCols; col++ )
{
if (m_model->m_childItems[parentId].size() <= col)
{
m_model->m_childItems[parentId].append(QList<qint64>());
}
QModelIndex parent = findIndex(m_rowNumbers);
m_model->beginInsertRows(parent, m_startRow, m_endRow);
qint64 parentId = parent.internalId();
for (int row = m_startRow; row <= m_endRow; row++) {
for (int col = 0; col < m_numCols; col++) {
if (m_model->m_childItems[parentId].size() <= col) {
m_model->m_childItems[parentId].append(QList<qint64>());
}
// QString name = QUuid::createUuid().toString();
qint64 id = m_model->newId();
QString name = QString::number(id);
qint64 id = m_model->newId();
QString name = QString::number(id);
m_model->m_items.insert(id, name);
m_model->m_childItems[parentId][col].insert(row, id);
m_model->m_items.insert(id, name);
m_model->m_childItems[parentId][col].insert(row, id);
}
}
}
m_model->endInsertRows();
m_model->endInsertRows();
}
ModelMoveCommand::ModelMoveCommand(DynamicTreeModel *model, QObject *parent)
: ModelChangeCommand(model, parent)
: ModelChangeCommand(model, parent)
{
}
bool ModelMoveCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow)
{
return m_model->beginMoveRows(srcParent, srcStart, srcEnd, destParent, destRow);
return m_model->beginMoveRows(srcParent, srcStart, srcEnd, destParent, destRow);
}
void ModelMoveCommand::doCommand()
@ -241,32 +240,28 @@ void ModelMoveCommand::doCommand()
QModelIndex srcParent = findIndex(m_rowNumbers);
QModelIndex destParent = findIndex(m_destRowNumbers);
if (!emitPreSignal(srcParent, m_startRow, m_endRow, destParent, m_destRow))
{
if (!emitPreSignal(srcParent, m_startRow, m_endRow, destParent, m_destRow)) {
return;
}
for (int column = 0; column < m_numCols; ++column)
{
QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(m_startRow, m_endRow - m_startRow + 1 );
for (int column = 0; column < m_numCols; ++column) {
QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(m_startRow, m_endRow - m_startRow + 1);
for (int i = m_startRow; i <= m_endRow ; i++)
{
for (int i = m_startRow; i <= m_endRow; i++) {
m_model->m_childItems[srcParent.internalId()][column].removeAt(m_startRow);
}
int d;
if (m_destRow < m_startRow)
if (m_destRow < m_startRow) {
d = m_destRow;
else
{
if (srcParent == destParent)
} else {
if (srcParent == destParent) {
d = m_destRow - (m_endRow - m_startRow + 1);
else
} else {
d = m_destRow - (m_endRow - m_startRow) + 1;
}
}
foreach(const qint64 id, l)
{
foreach (const qint64 id, l) {
m_model->m_childItems[destParent.internalId()][column].insert(d++, id);
}
}
@ -279,8 +274,8 @@ void ModelMoveCommand::emitPostSignal()
m_model->endMoveRows();
}
ModelResetCommand::ModelResetCommand(DynamicTreeModel* model, QObject* parent)
: ModelMoveCommand(model, parent)
ModelResetCommand::ModelResetCommand(DynamicTreeModel *model, QObject *parent)
: ModelMoveCommand(model, parent)
{
}
@ -306,8 +301,8 @@ void ModelResetCommand::emitPostSignal()
m_model->reset();
}
ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent)
: ModelMoveCommand(model, parent)
ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel *model, QObject *parent)
: ModelMoveCommand(model, parent)
{
}

View File

@ -47,118 +47,136 @@
#include <QtCore/QHash>
#include <QtCore/QList>
class DynamicTreeModel : public QAbstractItemModel
{
Q_OBJECT
Q_OBJECT
public:
DynamicTreeModel(QObject *parent = 0);
DynamicTreeModel(QObject *parent = 0);
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &index = QModelIndex()) const;
int columnCount(const QModelIndex &index = QModelIndex()) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &index = QModelIndex()) const;
int columnCount(const QModelIndex &index = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
void clear();
void clear();
protected Q_SLOTS:
/**
Finds the parent id of the string with id @p searchId.
/**
Finds the parent id of the string with id @p searchId.
Returns -1 if not found.
*/
qint64 findParentId(qint64 searchId) const;
Returns -1 if not found.
*/
qint64 findParentId(qint64 searchId) const;
private:
QHash<qint64, QString> m_items;
QHash<qint64, QList<QList<qint64> > > m_childItems;
qint64 nextId;
qint64 newId() { return nextId++; };
QHash<qint64, QString> m_items;
QHash<qint64, QList<QList<qint64> > > m_childItems;
qint64 nextId;
qint64 newId()
{
return nextId++;
};
QModelIndex m_nextParentIndex;
int m_nextRow;
QModelIndex m_nextParentIndex;
int m_nextRow;
int m_depth;
int maxDepth;
int m_depth;
int maxDepth;
friend class ModelInsertCommand;
friend class ModelMoveCommand;
friend class ModelResetCommand;
friend class ModelResetCommandFixed;
friend class ModelInsertCommand;
friend class ModelMoveCommand;
friend class ModelResetCommand;
friend class ModelResetCommandFixed;
};
class ModelChangeCommand : public QObject
{
Q_OBJECT
Q_OBJECT
public:
explicit ModelChangeCommand( DynamicTreeModel *model, QObject *parent = 0 );
explicit ModelChangeCommand(DynamicTreeModel *model, QObject *parent = 0);
virtual ~ModelChangeCommand() {}
virtual ~ModelChangeCommand() {}
void setAncestorRowNumbers(QList<int> rowNumbers) { m_rowNumbers = rowNumbers; }
void setAncestorRowNumbers(QList<int> rowNumbers)
{
m_rowNumbers = rowNumbers;
}
QModelIndex findIndex(QList<int> rows);
QModelIndex findIndex(QList<int> rows);
void setStartRow(int row) { m_startRow = row; }
void setStartRow(int row)
{
m_startRow = row;
}
void setEndRow(int row) { m_endRow = row; }
void setEndRow(int row)
{
m_endRow = row;
}
void setNumCols(int cols) { m_numCols = cols; }
void setNumCols(int cols)
{
m_numCols = cols;
}
virtual void doCommand() = 0;
virtual void doCommand() = 0;
protected:
DynamicTreeModel* m_model;
QList<int> m_rowNumbers;
int m_numCols;
int m_startRow;
int m_endRow;
DynamicTreeModel *m_model;
QList<int> m_rowNumbers;
int m_numCols;
int m_startRow;
int m_endRow;
};
typedef QList<ModelChangeCommand*> ModelChangeCommandList;
typedef QList<ModelChangeCommand *> ModelChangeCommandList;
class ModelInsertCommand : public ModelChangeCommand
{
Q_OBJECT
Q_OBJECT
public:
explicit ModelInsertCommand(DynamicTreeModel *model, QObject *parent = 0 );
virtual ~ModelInsertCommand() {}
explicit ModelInsertCommand(DynamicTreeModel *model, QObject *parent = 0);
virtual ~ModelInsertCommand() {}
virtual void doCommand();
virtual void doCommand();
};
class ModelMoveCommand : public ModelChangeCommand
{
Q_OBJECT
Q_OBJECT
public:
ModelMoveCommand(DynamicTreeModel *model, QObject *parent);
ModelMoveCommand(DynamicTreeModel *model, QObject *parent);
virtual ~ModelMoveCommand() {}
virtual ~ModelMoveCommand() {}
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
virtual void doCommand();
virtual void doCommand();
virtual void emitPostSignal();
virtual void emitPostSignal();
void setDestAncestors( QList<int> rows ) { m_destRowNumbers = rows; }
void setDestAncestors(QList<int> rows)
{
m_destRowNumbers = rows;
}
void setDestRow(int row) { m_destRow = row; }
void setDestRow(int row)
{
m_destRow = row;
}
protected:
QList<int> m_destRowNumbers;
int m_destRow;
QList<int> m_destRowNumbers;
int m_destRow;
};
/**
@ -166,14 +184,14 @@ protected:
*/
class ModelResetCommand : public ModelMoveCommand
{
Q_OBJECT
Q_OBJECT
public:
explicit ModelResetCommand(DynamicTreeModel* model, QObject* parent = 0);
explicit ModelResetCommand(DynamicTreeModel *model, QObject *parent = 0);
virtual ~ModelResetCommand();
virtual ~ModelResetCommand();
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
virtual void emitPostSignal();
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
virtual void emitPostSignal();
};
@ -182,16 +200,15 @@ public:
*/
class ModelResetCommandFixed : public ModelMoveCommand
{
Q_OBJECT
Q_OBJECT
public:
explicit ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent = 0);
explicit ModelResetCommandFixed(DynamicTreeModel *model, QObject *parent = 0);
virtual ~ModelResetCommandFixed();
virtual ~ModelResetCommandFixed();
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
virtual void emitPostSignal();
virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
virtual void emitPostSignal();
};
#endif

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#include <QtGui/QtGui>
#include "modeltest.h"
@ -48,61 +47,62 @@
//#undef Q_ASSERT
//#define Q_ASSERT QVERIFY
Q_DECLARE_METATYPE ( QModelIndex )
Q_DECLARE_METATYPE(QModelIndex)
/*!
Connect to all of the models signals. Whenever anything happens recheck everything.
*/
ModelTest::ModelTest ( QAbstractItemModel *_model, QObject *parent ) : QObject ( parent ), model ( _model ), fetchingMore ( false )
ModelTest::ModelTest(QAbstractItemModel *_model, QObject *parent) : QObject(parent), model(_model), fetchingMore(false)
{
Q_ASSERT ( model );
Q_ASSERT(model);
connect ( model, SIGNAL (columnsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (columnsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (columnsInserted(QModelIndex,int,int)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (columnsRemoved(QModelIndex,int,int)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (dataChanged(QModelIndex,QModelIndex)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (headerDataChanged(Qt::Orientation,int,int)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (layoutAboutToBeChanged()), this, SLOT (runAllTests()) );
connect ( model, SIGNAL (layoutChanged()), this, SLOT (runAllTests()) );
connect ( model, SIGNAL (modelReset()), this, SLOT (runAllTests()) );
connect ( model, SIGNAL (rowsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (rowsInserted(QModelIndex,int,int)),
this, SLOT (runAllTests()) );
connect ( model, SIGNAL (rowsRemoved(QModelIndex,int,int)),
this, SLOT (runAllTests()) );
connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(runAllTests()));
connect(model, SIGNAL(layoutChanged()), this, SLOT(runAllTests()));
connect(model, SIGNAL(modelReset()), this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(runAllTests()));
// Special checks for inserting/removing
connect ( model, SIGNAL (layoutAboutToBeChanged()),
this, SLOT (layoutAboutToBeChanged()) );
connect ( model, SIGNAL (layoutChanged()),
this, SLOT (layoutChanged()) );
connect(model, SIGNAL(layoutAboutToBeChanged()),
this, SLOT(layoutAboutToBeChanged()));
connect(model, SIGNAL(layoutChanged()),
this, SLOT(layoutChanged()));
connect ( model, SIGNAL (rowsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT (rowsAboutToBeInserted(QModelIndex,int,int)) );
connect ( model, SIGNAL (rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT (rowsAboutToBeRemoved(QModelIndex,int,int)) );
connect ( model, SIGNAL (rowsInserted(QModelIndex,int,int)),
this, SLOT (rowsInserted(QModelIndex,int,int)) );
connect ( model, SIGNAL (rowsRemoved(QModelIndex,int,int)),
this, SLOT (rowsRemoved(QModelIndex,int,int)) );
connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)));
connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(rowsInserted(QModelIndex,int,int)));
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(rowsRemoved(QModelIndex,int,int)));
runAllTests();
}
void ModelTest::runAllTests()
{
if ( fetchingMore )
if (fetchingMore) {
return;
}
nonDestructiveBasicTest();
rowCount();
columnCount();
@ -118,32 +118,32 @@ void ModelTest::runAllTests()
*/
void ModelTest::nonDestructiveBasicTest()
{
Q_ASSERT ( model->buddy ( QModelIndex() ) == QModelIndex() );
model->canFetchMore ( QModelIndex() );
Q_ASSERT ( model->columnCount ( QModelIndex() ) >= 0 );
Q_ASSERT ( model->data ( QModelIndex() ) == QVariant() );
Q_ASSERT(model->buddy(QModelIndex()) == QModelIndex());
model->canFetchMore(QModelIndex());
Q_ASSERT(model->columnCount(QModelIndex()) >= 0);
Q_ASSERT(model->data(QModelIndex()) == QVariant());
fetchingMore = true;
model->fetchMore ( QModelIndex() );
model->fetchMore(QModelIndex());
fetchingMore = false;
Qt::ItemFlags flags = model->flags ( QModelIndex() );
Q_ASSERT ( flags == Qt::ItemIsDropEnabled || flags == 0 );
model->hasChildren ( QModelIndex() );
model->hasIndex ( 0, 0 );
model->headerData ( 0, Qt::Horizontal );
model->index ( 0, 0 );
model->itemData ( QModelIndex() );
Qt::ItemFlags flags = model->flags(QModelIndex());
Q_ASSERT(flags == Qt::ItemIsDropEnabled || flags == 0);
model->hasChildren(QModelIndex());
model->hasIndex(0, 0);
model->headerData(0, Qt::Horizontal);
model->index(0, 0);
model->itemData(QModelIndex());
QVariant cache;
model->match ( QModelIndex(), -1, cache );
model->match(QModelIndex(), -1, cache);
model->mimeTypes();
Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() );
Q_ASSERT ( model->rowCount() >= 0 );
Q_ASSERT(model->parent(QModelIndex()) == QModelIndex());
Q_ASSERT(model->rowCount() >= 0);
QVariant variant;
model->setData ( QModelIndex(), variant, -1 );
model->setHeaderData ( -1, Qt::Horizontal, QVariant() );
model->setHeaderData ( 999999, Qt::Horizontal, QVariant() );
model->setData(QModelIndex(), variant, -1);
model->setHeaderData(-1, Qt::Horizontal, QVariant());
model->setHeaderData(999999, Qt::Horizontal, QVariant());
QMap<int, QVariant> roles;
model->sibling ( 0, 0, QModelIndex() );
model->span ( QModelIndex() );
model->sibling(0, 0, QModelIndex());
model->span(QModelIndex());
model->supportedDropActions();
}
@ -156,19 +156,21 @@ void ModelTest::rowCount()
{
// qDebug() << "rc";
// check top row
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
int rows = model->rowCount ( topIndex );
Q_ASSERT ( rows >= 0 );
if ( rows > 0 )
Q_ASSERT ( model->hasChildren ( topIndex ) == true );
QModelIndex topIndex = model->index(0, 0, QModelIndex());
int rows = model->rowCount(topIndex);
Q_ASSERT(rows >= 0);
if (rows > 0) {
Q_ASSERT(model->hasChildren(topIndex) == true);
}
QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex );
if ( secondLevelIndex.isValid() ) { // not the top level
QModelIndex secondLevelIndex = model->index(0, 0, topIndex);
if (secondLevelIndex.isValid()) { // not the top level
// check a row count where parent is valid
rows = model->rowCount ( secondLevelIndex );
Q_ASSERT ( rows >= 0 );
if ( rows > 0 )
Q_ASSERT ( model->hasChildren ( secondLevelIndex ) == true );
rows = model->rowCount(secondLevelIndex);
Q_ASSERT(rows >= 0);
if (rows > 0) {
Q_ASSERT(model->hasChildren(secondLevelIndex) == true);
}
}
// The models rowCount() is tested more extensively in checkChildren(),
@ -181,13 +183,14 @@ void ModelTest::rowCount()
void ModelTest::columnCount()
{
// check top row
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
Q_ASSERT ( model->columnCount ( topIndex ) >= 0 );
QModelIndex topIndex = model->index(0, 0, QModelIndex());
Q_ASSERT(model->columnCount(topIndex) >= 0);
// check a column count where parent is valid
QModelIndex childIndex = model->index ( 0, 0, topIndex );
if ( childIndex.isValid() )
Q_ASSERT ( model->columnCount ( childIndex ) >= 0 );
QModelIndex childIndex = model->index(0, 0, topIndex);
if (childIndex.isValid()) {
Q_ASSERT(model->columnCount(childIndex) >= 0);
}
// columnCount() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@ -200,19 +203,20 @@ void ModelTest::hasIndex()
{
// qDebug() << "hi";
// Make sure that invalid values returns an invalid index
Q_ASSERT ( model->hasIndex ( -2, -2 ) == false );
Q_ASSERT ( model->hasIndex ( -2, 0 ) == false );
Q_ASSERT ( model->hasIndex ( 0, -2 ) == false );
Q_ASSERT(model->hasIndex(-2, -2) == false);
Q_ASSERT(model->hasIndex(-2, 0) == false);
Q_ASSERT(model->hasIndex(0, -2) == false);
int rows = model->rowCount();
int columns = model->columnCount();
// check out of bounds
Q_ASSERT ( model->hasIndex ( rows, columns ) == false );
Q_ASSERT ( model->hasIndex ( rows + 1, columns + 1 ) == false );
Q_ASSERT(model->hasIndex(rows, columns) == false);
Q_ASSERT(model->hasIndex(rows + 1, columns + 1) == false);
if ( rows > 0 )
Q_ASSERT ( model->hasIndex ( 0, 0 ) == true );
if (rows > 0) {
Q_ASSERT(model->hasIndex(0, 0) == true);
}
// hasIndex() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@ -225,24 +229,25 @@ void ModelTest::index()
{
// qDebug() << "i";
// Make sure that invalid values returns an invalid index
Q_ASSERT ( model->index ( -2, -2 ) == QModelIndex() );
Q_ASSERT ( model->index ( -2, 0 ) == QModelIndex() );
Q_ASSERT ( model->index ( 0, -2 ) == QModelIndex() );
Q_ASSERT(model->index(-2, -2) == QModelIndex());
Q_ASSERT(model->index(-2, 0) == QModelIndex());
Q_ASSERT(model->index(0, -2) == QModelIndex());
int rows = model->rowCount();
int columns = model->columnCount();
if ( rows == 0 )
if (rows == 0) {
return;
}
// Catch off by one errors
Q_ASSERT ( model->index ( rows, columns ) == QModelIndex() );
Q_ASSERT ( model->index ( 0, 0 ).isValid() == true );
Q_ASSERT(model->index(rows, columns) == QModelIndex());
Q_ASSERT(model->index(0, 0).isValid() == true);
// Make sure that the same index is *always* returned
QModelIndex a = model->index ( 0, 0 );
QModelIndex b = model->index ( 0, 0 );
Q_ASSERT ( a == b );
QModelIndex a = model->index(0, 0);
QModelIndex b = model->index(0, 0);
Q_ASSERT(a == b);
// index() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@ -256,10 +261,11 @@ void ModelTest::parent()
// qDebug() << "p";
// Make sure the model wont crash and will return an invalid QModelIndex
// when asked for the parent of an invalid index.
Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() );
Q_ASSERT(model->parent(QModelIndex()) == QModelIndex());
if ( model->rowCount() == 0 )
if (model->rowCount() == 0) {
return;
}
// Column 0 | Column 1 |
// QModelIndex() | |
@ -268,29 +274,29 @@ void ModelTest::parent()
// Common error test #1, make sure that a top level index has a parent
// that is a invalid QModelIndex.
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
Q_ASSERT ( model->parent ( topIndex ) == QModelIndex() );
QModelIndex topIndex = model->index(0, 0, QModelIndex());
Q_ASSERT(model->parent(topIndex) == QModelIndex());
// Common error test #2, make sure that a second level index has a parent
// that is the first level index.
if ( model->rowCount ( topIndex ) > 0 ) {
QModelIndex childIndex = model->index ( 0, 0, topIndex );
Q_ASSERT ( model->parent ( childIndex ) == topIndex );
if (model->rowCount(topIndex) > 0) {
QModelIndex childIndex = model->index(0, 0, topIndex);
Q_ASSERT(model->parent(childIndex) == topIndex);
}
// Common error test #3, the second column should NOT have the same children
// as the first column in a row.
// Usually the second column shouldn't have children.
QModelIndex topIndex1 = model->index ( 0, 1, QModelIndex() );
if ( model->rowCount ( topIndex1 ) > 0 ) {
QModelIndex childIndex = model->index ( 0, 0, topIndex );
QModelIndex childIndex1 = model->index ( 0, 0, topIndex1 );
Q_ASSERT ( childIndex != childIndex1 );
QModelIndex topIndex1 = model->index(0, 1, QModelIndex());
if (model->rowCount(topIndex1) > 0) {
QModelIndex childIndex = model->index(0, 0, topIndex);
QModelIndex childIndex1 = model->index(0, 0, topIndex1);
Q_ASSERT(childIndex != childIndex1);
}
// Full test, walk n levels deep through the model making sure that all
// parent's children correctly specify their parent.
checkChildren ( QModelIndex() );
checkChildren(QModelIndex());
}
/*!
@ -307,62 +313,65 @@ void ModelTest::parent()
found the basic bugs because it is easier to figure out the problem in
those tests then this one.
*/
void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
void ModelTest::checkChildren(const QModelIndex &parent, int currentDepth)
{
// First just try walking back up the tree.
QModelIndex p = parent;
while ( p.isValid() )
while (p.isValid()) {
p = p.parent();
}
// For models that are dynamically populated
if ( model->canFetchMore ( parent ) ) {
if (model->canFetchMore(parent)) {
fetchingMore = true;
model->fetchMore ( parent );
model->fetchMore(parent);
fetchingMore = false;
}
int rows = model->rowCount ( parent );
int columns = model->columnCount ( parent );
int rows = model->rowCount(parent);
int columns = model->columnCount(parent);
if ( rows > 0 )
Q_ASSERT ( model->hasChildren ( parent ) );
if (rows > 0) {
Q_ASSERT(model->hasChildren(parent));
}
// Some further testing against rows(), columns(), and hasChildren()
Q_ASSERT ( rows >= 0 );
Q_ASSERT ( columns >= 0 );
if ( rows > 0 )
Q_ASSERT ( model->hasChildren ( parent ) == true );
Q_ASSERT(rows >= 0);
Q_ASSERT(columns >= 0);
if (rows > 0) {
Q_ASSERT(model->hasChildren(parent) == true);
}
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
// << "columns:" << columns << "parent column:" << parent.column();
Q_ASSERT ( model->hasIndex ( rows + 1, 0, parent ) == false );
for ( int r = 0; r < rows; ++r ) {
if ( model->canFetchMore ( parent ) ) {
Q_ASSERT(model->hasIndex(rows + 1, 0, parent) == false);
for (int r = 0; r < rows; ++r) {
if (model->canFetchMore(parent)) {
fetchingMore = true;
model->fetchMore ( parent );
model->fetchMore(parent);
fetchingMore = false;
}
Q_ASSERT ( model->hasIndex ( r, columns + 1, parent ) == false );
for ( int c = 0; c < columns; ++c ) {
Q_ASSERT ( model->hasIndex ( r, c, parent ) == true );
QModelIndex index = model->index ( r, c, parent );
Q_ASSERT(model->hasIndex(r, columns + 1, parent) == false);
for (int c = 0; c < columns; ++c) {
Q_ASSERT(model->hasIndex(r, c, parent) == true);
QModelIndex index = model->index(r, c, parent);
// rowCount() and columnCount() said that it existed...
Q_ASSERT ( index.isValid() == true );
Q_ASSERT(index.isValid() == true);
// index() should always return the same index when called twice in a row
QModelIndex modifiedIndex = model->index ( r, c, parent );
Q_ASSERT ( index == modifiedIndex );
QModelIndex modifiedIndex = model->index(r, c, parent);
Q_ASSERT(index == modifiedIndex);
// Make sure we get the same index if we request it twice in a row
QModelIndex a = model->index ( r, c, parent );
QModelIndex b = model->index ( r, c, parent );
Q_ASSERT ( a == b );
QModelIndex a = model->index(r, c, parent);
QModelIndex b = model->index(r, c, parent);
Q_ASSERT(a == b);
// Some basic checking on the index that is returned
Q_ASSERT ( index.model() == model );
Q_ASSERT ( index.row() == r );
Q_ASSERT ( index.column() == c );
Q_ASSERT(index.model() == model);
Q_ASSERT(index.row() == r);
Q_ASSERT(index.column() == c);
// While you can technically return a QVariant usually this is a sign
// of an bug in data() Disable if this really is ok in your model.
// Q_ASSERT ( model->data ( index, Qt::DisplayRole ).isValid() == true );
@ -381,17 +390,17 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
// Check that we can get back our real parent.
// qDebug() << model->parent ( index ) << parent ;
Q_ASSERT ( model->parent ( index ) == parent );
Q_ASSERT(model->parent(index) == parent);
// recursively go down the children
if ( model->hasChildren ( index ) && currentDepth < 10 ) {
if (model->hasChildren(index) && currentDepth < 10) {
//qDebug() << r << c << "has children" << model->rowCount(index);
checkChildren ( index, ++currentDepth );
checkChildren(index, ++currentDepth);
}/* else { if (currentDepth >= 10) qDebug() << "checked 10 deep"; };*/
// make sure that after testing the children that the index doesn't change.
QModelIndex newerIndex = model->index ( r, c, parent );
Q_ASSERT ( index == newerIndex );
QModelIndex newerIndex = model->index(r, c, parent);
Q_ASSERT(index == newerIndex);
}
}
}
@ -402,68 +411,69 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
void ModelTest::data()
{
// Invalid index should return an invalid qvariant
Q_ASSERT ( !model->data ( QModelIndex() ).isValid() );
Q_ASSERT(!model->data(QModelIndex()).isValid());
if ( model->rowCount() == 0 )
if (model->rowCount() == 0) {
return;
}
// A valid index should have a valid QVariant data
Q_ASSERT ( model->index ( 0, 0 ).isValid() );
Q_ASSERT(model->index(0, 0).isValid());
// shouldn't be able to set data on an invalid index
Q_ASSERT ( model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) == false );
Q_ASSERT(model->setData(QModelIndex(), QLatin1String("foo"), Qt::DisplayRole) == false);
// General Purpose roles that should return a QString
QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole );
if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
QVariant variant = model->data(model->index(0, 0), Qt::ToolTipRole);
if (variant.isValid()) {
Q_ASSERT(qVariantCanConvert<QString> (variant));
}
variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole );
if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
variant = model->data(model->index(0, 0), Qt::StatusTipRole);
if (variant.isValid()) {
Q_ASSERT(qVariantCanConvert<QString> (variant));
}
variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole );
if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
variant = model->data(model->index(0, 0), Qt::WhatsThisRole);
if (variant.isValid()) {
Q_ASSERT(qVariantCanConvert<QString> (variant));
}
// General Purpose roles that should return a QSize
variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole );
if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QSize> ( variant ) );
variant = model->data(model->index(0, 0), Qt::SizeHintRole);
if (variant.isValid()) {
Q_ASSERT(qVariantCanConvert<QSize> (variant));
}
// General Purpose roles that should return a QFont
QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole );
if ( fontVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QFont> ( fontVariant ) );
QVariant fontVariant = model->data(model->index(0, 0), Qt::FontRole);
if (fontVariant.isValid()) {
Q_ASSERT(qVariantCanConvert<QFont> (fontVariant));
}
// Check that the alignment is one we know about
QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole );
if ( textAlignmentVariant.isValid() ) {
QVariant textAlignmentVariant = model->data(model->index(0, 0), Qt::TextAlignmentRole);
if (textAlignmentVariant.isValid()) {
int alignment = textAlignmentVariant.toInt();
Q_ASSERT ( alignment == ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) );
Q_ASSERT(alignment == (alignment & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)));
}
// General Purpose roles that should return a QColor
QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole );
if ( colorVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) );
QVariant colorVariant = model->data(model->index(0, 0), Qt::BackgroundColorRole);
if (colorVariant.isValid()) {
Q_ASSERT(qVariantCanConvert<QColor> (colorVariant));
}
colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole );
if ( colorVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) );
colorVariant = model->data(model->index(0, 0), Qt::TextColorRole);
if (colorVariant.isValid()) {
Q_ASSERT(qVariantCanConvert<QColor> (colorVariant));
}
// Check that the "check state" is one we know about.
QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole );
if ( checkStateVariant.isValid() ) {
QVariant checkStateVariant = model->data(model->index(0, 0), Qt::CheckStateRole);
if (checkStateVariant.isValid()) {
int state = checkStateVariant.toInt();
Q_ASSERT ( state == Qt::Unchecked ||
state == Qt::PartiallyChecked ||
state == Qt::Checked );
Q_ASSERT(state == Qt::Unchecked ||
state == Qt::PartiallyChecked ||
state == Qt::Checked);
}
}
@ -472,7 +482,7 @@ void ModelTest::data()
\sa rowsInserted()
*/
void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end )
void ModelTest::rowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
{
// Q_UNUSED(end);
// qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
@ -480,10 +490,10 @@ void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, in
// qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) );
Changing c;
c.parent = parent;
c.oldSize = model->rowCount ( parent );
c.last = model->data ( model->index ( start - 1, 0, parent ) );
c.next = model->data ( model->index ( start, 0, parent ) );
insert.push ( c );
c.oldSize = model->rowCount(parent);
c.last = model->data(model->index(start - 1, 0, parent));
c.next = model->data(model->index(start, 0, parent));
insert.push(c);
}
/*!
@ -491,10 +501,10 @@ void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, in
\sa rowsAboutToBeInserted()
*/
void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
void ModelTest::rowsInserted(const QModelIndex &parent, int start, int end)
{
Changing c = insert.pop();
Q_ASSERT ( c.parent == parent );
Q_ASSERT(c.parent == parent);
// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
@ -504,30 +514,32 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
// }
// qDebug();
Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
Q_ASSERT(c.oldSize + (end - start + 1) == model->rowCount(parent));
Q_ASSERT(c.last == model->data(model->index(start - 1, 0, c.parent)));
if (c.next != model->data(model->index(end + 1, 0, c.parent))) {
qDebug() << start << end;
for (int i=0; i < model->rowCount(); ++i)
for (int i = 0; i < model->rowCount(); ++i) {
qDebug() << model->index(i, 0).data().toString();
}
qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent));
}
Q_ASSERT ( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) );
Q_ASSERT(c.next == model->data(model->index(end + 1, 0, c.parent)));
}
void ModelTest::layoutAboutToBeChanged()
{
for ( int i = 0; i < qBound ( 0, model->rowCount(), 100 ); ++i )
changing.append ( QPersistentModelIndex ( model->index ( i, 0 ) ) );
for (int i = 0; i < qBound(0, model->rowCount(), 100); ++i) {
changing.append(QPersistentModelIndex(model->index(i, 0)));
}
}
void ModelTest::layoutChanged()
{
for ( int i = 0; i < changing.count(); ++i ) {
for (int i = 0; i < changing.count(); ++i) {
QPersistentModelIndex p = changing[i];
Q_ASSERT ( p == model->index ( p.row(), p.column(), p.parent() ) );
Q_ASSERT(p == model->index(p.row(), p.column(), p.parent()));
}
changing.clear();
}
@ -537,15 +549,15 @@ void ModelTest::layoutChanged()
\sa rowsRemoved()
*/
void ModelTest::rowsAboutToBeRemoved ( const QModelIndex &parent, int start, int end )
void ModelTest::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
{
qDebug() << "ratbr" << parent << start << end;
qDebug() << "ratbr" << parent << start << end;
Changing c;
c.parent = parent;
c.oldSize = model->rowCount ( parent );
c.last = model->data ( model->index ( start - 1, 0, parent ) );
c.next = model->data ( model->index ( end + 1, 0, parent ) );
remove.push ( c );
c.oldSize = model->rowCount(parent);
c.last = model->data(model->index(start - 1, 0, parent));
c.next = model->data(model->index(end + 1, 0, parent));
remove.push(c);
}
/*!
@ -553,14 +565,13 @@ qDebug() << "ratbr" << parent << start << end;
\sa rowsAboutToBeRemoved()
*/
void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end )
void ModelTest::rowsRemoved(const QModelIndex &parent, int start, int end)
{
qDebug() << "rr" << parent << start << end;
qDebug() << "rr" << parent << start << end;
Changing c = remove.pop();
Q_ASSERT ( c.parent == parent );
Q_ASSERT ( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) );
Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
Q_ASSERT ( c.next == model->data ( model->index ( start, 0, c.parent ) ) );
Q_ASSERT(c.parent == parent);
Q_ASSERT(c.oldSize - (end - start + 1) == model->rowCount(parent));
Q_ASSERT(c.last == model->data(model->index(start - 1, 0, c.parent)));
Q_ASSERT(c.next == model->data(model->index(start, 0, c.parent)));
}

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#ifndef MODELTEST_H
#define MODELTEST_H
@ -49,46 +48,46 @@
class ModelTest : public QObject
{
Q_OBJECT
Q_OBJECT
public:
explicit ModelTest( QAbstractItemModel *model, QObject *parent = 0 );
explicit ModelTest(QAbstractItemModel *model, QObject *parent = 0);
private Q_SLOTS:
void nonDestructiveBasicTest();
void rowCount();
void columnCount();
void hasIndex();
void index();
void parent();
void data();
void nonDestructiveBasicTest();
void rowCount();
void columnCount();
void hasIndex();
void index();
void parent();
void data();
protected Q_SLOTS:
void runAllTests();
void layoutAboutToBeChanged();
void layoutChanged();
void rowsAboutToBeInserted( const QModelIndex &parent, int start, int end );
void rowsInserted( const QModelIndex & parent, int start, int end );
void rowsAboutToBeRemoved( const QModelIndex &parent, int start, int end );
void rowsRemoved( const QModelIndex & parent, int start, int end );
void runAllTests();
void layoutAboutToBeChanged();
void layoutChanged();
void rowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
void rowsInserted(const QModelIndex &parent, int start, int end);
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
void rowsRemoved(const QModelIndex &parent, int start, int end);
private:
void checkChildren( const QModelIndex &parent, int currentDepth = 0 );
void checkChildren(const QModelIndex &parent, int currentDepth = 0);
QAbstractItemModel *model;
QAbstractItemModel *model;
struct Changing {
QModelIndex parent;
int oldSize;
QVariant last;
QVariant next;
};
QStack<Changing> insert;
QStack<Changing> remove;
struct Changing {
QModelIndex parent;
int oldSize;
QVariant last;
QVariant next;
};
QStack<Changing> insert;
QStack<Changing> remove;
bool fetchingMore;
bool fetchingMore;
QList<QPersistentModelIndex> changing;
QList<QPersistentModelIndex> changing;
};
#endif

View File

@ -42,7 +42,6 @@ public:
}
};
void PackageStructureTest::initTestCase()
{
m_packagePath = QFINDTESTDATA("data/testpackage");
@ -82,10 +81,10 @@ void PackageStructureTest::multiplePaths()
void PackageStructureTest::directories()
{
QList<const char*> dirs;
QList<const char *> dirs;
dirs << "config" << "data" << "images" << "theme" << "scripts" << "translations" << "ui";
QList<const char*> psDirs = ps.directories();
QList<const char *> psDirs = ps.directories();
QCOMPARE(dirs.count(), psDirs.count());
@ -114,16 +113,16 @@ void PackageStructureTest::directories()
void PackageStructureTest::requiredDirectories()
{
QList<const char*> dirs;
QList<const char *> dirs;
QCOMPARE(ps.requiredDirectories(), dirs);
}
void PackageStructureTest::files()
{
QList<const char*> files;
QList<const char *> files;
files << "mainconfigui" << "mainconfigxml" << "mainscript";
QList<const char*> psFiles = ps.files();
QList<const char *> psFiles = ps.files();
//for (int i = 0; i < psFiles.count(); ++i) {
// qDebug() << psFiles[i];
@ -142,10 +141,10 @@ void PackageStructureTest::files()
void PackageStructureTest::requiredFiles()
{
QList<const char*> files;
QList<const char *> files;
files << "mainscript";
QList<const char*> psFiles = ps.requiredFiles();
QList<const char *> psFiles = ps.requiredFiles();
QCOMPARE(files.count(), psFiles.count());
for (int i = 0; i < files.count(); ++i) {
@ -181,4 +180,3 @@ void PackageStructureTest::mimeTypes()
QTEST_MAIN(PackageStructureTest)

View File

@ -25,11 +25,11 @@
class PackageUrlInterceptorTest : public QObject
{
Q_OBJECT
public:
PackageUrlInterceptorTest() {}
public:
PackageUrlInterceptorTest() {}
private Q_SLOTS:
void loadAccessManager();
private Q_SLOTS:
void loadAccessManager();
};
#endif

View File

@ -90,7 +90,6 @@ void PlasmoidPackageTest::createTestPackage(const QString &packageName)
file.flush();
file.close();
qDebug() << "THIS IS A PLASMOID SCRIPT THING";
// Now we have a minimal plasmoid package which is valid. Let's add some
// files to it for test purposes.
@ -274,31 +273,29 @@ void PlasmoidPackageTest::createAndInstallPackage()
qDebug() << "Installing " << archivePath;
//const QString packageRoot = "plasma/plasmoids/";
//const QString servicePrefix = "plasma-applet-";
KJob* job = p->install(archivePath, m_packageRoot);
KJob *job = p->install(archivePath, m_packageRoot);
connect(job, SIGNAL(finished(KJob*)), SLOT(packageInstalled(KJob*)));
//QVERIFY(p->isValid());
delete p;
}
void PlasmoidPackageTest::packageInstalled(KJob* j)
void PlasmoidPackageTest::packageInstalled(KJob *j)
{
qDebug() << "!!!!!!!!!!!!!!!!!!!! package installed" << (j->error() == KJob::NoError);
QVERIFY(j->error() == KJob::NoError);
//QVERIFY(p->path());
Plasma::Package *p = new Plasma::Package(m_defaultPackageStructure);
KJob* jj = p->uninstall("org.kde.microblog-qml", m_packageRoot);
KJob *jj = p->uninstall("org.kde.microblog-qml", m_packageRoot);
//QObject::disconnect(j, SIGNAL(finished(KJob*)), this, SLOT(packageInstalled(KJob*)));
connect(jj, SIGNAL(finished(KJob*)), SLOT(packageInstalled(KJob*)));
}
void PlasmoidPackageTest::packageUninstalled(KJob* j)
void PlasmoidPackageTest::packageUninstalled(KJob *j)
{
qDebug() << "!!!!!!!!!!!!!!!!!!!!! package uninstalled";
QVERIFY(j->error() == KJob::NoError);
}
QTEST_MAIN(PlasmoidPackageTest)

View File

@ -39,17 +39,17 @@ private Q_SLOTS:
void filePath();
void entryList();
void packageInstalled(KJob* j);
void packageUninstalled(KJob* j);
void packageInstalled(KJob *j);
void packageUninstalled(KJob *j);
private:
void createTestPackage(const QString &packageName);
QString m_packageRoot;
QString m_package;
KJob* m_packageJob;
KJob *m_packageJob;
Plasma::Package m_defaultPackage;
Plasma::PackageStructure* m_defaultPackageStructure;
Plasma::PackageStructure *m_defaultPackageStructure;
};
#endif

View File

@ -75,6 +75,5 @@ void PluginTest::loadDataEngine()
}
#include "moc_pluginloadertest.cpp"

View File

@ -25,18 +25,18 @@
class PluginTest : public QObject
{
Q_OBJECT
public:
PluginTest() {}
public:
PluginTest() {}
private Q_SLOTS:
void listEngines();
void listAppletCategories();
void listContainmentActions();
void listContainmentsOfType();
private Q_SLOTS:
void listEngines();
void listAppletCategories();
void listContainmentActions();
void listContainmentsOfType();
void loadDataEngine();
void loadDataEngine();
private:
private:
};
#endif

View File

@ -43,7 +43,7 @@ void SortFilterModelTest::setModel()
filterModel.setModel(&model);
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).value<QObject*>(), static_cast<QObject*>(&model));
QCOMPARE(arguments.at(0).value<QObject *>(), static_cast<QObject *>(&model));
filterModel.setModel(&model);
QCOMPARE(spy.count(), 0);
@ -54,9 +54,9 @@ void SortFilterModelTest::setEmptyModel()
SortFilterModel filterModel;
QStandardItemModel model;
filterModel.setModel(&model);
QCOMPARE(filterModel.sourceModel(), static_cast<QAbstractItemModel*>(&model));
QCOMPARE(filterModel.sourceModel(), static_cast<QAbstractItemModel *>(&model));
filterModel.setModel(0);
QCOMPARE(filterModel.sourceModel(), static_cast<QAbstractItemModel*>(0));
QCOMPARE(filterModel.sourceModel(), static_cast<QAbstractItemModel *>(0));
}
void SortFilterModelTest::setFilterRegExp()

View File

@ -34,7 +34,6 @@ private Q_SLOTS:
void retrieve();
void deleteEntry();
private:
QVariantMap m_data;
};

View File

@ -32,7 +32,7 @@
namespace KIO
{
class Job;
class Job;
};
class HttpContainer : public Plasma::DataContainer

View File

@ -23,13 +23,13 @@
#include <plasma/applet.h>
#include <QStandardItemModel>
AppletSelector::AppletSelector(QObject* parent, const QVariantList& args)
AppletSelector::AppletSelector(QObject *parent, const QVariantList &args)
: KDialog()
{
Q_UNUSED(args);
setButtons(Close);
QWidget* w = new QWidget(this);
QWidget *w = new QWidget(this);
m_ui = new Ui::AppletSelector;
m_ui->setupUi(w);
@ -38,13 +38,13 @@ AppletSelector::AppletSelector(QObject* parent, const QVariantList& args)
setMainWidget(w);
QStandardItemModel* model = new QStandardItemModel(this);
const KPluginInfo::List list= Plasma::Applet::listAppletInfo();
foreach(const KPluginInfo& info, list) {
QStandardItem* item = new QStandardItem(KIcon(info.icon()), info.name());
QStandardItemModel *model = new QStandardItemModel(this);
const KPluginInfo::List list = Plasma::Applet::listAppletInfo();
foreach (const KPluginInfo &info, list) {
QStandardItem *item = new QStandardItem(KIcon(info.icon()), info.name());
item->setEditable(false);
item->setToolTip(info.comment());
item->setData(info.pluginName(), Qt::UserRole+1);
item->setData(info.pluginName(), Qt::UserRole + 1);
model->appendRow(item);
}
@ -59,9 +59,9 @@ AppletSelector::~AppletSelector()
delete m_ui;
}
void AppletSelector::selected(const QModelIndex& idx)
void AppletSelector::selected(const QModelIndex &idx)
{
emit addApplet(idx.data(Qt::UserRole+1).toString());
emit addApplet(idx.data(Qt::UserRole + 1).toString());
}
#include "appletselector.moc"

View File

@ -23,22 +23,25 @@
#include <KDE/KDialog>
class QModelIndex;
namespace Ui { class AppletSelector; }
namespace Ui
{
class AppletSelector;
}
class AppletSelector : public KDialog
{
Q_OBJECT
Q_OBJECT
public:
explicit AppletSelector(QObject* parent = 0, const QVariantList& args = QVariantList());
explicit AppletSelector(QObject *parent = 0, const QVariantList &args = QVariantList());
~AppletSelector();
public slots:
void selected(const QModelIndex& idx);
void selected(const QModelIndex &idx);
signals:
void addApplet(const QString& name);
void addApplet(const QString &name);
private:
Ui::AppletSelector* m_ui;
Ui::AppletSelector *m_ui;
};
#endif // APPLETSELECTOR_H

View File

@ -27,13 +27,12 @@
#include <KStandardAction>
#include <KActionCollection>
#include <Plasma/Containment>
#include <QApplication>
ContainmentShell::ContainmentShell()
: KParts::MainWindow( ),
: KParts::MainWindow(),
m_dialog(0)
{
setXMLFile("plasma-kpart-shellui.rc");
@ -46,7 +45,7 @@ ContainmentShell::ContainmentShell()
// this routine will find and load our Part. it finds the Part by
// name which is a bad idea usually.. but it's alright in this
// case since our Part is made for this Shell
KService::Ptr service = KService::serviceByDesktopPath( "plasma-kpart.desktop" );
KService::Ptr service = KService::serviceByDesktopPath("plasma-kpart.desktop");
if (service) {
Plasma::PluginLoader *loader = new TestShellPluginLoader();
@ -86,8 +85,8 @@ ContainmentShell::~ContainmentShell()
void ContainmentShell::optionsPreferences()
{
if (!m_dialog) {
m_dialog = new AppletSelector( m_part );
connect( m_dialog, SIGNAL(addApplet(QString)), m_part, SLOT(addApplet(QString)) );
m_dialog = new AppletSelector(m_part);
connect(m_dialog, SIGNAL(addApplet(QString)), m_part, SLOT(addApplet(QString)));
}
m_dialog->show();
}

View File

@ -33,7 +33,7 @@
*/
class ContainmentShell : public KParts::MainWindow
{
Q_OBJECT
Q_OBJECT
public:
ContainmentShell();
virtual ~ContainmentShell();
@ -42,8 +42,8 @@ public Q_SLOTS:
void optionsPreferences();
private:
KParts::Part* m_part;
KDialog* m_dialog;
KParts::Part *m_part;
KDialog *m_dialog;
};
#endif // CONTAINMENTSHELL_H

View File

@ -23,10 +23,10 @@
static const char version[] = "0.1";
int main(int argc, char** argv)
int main(int argc, char **argv)
{
KAboutData about("plasma-kpart-shell", 0, ki18n("Plasma KPart Shell"), version, ki18n("A KDE KPart Application"), KAboutData::License_GPL, ki18n("(C) 2010 Ryan Rix"), KLocalizedString(), 0, "ry@n.rix.si");
about.addAuthor( ki18n("Ryan Rix"), KLocalizedString(), "ry@n.rix.si" );
about.addAuthor(ki18n("Ryan Rix"), KLocalizedString(), "ry@n.rix.si");
KCmdLineArgs::init(argc, argv, &about);
KApplication app;

View File

@ -29,19 +29,19 @@ TestShellPluginLoader::~TestShellPluginLoader()
{
}
Plasma::Applet* TestShellPluginLoader::internalLoadApplet (const QString &name, uint appletId, const QVariantList &args)
Plasma::Applet *TestShellPluginLoader::internalLoadApplet(const QString &name, uint appletId, const QVariantList &args)
{
kDebug() << "loadApplet called with" << name << appletId << args;
return 0;
}
Plasma::DataEngine* TestShellPluginLoader::internalLoadDataEngine(const QString &name)
Plasma::DataEngine *TestShellPluginLoader::internalLoadDataEngine(const QString &name)
{
kDebug() << "loadEngine called with" << name;
return 0;
}
Plasma::Service* TestShellPluginLoader::internalLoadService(const QString &name, const QVariantList &args, QObject *parent)
Plasma::Service *TestShellPluginLoader::internalLoadService(const QString &name, const QVariantList &args, QObject *parent)
{
kDebug() << "loadService called with" << name << args << parent;
return 0;

View File

@ -26,10 +26,10 @@ class TestShellPluginLoader : public Plasma::PluginLoader
public:
~TestShellPluginLoader();
Plasma::Applet* internalLoadApplet (const QString &name, uint appletId = 0,
const QVariantList &args = QVariantList());
Plasma::DataEngine* internalLoadDataEngine(const QString &name);
Plasma::Service* internalLoadService(const QString &name, const QVariantList &args, QObject *parent = 0);
Plasma::Applet *internalLoadApplet(const QString &name, uint appletId = 0,
const QVariantList &args = QVariantList());
Plasma::DataEngine *internalLoadDataEngine(const QString &name);
Plasma::Service *internalLoadService(const QString &name, const QVariantList &args, QObject *parent = 0);
};
#endif

View File

@ -19,7 +19,6 @@
#include <QDebug>
#include "calendar.h"
Calendar::Calendar(QObject *parent)
@ -35,8 +34,8 @@ Calendar::Calendar(QObject *parent)
m_daysModel = new DaysModel(this);
m_daysModel->setSourceData(&m_dayList);
// m_dayHelper = new CalendarDayHelper(this);
// connect(m_dayHelper, SIGNAL(calendarChanged()), this, SLOT(updateData()));
// m_dayHelper = new CalendarDayHelper(this);
// connect(m_dayHelper, SIGNAL(calendarChanged()), this, SLOT(updateData()));
}
QDate Calendar::startDate() const
@ -46,11 +45,11 @@ QDate Calendar::startDate() const
void Calendar::setStartDate(const QDate &dateTime)
{
if(m_startDate == dateTime) {
if (m_startDate == dateTime) {
return;
}
m_startDate = dateTime;
// m_dayHelper->setDate(m_startDate.year(), m_startDate.month());
// m_dayHelper->setDate(m_startDate.year(), m_startDate.month());
updateData();
emit startDateChanged();
}
@ -62,8 +61,9 @@ int Calendar::types() const
void Calendar::setTypes(int types)
{
if (m_types == types)
if (m_types == types) {
return;
}
// m_types = static_cast<Types>(types);
// updateTypes();
@ -78,7 +78,7 @@ int Calendar::days()
void Calendar::setDays(int days)
{
if(m_days != days) {
if (m_days != days) {
m_days = days;
updateData();
emit daysChanged();
@ -92,7 +92,7 @@ int Calendar::weeks()
void Calendar::setWeeks(int weeks)
{
if(m_weeks != weeks) {
if (m_weeks != weeks) {
m_weeks = weeks;
updateData();
emit weeksChanged();
@ -168,7 +168,7 @@ QList<int> Calendar::weeksModel() const
void Calendar::updateData()
{
if(m_days == 0 || m_weeks == 0) {
if (m_days == 0 || m_weeks == 0) {
return;
}
@ -182,7 +182,6 @@ void Calendar::updateData()
QDate firstDay(m_startDate.year(), m_startDate.month(), 1);
// If the first day is the same as the starting day then we add a complete row before it.
if (m_firstDayOfWeek < firstDay.dayOfWeek()) {
daysBeforeCurrentMonth = firstDay.dayOfWeek() - m_firstDayOfWeek;
@ -191,48 +190,48 @@ void Calendar::updateData()
}
int daysThusFar = daysBeforeCurrentMonth + m_startDate.daysInMonth();
if(daysThusFar < totalDays) {
if (daysThusFar < totalDays) {
daysAfterCurrentMonth = totalDays - daysThusFar;
}
if(daysBeforeCurrentMonth > 0) {
if (daysBeforeCurrentMonth > 0) {
QDate previousMonth = m_startDate.addMonths(-1);
//QDate previousMonth(m_startDate.year(), m_startDate.month() - 1, 1);
for(int i = 0; i < daysBeforeCurrentMonth; i++) {
for (int i = 0; i < daysBeforeCurrentMonth; i++) {
DayData day;
day.isCurrentMonth = false;
day.isNextMonth = false;
day.isPreviousMonth = true;
day.dayNumber = previousMonth.daysInMonth() - (daysBeforeCurrentMonth - (i + 1));
day.monthNumber =previousMonth.month();
day.yearNumber =previousMonth.year();
// day.containsEventItems = false;
day.monthNumber = previousMonth.month();
day.yearNumber = previousMonth.year();
// day.containsEventItems = false;
m_dayList << day;
}
}
for(int i = 0; i < m_startDate.daysInMonth(); i++) {
for (int i = 0; i < m_startDate.daysInMonth(); i++) {
DayData day;
day.isCurrentMonth = true;
day.isNextMonth = false;
day.isPreviousMonth = false;
day.dayNumber = i + 1; // +1 to go form 0 based index to 1 based calendar dates
// day.containsEventItems = m_dayHelper->containsEventItems(i + 1);
// day.containsEventItems = m_dayHelper->containsEventItems(i + 1);
day.monthNumber = m_startDate.month();
day.yearNumber = m_startDate.year();
m_dayList << day;
}
if(daysAfterCurrentMonth > 0) {
for(int i = 0; i < daysAfterCurrentMonth; i++) {
if (daysAfterCurrentMonth > 0) {
for (int i = 0; i < daysAfterCurrentMonth; i++) {
DayData day;
day.isCurrentMonth = false;
day.isNextMonth = true;
day.isPreviousMonth = false;
day.dayNumber = i + 1; // +1 to go form 0 based index to 1 based calendar dates
// day.containsEventItems = false;
day.monthNumber = m_startDate.addMonths(1).month();
// day.containsEventItems = false;
day.monthNumber = m_startDate.addMonths(1).month();
day.yearNumber = m_startDate.addMonths(1).year();
m_dayList << day;
}
@ -240,12 +239,11 @@ void Calendar::updateData()
const int numOfDaysInCalendar = m_dayList.count();
// Fill weeksModel (just a QList<int>) with the week numbers. This needs some tweaking!
for(int i = 0; i < numOfDaysInCalendar; i += 7) {
const DayData& data = m_dayList.at(i);
for (int i = 0; i < numOfDaysInCalendar; i += 7) {
const DayData &data = m_dayList.at(i);
m_weekList << QDate(data.yearNumber, data.monthNumber, data.dayNumber).weekNumber();
}
m_daysModel->update();
// qDebug() << "---------------------------------------------------------------";

View File

@ -27,7 +27,6 @@
#include "daydata.h"
#include "daysmodel.h"
class Calendar : public QObject
{
Q_OBJECT
@ -111,7 +110,7 @@ class Calendar : public QObject
* metadata about the current day. The exact metadata can be found in "daysmodel.cpp"
* where the exact names usable in QML are being set.
*/
Q_PROPERTY(QAbstractListModel* daysModel READ daysModel CONSTANT)
Q_PROPERTY(QAbstractListModel *daysModel READ daysModel CONSTANT)
Q_ENUMS(Type)
@ -124,7 +123,6 @@ public:
};
Q_DECLARE_FLAGS(Types, Type)
explicit Calendar(QObject *parent = 0);
// Start date
@ -155,16 +153,15 @@ public:
int year() const;
// Models
QAbstractListModel* daysModel() const;
QList<int> weeksModel() const;
QAbstractListModel *daysModel() const;
QList<int> weeksModel() const;
// QML invokables
Q_INVOKABLE void nextMonth();
Q_INVOKABLE void previousMonth();
Q_INVOKABLE void nextYear();
Q_INVOKABLE void previousYear();
Q_INVOKABLE QString dayName(int weekday) const ;
Q_INVOKABLE QString dayName(int weekday) const;
Q_INVOKABLE int currentWeek() const;
Q_SIGNALS:
@ -184,7 +181,7 @@ private:
QDate m_startDate;
Types m_types;
QList<DayData> m_dayList;
DaysModel* m_daysModel;
DaysModel *m_daysModel;
QList<int> m_weekList;
int m_days;

View File

@ -19,32 +19,28 @@
#include "calendardata.h"
CalendarData::CalendarData(QObject *parent)
: QObject(parent)
, m_types(Holiday | Event | Todo | Journal)
{
// m_etmCalendar = new ETMCalendar();
// m_etmCalendar->setParent(this); //TODO: hit sergio
// m_etmCalendar = new ETMCalendar();
// m_etmCalendar->setParent(this); //TODO: hit sergio
// EntityTreeModel *model = m_etmCalendar->entityTreeModel();
// model->setCollectionFetchStrategy(EntityTreeModel::InvisibleCollectionFetch);
// EntityTreeModel *model = m_etmCalendar->entityTreeModel();
// model->setCollectionFetchStrategy(EntityTreeModel::InvisibleCollectionFetch);
// m_itemList = new EntityMimeTypeFilterModel(this);
// m_itemList->setSourceModel(model);
// m_itemList = new EntityMimeTypeFilterModel(this);
// m_itemList->setSourceModel(model);
// CalendarRoleProxyModel *roleModel = new CalendarRoleProxyModel(this);
// roleModel->setSourceModel(m_itemList);
// CalendarRoleProxyModel *roleModel = new CalendarRoleProxyModel(this);
// roleModel->setSourceModel(m_itemList);
// m_filteredList = new DateTimeRangeFilterModel(this);
// m_filteredList->setSourceModel(roleModel);
// m_filteredList = new DateTimeRangeFilterModel(this);
// m_filteredList->setSourceModel(roleModel);
// updateTypes();
// updateTypes();
}
QDate CalendarData::startDate() const
{
return m_startDate;
@ -52,11 +48,12 @@ QDate CalendarData::startDate() const
void CalendarData::setStartDate(const QDate &dateTime)
{
if (m_startDate == dateTime)
if (m_startDate == dateTime) {
return;
}
m_startDate = dateTime;
// m_filteredList->setStartDate(m_startDate);
// m_filteredList->setStartDate(m_startDate);
emit startDateChanged();
}
@ -67,11 +64,12 @@ QDate CalendarData::endDate() const
void CalendarData::setEndDate(const QDate &dateTime)
{
if (m_endDate == dateTime)
if (m_endDate == dateTime) {
return;
}
m_endDate = dateTime;
// m_filteredList->setEndDate(m_endDate);
// m_filteredList->setEndDate(m_endDate);
emit endDateChanged();
}

View File

@ -24,9 +24,6 @@
#include <QFlags>
#include <QDate>
class QAbstractItemModel;
class CalendarData : public QObject
@ -35,10 +32,10 @@ class CalendarData : public QObject
Q_PROPERTY(QDate startDate READ startDate WRITE setStartDate NOTIFY startDateChanged)
Q_PROPERTY(QDate endDate READ endDate WRITE setEndDate NOTIFY endDateChanged)
// Q_PROPERTY(int types READ types WRITE setTypes NOTIFY typesChanged)
// Q_PROPERTY(int types READ types WRITE setTypes NOTIFY typesChanged)
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged)
// Q_PROPERTY(QAbstractItemModel* model READ model CONSTANT)
// Q_PROPERTY(QAbstractItemModel* model READ model CONSTANT)
Q_ENUMS(Type)
@ -66,20 +63,20 @@ private:
QDate endDate() const;
void setEndDate(const QDate &dateTime);
int types() const;
// void setTypes(int types);
// void setTypes(int types);
QString errorMessage() const;
bool loading() const;
// QAbstractItemModel* model() const;
// QAbstractItemModel* model() const;
// void updateTypes();
// void updateTypes();
QDate m_startDate;
QDate m_endDate;
Types m_types;
// Akonadi::ETMCalendar *m_etmCalendar;
// Akonadi::EntityMimeTypeFilterModel *m_itemList;
// DateTimeRangeFilterModel *m_filteredList;
// Akonadi::ETMCalendar *m_etmCalendar;
// Akonadi::EntityMimeTypeFilterModel *m_itemList;
// DateTimeRangeFilterModel *m_filteredList;
};
#endif // CALENDARDATA_H

View File

@ -24,15 +24,12 @@
#include <QAbstractItemModel>
#include <QAbstractListModel>
void CalendarPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.kde.plasma.calendar"));
qmlRegisterType<CalendarData>(uri, 2, 0, "CalendarData");
qmlRegisterType<CalendarData>(uri, 2, 0, "CalendarData");
qmlRegisterType<Calendar>(uri, 2, 0, "Calendar");
// qmlRegisterType<CalendarData>(uri, 1, 0, "CalendarData");
// qmlRegisterType<CalendarData>(uri, 1, 0, "CalendarData");
// qmlRegisterType<CalendarData>(uri, 1, 0, "Calendar");
qmlRegisterType<QAbstractItemModel>();
qmlRegisterType<QAbstractListModel>();

View File

@ -20,8 +20,6 @@
#ifndef CALENDARPLUGIN_H
#define CALENDARPLUGIN_H
#include <QQmlExtensionPlugin>
class QQmlEngine;
@ -29,7 +27,7 @@ class QQmlEngine;
class CalendarPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
void registerTypes(const char *uri);

View File

@ -7,14 +7,13 @@ public:
bool isPreviousMonth;
bool isCurrentMonth;
bool isNextMonth;
// bool containsHolidayItems;
// bool containsEventItems;
// bool containsTodoItems;
// bool containsJournalItems;
// bool containsHolidayItems;
// bool containsEventItems;
// bool containsTodoItems;
// bool containsJournalItems;
int dayNumber;
int monthNumber;
int yearNumber;
};
#endif // DAYDATA_H

View File

@ -31,8 +31,8 @@ DaysModel::DaysModel(QObject *parent) :
roleNames.insert(isNextMonth, "isNextMonth");
//roleNames.insert(containsHolidayItems, "containsHolidayItems");
//roleNames.insert(containsEventItems, "containsEventItems");
// roleNames.insert(containsTodoItems, "containsTodoItems");
// roleNames.insert(containsJournalItems, "containsJournalItems");
// roleNames.insert(containsTodoItems, "containsTodoItems");
// roleNames.insert(containsJournalItems, "containsJournalItems");
roleNames.insert(dayNumber, "dayNumber");
roleNames.insert(monthNumber, "monthNumber");
roleNames.insert(yearNumber, "yearNumber");
@ -43,7 +43,7 @@ DaysModel::DaysModel(QObject *parent) :
void DaysModel::setSourceData(QList<DayData> *data)
{
if(m_data != data) {
if (m_data != data) {
m_data = data;
reset();
}
@ -52,7 +52,7 @@ void DaysModel::setSourceData(QList<DayData> *data)
int DaysModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
if(m_data->size() <= 0) {
if (m_data->size() <= 0) {
return 0;
} else {
return m_data->size();
@ -65,19 +65,19 @@ QVariant DaysModel::data(const QModelIndex &index, int role) const
DayData currentData = m_data->at(index.row());
switch(role) {
switch (role) {
case isPreviousMonth:
return currentData.isPreviousMonth;
case isNextMonth:
return currentData.isNextMonth;
// case containsHolidayItems:
// return currentData.containsHolidayItems;
/* case containsEventItems:
return currentData.containsEventItems;
case containsTodoItems:
return currentData.containsTodoItems;
case containsJournalItems:
return currentData.containsJournalItems;*/
// case containsHolidayItems:
// return currentData.containsHolidayItems;
/* case containsEventItems:
return currentData.containsEventItems;
case containsTodoItems:
return currentData.containsTodoItems;
case containsJournalItems:
return currentData.containsJournalItems;*/
case dayNumber:
return currentData.dayNumber;
case monthNumber:
@ -91,7 +91,7 @@ QVariant DaysModel::data(const QModelIndex &index, int role) const
void DaysModel::update()
{
if(m_data->size() <= 0) {
if (m_data->size() <= 0) {
return;
}

View File

@ -41,7 +41,7 @@ public:
};
explicit DaysModel(QObject *parent = 0);
void setSourceData(QList<DayData>* data);
void setSourceData(QList<DayData> *data);
virtual int rowCount(const QModelIndex &parent) const;
virtual QVariant data(const QModelIndex &index, int role) const;
void update();

View File

@ -46,7 +46,6 @@
// #include "dataenginebindings_p.h"
#include <QDebug>
void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
@ -61,7 +60,6 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
Units *units = new Units(context);
context->setContextProperty("units", units);
if (!engine->rootContext()->contextObject()) {
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine);
@ -92,9 +90,9 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
qmlRegisterType<ToolTip>(uri, 2, 0, "ToolTipArea");
qmlRegisterInterface<Plasma::Service>("Service");
qRegisterMetaType<Plasma::Service*>("Service");
qRegisterMetaType<Plasma::Service *>("Service");
qmlRegisterInterface<Plasma::ServiceJob>("ServiceJob");
qRegisterMetaType<Plasma::ServiceJob*>("ServiceJob");
qRegisterMetaType<Plasma::ServiceJob *>("ServiceJob");
qmlRegisterType<ServiceOperationStatus>(uri, 2, 0, "ServiceOperationStatus");
qmlRegisterType<QAbstractItemModel>();
@ -102,11 +100,10 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
qmlRegisterType<IconItem>(uri, 2, 0, "IconItem");
qmlRegisterInterface<Plasma::DataSource>("DataSource");
qRegisterMetaType<Plasma::DataSource*>("DataSource");
qRegisterMetaType<Plasma::DataSource *>("DataSource");
qmlRegisterType<Plasma::WindowThumbnail>(uri, 2, 0, "WindowThumbnail");
}
#include "corebindingsplugin.moc"

View File

@ -38,5 +38,4 @@ public:
void registerTypes(const char *uri);
};
#endif

View File

@ -67,7 +67,7 @@ int qScriptRegisterMapMetaType(
QScriptEngine *engine,
const QScriptValue &prototype = QScriptValue()
#ifndef qdoc
, T * /* dummy */ = 0
, T * /* dummy */ = 0
#endif
)
{

View File

@ -27,14 +27,14 @@
namespace Plasma
{
SortFilterModel::SortFilterModel(QObject* parent)
SortFilterModel::SortFilterModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
setObjectName("SortFilterModel");
setDynamicSortFilter(true);
connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SIGNAL(countChanged()));
connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SIGNAL(countChanged()));
connect(this, SIGNAL(modelReset()),
this, SIGNAL(countChanged()));
@ -70,7 +70,7 @@ int SortFilterModel::roleNameToId(const QString &name)
return m_roleIds.value(name);
}
void SortFilterModel::setModel(QAbstractItemModel* model)
void SortFilterModel::setModel(QAbstractItemModel *model)
{
if (model == sourceModel()) {
return;
@ -165,10 +165,10 @@ int SortFilterModel::mapRowFromSource(int row) const
return mapFromSource(idx).row();
}
DataModel::DataModel(QObject* parent)
DataModel::DataModel(QObject *parent)
: QAbstractItemModel(parent),
m_dataSource(0),
m_maxRoleId(Qt::UserRole+1)
m_maxRoleId(Qt::UserRole + 1)
{
//There is one reserved role name: DataEngineSource
m_roleNames[m_maxRoleId] = "DataEngineSource";
@ -176,9 +176,9 @@ DataModel::DataModel(QObject* parent)
++m_maxRoleId;
setObjectName("DataModel");
connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SIGNAL(countChanged()));
connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SIGNAL(countChanged()));
connect(this, SIGNAL(modelReset()),
this, SIGNAL(countChanged()));
@ -215,7 +215,7 @@ void DataModel::dataUpdated(const QString &sourceName, const QVariantMap &data)
} else {
//a key that matches the one we want exists and is a list of DataEngine::Data
if (data.contains(m_keyRoleFilter) &&
data.value(m_keyRoleFilter).canConvert<QVariantList>()) {
data.value(m_keyRoleFilter).canConvert<QVariantList>()) {
setItems(sourceName, data.value(m_keyRoleFilter).value<QVariantList>());
} else if (m_keyRoleFilterRE.isValid()) {
//try to match the key we want with a regular expression if set
@ -265,7 +265,7 @@ QObject *DataModel::dataSource() const
return m_dataSource;
}
void DataModel::setKeyRoleFilter(const QString& key)
void DataModel::setKeyRoleFilter(const QString &key)
{
// the "key role filter" can be used in one of three ways:
//
@ -287,7 +287,7 @@ QString DataModel::keyRoleFilter() const
return m_keyRoleFilter;
}
void DataModel::setSourceFilter(const QString& key)
void DataModel::setSourceFilter(const QString &key)
{
if (m_sourceFilter == key) {
return;
@ -410,7 +410,7 @@ void DataModel::removeSource(const QString &sourceName)
QVariant DataModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.column() > 0 ||
index.row() < 0 || index.row() >= countItems()){
index.row() < 0 || index.row() >= countItems()) {
return QVariant();
}

View File

@ -34,7 +34,6 @@ namespace Plasma
class DataSource;
class DataModel;
class SortFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
@ -71,7 +70,7 @@ class SortFilterModel : public QSortFilterProxyModel
friend class DataModel;
public:
SortFilterModel(QObject* parent=0);
SortFilterModel(QObject *parent = 0);
~SortFilterModel();
void setModel(QAbstractItemModel *source);
@ -87,7 +86,10 @@ public:
void setSortOrder(const Qt::SortOrder order);
int count() const {return QSortFilterProxyModel::rowCount();}
int count() const
{
return QSortFilterProxyModel::rowCount();
}
/**
* Returns the item at index in the list model.
@ -145,7 +147,7 @@ class DataModel : public QAbstractItemModel
Q_PROPERTY(int count READ count NOTIFY countChanged)
public:
DataModel(QObject* parent=0);
DataModel(QObject *parent = 0);
~DataModel();
void setDataSource(QObject *source);
@ -154,13 +156,13 @@ public:
/**
* Include only items with a key that matches this regexp in the model
*/
void setKeyRoleFilter(const QString& key);
void setKeyRoleFilter(const QString &key);
QString keyRoleFilter() const;
/**
* Include only sources that matches this regexp in the model
*/
void setSourceFilter(const QString& key);
void setSourceFilter(const QString &key);
QString sourceFilter() const;
int roleNameToId(const QString &name);
@ -175,7 +177,10 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
int count() const {return countItems();}
int count() const
{
return countItems();
}
/**
* Returns the item at index in the list model.

View File

@ -24,7 +24,7 @@
namespace Plasma
{
DataSource::DataSource(QObject* parent)
DataSource::DataSource(QObject *parent)
: QObject(parent),
m_interval(0),
m_dataEngine(0),
@ -128,12 +128,12 @@ void DataSource::setupData()
* recommendations engine.
*/
m_dataEngine = engine;
connect(m_dataEngine, SIGNAL(sourceAdded(const QString&)), this, SIGNAL(sourcesChanged()), Qt::QueuedConnection);
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SIGNAL(sourcesChanged()));
connect(m_dataEngine, SIGNAL(sourceAdded(QString)), this, SIGNAL(sourcesChanged()), Qt::QueuedConnection);
connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SIGNAL(sourcesChanged()));
connect(m_dataEngine, SIGNAL(sourceAdded(const QString&)), this, SIGNAL(sourceAdded(const QString&)), Qt::QueuedConnection);
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SLOT(removeSource(const QString&)));
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SIGNAL(sourceRemoved(const QString&)));
connect(m_dataEngine, SIGNAL(sourceAdded(QString)), this, SIGNAL(sourceAdded(QString)), Qt::QueuedConnection);
connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SLOT(removeSource(QString)));
connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SIGNAL(sourceRemoved(QString)));
}
foreach (const QString &source, m_connectedSources) {
@ -163,7 +163,7 @@ void DataSource::modelChanged(const QString &sourceName, QAbstractItemModel *mod
m_models->insert(sourceName, QVariant::fromValue(model));
//FIXME: this will break in the case a second model is set
connect(model, &QObject::destroyed, [=]() {
connect(model, &QObject::destroyed, [ = ]() {
m_models->clear(sourceName);
});
}
@ -189,7 +189,7 @@ void DataSource::removeSource(const QString &source)
}
}
QObject* DataSource::serviceForSource(const QString &source)
QObject *DataSource::serviceForSource(const QString &source)
{
if (!m_services.contains(source)) {
Plasma::Service *service = m_dataEngine->serviceForSource(source);

View File

@ -30,10 +30,8 @@
#include <Plasma/DataEngineConsumer>
#include <Plasma/DataEngine>
class QQmlPropertyMap;
namespace Plasma
{
class DataEngine;
@ -51,19 +49,25 @@ public:
typedef QMap<QString, QVariant> Data;
DataSource(QObject* parent=0);
DataSource(QObject *parent = 0);
/**
* true if the connection to the Plasma DataEngine is valid
*/
Q_PROPERTY(bool valid READ valid)
bool valid() const {return m_dataEngine && m_dataEngine->isValid();}
bool valid() const
{
return m_dataEngine && m_dataEngine->isValid();
}
/**
* Polling interval in milliseconds when the data will be fetched again. If 0 no polling will be done.
*/
Q_PROPERTY(int interval READ interval WRITE setInterval NOTIFY intervalChanged)
int interval() const {return m_interval;}
int interval() const
{
return m_interval;
}
void setInterval(const int interval);
/**
@ -71,28 +75,44 @@ public:
*/
Q_PROPERTY(QString dataEngine READ engine WRITE setEngine NOTIFY engineChanged)
Q_PROPERTY(QString engine READ engine WRITE setEngine NOTIFY engineChanged)
QString engine() const {return m_engine;}
QString engine() const
{
return m_engine;
}
void setEngine(const QString &e);
/**
* String array of all the source names connected to the DataEngine
*/
Q_PROPERTY(QStringList connectedSources READ connectedSources WRITE setConnectedSources NOTIFY connectedSourcesChanged)
QStringList connectedSources() const {return m_connectedSources;}
QStringList connectedSources() const
{
return m_connectedSources;
}
void setConnectedSources(const QStringList &s);
/**
* Read only string array of all the sources available from the DataEngine (connected or not)
*/
Q_PROPERTY(QStringList sources READ sources NOTIFY sourcesChanged)
QStringList sources() const {if (m_dataEngine) return m_dataEngine->sources(); else return QStringList();}
QStringList sources() const
{
if (m_dataEngine) {
return m_dataEngine->sources();
} else {
return QStringList();
}
}
/**
* All the data fetched by this dataengine.
* This is a map of maps. At the first level, there are the source names, at the second, they keys set by the DataEngine
*/
Q_PROPERTY(QQmlPropertyMap *data READ data CONSTANT);
QQmlPropertyMap *data() const {return m_data;}
QQmlPropertyMap *data() const
{
return m_data;
}
/**
* All the models associated to this DataEngine, indexed by source.
@ -100,13 +120,16 @@ public:
* The user has to be connected to its source, so the source name has to be present in the connectedSources property.
*/
Q_PROPERTY(QQmlPropertyMap *models READ models CONSTANT);
QQmlPropertyMap *models() const {return m_models;}
QQmlPropertyMap *models() const
{
return m_models;
}
/**
* @returns a Plasma::Service given a source name
* @arg QString source source name we want a service of
*/
Q_INVOKABLE QObject* serviceForSource(const QString &source);
Q_INVOKABLE QObject *serviceForSource(const QString &source);
/**
* Connect a new source. It adds it to connectedSources
@ -142,8 +165,8 @@ private:
QString m_engine;
QQmlPropertyMap *m_data;
QQmlPropertyMap *m_models;
Plasma::DataEngine* m_dataEngine;
Plasma::DataEngineConsumer* m_dataEngineConsumer;
Plasma::DataEngine *m_dataEngine;
Plasma::DataEngineConsumer *m_dataEngineConsumer;
QStringList m_connectedSources;
QStringList m_oldSources;
QStringList m_newSources;

View File

@ -96,7 +96,7 @@ bool FrameSvgItemMargins::isFixed() const
FrameSvgItem::FrameSvgItem(QQuickItem *parent)
: QQuickItem(parent),
m_textureChanged(false)
m_textureChanged(false)
{
m_frameSvg = new Plasma::FrameSvg(this);
m_margins = new FrameSvgItemMargins(m_frameSvg, this);
@ -107,7 +107,6 @@ FrameSvgItem::FrameSvgItem(QQuickItem *parent)
connect(&m_units, &Units::devicePixelRatioChanged, this, &FrameSvgItem::updateDevicePixelRatio);
}
FrameSvgItem::~FrameSvgItem()
{
}
@ -145,7 +144,6 @@ QString FrameSvgItem::imagePath() const
return m_frameSvg->imagePath();
}
void FrameSvgItem::setPrefix(const QString &prefix)
{
if (m_prefix == prefix) {
@ -190,8 +188,9 @@ FrameSvgItemMargins *FrameSvgItem::fixedMargins() const
void FrameSvgItem::setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders)
{
if (m_frameSvg->enabledBorders() == borders)
if (m_frameSvg->enabledBorders() == borders) {
return;
}
m_frameSvg->setEnabledBorders(borders);
emit enabledBordersChanged();
@ -210,7 +209,7 @@ bool FrameSvgItem::hasElementPrefix(const QString &prefix) const
}
void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
const QRectF &oldGeometry)
{
if (isComponentComplete()) {
m_frameSvg->resizeFrame(newGeometry.size());
@ -270,7 +269,7 @@ Plasma::FrameSvg *FrameSvgItem::frameSvg() const
return m_frameSvg;
}
QSGNode* FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData*)
QSGNode *FrameSvgItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *)
{
if (!window() || !m_frameSvg || !m_frameSvg->hasElementPrefix(m_prefix)) {
delete oldNode;
@ -303,7 +302,6 @@ void FrameSvgItem::componentComplete()
m_textureChanged = true;
}
void FrameSvgItem::updateDevicePixelRatio()
{
//devicepixelratio is always set integer in the svg, so needs at least 192dpi to double up.

View File

@ -27,9 +27,10 @@
#include "units.h"
namespace Plasma {
namespace Plasma
{
class FrameSvg;
class FrameSvg;
class FrameSvgItemMargins : public QObject
{
@ -128,7 +129,7 @@ class FrameSvgItem : public QQuickItem
Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged)
public:
FrameSvgItem(QQuickItem *parent=0);
FrameSvgItem(QQuickItem *parent = 0);
~FrameSvgItem();
void setImagePath(const QString &path);
@ -144,7 +145,7 @@ public:
FrameSvgItemMargins *fixedMargins() const;
void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
const QRectF &oldGeometry);
void setImplicitWidth(qreal width);
qreal implicitWidth() const;
@ -162,9 +163,9 @@ public:
* to draw a frame
* @param prefix the given prefix we want to check if drawable
*/
Q_INVOKABLE bool hasElementPrefix(const QString & prefix) const;
Q_INVOKABLE bool hasElementPrefix(const QString &prefix) const;
virtual QSGNode* updatePaintNode(QSGNode*, UpdatePaintNodeData*);
virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
protected:
virtual void componentComplete();

View File

@ -29,7 +29,6 @@
#include <plasma/svg.h>
QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
{
if (from.isNull() && to.isNull()) {
@ -43,7 +42,7 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
QRect startRect(from.rect());
QRect targetRect(to.rect());
QSize pixmapSize = startRect.size().expandedTo(targetRect.size());
QRect toRect = QRect(QPoint(0,0), pixmapSize);
QRect toRect = QRect(QPoint(0, 0), pixmapSize);
targetRect.moveCenter(toRect.center());
startRect.moveCenter(toRect.center());
@ -54,8 +53,8 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
// If the native paint engine supports Porter/Duff compositing and CompositionMode_Plus
QPaintEngine *paintEngine = from.paintEngine();
if (paintEngine &&
paintEngine->hasFeature(QPaintEngine::PorterDuff) &&
paintEngine->hasFeature(QPaintEngine::BlendModes)) {
paintEngine->hasFeature(QPaintEngine::PorterDuff) &&
paintEngine->hasFeature(QPaintEngine::BlendModes)) {
QPixmap startPixmap(pixmapSize);
startPixmap.fill(Qt::transparent);
@ -163,7 +162,7 @@ IconItem::IconItem(QQuickItem *parent)
{
m_loadPixmapTimer.setSingleShot(true);
m_loadPixmapTimer.setInterval(150);
connect(&m_loadPixmapTimer, &QTimer::timeout, [=] () {
connect(&m_loadPixmapTimer, &QTimer::timeout, [ = ]() {
loadPixmap();
});
@ -183,7 +182,6 @@ IconItem::IconItem(QQuickItem *parent)
connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()),
this, SIGNAL(implicitHeightChanged()));
connect(this, SIGNAL(enabledChanged()),
&m_loadPixmapTimer, SLOT(start()));
@ -192,7 +190,6 @@ IconItem::IconItem(QQuickItem *parent)
setImplicitHeight(KIconLoader::global()->currentSize(KIconLoader::Dialog));
}
IconItem::~IconItem()
{
}
@ -226,7 +223,7 @@ void IconItem::setSource(const QVariant &source)
m_icon = QIcon();
connect(m_svgIcon, SIGNAL(repaintNeeded()), this, SLOT(loadPixmap()));
//ok, svg not available
//ok, svg not available
} else {
m_icon = QIcon::fromTheme(source.toString());
delete m_svgIcon;
@ -318,7 +315,7 @@ void IconItem::paint(QPainter *painter)
const int iconSize = adjustedSize(qMin(boundingRect().size().width(), boundingRect().size().height()));
const QRect destRect(QPointF(boundingRect().center() - QPointF(iconSize/2, iconSize/2)).toPoint(),
const QRect destRect(QPointF(boundingRect().center() - QPointF(iconSize / 2, iconSize / 2)).toPoint(),
QSize(iconSize, iconSize));
if (m_animation->state() == QAbstractAnimation::Running) {
@ -326,7 +323,7 @@ void IconItem::paint(QPainter *painter)
result = transition(result,
m_iconPixmaps.last(), m_animValue);
painter->drawPixmap(destRect, result);
//simpler logic for just paint
//simpler logic for just paint
} else {
painter->drawPixmap(destRect, m_iconPixmaps.first());
}
@ -349,13 +346,13 @@ void IconItem::valueChanged(const QVariant &value)
int IconItem::adjustedSize(int size)
{
//FIXME: Heuristic: allow 24x24 for icons/ that are in the systray(ugly)
//FIXME: Heuristic: allow 24x24 for icons/ that are in the systray(ugly)
if (m_svgIcon && m_svgIcon->imagePath().contains("icons/") &&
size > KIconLoader::SizeSmallMedium &&
size < KIconLoader::SizeMedium) {
size > KIconLoader::SizeSmallMedium &&
size < KIconLoader::SizeMedium) {
return 24;
//if size is less than 16, leave as is
//if size is less than 16, leave as is
} else if (size < KIconLoader::SizeSmall) {
//do nothing
} else if (size < KIconLoader::SizeSmallMedium) {
@ -366,7 +363,7 @@ int IconItem::adjustedSize(int size)
return KIconLoader::SizeMedium;
} else if (size < KIconLoader::SizeHuge) {
return KIconLoader::SizeLarge;
//if size is more than 64, leave as is
//if size is more than 64, leave as is
}
return size;
@ -378,7 +375,7 @@ void IconItem::loadPixmap()
//final pixmap to paint
QPixmap result;
if (size<=0) {
if (size <= 0) {
//m_iconPixmaps.clear();
m_animation->stop();
update();

View File

@ -28,8 +28,9 @@
class QPropertyAnimation;
namespace Plasma {
class Svg;
namespace Plasma
{
class Svg;
}
class IconItem : public QQuickPaintedItem
@ -43,7 +44,7 @@ class IconItem : public QQuickPaintedItem
public:
IconItem(QQuickItem *parent=0);
IconItem(QQuickItem *parent = 0);
~IconItem();
void setSource(const QVariant &source);

View File

@ -19,8 +19,6 @@
#include "serviceoperationstatus.h"
ServiceOperationStatus::ServiceOperationStatus(QObject *parent)
: QObject(parent),
m_enabled(false)

View File

@ -23,8 +23,9 @@
#include "plasma/service.h"
namespace Plasma {
class Service;
namespace Plasma
{
class Service;
}
class ServiceOperationStatus : public QObject
@ -47,7 +48,7 @@ class ServiceOperationStatus : public QObject
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
public:
ServiceOperationStatus(QObject *parent=0);
ServiceOperationStatus(QObject *parent = 0);
~ServiceOperationStatus();
void setService(Plasma::Service *service);
@ -73,5 +74,4 @@ private:
bool m_enabled;
};
#endif

View File

@ -43,7 +43,6 @@ SvgItem::SvgItem(QQuickItem *parent)
connect(&m_units, &Units::devicePixelRatioChanged, this, &SvgItem::updateDevicePixelRatio);
}
SvgItem::~SvgItem()
{
}
@ -85,7 +84,6 @@ QSizeF SvgItem::naturalSize() const
return m_svg.data()->size();
}
void SvgItem::setSvg(Plasma::Svg *svg)
{
if (m_svg) {
@ -100,7 +98,6 @@ void SvgItem::setSvg(Plasma::Svg *svg)
connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
}
if (implicitWidth() <= 0) {
setImplicitWidth(naturalSize().width());
}

View File

@ -24,9 +24,10 @@
#include "units.h"
namespace Plasma {
namespace Plasma
{
class Svg;
class Svg;
class SvgItem : public QQuickItem
{
@ -47,7 +48,7 @@ class SvgItem : public QQuickItem
* </code>
* Instead of a Svg declaration it can also be the id of a Svg declared elsewhere, useful to share Svg instances.
*/
Q_PROPERTY(Plasma::Svg * svg READ svg WRITE setSvg NOTIFY svgChanged)
Q_PROPERTY(Plasma::Svg *svg READ svg WRITE setSvg NOTIFY svgChanged)
/**
* The natural, unscaled size of the svg document or the element. useful if a pixel perfect rendering of outlines is needed.
@ -70,7 +71,7 @@ class SvgItem : public QQuickItem
Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged)
public:
SvgItem(QQuickItem *parent=0);
SvgItem(QQuickItem *parent = 0);
~SvgItem();
void setElementId(const QString &elementID);
@ -90,7 +91,7 @@ public:
void setImplicitHeight(qreal height);
qreal implicitHeight() const;
QSGNode* updatePaintNode(QSGNode * oldNode, UpdatePaintNodeData * updatePaintNodeData);
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData);
Q_SIGNALS:
void elementIdChanged();

View File

@ -22,7 +22,8 @@
#include <QSGSimpleTextureNode>
namespace Plasma {
namespace Plasma
{
/**
* This class wraps QSGSimpleTextureNode
@ -31,18 +32,19 @@ namespace Plasma {
class SVGTextureNode : public QSGSimpleTextureNode
{
public:
SVGTextureNode() {}
/**
* Set the current texture
* the object takes ownership of the texture
*/
void setTexture(QSGTexture *texture) {
m_texture.reset(texture);
QSGSimpleTextureNode::setTexture(texture);
}
private:
QScopedPointer<QSGTexture> m_texture;
public:
SVGTextureNode() {}
/**
* Set the current texture
* the object takes ownership of the texture
*/
void setTexture(QSGTexture *texture)
{
m_texture.reset(texture);
QSGSimpleTextureNode::setTexture(texture);
}
private:
QScopedPointer<QSGTexture> m_texture;
};
}

View File

@ -316,7 +316,7 @@ void ToolTip::hoverEnterEvent(QHoverEvent *event)
//FIXME: showToolTip needs to be renamed in sync or something like that
showToolTip();
} else if (m_mainItem ||
(!mainText().isEmpty() && !subText().isEmpty())) {
(!mainText().isEmpty() && !subText().isEmpty())) {
m_showTimer->start(m_interval);
}
}

View File

@ -47,7 +47,7 @@ ToolTipDialog::ToolTipDialog(QQuickItem *parent)
m_showTimer = new QTimer(this);
m_showTimer->setSingleShot(true);
connect(m_showTimer, &QTimer::timeout, [=]() {
connect(m_showTimer, &QTimer::timeout, [ = ]() {
setVisible(false);
});
}

View File

@ -33,7 +33,7 @@ class QPropertyAnimation;
namespace KDeclarative
{
class QmlObject;
class QmlObject;
}
/**

View File

@ -36,7 +36,7 @@ const QString plasmarc = QStringLiteral("plasmarc");
const QString groupName = QStringLiteral("Units");
const int defaultLongDuration = 250;
Units::Units (QObject *parent)
Units::Units(QObject *parent)
: QObject(parent),
m_gridUnit(-1),
m_devicePixelRatio(-1),
@ -194,7 +194,6 @@ void Units::updateSpacing()
}
}
int Units::longDuration() const
{
return m_longDuration;

View File

@ -30,18 +30,19 @@
#include <xcb/composite.h>
#if HAVE_GLX
#include <GL/glx.h>
typedef void (*glXBindTexImageEXT_func)(Display* dpy, GLXDrawable drawable,
int buffer, const int* attrib_list);
typedef void (*glXReleaseTexImageEXT_func)(Display* dpy, GLXDrawable drawable, int buffer);
typedef void (*glXBindTexImageEXT_func)(Display *dpy, GLXDrawable drawable,
int buffer, const int *attrib_list);
typedef void (*glXReleaseTexImageEXT_func)(Display *dpy, GLXDrawable drawable, int buffer);
#endif
#if HAVE_EGL
typedef EGLImageKHR(*eglCreateImageKHR_func)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*);
typedef EGLImageKHR(*eglCreateImageKHR_func)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *);
typedef EGLBoolean(*eglDestroyImageKHR_func)(EGLDisplay, EGLImageKHR);
typedef GLvoid(*glEGLImageTargetTexture2DOES_func)(GLenum, GLeglImageOES);
#endif // HAVE_EGL
#endif
namespace Plasma {
namespace Plasma
{
WindowTextureNode::WindowTextureNode()
: QSGSimpleTextureNode()
@ -58,7 +59,7 @@ void WindowTextureNode::reset(QSGTexture *texture)
m_texture.reset(texture);
}
WindowThumbnail::WindowThumbnail(QQuickItem* parent)
WindowThumbnail::WindowThumbnail(QQuickItem *parent)
: QQuickItem(parent)
, QAbstractNativeEventFilter()
, m_xcb(false)
@ -80,7 +81,7 @@ WindowThumbnail::WindowThumbnail(QQuickItem* parent)
#endif
{
setFlag(ItemHasContents);
connect(this, &QQuickItem::windowChanged, [this](QQuickWindow *window) {
connect(this, &QQuickItem::windowChanged, [this](QQuickWindow * window) {
if (!window) {
return;
}
@ -88,7 +89,7 @@ WindowThumbnail::WindowThumbnail(QQuickItem* parent)
stopRedirecting();
startRedirecting();
});
if (QGuiApplication *gui = dynamic_cast<QGuiApplication*>(QCoreApplication::instance())) {
if (QGuiApplication *gui = dynamic_cast<QGuiApplication *>(QCoreApplication::instance())) {
m_xcb = (gui->platformName() == QStringLiteral("xcb"));
if (m_xcb) {
gui->installNativeEventFilter(this);
@ -141,7 +142,7 @@ void WindowThumbnail::setWinId(uint32_t winId)
QSGNode *WindowThumbnail::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
{
Q_UNUSED(updatePaintNodeData)
auto *node = static_cast<WindowTextureNode*>(oldNode);
auto *node = static_cast<WindowTextureNode *>(oldNode);
if (!node) {
node = new WindowTextureNode();
node->setFiltering(QSGTexture::Linear);
@ -153,8 +154,8 @@ QSGNode *WindowThumbnail::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
}
node->setRect(boundingRect());
const QSize size(node->texture()->textureSize().scaled(boundingRect().size().toSize(), Qt::KeepAspectRatio));
const qreal x = boundingRect().x() + (boundingRect().width() - size.width())/2;
const qreal y = boundingRect().y() + (boundingRect().height() - size.height())/2;
const qreal x = boundingRect().x() + (boundingRect().width() - size.width()) / 2;
const qreal y = boundingRect().y() + (boundingRect().height() - size.height()) / 2;
node->setRect(QRectF(QPointF(x, y), size));
return node;
}
@ -167,15 +168,15 @@ bool WindowThumbnail::nativeEventFilter(const QByteArray &eventType, void *messa
return false;
}
#if HAVE_XCB_COMPOSITE
xcb_generic_event_t *event = static_cast<xcb_generic_event_t*>(message);
xcb_generic_event_t *event = static_cast<xcb_generic_event_t *>(message);
const uint8_t responseType = event->response_type & ~0x80;
if (responseType == m_damageEventBase + XCB_DAMAGE_NOTIFY) {
if (reinterpret_cast<xcb_damage_notify_event_t*>(event)->drawable == m_winId) {
if (reinterpret_cast<xcb_damage_notify_event_t *>(event)->drawable == m_winId) {
m_damaged = true;
update();
}
} else if (responseType == XCB_CONFIGURE_NOTIFY) {
if (reinterpret_cast<xcb_configure_notify_event_t*>(event)->window == m_winId) {
if (reinterpret_cast<xcb_configure_notify_event_t *>(event)->window == m_winId) {
// TODO: only discard if size changes
discardPixmap();
}
@ -253,8 +254,8 @@ bool WindowThumbnail::xcbWindowToTextureEGL(WindowTextureNode *textureNode)
EGL_NONE
};
m_image = ((eglCreateImageKHR_func)(m_eglCreateImageKHR))(eglGetCurrentDisplay(), EGL_NO_CONTEXT,
EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer)m_pixmap, attribs);
EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer)m_pixmap, attribs);
if (m_image == EGL_NO_IMAGE_KHR) {
qDebug() << "failed to create egl image";
@ -402,10 +403,11 @@ bool WindowThumbnail::loadGLXTexture()
XVisualInfo *vi = glXGetVisualFromFBConfig(d, fbConfigs[0]);
int textureFormat;
if (window()->openglContext()->format().hasAlpha())
if (window()->openglContext()->format().hasAlpha()) {
textureFormat = bindRgba ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT;
else
} else {
textureFormat = bindRgb ? GLX_TEXTURE_FORMAT_RGB_EXT : GLX_TEXTURE_FORMAT_RGBA_EXT;
}
XFree(vi);
// we assume that Texture_2D is supported as we have a QtQuick OpenGL context

View File

@ -37,7 +37,8 @@
#endif // HAVE_XCB_COMPOSITE
class KWindowInfo;
namespace Plasma {
namespace Plasma
{
class WindowTextureNode;

View File

@ -19,6 +19,4 @@
#include "enums.h"
#include "moc_enums.cpp"

View File

@ -22,7 +22,6 @@
#include <QObject>
class DialogStatus : public QObject
{
Q_OBJECT
@ -66,5 +65,4 @@ public:
};
};
#endif // ENUMS_H

View File

@ -138,6 +138,5 @@ void FullScreenSheet::open()
}
}
#include "fullscreensheet.moc"

View File

@ -41,18 +41,17 @@
#include <Plasma/Corona>
#include <Plasma/WindowEffects>
uint FullScreenWindow::s_numItems = 0;
class Background : public QWidget
{
public:
Background(FullScreenWindow *dialog)
: QWidget( 0L ),
: QWidget(0L),
m_dialog(dialog)
{
setAttribute( Qt::WA_NoSystemBackground );
setAttribute( Qt::WA_TranslucentBackground );
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::FramelessWindowHint | Qt::CustomizeWindowHint);
KWindowSystem::setOnAllDesktops(winId(), true);
@ -63,9 +62,9 @@ public:
~Background()
{}
void paintEvent( QPaintEvent *e )
void paintEvent(QPaintEvent *e)
{
QPainter painter( this );
QPainter painter(this);
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.fillRect(e->rect(), QColor(0, 0, 0, 80));
}
@ -151,7 +150,7 @@ void FullScreenWindow::init(const QString &componentName)
QDeclarativeContext *creationContext = component->creationContext();
m_rootObject = component->create(creationContext);
if (component->status() == QDeclarativeComponent::Error) {
qWarning()<<component->errors();
qWarning() << component->errors();
}
if (m_rootObject) {
@ -220,8 +219,8 @@ void FullScreenWindow::syncViewToMainItem()
}
m_declarativeItemContainer->setDeclarativeItem(di);
} else {
m_mainItem.data()->setY(-10000*s_numItems);
m_mainItem.data()->setY(10000*s_numItems);
m_mainItem.data()->setY(-10000 * s_numItems);
m_mainItem.data()->setY(10000 * s_numItems);
}
break;
}
@ -235,7 +234,6 @@ void FullScreenWindow::syncViewToMainItem()
m_view->setScene(scene);
QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()),
QSizeF(m_mainItem.data()->boundingRect().size()));
if (m_declarativeItemContainer) {
@ -244,12 +242,12 @@ void FullScreenWindow::syncViewToMainItem()
} else {
QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()),
QSizeF(m_mainItem.data()->boundingRect().size()));
QSizeF(m_mainItem.data()->boundingRect().size()));
m_view->resize(itemGeometry.size().toSize());
m_view->setSceneRect(itemGeometry);
}
m_view->move(QApplication::desktop()->availableGeometry().center() - QPoint(m_view->width()/2, m_view->height()/2));
m_view->move(QApplication::desktop()->availableGeometry().center() - QPoint(m_view->width() / 2, m_view->height() / 2));
}
void FullScreenWindow::syncMainItemToView()
@ -266,7 +264,7 @@ void FullScreenWindow::syncMainItemToView()
m_view->setSceneRect(m_declarativeItemContainer->geometry());
} else {
QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()),
QSizeF(m_mainItem.data()->boundingRect().size()));
QSizeF(m_mainItem.data()->boundingRect().size()));
m_view->setSceneRect(itemGeometry);
}
}
@ -297,7 +295,6 @@ QGraphicsView *FullScreenWindow::view() const
return m_view;
}
QDeclarativeListProperty<QGraphicsObject> FullScreenWindow::title()
{
if (m_rootObject) {
@ -334,7 +331,6 @@ DialogStatus::Status FullScreenWindow::status() const
}
}
void FullScreenWindow::statusHasChanged()
{
if (status() == DialogStatus::Closed) {
@ -373,22 +369,17 @@ void FullScreenWindow::close()
}
}
bool FullScreenWindow::eventFilter(QObject *watched, QEvent *event)
{
if (watched == m_mainItem.data() &&
(event->type() == QEvent::GraphicsSceneResize)) {
(event->type() == QEvent::GraphicsSceneResize)) {
syncViewToMainItem();
} else if (watched == m_view &&
(event->type() == QEvent::Resize)) {
(event->type() == QEvent::Resize)) {
syncMainItemToView();
}
return false;
}
#include "fullscreenwindow.moc"

View File

@ -43,7 +43,6 @@ class FullScreenWindow : public QDeclarativeItem
Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> buttons READ buttons DESIGNABLE false)
Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged)
public:
FullScreenWindow(QDeclarativeItem *parent = 0);
~FullScreenWindow();
@ -73,7 +72,6 @@ Q_SIGNALS:
void clickedOutside();
void statusChanged();
private Q_SLOTS:
void syncViewToMainItem();
void syncMainItemToView();

View File

@ -37,7 +37,7 @@
class BKSingleton
{
public:
EngineBookKeeping self;
EngineBookKeeping self;
};
Q_GLOBAL_STATIC(BKSingleton, privateBKSelf)
@ -63,8 +63,8 @@ QQmlEngine *EngineBookKeeping::engine() const
void EngineBookKeeping::insertEngine(QQmlEngine *engine)
{
connect(engine, SIGNAL(destroyed(QObject *)),
this, SLOT(engineDestroyed(QObject *)));
connect(engine, SIGNAL(destroyed(QObject*)),
this, SLOT(engineDestroyed(QObject*)));
m_engines.insert(engine);
}
@ -73,8 +73,6 @@ void EngineBookKeeping::engineDestroyed(QObject *deleted)
m_engines.remove(static_cast<QQmlEngine *>(deleted));
}
void PlasmaComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{
QQmlExtensionPlugin::initializeEngine(engine, uri);
@ -91,7 +89,7 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri)
qmlRegisterType<QMenuProxy>(uri, 2, 0, "Menu");
qmlRegisterType<QMenuItem>(uri, 2, 0, "MenuItem");
} else {
// qmlRegisterType<FullScreenSheet>(uri, 2, 0, "Sheet");
// qmlRegisterType<FullScreenSheet>(uri, 2, 0, "Sheet");
}
qmlRegisterType<Plasma::QRangeModel>(uri, 2, 0, "RangeModel");
@ -101,6 +99,5 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<PageStatus>(uri, 2, 0, "PageStatus", "");
}
#include "moc_plasmacomponentsplugin.cpp"

View File

@ -42,7 +42,7 @@ private Q_SLOTS:
void engineDestroyed(QObject *deleted);
private:
QSet <QQmlEngine*> m_engines;
QSet <QQmlEngine *> m_engines;
};
class PlasmaComponentsPlugin : public QQmlExtensionPlugin

View File

@ -26,13 +26,13 @@
#include <QQuickItem>
#include "plasmacomponentsplugin.h"
QMenuProxy::QMenuProxy (QObject *parent)
QMenuProxy::QMenuProxy(QObject *parent)
: QObject(parent),
m_status(DialogStatus::Closed)
{
m_menu = new QMenu(0);
connect(m_menu, &QMenu::triggered, this, &QMenuProxy::itemTriggered);
connect(m_menu, &QMenu::aboutToHide, [=]() {
connect(m_menu, &QMenu::aboutToHide, [ = ]() {
m_status = DialogStatus::Closed;
emit statusChanged();
});
@ -85,7 +85,7 @@ void QMenuProxy::setVisualParent(QObject *parent)
if (action) {
action->setMenu(m_menu);
m_menu->clear();
foreach(QMenuItem* item, m_items) {
foreach (QMenuItem *item, m_items) {
m_menu->addAction(item->action());
}
m_menu->updateGeometry();
@ -179,8 +179,8 @@ void QMenuProxy::open(int x, int y)
{
qDebug() << "opening menu at " << x << y;
m_menu->clear();
foreach(QMenuItem* item, m_items) {
qDebug() <<"Adding action: " << item->text();
foreach (QMenuItem *item, m_items) {
qDebug() << "Adding action: " << item->text();
m_menu->addAction(item->action());
}
@ -200,7 +200,6 @@ void QMenuProxy::open(int x, int y)
emit statusChanged();
}
void QMenuProxy::close()
{
m_menu->hide();

View File

@ -82,7 +82,7 @@ private Q_SLOTS:
void itemTriggered(QAction *item);
private:
QList<QMenuItem*> m_items;
QList<QMenuItem *> m_items;
QMenu *m_menu;
DialogStatus::Status m_status;
QWeakPointer<QObject> m_visualParent;

View File

@ -20,22 +20,21 @@
#include "qmenuitem.h"
QMenuItem::QMenuItem(QQuickItem *parent)
: QQuickItem(parent),
m_action(0)
m_action(0)
{
setAction(new QAction(this));
connect(m_action, &QAction::triggered, this, &QMenuItem::clicked);
}
QAction* QMenuItem::action() const
QAction *QMenuItem::action() const
{
return m_action;
}
void QMenuItem::setAction(QAction* a)
void QMenuItem::setAction(QAction *a)
{
if (m_action != a) {
if (m_action) {
@ -54,7 +53,7 @@ QVariant QMenuItem::icon() const
return m_icon;
}
void QMenuItem::setIcon(const QVariant& i)
void QMenuItem::setIcon(const QVariant &i)
{
m_icon = i;
if (i.canConvert<QIcon>()) {
@ -80,7 +79,7 @@ QString QMenuItem::text() const
return m_action->text();
}
void QMenuItem::setText(const QString& t)
void QMenuItem::setText(const QString &t)
{
if (m_action->text() != t) {
m_action->setText(t);

View File

@ -39,17 +39,17 @@ class QMenuItem : public QQuickItem
Q_PROPERTY(bool separator READ separator WRITE setSeparator NOTIFY separatorChanged)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
Q_PROPERTY(QVariant icon READ icon WRITE setIcon NOTIFY iconChanged)
Q_PROPERTY(QAction* action READ action WRITE setAction NOTIFY actionChanged)
Q_PROPERTY(QAction *action READ action WRITE setAction NOTIFY actionChanged)
Q_PROPERTY(bool checkable READ checkable WRITE setCheckable NOTIFY checkableChanged)
Q_PROPERTY(bool checked READ checked WRITE setChecked NOTIFY toggled)
public:
QMenuItem(QQuickItem *parent = 0);
QAction* action() const;
void setAction(QAction* a);
QAction *action() const;
void setAction(QAction *a);
QVariant icon() const;
void setIcon(const QVariant& i);
void setIcon(const QVariant &i);
bool separator() const;
void setSeparator(bool s);
QString text() const;
@ -72,7 +72,7 @@ Q_SIGNALS:
void checkableChanged();
private:
QAction* m_action;
QAction *m_action;
QVariant m_icon;
};

View File

@ -104,14 +104,16 @@ qreal QRangeModelPrivate::publicPosition(qreal position) const
const qreal positionValueRatio = valueRange ? (max - min) / valueRange : 0;
const qreal positionStep = stepSize * positionValueRatio;
if (positionStep == 0)
if (positionStep == 0) {
return (min < max) ? qBound(min, position, max) : qBound(max, position, min);
}
const int stepSizeMultiplier = (position - min) / positionStep;
// Test whether value is below minimum range
if (stepSizeMultiplier < 0)
if (stepSizeMultiplier < 0) {
return min;
}
qreal leftEdge = (stepSizeMultiplier * positionStep) + min;
qreal rightEdge = ((stepSizeMultiplier + 1) * positionStep) + min;
@ -124,8 +126,9 @@ qreal QRangeModelPrivate::publicPosition(qreal position) const
rightEdge = qMax(rightEdge, max);
}
if (qAbs(leftEdge - position) <= qAbs(rightEdge - position))
if (qAbs(leftEdge - position) <= qAbs(rightEdge - position)) {
return leftEdge;
}
return rightEdge;
}
@ -143,14 +146,16 @@ qreal QRangeModelPrivate::publicValue(qreal value) const
// QML bindings; a position that is initially invalid because it lays
// outside the range, might become valid later if the range changes.
if (stepSize == 0)
if (stepSize == 0) {
return qBound(minimum, value, maximum);
}
const int stepSizeMultiplier = (value - minimum) / stepSize;
// Test whether value is below minimum range
if (stepSizeMultiplier < 0)
if (stepSizeMultiplier < 0) {
return minimum;
}
const qreal leftEdge = qMin(maximum, (stepSizeMultiplier * stepSize) + minimum);
const qreal rightEdge = qMin(maximum, ((stepSizeMultiplier + 1) * stepSize) + minimum);
@ -172,10 +177,12 @@ void QRangeModelPrivate::emitValueAndPositionIfChanged(const qreal oldValue, con
// unchanged. This will be the case when operating with values outside range:
const qreal newValue = q->value();
const qreal newPosition = q->position();
if (!qFuzzyCompare(newValue, oldValue))
if (!qFuzzyCompare(newValue, oldValue)) {
emit q->valueChanged(newValue);
if (!qFuzzyCompare(newPosition, oldPosition))
}
if (!qFuzzyCompare(newPosition, oldPosition)) {
emit q->positionChanged(newPosition);
}
}
/*!
@ -224,8 +231,9 @@ void QRangeModel::setPositionRange(qreal min, qreal max)
bool emitPosAtMinChanged = !qFuzzyCompare(min, d->posatmin);
bool emitPosAtMaxChanged = !qFuzzyCompare(max, d->posatmax);
if (!(emitPosAtMinChanged || emitPosAtMaxChanged))
if (!(emitPosAtMinChanged || emitPosAtMaxChanged)) {
return;
}
const qreal oldPosition = position();
d->posatmin = min;
@ -239,10 +247,12 @@ void QRangeModel::setPositionRange(qreal min, qreal max)
// the positionChanged signal.
d->pos = d->equivalentPosition(d->value);
if (emitPosAtMinChanged)
if (emitPosAtMinChanged) {
emit positionAtMinimumChanged(d->posatmin);
if (emitPosAtMaxChanged)
}
if (emitPosAtMaxChanged) {
emit positionAtMaximumChanged(d->posatmax);
}
d->emitValueAndPositionIfChanged(value(), oldPosition);
}
@ -259,8 +269,9 @@ void QRangeModel::setRange(qreal min, qreal max)
bool emitMinimumChanged = !qFuzzyCompare(min, d->minimum);
bool emitMaximumChanged = !qFuzzyCompare(max, d->maximum);
if (!(emitMinimumChanged || emitMaximumChanged))
if (!(emitMinimumChanged || emitMaximumChanged)) {
return;
}
const qreal oldValue = value();
const qreal oldPosition = position();
@ -271,10 +282,12 @@ void QRangeModel::setRange(qreal min, qreal max)
// Update internal position if it was changed. It can occurs if internal value changes, due to range update
d->pos = d->equivalentPosition(d->value);
if (emitMinimumChanged)
if (emitMinimumChanged) {
emit minimumChanged(d->minimum);
if (emitMaximumChanged)
}
if (emitMaximumChanged) {
emit maximumChanged(d->maximum);
}
d->emitValueAndPositionIfChanged(oldValue, oldPosition);
}
@ -332,8 +345,9 @@ void QRangeModel::setStepSize(qreal stepSize)
Q_D(QRangeModel);
stepSize = qMax(qreal(0.0), stepSize);
if (qFuzzyCompare(stepSize, d->stepSize))
if (qFuzzyCompare(stepSize, d->stepSize)) {
return;
}
const qreal oldValue = value();
const qreal oldPosition = position();
@ -386,8 +400,9 @@ void QRangeModel::setPosition(qreal newPosition)
{
Q_D(QRangeModel);
if (qFuzzyCompare(newPosition, d->pos))
if (qFuzzyCompare(newPosition, d->pos)) {
return;
}
const qreal oldPosition = position();
const qreal oldValue = value();
@ -473,8 +488,9 @@ void QRangeModel::setValue(qreal newValue)
{
Q_D(QRangeModel);
if (qFuzzyCompare(newValue, d->value))
if (qFuzzyCompare(newValue, d->value)) {
return;
}
const qreal oldValue = value();
const qreal oldPosition = position();
@ -497,8 +513,9 @@ void QRangeModel::setValue(qreal newValue)
void QRangeModel::setInverted(bool inverted)
{
Q_D(QRangeModel);
if (inverted == d->inverted)
if (inverted == d->inverted) {
return;
}
d->inverted = inverted;
emit invertedChanged(d->inverted);

View File

@ -113,7 +113,7 @@ Q_SIGNALS:
protected:
QRangeModel(QRangeModelPrivate &dd, QObject *parent);
QRangeModelPrivate* d_ptr;
QRangeModelPrivate *d_ptr;
private:
Q_DISABLE_COPY(QRangeModel)

View File

@ -59,29 +59,35 @@ public:
QRangeModel *q_ptr;
inline qreal effectivePosAtMin() const {
inline qreal effectivePosAtMin() const
{
return inverted ? posatmax : posatmin;
}
inline qreal effectivePosAtMax() const {
inline qreal effectivePosAtMax() const
{
return inverted ? posatmin : posatmax;
}
inline qreal equivalentPosition(qreal value) const {
inline qreal equivalentPosition(qreal value) const
{
// Return absolute position from absolute value
const qreal valueRange = maximum - minimum;
if (valueRange == 0)
if (valueRange == 0) {
return effectivePosAtMin();
}
const qreal scale = (effectivePosAtMax() - effectivePosAtMin()) / valueRange;
return (value - minimum) * scale + effectivePosAtMin();
}
inline qreal equivalentValue(qreal pos) const {
inline qreal equivalentValue(qreal pos) const
{
// Return absolute value from absolute position
const qreal posRange = effectivePosAtMax() - effectivePosAtMin();
if (posRange == 0)
if (posRange == 0) {
return minimum;
}
const qreal scale = (maximum - minimum) / posRange;
return (pos - effectivePosAtMin()) * scale + minimum;

View File

@ -27,7 +27,7 @@
#include <Plasma/Theme>
AppBackgroundProvider::AppBackgroundProvider()
: QQuickImageProvider(QQuickImageProvider::Image)
: QQuickImageProvider(QQuickImageProvider::Image)
{
m_theme = new Plasma::Theme();
}

View File

@ -24,7 +24,7 @@
namespace Plasma
{
class Theme;
class Theme;
}
class AppBackgroundProvider : public QQuickImageProvider

View File

@ -25,7 +25,6 @@
#include <QDebug>
FallbackComponent::FallbackComponent(QObject *parent)
: QObject(parent)
{

View File

@ -20,7 +20,6 @@
#ifndef FALLBACKCOMPONENT_H
#define FALLBACKCOMPONENT_H
#include <QObject>
#include <QCache>
#include <QStringList>
@ -55,16 +54,14 @@ public:
*
* @param key the name of the file to search for
**/
Q_INVOKABLE QString filePath(const QString& key = QString());
Q_INVOKABLE QString filePath(const QString &key = QString());
QString basePath() const;
void setBasePath(const QString &basePath);
QStringList candidates() const;
void setCandidates(const QStringList &candidates);
Q_SIGNALS:
void basePathChanged();
void candidatesChanged();

View File

@ -26,7 +26,6 @@
#include <QtQml>
#include <QQmlEngine>
// #include <KSharedConfig>
// #include <KConfigGroup>
@ -43,6 +42,5 @@ void PlasmaExtraComponentsPlugin::registerTypes(const char *uri)
qmlRegisterType<FallbackComponent>(uri, 2, 0, "FallbackComponent");
}
#include "plasmaextracomponentsplugin.moc"

View File

@ -26,7 +26,6 @@
#include <KActivities/ResourceInstance>
#include <QDebug>
ResourceInstance::ResourceInstance(QQuickItem *parent)
: QQuickItem(parent)
{
@ -56,7 +55,7 @@ void ResourceInstance::syncWid()
} else {
if (m_uri.scheme().startsWith(QLatin1String("http")) && !m_uri.hasQuery() && m_uri.path().endsWith('/')) {
const QString & oldPath = m_uri.path();
const QString &oldPath = m_uri.path();
m_uri.setPath(oldPath.left(oldPath.length() - 1));
// qDebug() << "Old and new path" << oldPath << m_uri;
@ -129,7 +128,6 @@ void ResourceInstance::notifyFocusedIn()
m_resourceInstance->notifyFocusedIn();
}
void ResourceInstance::notifyFocusedOut()
{
//ensure the resource instance exists

View File

@ -22,8 +22,9 @@
#include <QQuickItem>
#include <QUrl>
namespace KActivities {
class ResourceInstance;
namespace KActivities
{
class ResourceInstance;
}
class QTimer;

View File

@ -24,13 +24,13 @@
#include <QDebug>
Application::Private::Private(Application * parent)
Application::Private::Private(Application *parent)
: q(parent)
{
connect(
&process, SIGNAL(stateChanged(QProcess::ProcessState)),
this, SLOT(stateChanged(QProcess::ProcessState))
);
);
process.setProcessChannelMode(QProcess::MergedChannels);
}
@ -40,7 +40,7 @@ void Application::Private::stateChanged(QProcess::ProcessState newState)
//q->runningChanged(running);
}
Application::Application(QObject * parent)
Application::Application(QObject *parent)
: QObject(parent), d(this)
{
}
@ -60,7 +60,7 @@ QString Application::application() const
return d->application;
}
void Application::setApplication(const QString & application)
void Application::setApplication(const QString &application)
{
qDebug() << "setting the application to" << application;
@ -87,10 +87,11 @@ void Application::setRunning(bool run)
qDebug() << "running?" << run;
d->running = run;
if (run)
if (run) {
start();
else
} else {
terminate();
}
}
void Application::start()
@ -107,7 +108,7 @@ void Application::start()
qDebug() << "Starting" << d->application;
d->process.start(d->application);
if(!d->process.waitForStarted()) {
if (!d->process.waitForStarted()) {
qWarning() << "Error" << d->process.error() << "while starting" << d->application;
}

View File

@ -36,7 +36,8 @@
* }
* </code>
*/
class Application: public QObject {
class Application: public QObject
{
Q_OBJECT
/**
@ -51,14 +52,14 @@ class Application: public QObject {
Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged);
public:
Application(QObject * parent = Q_NULLPTR);
Application(QObject *parent = Q_NULLPTR);
~Application();
QString application() const;
bool running() const;
public:
void setApplication(const QString & application);
void setApplication(const QString &application);
void setRunning(bool run);
public Q_SLOTS:
@ -66,7 +67,7 @@ public Q_SLOTS:
void terminate();
Q_SIGNALS:
void applicationChanged(const QString & application);
void applicationChanged(const QString &application);
void runningChanged(bool running);
private:

View File

@ -24,7 +24,8 @@
#include <QProcess>
class Application::Private: public QObject {
class Application::Private: public QObject
{
Q_OBJECT
public:
Private(Application *);
@ -37,7 +38,7 @@ private Q_SLOTS:
void stateChanged(QProcess::ProcessState newState);
private:
Application * const q;
Application *const q;
};
#endif /* APPLICATION_P_H */

View File

@ -31,13 +31,14 @@
/**
*
*/
class IconDialog::Private {
class IconDialog::Private
{
public:
utils::SharedSingleton<KIconDialog> dialog;
};
IconDialog::IconDialog(QObject * parent)
IconDialog::IconDialog(QObject *parent)
: QObject(parent)
{
}

View File

@ -39,11 +39,12 @@
* icon = iconDialog.openDialog()
* </code>
*/
class IconDialog: public QObject {
class IconDialog: public QObject
{
Q_OBJECT
public:
IconDialog(QObject * parent = Q_NULLPTR);
IconDialog(QObject *parent = Q_NULLPTR);
~IconDialog();
Q_INVOKABLE QString openDialog();

View File

@ -24,25 +24,25 @@
#include "application.h"
#include "icondialog.h"
class PlatformComponentsPlugin: public QQmlExtensionPlugin {
class PlatformComponentsPlugin: public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.kde.plasma.platformcomponents")
public:
PlatformComponentsPlugin(QObject * parent = Q_NULLPTR)
PlatformComponentsPlugin(QObject *parent = Q_NULLPTR)
: QQmlExtensionPlugin(parent)
{
qDebug() << "instantiated plugin object";
}
void registerTypes(const char * uri) Q_DECL_OVERRIDE
{
void registerTypes(const char *uri) Q_DECL_OVERRIDE {
qDebug() << "plugin loaded, registering types " << uri;
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.platformcomponents"));
qmlRegisterType<Application> (uri, 2, 0, "Application");
qmlRegisterType<IconDialog> (uri, 2, 0, "IconDialog");
qmlRegisterType<IconDialog> (uri, 2, 0, "IconDialog");
}
};

View File

@ -22,10 +22,12 @@
#include <memory>
namespace utils {
namespace utils
{
template <typename T>
class d_ptr {
class d_ptr
{
private:
std::unique_ptr<T> d;
@ -33,11 +35,11 @@ public:
d_ptr();
template <typename ...Args>
d_ptr(Args && ...);
d_ptr(Args &&...);
~d_ptr();
T * operator->() const;
T *operator->() const;
};
#define D_PTR \

View File

@ -22,7 +22,8 @@
#include <utility>
namespace utils {
namespace utils
{
template <typename T>
d_ptr<T>::d_ptr() : d(new T())
@ -31,8 +32,8 @@ d_ptr<T>::d_ptr() : d(new T())
template <typename T>
template <typename ...Args>
d_ptr<T>::d_ptr(Args && ... args)
: d(new T(std::forward<Args>(args)... ))
d_ptr<T>::d_ptr(Args &&... args)
: d(new T(std::forward<Args>(args)...))
{
}
@ -42,7 +43,7 @@ d_ptr<T>::~d_ptr()
}
template<typename T>
T * d_ptr<T>::operator->() const
T *d_ptr<T>::operator->() const
{
return d.get();
}

View File

@ -22,10 +22,12 @@
#include <memory>
namespace utils {
namespace utils
{
template <typename Target>
class SharedSingleton {
class SharedSingleton
{
public:
static std::shared_ptr<Target> instance()
{

View File

@ -88,14 +88,14 @@ PlasmaKPart::~PlasmaKPart()
void PlasmaKPart::setThemeDefaults()
{
KConfigGroup cg(KSharedConfig::openConfig("plasmarc"), "Theme-plasma-kpart" );
KConfigGroup cg(KSharedConfig::openConfig("plasmarc"), "Theme-plasma-kpart");
const QString themeName = cg.readEntry("name", "appdashboard");
Plasma::Theme::defaultTheme()->setUseGlobalSettings(false);
Plasma::Theme::defaultTheme()->setThemeName(themeName);
cg = KConfigGroup(KSharedConfig::openConfig(), "General");
Plasma::Theme::defaultTheme()->setFont(cg.readEntry("desktopFont", QFont("Sans") ));
Plasma::Theme::defaultTheme()->setFont(cg.readEntry("desktopFont", QFont("Sans")));
}
void PlasmaKPart::syncConfig()
@ -119,7 +119,7 @@ void PlasmaKPart::initCorona()
m_view->show();
}
PlasmaKPartCorona* PlasmaKPart::corona() const
PlasmaKPartCorona *PlasmaKPart::corona() const
{
Q_ASSERT(m_corona);
return m_corona;
@ -131,7 +131,7 @@ void PlasmaKPart::createView(Plasma::Containment *containment)
m_view->setContainment(containment);
}
void PlasmaKPart::addApplet(const QString& name, const QVariantList& args, const QRectF& geometry )
void PlasmaKPart::addApplet(const QString &name, const QVariantList &args, const QRectF &geometry)
{
Q_ASSERT(containment());
containment()->createApplet(name, args, geometry);
@ -155,7 +155,7 @@ void PlasmaKPart::setConfigFile(const QString &file)
}
}
Plasma::Containment* PlasmaKPart::containment() const
Plasma::Containment *PlasmaKPart::containment() const
{
Q_ASSERT(corona());
Q_ASSERT(!corona()->containments().isEmpty());

View File

@ -30,8 +30,8 @@ class PlasmaKPartCorona;
Q_DECLARE_METATYPE(Plasma::Containment *)
namespace Plasma
{
class Applet;
class PluginLoader;
class Applet;
class PluginLoader;
}
#include <KDE/KParts/Part>
@ -85,14 +85,14 @@ public Q_SLOTS:
private Q_SLOTS:
void initCorona();
void syncConfig();
void createView(Plasma::Containment* containment);
void createView(Plasma::Containment *containment);
void setThemeDefaults();
private:
PlasmaKPartCorona* m_corona;
PlasmaKPartView* m_view;
QHash<QString,Plasma::Applet*>* m_appletList;
QVBoxLayout* m_configLayout;
PlasmaKPartCorona *m_corona;
PlasmaKPartView *m_view;
QHash<QString, Plasma::Applet *> *m_appletList;
QVBoxLayout *m_configLayout;
QString m_configFile;
};

View File

@ -61,7 +61,7 @@ void PlasmaKPartCorona::evaluateScripts(const QStringList &scripts)
connect(&scriptEngine, SIGNAL(print(QString)), this, SLOT(printScriptMessage(QString)));
QFile file(script);
if (file.open(QIODevice::ReadOnly | QIODevice::Text) ) {
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QString code = file.readAll();
// qDebug() << "evaluating startup script:" << script;
scriptEngine.evaluateScript(code);

View File

@ -26,7 +26,7 @@
namespace Plasma
{
class Applet;
class Applet;
} // namespace Plasma
/**
@ -34,9 +34,9 @@ namespace Plasma
*/
class PlasmaKPartCorona : public Plasma::Corona
{
Q_OBJECT
Q_OBJECT
public:
PlasmaKPartCorona(QObject* parent);
PlasmaKPartCorona(QObject *parent);
protected:
void loadDefaultLayout();

View File

@ -26,7 +26,7 @@
#include <Plasma/Applet>
#include <Plasma/Containment>
PlasmaKPartView::PlasmaKPartView(Plasma::Containment* containment, int uid, QWidget* parent)
PlasmaKPartView::PlasmaKPartView(Plasma::Containment *containment, int uid, QWidget *parent)
: Plasma::View(containment, uid, parent),
m_configurationMode(false)
{
@ -41,7 +41,7 @@ PlasmaKPartView::~PlasmaKPartView()
{
}
void PlasmaKPartView::connectContainment(Plasma::Containment* containment)
void PlasmaKPartView::connectContainment(Plasma::Containment *containment)
{
if (!containment) {
return;
@ -51,7 +51,7 @@ void PlasmaKPartView::connectContainment(Plasma::Containment* containment)
connect(containment, SIGNAL(toolBoxVisibilityChanged(bool)), this, SLOT(updateConfigurationMode(bool)));
}
void PlasmaKPartView::setContainment(Plasma::Containment* c)
void PlasmaKPartView::setContainment(Plasma::Containment *c)
{
if (containment()) {
disconnect(containment(), 0, this, 0);
@ -71,7 +71,7 @@ void PlasmaKPartView::resizeEvent(QResizeEvent *event)
void PlasmaKPartView::updateGeometry()
{
Plasma::Containment* c = containment();
Plasma::Containment *c = containment();
if (!c) {
return;
}
@ -85,5 +85,4 @@ void PlasmaKPartView::updateGeometry()
}
}
#include "plasmakpartview.moc"

View File

@ -27,12 +27,12 @@
namespace Plasma
{
class Containment;
class Containment;
} // namespace Plasma
class PlasmaKPartView : public Plasma::View
{
Q_OBJECT
Q_OBJECT
public:
typedef Plasma::Types::ImmutabilityType ImmutabilityType;
PlasmaKPartView(Plasma::Containment *containment, int uid, QWidget *parent = 0);
@ -55,7 +55,7 @@ Q_SIGNALS:
void geometryChanged();
protected:
void resizeEvent( QResizeEvent* event );
void resizeEvent(QResizeEvent *event);
private:
bool m_configurationMode;

View File

@ -45,21 +45,19 @@
Class* self = qscriptvalue_cast<Class*>(ctx->thisObject()); \
if (!self) { \
return ctx->throwError(QScriptContext::TypeError, \
QString::fromLatin1("%0.prototype.%1: this object is not a %0") \
.arg(#Class).arg(#__fn__)); \
QString::fromLatin1("%0.prototype.%1: this object is not a %0") \
.arg(#Class).arg(#__fn__)); \
}
#define DECLARE_SELF2(Class, __fn__, __ret__) \
Class* self = qscriptvalue_cast<Class*>(thisObject()); \
if (!self) { \
context()->throwError(QScriptContext::TypeError, \
QString::fromLatin1("%0.prototype.%1: this object is not a %0") \
.arg(#Class).arg(#__fn__)); \
QString::fromLatin1("%0.prototype.%1: this object is not a %0") \
.arg(#Class).arg(#__fn__)); \
return __ret__; \
}
#define ADD_METHOD(__p__, __f__) \
__p__.setProperty(#__f__, __p__.engine()->newFunction(__f__))
@ -67,53 +65,49 @@
ADD_METHOD(__p__, __get__)
#define ADD_GET_SET_METHODS(__p__, __get__, __set__) \
do { \
ADD_METHOD(__p__, __get__); \
ADD_METHOD(__p__, __set__); \
} while (0);
do { \
ADD_METHOD(__p__, __get__); \
ADD_METHOD(__p__, __set__); \
} while (0);
#define ADD_CTOR_FUNCTION(__c__, __f__) ADD_METHOD(__c__, __f__)
#define ADD_ENUM_VALUE(__c__, __ns__, __v__) \
__c__.setProperty(#__v__, QScriptValue(__c__.engine(), __ns__::__v__))
#define BEGIN_DECLARE_METHOD(Class, __mtd__) \
static QScriptValue __mtd__(QScriptContext *ctx, QScriptEngine *eng) \
{ \
DECLARE_SELF(Class, __mtd__);
static QScriptValue __mtd__(QScriptContext *ctx, QScriptEngine *eng) \
{ \
DECLARE_SELF(Class, __mtd__);
#define END_DECLARE_METHOD \
}
}
#define DECLARE_GET_METHOD(Class, __get__) \
BEGIN_DECLARE_METHOD(Class, __get__) { \
return qScriptValueFromValue(eng, self->__get__()); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __get__) { \
return qScriptValueFromValue(eng, self->__get__()); \
} END_DECLARE_METHOD
#define DECLARE_SET_METHOD(Class, T, __set__) \
BEGIN_DECLARE_METHOD(Class, __set__) { \
self->__set__(qscriptvalue_cast<T>(ctx->argument(0))); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __set__) { \
self->__set__(qscriptvalue_cast<T>(ctx->argument(0))); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
#define DECLARE_GET_SET_METHODS(Class, T, __get__, __set__) \
DECLARE_GET_METHOD(Class, /*T,*/ __get__) \
DECLARE_SET_METHOD(Class, T, __set__)
DECLARE_GET_METHOD(Class, /*T,*/ __get__) \
DECLARE_SET_METHOD(Class, T, __set__)
#define DECLARE_SIMPLE_GET_METHOD(Class, __get__) \
BEGIN_DECLARE_METHOD(Class, __get__) { \
return QScriptValue(eng, self->__get__()); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __get__) { \
return QScriptValue(eng, self->__get__()); \
} END_DECLARE_METHOD
#define DECLARE_SIMPLE_SET_METHOD(Class, ToType, __set__) \
BEGIN_DECLARE_METHOD(Class, __set__) { \
self->__set__(ctx->argument(0).ToType()); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __set__) { \
self->__set__(ctx->argument(0).ToType()); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
#define DECLARE_BOOLEAN_GET_METHOD(Class, __set__) \
DECLARE_SIMPLE_GET_METHOD(Class, __set__)
@ -136,9 +130,9 @@ BEGIN_DECLARE_METHOD(Class, __set__) { \
DECLARE_SIMPLE_SET_METHOD(Class, toString, __set__)
#define DECLARE_QOBJECT_GET_METHOD(Class, __get__) \
BEGIN_DECLARE_METHOD(Class, __get__) { \
return eng->newQObject(self->__get__()); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __get__) { \
return eng->newQObject(self->__get__()); \
} END_DECLARE_METHOD
#define DECLARE_QOBJECT_SET_METHOD(Class, __set__) \
DECLARE_SIMPLE_SET_METHOD(Class, toQObject, __set__)
@ -162,42 +156,40 @@ BEGIN_DECLARE_METHOD(Class, __get__) { \
DECLARE_QOBJECT_GET_METHOD(Class, __get__) \
DECLARE_QOBJECT_SET_METHOD(Class, __set__)
#define DECLARE_VOID_METHOD(Class, __fun__) \
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
#define DECLARE_VOID_NUMBER_METHOD(Class, __fun__) \
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(ctx->argument(0).toNumber()); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(ctx->argument(0).toNumber()); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
#define DECLARE_VOID_NUMBER_NUMBER_METHOD(Class, __fun__) \
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(ctx->argument(0).toNumber(), ctx->argument(1).toNumber()); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(ctx->argument(0).toNumber(), ctx->argument(1).toNumber()); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
#define DECLARE_VOID_QUAD_NUMBER_METHOD(Class, __fun__) \
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(ctx->argument(0).toNumber(), ctx->argument(1).toNumber(), ctx->argument(2).toNumber(), ctx->argument(3).toNumber()); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(ctx->argument(0).toNumber(), ctx->argument(1).toNumber(), ctx->argument(2).toNumber(), ctx->argument(3).toNumber()); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
#define DECLARE_VOID_1ARG_METHOD(Class, ArgType, __fun__) \
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(qscriptvalue_cast<ArgType>(ctx->argument(0))); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __fun__) { \
self->__fun__(qscriptvalue_cast<ArgType>(ctx->argument(0))); \
return eng->undefinedValue(); \
} END_DECLARE_METHOD
#define DECLARE_BOOLEAN_1ARG_METHOD(Class, ArgType, __fun__) \
BEGIN_DECLARE_METHOD(Class, __fun__) { \
return QScriptValue(eng, self->__fun__(qscriptvalue_cast<ArgType>(ctx->argument(0)))); \
} END_DECLARE_METHOD
BEGIN_DECLARE_METHOD(Class, __fun__) { \
return QScriptValue(eng, self->__fun__(qscriptvalue_cast<ArgType>(ctx->argument(0)))); \
} END_DECLARE_METHOD
#define DECLARE_POINTER_METATYPE(T) \
Q_DECLARE_METATYPE(T*) \
@ -214,21 +206,22 @@ template <typename T>
class Pointer : public QSharedData
{
public:
typedef T* pointer_type;
typedef T *pointer_type;
typedef QExplicitlySharedDataPointer<Pointer<T> > wrapped_pointer_type;
~Pointer()
{
if (!(m_flags & UserOwnership))
if (!(m_flags & UserOwnership)) {
delete m_value;
}
}
operator T*()
operator T *()
{
return m_value;
}
operator const T*() const
operator const T *() const
{
return m_value;
}
@ -238,25 +231,26 @@ public:
return wrapped_pointer_type(new Pointer(value, flags));
}
static QScriptValue toScriptValue(QScriptEngine *engine, T* const &source)
static QScriptValue toScriptValue(QScriptEngine *engine, T *const &source)
{
if (!source)
if (!source) {
return engine->nullValue();
}
return engine->newVariant(qVariantFromValue(source));
}
static void fromScriptValue(const QScriptValue &value, T* &target)
static void fromScriptValue(const QScriptValue &value, T *&target)
{
if (value.isVariant()) {
QVariant var = value.toVariant();
if (qVariantCanConvert<T*>(var)) {
target = qvariant_cast<T*>(var);
if (qVariantCanConvert<T *>(var)) {
target = qvariant_cast<T *>(var);
} else if (qVariantCanConvert<wrapped_pointer_type>(var)) {
target = qvariant_cast<wrapped_pointer_type>(var)->operator T*();
target = qvariant_cast<wrapped_pointer_type>(var)->operator T * ();
} else {
// look in prototype chain
target = 0;
int type = qMetaTypeId<T*>();
int type = qMetaTypeId<T *>();
int pointerType = qMetaTypeId<wrapped_pointer_type>();
QScriptValue proto = value.prototype();
while (proto.isObject() && proto.isVariant()) {
@ -264,10 +258,10 @@ public:
if ((type == protoType) || (pointerType == protoType)) {
QByteArray name = QMetaType::typeName(var.userType());
if (name.startsWith("QScript::Pointer<")) {
target = (*reinterpret_cast<wrapped_pointer_type*>(var.data()))->operator T*();
target = (*reinterpret_cast<wrapped_pointer_type *>(var.data()))->operator T * ();
break;
} else {
target = static_cast<T*>(var.data());
target = static_cast<T *>(var.data());
break;
}
}
@ -276,28 +270,34 @@ public:
}
} else if (value.isQObject()) {
QObject *qobj = value.toQObject();
QByteArray typeName = QMetaType::typeName(qMetaTypeId<T*>());
target = reinterpret_cast<T*>(qobj->qt_metacast(typeName.left(typeName.size()-1)));
QByteArray typeName = QMetaType::typeName(qMetaTypeId<T *>());
target = reinterpret_cast<T *>(qobj->qt_metacast(typeName.left(typeName.size() - 1)));
} else {
target = 0;
}
}
uint flags() const
{ return m_flags; }
{
return m_flags;
}
void setFlags(uint flags)
{ m_flags = flags; }
{
m_flags = flags;
}
void unsetFlags(uint flags)
{ m_flags &= ~flags; }
{
m_flags &= ~flags;
}
protected:
Pointer(T* value, uint flags)
Pointer(T *value, uint flags)
: m_flags(flags), m_value(value)
{}
private:
uint m_flags;
T* m_value;
T *m_value;
};
template <typename T>
@ -307,9 +307,9 @@ int registerPointerMetaType(
T * /* dummy */ = 0
)
{
QScriptValue (*mf)(QScriptEngine *, T* const &) = Pointer<T>::toScriptValue;
void (*df)(const QScriptValue &, T* &) = Pointer<T>::fromScriptValue;
const int id = qMetaTypeId<T*>();
QScriptValue(*mf)(QScriptEngine *, T * const &) = Pointer<T>::toScriptValue;
void (*df)(const QScriptValue &, T *&) = Pointer<T>::fromScriptValue;
const int id = qMetaTypeId<T *>();
qScriptRegisterMetaType_helper(
eng, id, reinterpret_cast<QScriptEngine::MarshalFunction>(mf),
reinterpret_cast<QScriptEngine::DemarshalFunction>(df),
@ -323,8 +323,9 @@ inline void maybeReleaseOwnership(const QScriptValue &value)
if (value.isVariant()) {
QVariant var = value.toVariant();
QByteArray name = QMetaType::typeName(var.userType());
if (name.startsWith("QScript::Pointer<"))
(*reinterpret_cast<Pointer<void*>::wrapped_pointer_type *>(var.data()))->setFlags(UserOwnership);
if (name.startsWith("QScript::Pointer<")) {
(*reinterpret_cast<Pointer<void *>::wrapped_pointer_type *>(var.data()))->setFlags(UserOwnership);
}
}
}
@ -333,8 +334,9 @@ inline void maybeTakeOwnership(const QScriptValue &value)
if (value.isVariant()) {
QVariant var = value.toVariant();
QByteArray name = QMetaType::typeName(var.userType());
if (name.startsWith("QScript::Pointer<"))
(*reinterpret_cast<Pointer<void*>::wrapped_pointer_type *>(var.data()))->unsetFlags(UserOwnership);
if (name.startsWith("QScript::Pointer<")) {
(*reinterpret_cast<Pointer<void *>::wrapped_pointer_type *>(var.data()))->unsetFlags(UserOwnership);
}
}
}
@ -348,7 +350,8 @@ inline QScriptValue wrapPointer(QScriptEngine *eng, T *ptr, uint flags = 0)
#ifdef QGRAPHICSITEM_H
namespace QScript {
namespace QScript
{
template <class T>
inline QScriptValue wrapGVPointer(QScriptEngine *eng, T *item)

View File

@ -19,13 +19,12 @@
#include <QtCore/QRectF>
#include "backportglobal.h"
Q_DECLARE_METATYPE(QRectF*)
Q_DECLARE_METATYPE(QRectF *)
Q_DECLARE_METATYPE(QRectF)
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
{
if (ctx->argumentCount() == 4)
{
if (ctx->argumentCount() == 4) {
qreal x = ctx->argument(0).toNumber();
qreal y = ctx->argument(1).toNumber();
qreal width = ctx->argument(2).toNumber();
@ -158,7 +157,6 @@ static QScriptValue moveRight(QScriptContext *ctx, QScriptEngine *)
return QScriptValue();
}
static QScriptValue moveTo(QScriptContext *ctx, QScriptEngine *)
{
DECLARE_SELF(QRectF, moveTo);
@ -321,7 +319,7 @@ QScriptValue constructQRectFClass(QScriptEngine *eng)
proto.setProperty("y", eng->newFunction(y), getter | setter);
eng->setDefaultPrototype(qMetaTypeId<QRectF>(), proto);
eng->setDefaultPrototype(qMetaTypeId<QRectF*>(), proto);
eng->setDefaultPrototype(qMetaTypeId<QRectF *>(), proto);
return eng->newFunction(ctor, proto);
}

View File

@ -134,7 +134,7 @@ QScriptValue ScriptEngine::loadTemplate(QScriptContext *context, QScriptEngine *
}
const QString constraint = QString("[X-Plasma-Shell] == '%1' and [X-KDE-PluginInfo-Name] == '%2'")
.arg(KGlobal::mainComponent().componentName(),layout);
.arg(KGlobal::mainComponent().componentName(), layout);
KService::List offers = KServiceTypeTrader::self()->query("Plasma/LayoutTemplate", constraint);
if (offers.isEmpty()) {
@ -145,8 +145,8 @@ QScriptValue ScriptEngine::loadTemplate(QScriptContext *context, QScriptEngine *
Plasma::PackageStructure::Ptr structure(new LayoutTemplatePackageStructure);
KPluginInfo info(offers.first());
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
structure->defaultPackageRoot() + '/' + info.pluginName() + '/',
QStandardPaths::LocateDirectory);
structure->defaultPackageRoot() + '/' + info.pluginName() + '/',
QStandardPaths::LocateDirectory);
if (path.isEmpty()) {
// qDebug() << "script path is empty";
return false;
@ -189,11 +189,11 @@ void ScriptEngine::setupEngine()
v.setProperty("widgets", newFunction(ScriptEngine::widgets));
v.setProperty("addWidget", newFunction(ScriptEngine::addWidget));
v.setProperty("applicationVersion", KGlobal::mainComponent().aboutData()->version(),
QScriptValue::PropertyGetter | QScriptValue::ReadOnly | QScriptValue::Undeletable);
QScriptValue::PropertyGetter | QScriptValue::ReadOnly | QScriptValue::Undeletable);
v.setProperty("scriptingVersion", newVariant(PLASMA_KPART_SCRIPTING_VERSION),
QScriptValue::PropertyGetter | QScriptValue::ReadOnly | QScriptValue::Undeletable);
QScriptValue::PropertyGetter | QScriptValue::ReadOnly | QScriptValue::Undeletable);
v.setProperty("platformVersion", KDE::versionString(),
QScriptValue::PropertyGetter | QScriptValue::ReadOnly | QScriptValue::Undeletable);
QScriptValue::PropertyGetter | QScriptValue::ReadOnly | QScriptValue::Undeletable);
setGlobalObject(v);
}
@ -205,9 +205,9 @@ bool ScriptEngine::evaluateScript(const QString &script, const QString &path)
if (hasUncaughtException()) {
//qDebug() << "catch the exception!";
QString error = QString("Error: %1 at line %2\n\nBacktrace:\n%3").arg(
uncaughtException().toString(),
QString::number(uncaughtExceptionLineNumber()),
uncaughtExceptionBacktrace().join("\n "));
uncaughtException().toString(),
QString::number(uncaughtExceptionLineNumber()),
uncaughtExceptionBacktrace().join("\n "));
emit printError(error);
return false;
}
@ -336,21 +336,21 @@ QScriptValue ScriptEngine::addWidget(QScriptContext *context, QScriptEngine *eng
// applet = env->m_containment->addApplet(v.toString(), row, column);
QMetaObject::invokeMethod(env->m_containment, "addApplet",
Qt::DirectConnection,
Q_RETURN_ARG(Plasma::Applet*, applet),
Q_RETURN_ARG(Plasma::Applet *, applet),
Q_ARG(QString, v.toString()),
Q_ARG(int, row), Q_ARG(int, column));
if (applet) {
ScriptEngine *env = ScriptEngine::envFor(engine);
return env->wrap(applet);
}
} else if (Widget *widget = qobject_cast<Widget*>(v.toQObject())) {
} else if (Widget *widget = qobject_cast<Widget *>(v.toQObject())) {
applet = widget->applet();
// FIXME: Using QMetaObject::invokeMethod until the newspaper's API is exported... Fuuuu
// env->m_containment->addApplet(applet, row, column);
QMetaObject::invokeMethod(env->m_containment, "addApplet",
Qt::DirectConnection,
Q_RETURN_ARG(Plasma::Applet*, applet),
Q_RETURN_ARG(Plasma::Applet *, applet),
Q_ARG(QString, v.toString()),
Q_ARG(int, row), Q_ARG(int, column));
return v;

View File

@ -25,9 +25,9 @@
namespace Plasma
{
class Applet;
class Containment;
class Corona;
class Applet;
class Containment;
class Corona;
} // namespace Plasma
namespace PlasmaKPartScripting

View File

@ -26,7 +26,7 @@
namespace Plasma
{
class Applet;
class Applet;
} // namespace Plasma
namespace PlasmaKPartScripting
@ -71,7 +71,7 @@ public:
QString type() const;
/**
FIXME: what should the index(es?) be given that we're in the newspaper containment
FIXME: what should the index(es?) be given that we're in the newspaper containment
int index() const;
void setIndex(int index);
*/
@ -89,7 +89,7 @@ public Q_SLOTS:
private:
class Private;
Private * const d;
Private *const d;
};
}

View File

@ -56,7 +56,6 @@
#include "private/associatedapplicationmanager_p.h"
#include "private/containment_p.h"
namespace Plasma
{
@ -168,12 +167,12 @@ void Applet::restore(KConfigGroup &group)
if (!shortcutText.isEmpty()) {
setGlobalShortcut(QKeySequence(shortcutText));
/*
#ifndef NDEBUG
#ifndef NDEBUG
// qDebug() << "got global shortcut for" << name() << "of" << QKeySequence(shortcutText);
#endif
#ifndef NDEBUG
#endif
#ifndef NDEBUG
// qDebug() << "set to" << d->activationAction->objectName()
#endif
#endif
<< d->activationAction->globalShortcut().primary();
*/
}
@ -181,10 +180,10 @@ void Applet::restore(KConfigGroup &group)
// local shortcut, if any
//TODO: implement; the shortcut will need to be registered with the containment
/*
#include "accessmanager.h"
#include "private/plasmoidservice_p.h"
#include "authorizationmanager.h"
#include "authorizationmanager.h"
#include "accessmanager.h"
#include "private/plasmoidservice_p.h"
#include "authorizationmanager.h"
#include "authorizationmanager.h"
shortcutText = shortcutConfig.readEntryUntranslated("local", QString());
if (!shortcutText.isEmpty()) {
//TODO: implement; the shortcut
@ -268,7 +267,7 @@ bool Applet::destroyed() const
ConfigLoader *Applet::configScheme() const
{
if (!d->configLoader) {
const QString xmlPath = d->package? d->package->filePath("mainconfigxml") : QString();
const QString xmlPath = d->package ? d->package->filePath("mainconfigxml") : QString();
KConfigGroup cfg = config();
if (xmlPath.isEmpty()) {
d->configLoader = new ConfigLoader(&cfg, 0);
@ -352,7 +351,7 @@ Types::Types::ImmutabilityType Applet::immutability() const
Types::ImmutabilityType upperImmutability = Types::Mutable;
if (isContainment()) {
Corona *cor = static_cast<Containment*>(const_cast<Applet*>(this))->corona();
Corona *cor = static_cast<Containment *>(const_cast<Applet *>(this))->corona();
if (cor) {
upperImmutability = cor->immutability();
}
@ -506,7 +505,7 @@ void Applet::flushPendingConstraintsEvents()
}
// now take care of constraints in special subclass: Contaiment
Containment* containment = qobject_cast<Plasma::Containment*>(this);
Containment *containment = qobject_cast<Plasma::Containment *>(this);
if (containment) {
containment->d->containmentConstraintsEvent(c);
}
@ -534,10 +533,10 @@ void Applet::flushPendingConstraintsEvents()
}
}
QList<QAction*> Applet::contextualActions()
QList<QAction *> Applet::contextualActions()
{
//qDebug() << "empty context actions";
return d->script ? d->script->contextualActions() : QList<QAction*>();
return d->script ? d->script->contextualActions() : QList<QAction *>();
}
KActionCollection *Applet::actions() const
@ -561,7 +560,7 @@ Types::FormFactor Applet::formFactor() const
Containment *Applet::containment() const
{
Containment *c = qobject_cast<Containment*>(const_cast<Applet*>(this));
Containment *c = qobject_cast<Containment *>(const_cast<Applet *>(this));
if (c && c->isContainment()) {
return c;
} else {
@ -571,7 +570,7 @@ Containment *Applet::containment() const
QObject *parent = this->parent();
while (parent) {
Containment *possibleC = qobject_cast<Containment*>(parent);
Containment *possibleC = qobject_cast<Containment *>(parent);
if (possibleC && possibleC->isContainment()) {
c = possibleC;
@ -612,7 +611,6 @@ QKeySequence Applet::globalShortcut() const
}
}
return QKeySequence();
}
@ -731,7 +729,7 @@ void Applet::timerEvent(QTimerEvent *event)
// Don't flushPendingConstraints if we're just starting up
// flushPendingConstraints will be called by Corona
if(!(d->pendingConstraints & Plasma::Types::StartupCompletedConstraint)) {
if (!(d->pendingConstraints & Plasma::Types::StartupCompletedConstraint)) {
flushPendingConstraintsEvents();
}
} else if (d->modificationsTimer && event->timerId() == d->modificationsTimer->timerId()) {
@ -753,7 +751,7 @@ bool Applet::isContainment() const
return true;
}
//normal "acting as a containment" condition
return qobject_cast<const Containment*>(this) && qobject_cast<Corona *>(parent());
return qobject_cast<const Containment *>(this) && qobject_cast<Corona *>(parent());
}
} // Plasma namespace

File diff suppressed because it is too large Load Diff

View File

@ -155,7 +155,7 @@ QString ConfigLoaderHandler::defaultValue() const
}
bool ConfigLoaderHandler::endElement(const QString &namespaceURI,
const QString &localName, const QString &qName)
const QString &localName, const QString &qName)
{
Q_UNUSED(namespaceURI)
Q_UNUSED(qName)
@ -247,7 +247,7 @@ void ConfigLoaderHandler::addItem()
item = m_config->addItemFont(m_name, *d->newFont(), QFont(m_default), m_key);
} else if (m_type == "int") {
KConfigSkeleton::ItemInt *intItem = m_config->addItemInt(m_name, *d->newInt(),
m_default.toInt(), m_key);
m_default.toInt(), m_key);
if (m_haveMin) {
intItem->setMinValue(m_min);
@ -313,11 +313,11 @@ void ConfigLoaderHandler::addItem()
longlongItem->setMaxValue(m_max);
}
item = longlongItem;
/* No addItemPathList in KConfigSkeleton ?
} else if (m_type == "PathList") {
//FIXME: the split() is naive and will break on lists with ,'s in them
item = m_config->addItemPathList(m_name, *d->newStringList(), m_default.split(","), m_key);
*/
/* No addItemPathList in KConfigSkeleton ?
} else if (m_type == "PathList") {
//FIXME: the split() is naive and will break on lists with ,'s in them
item = m_config->addItemPathList(m_name, *d->newStringList(), m_default.split(","), m_key);
*/
} else if (m_type == "point") {
QPoint defaultPoint;
QStringList tmpList = m_default.split(',');
@ -352,15 +352,15 @@ void ConfigLoaderHandler::addItem()
ulonglongItem->setMaxValue(m_max);
}
item = ulonglongItem;
/* No addItemUrlList in KConfigSkeleton ?
} else if (m_type == "urllist") {
//FIXME: the split() is naive and will break on lists with ,'s in them
QStringList tmpList = m_default.split(",");
QList<QUrl> defaultList;
foreach (const QString& tmp, tmpList) {
defaultList.append(QUrl(tmp));
}
item = m_config->addItemUrlList(m_name, *d->newUrlList(), defaultList, m_key);*/
/* No addItemUrlList in KConfigSkeleton ?
} else if (m_type == "urllist") {
//FIXME: the split() is naive and will break on lists with ,'s in them
QStringList tmpList = m_default.split(",");
QList<QUrl> defaultList;
foreach (const QString& tmp, tmpList) {
defaultList.append(QUrl(tmp));
}
item = m_config->addItemUrlList(m_name, *d->newUrlList(), defaultList, m_key);*/
}
if (item) {
@ -456,7 +456,7 @@ bool ConfigLoader::usrWriteConfig()
{
if (d->saveDefaults) {
KConfigSkeletonItem::List itemList = items();
for(int i = 0; i < itemList.size(); i++) {
for (int i = 0; i < itemList.size(); i++) {
KConfigGroup cg(config(), itemList.at(i)->group());
cg.writeEntry(itemList.at(i)->key(), "");
}

View File

@ -146,7 +146,7 @@ protected:
private:
friend class Service;
ConfigLoaderPrivate * const d;
ConfigLoaderPrivate *const d;
};
} // Plasma namespace

View File

@ -107,7 +107,7 @@ void Containment::init()
setContainmentType(Plasma::Types::CustomContainment);
} else if (type == "CustomPanel") {
setContainmentType(Plasma::Types::CustomPanelContainment);
//default to desktop
//default to desktop
} else {
setContainmentType(Plasma::Types::DesktopContainment);
}
@ -157,14 +157,14 @@ bool appletConfigLessThan(const KConfigGroup &c1, const KConfigGroup &c2)
void Containment::restore(KConfigGroup &group)
{
/*
#ifndef NDEBUG
#ifndef NDEBUG
// qDebug() << "!!!!!!!!!!!!initConstraints" << group.name() << d->type;
// qDebug() << " location:" << group.readEntry("location", (int)d->location);
// qDebug() << " geom:" << group.readEntry("geometry", geometry());
// qDebug() << " formfactor:" << group.readEntry("formfactor", (int)d->formFactor);
// qDebug() << " screen:" << group.readEntry("screen", d->screen);
#endif
*/
#endif
*/
setLocation((Plasma::Types::Location)group.readEntry("location", (int)d->location));
setFormFactor((Plasma::Types::FormFactor)group.readEntry("formfactor", (int)d->formFactor));
d->lastScreen = group.readEntry("lastScreen", d->lastScreen);
@ -181,7 +181,6 @@ void Containment::restore(KConfigGroup &group)
KConfigGroup cfg = KConfigGroup(corona()->config(), "ActionPlugins");
cfg = KConfigGroup(&cfg, QString::number(containmentType()));
//qDebug() << cfg.keyList();
if (cfg.exists()) {
foreach (const QString &key, cfg.keyList()) {
@ -192,7 +191,7 @@ void Containment::restore(KConfigGroup &group)
KConfigGroup defaultActionsCfg;
if (d->type == Plasma::Types::PanelContainment) {
defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Panel");
//Plasma::Types::DesktopContainment
//Plasma::Types::DesktopContainment
} else {
defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Desktop");
}
@ -205,9 +204,9 @@ void Containment::restore(KConfigGroup &group)
}
/*
#ifndef NDEBUG
#ifndef NDEBUG
// qDebug() << "Containment" << id() <<
#endif
#endif
"screen" << screen() <<
"geometry is" << geometry() <<
"config entries" << group.entryMap();
@ -293,7 +292,7 @@ void Containment::setContainmentType(Plasma::Types::ContainmentType type)
Corona *Containment::corona() const
{
return qobject_cast<Corona*>(parent());
return qobject_cast<Corona *>(parent());
}
void Containment::setFormFactor(Types::FormFactor formFactor)
@ -444,7 +443,7 @@ int Containment::screen() const
if (corona()) {
return corona()->screenForContainment(this);
//case in which this containment is child of an applet, hello systray :)
//case in which this containment is child of an applet, hello systray :)
} else if (Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(parent())) {
if (parentApplet->containment()) {
return parentApplet->containment()->screen();
@ -519,7 +518,7 @@ void Containment::setContainmentActions(const QString &trigger, const QString &p
emit configNeedsSaving();
}
QHash<QString, ContainmentActions*> &Containment::containmentActions()
QHash<QString, ContainmentActions *> &Containment::containmentActions()
{
return d->localActionPlugins;
}
@ -565,6 +564,4 @@ void Containment::reactToScreenChange()
} // Plasma namespace
#include "moc_containment.cpp"

View File

@ -30,7 +30,6 @@
#include <plasma/applet.h>
namespace Plasma
{
@ -66,271 +65,268 @@ class PLASMA_EXPORT Containment : public Applet
Q_OBJECT
Q_PROPERTY(QString wallpaper READ wallpaper WRITE setWallpaper NOTIFY wallpaperChanged)
public:
/**
* @param parent the QObject this applet is parented to
* @param serviceId the name of the .desktop file containing the
* information about the widget
* @param containmentId a unique id used to differentiate between multiple
* instances of the same Applet type
*/
explicit Containment(QObject *parent = 0,
const QString &serviceId = QString(),
uint containmentId = 0);
public:
/**
* @param parent the QObject this applet is parented to
* @param serviceId the name of the .desktop file containing the
* information about the widget
* @param containmentId a unique id used to differentiate between multiple
* instances of the same Applet type
*/
explicit Containment(QObject *parent = 0,
const QString &serviceId = QString(),
uint containmentId = 0);
/**
* This constructor is to be used with the plugin loading systems
* found in KPluginInfo and KService. The argument list is expected
* to have two elements: the KService service ID for the desktop entry
* and an applet ID which must be a base 10 number.
*
* @param parent a QObject parent; you probably want to pass in 0
* @param args a list of strings containing two entries: the service id
* and the applet id
*/
Containment(QObject *parent, const QVariantList &args);
/**
* This constructor is to be used with the plugin loading systems
* found in KPluginInfo and KService. The argument list is expected
* to have two elements: the KService service ID for the desktop entry
* and an applet ID which must be a base 10 number.
*
* @param parent a QObject parent; you probably want to pass in 0
* @param args a list of strings containing two entries: the service id
* and the applet id
*/
Containment(QObject *parent, const QVariantList &args);
~Containment();
~Containment();
/**
* Reimplemented from Applet
*/
void init();
/**
* Reimplemented from Applet
*/
void init();
/**
* Returns the type of containment
*/
Plasma::Types::ContainmentType containmentType() const;
/**
* Returns the type of containment
*/
Plasma::Types::ContainmentType containmentType() const;
/**
* Returns the Corona (if any) that this Containment is hosted by
*/
Corona *corona() const;
/**
* Returns the Corona (if any) that this Containment is hosted by
*/
Corona *corona() const;
/**
* Adds an applet to this Containment
*
* @param name the plugin name for the applet, as given by
* KPluginInfo::pluginName()
* @param args argument list to pass to the plasmoid
* @param geometry where to place the applet, or to auto-place it if an invalid
* is provided
*
* @return a pointer to the applet on success, or 0 on failure
*/
Applet *createApplet(const QString &name, const QVariantList &args = QVariantList());
/**
* Adds an applet to this Containment
*
* @param name the plugin name for the applet, as given by
* KPluginInfo::pluginName()
* @param args argument list to pass to the plasmoid
* @param geometry where to place the applet, or to auto-place it if an invalid
* is provided
*
* @return a pointer to the applet on success, or 0 on failure
*/
Applet *createApplet(const QString &name, const QVariantList &args = QVariantList());
/**
* Add an existing applet to this Containment
*
* @param applet the applet that should be added
* @param pos the containment-relative position
*/
void addApplet(Applet *applet);
/**
* Add an existing applet to this Containment
*
* @param applet the applet that should be added
* @param pos the containment-relative position
*/
void addApplet(Applet *applet);
/**
* @return the applets currently in this Containment
*/
QList<Applet *> applets() const;
/**
* @return the applets currently in this Containment
*/
QList<Applet *> applets() const;
/**
* @return the screen number this containment is serving as the desktop for
* or -1 if none
*/
int screen() const;
/**
* @return the screen number this containment is serving as the desktop for
* or -1 if none
*/
int screen() const;
/**
* @return the last screen number this containment had
* only returns -1 if it's never ever been on a screen
* @since 4.5
*/
int lastScreen() const;
/**
* @return the last screen number this containment had
* only returns -1 if it's never ever been on a screen
* @since 4.5
*/
int lastScreen() const;
/**
* @reimp
* @sa Applet::save(KConfigGroup &)
*/
void save(KConfigGroup &group) const;
/**
* @reimp
* @sa Applet::save(KConfigGroup &)
*/
void save(KConfigGroup &group) const;
/**
* @reimp
* @sa Applet::restore(KConfigGroup &)
*/
void restore(KConfigGroup &group);
/**
* @reimp
* @sa Applet::restore(KConfigGroup &)
*/
void restore(KConfigGroup &group);
/**
* Sets wallpaper plugin.
*
* @param pluginName the name of the wallpaper to attempt to load
*/
void setWallpaper(const QString &pluginName);
/**
* Sets wallpaper plugin.
*
* @param pluginName the name of the wallpaper to attempt to load
*/
void setWallpaper(const QString &pluginName);
/**
* Return wallpaper plugin.
*/
QString wallpaper() const;
/**
* Return wallpaper plugin.
*/
QString wallpaper() const;
/**
* Sets the current activity by id
*
* @param activity the id of the activity
*/
void setActivity(const QString &activityId);
/**
* Sets the current activity by id
*
* @param activity the id of the activity
*/
void setActivity(const QString &activityId);
/**
* @return the current activity id associated with this containment
*/
QString activity() const;
/**
* @return the current activity id associated with this containment
*/
QString activity() const;
/**
* Sets a containmentactions plugin.
*
* @param trigger the mouse button (and optional modifier) to associate the plugin with
* @param pluginName the name of the plugin to attempt to load. blank = set no plugin.
* @since 4.4
*/
void setContainmentActions(const QString &trigger, const QString &pluginName);
/**
* Sets a containmentactions plugin.
*
* @param trigger the mouse button (and optional modifier) to associate the plugin with
* @param pluginName the name of the plugin to attempt to load. blank = set no plugin.
* @since 4.4
*/
void setContainmentActions(const QString &trigger, const QString &pluginName);
/**
* @return All the loaded containment action plugins, indexed by trigger name
* @since 5.0
*/
QHash<QString, ContainmentActions*> &containmentActions();
/**
* @return All the loaded containment action plugins, indexed by trigger name
* @since 5.0
*/
QHash<QString, ContainmentActions *> &containmentActions();
/**
* @returns true when the ui of this containment is fully loaded, as well the ui of every applet in it
*/
bool isUiReady() const;
/**
* @returns true when the ui of this containment is fully loaded, as well the ui of every applet in it
*/
bool isUiReady() const;
Q_SIGNALS:
/**
* This signal is emitted when a new applet is created by the containment
*/
void appletAdded(Plasma::Applet *applet);
/**
* This signal is emitted when a new applet is created by the containment
*/
void appletAdded(Plasma::Applet *applet);
/**
* This signal is emitted when an applet is destroyed
*/
void appletRemoved(Plasma::Applet *applet);
/**
* This signal is emitted when an applet is destroyed
*/
void appletRemoved(Plasma::Applet *applet);
/**
* Emitted when the activity id has changed
*/
void activityChanged(const QString &activity);
/**
* Emitted when the activity id has changed
*/
void activityChanged(const QString &activity);
/**
* Emitted when the containment requests an add widgets dialog is shown.
* Usually only used for desktop containments.
*
* @param pos where in the containment this request was made from, or
* an invalid position (QPointF()) is not location specific
*/
void showAddWidgetsInterface(const QPointF &pos);
/**
* Emitted when the containment requests an add widgets dialog is shown.
* Usually only used for desktop containments.
*
* @param pos where in the containment this request was made from, or
* an invalid position (QPointF()) is not location specific
*/
void showAddWidgetsInterface(const QPointF &pos);
/**
* This signal indicates that a containment has been
* associated (or dissociated) with a physical screen.
*
* @param newScreen the screen it is now associated with
*/
void screenChanged(int newScreen);
/**
* This signal indicates that a containment has been
* associated (or dissociated) with a physical screen.
*
* @param newScreen the screen it is now associated with
*/
void screenChanged(int newScreen);
/**
* Emitted when the user wants to configure/change the containment, or an applet inside it.
*/
void configureRequested(Plasma::Applet *applet);
/**
* Emitted when the user wants to configure/change the containment, or an applet inside it.
*/
void configureRequested(Plasma::Applet *applet);
/**
* Emitted when the wallpaper plugin is changed
*/
void wallpaperChanged();
/**
* Emitted when the wallpaper plugin is changed
*/
void wallpaperChanged();
/**
* Emitted when the location has changed
* @since 5.0
*/
void locationChanged(Plasma::Types::Location location);
/**
* Emitted when the location has changed
* @since 5.0
*/
void locationChanged(Plasma::Types::Location location);
/**
* Emitted when the formFactor has changed
* @since 5.0
*/
void formFactorChanged(Plasma::Types::FormFactor formFactor);
/**
* Emitted when the formFactor has changed
* @since 5.0
*/
void formFactorChanged(Plasma::Types::FormFactor formFactor);
/**
* Emitted when the ui has been fully loaded and is fully working
* @param uiReady true when the ui of the containment is ready, as well the ui of each applet in it
*/
void uiReadyChanged(bool uiReady);
/**
* Emitted when the ui has been fully loaded and is fully working
* @param uiReady true when the ui of the containment is ready, as well the ui of each applet in it
*/
void uiReadyChanged(bool uiReady);
/**
* emitted when the containment type changed
*/
void containmentTypeChanged();
/**
* emitted when the containment type changed
*/
void containmentTypeChanged();
public Q_SLOTS:
/**
* Informs the Corona as to what position it is in. This is informational
* only, as the Corona doesn't change its actual location. This is,
* however, passed on to Applets that may be managed by this Corona.
*
* @param location the new location of this Corona
*/
void setLocation(Plasma::Types::Location location);
public Q_SLOTS:
/**
* Informs the Corona as to what position it is in. This is informational
* only, as the Corona doesn't change its actual location. This is,
* however, passed on to Applets that may be managed by this Corona.
*
* @param location the new location of this Corona
*/
void setLocation(Plasma::Types::Location location);
/**
* Sets the form factor for this Containment. This may cause changes in both
* the arrangement of Applets as well as the display choices of individual
* Applets.
*/
void setFormFactor(Plasma::Types::FormFactor formFactor);
/**
* Sets the form factor for this Containment. This may cause changes in both
* the arrangement of Applets as well as the display choices of individual
* Applets.
*/
void setFormFactor(Plasma::Types::FormFactor formFactor);
/**
* Sets the type of this containment.
*/
void setContainmentType(Plasma::Types::ContainmentType type);
/**
* Sets the type of this containment.
*/
void setContainmentType(Plasma::Types::ContainmentType type);
void reactToScreenChange();
void reactToScreenChange();
protected:
/**
* Called when the contents of the containment should be saved. By default this saves
* all loaded Applets
*
* @param group the KConfigGroup to save settings under
*/
virtual void saveContents(KConfigGroup &group) const;
protected:
/**
* Called when the contents of the containment should be saved. By default this saves
* all loaded Applets
*
* @param group the KConfigGroup to save settings under
*/
virtual void saveContents(KConfigGroup &group) const;
/**
* Called when the contents of the containment should be loaded. By default this loads
* all previously saved Applets
*
* @param group the KConfigGroup to save settings under
*/
virtual void restoreContents(KConfigGroup &group);
/**
* Called when the contents of the containment should be loaded. By default this loads
* all previously saved Applets
*
* @param group the KConfigGroup to save settings under
*/
virtual void restoreContents(KConfigGroup &group);
private:
/**
* @internal This constructor is to be used with the Package loading system.
*
* @param parent a QObject parent; you probably want to pass in 0
* @since 4.3
*/
Containment(const QString &packagePath, uint appletId);
Q_PRIVATE_SLOT(d, void appletDeleted(Plasma::Applet *))
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::Types::ItemStatus))
private:
/**
* @internal This constructor is to be used with the Package loading system.
*
* @param parent a QObject parent; you probably want to pass in 0
* @since 4.3
*/
Containment(const QString &packagePath, uint appletId);
Q_PRIVATE_SLOT(d, void appletDeleted(Plasma::Applet*))
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::Types::ItemStatus))
friend class Applet;
friend class AppletPrivate;
friend class CoronaPrivate;
friend class ContainmentPrivate;
friend class ContainmentActions;
ContainmentPrivate *const d;
friend class Applet;
friend class AppletPrivate;
friend class CoronaPrivate;
friend class ContainmentPrivate;
friend class ContainmentActions;
ContainmentPrivate *const d;
};
} // Plasma namespace

Some files were not shown because too many files have changed in this diff Show More