1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-13 10:32:11 +01:00

plugins: port foreach -> range-based for

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
Juraj Oravec 2019-12-30 20:25:31 +01:00
parent 5efc0e8d9d
commit f02cb62b7b
No known key found for this signature in database
GPG Key ID: 63ACB65056BC8D07
3 changed files with 17 additions and 17 deletions

View File

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

View File

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

View File

@ -96,7 +96,7 @@ SpeedDial::Page SpeedDial::pageForUrl(const QUrl &url)
if (urlString.endsWith(QL1C('/'))) if (urlString.endsWith(QL1C('/')))
urlString = urlString.left(urlString.size() - 1); urlString = urlString.left(urlString.size() - 1);
foreach (const Page &page, m_pages) { for (const Page &page : qAsConst(m_pages)) {
if (page.url == urlString) { if (page.url == urlString) {
return page; return page;
} }
@ -202,7 +202,7 @@ QString SpeedDial::initialScript()
QVariantList pages; QVariantList pages;
foreach (const Page &page, m_pages) { for (const Page &page : qAsConst(m_pages)) {
QString imgSource = m_thumbnailsDir + QCryptographicHash::hash(page.url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png"; QString imgSource = m_thumbnailsDir + QCryptographicHash::hash(page.url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png";
if (!QFile(imgSource).exists()) { if (!QFile(imgSource).exists()) {
@ -232,7 +232,7 @@ void SpeedDial::changed(const QString &allPages)
const QStringList entries = allPages.split(QLatin1String("\";"), QString::SkipEmptyParts); const QStringList entries = allPages.split(QLatin1String("\";"), QString::SkipEmptyParts);
m_pages.clear(); m_pages.clear();
foreach (const QString &entry, entries) { for (const QString &entry : entries) {
if (entry.isEmpty()) { if (entry.isEmpty()) {
continue; continue;
} }
@ -369,7 +369,7 @@ QString SpeedDial::generateAllPages()
{ {
QString allPages; QString allPages;
foreach (const Page &page, m_pages) { for (const Page &page : qAsConst(m_pages)) {
const QString string = QString("url:\"%1\"|title:\"%2\";").arg(page.url, page.title); const QString string = QString("url:\"%1\"|title:\"%2\";").arg(page.url, page.title);
allPages.append(string); allPages.append(string);
} }