diff options
author | Montel Laurent <montel@kde.org> | 2013-10-01 07:59:26 +0200 |
---|---|---|
committer | Montel Laurent <montel@kde.org> | 2013-10-01 07:59:26 +0200 |
commit | 57285a4d9bb616260bb4624106110993e90e4465 (patch) | |
tree | c759d7fddda995f3a9884f1840a6620e94c9f2bd /src | |
parent | Add else if (diff) | |
download | rekonq-57285a4d9bb616260bb4624106110993e90e4465.tar.xz |
Use const'ref
Diffstat (limited to 'src')
-rw-r--r-- | src/adblock/adblockelementhiding.cpp | 16 | ||||
-rw-r--r-- | src/adblock/adblockmanager.cpp | 16 | ||||
-rw-r--r-- | src/adblock/adblocksettingwidget.cpp | 6 | ||||
-rw-r--r-- | src/adblock/adblocksettingwidget.h | 2 |
4 files changed, 20 insertions, 20 deletions
diff --git a/src/adblock/adblockelementhiding.cpp b/src/adblock/adblockelementhiding.cpp index 442e652c..bac693cb 100644 --- a/src/adblock/adblockelementhiding.cpp +++ b/src/adblock/adblockelementhiding.cpp @@ -46,11 +46,11 @@ bool AdBlockElementHiding::addRule(const QString &rule) return true; } - QStringList lst = rule.split(QL1S("##")); + const QStringList lst = rule.split(QL1S("##")); QString domainSpecificRule = lst[1]; QStringList domains = lst[0].split(QL1C(',')); - Q_FOREACH(QString domain, domains) + Q_FOREACH(const QString &domain, domains) { if(domain.startsWith(QL1C('~'))) { @@ -69,25 +69,25 @@ void AdBlockElementHiding::apply(QWebElement &document, QString domain) const { //first apply generic rules - Q_FOREACH(QString rule, m_GenericRules) + Q_FOREACH(const QString &rule, m_GenericRules) { applyStringRule(document, rule); } //check for whitelisted rules QStringList whiteListedRules; - QStringList subdomainList = generateSubdomainList(domain); + const QStringList subdomainList = generateSubdomainList(domain); - Q_FOREACH(QString d, subdomainList) + Q_FOREACH(const QString &d, subdomainList) { whiteListedRules.append(m_DomainSpecificRulesWhitelist.values(d)); } //apply rules if not whitelisted - Q_FOREACH(QString d, subdomainList) + Q_FOREACH(const QString &d, subdomainList) { - QList<QString> ruleList = m_DomainSpecificRules.values(d); - Q_FOREACH(QString rule, ruleList) + const QList<QString> ruleList = m_DomainSpecificRules.values(d); + Q_FOREACH(const QString &rule, ruleList) { if (!whiteListedRules.contains(rule)) applyStringRule(document, rule); diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp index 93f6065c..3c05c870 100644 --- a/src/adblock/adblockmanager.cpp +++ b/src/adblock/adblockmanager.cpp @@ -97,12 +97,12 @@ bool AdBlockManager::isHidingElements() void AdBlockManager::loadSettings() { // first, check this... - QString adblockFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrc")); + const QString adblockFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrc")); if (!QFile::exists(adblockFilePath)) { - QString generalAdblockFilePath = KStandardDirs::locate("appdata" , QL1S("adblockrc")); + const QString generalAdblockFilePath = KStandardDirs::locate("appdata" , QL1S("adblockrc")); QFile adblockFile(generalAdblockFilePath); - bool copied = adblockFile.copy(adblockFilePath); + const bool copied = adblockFile.copy(adblockFilePath); if (!copied) { kDebug() << "oh oh... Problems copying default adblock file"; @@ -134,7 +134,7 @@ void AdBlockManager::loadSettings() // ---------------------------------------------------------- - QDateTime today = QDateTime::currentDateTime(); + const QDateTime today = QDateTime::currentDateTime(); QDateTime lastUpdate = QDateTime::fromString(settingsGroup.readEntry("lastUpdate", QString())); int days = settingsGroup.readEntry("updateInterval", 7); @@ -306,7 +306,7 @@ void AdBlockManager::updateSubscription(int i) KConfigGroup filtersGroup(_adblockConfig, "FiltersList"); QString n = QString::number(i + 1); - QString fUrl = filtersGroup.readEntry("FilterURL-" + n, QString()); + const QString fUrl = filtersGroup.readEntry("FilterURL-" + n, QString()); KUrl subUrl = KUrl(fUrl); QString rulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_") + n); @@ -337,9 +337,9 @@ void AdBlockManager::slotFinished(KJob *job) bool AdBlockManager::subscriptionFileExists(int i) { - QString n = QString::number(i + 1); + const QString n = QString::number(i + 1); - QString rulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_") + n); + const QString rulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_") + n); return QFile::exists(rulesFilePath); } @@ -369,7 +369,7 @@ void AdBlockManager::addCustomRule(const QString &stringRule, bool reloadPage) _settingsLoaded.waitForFinished(); // save rule in local filters - QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local")); + const QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local")); QFile ruleFile(localRulesFilePath); if (!ruleFile.open(QFile::WriteOnly | QFile::Append)) diff --git a/src/adblock/adblocksettingwidget.cpp b/src/adblock/adblocksettingwidget.cpp index 89d5f8b2..6d565022 100644 --- a/src/adblock/adblocksettingwidget.cpp +++ b/src/adblock/adblocksettingwidget.cpp @@ -158,7 +158,7 @@ void AdBlockSettingWidget::load() // ------------------------------------------------------------------------------ // local filters - QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local")); + const QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local")); QFile ruleFile(localRulesFilePath); if (!ruleFile.open(QFile::ReadOnly | QFile::Text)) @@ -170,7 +170,7 @@ void AdBlockSettingWidget::load() QTextStream in(&ruleFile); while (!in.atEnd()) { - QString stringRule = in.readLine(); + const QString stringRule = in.readLine(); QListWidgetItem *subItem = new QListWidgetItem(manualFiltersListWidget); subItem->setText(stringRule); } @@ -236,7 +236,7 @@ void AdBlockSettingWidget::hasChanged() } -bool AdBlockSettingWidget::changed() +bool AdBlockSettingWidget::changed() const { return _changed; } diff --git a/src/adblock/adblocksettingwidget.h b/src/adblock/adblocksettingwidget.h index 2f0fab15..e814b85b 100644 --- a/src/adblock/adblocksettingwidget.h +++ b/src/adblock/adblocksettingwidget.h @@ -48,7 +48,7 @@ class AdBlockSettingWidget : public QWidget, private Ui::adblock public: explicit AdBlockSettingWidget(KSharedConfig::Ptr config, QWidget *parent = 0); - bool changed(); + bool changed() const; Q_SIGNALS: void changed(bool); |