diff --git a/CHANGELOG b/CHANGELOG index 73b6abacc..3e9ef709c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ Version 1.5.0 * added support for Proxy Auto-Config (PAC) * added option to open another private window from private window * added delete action in edit context menu on page + * added possibility to remove EasyList from AdBlock * proxy exceptions now supports wildcards (*, ?) * cancel upload when trying to upload non-readable files * GreaseMonkey: added support for GM_Settings diff --git a/src/lib/adblock/adblockaddsubscriptiondialog.cpp b/src/lib/adblock/adblockaddsubscriptiondialog.cpp index a41dee037..c6586b094 100644 --- a/src/lib/adblock/adblockaddsubscriptiondialog.cpp +++ b/src/lib/adblock/adblockaddsubscriptiondialog.cpp @@ -24,7 +24,8 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent) { ui->setupUi(this); - m_knownSubscriptions << Subscription("Fanboy's List (English)", "http://www.fanboy.co.nz/adblock/fanboy-adblock.txt") + m_knownSubscriptions << Subscription("EasyList (English)", "https://easylist-downloads.adblockplus.org/easylist.txt") + << Subscription("Fanboy's List (English)", "http://www.fanboy.co.nz/adblock/fanboy-adblock.txt") << Subscription("Adversity (English)", "http://adversity.googlecode.com/hg/Adversity.txt") << Subscription("BSI Lista Polska (Polish)", "http://www.bsi.info.pl/filtrABP.txt") << Subscription("Czech List (Czech)", "http://adblock.dajbych.net/adblock.txt") diff --git a/src/lib/adblock/adblockmanager.cpp b/src/lib/adblock/adblockmanager.cpp index afe352f26..39f6ecfa8 100644 --- a/src/lib/adblock/adblockmanager.cpp +++ b/src/lib/adblock/adblockmanager.cpp @@ -225,7 +225,7 @@ void AdBlockManager::load() } foreach (const QString &fileName, adblockDir.entryList(QStringList("*.txt"), QDir::Files)) { - if (fileName == QLatin1String("easylist.txt") || fileName == QLatin1String("customlist.txt")) { + if (fileName == QLatin1String("customlist.txt")) { continue; } @@ -253,10 +253,15 @@ void AdBlockManager::load() m_subscriptions.append(subscription); } - // Prepend EasyList - AdBlockSubscription* easyList = new AdBlockEasyList(this); - m_subscriptions.prepend(easyList); - connect(easyList, SIGNAL(subscriptionUpdated()), mApp, SLOT(reloadUserStyleSheet())); + // Prepend EasyList if subscriptions are empty + if (m_subscriptions.isEmpty()) { + AdBlockSubscription* easyList = new AdBlockSubscription(tr("EasyList"), this); + easyList->setUrl(QUrl("https://easylist-downloads.adblockplus.org/easylist.txt")); + easyList->setFilePath(mApp->currentProfilePath() + "adblock/easylist.txt"); + connect(easyList, SIGNAL(subscriptionUpdated()), mApp, SLOT(reloadUserStyleSheet())); + + m_subscriptions.prepend(easyList); + } // Append CustomList AdBlockCustomList* customList = new AdBlockCustomList(this); diff --git a/src/lib/adblock/adblocksubscription.cpp b/src/lib/adblock/adblocksubscription.cpp index f69baf194..8ca3b4b24 100644 --- a/src/lib/adblock/adblocksubscription.cpp +++ b/src/lib/adblock/adblocksubscription.cpp @@ -181,6 +181,19 @@ void AdBlockSubscription::saveDownloadedData(const QByteArray &data) return; } + if (m_url == QUrl("https://easylist-downloads.adblockplus.org/easylist.txt")) { + // Third-party advertisers rules are with start domain (||) placeholder which needs regexps + // So we are ignoring it for keeping good performance + // But we will use whitelist rules at the end of list + + QByteArray part1 = data.left(data.indexOf(QLatin1String("!-----------------------------Third-party adverts-----------------------------!"))); + QByteArray part2 = data.mid(data.indexOf(QLatin1String("!---------------------------------Whitelists----------------------------------!"))); + + file.write(part1 + part2); + file.close(); + return; + } + file.write(data); file.close(); } @@ -379,40 +392,6 @@ AdBlockSubscription::~AdBlockSubscription() qDeleteAll(m_rules); } -// AdBlockEasyList - -AdBlockEasyList::AdBlockEasyList(QObject* parent) - : AdBlockSubscription(tr("EasyList"), parent) -{ - setUrl(QUrl("https://easylist-downloads.adblockplus.org/easylist.txt")); - setFilePath(mApp->currentProfilePath() + "adblock/easylist.txt"); -} - -bool AdBlockEasyList::canBeRemoved() const -{ - return false; -} - -void AdBlockEasyList::saveDownloadedData(const QByteArray &data) -{ - QFile file(filePath()); - - if (!file.open(QFile::ReadWrite | QFile::Truncate)) { - qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "Unable to open adblock file for writing:" << filePath(); - return; - } - - // Third-party advertisers rules are with start domain (||) placeholder which needs regexps - // So we are ignoring it for keeping good performance - // But we will use whitelist rules at the end of list - - QByteArray part1 = data.left(data.indexOf(QLatin1String("!-----------------------------Third-party adverts-----------------------------!"))); - QByteArray part2 = data.mid(data.indexOf(QLatin1String("!---------------------------------Whitelists----------------------------------!"))); - - file.write(part1 + part2); - file.close(); -} - // AdBlockCustomList AdBlockCustomList::AdBlockCustomList(QObject* parent) diff --git a/src/lib/adblock/adblocksubscription.h b/src/lib/adblock/adblocksubscription.h index 94065af38..a83ffd151 100644 --- a/src/lib/adblock/adblocksubscription.h +++ b/src/lib/adblock/adblocksubscription.h @@ -131,18 +131,6 @@ private: bool m_updated; }; -class AdBlockEasyList : public AdBlockSubscription -{ - Q_OBJECT -public: - explicit AdBlockEasyList(QObject* parent = 0); - - bool canBeRemoved() const; - -protected: - void saveDownloadedData(const QByteArray &data); -}; - class AdBlockCustomList : public AdBlockSubscription { Q_OBJECT diff --git a/translations/empty.ts b/translations/empty.ts index 2dbe4da4c..f4b1478a1 100644 --- a/translations/empty.ts +++ b/translations/empty.ts @@ -116,7 +116,7 @@ AdBlockCustomList - + Custom Rules @@ -179,14 +179,6 @@ - - AdBlockEasyList - - - EasyList - - - AdBlockIcon @@ -258,6 +250,11 @@ AdBlock Subscription + + + EasyList + + AdBlockTreeWidget @@ -2439,12 +2436,12 @@ - + Error! - + Cannot load extension! @@ -5751,173 +5748,173 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla WebPage - + QupZilla cannot handle <b>%1:</b> links. The requested link is <ul><li>%2</li></ul>Do you want QupZilla to try open this link in system application? - + Remember my choice for this protocol - + External Protocol Request - + To show this page, QupZilla must resend request which do it again (like searching on making an shopping, which has been already done.) - + Confirm form resubmission - + Select files to upload... - + Server refused the connection - + Server closed the connection - + Server not found - + Connection timed out - + Untrusted connection - + Temporary network failure - + Proxy connection refused - + Proxy server not found - + Proxy connection timed out - + Proxy authentication required - + Content not found - + Unknown network error - + AdBlocked Content - + Blocked by <i>%1</i> - + Content Access Denied - + Error code %1 - + Failed loading page - + QupZilla can't load page. - + QupZilla can't load page from %1. - + Check the address for typing errors such as <b>ww.</b>example.com instead of <b>www.</b>example.com - + If you are unable to load any pages, check your computer's network connection. - + If your computer or network is protected by a firewall or proxy, make sure that QupZilla is permitted to access the Web. - + Try Again - + JavaScript alert - + Prevent this page from creating additional dialogs - + Choose file... - + Cannot read data from <b>%1</b>. Upload was cancelled! - + Cannot read file! @@ -5963,268 +5960,268 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla - + Create Search Engine - + Cut - + Copy - + Paste - + Select All - - + + &Reload - + S&top - + Delete - + &Back - + &Forward - + This frame - + Show &only this frame - + Show this frame in new &tab - + Print frame - + Zoom &in - + &Zoom out - + Reset - + Show so&urce of frame - + Book&mark page - + &Save page as... - + &Copy page link - + Send page link... - + &Print page - + Select &all - + Validate page - + Show so&urce code - + Show info ab&out site - + Open link in new &tab - + Open link in new &window - + B&ookmark link - + &Save link as... - + Send link... - + &Copy link address - + Show i&mage - + Copy im&age - + Copy image ad&dress - + &Save image as... - + Send image... - + Send text... - + Google Translate - + Dictionary - + Go to &web address - + Search "%1 .." with %2 - + Search with... - + &Play - + &Pause - + Un&mute - + &Mute - + &Copy Media Address - + &Send Media Address - + Save Media To &Disk - + Check &Spelling - + Languages