diff --git a/src/definitions/definitions.h.in b/src/definitions/definitions.h.in index 5f317b82f..e7e76c267 100755 --- a/src/definitions/definitions.h.in +++ b/src/definitions/definitions.h.in @@ -93,7 +93,7 @@ #define PLACEHOLDER_UNREAD_COUNTS "%unread" #define PLACEHOLDER_ALL_COUNTS "%all" -#define ADBLOCK_CUSTOM_LIST_FILENAME "customlist.txt" +#define ADBLOCK_CUSTOM_LIST_FILENAME "custom_rules.txt" #define ADBLOCK_BASE_DIRECTORY_NAME "data/adblock" #define ADBLOCK_FILTERS_HELP "https://adblockplus.org/en/filters" #define ADBLOCK_EASYLIST_URL "https://easylist-downloads.adblockplus.org/easylist.txt" diff --git a/src/network-web/adblock/adblockaddsubscriptiondialog.cpp b/src/network-web/adblock/adblockaddsubscriptiondialog.cpp index 842e1d193..d5b451db0 100755 --- a/src/network-web/adblock/adblockaddsubscriptiondialog.cpp +++ b/src/network-web/adblock/adblockaddsubscriptiondialog.cpp @@ -60,16 +60,16 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget *parent) << Subscription("ABPindo (Indonesian)", "https://indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt") << Subscription("ChinaList (Chinese)", "http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt") << Subscription("Malware Domains list", "https://easylist-downloads.adblockplus.org/malwaredomains_full.txt") << - Subscription(tr("Other list"), QString()); + Subscription(tr("Another subscription"), QString()); foreach (const Subscription &subscription, m_knownSubscriptions) { m_ui->m_cmbPresets->addItem(subscription.m_title); } - connect(m_ui->m_cmbPresets, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int))); + connect(m_ui->m_cmbPresets, SIGNAL(currentIndexChanged(int)), this, SLOT(onSubscriptionPresetChanged(int))); connect(m_ui->m_txtTitle->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkInputs())); connect(m_ui->m_txtUrl->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkInputs())); - indexChanged(0); + onSubscriptionPresetChanged(0); } QString AdBlockAddSubscriptionDialog::title() const { @@ -80,7 +80,7 @@ QString AdBlockAddSubscriptionDialog::url() const { return m_ui->m_txtUrl->lineEdit()->text(); } -void AdBlockAddSubscriptionDialog::indexChanged(int index) { +void AdBlockAddSubscriptionDialog::onSubscriptionPresetChanged(int index) { const Subscription subscription = m_knownSubscriptions.at(index); // "Other" entry. @@ -89,14 +89,7 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index) { m_ui->m_txtUrl->lineEdit()->clear(); } else { - int pos = subscription.m_title.indexOf(QLatin1Char('(')); - QString title = subscription.m_title; - - if (pos > 0) { - title = title.left(pos).trimmed(); - } - - m_ui->m_txtTitle->lineEdit()->setText(title); + m_ui->m_txtTitle->lineEdit()->setText( subscription.m_title); m_ui->m_txtTitle->lineEdit()->setCursorPosition(0); m_ui->m_txtUrl->lineEdit()->setText(subscription.m_url); m_ui->m_txtUrl->lineEdit()->setCursorPosition(0); diff --git a/src/network-web/adblock/adblockaddsubscriptiondialog.h b/src/network-web/adblock/adblockaddsubscriptiondialog.h index ccc7bbf1c..0571bd7e9 100755 --- a/src/network-web/adblock/adblockaddsubscriptiondialog.h +++ b/src/network-web/adblock/adblockaddsubscriptiondialog.h @@ -43,7 +43,7 @@ class AdBlockAddSubscriptionDialog : public QDialog { private slots: // Index of selected list changed. - void indexChanged(int index); + void onSubscriptionPresetChanged(int index); void checkInputs(); private: diff --git a/src/network-web/adblock/adblockdialog.cpp b/src/network-web/adblock/adblockdialog.cpp index 3821d74ff..47f26be59 100755 --- a/src/network-web/adblock/adblockdialog.cpp +++ b/src/network-web/adblock/adblockdialog.cpp @@ -55,8 +55,6 @@ AdBlockDialog::AdBlockDialog(QWidget* parent) : QDialog(parent), m_ui(new Ui::Ad // Load the contents. load(); - - m_ui->m_buttonBox->setFocus(); } AdBlockDialog::~AdBlockDialog() { @@ -87,8 +85,8 @@ void AdBlockDialog::createConnections() { connect(m_ui->m_buttonBox, SIGNAL(accepted()), this, SLOT(close())); } -void AdBlockDialog::showRule(const AdBlockRule* rule) const { - AdBlockSubscription *subscription = rule->subscription(); +void AdBlockDialog::showRule(const AdBlockRule *rule) const { + const AdBlockSubscription *subscription = rule->subscription(); if (subscription == NULL) { return; @@ -115,11 +113,11 @@ void AdBlockDialog::removeRule() { } void AdBlockDialog::addSubscription() { - AdBlockAddSubscriptionDialog dialog(this); + QPointer dialog = new AdBlockAddSubscriptionDialog(this); - if (dialog.exec() == QDialog::Accepted) { - QString title = dialog.title(); - QString url = dialog.url(); + if (dialog.data()->exec() == QDialog::Accepted) { + QString title = dialog.data()->title(); + QString url = dialog.data()->url(); if (AdBlockSubscription *subscription = m_manager->addSubscription(title, url)) { AdBlockTreeWidget *tree = new AdBlockTreeWidget(subscription, m_ui->m_tabs); @@ -128,6 +126,8 @@ void AdBlockDialog::addSubscription() { m_ui->m_tabs->setCurrentIndex(index); } } + + delete dialog.data(); } void AdBlockDialog::removeSubscription() { diff --git a/src/network-web/adblock/adblockdialog.ui b/src/network-web/adblock/adblockdialog.ui index 467345ec7..e3a17b968 100755 --- a/src/network-web/adblock/adblockdialog.ui +++ b/src/network-web/adblock/adblockdialog.ui @@ -7,7 +7,7 @@ 0 0 535 - 408 + 466 @@ -32,7 +32,9 @@ - Note that Adblock may significantly slow this application down once you activate huge subscriptions. Too many rules is not good for performance. Also, make sure you restart application after you disable Adblock if you wish to have low memory footprint. Adblock is known to use much system memory. + Note that Adblock may significantly slow this application down once you activate huge subscriptions. Too many rules is not good for performance. Also, make sure you restart application after you disable Adblock if you wish to have low memory footprint. Adblock is known to use much system memory. + +Also note that some resources are cached by internal web browser. Thus, after changing some rules or subscriptions they will fully apply only for newly opened web browser tabs. true