1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 18:26:34 +01:00

Port to std::as_const

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2023-11-21 21:05:09 +01:00
parent 42c42872f0
commit 845c241f21
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
42 changed files with 85 additions and 85 deletions

View File

@ -39,7 +39,7 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
<< Subscription(QSL("Anti-Adblock Killer"), QSL("https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt"))
<< Subscription(tr("Other..."), QString());
for (const Subscription &subscription : qAsConst(m_knownSubscriptions)) {
for (const Subscription &subscription : std::as_const(m_knownSubscriptions)) {
ui->comboBox->addItem(subscription.title);
}

View File

@ -242,7 +242,7 @@ bool AdBlockManager::removeSubscription(AdBlockSubscription* subscription)
AdBlockCustomList* AdBlockManager::customList() const
{
for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) {
for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) {
auto* list = qobject_cast<AdBlockCustomList*>(subscription);
if (list) {
@ -330,7 +330,7 @@ void AdBlockManager::load()
m_subscriptions.append(customList);
// Load all subscriptions
for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) {
for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) {
subscription->loadSubscription(m_disabledRules);
connect(subscription, &AdBlockSubscription::subscriptionUpdated, mApp, &MainApplication::reloadUserStyleSheet);
@ -367,7 +367,7 @@ void AdBlockManager::updateMatcher()
void AdBlockManager::updateAllSubscriptions()
{
for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) {
for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) {
subscription->updateSubscription();
}
@ -383,7 +383,7 @@ void AdBlockManager::save()
return;
}
for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) {
for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) {
subscription->saveSubscription();
}
@ -428,7 +428,7 @@ QString AdBlockManager::elementHidingRulesForDomain(const QUrl &url) const
AdBlockSubscription* AdBlockManager::subscriptionByName(const QString &name) const
{
for (AdBlockSubscription* subscription : qAsConst(m_subscriptions)) {
for (AdBlockSubscription* subscription : std::as_const(m_subscriptions)) {
if (subscription->title() == name) {
return subscription;
}

View File

@ -180,7 +180,7 @@ void AdBlockMatcher::update()
}
}
for (const AdBlockRule* rule : qAsConst(exceptionCssRules)) {
for (const AdBlockRule* rule : std::as_const(exceptionCssRules)) {
const AdBlockRule* originalRule = cssRulesHash.value(rule->cssSelector());
// If we don't have this selector, the exception does nothing

View File

@ -279,14 +279,14 @@ bool AdBlockRule::matchDomain(const QString &domain) const
}
if (m_blockedDomains.isEmpty()) {
for (const QString &d : qAsConst(m_allowedDomains)) {
for (const QString &d : std::as_const(m_allowedDomains)) {
if (isMatchingDomain(domain, d)) {
return true;
}
}
}
else if (m_allowedDomains.isEmpty()) {
for (const QString &d : qAsConst(m_blockedDomains)) {
for (const QString &d : std::as_const(m_blockedDomains)) {
if (isMatchingDomain(domain, d)) {
return false;
}
@ -294,13 +294,13 @@ bool AdBlockRule::matchDomain(const QString &domain) const
return true;
}
else {
for (const QString &d : qAsConst(m_blockedDomains)) {
for (const QString &d : std::as_const(m_blockedDomains)) {
if (isMatchingDomain(domain, d)) {
return false;
}
}
for (const QString &d : qAsConst(m_allowedDomains)) {
for (const QString &d : std::as_const(m_allowedDomains)) {
if (isMatchingDomain(domain, d)) {
return true;
}

View File

@ -334,7 +334,7 @@ void AdBlockCustomList::saveSubscription()
textStream << "Url: " << url().toString() << Qt::endl;
textStream << "[Adblock Plus 1.1.1]" << Qt::endl;
for (const AdBlockRule* rule : qAsConst(m_rules)) {
for (const AdBlockRule* rule : std::as_const(m_rules)) {
textStream << rule->filter() << Qt::endl;
}
@ -353,7 +353,7 @@ bool AdBlockCustomList::canBeRemoved() const
bool AdBlockCustomList::containsFilter(const QString &filter) const
{
for (const AdBlockRule* rule : qAsConst(m_rules)) {
for (const AdBlockRule* rule : std::as_const(m_rules)) {
if (rule->filter() == filter) {
return true;
}

View File

@ -121,7 +121,7 @@ BrowserWindow::SavedWindow::SavedWindow(BrowserWindow *window)
bool BrowserWindow::SavedWindow::isValid() const
{
for (const WebTab::SavedTab &tab : qAsConst(tabs)) {
for (const WebTab::SavedTab &tab : std::as_const(tabs)) {
if (!tab.isValid()) {
return false;
}
@ -227,7 +227,7 @@ BrowserWindow::~BrowserWindow()
{
mApp->plugins()->emitMainWindowDeleted(this);
for (const QPointer<QWidget> &pointer : qAsConst(m_deleteOnCloseWidgets)) {
for (const QPointer<QWidget> &pointer : std::as_const(m_deleteOnCloseWidgets)) {
if (pointer) {
pointer->deleteLater();
}
@ -525,7 +525,7 @@ void BrowserWindow::createEncodingSubMenu(const QString &name, QStringList &code
auto *group = new QActionGroup(subMenu);
for (const QString &codecName : qAsConst(codecNames)) {
for (const QString &codecName : std::as_const(codecNames)) {
QAction *act = createEncodingAction(codecName, activeCodecName, subMenu);
group->addAction(act);
subMenu->addAction(act);

View File

@ -105,7 +105,7 @@ void DataPaths::init()
m_paths[Plugins].append(QStringLiteral(FALKON_PLUGIN_PATH));
#endif
for (const QString &location : qAsConst(m_paths[AppData])) {
for (const QString &location : std::as_const(m_paths[AppData])) {
initAssetsIn(location);
}

View File

@ -262,7 +262,7 @@ MainApplication::MainApplication(int &argc, char** argv)
if (isRunning()) {
m_isClosing = true;
for (const QString &message : qAsConst(messages)) {
for (const QString &message : std::as_const(messages)) {
sendMessage(message);
}
return;
@ -735,7 +735,7 @@ void MainApplication::quitApplication()
return;
}
for (BrowserWindow *window : qAsConst(m_windows)) {
for (BrowserWindow *window : std::as_const(m_windows)) {
Q_EMIT window->aboutToClose();
}
@ -745,7 +745,7 @@ void MainApplication::quitApplication()
m_isClosing = true;
for (BrowserWindow *window : qAsConst(m_windows)) {
for (BrowserWindow *window : std::as_const(m_windows)) {
window->close();
}
@ -785,7 +785,7 @@ QByteArray MainApplication::saveState() const
{
RestoreData restoreData;
restoreData.windows.reserve(m_windows.count());
for (BrowserWindow *window : qAsConst(m_windows)) {
for (BrowserWindow *window : std::as_const(m_windows)) {
restoreData.windows.append(BrowserWindow::SavedWindow(window));
}
@ -1127,7 +1127,7 @@ void MainApplication::checkOptimizeDatabase()
void MainApplication::registerAllowedSchemes()
{
for (const QString &schemeName : qAsConst(qzSettings->allowedSchemes)) {
for (const QString &schemeName : std::as_const(qzSettings->allowedSchemes)) {
if (qzSettings->blockedSchemes.contains(schemeName)) {
continue;
}

View File

@ -72,7 +72,7 @@ void BookmarksExportDialog::init()
{
m_exporters.append(new HtmlExporter(this));
for (BookmarksExporter* exporter : qAsConst(m_exporters)) {
for (BookmarksExporter* exporter : std::as_const(m_exporters)) {
ui->format->addItem(exporter->name());
}

View File

@ -126,7 +126,7 @@ BookmarkItem* FirefoxImporter::importBookmarks()
QHash<int, BookmarkItem*> hash;
for (const Item &item : qAsConst(items)) {
for (const Item &item : std::as_const(items)) {
BookmarkItem* parent = hash.value(item.parent);
auto* bookmark = new BookmarkItem(item.type, parent ? parent : root);
bookmark->setTitle(item.title.isEmpty() ? item.url.toString() : item.title);

View File

@ -252,7 +252,7 @@ bool BookmarksModel::dropMimeData(const QMimeData* data, Qt::DropAction action,
row = qMax(row, 0);
for (BookmarkItem* itm : qAsConst(items)) {
for (BookmarkItem* itm : std::as_const(items)) {
// If we are moving an item through the folder and item is above the row to insert,
// we must decrease row by one (by the dropped folder)
if (itm->parent() == parentItm && itm->parent()->children().indexOf(itm) < row) {

View File

@ -81,7 +81,7 @@ void CookieJar::deleteAllCookies(bool deleteAll)
return;
}
for (const QNetworkCookie &cookie : qAsConst(m_cookies)) {
for (const QNetworkCookie &cookie : std::as_const(m_cookies)) {
if (!listMatchesDomain(m_whitelist, cookie.domain())) {
m_client->deleteCookie(cookie);
}

View File

@ -135,7 +135,7 @@ void CookieManager::remove()
}
}
for (const QNetworkCookie &cookie : qAsConst(cookies)) {
for (const QNetworkCookie &cookie : std::as_const(cookies)) {
mApp->cookieJar()->deleteCookie(cookie);
}
}

View File

@ -209,20 +209,20 @@ void DownloadManager::timerEvent(QTimerEvent* e)
}
QTime remaining;
for (const QTime &time : qAsConst(remTimes)) {
for (const QTime &time : std::as_const(remTimes)) {
if (time > remaining) {
remaining = time;
}
}
int progress = 0;
for (int prog : qAsConst(progresses)) {
for (int prog : std::as_const(progresses)) {
progress += prog;
}
progress = progress / progresses.count();
double speed = 0.00;
for (double spee : qAsConst(speeds)) {
for (double spee : std::as_const(speeds)) {
speed += spee;
}

View File

@ -322,7 +322,7 @@ void HistoryModel::fetchMore(const QModelIndex &parent)
beginInsertRows(parent, 0, list.size() - 1);
for (const HistoryEntry &entry : qAsConst(list)) {
for (const HistoryEntry &entry : std::as_const(list)) {
auto* newItem = new HistoryItem(parentItem);
newItem->historyEntry = entry;
}

View File

@ -280,7 +280,7 @@ int LocationCompleterDelegate::viewItemDrawText(QPainter *p, const QStyleOptionV
// Look for longer parts first
std::sort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan);
for (const QString &string : qAsConst(searchStrings)) {
for (const QString &string : std::as_const(searchStrings)) {
int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive);
while (delimiter != -1) {

View File

@ -126,7 +126,7 @@ QSqlQuery LocationCompleterModel::createHistoryQuery(const QString &searchString
sqlQuery.addBindValue(QSL("%%1%").arg(searchString));
}
else {
for (const QString &str : qAsConst(searchList)) {
for (const QString &str : std::as_const(searchList)) {
sqlQuery.addBindValue(QSL("%%1%").arg(str));
sqlQuery.addBindValue(QSL("%%1%").arg(str));
}

View File

@ -100,7 +100,7 @@ void LocationCompleterRefreshJob::runJob()
}
// Load all icons into QImage
for (QStandardItem* item : qAsConst(m_items)) {
for (QStandardItem* item : std::as_const(m_items)) {
if (m_jobCancelled) {
return;
}

View File

@ -221,7 +221,7 @@ void NavigationBar::setSplitterSizes(int locationBar, int websearchBar)
void NavigationBar::setCurrentView(TabbedWebView *view)
{
for (const WidgetData &data : qAsConst(m_widgets)) {
for (const WidgetData &data : std::as_const(m_widgets)) {
if (data.button) {
data.button->setWebView(view);
}
@ -437,7 +437,7 @@ void NavigationBar::aboutToShowToolsMenu()
m_window->createSidebarsMenu(m_menuTools->addMenu(tr("Sidebar")));
m_menuTools->addSeparator();
for (const WidgetData &data : qAsConst(m_widgets)) {
for (const WidgetData &data : std::as_const(m_widgets)) {
AbstractButtonInterface *button = data.button;
if (button && (!button->isVisible() || !m_layoutIds.contains(data.id))) {
QString title = button->title();
@ -570,7 +570,7 @@ void NavigationBar::reloadLayout()
}
// Add widgets to layout
for (const QString &id : qAsConst(m_layoutIds)) {
for (const QString &id : std::as_const(m_layoutIds)) {
const WidgetData data = m_widgets.value(id);
if (data.widget) {
m_layout->addWidget(data.widget);

View File

@ -54,7 +54,7 @@ void NavigationBarConfigDialog::loadSettings()
};
ui->currentItems->clear();
for (const QString &id : qAsConst(m_navigationBar->m_layoutIds)) {
for (const QString &id : std::as_const(m_navigationBar->m_layoutIds)) {
NavigationBar::WidgetData data = m_navigationBar->m_widgets.value(id);
if (data.id.isEmpty()) {
data.id = id;
@ -64,7 +64,7 @@ void NavigationBarConfigDialog::loadSettings()
}
ui->availableItems->clear();
for (const NavigationBar::WidgetData &data : qAsConst(m_navigationBar->m_widgets)) {
for (const NavigationBar::WidgetData &data : std::as_const(m_navigationBar->m_widgets)) {
if (!m_navigationBar->m_layoutIds.contains(data.id)) {
ui->availableItems->addItem(createItem(data));
}

View File

@ -58,7 +58,7 @@ void NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
}
}
for (UrlInterceptor *interceptor : qAsConst(m_interceptors)) {
for (UrlInterceptor *interceptor : std::as_const(m_interceptors)) {
interceptor->interceptRequest(info);
}
}

View File

@ -118,7 +118,7 @@ SearchEngine SearchEnginesManager::engineForShortcut(const QString &shortcut)
return returnEngine;
}
for (const Engine &en : qAsConst(m_allEngines)) {
for (const Engine &en : std::as_const(m_allEngines)) {
if (en.shortcut == shortcut) {
returnEngine = en;
break;
@ -216,7 +216,7 @@ void SearchEnginesManager::engineChangedImage()
return;
}
for (Engine e : qAsConst(m_allEngines)) {
for (Engine e : std::as_const(m_allEngines)) {
if (e.name == engine->name() &&
e.url.contains(engine->searchUrl(QSL("%s")).toString()) &&
!engine->image().isNull()
@ -495,7 +495,7 @@ void SearchEnginesManager::saveSettings()
QSqlQuery query(SqlDatabase::instance()->database());
query.exec(QSL("DELETE FROM search_engines"));
for (const Engine &en : qAsConst(m_allEngines)) {
for (const Engine &en : std::as_const(m_allEngines)) {
query.prepare(QSL("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData) VALUES (?, ?, ?, ?, ?, ?, ?)"));
query.addBindValue(en.name);
query.addBindValue(iconToBase64(en.icon));

View File

@ -96,7 +96,7 @@ void PluginProxy::populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTe
return;
}
for (PluginInterface* iPlugin : qAsConst(m_loadedPlugins)) {
for (PluginInterface* iPlugin : std::as_const(m_loadedPlugins)) {
iPlugin->populateWebViewMenu(menu, view, r);
}
}
@ -107,7 +107,7 @@ void PluginProxy::populateExtensionsMenu(QMenu *menu)
return;
}
for (PluginInterface* iPlugin : qAsConst(m_loadedPlugins)) {
for (PluginInterface* iPlugin : std::as_const(m_loadedPlugins)) {
iPlugin->populateExtensionsMenu(menu);
}
}
@ -116,7 +116,7 @@ bool PluginProxy::processMouseDoubleClick(Qz::ObjectName type, QObject* obj, QMo
{
bool accepted = false;
for (PluginInterface* iPlugin : qAsConst(m_mouseDoubleClickHandlers)) {
for (PluginInterface* iPlugin : std::as_const(m_mouseDoubleClickHandlers)) {
if (iPlugin->mouseDoubleClick(type, obj, event)) {
accepted = true;
}
@ -129,7 +129,7 @@ bool PluginProxy::processMousePress(Qz::ObjectName type, QObject* obj, QMouseEve
{
bool accepted = false;
for (PluginInterface* iPlugin : qAsConst(m_mousePressHandlers)) {
for (PluginInterface* iPlugin : std::as_const(m_mousePressHandlers)) {
if (iPlugin->mousePress(type, obj, event)) {
accepted = true;
}
@ -142,7 +142,7 @@ bool PluginProxy::processMouseRelease(Qz::ObjectName type, QObject* obj, QMouseE
{
bool accepted = false;
for (PluginInterface* iPlugin : qAsConst(m_mouseReleaseHandlers)) {
for (PluginInterface* iPlugin : std::as_const(m_mouseReleaseHandlers)) {
if (iPlugin->mouseRelease(type, obj, event)) {
accepted = true;
}
@ -155,7 +155,7 @@ bool PluginProxy::processMouseMove(Qz::ObjectName type, QObject* obj, QMouseEven
{
bool accepted = false;
for (PluginInterface* iPlugin : qAsConst(m_mouseMoveHandlers)) {
for (PluginInterface* iPlugin : std::as_const(m_mouseMoveHandlers)) {
if (iPlugin->mouseMove(type, obj, event)) {
accepted = true;
}
@ -168,7 +168,7 @@ bool PluginProxy::processWheelEvent(Qz::ObjectName type, QObject* obj, QWheelEve
{
bool accepted = false;
for (PluginInterface* iPlugin : qAsConst(m_wheelEventHandlers)) {
for (PluginInterface* iPlugin : std::as_const(m_wheelEventHandlers)) {
if (iPlugin->wheelEvent(type, obj, event)) {
accepted = true;
}
@ -181,7 +181,7 @@ bool PluginProxy::processKeyPress(Qz::ObjectName type, QObject* obj, QKeyEvent*
{
bool accepted = false;
for (PluginInterface* iPlugin : qAsConst(m_keyPressHandlers)) {
for (PluginInterface* iPlugin : std::as_const(m_keyPressHandlers)) {
if (iPlugin->keyPress(type, obj, event)) {
accepted = true;
}
@ -194,7 +194,7 @@ bool PluginProxy::processKeyRelease(Qz::ObjectName type, QObject* obj, QKeyEvent
{
bool accepted = false;
for (PluginInterface* iPlugin : qAsConst(m_keyReleaseHandlers)) {
for (PluginInterface* iPlugin : std::as_const(m_keyReleaseHandlers)) {
if (iPlugin->keyRelease(type, obj, event)) {
accepted = true;
}
@ -207,7 +207,7 @@ bool PluginProxy::acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEn
{
bool accepted = true;
for (PluginInterface* iPlugin : qAsConst(m_loadedPlugins)) {
for (PluginInterface* iPlugin : std::as_const(m_loadedPlugins)) {
if (!iPlugin->acceptNavigationRequest(page, url, type, isMainFrame)) {
accepted = false;
}

View File

@ -164,7 +164,7 @@ void Plugins::loadSettings()
void Plugins::shutdown()
{
for (PluginInterface* iPlugin : qAsConst(m_loadedPlugins)) {
for (PluginInterface* iPlugin : std::as_const(m_loadedPlugins)) {
iPlugin->unload();
}
}
@ -226,7 +226,7 @@ void Plugins::loadPlugins()
settingsDir.mkdir(settingsDir.absolutePath());
}
for (const QString &pluginId : qAsConst(m_allowedPlugins)) {
for (const QString &pluginId : std::as_const(m_allowedPlugins)) {
Plugin plugin = loadPlugin(pluginId);
if (plugin.type == Plugin::Invalid) {
continue;
@ -306,7 +306,7 @@ void Plugins::refreshLoadedPlugins()
{
m_loadedPlugins.clear();
for (const Plugin &plugin : qAsConst(m_availablePlugins)) {
for (const Plugin &plugin : std::as_const(m_availablePlugins)) {
if (plugin.isLoaded()) {
m_loadedPlugins.append(plugin.instance);
}

View File

@ -64,7 +64,7 @@ BookmarkItem *QmlBookmarks::getBookmarkItem(QmlBookmarkTreeNode *treeNode) const
items = bookmarks->searchBookmarks(QUrl::fromEncoded(treeNode->url().toUtf8()));
}
for (BookmarkItem *item : qAsConst(items)) {
for (BookmarkItem *item : std::as_const(items)) {
if (treeNode->item() == item) {
return item;
}
@ -182,7 +182,7 @@ QList<QObject*> QmlBookmarks::search(const QVariantMap &map) const
}
QList<QObject*> ret;
ret.reserve(items.size());
for (auto item : qAsConst(items)) {
for (auto item : std::as_const(items)) {
ret.append(QmlStaticData::instance().getBookmarkTreeNode(item));
}
return ret;

View File

@ -51,7 +51,7 @@ QNetworkCookie QmlCookies::getNetworkCookie(const QVariantMap &map)
const QString name = map.value(QSL("name")).toString();
const QString url = map.value(QSL("url")).toString();
QVector<QNetworkCookie> cookies = mApp->cookieJar()->getAllCookies();
for (const QNetworkCookie &cookie : qAsConst(cookies)) {
for (const QNetworkCookie &cookie : std::as_const(cookies)) {
if (QString::fromUtf8(cookie.name()) == name && cookie.domain() == url) {
return cookie;
}
@ -74,7 +74,7 @@ QList<QObject*> QmlCookies::getAll(const QVariantMap &map)
const bool secure = map.value(QSL("secure")).toBool();
const bool session = map.value(QSL("session")).toBool();
QVector<QNetworkCookie> cookies = mApp->cookieJar()->getAllCookies();
for (QNetworkCookie cookie : qAsConst(cookies)) {
for (QNetworkCookie cookie : std::as_const(cookies)) {
if ((!map.contains(QSL("name")) || QString::fromUtf8(cookie.name()) == name)
&& (!map.contains(QSL("url")) || cookie.domain() == url)
&& (!map.contains(QSL("path")) || cookie.path() == path)

View File

@ -26,7 +26,7 @@ QmlExternalJsObject::QmlExternalJsObject(QObject *parent)
QmlExternalJsObject::~QmlExternalJsObject()
{
for (QObject *object : qAsConst(m_objects)) {
for (QObject *object : std::as_const(m_objects)) {
ExternalJsObject::unregisterExtraObject(object);
}
}

View File

@ -69,7 +69,7 @@ void QmlPluginInterface::unload()
m_unload.call();
for (QObject *childItem : qAsConst(m_childItems)) {
for (QObject *childItem : std::as_const(m_childItems)) {
childItem->deleteLater();
}

View File

@ -101,7 +101,7 @@ SpeedDial::Page SpeedDial::pageForUrl(const QUrl &url)
if (urlString.endsWith(QL1C('/')))
urlString = urlString.left(urlString.size() - 1);
for (const Page &page : qAsConst(m_pages)) {
for (const Page &page : std::as_const(m_pages)) {
if (page.url == urlString) {
return page;
}
@ -207,7 +207,7 @@ QString SpeedDial::initialScript()
QVariantList pages;
for (const Page &page : qAsConst(m_pages)) {
for (const Page &page : std::as_const(m_pages)) {
QString imgSource = m_thumbnailsDir + QString::fromLatin1(QCryptographicHash::hash(page.url.toUtf8(), QCryptographicHash::Md4).toHex()) + QSL(".png");
if (!QFile(imgSource).exists()) {
@ -374,7 +374,7 @@ QString SpeedDial::generateAllPages()
{
QString allPages;
for (const Page &page : qAsConst(m_pages)) {
for (const Page &page : std::as_const(m_pages)) {
const QString string = QSL(R"(url:"%1"|title:"%2";)").arg(page.url, page.title);
allPages.append(string);
}

View File

@ -26,7 +26,7 @@ static const int restoreDataVersion = 2;
bool RestoreData::isValid() const
{
for (const BrowserWindow::SavedWindow &window : qAsConst(windows)) {
for (const BrowserWindow::SavedWindow &window : std::as_const(windows)) {
if (!window.isValid()) {
return false;
}
@ -44,7 +44,7 @@ void RestoreData::clear()
QDataStream &operator<<(QDataStream &stream, const RestoreData &data)
{
stream << data.windows.count();
for (const BrowserWindow::SavedWindow &window : qAsConst(data.windows)) {
for (const BrowserWindow::SavedWindow &window : std::as_const(data.windows)) {
stream << window;
}

View File

@ -119,7 +119,7 @@ void SideBarManager::createMenu(QMenu* menu)
act->setChecked(m_activeBar == QL1S("History"));
group->addAction(act);
for (const QPointer<SideBarInterface> &sidebar : qAsConst(s_sidebars)) {
for (const QPointer<SideBarInterface> &sidebar : std::as_const(s_sidebars)) {
if (sidebar) {
QAction* act = sidebar.data()->createMenuAction();
act->setData(s_sidebars.key(sidebar));

View File

@ -47,7 +47,7 @@ TabTreeModelItem::TabTreeModelItem(WebTab *tab, const QModelIndex &index)
TabTreeModelItem::~TabTreeModelItem()
{
for (TabTreeModelItem *child : qAsConst(children)) {
for (TabTreeModelItem *child : std::as_const(children)) {
delete child;
}
}
@ -269,7 +269,7 @@ void TabTreeModel::init()
}
}
for (TabTreeModelItem *item : qAsConst(m_items)) {
for (TabTreeModelItem *item : std::as_const(m_items)) {
connectTab(item->tab);
}

View File

@ -864,7 +864,7 @@ bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentT
}
}
for (const auto &p : qAsConst(childTabs)) {
for (const auto &p : std::as_const(childTabs)) {
const auto indices = p.second;
for (int index : indices) {
WebTab *t = weTab(index);

View File

@ -158,7 +158,7 @@ void ButtonWithMenu::generateMenu()
{
m_menu->clear();
for (const Item &item : qAsConst(m_items)) {
for (const Item &item : std::as_const(m_items)) {
QVariant variant;
variant.setValue(item);
m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant);

View File

@ -257,7 +257,7 @@ void IconProvider::saveIconsToDatabase()
{
QMutexLocker locker(&instance()->m_iconCacheMutex);
for (const BufferedIcon &ic : qAsConst(m_iconBuffer)) {
for (const BufferedIcon &ic : std::as_const(m_iconBuffer)) {
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);

View File

@ -171,7 +171,7 @@ bool FCM_Plugin::isWhitelisted(const FlashCookie &flashCookie)
void FCM_Plugin::removeAllButWhitelisted()
{
for (const FlashCookie &flashCookie : qAsConst(m_flashCookies)) {
for (const FlashCookie &flashCookie : std::as_const(m_flashCookies)) {
if (isWhitelisted(flashCookie)) {
continue;
}
@ -257,7 +257,7 @@ void FCM_Plugin::autoRefresh()
loadFlashCookies();
QStringList newCookieList;
for (const FlashCookie &flashCookie : qAsConst(m_flashCookies)) {
for (const FlashCookie &flashCookie : std::as_const(m_flashCookies)) {
if (isBlacklisted(flashCookie)) {
removeCookie(flashCookie);
continue;
@ -268,7 +268,7 @@ void FCM_Plugin::autoRefresh()
}
bool newCookie = true;
for (const FlashCookie &oldFlashCookie : qAsConst(oldflashCookies)) {
for (const FlashCookie &oldFlashCookie : std::as_const(oldflashCookies)) {
if (QString(oldFlashCookie.path + oldFlashCookie.name) ==
QString(flashCookie.path + flashCookie.name)) {
newCookie = false;
@ -378,7 +378,7 @@ void FCM_Plugin::loadFlashCookies(QString path)
entryList.removeAll(QL1S("."));
entryList.removeAll(QL1S(".."));
for (QString entry : qAsConst(entryList)) {
for (QString entry : std::as_const(entryList)) {
if (path.endsWith(QL1S("#SharedObjects")) && entry == QL1S("#AppContainer")) {
// specific to IE and Windows
continue;

View File

@ -158,7 +158,7 @@ QList<GM_Script*> GM_Manager::allScripts() const
bool GM_Manager::containsScript(const QString &fullName) const
{
for (GM_Script* script : qAsConst(m_scripts)) {
for (GM_Script* script : std::as_const(m_scripts)) {
if (fullName == script->fullName()) {
return true;
}

View File

@ -333,7 +333,7 @@ void GM_Script::downloadIcon()
void GM_Script::downloadRequires()
{
for (const QString &url : qAsConst(m_require)) {
for (const QString &url : std::as_const(m_require)) {
if (m_manager->requireScripts({url}).isEmpty()) {
auto *downloader = new GM_Downloader(QUrl(url), m_manager, GM_Downloader::DownloadRequireScript);
connect(downloader, &GM_Downloader::finished, this, &GM_Script::reloadScript);

View File

@ -128,7 +128,7 @@ void KDEFrameworksIntegrationPlugin::unload()
delete m_backend;
delete m_sharePageMenu;
for (KIOSchemeHandler *handler : qAsConst(m_kioSchemeHandlers)) {
for (KIOSchemeHandler *handler : std::as_const(m_kioSchemeHandlers)) {
mApp->webProfile()->removeUrlSchemeHandler(handler);
WebPage::removeSupportedScheme(handler->protocol());
delete handler;

View File

@ -65,7 +65,7 @@ QVector<PasswordEntry> KWalletPasswordBackend::getEntries(const QUrl &url)
QVector<PasswordEntry> list;
for (const PasswordEntry &entry : qAsConst(m_allEntries)) {
for (const PasswordEntry &entry : std::as_const(m_allEntries)) {
if (entry.host == host) {
list.append(entry);
}
@ -269,7 +269,7 @@ void KWalletPasswordBackend::initialize()
return;
}
for (const PasswordEntry &entry : qAsConst(m_allEntries)) {
for (const PasswordEntry &entry : std::as_const(m_allEntries)) {
m_wallet->writeMap(entry.id.toString(), encodeEntry(entry));
}
}

View File

@ -189,7 +189,7 @@ void TabManagerDelegate::viewItemDrawText(QPainter *p, const QStyleOptionViewIte
// Look for longer parts first
std::sort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan);
for (const QString &string : qAsConst(searchStrings)) {
for (const QString &string : std::as_const(searchStrings)) {
int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive);
while (delimiter != -1) {

View File

@ -184,7 +184,7 @@ void TabTreeView::rowsInserted(const QModelIndex &parent, int start, int end)
stack.append(idx);
idx = idx.parent();
} while (idx.isValid());
for (const QModelIndex &index : qAsConst(stack)) {
for (const QModelIndex &index : std::as_const(stack)) {
expand(index);
}
if (index.data(TabModel::CurrentTabRole).toBool()) {
@ -415,7 +415,7 @@ void TabTreeView::closeTree(const QModelIndex &root)
tabs.append(tab);
}
});
for (WebTab *tab : qAsConst(tabs)) {
for (WebTab *tab : std::as_const(tabs)) {
tab->closeTab();
}
}