Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b449d47d authored by Laurent Montel's avatar Laurent Montel 😁

Const'ify, initialize values

parent 1dc41ad7
......@@ -30,10 +30,6 @@ class Q_DECL_HIDDEN CachePolicy::Private : public QSharedData
public:
Private()
: QSharedData()
, inherit(true)
, timeout(-1)
, interval(-1)
, syncOnDemand(false)
{
}
......@@ -47,11 +43,11 @@ public:
syncOnDemand = other.syncOnDemand;
}
bool inherit;
bool inherit = true;
QStringList localParts;
int timeout;
int interval;
bool syncOnDemand;
int timeout = -1;
int interval = -1;
bool syncOnDemand = false;
};
CachePolicy::CachePolicy()
......
......@@ -182,7 +182,7 @@ QQueue<Protocol::ChangeNotificationPtr> ChangeRecorderPrivate::loadFrom(QFile *d
msg = loadRelationNotification(stream, version);
break;
default:
qWarning() << "Unknown notification type";
qCWarning(AKONADICORE_LOG) << "Unknown notification type";
break;
}
......@@ -241,7 +241,7 @@ void ChangeRecorderPrivate::addToStream(QDataStream &stream, const Protocol::Cha
saveRelationNotification(stream, Protocol::cmdCast<Protocol::RelationChangeNotification>(msg));
break;
default:
qWarning() << "Unexpected type?";
qCWarning(AKONADICORE_LOG) << "Unexpected type?";
return;
}
}
......@@ -717,7 +717,7 @@ Protocol::ChangeNotificationPtr ChangeRecorderPrivate::loadRelationNotification(
auto msg = Protocol::RelationChangeNotificationPtr::create();
if (version == 1) {
qWarning() << "Invalid version of relation notification";
qCWarning(AKONADICORE_LOG) << "Invalid version of relation notification";
return msg;
} else if (version >= 2) {
stream >> operation;
......@@ -843,7 +843,7 @@ Protocol::CollectionChangeNotification::Operation ChangeRecorderPrivate::mapColl
case Unsubscribe:
return Protocol::CollectionChangeNotification::Unsubscribe;
default:
qWarning() << "Unexpected operation type in collection notification";
qCWarning(AKONADICORE_LOG) << "Unexpected operation type in collection notification";
return Protocol::CollectionChangeNotification::InvalidOp;
}
}
......@@ -858,7 +858,7 @@ Protocol::TagChangeNotification::Operation ChangeRecorderPrivate::mapTagOperatio
case Remove:
return Protocol::TagChangeNotification::Remove;
default:
qWarning() << "Unexpected operation type in tag notification";
qCWarning(AKONADICORE_LOG) << "Unexpected operation type in tag notification";
return Protocol::TagChangeNotification::InvalidOp;
}
}
......@@ -871,7 +871,7 @@ Protocol::RelationChangeNotification::Operation ChangeRecorderPrivate::mapRelati
case Remove:
return Protocol::RelationChangeNotification::Remove;
default:
qWarning() << "Unexpected operation type in relation notification";
qCWarning(AKONADICORE_LOG) << "Unexpected operation type in relation notification";
return Protocol::RelationChangeNotification::InvalidOp;
}
}
......@@ -888,7 +888,7 @@ ChangeRecorderPrivate::LegacyType ChangeRecorderPrivate::mapToLegacyType(Protoco
case Protocol::Command::RelationChangeNotification:
return Relation;
default:
qWarning() << "Unexpected notification type";
qCWarning(AKONADICORE_LOG) << "Unexpected notification type";
return InvalidType;
}
}
......@@ -52,7 +52,7 @@ QColor CollectionColorAttribute::color() const
QByteArray CollectionColorAttribute::type() const
{
return "collectioncolor";
return QByteArrayLiteral("collectioncolor");
}
CollectionColorAttribute *CollectionColorAttribute::clone() const
......
......@@ -107,7 +107,7 @@ QByteArray CollectionIdentificationAttribute::collectionNamespace() const
QByteArray CollectionIdentificationAttribute::type() const
{
return "collectionidentification";
return QByteArrayLiteral("collectionidentification");
}
Akonadi::Attribute *CollectionIdentificationAttribute::clone() const
......
......@@ -91,7 +91,7 @@ public:
Collection::Id mColId;
QString mPath;
bool mPathToId;
bool mPathToId = false;
QStringList mPathParts;
Collection mCurrentNode;
};
......
......@@ -1274,7 +1274,7 @@ void EntityTreeModelPrivate::monitoredItemLinked(const Akonadi::Item &item, cons
QList<Node *> &collectionEntities = m_childEntities[collectionId];
int existingPosition = indexOf<Node::Item>(collectionEntities, itemId);
const int existingPosition = indexOf<Node::Item>(collectionEntities, itemId);
if (existingPosition > 0) {
qCWarning(AKONADICORE_LOG) << "Item with id " << itemId << " already in virtual collection with id " << collectionId;
......@@ -1528,7 +1528,8 @@ void EntityTreeModelPrivate::fetchTopLevelCollections() const
q, SLOT(topLevelCollectionsFetched(Akonadi::Collection::List)));
q->connect(job, SIGNAL(result(KJob*)),
q, SLOT(collectionFetchJobDone(KJob*)));
qCDebug(DebugETM) << ""; jobTimeTracker[job].start();
qCDebug(DebugETM) << "EntityTreeModelPrivate::fetchTopLevelCollections";
jobTimeTracker[job].start();
}
void EntityTreeModelPrivate::topLevelCollectionsFetched(const Akonadi::Collection::List &list)
......
......@@ -37,7 +37,6 @@ class RecursiveCollectionFilterProxyModelPrivate
public:
RecursiveCollectionFilterProxyModelPrivate(RecursiveCollectionFilterProxyModel *model)
: q_ptr(model)
, checkOnlyChecked(false)
{
}
......@@ -45,7 +44,7 @@ public:
QSet<QString> includedMimeTypes;
Akonadi::MimeTypeChecker checker;
QString pattern;
bool checkOnlyChecked;
bool checkOnlyChecked = false;
};
}
......@@ -134,13 +133,17 @@ int Akonadi::RecursiveCollectionFilterProxyModel::columnCount(const QModelIndex
void Akonadi::RecursiveCollectionFilterProxyModel::setSearchPattern(const QString &pattern)
{
Q_D(RecursiveCollectionFilterProxyModel);
d->pattern = pattern;
invalidate();
if (d->pattern != pattern) {
d->pattern = pattern;
invalidate();
}
}
void Akonadi::RecursiveCollectionFilterProxyModel::setIncludeCheckedOnly(bool checked)
{
Q_D(RecursiveCollectionFilterProxyModel);
d->checkOnlyChecked = checked;
invalidate();
if (d->checkOnlyChecked != checked) {
d->checkOnlyChecked = checked;
invalidate();
}
}
......@@ -74,8 +74,8 @@ public:
QString toolTipForCollection(const QModelIndex &index, const Collection &collection)
{
QString bckColor = QApplication::palette().color(QPalette::ToolTipBase).name();
QString txtColor = QApplication::palette().color(QPalette::ToolTipText).name();
const QString bckColor = QApplication::palette().color(QPalette::ToolTipBase).name();
const QString txtColor = QApplication::palette().color(QPalette::ToolTipText).name();
QString tip = QStringLiteral(
"<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"0\">\n"
......@@ -96,8 +96,7 @@ public:
" <td align=\"%1\" valign=\"top\">\n"
).arg(textDirection);
QString tipInfo;
tipInfo += QStringLiteral(
QString tipInfo = QStringLiteral(
" <strong>%1</strong>: %2<br>\n"
" <strong>%3</strong>: %4<br><br>\n"
).arg(i18n("Total Messages")).arg(collection.statistics().count())
......
......@@ -27,10 +27,9 @@ class TrashFilterProxyModel::TrashFilterProxyModelPrivate
{
public:
TrashFilterProxyModelPrivate()
: mTrashIsShown(false)
{
}
bool mTrashIsShown;
bool mTrashIsShown = false;
};
TrashFilterProxyModel::TrashFilterProxyModel(QObject *parent)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment