From c328e203e0d84177a0028d8ba5b0af4b82c16eeb Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 5 Feb 2010 00:29:13 +0100 Subject: QPointers --> QWeakPointers --- src/settings/settingsdialog.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/settings') diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index e37481aa..6fab5dcf 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -53,7 +53,6 @@ #include // Qt Includes -#include #include -- cgit v1.2.1 From 067b99a053b6f8b1ccab507be8e828b2f72a1e43 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 10 Feb 2010 10:57:57 +0100 Subject: Fix copyright for 0.4 beta release --- src/settings/settingsdialog.cpp | 5 ++--- src/settings/settingsdialog.h | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/settings') diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 6fab5dcf..2c04fac0 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -2,9 +2,8 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008-2009 by Andrea Diamantini -* Copyright (C) 2009 by Lionel Chauvin +* Copyright (C) 2008-2010 by Andrea Diamantini +* Copyright (C) 2009-2010 by Lionel Chauvin * * * This program is free software; you can redistribute it and/or diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h index 360fe246..da1415c4 100644 --- a/src/settings/settingsdialog.h +++ b/src/settings/settingsdialog.h @@ -2,9 +2,8 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008-2009 by Andrea Diamantini -* Copyright (C) 2009 by Lionel Chauvin +* Copyright (C) 2008-2010 by Andrea Diamantini +* Copyright (C) 2009-2010 by Lionel Chauvin * * * This program is free software; you can redistribute it and/or -- cgit v1.2.1 From 3e1ac6fb3f9865bf5bb0c156e985c1a4577b20e0 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 14 Feb 2010 11:23:37 +0100 Subject: Krazy issues (1st branch) --- src/settings/settings_webkit.ui | 2 +- src/settings/settingsdialog.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/settings') diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui index 5074522b..75776d95 100644 --- a/src/settings/settings_webkit.ui +++ b/src/settings/settings_webkit.ui @@ -148,7 +148,7 @@ - + 0 diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 2c04fac0..a3bf7359 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -138,7 +138,7 @@ Private::Private(SettingsDialog *parent) pageItem->setIcon(KIcon(ebrowsingInfo.icon())); // WARNING remember wheh changing here that the smaller netbooks - // have a 1024x576 resolution. So DONT bother that limits!! + // have a 1024x576 resolution. So DON'T bother that limits!! parent->setMinimumSize(700,525); } -- cgit v1.2.1 From 4391ac07ae2b5adfce04ee96c47d7eb49f1f4281 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 18 Feb 2010 15:20:03 +0100 Subject: Fix settings webkit UI (broken on the krazy fix from QComboBox to KComboBox) --- src/settings/settings_webkit.ui | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/settings') diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui index 75776d95..e424fd9c 100644 --- a/src/settings/settings_webkit.ui +++ b/src/settings/settings_webkit.ui @@ -149,12 +149,6 @@ - - - 0 - 0 - - Autoload Plugins @@ -219,6 +213,11 @@ QFrame
kurlrequester.h
+ + KComboBox + QComboBox +
kcombobox.h
+
-- cgit v1.2.1 From 8f65c4ad86e65f30935cec1c459d59fcd23fda18 Mon Sep 17 00:00:00 2001 From: pano Date: Thu, 18 Feb 2010 20:10:26 +0100 Subject: =?UTF-8?q?Change=20window=20titles=20strings=20a=20bit=20They=20n?= =?UTF-8?q?ow=20use=20a=20"real=20hyphen"=20(=E2=80=93)=20instead=20of=20t?= =?UTF-8?q?he=20plain=20minus=20character=20(-),=20like=20it=20is=20used?= =?UTF-8?q?=20in=20the=20rest=20of=20KDE.=20I=20also=20made=20the=20window?= =?UTF-8?q?=20titles=20translatable,=20since=20Left-to-Right=20languages?= =?UTF-8?q?=20might=20need=20this?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/settings/settingsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/settings') diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index a3bf7359..0b9d8e85 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -151,7 +151,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) , d(new Private(this)) { showButtonSeparator(false); - setWindowTitle(i18n("Configure - rekonq")); + setWindowTitle(i18nic("Window title of the settings dialog", "Configure – rekonq")); setModal(true); readConfig(); -- cgit v1.2.1 From 3d67f611a66096f19e1a6521f257ea748effb27f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 19 Feb 2010 02:36:27 +0100 Subject: Pano, please compile your code && your changes before asking for a merge request.. --- src/settings/settingsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/settings') diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 0b9d8e85..e7a9d1e8 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -151,7 +151,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) , d(new Private(this)) { showButtonSeparator(false); - setWindowTitle(i18nic("Window title of the settings dialog", "Configure – rekonq")); + setWindowTitle(i18nc("Window title of the settings dialog", "Configure – rekonq")); setModal(true); readConfig(); -- cgit v1.2.1 From 8dda858403d283f1850c0298aac0fb5212a27952 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 26 Feb 2010 11:37:11 +0100 Subject: tests support for every Qt derived rekonq class --- src/settings/settingsdialog.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/settings') diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h index da1415c4..54494a00 100644 --- a/src/settings/settingsdialog.h +++ b/src/settings/settingsdialog.h @@ -29,6 +29,9 @@ #define SETTINGS_DIALOG_H +// Local Includes +#include "rekonqprivate_export.h" + // KDE Includes #include @@ -37,7 +40,7 @@ class QWidget; class Private; -class SettingsDialog : public KConfigDialog +class REKONQ_TESTS_EXPORT SettingsDialog : public KConfigDialog { Q_OBJECT -- cgit v1.2.1 From 6faa12680a0d7d2f13c2862628325ab65521004b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 13 Mar 2010 23:24:45 +0100 Subject: Implemented automatic adblock update. This (squashed) commit adds this new feature in rekonq, letting people to simply "forgot" adblock and let rekonq do everything for it I added: - a new (rekonq) adblock widget - an asyncronous method to update rules from the net every TOT days - a better AdBlockManager management. What it is actually missing is the adp protocol support to add new subscriptions to adblock. This will come the next week. For now this part seems stable and needs just testing :) --- src/settings/adblockwidget.cpp | 158 ++++++++++++++++++++++++++++++++++++ src/settings/adblockwidget.h | 56 +++++++++++++ src/settings/settings_adblock.ui | 167 +++++++++++++++++++++++++++++++++++++++ src/settings/settingsdialog.cpp | 22 +++--- 4 files changed, 393 insertions(+), 10 deletions(-) create mode 100644 src/settings/adblockwidget.cpp create mode 100644 src/settings/adblockwidget.h create mode 100644 src/settings/settings_adblock.ui (limited to 'src/settings') diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp new file mode 100644 index 00000000..45e5fd5c --- /dev/null +++ b/src/settings/adblockwidget.cpp @@ -0,0 +1,158 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +#include "adblockwidget.h" +#include "adblockwidget.moc" + +#include "rekonq.h" + +#include +#include +#include + +#include +#include +#include + + +AdBlockWidget::AdBlockWidget(QWidget *parent) + : QWidget(parent) +{ + setupUi(this); + + hintLabel->setText( i18n("Filter expression (e.g. http://www.example.com/ad/*, more information):") ); + 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() ) ); + + load(); +} + + +void AdBlockWidget::slotInfoLinkActivated(const QString &url) +{ + Q_UNUSED(url) + + QString hintHelpString = i18n("

Enter an expression to filter. Filters can be defined as either:" + "

  • a shell-style wildcard, e.g. http://www.example.com/ads*, the wildcards *?[] may be used
  • " + "
  • a full regular expression by surrounding the string with '/', e.g. /\\/(ad|banner)\\./
" + "

Any filter string can be preceded by '@@' to whitelist (allow) any matching URL, " + "which takes priority over any blacklist (blocking) filter."); + + QWhatsThis::showText( QCursor::pos(), hintHelpString ); +} + + +void AdBlockWidget::insertRule() +{ + QString rule = addFilterLineEdit->text(); + if(rule.isEmpty()) + return; + + listWidget->addItem( rule ); + addFilterLineEdit->clear(); +} + + +void AdBlockWidget::removeRule() +{ + listWidget->takeItem( listWidget->currentRow() ); +} + + +void AdBlockWidget::load() +{ + bool isAdBlockEnabled = ReKonfig::adBlockEnabled(); + checkEnableAdblock->setChecked(isAdBlockEnabled); + + bool areImageFiltered = ReKonfig::hideAdsEnabled(); + checkHideImages->setChecked(areImageFiltered); + + QStringList subscriptions = ReKonfig::subscriptionNames(); + + // load automatic rules + foreach(QString sub, subscriptions) + { + QTreeWidgetItem *subItem = new QTreeWidgetItem(treeWidget); + 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() ); + foreach(const QString &rule, rules) + { + listWidget->addItem( rule ); + } +} + + +void AdBlockWidget::loadRules(QTreeWidgetItem *item) +{ + KSharedConfig::Ptr config = KGlobal::config(); + KConfigGroup localGroup( config, "rules" ); + + QString str = item->text(0) + "-rules"; + kDebug() << str; + QStringList rules = localGroup.readEntry( str , QStringList() ); + + foreach(const QString &rule, rules) + { + QTreeWidgetItem *subItem = new QTreeWidgetItem(item); + subItem->setText(0, rule); + } +} + + +void AdBlockWidget::save() +{ + int n; + + // local rules + KSharedConfig::Ptr config = KGlobal::config(); + KConfigGroup localGroup( config , "rules" ); + + QStringList localRules; + + n = listWidget->count(); + for(int i = 0; i < n; ++i) + { + QListWidgetItem *item = listWidget->takeItem(i); + localRules << item->text(); + } + localGroup.writeEntry( "local-rules" , localRules ); +} diff --git a/src/settings/adblockwidget.h b/src/settings/adblockwidget.h new file mode 100644 index 00000000..67061800 --- /dev/null +++ b/src/settings/adblockwidget.h @@ -0,0 +1,56 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +#ifndef ADBLOCK_WIDGET_H +#define ADBLOCK_WIDGET_H + + +#include "ui_settings_adblock.h" + +#include +#include + + +class AdBlockWidget : public QWidget, private Ui::adblock +{ +Q_OBJECT + +public: + AdBlockWidget(QWidget *parent = 0); + + void save(); + +private slots: + void slotInfoLinkActivated(const QString &); + void insertRule(); + void removeRule(); + +private: + void load(); + void loadRules(QTreeWidgetItem *item); +}; + +#endif // ADBLOCK_WIDGET_H diff --git a/src/settings/settings_adblock.ui b/src/settings/settings_adblock.ui new file mode 100644 index 00000000..28e1f973 --- /dev/null +++ b/src/settings/settings_adblock.ui @@ -0,0 +1,167 @@ + + + adblock + + + + 0 + 0 + 601 + 507 + + + + Form + + + + + + &Enable AdBlock + + + + + + + &Hide filtered Elements + + + + + + + + + + 0 + + + + Automatic Filters + + + + + + + 1 + + + + + + + + + + Automatic update interval: + + + + + + + 7 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Manual Filters + + + + + + + + Search: + + + + + + + + + + + + + + + TextLabel + + + + + + + + + + + + ... + + + + + + + ... + + + + + + + + + + + + + + KListWidget + QListWidget +

klistwidget.h
+ + + KLineEdit + QLineEdit +
klineedit.h
+
+ + KTabWidget + QTabWidget +
ktabwidget.h
+ 1 +
+ + KListWidgetSearchLine + KLineEdit +
klistwidgetsearchline.h
+
+ + + + diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index e7a9d1e8..fa1e8891 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -36,12 +36,14 @@ #include "application.h" #include "mainwindow.h" #include "webtab.h" +#include "adblockwidget.h" //Ui Includes #include "ui_settings_general.h" #include "ui_settings_tabs.h" #include "ui_settings_fonts.h" #include "ui_settings_webkit.h" +#include "ui_settings_adblock.h" // KDE Includes #include @@ -63,12 +65,14 @@ private: Ui::tabs tabsUi; Ui::fonts fontsUi; Ui::webkit webkitUi; + + AdBlockWidget *adBlockWidg; KCModuleProxy *proxyModule; KCModuleProxy *ebrowsingModule; KCModuleProxy *cookiesModule; KCModuleProxy *cacheModule; - KCModuleProxy *adblockModule; + KShortcutsEditor *shortcutsEditor; Private(SettingsDialog *parent); @@ -123,10 +127,10 @@ Private::Private(SettingsDialog *parent) KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); pageItem->setIcon(webkitIcon); - KCModuleInfo adblockInfo("khtml_filter.desktop"); - adblockModule = new KCModuleProxy(adblockInfo,parent); - pageItem = parent->addPage(adblockModule, i18n(adblockInfo.moduleName().toLocal8Bit())); - pageItem->setIcon(KIcon(adblockInfo.icon())); + adBlockWidg = new AdBlockWidget(parent); + adBlockWidg->layout()->setMargin(0); + pageItem = parent->addPage(adBlockWidg , i18n("Ad Block")); + pageItem->setIcon( KIcon("preferences-web-browser-adblock") ); shortcutsEditor = new KShortcutsEditor(Application::instance()->mainWindow()->actionCollection(), parent); pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts")); @@ -137,7 +141,7 @@ Private::Private(SettingsDialog *parent) pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit())); pageItem->setIcon(KIcon(ebrowsingInfo.icon())); - // WARNING remember wheh changing here that the smaller netbooks + // WARNING remember wheh changing here that the smallest netbooks // have a 1024x576 resolution. So DON'T bother that limits!! parent->setMinimumSize(700,525); } @@ -162,8 +166,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) connect(d->cookiesModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->proxyModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->cacheModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->adblockModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - + connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); @@ -213,7 +216,7 @@ void SettingsDialog::saveSettings() d->proxyModule->save(); d->cacheModule->save(); d->shortcutsEditor->save(); - d->adblockModule->save(); + d->adBlockWidg->save(); } @@ -224,7 +227,6 @@ bool SettingsDialog::hasChanged() || d->cookiesModule->changed() || d->proxyModule->changed() || d->cacheModule->changed() - || d->adblockModule->changed() || d->shortcutsEditor->isModified(); ; } -- cgit v1.2.1 From ae8aceced59f5d8721e986e7fc1c66c9026e87df Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 15 Mar 2010 00:38:50 +0100 Subject: Created a new Network Widget containing Cache, Cookies & Proxy Settings. This for multiple purposes: - clean a bit our settings dialog. Network settings are usually the less used - Provide a unique place where managing the settings network related. This to implement (one day) some better Ui to manage them. This commit also fixes all the handling with the network & the adblock widgets related to updating buttons and settings Ui at the beginning. --- src/settings/adblockwidget.cpp | 36 ++++++++++++++- src/settings/adblockwidget.h | 10 ++++ src/settings/networkwidget.cpp | 98 ++++++++++++++++++++++++++++++++++++++++ src/settings/networkwidget.h | 63 ++++++++++++++++++++++++++ src/settings/settings_adblock.ui | 2 +- src/settings/settingsdialog.cpp | 52 ++++++++------------- 6 files changed, 225 insertions(+), 36 deletions(-) create mode 100644 src/settings/networkwidget.cpp create mode 100644 src/settings/networkwidget.h (limited to 'src/settings') diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp index 45e5fd5c..8aac3e8c 100644 --- a/src/settings/adblockwidget.cpp +++ b/src/settings/adblockwidget.cpp @@ -24,15 +24,19 @@ * ============================================================ */ +// Self Includes #include "adblockwidget.h" #include "adblockwidget.moc" +// Auto Includes #include "rekonq.h" +// KDE Includes #include #include #include +// Qt Includes #include #include #include @@ -40,6 +44,7 @@ AdBlockWidget::AdBlockWidget(QWidget *parent) : QWidget(parent) + , _changed(false) { setupUi(this); @@ -53,11 +58,18 @@ AdBlockWidget::AdBlockWidget(QWidget *parent) 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() ) ); } @@ -98,7 +110,10 @@ void AdBlockWidget::load() checkEnableAdblock->setChecked(isAdBlockEnabled); bool areImageFiltered = ReKonfig::hideAdsEnabled(); - checkHideImages->setChecked(areImageFiltered); + checkHideAds->setChecked(areImageFiltered); + + int days = ReKonfig::updateInterval(); + spinBox->setValue( days ); QStringList subscriptions = ReKonfig::subscriptionNames(); @@ -155,4 +170,21 @@ void AdBlockWidget::save() localRules << item->text(); } localGroup.writeEntry( "local-rules" , localRules ); + + ReKonfig::setAdBlockEnabled( checkEnableAdblock->isChecked() ); + ReKonfig::setHideAdsEnabled( checkHideAds->isChecked() ); + ReKonfig::setUpdateInterval( spinBox->value() ); +} + + +void AdBlockWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +bool AdBlockWidget::changed() +{ + return _changed; } diff --git a/src/settings/adblockwidget.h b/src/settings/adblockwidget.h index 67061800..7e641f3e 100644 --- a/src/settings/adblockwidget.h +++ b/src/settings/adblockwidget.h @@ -28,8 +28,10 @@ #define ADBLOCK_WIDGET_H +// Ui Includes #include "ui_settings_adblock.h" +// Qt Includes #include #include @@ -42,8 +44,14 @@ 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(); @@ -51,6 +59,8 @@ private slots: private: void load(); void loadRules(QTreeWidgetItem *item); + + bool _changed; }; #endif // ADBLOCK_WIDGET_H diff --git a/src/settings/networkwidget.cpp b/src/settings/networkwidget.cpp new file mode 100644 index 00000000..2f5948cf --- /dev/null +++ b/src/settings/networkwidget.cpp @@ -0,0 +1,98 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +// Self Includes +#include "networkwidget.h" +#include "networkwidget.moc" + +// KDE Includes +#include +#include +#include + +// Qt Includes +#include + + +NetworkWidget::NetworkWidget(QWidget *parent) + : 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 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() ) ); +} + + +NetworkWidget::~NetworkWidget() +{ + delete _cacheModule; + delete _cookiesModule; + delete _proxyModule; +} + + +void NetworkWidget::save() +{ + _cookiesModule->save(); + _proxyModule->save(); + _cacheModule->save(); +} + + +void NetworkWidget::hasChanged() +{ + _changed = true; + emit changed(true); +} + + +bool NetworkWidget::changed() +{ + return _changed; +} diff --git a/src/settings/networkwidget.h b/src/settings/networkwidget.h new file mode 100644 index 00000000..efdd1807 --- /dev/null +++ b/src/settings/networkwidget.h @@ -0,0 +1,63 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +#ifndef NETWORK_WIDGET_H +#define NETWORK_WIDGET_H + + +// KDE Includes +#include + +// Qt Includes +#include + + +class NetworkWidget : public QWidget +{ +Q_OBJECT + +public: + NetworkWidget(QWidget *parent = 0); + ~NetworkWidget(); + + void save(); + bool changed(); + +signals: + void changed(bool); + +private slots: + void hasChanged(); + +private: + KCModuleProxy *_cacheModule; + KCModuleProxy *_cookiesModule; + KCModuleProxy *_proxyModule; + + bool _changed; +}; + +#endif // NETWORK_WIDGET_H diff --git a/src/settings/settings_adblock.ui b/src/settings/settings_adblock.ui index 28e1f973..445431c5 100644 --- a/src/settings/settings_adblock.ui +++ b/src/settings/settings_adblock.ui @@ -22,7 +22,7 @@
- + &Hide filtered Elements diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index fa1e8891..08d5ca6e 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -37,13 +37,13 @@ #include "mainwindow.h" #include "webtab.h" #include "adblockwidget.h" +#include "networkwidget.h" //Ui Includes #include "ui_settings_general.h" #include "ui_settings_tabs.h" #include "ui_settings_fonts.h" #include "ui_settings_webkit.h" -#include "ui_settings_adblock.h" // KDE Includes #include @@ -67,11 +67,9 @@ private: Ui::webkit webkitUi; AdBlockWidget *adBlockWidg; + NetworkWidget *networkWidg; - KCModuleProxy *proxyModule; KCModuleProxy *ebrowsingModule; - KCModuleProxy *cookiesModule; - KCModuleProxy *cacheModule; KShortcutsEditor *shortcutsEditor; @@ -103,21 +101,6 @@ Private::Private(SettingsDialog *parent) widget->layout()->setMargin(0); pageItem = parent->addPage(widget , i18n("Fonts")); pageItem->setIcon(KIcon("preferences-desktop-font")); - - KCModuleInfo cookiesInfo("cookies.desktop"); - cookiesModule = new KCModuleProxy(cookiesInfo,parent); - pageItem = parent->addPage(cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit())); - pageItem->setIcon(KIcon(cookiesInfo.icon())); - - KCModuleInfo proxyInfo("proxy.desktop"); - proxyModule = new KCModuleProxy(proxyInfo,parent); - pageItem = parent->addPage(proxyModule, i18n(proxyInfo.moduleName().toLocal8Bit())); - pageItem->setIcon(KIcon(proxyInfo.icon())); - - KCModuleInfo cacheInfo("cache.desktop"); - cacheModule = new KCModuleProxy(cacheInfo,parent); - pageItem = parent->addPage(cacheModule, i18n(cacheInfo.moduleName().toLocal8Bit())); - pageItem->setIcon(KIcon(cacheInfo.icon())); widget = new QWidget; webkitUi.setupUi(widget); @@ -127,6 +110,11 @@ Private::Private(SettingsDialog *parent) KIcon webkitIcon = KIcon(QIcon(webkitIconPath)); pageItem->setIcon(webkitIcon); + networkWidg = new NetworkWidget(parent); + networkWidg->layout()->setMargin(0); + pageItem = parent->addPage(networkWidg , i18n("Network")); + pageItem->setIcon( KIcon("preferences-system-network") ); + adBlockWidg = new AdBlockWidget(parent); adBlockWidg->layout()->setMargin(0); pageItem = parent->addPage(adBlockWidg , i18n("Ad Block")); @@ -162,15 +150,16 @@ SettingsDialog::SettingsDialog(QWidget *parent) 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->cookiesModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->proxyModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->cacheModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - - connect(d->shortcutsEditor, SIGNAL(keyChange()), 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())); + connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); setWebSettingsToolTips(); } @@ -212,21 +201,18 @@ void SettingsDialog::saveSettings() { ReKonfig::self()->writeConfig(); d->ebrowsingModule->save(); - d->cookiesModule->save(); - d->proxyModule->save(); - d->cacheModule->save(); d->shortcutsEditor->save(); d->adBlockWidg->save(); + d->networkWidg->save(); } bool SettingsDialog::hasChanged() { return KConfigDialog::hasChanged() - || d->ebrowsingModule->changed() - || d->cookiesModule->changed() - || d->proxyModule->changed() - || d->cacheModule->changed() + || d->adBlockWidg->changed() + || d->networkWidg->changed() + || d->ebrowsingModule->changed() || d->shortcutsEditor->isModified(); ; } -- cgit v1.2.1 From f51c660a207364b9b5ff400a29e8ff1dba721e61 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 19 Mar 2010 11:00:18 +0100 Subject: abp (Ad Block Plus) fake protocol support This will let rekonq to automatically add abp subscriptions from the adblockplus.org site (or wherever someone provides abp urls) Anyway, consider that the raccomended way to manage adblock (by me and by abp developers) is just adding the EasyList subscription. rekonq just does it by default!! --- src/settings/adblockwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/settings') diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp index 8aac3e8c..471f57f0 100644 --- a/src/settings/adblockwidget.cpp +++ b/src/settings/adblockwidget.cpp @@ -115,7 +115,7 @@ void AdBlockWidget::load() int days = ReKonfig::updateInterval(); spinBox->setValue( days ); - QStringList subscriptions = ReKonfig::subscriptionNames(); + QStringList subscriptions = ReKonfig::subscriptionTitles(); // load automatic rules foreach(QString sub, subscriptions) -- cgit v1.2.1 From a6ef003dd4c1b6ad08eca4f5adaa4679bbc20bce Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 20 Mar 2010 22:54:21 +0100 Subject: Downloads Page This commit implements the downloads history page. While it is in an horrible shape, its slots seem working well It needs just some love.. --- src/settings/settings_general.ui | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/settings') diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui index a4503d4a..98a56591 100644 --- a/src/settings/settings_general.ui +++ b/src/settings/settings_general.ui @@ -262,6 +262,11 @@ History + + + Downloads + + @@ -284,7 +289,7 @@ If enabled, rekonq will display an additional context menu entry, which, when selected, lists all available links of the current website in KGet. - + List links with KGet -- cgit v1.2.1 From 288b838f75f91205d81d5d46201eae90e8abd51a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 24 Mar 2010 10:51:58 +0100 Subject: This commit should finally fix settings handling --- src/settings/adblockwidget.cpp | 3 +++ src/settings/networkwidget.cpp | 3 +++ src/settings/settingsdialog.cpp | 6 ++++++ 3 files changed, 12 insertions(+) (limited to 'src/settings') 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"); } -- cgit v1.2.1 From 73a3dd68e9e9ffcecf9a09aceb479efccb0980ca Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 30 Mar 2010 09:44:03 +0200 Subject: fixing crash on manual rules saving --- src/settings/adblockwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/settings') diff --git a/src/settings/adblockwidget.cpp b/src/settings/adblockwidget.cpp index 39df2c36..2f431c1e 100644 --- a/src/settings/adblockwidget.cpp +++ b/src/settings/adblockwidget.cpp @@ -166,7 +166,7 @@ void AdBlockWidget::save() n = listWidget->count(); for(int i = 0; i < n; ++i) { - QListWidgetItem *item = listWidget->takeItem(i); + QListWidgetItem *item = listWidget->item(i); localRules << item->text(); } localGroup.writeEntry( "local-rules" , localRules ); -- cgit v1.2.1 From 93ad10ce9a9e1f02f43837edafb83b08cc90f1d4 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 19 Apr 2010 11:17:57 +0200 Subject: Implementing a new default engine choice for rekonq --- src/settings/settings_general.ui | 105 ++++++++--------------------- src/settings/settings_tabs.ui | 138 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 161 insertions(+), 82 deletions(-) (limited to 'src/settings') diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui index 98a56591..00277133 100644 --- a/src/settings/settings_general.ui +++ b/src/settings/settings_general.ui @@ -6,8 +6,8 @@ 0 0 - 751 - 523 + 552 + 512 @@ -150,11 +150,11 @@ - New Tabs Behaviour + Search Engine - - - + + + 0 @@ -169,73 +169,20 @@ - 120 - 0 - - - - New tab opens: - - - - - - - true - - - - 0 - 0 - - - - - New Tab Page - - - - - Blank Page - - - - - Home Page - - - - - - - - - 0 - 0 - - - - - 120 + 0 0 - - - 120 - 0 - + + Qt::LeftToRight - New tab page starts with: + Default search engine: - - - - true - + + 0 @@ -244,27 +191,27 @@ - Favorites + google - Closed Tabs + altavista - Bookmarks + lycos - History + wikipedia - Downloads + wolfram @@ -277,14 +224,7 @@ Download Manager - - - - - Use KGet for downloading files - - - + @@ -295,6 +235,13 @@ + + + + Use KGet for downloading files + + + @@ -306,7 +253,7 @@ 20 - 40 + 179 diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui index 9104843a..45579e90 100644 --- a/src/settings/settings_tabs.ui +++ b/src/settings/settings_tabs.ui @@ -6,14 +6,139 @@ 0 0 - 456 - 329 + 483 + 427 Tabs + + + + New Tabs Behaviour + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 0 + + + + New tab opens: + + + + + + + true + + + + 0 + 0 + + + + + New Tab Page + + + + + Blank Page + + + + + Home Page + + + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 0 + + + + New tab page starts with: + + + + + + + true + + + + 0 + 0 + + + + + Favorites + + + + + Closed Tabs + + + + + Bookmarks + + + + + History + + + + + Downloads + + + + + + + @@ -79,13 +204,20 @@ 20 - 142 + 120 + + + KComboBox + QComboBox +
kcombobox.h
+
+
-- cgit v1.2.1