Commit 6a141e89 authored by Laurent Montel's avatar Laurent Montel 😁

Reactivate some codes

parent b803a6b6
......@@ -46,7 +46,6 @@ void AdblockManager::reloadConfig()
loadSubscriptions();
bool enabled = AdBlock::AdBlockSettings::self()->adBlockEnabled();
Q_EMIT enabledChanged(enabled);
qDebug() << " void AdblockManager::reloadConfig()" << enabled << " " << this;
}
void AdblockManager::loadSubscriptions()
......
......@@ -332,15 +332,14 @@ AdBlockCustomList::AdBlockCustomList(QObject *parent)
void AdBlockCustomList::loadSubscription(const QStringList &disabledRules)
{
#if 0
// DuckDuckGo ad whitelist rules
// They cannot be removed, but can be disabled.
// Please consider not disabling them. Thanks!
const QString ddg1 = QSL("@@||duckduckgo.com^$document");
const QString ddg2 = QSL("duckduckgo.com#@#.has-ad");
const QString ddg1 = QStringLiteral("@@||duckduckgo.com^$document");
const QString ddg2 = QStringLiteral("duckduckgo.com#@#.has-ad");
const QString rules = QzTools::readAllFileContents(filePath());
const QString rules = QString::fromUtf8(readAllFileByteContents(filePath()));
QFile file(filePath());
if (file.open(QFile::WriteOnly | QFile::Append)) {
......@@ -358,11 +357,20 @@ void AdBlockCustomList::loadSubscription(const QStringList &disabledRules)
file.close();
AdBlockSubscription::loadSubscription(disabledRules);
#else
Q_UNUSED(disabledRules);
#endif
}
QByteArray AdBlockCustomList::readAllFileByteContents(const QString &filename)
{
QFile file(filename);
if (!filename.isEmpty() && file.open(QFile::ReadOnly)) {
const QByteArray a = file.readAll();
file.close();
return a;
}
return QByteArray();
}
void AdBlockCustomList::saveSubscription()
{
QFile file(filePath());
......
......@@ -145,6 +145,8 @@ public:
int addRule(AdBlockRule *rule) override;
bool removeRule(int offset) override;
const AdBlockRule *replaceRule(AdBlockRule *rule, int offset) override;
private:
QByteArray readAllFileByteContents(const QString &filename);
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment