summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/adblock/adblockmanager.cpp51
-rw-r--r--src/mainwindow.cpp14
-rw-r--r--src/settings/adblockwidget.cpp3
-rw-r--r--src/settings/networkwidget.cpp3
-rw-r--r--src/settings/settingsdialog.cpp6
5 files changed, 51 insertions, 26 deletions
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp
index 66e11277..71412d5d 100644
--- a/src/adblock/adblockmanager.cpp
+++ b/src/adblock/adblockmanager.cpp
@@ -84,7 +84,7 @@ void AdBlockManager::loadSettings(bool checkUpdateDate)
KConfigGroup rulesGroup( config, "rules" );
QStringList rules;
rules = rulesGroup.readEntry( "local-rules" , QStringList() );
- loadRules( rules );
+ loadRules(rules);
// ----------------------------------------------------------
@@ -115,26 +115,35 @@ void AdBlockManager::loadRules(const QStringList &rules)
foreach(const QString &stringRule, rules)
{
// ! rules are comments
- if( !stringRule.startsWith('!') && !stringRule.startsWith('[') && !stringRule.isEmpty() )
- {
- // white rules
- if( stringRule.startsWith( QLatin1String("@@") ) )
- {
- AdBlockRule rule( stringRule.mid(2) );
- _whiteList << rule;
- continue;
- }
-
- // hide (CSS) rules
- if( stringRule.startsWith( QLatin1String("##") ) )
- {
- _hideList << stringRule.mid(2);
- continue;
- }
-
- AdBlockRule rule( stringRule );
- _blackList << rule;
+ if( stringRule.startsWith('!') )
+ continue;
+
+ // [ rules are ABP infos
+ if( stringRule.startsWith('[') )
+ continue;
+
+ // empty rules are just dangerous..
+ // (an empty rule in whitelist allows all, in blacklist blocks all..)
+ if( stringRule.isEmpty() )
+ continue;
+
+ // white rules
+ if( stringRule.startsWith( QLatin1String("@@") ) )
+ {
+ AdBlockRule rule( stringRule.mid(2) );
+ _whiteList << rule;
+ continue;
}
+
+ // hide (CSS) rules
+ if( stringRule.startsWith( QLatin1String("##") ) )
+ {
+ _hideList << stringRule.mid(2);
+ continue;
+ }
+
+ AdBlockRule rule( stringRule );
+ _blackList << rule;
}
}
@@ -182,7 +191,7 @@ QNetworkReply *AdBlockManager::block(const QNetworkRequest &request)
void AdBlockManager::applyHidingRules(WebPage *page)
{
- if(!page || !page->mainFrame())
+ if(!page)
return;
if (!_isAdblockEnabled)
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 93273dc9..867d2a32 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -545,6 +545,11 @@ void MainWindow::setupPanels()
void MainWindow::updateConfiguration()
{
+ kDebug() << "======================================================================================================================";
+ kDebug() << "======================================================================================================================";
+ kDebug() << "======================================================================================================================";
+ kDebug() << "======================================================================================================================";
+
// ============== General ==================
m_view->updateTabBar();
@@ -641,14 +646,13 @@ void MainWindow::preferences()
return;
// we didn't find an instance of this dialog, so lets create it
- QWeakPointer<SettingsDialog> s = new SettingsDialog(this);
+ QPointer<SettingsDialog> s = new SettingsDialog(this);
// keep us informed when the user changes settings
- connect(s.data(), SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
+ connect(s, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration()));
- s.data()->exec();
- delete s.data();
- s.clear();
+ s->exec();
+ delete s;
}
diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp
index 471f57f0..39df2c36 100644
--- a/src/settings/adblockwidget.cpp
+++ b/src/settings/adblockwidget.cpp
@@ -174,6 +174,9 @@ void AdBlockWidget::save()
ReKonfig::setAdBlockEnabled( checkEnableAdblock->isChecked() );
ReKonfig::setHideAdsEnabled( checkHideAds->isChecked() );
ReKonfig::setUpdateInterval( spinBox->value() );
+
+ _changed = false;
+ emit changed(false);
}
diff --git a/src/settings/networkwidget.cpp b/src/settings/networkwidget.cpp
index 2f5948cf..54f6e068 100644
--- a/src/settings/networkwidget.cpp
+++ b/src/settings/networkwidget.cpp
@@ -82,6 +82,9 @@ void NetworkWidget::save()
_cookiesModule->save();
_proxyModule->save();
_cacheModule->save();
+
+ _changed = false;
+ emit changed(false);
}
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index 08d5ca6e..35f753d3 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -199,11 +199,17 @@ void SettingsDialog::readConfig()
// we need this function to SAVE settings in rc file..
void SettingsDialog::saveSettings()
{
+ if (!hasChanged())
+ return;
+
ReKonfig::self()->writeConfig();
d->ebrowsingModule->save();
d->shortcutsEditor->save();
d->adBlockWidg->save();
d->networkWidg->save();
+
+ updateButtons();
+ emit settingsChanged("ReKonfig");
}