1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[AdBlockDialog] Show error if subscription can't be loaded

This commit is contained in:
nowrep 2014-02-14 10:38:43 +01:00
parent 4aa4864c06
commit 363cd01016
5 changed files with 17 additions and 3 deletions

View File

@ -168,6 +168,9 @@ void AdBlockSubscription::subscriptionDownloaded()
loadSubscription(AdBlockManager::instance()->disabledRules()); loadSubscription(AdBlockManager::instance()->disabledRules());
emit subscriptionUpdated(); emit subscriptionUpdated();
} }
else {
emit subscriptionError(tr("Cannot load subscription!"));
}
m_reply->deleteLater(); m_reply->deleteLater();
m_reply = 0; m_reply = 0;

View File

@ -103,6 +103,7 @@ public slots:
signals: signals:
void subscriptionUpdated(); void subscriptionUpdated();
void subscriptionError(const QString &message);
protected slots: protected slots:
void subscriptionDownloaded(); void subscriptionDownloaded();

View File

@ -38,6 +38,7 @@ AdBlockTreeWidget::AdBlockTreeWidget(AdBlockSubscription* subscription, QWidget*
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint))); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*))); connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*)));
connect(m_subscription, SIGNAL(subscriptionUpdated()), this, SLOT(subscriptionUpdated())); connect(m_subscription, SIGNAL(subscriptionUpdated()), this, SLOT(subscriptionUpdated()));
connect(m_subscription, SIGNAL(subscriptionError(QString)), this, SLOT(subscriptionError(QString)));
} }
AdBlockSubscription* AdBlockTreeWidget::subscription() const AdBlockSubscription* AdBlockTreeWidget::subscription() const
@ -178,6 +179,15 @@ void AdBlockTreeWidget::subscriptionUpdated()
m_itemChangingBlock = false; m_itemChangingBlock = false;
} }
void AdBlockTreeWidget::subscriptionError(const QString &message)
{
refresh();
m_itemChangingBlock = true;
m_topItem->setText(0, tr("%1 (Error: %2)").arg(m_subscription->title(), message));
m_itemChangingBlock = false;
}
void AdBlockTreeWidget::adjustItemFeatures(QTreeWidgetItem* item, const AdBlockRule* rule) void AdBlockTreeWidget::adjustItemFeatures(QTreeWidgetItem* item, const AdBlockRule* rule)
{ {
if (!rule->isEnabled()) { if (!rule->isEnabled()) {

View File

@ -45,6 +45,7 @@ private slots:
void copyFilter(); void copyFilter();
void subscriptionUpdated(); void subscriptionUpdated();
void subscriptionError(const QString &message);
private: private:
void adjustItemFeatures(QTreeWidgetItem* item, const AdBlockRule* rule); void adjustItemFeatures(QTreeWidgetItem* item, const AdBlockRule* rule);

View File

@ -83,8 +83,8 @@ NetworkManager::NetworkManager(QObject* parent)
m_proxyFactory = new NetworkProxyFactory(); m_proxyFactory = new NetworkProxyFactory();
setProxyFactory(m_proxyFactory); setProxyFactory(m_proxyFactory);
loadSettings();
loadSettings();
} }
void NetworkManager::loadSettings() void NetworkManager::loadSettings()
@ -100,7 +100,7 @@ void NetworkManager::loadSettings()
// Force SSLv3 for servers that doesn't understand TLSv1 handshake // Force SSLv3 for servers that doesn't understand TLSv1 handshake
QStringList sslv3Sites; QStringList sslv3Sites;
sslv3Sites << QLatin1String("centrum.sk") << QLatin1String("centrum.cz") << QLatin1String("oneaccount.com") << QLatin1String("hdi.de") sslv3Sites << QLatin1String("centrum.sk") << QLatin1String("centrum.cz") << QLatin1String("oneaccount.com") << QLatin1String("hdi.de")
<< QLatin1String("live.com") << QLatin1String("i0.cz") << QLatin1String("sermepa.es"); << QLatin1String("live.com") << QLatin1String("i0.cz") << QLatin1String("sermepa.es") << QLatin1String("easylist-downloads.adblockplus.org");
settings.beginGroup("Web-Browser-Settings"); settings.beginGroup("Web-Browser-Settings");
m_doNotTrack = settings.value("DoNotTrack", false).toBool(); m_doNotTrack = settings.value("DoNotTrack", false).toBool();
@ -110,7 +110,6 @@ void NetworkManager::loadSettings()
m_acceptLanguage = AcceptLanguage::generateHeader(settings.value("Language/acceptLanguage", AcceptLanguage::defaultLanguage()).toStringList()); m_acceptLanguage = AcceptLanguage::generateHeader(settings.value("Language/acceptLanguage", AcceptLanguage::defaultLanguage()).toStringList());
#if defined(Q_OS_WIN) || defined(Q_OS_HAIKU) || defined(Q_OS_OS2) #if defined(Q_OS_WIN) || defined(Q_OS_HAIKU) || defined(Q_OS_OS2)
QString certDir = mApp->PROFILEDIR + "certificates"; QString certDir = mApp->PROFILEDIR + "certificates";
QString bundlePath = certDir + "/ca-bundle.crt"; QString bundlePath = certDir + "/ca-bundle.crt";