Commit ac2b6572 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix clazy warning

parent 674dfa14
......@@ -123,7 +123,8 @@ void AkonotesIndexer::processPart(KMime::Content *content, KMime::Content *mainC
return;
}
for (KMime::Content *c : content->contents()) {
const auto contents = content->contents();
for (KMime::Content *c : contents) {
processPart(c, mainContent);
}
}
......
......@@ -191,7 +191,7 @@ private Q_SLOTS:
QSharedPointer<DummyJobFactory> factory(new DummyJobFactory());
Scheduler scheduler(index, config, factory);
QSignalSpy statusSpy(&scheduler, SIGNAL(status(int,QString)));
QSignalSpy statusSpy(&scheduler, &Scheduler::status);
QSignalSpy finishedIndexing(&scheduler, &Scheduler::collectionIndexingFinished);
scheduler.setBusyTimeout(0);
......
......@@ -108,7 +108,8 @@ void CollectionIndexer::index(const Akonadi::Collection &collection)
const QByteArray term = "NS" + ns;
doc.add_boolean_term(term.constData());
}
for (const QString &mt : collection.contentMimeTypes()) {
const QStringList contentMimeTypes = collection.contentMimeTypes();
for (const QString &mt : contentMimeTypes) {
const QByteArray term = "M" + mt.toUtf8();
doc.add_boolean_term(term.constData());
}
......
......@@ -55,7 +55,8 @@ static void removeDir(const QString &dirName)
{
QDir dir(dirName);
if (dir.exists(dirName)) {
for (const QFileInfo &info : dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) {
const auto dirs = dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst);
for (const QFileInfo &info : dirs) {
if (info.isDir()) {
removeDir(info.absoluteFilePath());
} else {
......@@ -201,7 +202,8 @@ void Index::change(const Akonadi::Collection &col)
void Index::remove(const Akonadi::Collection &col)
{
//Remove items
for (AbstractIndexer *indexer : indexersForMimetypes(col.contentMimeTypes())) {
const auto indexers = indexersForMimetypes(col.contentMimeTypes());
for (AbstractIndexer *indexer : indexers) {
try {
indexer->remove(col);
} catch (const Xapian::Error &e) {
......@@ -226,7 +228,8 @@ void Index::move(const Akonadi::Collection &collection, const Akonadi::Collectio
void Index::addIndexer(AbstractIndexer *indexer)
{
m_listIndexer.append(indexer);
for (const QString &mimeType : indexer->mimeTypes()) {
const QStringList indexerMimetypes = indexer->mimeTypes();
for (const QString &mimeType : indexerMimetypes) {
m_indexer.insert(mimeType, indexer);
}
}
......
......@@ -297,7 +297,7 @@ QByteArray Query::toJSON() const
map[QStringLiteral("sortingProperty")] = d->m_sortingProperty;
}
if (d->m_customOptions.size()) {
if (!d->m_customOptions.isEmpty()) {
map[QStringLiteral("customOptions")] = d->m_customOptions;
}
......@@ -316,7 +316,7 @@ Query Query::fromJSON(const QByteArray &arr)
Query query;
query.d->m_types = map[QStringLiteral("type")].toStringList();
if (map.contains(QLatin1String("limit"))) {
if (map.contains(QStringLiteral("limit"))) {
query.d->m_limit = map[QStringLiteral("limit")].toUInt();
} else {
query.d->m_limit = defaultLimit;
......@@ -326,26 +326,26 @@ Query Query::fromJSON(const QByteArray &arr)
query.d->m_searchString = map[QStringLiteral("searchString")].toString();
query.d->m_term = Term::fromVariantMap(map[QStringLiteral("term")].toMap());
if (map.contains(QLatin1String("yearFilter"))) {
if (map.contains(QStringLiteral("yearFilter"))) {
query.d->m_yearFilter = map[QStringLiteral("yearFilter")].toInt();
}
if (map.contains(QLatin1String("monthFilter"))) {
if (map.contains(QStringLiteral("monthFilter"))) {
query.d->m_monthFilter = map[QStringLiteral("monthFilter")].toInt();
}
if (map.contains(QLatin1String("dayFilter"))) {
if (map.contains(QStringLiteral("dayFilter"))) {
query.d->m_dayFilter = map[QStringLiteral("dayFilter")].toInt();
}
if (map.contains(QLatin1String("sortingOption"))) {
if (map.contains(QStringLiteral("sortingOption"))) {
int option = map.value(QStringLiteral("sortingOption")).toInt();
query.d->m_sortingOption = static_cast<SortingOption>(option);
}
if (map.contains(QLatin1String("sortingProperty"))) {
if (map.contains(QStringLiteral("sortingProperty"))) {
query.d->m_sortingProperty = map.value(QStringLiteral("sortingProperty")).toString();
}
if (map.contains(QLatin1String("customOptions"))) {
if (map.contains(QStringLiteral("customOptions"))) {
QVariant var = map[QStringLiteral("customOptions")];
if (var.type() == QVariant::Map) {
query.d->m_customOptions = map[QStringLiteral("customOptions")].toMap();
......
......@@ -133,7 +133,8 @@ void PIMContactsRunner::queryContacts(Plasma::RunnerContext &context, const QStr
return;
}
for (const Akonadi::Item &item : fetch->items()) {
const auto items = fetch->items();
for (const Akonadi::Item &item : items) {
KContacts::Addressee contact;
try {
contact = item.payload<KContacts::Addressee>();
......
......@@ -46,7 +46,7 @@ PIMContactsRunnerConfig::PIMContactsRunnerConfig(QWidget *parent, const QVariant
void PIMContactsRunnerConfig::configChanged()
{
Q_EMIT markAsChanged();
markAsChanged();
}
void PIMContactsRunnerConfig::load()
......
......@@ -29,7 +29,7 @@ ContactSearchStore::ContactSearchStore(QObject *parent)
{
m_prefix.insert(QStringLiteral("name"), QStringLiteral("NA"));
m_prefix.insert(QStringLiteral("nick"), QStringLiteral("NI"));
m_prefix.insert(QStringLiteral("email"), QStringLiteral("")); // Email currently doesn't map to anything
m_prefix.insert(QStringLiteral("email"), QLatin1String("")); // Email currently doesn't map to anything
m_prefix.insert(QStringLiteral("collection"), QStringLiteral("C"));
m_prefix.insert(QStringLiteral("uid"), QStringLiteral("UID"));
......
......@@ -74,7 +74,8 @@ int main(int argc, char **argv)
int dbSize = 0;
QDir dbDir(tempDir.path());
for (const QFileInfo &file : dbDir.entryInfoList(QDir::Files)) {
const auto entryInfoList = dbDir.entryInfoList(QDir::Files);
for (const QFileInfo &file : entryInfoList) {
qDebug() << file.fileName() << file.size() / 1024 << "kb";
dbSize += file.size();
}
......
......@@ -149,7 +149,7 @@ int XapianSearchStore::exec(const Query &query)
qCDebug(AKONADI_SEARCH_XAPIAN_LOG) << query.term() << "could not be processed. Aborting";
return 0;
}
if (query.searchString().size()) {
if (!query.searchString().isEmpty()) {
QString str = query.searchString();
Xapian::Query q = constructSearchQuery(str);
......
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