fix warnings

This commit is contained in:
Martin Rotter 2023-11-11 08:18:19 +01:00
parent b6269bf0e6
commit 2aead89071
43 changed files with 100 additions and 100 deletions

View File

@ -353,14 +353,14 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
// and store the fact to server (of synchronized) and local DB later.
// This is mainly because articles might not even be in DB yet.
// So first insert articles, then update their label assignments etc.
for (Label* lbl : qAsConst(msg_original.m_assignedLabels)) {
for (Label* lbl : std::as_const(msg_original.m_assignedLabels)) {
if (!msg_tweaked_by_filter->m_assignedLabels.contains(lbl)) {
// Label is not there anymore, it was deassigned.
msg_tweaked_by_filter->m_deassignedLabelsByFilter << lbl;
}
}
for (Label* lbl : qAsConst(msg_tweaked_by_filter->m_assignedLabels)) {
for (Label* lbl : std::as_const(msg_tweaked_by_filter->m_assignedLabels)) {
if (!msg_original.m_assignedLabels.contains(lbl)) {
// Label is in new message, but is not in old message, it
// was newly assigned.

View File

@ -234,7 +234,7 @@ QList<ServiceRoot*> FeedsModel::serviceRoots() const {
QList<ServiceRoot*> roots;
auto ch = m_rootItem->childItems();
for (RootItem* root : qAsConst(ch)) {
for (RootItem* root : std::as_const(ch)) {
if (root->kind() == RootItem::Kind::ServiceRoot) {
roots.append(root->toServiceRoot());
}
@ -248,7 +248,7 @@ QList<Feed*> FeedsModel::feedsForScheduledUpdate(bool auto_update_now) {
auto stf = m_rootItem->getSubTreeFeeds();
auto cur_date = QDateTime::currentDateTimeUtc();
for (Feed* feed : qAsConst(stf)) {
for (Feed* feed : std::as_const(stf)) {
switch (feed->autoUpdateType()) {
case Feed::AutoUpdateType::DontAutoUpdate:
// Do not auto-update this feed ever.
@ -432,7 +432,7 @@ bool FeedsModel::restoreAllBins() {
bool result = true;
auto srts = serviceRoots();
for (ServiceRoot* root : qAsConst(srts)) {
for (ServiceRoot* root : std::as_const(srts)) {
RecycleBin* bin_of_root = root->recycleBin();
if (bin_of_root != nullptr) {
@ -447,7 +447,7 @@ bool FeedsModel::emptyAllBins() {
bool result = true;
auto srts = serviceRoots();
for (ServiceRoot* root : qAsConst(srts)) {
for (ServiceRoot* root : std::as_const(srts)) {
RecycleBin* bin_of_root = root->recycleBin();
if (bin_of_root != nullptr) {
@ -480,7 +480,7 @@ void FeedsModel::loadActivatedServiceAccounts() {
auto serv = qApp->feedReader()->feedServices();
// Iterate all globally available feed "service plugins".
for (const ServiceEntryPoint* entry_point : qAsConst(serv)) {
for (const ServiceEntryPoint* entry_point : std::as_const(serv)) {
// Load all stored root nodes from the entry point and add those to the model.
QList<ServiceRoot*> roots = entry_point->initializeSubtree();
@ -499,7 +499,7 @@ void FeedsModel::loadActivatedServiceAccounts() {
void FeedsModel::stopServiceAccounts() {
auto serv = serviceRoots();
for (ServiceRoot* account : qAsConst(serv)) {
for (ServiceRoot* account : std::as_const(serv)) {
account->stop();
}
}

View File

@ -28,7 +28,7 @@ QList<Enclosure> Enclosures::decodeEnclosuresFromString(const QString& enclosure
QList<Enclosure> enclosures;
enclosures.reserve(enc.size());
for (const QString& single_enclosure : qAsConst(enc)) {
for (const QString& single_enclosure : std::as_const(enc)) {
Enclosure enclosure;
if (single_enclosure.contains(ECNLOSURES_INNER_SEPARATOR)) {

View File

@ -1812,7 +1812,7 @@ bool DatabaseQueries::deleteAccount(const QSqlDatabase& db, ServiceRoot* account
<< QSL("DELETE FROM Labels WHERE account_id = :account_id;")
<< QSL("DELETE FROM Accounts WHERE id = :account_id;");
for (const QString& q : qAsConst(queries)) {
for (const QString& q : std::as_const(queries)) {
query.prepare(q);
query.bindValue(QSL(":account_id"), account->accountId());
@ -2045,7 +2045,7 @@ void DatabaseQueries::storeAccountTree(const QSqlDatabase& db, RootItem* tree_ro
// Iterate all children.
auto str = tree_root->getSubTree();
for (RootItem* child : qAsConst(str)) {
for (RootItem* child : std::as_const(str)) {
if (child->kind() == RootItem::Kind::Category) {
createOverwriteCategory(db, child->toCategory(), account_id, child->parent()->id());
}
@ -2056,7 +2056,7 @@ void DatabaseQueries::storeAccountTree(const QSqlDatabase& db, RootItem* tree_ro
// Add all labels.
auto ch = child->childItems();
for (RootItem* lbl : qAsConst(ch)) {
for (RootItem* lbl : std::as_const(ch)) {
Label* label = lbl->toLabel();
createLabel(db, label, account_id);

View File

@ -41,7 +41,7 @@ bool DynamicShortcutsWidget::areShortcutsUnique() const {
}
void DynamicShortcutsWidget::updateShortcuts() {
for (const ActionBinding& binding : qAsConst(m_actionBindings)) {
for (const ActionBinding& binding : std::as_const(m_actionBindings)) {
binding.first->setShortcut(binding.second->shortcut());
}
}

View File

@ -58,7 +58,7 @@ ServiceEntryPoint* FormAddAccount::selectedEntryPoint() const {
void FormAddAccount::loadEntryPoints() {
int classic_row = 0, i = 0;
for (const ServiceEntryPoint* entry_point : qAsConst(m_entryPoints)) {
for (const ServiceEntryPoint* entry_point : std::as_const(m_entryPoints)) {
if (entry_point->code() == QSL(SERVICE_CODE_STD_RSS)) {
classic_row = i;
}

View File

@ -306,7 +306,7 @@ void FormMain::updateAddItemMenu() {
auto srts = qApp->feedReader()->feedsModel()->serviceRoots();
for (ServiceRoot* activated_root : qAsConst(srts)) {
for (ServiceRoot* activated_root : std::as_const(srts)) {
QMenu* root_menu = new QMenu(activated_root->title(), m_ui->m_menuAddItem);
root_menu->setIcon(activated_root->icon());
@ -359,7 +359,7 @@ void FormMain::updateRecycleBinMenu() {
auto srts = qApp->feedReader()->feedsModel()->serviceRoots();
for (const ServiceRoot* activated_root : qAsConst(srts)) {
for (const ServiceRoot* activated_root : std::as_const(srts)) {
QMenu* root_menu = new QMenu(activated_root->title(), m_ui->m_menuRecycleBin);
root_menu->setIcon(activated_root->icon());

View File

@ -221,7 +221,7 @@ void FormMessageFiltersManager::removeSelectedFilter() {
void FormMessageFiltersManager::loadFilters() {
auto flt = m_reader->messageFilters();
for (auto* fltr : qAsConst(flt)) {
for (auto* fltr : std::as_const(flt)) {
auto* it = new QListWidgetItem(fltr->name(), m_ui.m_listFilters);
it->setData(Qt::ItemDataRole::UserRole, QVariant::fromValue<MessageFilter*>(fltr));
@ -421,7 +421,7 @@ void FormMessageFiltersManager::processCheckedFeeds() {
}
// Process changed labels.
for (Label* lbl : qAsConst(msg_backup.m_assignedLabels)) {
for (Label* lbl : std::as_const(msg_backup.m_assignedLabels)) {
if (!msg->m_assignedLabels.contains(lbl)) {
// Label is not there anymore, it was deassigned.
lbl->deassignFromMessage(*msg);
@ -431,7 +431,7 @@ void FormMessageFiltersManager::processCheckedFeeds() {
}
}
for (Label* lbl : qAsConst(msg->m_assignedLabels)) {
for (Label* lbl : std::as_const(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.
@ -504,7 +504,7 @@ void FormMessageFiltersManager::loadFilterFeedAssignments(MessageFilter* filter,
m_loadingFilter = true;
auto stf = account->getSubTreeFeeds();
for (auto* feed : qAsConst(stf)) {
for (auto* feed : std::as_const(stf)) {
if (feed->messageFilters().contains(filter)) {
m_feedsModel->sourceModel()->setItemChecked(feed, Qt::CheckState::Checked);
}
@ -578,7 +578,7 @@ void FormMessageFiltersManager::showFilter(MessageFilter* filter) {
}
void FormMessageFiltersManager::loadAccounts() {
for (auto* acc : qAsConst(m_accounts)) {
for (auto* acc : std::as_const(m_accounts)) {
m_ui.m_cmbAccounts->addItem(acc->icon(), acc->title(), QVariant::fromValue(acc));
}
}

View File

@ -82,7 +82,7 @@ void FormSettings::applySettings() {
m_settings.checkSettings();
QStringList panels_for_restart;
for (SettingsPanel* panel : qAsConst(m_panels)) {
for (SettingsPanel* panel : std::as_const(m_panels)) {
if (panel->isDirty() && panel->isLoaded()) {
panel->saveSettings();
}
@ -122,7 +122,7 @@ void FormSettings::applySettings() {
void FormSettings::cancelSettings() {
QStringList changed_panels;
for (SettingsPanel* panel : qAsConst(m_panels)) {
for (SettingsPanel* panel : std::as_const(m_panels)) {
if (panel->isLoaded() && panel->isDirty()) {
changed_panels.append(panel->title().toLower());
}

View File

@ -150,7 +150,7 @@ void FormUpdate::saveUpdateFile(const QByteArray& file_contents) {
void FormUpdate::loadAvailableFiles() {
m_ui.m_listFiles->clear();
for (const UpdateUrl& url : qAsConst(m_updateInfo.m_urls)) {
for (const UpdateUrl& url : std::as_const(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(")"));

View File

@ -423,7 +423,7 @@ void MessagesView::initializeContextMenu() {
menu_ext_tools->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
for (const ExternalTool& tool : qAsConst(tools)) {
for (const ExternalTool& tool : std::as_const(tools)) {
QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools);
act_tool->setIcon(icon_provider.icon(QFileInfo(tool.executable())));
@ -612,7 +612,7 @@ void MessagesView::changeFilter(MessagesProxyModel::MessageListFilter filter) {
void MessagesView::openSelectedSourceMessagesExternally() {
auto rws = selectionModel()->selectedRows();
for (const QModelIndex& index : qAsConst(rws)) {
for (const QModelIndex& index : std::as_const(rws)) {
QString link = m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row())
.m_url.replace(QRegularExpression(QSL("[\\t\\n]")), QString());
@ -637,7 +637,7 @@ void MessagesView::openSelectedMessagesInternally() {
QList<Message> messages;
auto rws = selectionModel()->selectedRows();
for (const QModelIndex& index : qAsConst(rws)) {
for (const QModelIndex& index : std::as_const(rws)) {
messages << m_sourceModel->messageAt(m_proxyModel->mapToSource(index).row());
}
@ -869,7 +869,7 @@ void MessagesView::openSelectedMessagesWithExternalTool() {
auto tool = sndr->data().value<ExternalTool>();
auto rws = selectionModel()->selectedRows();
for (const QModelIndex& index : qAsConst(rws)) {
for (const QModelIndex& index : std::as_const(rws)) {
const QString link =
m_sourceModel->data(m_proxyModel->mapToSource(index).row(), MSG_DB_URL_INDEX, Qt::ItemDataRole::EditRole)
.toString()

View File

@ -20,7 +20,7 @@ JsSyntaxHighlighter::JsSyntaxHighlighter(QTextDocument* parent) : QSyntaxHighlig
keywords = FROM_STD_LIST(QStringList, std_keywords);
for (const QString& pattern : qAsConst(keywords)) {
for (const QString& pattern : std::as_const(keywords)) {
rule.m_pattern = QRegularExpression(pattern);
rule.m_format = m_keywordFormat;

View File

@ -78,13 +78,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 : qAsConst(m_messages)) {
for (const auto& msg : std::as_const(m_messages)) {
origin->label()->assignToMessage(msg);
}
}
else if (state == Qt::CheckState::Unchecked) {
// Remove label from selected messages.
for (const auto& msg : qAsConst(m_messages)) {
for (const auto& msg : std::as_const(m_messages)) {
origin->label()->deassignFromMessage(msg);
}
}

View File

@ -165,7 +165,7 @@ void SettingsGui::loadSettings() {
const QString current_theme = qApp->icons()->currentIconTheme();
auto icons = qApp->icons()->installedIconThemes();
for (const QString& icon_theme_name : qAsConst(icons)) {
for (const QString& icon_theme_name : std::as_const(icons)) {
if (icon_theme_name == QSL(APP_NO_THEME)) {
// Add just "no theme" on other systems.
//: Label for disabling icon theme.
@ -201,7 +201,7 @@ void SettingsGui::loadSettings() {
// Load styles.
auto styles = QStyleFactory::keys();
for (const QString& style_name : qAsConst(styles)) {
for (const QString& style_name : std::as_const(styles)) {
m_ui->m_cmbStyles->addItem(style_name);
}
@ -218,7 +218,7 @@ void SettingsGui::loadSettings() {
const QString selected_skin = qApp->skins()->selectedSkinName();
auto skins = qApp->skins()->installedSkins();
for (const Skin& skin : qAsConst(skins)) {
for (const Skin& skin : std::as_const(skins)) {
QTreeWidgetItem* new_item =
new QTreeWidgetItem({skin.m_visibleName,
skin.m_author,

View File

@ -112,7 +112,7 @@ void SettingsLocalization::loadSettings() {
tr("Big thanks to all translators!"));
}
for (const Language& language : qAsConst(langs)) {
for (const Language& language : std::as_const(langs)) {
auto* item = new QTreeWidgetItem(m_ui->m_treeLanguages);
int perc_translated = percentages_langs.value(language.m_code);

View File

@ -401,7 +401,7 @@ void TextBrowserViewer::contextMenuEvent(QContextMenuEvent* event) {
menu_ext_tools->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
for (const ExternalTool& tool : qAsConst(tools)) {
for (const ExternalTool& tool : std::as_const(tools)) {
QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools);
act_tool->setIcon(icon_provider.icon(QFileInfo(tool.executable())));

View File

@ -111,7 +111,7 @@ void WebEngineViewer::contextMenuEvent(QContextMenuEvent* event) {
menu_ext_tools->setIcon(qApp->icons()->fromTheme(QSL("document-open")));
for (const ExternalTool& tool : qAsConst(tools)) {
for (const ExternalTool& tool : std::as_const(tools)) {
QAction* act_tool = new QAction(QFileInfo(tool.executable()).fileName(), menu_ext_tools);
act_tool->setIcon(icon_provider.icon(QFileInfo(tool.executable())));

View File

@ -1151,7 +1151,7 @@ void Application::parseCmdArgumentsFromOtherInstance(const QString& message) {
messages = cmd_parser.positionalArguments();
for (const QString& msg : qAsConst(messages)) {
for (const QString& msg : std::as_const(messages)) {
// Application was running, and someone wants to add new feed.
ServiceRoot* rt = boolinq::from(feedReader()->feedsModel()->serviceRoots()).firstOrDefault([](ServiceRoot* root) {
return root->supportsFeedAdding();

View File

@ -202,7 +202,7 @@ void FeedReader::loadSavedMessageFilters() {
m_messageFilters =
DatabaseQueries::getMessageFilters(qApp->database()->driver()->connection(metaObject()->className()));
for (auto* filter : qAsConst(m_messageFilters)) {
for (auto* filter : std::as_const(m_messageFilters)) {
filter->setParent(this);
}
}

View File

@ -150,7 +150,7 @@ QStringList IconFactory::installedIconThemes() const {
QDir::SortFlag::Time);
// Iterate all icon themes in this directory.
for (const QFileInfo& icon_theme_path : qAsConst(icon_paths)) {
for (const QFileInfo& icon_theme_path : std::as_const(icon_paths)) {
QDir icon_theme_dir = QDir(icon_theme_path.absoluteFilePath());
if (icon_theme_dir.exists(filters_index.at(0))) {

View File

@ -72,7 +72,7 @@ QList<Language> Localization::installedLanguages() const {
file_dir.entryInfoList(QStringList() << QSL("rssguard_*.qm"), QDir::Filter::Files, QDir::SortFlag::Name);
// Iterate all found language files.
for (const QFileInfo& file : qAsConst(lang_files)) {
for (const QFileInfo& file : std::as_const(lang_files)) {
if (translator.load(file.absoluteFilePath())) {
Language new_language;

View File

@ -62,7 +62,7 @@ void NotificationFactory::save(const QList<Notification>& new_notifications, Set
settings->remove(GROUP(Notifications));
m_notifications = new_notifications;
for (const auto& n : qAsConst(m_notifications)) {
for (const auto& n : std::as_const(m_notifications)) {
settings->setValue(GROUP(Notifications),
QString::number(int(n.event())),
QStringList{n.balloonEnabled() ? QSL("1") : QSL("0"),

View File

@ -92,7 +92,7 @@ QDateTime TextFactory::parseDateTime(const QString& date_time) {
<< QSL("-hh");
// Iterate over patterns and check if input date/time matches the pattern.
for (const QString& pattern : qAsConst(date_patterns)) {
for (const QString& pattern : std::as_const(date_patterns)) {
dt = locale.toDateTime(input_date.left(pattern.size()), pattern);
if (dt.isValid()) {
@ -103,7 +103,7 @@ QDateTime TextFactory::parseDateTime(const QString& date_time) {
if (input_date.size() >= TIMEZONE_OFFSET_LIMIT) {
QString offset_sanitized = input_date.mid(pattern.size()).replace(QL1S(" "), QString());
for (const QString& pattern_t : qAsConst(timezone_offset_patterns)) {
for (const QString& pattern_t : std::as_const(timezone_offset_patterns)) {
time_zone_offset = QTime::fromString(offset_sanitized.left(pattern_t.size()), pattern_t);
if (time_zone_offset.isValid()) {

View File

@ -353,7 +353,7 @@ void AdBlockManager::updateUnifiedFiltersFileAndStartServer() {
auto filter_lists = filterLists();
// Download filters one by one and append.
for (const QString& filter_list_url : qAsConst(filter_lists)) {
for (const QString& filter_list_url : std::as_const(filter_lists)) {
if (filter_list_url.simplified().isEmpty()) {
continue;
}

View File

@ -82,7 +82,7 @@ void CookieJar::loadCookies() {
Settings* sett = qApp->settings();
auto keys = sett->allKeys(GROUP(Cookies));
for (const QString& cookie_key : qAsConst(keys)) {
for (const QString& cookie_key : std::as_const(keys)) {
QByteArray encoded = sett->password(GROUP(Cookies), cookie_key, {}).toByteArray();
if (!encoded.isEmpty()) {

View File

@ -315,7 +315,7 @@ QList<HttpResponse> Downloader::decodeMultipartAnswer(QNetworkReply* reply) {
QString::SplitBehavior::SkipEmptyParts);
#endif
for (const QString& header_line : qAsConst(header_lines)) {
for (const QString& header_line : std::as_const(header_lines)) {
int index_colon = header_line.indexOf(QL1C(':'));
if (index_colon > 0) {

View File

@ -33,7 +33,7 @@ void NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) {
// NOTE: Here we can add custom headers for each webengine request, for example "User-Agent".
for (UrlInterceptor* interceptor : qAsConst(m_interceptors)) {
for (UrlInterceptor* interceptor : std::as_const(m_interceptors)) {
interceptor->interceptRequest(info);
}
}

View File

@ -46,7 +46,7 @@ void AccountCheckModel::checkAllItems() {
if (m_rootItem != nullptr) {
auto chi = m_rootItem->childItems();
for (RootItem* root_child : qAsConst(chi)) {
for (RootItem* root_child : std::as_const(chi)) {
if (root_child->kind() == RootItem::Kind::Feed || root_child->kind() == RootItem::Kind::Category) {
setItemChecked(root_child, Qt::CheckState::Checked);
}
@ -58,7 +58,7 @@ void AccountCheckModel::uncheckAllItems() {
if (m_rootItem != nullptr) {
auto chi = m_rootItem->childItems();
for (RootItem* root_child : qAsConst(chi)) {
for (RootItem* root_child : std::as_const(chi)) {
if (root_child->kind() == RootItem::Kind::Feed || root_child->kind() == RootItem::Kind::Category) {
setData(indexForItem(root_child), Qt::CheckState::Unchecked, Qt::ItemDataRole::CheckStateRole);
}
@ -219,7 +219,7 @@ bool AccountCheckModel::setData(const QModelIndex& index, const QVariant& value,
// Set new data for all descendants of this actual item.
auto chi = item->childItems();
for (RootItem* child : qAsConst(chi)) {
for (RootItem* child : std::as_const(chi)) {
setData(indexForItem(child), value, Qt::CheckStateRole);
}
@ -238,7 +238,7 @@ bool AccountCheckModel::setData(const QModelIndex& index, const QVariant& value,
bool all_unchecked = true;
auto childr = item->childItems();
for (RootItem* child_of_parent : qAsConst(childr)) {
for (RootItem* child_of_parent : std::as_const(childr)) {
if (m_checkStates.contains(child_of_parent)) {
all_checked &= m_checkStates[child_of_parent] == Qt::CheckState::Checked;
all_unchecked &= m_checkStates[child_of_parent] == Qt::CheckState::Unchecked;

View File

@ -20,7 +20,7 @@ void Category::updateCounts(bool including_total_count) {
QList<Feed*> feeds;
auto str = childItems();
for (RootItem* child : qAsConst(str)) {
for (RootItem* child : std::as_const(str)) {
if (child->kind() == RootItem::Kind::Feed) {
feeds.append(child->toFeed());
}

View File

@ -70,7 +70,7 @@ bool RootItem::deleteItem() {
bool RootItem::markAsReadUnread(ReadStatus status) {
bool result = true;
for (RootItem* child : qAsConst(m_childItems)) {
for (RootItem* child : std::as_const(m_childItems)) {
result &= child->markAsReadUnread(status);
}
@ -80,7 +80,7 @@ bool RootItem::markAsReadUnread(ReadStatus status) {
QList<Message> RootItem::undeletedMessages() const {
QList<Message> messages;
for (RootItem* child : qAsConst(m_childItems)) {
for (RootItem* child : std::as_const(m_childItems)) {
if (child->kind() != Kind::Bin && child->kind() != Kind::Labels && child->kind() != Kind::Label) {
messages.append(child->undeletedMessages());
}
@ -92,7 +92,7 @@ QList<Message> RootItem::undeletedMessages() const {
bool RootItem::cleanMessages(bool clear_only_read) {
bool result = true;
for (RootItem* child : qAsConst(m_childItems)) {
for (RootItem* child : std::as_const(m_childItems)) {
if (child->kind() != RootItem::Kind::Bin) {
result &= child->cleanMessages(clear_only_read);
}
@ -102,7 +102,7 @@ bool RootItem::cleanMessages(bool clear_only_read) {
}
void RootItem::updateCounts(bool including_total_count) {
for (RootItem* child : qAsConst(m_childItems)) {
for (RootItem* child : std::as_const(m_childItems)) {
child->updateCounts(including_total_count);
}
}

View File

@ -231,7 +231,7 @@ void ServiceRoot::updateCounts(bool including_total_count) {
QList<Feed*> feeds;
auto str = getSubTree();
for (RootItem* child : qAsConst(str)) {
for (RootItem* child : std::as_const(str)) {
if (child->kind() == RootItem::Kind::Feed) {
feeds.append(child->toFeed());
}
@ -306,7 +306,7 @@ void ServiceRoot::removeOldAccountFromDatabase(bool delete_messages_too, bool de
void ServiceRoot::cleanAllItemsFromModel(bool clean_labels_too) {
auto chi = childItems();
for (RootItem* top_level_item : qAsConst(chi)) {
for (RootItem* top_level_item : std::as_const(chi)) {
if (top_level_item->kind() != RootItem::Kind::Bin && top_level_item->kind() != RootItem::Kind::Important &&
top_level_item->kind() != RootItem::Kind::Unread && top_level_item->kind() != RootItem::Kind::Probes &&
top_level_item->kind() != RootItem::Kind::Labels) {
@ -317,7 +317,7 @@ void ServiceRoot::cleanAllItemsFromModel(bool clean_labels_too) {
if (labelsNode() != nullptr && clean_labels_too) {
auto lbl_chi = labelsNode()->childItems();
for (RootItem* lbl : qAsConst(lbl_chi)) {
for (RootItem* lbl : std::as_const(lbl_chi)) {
requestItemRemoval(lbl);
}
}
@ -479,7 +479,7 @@ QMap<QString, QVariantMap> ServiceRoot::storeCustomFeedsData() {
QMap<QString, QVariantMap> custom_data;
auto str = getSubTreeFeeds();
for (const Feed* feed : qAsConst(str)) {
for (const Feed* feed : std::as_const(str)) {
QVariantMap feed_custom_data;
// TODO: This could potentially call Feed::customDatabaseData() and append it
@ -510,7 +510,7 @@ QMap<QString, QVariantMap> ServiceRoot::storeCustomCategoriesData() {
QMap<QString, QVariantMap> custom_data;
auto str = getSubTreeCategories();
for (const Category* cat : qAsConst(str)) {
for (const Category* cat : std::as_const(str)) {
QVariantMap cat_custom_data;
// NOTE: This is here specifically to be able to restore custom sort order.
@ -666,7 +666,7 @@ void ServiceRoot::syncIn() {
auto chi = new_tree->childItems();
for (RootItem* top_level_item : qAsConst(chi)) {
for (RootItem* top_level_item : std::as_const(chi)) {
if (top_level_item->kind() != Kind::Labels) {
top_level_item->setParent(nullptr);
requestItemReassignment(top_level_item, this);
@ -676,7 +676,7 @@ void ServiceRoot::syncIn() {
if (labelsNode() != nullptr) {
auto lbl_chi = top_level_item->childItems();
for (RootItem* new_lbl : qAsConst(lbl_chi)) {
for (RootItem* new_lbl : std::as_const(lbl_chi)) {
new_lbl->setParent(nullptr);
requestItemReassignment(new_lbl, labelsNode());
}
@ -736,7 +736,7 @@ QStringList ServiceRoot::customIDSOfMessagesForItem(RootItem* item, ReadStatus t
case RootItem::Kind::Category: {
auto chi = item->childItems();
for (RootItem* child : qAsConst(chi)) {
for (RootItem* child : std::as_const(chi)) {
list.append(customIDSOfMessagesForItem(child, target_read));
}

View File

@ -413,7 +413,7 @@ QList<Message> FeedlyNetwork::decodeStreamContents(const QByteArray& stream_cont
auto items = nested_items ? json.object()[QSL("items")].toArray() : json.array();
for (const QJsonValue& entry : qAsConst(items)) {
for (const QJsonValue& entry : std::as_const(items)) {
const QJsonObject& entry_obj = entry.toObject();
Message message;
@ -451,7 +451,7 @@ QList<Message> FeedlyNetwork::decodeStreamContents(const QByteArray& stream_cont
auto enclosures = entry_obj[QSL("enclosure")].toArray();
for (const QJsonValue& enc : qAsConst(enclosures)) {
for (const QJsonValue& enc : std::as_const(enclosures)) {
const QJsonObject& enc_obj = enc.toObject();
const QString& enc_href = enc_obj[QSL("href")].toString();
@ -464,7 +464,7 @@ QList<Message> FeedlyNetwork::decodeStreamContents(const QByteArray& stream_cont
auto tags = entry_obj[QSL("tags")].toArray();
for (const QJsonValue& tag : qAsConst(tags)) {
for (const QJsonValue& tag : std::as_const(tags)) {
const QJsonObject& tag_obj = tag.toObject();
const QString& tag_id = tag_obj[QSL("id")].toString();
@ -532,7 +532,7 @@ RootItem* FeedlyNetwork::decodeCollections(const QByteArray& json,
QList<QString> used_feeds;
auto coll = doc.array();
for (const QJsonValue& cat : qAsConst(coll)) {
for (const QJsonValue& cat : std::as_const(coll)) {
QJsonObject cat_obj = cat.toObject();
auto* category = new Category(parent);
@ -541,7 +541,7 @@ RootItem* FeedlyNetwork::decodeCollections(const QByteArray& json,
auto feeds = cat[QSL("feeds")].toArray();
for (const QJsonValue& fee : qAsConst(feeds)) {
for (const QJsonValue& fee : std::as_const(feeds)) {
QJsonObject fee_obj = fee.toObject();
if (used_feeds.contains(fee_obj[QSL("id")].toString())) {
@ -663,7 +663,7 @@ QList<RootItem*> FeedlyNetwork::tags() {
QList<RootItem*> lbls;
auto tags = json.array();
for (const QJsonValue& tag : qAsConst(tags)) {
for (const QJsonValue& tag : std::as_const(tags)) {
const QJsonObject& tag_obj = tag.toObject();
QString name_id = tag_obj[QSL("id")].toString();

View File

@ -531,7 +531,7 @@ bool GmailNetworkFactory::fillFullMessage(Message& msg, const QJsonObject& json,
QHash<QString, QString> headers;
auto json_headers = json[QSL("payload")].toObject()[QSL("headers")].toArray();
for (const QJsonValue& header : qAsConst(json_headers)) {
for (const QJsonValue& header : std::as_const(json_headers)) {
headers.insert(header.toObject()[QSL("name")].toString(), header.toObject()["value"].toString());
}
@ -541,7 +541,7 @@ bool GmailNetworkFactory::fillFullMessage(Message& msg, const QJsonObject& json,
auto active_labels = m_service->labelsNode() != nullptr ? m_service->labelsNode()->labels() : QList<Label*>();
auto active_labels_linq = boolinq::from(active_labels);
for (const QVariant& label : qAsConst(labelids)) {
for (const QVariant& label : std::as_const(labelids)) {
QString lbl = label.toString();
if (lbl == QSL(GMAIL_SYSTEM_LABEL_UNREAD)) {
@ -587,7 +587,7 @@ bool GmailNetworkFactory::fillFullMessage(Message& msg, const QJsonObject& json,
auto this_part = parts_to_process.takeFirst();
auto nested_parts = this_part[QSL("parts")].toArray();
for (const QJsonValue& prt : qAsConst(nested_parts)) {
for (const QJsonValue& prt : std::as_const(nested_parts)) {
auto prt_obj = prt.toObject();
parts.append(prt_obj);
@ -599,7 +599,7 @@ bool GmailNetworkFactory::fillFullMessage(Message& msg, const QJsonObject& json,
parts.prepend(json[QSL("payload")].toObject());
}
for (const QJsonObject& part : qAsConst(parts)) {
for (const QJsonObject& part : std::as_const(parts)) {
QJsonObject body = part[QSL("body")].toObject();
QString mime = part[QSL("mimeType")].toString();
QString filename = part[QSL("filename")].toString();
@ -743,7 +743,7 @@ QList<Message> GmailNetworkFactory::obtainAndDecodeFullMessages(const QStringLis
if (res.m_networkError == QNetworkReply::NetworkError::NoError) {
// We parse each part of HTTP response (it contains HTTP headers and payload with msg full data).
for (const HttpResponse& part : qAsConst(output)) {
for (const HttpResponse& part : std::as_const(output)) {
QJsonObject msg_doc = QJsonDocument::fromJson(part.body().toUtf8()).object();
QString msg_id = msg_doc[QSL("id")].toString();

View File

@ -201,7 +201,7 @@ void GmailServiceRoot::start(bool freshly_activated) {
auto chi = childItems();
for (RootItem* feed : qAsConst(chi)) {
for (RootItem* feed : std::as_const(chi)) {
if (feed->customId() == QL1S(GMAIL_SYSTEM_LABEL_INBOX)) {
feed->setKeepOnTop(true);
}

View File

@ -42,7 +42,7 @@ FormAddEditEmail::FormAddEditEmail(GmailServiceRoot* root, QWidget* parent)
m_possibleRecipients = DatabaseQueries::getAllGmailRecipients(db, m_root->accountId());
auto ctrls = recipientControls();
for (auto* rec : qAsConst(ctrls)) {
for (auto* rec : std::as_const(ctrls)) {
rec->setPossibleRecipients(m_possibleRecipients);
}
}

View File

@ -663,11 +663,11 @@ RootItem* GreaderNetwork::decodeTagsSubscriptions(const QString& categories,
// We need to process subscription list first and extract categories.
json = QJsonDocument::fromJson(feeds.toUtf8()).object()[QSL("subscriptions")].toArray();
for (const QJsonValue& feed : qAsConst(json)) {
for (const QJsonValue& feed : std::as_const(json)) {
auto subscription = feed.toObject();
auto json_cats = subscription[QSL("categories")].toArray();
for (const QJsonValue& cat : qAsConst(json_cats)) {
for (const QJsonValue& cat : std::as_const(json_cats)) {
auto cat_obj = cat.toObject();
auto cat_id = cat_obj[QSL("id")].toString();
@ -687,7 +687,7 @@ RootItem* GreaderNetwork::decodeTagsSubscriptions(const QString& categories,
json = QJsonDocument::fromJson(categories.toUtf8()).object()[QSL("tags")].toArray();
cats.insert(QString(), parent);
for (const QJsonValue& obj : qAsConst(json)) {
for (const QJsonValue& obj : std::as_const(json)) {
auto label = obj.toObject();
QString label_id = label[QSL("id")].toString();
@ -727,7 +727,7 @@ RootItem* GreaderNetwork::decodeTagsSubscriptions(const QString& categories,
json = QJsonDocument::fromJson(feeds.toUtf8()).object()[QSL("subscriptions")].toArray();
for (const QJsonValue& obj : qAsConst(json)) {
for (const QJsonValue& obj : std::as_const(json)) {
auto subscription = obj.toObject();
QString id = subscription[QSL("id")].toString();
QString title = subscription[QSL("title")].toString();
@ -739,7 +739,7 @@ RootItem* GreaderNetwork::decodeTagsSubscriptions(const QString& categories,
continue;
}
for (const QJsonValue& cat : qAsConst(assigned_categories)) {
for (const QJsonValue& cat : std::as_const(assigned_categories)) {
QString potential_id = cat.toObject()[QSL("id")].toString();
if (potential_id.contains(QSL("/label/"))) {

View File

@ -494,7 +494,7 @@ RootItem* OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons)
// Process categories first, then process feeds.
auto json_folders = QJsonDocument::fromJson(m_contentCategories.toUtf8()).object()[QSL("folders")].toArray();
for (const QJsonValue& cat : qAsConst(json_folders)) {
for (const QJsonValue& cat : std::as_const(json_folders)) {
QJsonObject item = cat.toObject();
auto* category = new Category();
@ -509,7 +509,7 @@ RootItem* OwnCloudGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons)
// We have categories added, now add all feeds.
auto json_feeds = QJsonDocument::fromJson(m_contentFeeds.toUtf8()).object()[QSL("feeds")].toArray();
for (const QJsonValue& fed : qAsConst(json_feeds)) {
for (const QJsonValue& fed : std::as_const(json_feeds)) {
QJsonObject item = fed.toObject();
auto* feed = new OwnCloudFeed();
@ -575,7 +575,7 @@ QList<Message> OwnCloudGetMessagesResponse::messages() const {
QList<Message> msgs;
auto json_items = m_rawContent[QSL("items")].toArray();
for (const QJsonValue& message : qAsConst(json_items)) {
for (const QJsonValue& message : std::as_const(json_items)) {
QJsonObject message_map = message.toObject();
Message msg;

View File

@ -300,7 +300,7 @@ QStringList FeedParser::xmlTextsFromPath(const QDomElement& element,
}
if (!current_elements.isEmpty()) {
for (const QDomElement& elem : qAsConst(current_elements)) {
for (const QDomElement& elem : std::as_const(current_elements)) {
result.append(elem.text());
}
}

View File

@ -202,7 +202,7 @@ QList<Enclosure> JsonParser::jsonMessageEnclosures(const QJsonObject& msg_elemen
auto json_att = msg_element[QSL("attachments")].toArray();
QList<Enclosure> enc;
for (const QJsonValue& att : qAsConst(json_att)) {
for (const QJsonValue& att : std::as_const(json_att)) {
QJsonObject att_obj = att.toObject();
enc.append(Enclosure(att_obj[QSL("url")].toString(), att_obj[QSL("mime_type")].toString()));

View File

@ -64,7 +64,7 @@ bool StandardCategory::removeItself() {
// from the database.
auto chi = childItems();
for (RootItem* child : qAsConst(chi)) {
for (RootItem* child : std::as_const(chi)) {
if (child->kind() == RootItem::Kind::Category) {
children_removed &= qobject_cast<StandardCategory*>(child)->removeItself();
}

View File

@ -98,7 +98,7 @@ bool FeedsImportExportModel::exportToOMPL20(QByteArray& result, bool export_icon
RootItem* active_item = items_to_process.pop();
auto chi = active_item->childItems();
for (RootItem* child_item : qAsConst(chi)) {
for (RootItem* child_item : std::as_const(chi)) {
if (!sourceModel()->isItemChecked(child_item)) {
continue;
}
@ -440,7 +440,7 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data,
bool FeedsImportExportModel::exportToTxtURLPerLine(QByteArray& result) {
auto stf = sourceModel()->rootItem()->getSubTreeFeeds();
for (const Feed* const feed : qAsConst(stf)) {
for (const Feed* const feed : std::as_const(stf)) {
result += feed->source() + QL1S("\n");
}

View File

@ -388,7 +388,7 @@ bool StandardServiceRoot::mergeImportExportModel(FeedsImportExportModel* model,
RootItem* source_parent = new_parents.pop();
auto sour_chi = source_parent->childItems();
for (RootItem* source_item : qAsConst(sour_chi)) {
for (RootItem* source_item : std::as_const(sour_chi)) {
if (!model->sourceModel()->isItemChecked(source_item)) {
// We can skip this item, because it is not checked and should not be imported.
// NOTE: All descendants are thus skipped too.
@ -420,7 +420,7 @@ bool StandardServiceRoot::mergeImportExportModel(FeedsImportExportModel* model,
RootItem* existing_category = nullptr;
auto tar_chi = target_parent->childItems();
for (RootItem* child : qAsConst(tar_chi)) {
for (RootItem* child : std::as_const(tar_chi)) {
if (child->kind() == RootItem::Kind::Category && child->title() == new_category_title) {
existing_category = child;
}

View File

@ -941,7 +941,7 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(TtRssNetworkFactory*
if (item.contains(QSL("items"))) {
auto ite = item[QSL("items")].toArray();
for (const QJsonValue& child_feed : qAsConst(ite)) {
for (const QJsonValue& child_feed : std::as_const(ite)) {
pairs.append(QPair<RootItem*, QJsonValue>(parent, child_feed));
}
}
@ -956,7 +956,7 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(TtRssNetworkFactory*
if (item.contains(QSL("items"))) {
auto ite = item[QSL("items")].toArray();
for (const QJsonValue& child : qAsConst(ite)) {
for (const QJsonValue& child : std::as_const(ite)) {
pairs.append(QPair<RootItem*, QJsonValue>(category, child));
}
}
@ -1037,7 +1037,7 @@ QList<Message> TtRssGetHeadlinesResponse::messages(ServiceRoot* root) const {
return lbl->customNumericId() == TTRSS_PUBLISHED_LABEL_ID;
});
for (const QJsonValue& item : qAsConst(json_msgs)) {
for (const QJsonValue& item : std::as_const(json_msgs)) {
QJsonObject mapped = item.toObject();
Message message;
@ -1054,7 +1054,7 @@ QList<Message> TtRssGetHeadlinesResponse::messages(ServiceRoot* root) const {
auto json_labels = mapped[QSL("labels")].toArray();
for (const QJsonValue& lbl_val : qAsConst(json_labels)) {
for (const QJsonValue& lbl_val : std::as_const(json_labels)) {
QString lbl_custom_id = QString::number(lbl_val.toArray().at(0).toInt());
Label* label =
boolinq::from(active_labels.begin(), active_labels.end()).firstOrDefault([lbl_custom_id](Label* lbl) {
@ -1087,7 +1087,7 @@ QList<Message> TtRssGetHeadlinesResponse::messages(ServiceRoot* root) const {
// Process enclosures.
auto json_att = mapped[QSL("attachments")].toArray();
for (const QJsonValue& attachment : qAsConst(json_att)) {
for (const QJsonValue& attachment : std::as_const(json_att)) {
QJsonObject mapped_attachemnt = attachment.toObject();
Enclosure enclosure;
@ -1177,7 +1177,7 @@ QList<RootItem*> TtRssGetLabelsResponse::labels() const {
published_lbl->setCustomId(QString::number(TTRSS_PUBLISHED_LABEL_ID));
labels.append(published_lbl);
for (const QJsonValue& lbl_val : qAsConst(json_labels)) {
for (const QJsonValue& lbl_val : std::as_const(json_labels)) {
QJsonObject lbl_obj = lbl_val.toObject();
Label* lbl = new Label(lbl_obj[QSL("caption")].toString(), QColor(lbl_obj[QSL("fg_color")].toString()));
@ -1197,7 +1197,7 @@ QStringList TtRssGetCompactHeadlinesResponse::ids() const {
auto json_ids = m_rawContent[QSL("content")].toArray();
QStringList msg_ids;
for (const QJsonValue& id_val : qAsConst(json_ids)) {
for (const QJsonValue& id_val : std::as_const(json_ids)) {
msg_ids.append(QString::number(id_val.toObject()[QSL("id")].toInt()));
}