1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

[AdBlock] Add "Other..." entry in AddSubscription dialog

To make it less confusing how to add a subscription that is not
listed in known subscriptions.
This commit is contained in:
David Rosca 2014-07-08 19:08:28 +02:00
parent 5b6db60605
commit c4e0646915

View File

@ -43,7 +43,8 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
<< Subscription("Antisocial (English)", "http://adversity.googlecode.com/hg/Antisocial.txt") << Subscription("Antisocial (English)", "http://adversity.googlecode.com/hg/Antisocial.txt")
<< Subscription("RU Adlist (Russian)", "https://ruadlist.googlecode.com/hg/advblock.txt") << Subscription("RU Adlist (Russian)", "https://ruadlist.googlecode.com/hg/advblock.txt")
<< Subscription("ABPindo (Indonesian)", "https://indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt") << Subscription("ABPindo (Indonesian)", "https://indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt")
<< Subscription("ChinaList (Chinese)", "http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt"); << Subscription("ChinaList (Chinese)", "http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt")
<< Subscription(tr("Other..."), QString());
foreach (const Subscription &subscription, m_knownSubscriptions) { foreach (const Subscription &subscription, m_knownSubscriptions) {
ui->comboBox->addItem(subscription.title); ui->comboBox->addItem(subscription.title);
@ -67,6 +68,12 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index)
{ {
const Subscription subscription = m_knownSubscriptions.at(index); const Subscription subscription = m_knownSubscriptions.at(index);
// "Other..." entry
if (subscription.url.isEmpty()) {
ui->title->clear();
ui->url->clear();
}
else {
int pos = subscription.title.indexOf(QLatin1Char('(')); int pos = subscription.title.indexOf(QLatin1Char('('));
QString title = subscription.title; QString title = subscription.title;
@ -79,6 +86,7 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index)
ui->url->setText(subscription.url); ui->url->setText(subscription.url);
ui->url->setCursorPosition(0); ui->url->setCursorPosition(0);
}
} }
AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog() AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog()