2012-06-24 23:46:32 +02:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2013-02-07 11:12:54 +01:00
|
|
|
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
2012-06-24 23:46:32 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#include "adblockaddsubscriptiondialog.h"
|
|
|
|
#include "ui_adblockaddsubscriptiondialog.h"
|
|
|
|
|
|
|
|
AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
|
|
|
|
: QDialog(parent)
|
|
|
|
, ui(new Ui::AdBlockAddSubscriptionDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
m_knownSubscriptions << 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")
|
|
|
|
<< Subscription("dutchblock (Dutch)", "http://groenewoudt.net/dutchblock/list.txt")
|
|
|
|
<< Subscription("Filtros Nauscopicos (Spanish)", "http://abp.mozilla-hispano.org/nauscopio/filtros.txt")
|
|
|
|
<< Subscription("hufilter (Hungarian)", "http://www.hufilter.hu/hufilter.txt")
|
|
|
|
<< Subscription("IsraelList (Hebrew)", "http://secure.fanboy.co.nz/israelilist/IsraelList.txt")
|
|
|
|
<< Subscription("Lista Basa (Polish)", "http://plok.studentlive.pl/abp.txt")
|
|
|
|
<< Subscription("NLBlock (Dutch)", "http://www.verzijlbergh.com/adblock/nlblock.txt")
|
|
|
|
<< Subscription("Peter Lowe's list (English)", "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=adblockplus&mimetype=plaintext")
|
|
|
|
<< Subscription("PLgeneral (Polish)", "http://www.niecko.pl/adblock/adblock.txt")
|
|
|
|
<< Subscription("Schacks Adblock Plus liste (Danish)", "http://adblock.schack.dk/block.txt")
|
|
|
|
<< Subscription("Xfiles (Italian)", "http://mozilla.gfsolone.com/filtri.txt")
|
2012-07-01 20:38:37 +02:00
|
|
|
<< Subscription("EasyPrivacy (English)", "http://easylist-downloads.adblockplus.org/easyprivacy.txt")
|
2013-02-07 11:12:54 +01:00
|
|
|
<< Subscription("RU Adlist (Russian)", "https://ruadlist.googlecode.com/hg/advblock.txt")
|
2012-06-24 23:46:32 +02:00
|
|
|
<< Subscription("Antisocial (English)", "http://adversity.googlecode.com/hg/Antisocial.txt");
|
|
|
|
|
|
|
|
foreach(const Subscription & subscription, m_knownSubscriptions) {
|
|
|
|
ui->comboBox->addItem(subscription.title);
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int)));
|
|
|
|
indexChanged(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AdBlockAddSubscriptionDialog::title() const
|
|
|
|
{
|
|
|
|
return ui->title->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString AdBlockAddSubscriptionDialog::url() const
|
|
|
|
{
|
|
|
|
return ui->url->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AdBlockAddSubscriptionDialog::indexChanged(int index)
|
|
|
|
{
|
2013-02-08 12:10:12 +01:00
|
|
|
const Subscription subscription = m_knownSubscriptions.at(index);
|
2012-06-24 23:46:32 +02:00
|
|
|
|
2012-09-04 12:42:45 +02:00
|
|
|
int pos = subscription.title.indexOf(QLatin1Char('('));
|
2012-07-01 20:38:37 +02:00
|
|
|
QString title = subscription.title;
|
|
|
|
|
|
|
|
if (pos > 0) {
|
|
|
|
title = title.left(pos).trimmed();
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->title->setText(title);
|
2012-06-25 16:07:25 +02:00
|
|
|
ui->title->setCursorPosition(0);
|
|
|
|
|
2012-06-24 23:46:32 +02:00
|
|
|
ui->url->setText(subscription.url);
|
2012-06-25 16:07:25 +02:00
|
|
|
ui->url->setCursorPosition(0);
|
2012-06-24 23:46:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|