summaryrefslogtreecommitdiff
path: root/src/settings
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-04-30 11:23:37 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-04-30 11:23:37 +0200
commitc896cc340d7e6e0878b3249c5792e6d88a12cf42 (patch)
treefd0a7a61ff1d07f301f2188de5cb6fa473134897 /src/settings
parentA tiny improvement in the error page, showing a fat icon.. :) (diff)
downloadrekonq-c896cc340d7e6e0878b3249c5792e6d88a12cf42.tar.xz
A coding style round
Diffstat (limited to 'src/settings')
-rw-r--r--src/settings/adblockwidget.cpp92
-rw-r--r--src/settings/adblockwidget.h10
-rw-r--r--src/settings/networkwidget.cpp40
-rw-r--r--src/settings/networkwidget.h6
-rw-r--r--src/settings/settingsdialog.cpp52
-rw-r--r--src/settings/settingsdialog.h6
6 files changed, 103 insertions, 103 deletions
diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp
index 2f431c1e..0d65c2de 100644
--- a/src/settings/adblockwidget.cpp
+++ b/src/settings/adblockwidget.cpp
@@ -43,64 +43,64 @@
AdBlockWidget::AdBlockWidget(QWidget *parent)
- : QWidget(parent)
- , _changed(false)
+ : QWidget(parent)
+ , _changed(false)
{
setupUi(this);
-
- hintLabel->setText( i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):") );
- connect( hintLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(slotInfoLinkActivated(const QString &)) );
-
+
+ hintLabel->setText(i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):"));
+ connect(hintLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(slotInfoLinkActivated(const QString &)));
+
listWidget->setSortingEnabled(true);
listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
-
+
searchLine->setListWidget(listWidget);
-
- insertButton->setIcon( KIcon("list-add") );
- connect( insertButton, SIGNAL( clicked() ), this, SLOT( insertRule() ) );
-
- removeButton->setIcon( KIcon("list-remove") );
- connect( removeButton, SIGNAL( clicked() ), this, SLOT( removeRule() ) );
-
+
+ insertButton->setIcon(KIcon("list-add"));
+ connect(insertButton, SIGNAL(clicked()), this, SLOT(insertRule()));
+
+ removeButton->setIcon(KIcon("list-remove"));
+ connect(removeButton, SIGNAL(clicked()), this, SLOT(removeRule()));
+
load();
-
+
// emit changed signal
- connect( insertButton, SIGNAL( clicked() ), this, SLOT( hasChanged() ) );
- connect( removeButton, SIGNAL( clicked() ), this, SLOT( hasChanged() ) );
- connect( checkEnableAdblock, SIGNAL( stateChanged(int) ), this, SLOT( hasChanged() ) );
- connect( checkHideAds, SIGNAL( stateChanged(int) ), this, SLOT( hasChanged() ) );
- connect( spinBox, SIGNAL( valueChanged(int) ), this, SLOT( hasChanged() ) );
+ connect(insertButton, SIGNAL(clicked()), this, SLOT(hasChanged()));
+ connect(removeButton, SIGNAL(clicked()), this, SLOT(hasChanged()));
+ connect(checkEnableAdblock, SIGNAL(stateChanged(int)), this, SLOT(hasChanged()));
+ connect(checkHideAds, SIGNAL(stateChanged(int)), this, SLOT(hasChanged()));
+ connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(hasChanged()));
}
void AdBlockWidget::slotInfoLinkActivated(const QString &url)
{
Q_UNUSED(url)
-
+
QString hintHelpString = i18n("<qt><p>Enter an expression to filter. Filters can be defined as either:"
"<ul><li>a shell-style wildcard, e.g. <tt>http://www.example.com/ads*</tt>, the wildcards <tt>*?[]</tt> may be used</li>"
"<li>a full regular expression by surrounding the string with '<tt>/</tt>', e.g. <tt>/\\/(ad|banner)\\./</tt></li></ul>"
"<p>Any filter string can be preceded by '<tt>@@</tt>' to whitelist (allow) any matching URL, "
"which takes priority over any blacklist (blocking) filter.");
- QWhatsThis::showText( QCursor::pos(), hintHelpString );
+ QWhatsThis::showText(QCursor::pos(), hintHelpString);
}
void AdBlockWidget::insertRule()
{
QString rule = addFilterLineEdit->text();
- if(rule.isEmpty())
+ if (rule.isEmpty())
return;
-
- listWidget->addItem( rule );
+
+ listWidget->addItem(rule);
addFilterLineEdit->clear();
}
void AdBlockWidget::removeRule()
{
- listWidget->takeItem( listWidget->currentRow() );
+ listWidget->takeItem(listWidget->currentRow());
}
@@ -108,13 +108,13 @@ void AdBlockWidget::load()
{
bool isAdBlockEnabled = ReKonfig::adBlockEnabled();
checkEnableAdblock->setChecked(isAdBlockEnabled);
-
+
bool areImageFiltered = ReKonfig::hideAdsEnabled();
checkHideAds->setChecked(areImageFiltered);
-
+
int days = ReKonfig::updateInterval();
- spinBox->setValue( days );
-
+ spinBox->setValue(days);
+
QStringList subscriptions = ReKonfig::subscriptionTitles();
// load automatic rules
@@ -124,14 +124,14 @@ void AdBlockWidget::load()
subItem->setText(0, sub);
loadRules(subItem);
}
-
+
// load local rules
KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup localGroup( config, "rules" );
- QStringList rules = localGroup.readEntry( "local-rules" , QStringList() );
+ KConfigGroup localGroup(config, "rules");
+ QStringList rules = localGroup.readEntry("local-rules" , QStringList());
foreach(const QString &rule, rules)
{
- listWidget->addItem( rule );
+ listWidget->addItem(rule);
}
}
@@ -139,12 +139,12 @@ void AdBlockWidget::load()
void AdBlockWidget::loadRules(QTreeWidgetItem *item)
{
KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup localGroup( config, "rules" );
-
+ KConfigGroup localGroup(config, "rules");
+
QString str = item->text(0) + "-rules";
kDebug() << str;
- QStringList rules = localGroup.readEntry( str , QStringList() );
-
+ QStringList rules = localGroup.readEntry(str , QStringList());
+
foreach(const QString &rule, rules)
{
QTreeWidgetItem *subItem = new QTreeWidgetItem(item);
@@ -159,21 +159,21 @@ void AdBlockWidget::save()
// local rules
KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup localGroup( config , "rules" );
-
+ KConfigGroup localGroup(config , "rules");
+
QStringList localRules;
-
+
n = listWidget->count();
- for(int i = 0; i < n; ++i)
+ for (int i = 0; i < n; ++i)
{
QListWidgetItem *item = listWidget->item(i);
localRules << item->text();
}
- localGroup.writeEntry( "local-rules" , localRules );
+ localGroup.writeEntry("local-rules" , localRules);
- ReKonfig::setAdBlockEnabled( checkEnableAdblock->isChecked() );
- ReKonfig::setHideAdsEnabled( checkHideAds->isChecked() );
- ReKonfig::setUpdateInterval( spinBox->value() );
+ ReKonfig::setAdBlockEnabled(checkEnableAdblock->isChecked());
+ ReKonfig::setHideAdsEnabled(checkHideAds->isChecked());
+ ReKonfig::setUpdateInterval(spinBox->value());
_changed = false;
emit changed(false);
diff --git a/src/settings/adblockwidget.h b/src/settings/adblockwidget.h
index 7e641f3e..1ed9aaa6 100644
--- a/src/settings/adblockwidget.h
+++ b/src/settings/adblockwidget.h
@@ -38,20 +38,20 @@
class AdBlockWidget : public QWidget, private Ui::adblock
{
-Q_OBJECT
+ Q_OBJECT
public:
AdBlockWidget(QWidget *parent = 0);
-
+
void save();
bool changed();
-
+
signals:
void changed(bool);
-
+
private slots:
void hasChanged();
-
+
void slotInfoLinkActivated(const QString &);
void insertRule();
void removeRule();
diff --git a/src/settings/networkwidget.cpp b/src/settings/networkwidget.cpp
index 54f6e068..25e38c47 100644
--- a/src/settings/networkwidget.cpp
+++ b/src/settings/networkwidget.cpp
@@ -38,34 +38,34 @@
NetworkWidget::NetworkWidget(QWidget *parent)
- : QWidget(parent)
- , _cacheModule(0)
- , _cookiesModule(0)
- , _proxyModule(0)
- , _changed(false)
+ : QWidget(parent)
+ , _cacheModule(0)
+ , _cookiesModule(0)
+ , _proxyModule(0)
+ , _changed(false)
{
QVBoxLayout *l = new QVBoxLayout(this);
l->setMargin(0);
l->setSpacing(0);
-
+
KTabWidget *tabWidget = new KTabWidget(this);
l->addWidget(tabWidget);
- KCModuleInfo cacheInfo("cache.desktop");
- _cacheModule = new KCModuleProxy(cacheInfo,parent);
- tabWidget->addTab( _cacheModule, i18n(cacheInfo.moduleName().toLocal8Bit()) );
-
+ KCModuleInfo cacheInfo("cache.desktop");
+ _cacheModule = new KCModuleProxy(cacheInfo, parent);
+ tabWidget->addTab(_cacheModule, i18n(cacheInfo.moduleName().toLocal8Bit()));
+
KCModuleInfo cookiesInfo("cookies.desktop");
- _cookiesModule = new KCModuleProxy(cookiesInfo,parent);
- tabWidget->addTab( _cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit()) );
-
- KCModuleInfo proxyInfo("proxy.desktop");
- _proxyModule = new KCModuleProxy(proxyInfo,parent);
- tabWidget->addTab( _proxyModule, i18n(proxyInfo.moduleName().toLocal8Bit()) );
-
- connect(_cacheModule, SIGNAL( changed(bool) ), this, SLOT( hasChanged() ) );
- connect(_cookiesModule, SIGNAL( changed(bool) ), this, SLOT( hasChanged() ) );
- connect(_proxyModule, SIGNAL( changed(bool) ), this, SLOT( hasChanged() ) );
+ _cookiesModule = new KCModuleProxy(cookiesInfo, parent);
+ tabWidget->addTab(_cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit()));
+
+ KCModuleInfo proxyInfo("proxy.desktop");
+ _proxyModule = new KCModuleProxy(proxyInfo, parent);
+ tabWidget->addTab(_proxyModule, i18n(proxyInfo.moduleName().toLocal8Bit()));
+
+ connect(_cacheModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
+ connect(_cookiesModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
+ connect(_proxyModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
}
diff --git a/src/settings/networkwidget.h b/src/settings/networkwidget.h
index efdd1807..6b7abffd 100644
--- a/src/settings/networkwidget.h
+++ b/src/settings/networkwidget.h
@@ -37,12 +37,12 @@
class NetworkWidget : public QWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
NetworkWidget(QWidget *parent = 0);
~NetworkWidget();
-
+
void save();
bool changed();
@@ -51,7 +51,7 @@ signals:
private slots:
void hasChanged();
-
+
private:
KCModuleProxy *_cacheModule;
KCModuleProxy *_cookiesModule;
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
index d01b5809..d2d5c0d0 100644
--- a/src/settings/settingsdialog.cpp
+++ b/src/settings/settingsdialog.cpp
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -61,7 +61,7 @@
class Private
{
private:
-
+
Ui::general generalUi;
Ui::tabs tabsUi;
Ui::fonts fontsUi;
@@ -69,11 +69,11 @@ private:
AdBlockWidget *adBlockWidg;
NetworkWidget *networkWidg;
-
+
KCModuleProxy *ebrowsingModule;
KShortcutsEditor *shortcutsEditor;
-
+
Private(SettingsDialog *parent);
friend class SettingsDialog;
@@ -102,7 +102,7 @@ Private::Private(SettingsDialog *parent)
widget->layout()->setMargin(0);
pageItem = parent->addPage(widget , i18n("Fonts"));
pageItem->setIcon(KIcon("preferences-desktop-font"));
-
+
widget = new QWidget;
webkitUi.setupUi(widget);
widget->layout()->setMargin(0);
@@ -114,25 +114,25 @@ Private::Private(SettingsDialog *parent)
networkWidg = new NetworkWidget(parent);
networkWidg->layout()->setMargin(0);
pageItem = parent->addPage(networkWidg , i18n("Network"));
- pageItem->setIcon( KIcon("preferences-system-network") );
-
+ pageItem->setIcon(KIcon("preferences-system-network"));
+
adBlockWidg = new AdBlockWidget(parent);
adBlockWidg->layout()->setMargin(0);
pageItem = parent->addPage(adBlockWidg , i18n("Ad Block"));
- pageItem->setIcon( KIcon("preferences-web-browser-adblock") );
-
+ pageItem->setIcon(KIcon("preferences-web-browser-adblock"));
+
shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent);
pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts"));
pageItem->setIcon(KIcon("configure-shortcuts"));
KCModuleInfo ebrowsingInfo("ebrowsing.desktop");
- ebrowsingModule = new KCModuleProxy(ebrowsingInfo,parent);
+ ebrowsingModule = new KCModuleProxy(ebrowsingInfo, parent);
pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit()));
pageItem->setIcon(KIcon(ebrowsingInfo.icon()));
// WARNING remember wheh changing here that the smallest netbooks
// have a 1024x576 resolution. So DON'T bother that limits!!
- parent->setMinimumSize(700,525);
+ parent->setMinimumSize(700, 525);
}
@@ -150,18 +150,18 @@ SettingsDialog::SettingsDialog(QWidget *parent)
readConfig();
connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
-
+
// update buttons
connect(d->adBlockWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
connect(d->networkWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
-
+
connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons()));
-
+
// save settings
connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings()));
connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings()));
-
+
setWebSettingsToolTips();
}
@@ -175,7 +175,7 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::setWebSettingsToolTips()
{
d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages."));
- d->webkitUi.kcfg_dnsPrefetch->setToolTip( i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing.") );
+ d->webkitUi.kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing."));
d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs."));
d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets."));
d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages."));
@@ -203,7 +203,7 @@ void SettingsDialog::saveSettings()
{
if (!hasChanged())
return;
-
+
ReKonfig::self()->writeConfig();
d->ebrowsingModule->save();
d->shortcutsEditor->save();
@@ -212,8 +212,8 @@ void SettingsDialog::saveSettings()
SearchEngine::loadDefaultWS();
SearchEngine::loadDelimiter();
SearchEngine::loadFavorites();
-
-
+
+
updateButtons();
emit settingsChanged("ReKonfig");
}
@@ -221,12 +221,12 @@ void SettingsDialog::saveSettings()
bool SettingsDialog::hasChanged()
{
- return KConfigDialog::hasChanged()
- || d->adBlockWidg->changed()
- || d->networkWidg->changed()
- || d->ebrowsingModule->changed()
- || d->shortcutsEditor->isModified();
- ;
+ return KConfigDialog::hasChanged()
+ || d->adBlockWidg->changed()
+ || d->networkWidg->changed()
+ || d->ebrowsingModule->changed()
+ || d->shortcutsEditor->isModified();
+ ;
}
diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h
index 54494a00..08d3c71b 100644
--- a/src/settings/settingsdialog.h
+++ b/src/settings/settingsdialog.h
@@ -11,9 +11,9 @@
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
+* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
-*
+*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -47,7 +47,7 @@ class REKONQ_TESTS_EXPORT SettingsDialog : public KConfigDialog
public:
SettingsDialog(QWidget *parent = 0);
~SettingsDialog();
-
+
virtual bool hasChanged();
private: