From c715aa180af8cf24b9cd2f1f08bc188ee4912260 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sat, 22 Apr 2017 21:08:03 +0200 Subject: [PATCH] Some clazy fixes. --- src/gui/styleditemdelegatewithoutfocus.h | 2 ++ src/network-web/downloadmanager.h | 3 ++- src/network-web/webfactory.cpp | 12 ++++++++---- src/qtsingleapplication/qtlockedfile.h | 2 ++ .../owncloud/network/owncloudnetworkfactory.cpp | 6 +++--- src/services/owncloud/owncloudcategory.h | 2 ++ src/services/owncloud/owncloudrecyclebin.h | 2 ++ src/services/owncloud/owncloudserviceroot.cpp | 9 ++++++--- 8 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/gui/styleditemdelegatewithoutfocus.h b/src/gui/styleditemdelegatewithoutfocus.h index b27823152..ec7474909 100755 --- a/src/gui/styleditemdelegatewithoutfocus.h +++ b/src/gui/styleditemdelegatewithoutfocus.h @@ -23,6 +23,8 @@ class StyledItemDelegateWithoutFocus : public QStyledItemDelegate { + Q_OBJECT + public: // Constructors. explicit StyledItemDelegateWithoutFocus(QObject *parent = 0); diff --git a/src/network-web/downloadmanager.h b/src/network-web/downloadmanager.h index 4873ed1e8..a91496ff6 100755 --- a/src/network-web/downloadmanager.h +++ b/src/network-web/downloadmanager.h @@ -98,7 +98,6 @@ class WebBrowser; class DownloadManager : public TabContent { Q_OBJECT Q_PROPERTY(RemovePolicy removePolicy READ removePolicy WRITE setRemovePolicy) - Q_ENUMS(RemovePolicy) friend class DownloadModel; @@ -109,6 +108,8 @@ class DownloadManager : public TabContent { OnSuccessfullDownload }; + Q_ENUM(RemovePolicy) + explicit DownloadManager(QWidget *parent = 0); virtual ~DownloadManager(); diff --git a/src/network-web/webfactory.cpp b/src/network-web/webfactory.cpp index abe47e7b9..b24bae77a 100755 --- a/src/network-web/webfactory.cpp +++ b/src/network-web/webfactory.cpp @@ -91,9 +91,11 @@ QString WebFactory::escapeHtml(const QString &html) { } QString output = html; + QMapIterator i(m_escapes); - foreach (const QString &key, m_escapes.keys()) { - output = output.replace(key, m_escapes.value(key)); + while (i.hasNext()) { + i.next(); + output = output.replace(i.key(), i.value()); } return output; @@ -105,9 +107,11 @@ QString WebFactory::deEscapeHtml(const QString &text) { } QString output = text; + QMapIterator i(m_deEscapes); - foreach (const QString &key, m_deEscapes.keys()) { - output = output.replace(key, m_deEscapes.value(key)); + while (i.hasNext()) { + i.next(); + output = output.replace(i.key(), i.value()); } return output; diff --git a/src/qtsingleapplication/qtlockedfile.h b/src/qtsingleapplication/qtlockedfile.h index 84c18e5c9..cbcd0cc78 100644 --- a/src/qtsingleapplication/qtlockedfile.h +++ b/src/qtsingleapplication/qtlockedfile.h @@ -66,6 +66,8 @@ namespace QtLP_Private { class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile { + Q_OBJECT + public: enum LockMode { NoLock = 0, ReadLock, WriteLock }; diff --git a/src/services/owncloud/network/owncloudnetworkfactory.cpp b/src/services/owncloud/network/owncloudnetworkfactory.cpp index c42471578..37764188c 100755 --- a/src/services/owncloud/network/owncloudnetworkfactory.cpp +++ b/src/services/owncloud/network/owncloudnetworkfactory.cpp @@ -502,7 +502,7 @@ RootItem *OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons) cats.insert(0, parent); // Process categories first, then process feeds. - foreach (QJsonValue cat, QJsonDocument::fromJson(m_contentCategories.toUtf8()).object()["folders"].toArray()) { + foreach (const QJsonValue &cat, QJsonDocument::fromJson(m_contentCategories.toUtf8()).object()["folders"].toArray()) { QJsonObject item = cat.toObject(); OwnCloudCategory *category = new OwnCloudCategory(); @@ -516,7 +516,7 @@ RootItem *OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons) } // We have categories added, now add all feeds. - foreach (QJsonValue fed, QJsonDocument::fromJson(m_contentFeeds.toUtf8()).object()["feeds"].toArray()) { + foreach (const QJsonValue &fed, QJsonDocument::fromJson(m_contentFeeds.toUtf8()).object()["feeds"].toArray()) { QJsonObject item = fed.toObject(); OwnCloudFeed *feed = new OwnCloudFeed(); @@ -557,7 +557,7 @@ OwnCloudGetMessagesResponse::~OwnCloudGetMessagesResponse() { QList OwnCloudGetMessagesResponse::messages() const { QList msgs; - foreach (QJsonValue message, m_rawContent["items"].toArray()) { + foreach (const QJsonValue &message, m_rawContent["items"].toArray()) { QJsonObject message_map = message.toObject(); Message msg; diff --git a/src/services/owncloud/owncloudcategory.h b/src/services/owncloud/owncloudcategory.h index 38c10a160..ece0a244e 100755 --- a/src/services/owncloud/owncloudcategory.h +++ b/src/services/owncloud/owncloudcategory.h @@ -22,6 +22,8 @@ class OwnCloudCategory : public Category { + Q_OBJECT + public: explicit OwnCloudCategory(RootItem *parent = NULL); explicit OwnCloudCategory(const QSqlRecord &record); diff --git a/src/services/owncloud/owncloudrecyclebin.h b/src/services/owncloud/owncloudrecyclebin.h index 6c211cc1c..1149248c5 100755 --- a/src/services/owncloud/owncloudrecyclebin.h +++ b/src/services/owncloud/owncloudrecyclebin.h @@ -24,6 +24,8 @@ class OwnCloudServiceRoot; class OwnCloudRecycleBin : public RecycleBin { + Q_OBJECT + public: explicit OwnCloudRecycleBin(RootItem *parent = NULL); virtual ~OwnCloudRecycleBin(); diff --git a/src/services/owncloud/owncloudserviceroot.cpp b/src/services/owncloud/owncloudserviceroot.cpp index 182e1496b..c978ea1d5 100755 --- a/src/services/owncloud/owncloudserviceroot.cpp +++ b/src/services/owncloud/owncloudserviceroot.cpp @@ -154,10 +154,13 @@ void OwnCloudServiceRoot::saveAllCachedData() { m_cacheSaveMutex->unlock(); + QMapIterator i(cached_data_read); + // Save the actual data. - for (int i = 0; i < cached_data_read.size(); i++) { - auto key = cached_data_read.keys().at(i); - QStringList ids = cached_data_read[key]; + while (i.hasNext()) { + i.next(); + auto key = i.key(); + QStringList ids = i.value(); if (!ids.isEmpty()) { network()->markMessagesRead(key, ids);