Some clazy fixes.

This commit is contained in:
Martin Rotter 2017-04-22 21:08:03 +02:00
parent 338f03228d
commit c715aa180a
8 changed files with 27 additions and 11 deletions

View File

@ -23,6 +23,8 @@
class StyledItemDelegateWithoutFocus : public QStyledItemDelegate {
Q_OBJECT
public:
// Constructors.
explicit StyledItemDelegateWithoutFocus(QObject *parent = 0);

View File

@ -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();

View File

@ -91,9 +91,11 @@ QString WebFactory::escapeHtml(const QString &html) {
}
QString output = html;
QMapIterator<QString, QString> 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<QString, QString> 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;

View File

@ -66,6 +66,8 @@ namespace QtLP_Private {
class QT_QTLOCKEDFILE_EXPORT QtLockedFile : public QFile
{
Q_OBJECT
public:
enum LockMode { NoLock = 0, ReadLock, WriteLock };

View File

@ -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<Message> OwnCloudGetMessagesResponse::messages() const {
QList<Message> msgs;
foreach (QJsonValue message, m_rawContent["items"].toArray()) {
foreach (const QJsonValue &message, m_rawContent["items"].toArray()) {
QJsonObject message_map = message.toObject();
Message msg;

View File

@ -22,6 +22,8 @@
class OwnCloudCategory : public Category {
Q_OBJECT
public:
explicit OwnCloudCategory(RootItem *parent = NULL);
explicit OwnCloudCategory(const QSqlRecord &record);

View File

@ -24,6 +24,8 @@
class OwnCloudServiceRoot;
class OwnCloudRecycleBin : public RecycleBin {
Q_OBJECT
public:
explicit OwnCloudRecycleBin(RootItem *parent = NULL);
virtual ~OwnCloudRecycleBin();

View File

@ -154,10 +154,13 @@ void OwnCloudServiceRoot::saveAllCachedData() {
m_cacheSaveMutex->unlock();
QMapIterator<RootItem::ReadStatus, QStringList> 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);