1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36: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("RU Adlist (Russian)", "https://ruadlist.googlecode.com/hg/advblock.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) {
ui->comboBox->addItem(subscription.title);
@ -67,18 +68,25 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index)
{
const Subscription subscription = m_knownSubscriptions.at(index);
int pos = subscription.title.indexOf(QLatin1Char('('));
QString title = subscription.title;
if (pos > 0) {
title = title.left(pos).trimmed();
// "Other..." entry
if (subscription.url.isEmpty()) {
ui->title->clear();
ui->url->clear();
}
else {
int pos = subscription.title.indexOf(QLatin1Char('('));
QString title = subscription.title;
ui->title->setText(title);
ui->title->setCursorPosition(0);
if (pos > 0) {
title = title.left(pos).trimmed();
}
ui->url->setText(subscription.url);
ui->url->setCursorPosition(0);
ui->title->setText(title);
ui->title->setCursorPosition(0);
ui->url->setText(subscription.url);
ui->url->setCursorPosition(0);
}
}
AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog()