diff --git a/src/librssguard/core/feeddownloader.cpp b/src/librssguard/core/feeddownloader.cpp index 5424fa59b..932a3ad89 100644 --- a/src/librssguard/core/feeddownloader.cpp +++ b/src/librssguard/core/feeddownloader.cpp @@ -226,7 +226,7 @@ void FeedDownloader::updateOneFeed(Feed* feed) { } // Process changed labels. - for (Label* lbl : msg_backup.m_assignedLabels) { + for (Label* lbl : qAsConst(msg_backup.m_assignedLabels)) { if (!msg_orig->m_assignedLabels.contains(lbl)) { // Label is not there anymore, it was deassigned. lbl->deassignFromMessage(*msg_orig); @@ -238,7 +238,7 @@ void FeedDownloader::updateOneFeed(Feed* feed) { } } - for (Label* lbl : msg_orig->m_assignedLabels) { + for (Label* lbl : qAsConst(msg_orig->m_assignedLabels)) { if (!msg_backup.m_assignedLabels.contains(lbl)) { // Label is in new message, but is not in old message, it // was newly assigned. diff --git a/src/librssguard/core/feedsmodel.cpp b/src/librssguard/core/feedsmodel.cpp index 789eac837..25a5ea41c 100644 --- a/src/librssguard/core/feedsmodel.cpp +++ b/src/librssguard/core/feedsmodel.cpp @@ -3,9 +3,9 @@ #include "core/feedsmodel.h" #include "3rd-party/boolinq/boolinq.h" +#include "database/databasefactory.h" #include "definitions/definitions.h" #include "gui/dialogs/formmain.h" -#include "database/databasefactory.h" #include "miscellaneous/feedreader.h" #include "miscellaneous/iconfactory.h" #include "miscellaneous/textfactory.h" @@ -292,8 +292,9 @@ void FeedsModel::reassignNodeToNewParent(RootItem* original_node, RootItem* new_ QListFeedsModel::serviceRoots() const { QList roots; + auto ch = m_rootItem->childItems(); - for (RootItem* root : m_rootItem->childItems()) { + for (RootItem* root : qAsConst(ch)) { if (root->kind() == RootItem::Kind::ServiceRoot) { roots.append(root->toServiceRoot()); } @@ -304,8 +305,9 @@ QListFeedsModel::serviceRoots() const { QListFeedsModel::feedsForScheduledUpdate(bool auto_update_now) { QListfeeds_for_update; + auto stf = m_rootItem->getSubTreeFeeds(); - for (Feed* feed : m_rootItem->getSubTreeFeeds()) { + for (Feed* feed : qAsConst(stf)) { switch (feed->autoUpdateType()) { case Feed::AutoUpdateType::DontAutoUpdate: @@ -489,8 +491,9 @@ bool FeedsModel::addServiceAccount(ServiceRoot* root, bool freshly_activated) { bool FeedsModel::restoreAllBins() { bool result = true; + auto srts = serviceRoots(); - for (ServiceRoot* root : serviceRoots()) { + for (ServiceRoot* root : qAsConst(srts)) { RecycleBin* bin_of_root = root->recycleBin(); if (bin_of_root != nullptr) { @@ -503,8 +506,9 @@ bool FeedsModel::restoreAllBins() { bool FeedsModel::emptyAllBins() { bool result = true; + auto srts = serviceRoots(); - for (ServiceRoot* root : serviceRoots()) { + for (ServiceRoot* root : qAsConst(srts)) { RecycleBin* bin_of_root = root->recycleBin(); if (bin_of_root != nullptr) { @@ -516,8 +520,10 @@ bool FeedsModel::emptyAllBins() { } void FeedsModel::loadActivatedServiceAccounts() { + auto serv = qApp->feedReader()->feedServices(); + // Iterate all globally available feed "service plugins". - for (const ServiceEntryPoint* entry_point : qApp->feedReader()->feedServices()) { + for (const ServiceEntryPoint* entry_point : qAsConst(serv)) { // Load all stored root nodes from the entry point and add those to the model. QList roots = entry_point->initializeSubtree(); @@ -534,7 +540,9 @@ void FeedsModel::loadActivatedServiceAccounts() { } void FeedsModel::stopServiceAccounts() { - for (ServiceRoot* account : serviceRoots()) { + auto serv = serviceRoots(); + + for (ServiceRoot* account : qAsConst(serv)) { account->stop(); } } diff --git a/src/librssguard/core/message.cpp b/src/librssguard/core/message.cpp index 66da7a477..078da16ba 100644 --- a/src/librssguard/core/message.cpp +++ b/src/librssguard/core/message.cpp @@ -20,13 +20,14 @@ Enclosure::Enclosure(QString url, QString mime) : m_url(std::move(url)), m_mimeT QList Enclosures::decodeEnclosuresFromString(const QString& enclosures_data) { QList enclosures; - - for (const QString& single_enclosure : enclosures_data.split(ENCLOSURES_OUTER_SEPARATOR, + auto enc = enclosures_data.split(ENCLOSURES_OUTER_SEPARATOR, #if QT_VERSION >= 0x050F00 // Qt >= 5.15.0 - Qt::SplitBehaviorFlags::SkipEmptyParts)) { + Qt::SplitBehaviorFlags::SkipEmptyParts); #else - QString::SplitBehavior::SkipEmptyParts)) { + QString::SplitBehavior::SkipEmptyParts); #endif + + for (const QString& single_enclosure : qAsConst(enc)) { Enclosure enclosure; if (single_enclosure.contains(ECNLOSURES_INNER_SEPARATOR)) { diff --git a/src/librssguard/core/messageobject.cpp b/src/librssguard/core/messageobject.cpp index f999c9fb2..0f3b19ee2 100755 --- a/src/librssguard/core/messageobject.cpp +++ b/src/librssguard/core/messageobject.cpp @@ -22,7 +22,7 @@ bool MessageObject::isDuplicateWithAttribute(MessageObject::DuplicationAttribute // Check database according to duplication attribute_check. QSqlQuery q(*m_db); QStringList where_clauses; - QList> bind_values; + QVector> bind_values; // Now we construct the query according to parameter. if ((attribute_check& DuplicationAttributeCheck::SameTitle) == DuplicationAttributeCheck::SameTitle) { diff --git a/src/librssguard/core/messageobject.h b/src/librssguard/core/messageobject.h index 7cf18c6a4..36ea5e543 100755 --- a/src/librssguard/core/messageobject.h +++ b/src/librssguard/core/messageobject.h @@ -70,7 +70,7 @@ class MessageObject : public QObject { // Check if message is duplicate with another messages in DB. // Parameter "attribute_check" is DuplicationAttributeCheck enum // value casted to int. - Q_INVOKABLE bool isDuplicateWithAttribute(DuplicationAttributeCheck attribute_check) const; + Q_INVOKABLE bool isDuplicateWithAttribute(MessageObject::DuplicationAttributeCheck attribute_check) const; // Adds given label to list of assigned labels to this message. // Returns true if label was assigned now or if the message already has it assigned. diff --git a/src/librssguard/database/databasefactory.cpp b/src/librssguard/database/databasefactory.cpp index 3d358606a..8e7b505e8 100644 --- a/src/librssguard/database/databasefactory.cpp +++ b/src/librssguard/database/databasefactory.cpp @@ -48,7 +48,7 @@ void DatabaseFactory::determineDriver() { if (m_dbDriver->driverType() != DatabaseDriver::DriverType::SQLite) { // Try to setup connection and fallback to SQLite. try { - m_dbDriver->connection(metaObject()->className()); + m_dbDriver->connection(QSL("DatabaseFactory")); } catch (const ApplicationException& ex) { qCriticalNN << LOGSEC_DB diff --git a/src/librssguard/database/databasequeries.cpp b/src/librssguard/database/databasequeries.cpp index 513117a4b..4dc8d3a95 100755 --- a/src/librssguard/database/databasequeries.cpp +++ b/src/librssguard/database/databasequeries.cpp @@ -598,8 +598,6 @@ int DatabaseQueries::getMessageCountsForLabel(const QSqlDatabase& db, Label* lab return q.value(0).toInt(); } else { - auto aa = q.lastError().text(); - if (ok != nullptr) { *ok = false; } @@ -877,8 +875,6 @@ QList DatabaseQueries::getUndeletedMessagesForAccount(const QSqlDatabas } } else { - auto aa = q.lastError().text(); - if (ok != nullptr) { *ok = false; } @@ -1268,7 +1264,7 @@ bool DatabaseQueries::deleteAccount(const QSqlDatabase& db, int account_id) { << QSL("DELETE FROM Labels WHERE account_id = :account_id;") << QSL("DELETE FROM Accounts WHERE id = :account_id;"); - for (const QString& q : queries) { + for (const QString& q : qAsConst(queries)) { query.prepare(q); query.bindValue(QSL(":account_id"), account_id); @@ -1483,8 +1479,6 @@ bool DatabaseQueries::purgeLeftoverLabelAssignments(const QSqlDatabase& db, int } if (!succ) { - auto xx = q.lastError().text(); - qWarningNN << LOGSEC_DB << "Removing of leftover label assignments failed: '" << q.lastError().text() @@ -1509,11 +1503,10 @@ bool DatabaseQueries::purgeLabelsAndLabelAssignments(const QSqlDatabase& db, int } bool DatabaseQueries::storeAccountTree(const QSqlDatabase& db, RootItem* tree_root, int account_id) { - QSqlQuery query_category(db); - QSqlQuery query_feed(db); - // Iterate all children. - for (RootItem* child : tree_root->getSubTree()) { + auto str = tree_root->getSubTree(); + + for (RootItem* child : qAsConst(str)) { if (child->kind() == RootItem::Kind::Category) { createOverwriteCategory(db, child->toCategory(), account_id, child->parent()->id()); } @@ -1522,7 +1515,9 @@ bool DatabaseQueries::storeAccountTree(const QSqlDatabase& db, RootItem* tree_ro } else if (child->kind() == RootItem::Kind::Labels) { // Add all labels. - for (RootItem* lbl : child->childItems()) { + auto ch = child->childItems(); + + for (RootItem* lbl : qAsConst(ch)) { Label* label = lbl->toLabel(); if (!createLabel(db, label, account_id)) { @@ -1733,8 +1728,6 @@ void DatabaseQueries::createOverwriteFeed(const QSqlDatabase& db, Feed* feed, in q.bindValue(QSL(":custom_data"), serialized_custom_data); if (!q.exec()) { - auto xx = q.lastError().text(); - throw ApplicationException(q.lastError().text()); } } diff --git a/src/librssguard/dynamic-shortcuts/dynamicshortcutswidget.cpp b/src/librssguard/dynamic-shortcuts/dynamicshortcutswidget.cpp index e234ecb92..eeb895161 100644 --- a/src/librssguard/dynamic-shortcuts/dynamicshortcutswidget.cpp +++ b/src/librssguard/dynamic-shortcuts/dynamicshortcutswidget.cpp @@ -41,7 +41,7 @@ bool DynamicShortcutsWidget::areShortcutsUnique() const { } void DynamicShortcutsWidget::updateShortcuts() { - for (const ActionBinding& binding : m_actionBindings) { + for (const ActionBinding& binding : qAsConst(m_actionBindings)) { binding.first->setShortcut(binding.second->shortcut()); } } diff --git a/src/librssguard/gui/dialogs/formaddaccount.cpp b/src/librssguard/gui/dialogs/formaddaccount.cpp index 4143e612c..e3a55940e 100644 --- a/src/librssguard/gui/dialogs/formaddaccount.cpp +++ b/src/librssguard/gui/dialogs/formaddaccount.cpp @@ -58,7 +58,7 @@ ServiceEntryPoint* FormAddAccount::selectedEntryPoint() const { } void FormAddAccount::loadEntryPoints() { - for (const ServiceEntryPoint* entry_point : m_entryPoints) { + for (const ServiceEntryPoint* entry_point : qAsConst(m_entryPoints)) { QListWidgetItem* item = new QListWidgetItem(entry_point->icon(), entry_point->name(), m_ui->m_listEntryPoints); item->setToolTip(entry_point->description()); diff --git a/src/librssguard/gui/dialogs/formmain.cpp b/src/librssguard/gui/dialogs/formmain.cpp index 6ee51a0df..bb1552b07 100755 --- a/src/librssguard/gui/dialogs/formmain.cpp +++ b/src/librssguard/gui/dialogs/formmain.cpp @@ -2,6 +2,7 @@ #include "gui/dialogs/formmain.h" +#include "database/databasefactory.h" #include "definitions/definitions.h" #include "gui/dialogs/formabout.h" #include "gui/dialogs/formaddaccount.h" @@ -22,7 +23,6 @@ #include "gui/systemtrayicon.h" #include "gui/tabbar.h" #include "miscellaneous/application.h" -#include "database/databasefactory.h" #include "miscellaneous/feedreader.h" #include "miscellaneous/iconfactory.h" #include "miscellaneous/mutex.h" @@ -257,7 +257,9 @@ void FormMain::updateAddItemMenu() { // NOTE: Clear here deletes items from memory but only those OWNED by the menu. m_ui->m_menuAddItem->clear(); - for (ServiceRoot* activated_root : qApp->feedReader()->feedsModel()->serviceRoots()) { + auto srts = qApp->feedReader()->feedsModel()->serviceRoots(); + + for (ServiceRoot* activated_root : qAsConst(srts)) { QMenu* root_menu = new QMenu(activated_root->title(), m_ui->m_menuAddItem); root_menu->setIcon(activated_root->icon()); @@ -312,7 +314,9 @@ void FormMain::updateAddItemMenu() { void FormMain::updateRecycleBinMenu() { m_ui->m_menuRecycleBin->clear(); - for (const ServiceRoot* activated_root : qApp->feedReader()->feedsModel()->serviceRoots()) { + auto srts = qApp->feedReader()->feedsModel()->serviceRoots(); + + for (const ServiceRoot* activated_root : qAsConst(srts)) { QMenu* root_menu = new QMenu(activated_root->title(), m_ui->m_menuRecycleBin); root_menu->setIcon(activated_root->icon()); @@ -354,7 +358,9 @@ void FormMain::updateRecycleBinMenu() { void FormMain::updateAccountsMenu() { m_ui->m_menuAccounts->clear(); - for (ServiceRoot* activated_root : qApp->feedReader()->feedsModel()->serviceRoots()) { + auto srts = qApp->feedReader()->feedsModel()->serviceRoots(); + + for (ServiceRoot* activated_root : srts) { QMenu* root_menu = new QMenu(activated_root->title(), m_ui->m_menuAccounts); root_menu->setIcon(activated_root->icon()); diff --git a/src/librssguard/gui/dialogs/formmessagefiltersmanager.cpp b/src/librssguard/gui/dialogs/formmessagefiltersmanager.cpp index f6a4add5e..b50c92aae 100644 --- a/src/librssguard/gui/dialogs/formmessagefiltersmanager.cpp +++ b/src/librssguard/gui/dialogs/formmessagefiltersmanager.cpp @@ -9,11 +9,11 @@ #include "3rd-party/boolinq/boolinq.h" #include "core/messagefilter.h" #include "core/messagesforfiltersmodel.h" +#include "database/databasequeries.h" #include "exceptions/filteringexception.h" #include "gui/guiutilities.h" #include "gui/messagebox.h" #include "miscellaneous/application.h" -#include "database/databasequeries.h" #include "miscellaneous/feedreader.h" #include "miscellaneous/iconfactory.h" #include "network-web/webfactory.h" @@ -157,7 +157,9 @@ void FormMessageFiltersManager::removeSelectedFilter() { } void FormMessageFiltersManager::loadFilters() { - for (auto* fltr : m_reader->messageFilters()) { + auto flt = m_reader->messageFilters(); + + for (auto* fltr : qAsConst(flt)) { auto* it = new QListWidgetItem(fltr->name(), m_ui.m_listFilters); it->setData(Qt::ItemDataRole::UserRole, QVariant::fromValue(fltr)); @@ -344,7 +346,7 @@ void FormMessageFiltersManager::processCheckedFeeds() { } // Process changed labels. - for (Label* lbl : msg_backup.m_assignedLabels) { + for (Label* lbl : qAsConst(msg_backup.m_assignedLabels)) { if (!msg->m_assignedLabels.contains(lbl)) { // Label is not there anymore, it was deassigned. lbl->deassignFromMessage(*msg); @@ -356,7 +358,7 @@ void FormMessageFiltersManager::processCheckedFeeds() { } } - for (Label* lbl : msg->m_assignedLabels) { + for (Label* lbl : qAsConst(msg->m_assignedLabels)) { if (!msg_backup.m_assignedLabels.contains(lbl)) { // Label is in new message, but is not in old message, it // was newly assigned. @@ -428,8 +430,9 @@ void FormMessageFiltersManager::loadFilterFeedAssignments(MessageFilter* filter, } m_loadingFilter = true; + auto stf = account->getSubTreeFeeds(); - for (auto* feed : account->getSubTreeFeeds()) { + for (auto* feed : qAsConst(stf)) { if (feed->messageFilters().contains(filter)) { m_feedsModel->sourceModel()->setItemChecked(feed, Qt::CheckState::Checked); } @@ -503,10 +506,8 @@ void FormMessageFiltersManager::showFilter(MessageFilter* filter) { } void FormMessageFiltersManager::loadAccounts() { - for (auto* acc : m_accounts) { - m_ui.m_cmbAccounts->addItem(acc->icon(), - acc->title(), - QVariant::fromValue(acc)); + for (auto* acc : qAsConst(m_accounts)) { + m_ui.m_cmbAccounts->addItem(acc->icon(), acc->title(), QVariant::fromValue(acc)); } } diff --git a/src/librssguard/gui/dialogs/formsettings.cpp b/src/librssguard/gui/dialogs/formsettings.cpp index 67cd04ad3..dcd7e4d22 100644 --- a/src/librssguard/gui/dialogs/formsettings.cpp +++ b/src/librssguard/gui/dialogs/formsettings.cpp @@ -56,7 +56,7 @@ void FormSettings::applySettings() { m_settings.checkSettings(); QStringList panels_for_restart; - for (SettingsPanel* panel : m_panels) { + for (SettingsPanel* panel : qAsConst(m_panels)) { if (panel->isDirty()) { panel->saveSettings(); } @@ -94,7 +94,7 @@ void FormSettings::applySettings() { void FormSettings::cancelSettings() { QStringList changed_panels; - for (SettingsPanel* panel : m_panels) { + for (SettingsPanel* panel : qAsConst(m_panels)) { if (panel->isDirty()) { changed_panels.append(panel->title().toLower()); } diff --git a/src/librssguard/gui/dialogs/formupdate.cpp b/src/librssguard/gui/dialogs/formupdate.cpp index b9f20d2d1..fea894a93 100644 --- a/src/librssguard/gui/dialogs/formupdate.cpp +++ b/src/librssguard/gui/dialogs/formupdate.cpp @@ -148,7 +148,7 @@ void FormUpdate::saveUpdateFile(const QByteArray& file_contents) { void FormUpdate::loadAvailableFiles() { m_ui.m_listFiles->clear(); - for (const UpdateUrl& url : m_updateInfo.m_urls) { + for (const UpdateUrl& url : qAsConst(m_updateInfo.m_urls)) { if (SystemFactory::supportedUpdateFiles().match(url.m_name).hasMatch()) { QListWidgetItem* item = new QListWidgetItem(url.m_name + tr(" (size ") + url.m_size + QSL(")")); diff --git a/src/librssguard/gui/discoverfeedsbutton.cpp b/src/librssguard/gui/discoverfeedsbutton.cpp index 74764ccd7..a7dc064f2 100644 --- a/src/librssguard/gui/discoverfeedsbutton.cpp +++ b/src/librssguard/gui/discoverfeedsbutton.cpp @@ -60,12 +60,13 @@ void DiscoverFeedsButton::linkTriggered(QAction* action) { void DiscoverFeedsButton::fillMenu() { menu()->clear(); + auto srts = qApp->feedReader()->feedsModel()->serviceRoots(); - for (const ServiceRoot* root : qApp->feedReader()->feedsModel()->serviceRoots()) { + for (const ServiceRoot* root : qAsConst(srts)) { if (root->supportsFeedAdding()) { QMenu* root_menu = menu()->addMenu(root->icon(), root->title()); - for (const QString& url : m_addresses) { + for (const QString& url : qAsConst(m_addresses)) { QAction* url_action = root_menu->addAction(root->icon(), url); url_action->setProperty("url", url); diff --git a/src/librssguard/gui/feedsview.cpp b/src/librssguard/gui/feedsview.cpp index 510b4feb5..3af9fd0ec 100755 --- a/src/librssguard/gui/feedsview.cpp +++ b/src/librssguard/gui/feedsview.cpp @@ -717,7 +717,7 @@ void FeedsView::selectionChanged(const QItemSelection& selected, const QItemSele if (!selectedIndexes().isEmpty() && qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::AutoExpandOnSelection)).toBool()) { - expand(selectedIndexes().first()); + expand(selectedIndexes().constFirst()); } } diff --git a/src/librssguard/gui/labelsmenu.cpp b/src/librssguard/gui/labelsmenu.cpp index 8c955798a..7fda03e49 100644 --- a/src/librssguard/gui/labelsmenu.cpp +++ b/src/librssguard/gui/labelsmenu.cpp @@ -3,8 +3,8 @@ #include "gui/labelsmenu.h" #include "3rd-party/boolinq/boolinq.h" -#include "miscellaneous/application.h" #include "database/databasequeries.h" +#include "miscellaneous/application.h" #include "miscellaneous/iconfactory.h" #include @@ -22,7 +22,7 @@ LabelsMenu::LabelsMenu(const QList& messages, const QList& labe addAction(act_not_labels); } else { - QSqlDatabase db = qApp->database()->driver()->connection(metaObject()->className()); + QSqlDatabase db = qApp->database()->driver()->connection(QSL("LabelsMenu")); for (Label* label: boolinq::from(labels).orderBy([](const Label* label) { return label->title().toLower(); @@ -73,13 +73,13 @@ void LabelsMenu::changeLabelAssignment(Qt::CheckState state) { if (origin != nullptr) { if (state == Qt::CheckState::Checked) { // Assign this label to selected messages. - for (const auto& msg : m_messages) { + for (const auto& msg : qAsConst(m_messages)) { origin->label()->assignToMessage(msg); } } else if (state == Qt::CheckState::Unchecked) { // Remove label from selected messages. - for (const auto& msg : m_messages) { + for (const auto& msg : qAsConst(m_messages)) { origin->label()->deassignFromMessage(msg); } } @@ -140,7 +140,7 @@ void LabelAction::updateActionForState() { break; case Qt::CheckState::PartiallyChecked: - highlight = QColor("#ff8c00"); + highlight = QColor(100, 50, 0); break; case Qt::CheckState::Unchecked: diff --git a/src/librssguard/gui/messagepreviewer.cpp b/src/librssguard/gui/messagepreviewer.cpp index 7d085dcb0..950ee67d1 100755 --- a/src/librssguard/gui/messagepreviewer.cpp +++ b/src/librssguard/gui/messagepreviewer.cpp @@ -231,8 +231,9 @@ void MessagePreviewer::updateLabels(bool only_clear) { if (m_root.data() != nullptr && !m_root.data()->getParentServiceRoot()->labelsNode()->labels().isEmpty()) { m_separator = m_toolBar->addSeparator(); QSqlDatabase database = qApp->database()->driver()->connection(metaObject()->className()); + auto lbls = m_root.data()->getParentServiceRoot()->labelsNode()->labels(); - for (auto* label : m_root.data()->getParentServiceRoot()->labelsNode()->labels()) { + for (auto* label : lbls) { LabelButton* btn_label = new LabelButton(this); btn_label->setLabel(label); diff --git a/src/librssguard/gui/messagesview.cpp b/src/librssguard/gui/messagesview.cpp index 01851c67a..6a14f71c0 100644 --- a/src/librssguard/gui/messagesview.cpp +++ b/src/librssguard/gui/messagesview.cpp @@ -209,10 +209,11 @@ void MessagesView::initializeContextMenu() { // External tools. QFileIconProvider icon_provider; QMenu* menu_ext_tools = new QMenu(tr("Open with external tool"), m_contextMenu); + auto tools = ExternalTool::toolsFromSettings(); menu_ext_tools->setIcon(qApp->icons()->fromTheme(QSL("document-open"))); - for (const ExternalTool& tool : ExternalTool::toolsFromSettings()) { + for (const ExternalTool& tool : qAsConst(tools)) { QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools); act_tool->setIcon(icon_provider.icon(tool.executable())); @@ -375,7 +376,9 @@ void MessagesView::switchShowUnreadOnly(bool set_new_value, bool show_unread_onl } void MessagesView::openSelectedSourceMessagesExternally() { - for (const QModelIndex& index : selectionModel()->selectedRows()) { + auto rws = selectionModel()->selectedRows(); + + for (const QModelIndex& index : qAsConst(rws)) { QString link = m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row()) .m_url .replace(QRegularExpression("[\\t\\n]"), QString()); @@ -397,8 +400,9 @@ void MessagesView::openSelectedSourceMessagesExternally() { void MessagesView::openSelectedMessagesInternally() { QList messages; + auto rws = selectionModel()->selectedRows(); - for (const QModelIndex& index : selectionModel()->selectedRows()) { + for (const QModelIndex& index : qAsConst(rws)) { messages << m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row()); } @@ -591,8 +595,9 @@ void MessagesView::openSelectedMessagesWithExternalTool() { if (sndr != nullptr) { auto tool = sndr->data().value(); + auto rws = selectionModel()->selectedRows(); - for (const QModelIndex& index : selectionModel()->selectedRows()) { + for (const QModelIndex& index : qAsConst(rws)) { const QString link = m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row()) .m_url .replace(QRegularExpression("[\\t\\n]"), QString()); diff --git a/src/librssguard/gui/settings/settingsfeedsmessages.cpp b/src/librssguard/gui/settings/settingsfeedsmessages.cpp index 09c66d53c..550d4aef4 100644 --- a/src/librssguard/gui/settings/settingsfeedsmessages.cpp +++ b/src/librssguard/gui/settings/settingsfeedsmessages.cpp @@ -92,8 +92,9 @@ void SettingsFeedsMessages::initializeMessageDateFormats() { QStringList best_formats; const QDateTime current_dt = QDateTime::currentDateTime(); const QLocale current_locale = qApp->localization()->loadedLocale(); + auto installed_languages = qApp->localization()->installedLanguages(); - for (const Language& lang : qApp->localization()->installedLanguages()) { + for (const Language& lang : qAsConst(installed_languages)) { QLocale locale(lang.m_code); best_formats << locale.dateTimeFormat(QLocale::LongFormat) @@ -103,7 +104,7 @@ void SettingsFeedsMessages::initializeMessageDateFormats() { best_formats.removeDuplicates(); - for (const QString& format : best_formats) { + for (const QString& format : qAsConst(best_formats)) { m_ui->m_cmbMessagesDateTimeFormat->addItem(current_locale.toString(current_dt, format), format); } }