diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -27,7 +27,5 @@ add_subdirectory( searchbar ) add_subdirectory( rellinks ) -# TODO add_subdirectory( adblock ) - add_subdirectory( akregator ) diff --git a/plugins/adblock/CMakeLists.txt b/plugins/adblock/CMakeLists.txt deleted file mode 100644 --- a/plugins/adblock/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ - - -########### next target ############### -add_definitions(-DTRANSLATION_DOMAIN=\"adblock\") -set(adblock_PART_SRCS adblock.cpp adblockdialog.cpp ) - -add_library(adblock MODULE ${adblock_PART_SRCS}) - - - -target_link_libraries(adblock KF5::Parts KF5::KHtml KF5::KCMUtils KF5::KDELibs4Support) - -install(TARGETS adblock DESTINATION ${KDE_INSTALL_PLUGINDIR} ) - - -########### install files ############### - -install( FILES plugin_adblock.desktop plugin_adblock.rc DESTINATION ${KDE_INSTALL_DATADIR}/khtml/kpartplugins ) diff --git a/plugins/adblock/Messages.sh b/plugins/adblock/Messages.sh deleted file mode 100644 --- a/plugins/adblock/Messages.sh +++ /dev/null @@ -1,3 +0,0 @@ -$EXTRACTRC *.rc >> rc.cpp -$XGETTEXT *.cpp -o $podir/adblock.pot - diff --git a/plugins/adblock/adblock.h b/plugins/adblock/adblock.h deleted file mode 100644 --- a/plugins/adblock/adblock.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (c) 2008 Laurent Montel - Copyright (C) 2006 Daniele Galdi - - 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 2 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -#ifndef KONQ_ADBLOCK_H -#define KONQ_ADBLOCK_H - -#include -#include -#include -#include -#include -#include - -class KHTMLPart; -class KUrlLabel; -class AdElement; -class KActionMenu; -namespace KParts -{ -} - -namespace DOM -{ -class DOMString; -} - -typedef QList AdElementList; - -class AdBlock : public KParts::Plugin -{ - Q_OBJECT - -public: - AdBlock(QObject *parent = nullptr, const QVariantList &args = QVariantList()); - ~AdBlock(); - -private: - QPointer m_part; - QWeakPointer m_label; - KActionMenu *m_menu; - - void fillBlockableElements(); - void fillWithImages(); - void fillWithHtmlTag(const DOM::DOMString &tagName, - const DOM::DOMString &attrName, - const QString &category); - -private slots: - void initLabel(); - void slotConfigure(); - void addAdFilter(const QString &url); - void contextMenu(); - void showKCModule(); - void slotDisableForThisPage(); - void slotDisableForThisSite(); - -private: - void disableForUrl(KUrl url); - void updateFilters(); - - AdElementList *m_elements; -}; - -// ---------------------------------------------------------------------------- - -class AdElement -{ -public: - AdElement(); - AdElement(const QString &url, const QString &category, - const QString &type, bool blocked, const DOM::Node &node); - - AdElement &operator=(const AdElement &); - bool operator==(const AdElement &e1); - - bool isBlocked() const; - QString blockedBy() const; - void setBlocked(bool blocked); - void setBlockedBy(const QString &by); - QString url() const; - QString category() const; - QString type() const; - DOM::Node node() const; -private: - QString m_url; - QString m_category; - QString m_type; - bool m_blocked; - QString m_blockedBy; - DOM::Node m_node; -}; - -#endif diff --git a/plugins/adblock/adblock.cpp b/plugins/adblock/adblock.cpp deleted file mode 100644 --- a/plugins/adblock/adblock.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* - Copyright (c) 2008 Laurent Montel - Copyright (C) 2006 Daniele Galdi - - 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 2 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -/* Project related */ -#include "adblock.h" -#include "adblockdialog.h" - -/* Kde related */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace DOM; - -#include -#include -#include - -K_PLUGIN_FACTORY(AdBlockFactory, registerPlugin< AdBlock >();) -K_EXPORT_PLUGIN(AdBlockFactory("adblock")) - -AdBlock::AdBlock(QObject *parent, const QVariantList & /*args*/) : - Plugin(parent), - m_menu(0), m_elements(0) -{ - m_part = dynamic_cast(parent); - if (!m_part) { - kDebug() << "couldn't get KHTMLPart"; - return; - } - m_menu = new KActionMenu(KIcon("preferences-web-browser-adblock"), i18n("Adblock"), - actionCollection()); - actionCollection()->addAction("action adblock", m_menu); - m_menu->setDelayed(false); - - QAction *a = actionCollection()->addAction("show_elements"); - a->setText(i18n("Show Blockable Elements...")); - connect(a, SIGNAL(triggered()), this, SLOT(slotConfigure())); - m_menu->addAction(a); - - a = actionCollection()->addAction("configure"); - a->setText(i18n("Configure Filters...")); - connect(a, SIGNAL(triggered()), this, SLOT(showKCModule())); - m_menu->addAction(a); - - a = actionCollection()->addAction("separator"); - a->setSeparator(true); - m_menu->addAction(a); - - a = actionCollection()->addAction("disable_for_this_page"); - a->setText(i18n("No blocking for this page")); - connect(a, SIGNAL(triggered()), this, SLOT(slotDisableForThisPage())); - m_menu->addAction(a); - - a = actionCollection()->addAction("disable_for_this_site"); - a->setText(i18n("No blocking for this site")); - connect(a, SIGNAL(triggered()), this, SLOT(slotDisableForThisSite())); - m_menu->addAction(a); - - connect(m_part, SIGNAL(completed()), this, SLOT(initLabel())); -} - -AdBlock::~AdBlock() -{ - KParts::StatusBarExtension *statusBarEx = KParts::StatusBarExtension::childObject(m_part); - - if (statusBarEx && m_label) { - statusBarEx->removeStatusBarItem(m_label.data()); - } - delete m_label.data(); - m_label.clear(); - delete m_menu; - m_menu = 0; - delete m_elements; - m_elements = 0; -} - -void AdBlock::initLabel() -{ - if (m_label) { - return; - } - - KParts::StatusBarExtension *statusBarEx = KParts::StatusBarExtension::childObject(m_part); - - if (!statusBarEx) { - kDebug() << "couldn't get KParts::StatusBarExtension"; - return; - } - - KUrlLabel *label = new KUrlLabel(statusBarEx->statusBar()); - - KIconLoader *loader = KIconLoader::global(); - - label->setFixedHeight(loader->currentSize(KIconLoader::Small)); - label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - label->setUseCursor(false); - label->setPixmap(loader->loadIcon("preferences-web-browser-adblock", KIconLoader::Small)); - - statusBarEx->addStatusBarItem(label, 0, false); - connect(label, SIGNAL(leftClickedUrl()), this, SLOT(slotConfigure())); - connect(label, SIGNAL(rightClickedUrl()), this, SLOT(contextMenu())); - - m_label = label; -} - -void AdBlock::disableForUrl(KUrl url) -{ - url.setQuery(QString()); - url.setRef(QString()); - - KHTMLSettings *settings = const_cast(m_part->settings()); - settings->addAdFilter("@@" + url.url()); -} - -void AdBlock::slotDisableForThisPage() -{ - disableForUrl(m_part->toplevelURL().url()); -} - -void AdBlock::slotDisableForThisSite() -{ - KUrl u(m_part->toplevelURL().url()); - u.setPath("/*"); - disableForUrl(u); -} - -void AdBlock::slotConfigure() -{ - if (!m_part->settings()->isAdFilterEnabled()) { - KMessageBox::error(0, - i18n("Please enable Konqueror's Adblock"), - i18nc("@title:window", "Adblock disabled")); - - return; - } - - m_elements = new AdElementList; - fillBlockableElements(); - - AdBlockDlg *dlg = new AdBlockDlg(m_part->widget(), m_elements, m_part); - connect(dlg, SIGNAL(notEmptyFilter(QString)), this, SLOT(addAdFilter(QString))); - connect(dlg, SIGNAL(configureFilters()), this, SLOT(showKCModule())); - dlg->exec(); - delete dlg; -} - -void AdBlock::showKCModule() -{ - KCMultiDialog *dialogue = new KCMultiDialog(m_part->widget()); - dialogue->addModule("khtml_filter"); - connect(dialogue, SIGNAL(cancelClicked()), dialogue, SLOT(delayedDestruct())); - connect(dialogue, SIGNAL(closeClicked()), dialogue, SLOT(delayedDestruct())); - dialogue->show(); -} - -void AdBlock::contextMenu() -{ - m_menu->menu()->exec(QCursor::pos()); -} - -void AdBlock::fillBlockableElements() -{ - fillWithHtmlTag("script", "src", i18n("script")); - fillWithHtmlTag("embed", "src", i18n("object")); - fillWithHtmlTag("object", "src", i18n("object")); - // TODO: iframe's are not blocked by KHTML yet - fillWithHtmlTag("iframe", "src", i18n("frame")); - fillWithImages(); - - updateFilters(); -} - -void AdBlock::fillWithImages() -{ - HTMLDocument htmlDoc = m_part->htmlDocument(); - - HTMLCollection images = htmlDoc.images(); - - for (unsigned int i = 0; i < images.length(); i++) { - HTMLImageElement image = static_cast(images.item(i)); - - DOMString src = image.src(); - - QString url = htmlDoc.completeURL(src).string(); - if (!url.isEmpty() && url != m_part->baseURL().url()) { - AdElement element(url, i18n("image"), "IMG", false, image); - if (!m_elements->contains(element)) { - m_elements->append(element); - } - } - } -} - -void AdBlock::fillWithHtmlTag(const DOMString &tagName, - const DOMString &attrName, - const QString &category) -{ - Document doc = m_part->document(); - - NodeList nodes = doc.getElementsByTagName(tagName); - - for (unsigned int i = 0; i < nodes.length(); i++) { - Node node = nodes.item(i); - Node attr = node.attributes().getNamedItem(attrName); - - DOMString src = attr.nodeValue(); - if (src.isNull()) { - continue; - } - - QString url = doc.completeURL(src).string(); - if (!url.isEmpty() && url != m_part->baseURL().url()) { - AdElement element(url, category, tagName.string().toUpper(), false, attr); - if (!m_elements->contains(element)) { - m_elements->append(element); - } - } - } -} - -void AdBlock::addAdFilter(const QString &url) -{ - //FIXME hackish - KHTMLSettings *settings = const_cast(m_part->settings()); - settings->addAdFilter(url); - updateFilters(); -} - -void AdBlock::updateFilters() -{ - const KHTMLSettings *settings = m_part->settings(); - - AdElementList::iterator it; - for (it = m_elements->begin(); it != m_elements->end(); ++it) { - AdElement &element = (*it); - - bool isWhitelist; - QString filter = settings->adFilteredBy(element.url(), &isWhitelist); - if (!filter.isEmpty()) { - if (!isWhitelist) { - element.setBlocked(true); - element.setBlockedBy(i18n("Blocked by %1", filter)); - } else { - element.setBlockedBy(i18n("Allowed by %1", filter)); - } - } - } -} - -// ---------------------------------------------------------------------------- - -AdElement::AdElement() : - m_blocked(false) {} - -AdElement::AdElement(const QString &url, const QString &category, - const QString &type, bool blocked, const DOM::Node &node) : - m_url(url), m_category(category), m_type(type), m_blocked(blocked), m_node(node) {} - -AdElement &AdElement::operator=(const AdElement &obj) -{ - m_blocked = obj.m_blocked; - m_blockedBy = obj.m_blockedBy; - m_url = obj.m_url; - m_category = obj.m_category; - m_type = obj.m_type; - m_node = obj.m_node; - - return *this; -} - -bool AdElement::operator==(const AdElement &obj) -{ - return m_url == obj.m_url; -} - -bool AdElement::isBlocked() const -{ - return m_blocked; -} - -QString AdElement::blockedBy() const -{ - return m_blockedBy; -} - -void AdElement::setBlockedBy(const QString &by) -{ - m_blockedBy = by; -} - -void AdElement::setBlocked(bool blocked) -{ - m_blocked = blocked; -} - -QString AdElement::url() const -{ - return m_url; -} - -QString AdElement::category() const -{ - return m_category; -} - -QString AdElement::type() const -{ - return m_type; -} - -DOM::Node AdElement::node() const -{ - return m_node; -} - -#include "adblock.moc" diff --git a/plugins/adblock/adblockdialog.h b/plugins/adblock/adblockdialog.h deleted file mode 100644 --- a/plugins/adblock/adblockdialog.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (c) 2008 Laurent Montel - Copyright (C) 2006 Daniele Galdi - - 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 2 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef KONQ_ADBLOCKDIALOG_H -#define KONQ_ADBLOCKDIALOG_H - -#include "adblock.h" -#include -#include -#include -class QLineEdit; -class KMenu; -class QTreeWidget; - -class AdBlockDlg : public KDialog -{ - Q_OBJECT -public: - AdBlockDlg(QWidget *parent, const AdElementList *elements, KHTMLPart *part); - ~AdBlockDlg(); - -private slots: - void slotAddFilter(); - void slotConfigureFilters(); - - void updateFilter(QTreeWidgetItem *item); - void showContextMenu(const QPoint &); - void filterItem(); - void filterPath(); - void filterHost(); - void filterDomain(); - void addWhiteList(); - void copyLinkAddress(); - void highLightElement(); - void showElement(); - void filterTextChanged(const QString &text); - -signals: - void notEmptyFilter(const QString &url); - void configureFilters(); - -private: - KUrl getItem(); - void setFilterText(const QString &text); - - QLineEdit *m_filter; - QTreeWidget *m_list; - KMenu *m_menu; - KHTMLPart *m_part; -}; - -#endif diff --git a/plugins/adblock/adblockdialog.cpp b/plugins/adblock/adblockdialog.cpp deleted file mode 100644 --- a/plugins/adblock/adblockdialog.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* - Copyright (c) 2008 Laurent Montel - Copyright (C) 2006 Daniele Galdi - - 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 2 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, write to the Free Software Foundation, Inc., 51 - Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "adblockdialog.h" -#include "adblock.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ---------------------------------------------------------------------------- - -class ListViewItem : public QTreeWidgetItem -{ -public: - ListViewItem(QTreeWidget *listView, const QStringList &lst, const AdElement *element) - : QTreeWidgetItem(listView, lst), - m_element(element), - m_blocked(false) {}; - - bool isBlocked() const - { - return (m_blocked); - }; - void setBlocked(bool blocked); - void setBlockedBy(const QString &reason); - void setNode(const DOM::Node &node); - DOM::Node node()const - { - return (m_node); - } - const AdElement *element() const - { - return (m_element); - } - -private: - const AdElement *m_element; - bool m_blocked; - DOM::Node m_node; -}; - -void ListViewItem::setBlocked(bool blocked) -{ - m_blocked = blocked; - setData(0, Qt::ForegroundRole, (blocked ? Qt::red : Qt::black)); - QFont itemFont = font(0); - itemFont.setItalic(blocked); - itemFont.setBold(blocked); - setData(0, Qt::FontRole, itemFont); -} - -void ListViewItem::setBlockedBy(const QString &reason) -{ - setToolTip(0, reason); -} - -void ListViewItem::setNode(const DOM::Node &node) -{ - m_node = node; -} - -// ---------------------------------------------------------------------------- - -AdBlockDlg::AdBlockDlg(QWidget *parent, const AdElementList *elements, KHTMLPart *part) : - KDialog(parent), m_part(part) -{ - setModal(true); - setCaption(i18nc("@title:window", "Blockable items on this page")); - setButtons(KDialog::User1 | KDialog::User2 | KDialog::Close); - setDefaultButton(KDialog::User2); - setButtonText(KDialog::User1, i18n("Configure Filters...")); - setButtonIcon(KDialog::User1, KIcon("preferences-web-browser-adblock")); - setButtonText(KDialog::User2, i18n("Add filter")); - setButtonIcon(KDialog::User2, KStandardGuiItem::add().icon()); - - QWidget *page = new QWidget(this); - setMainWidget(page); - - QVBoxLayout *layout = new QVBoxLayout(page); - layout->setContentsMargins(0, 0, 0, 0); - - QLabel *l = new QLabel(i18n("Search:"), page); - layout->addWidget(l); - - KTreeWidgetSearchLine *searchLine = new KTreeWidgetSearchLine(page); - layout->addWidget(searchLine); - l->setBuddy(searchLine); - - l = new QLabel(i18n("Blockable items:"), page); - layout->addWidget(l); - - m_list = new QTreeWidget(page); - m_list->setAllColumnsShowFocus(true); - layout->addWidget(m_list); - l->setBuddy(m_list); - - QStringList lstHeader; - lstHeader << i18n("Source") << i18n("Category") << i18n("Tag"); - m_list->setHeaderLabels(lstHeader); - - m_list->setColumnWidth(0, 600); - m_list->setColumnWidth(1, 90); - m_list->setColumnWidth(2, 65); - - m_list->setRootIsDecorated(false); - - AdElementList::const_iterator it; - for (it = elements->constBegin(); it != elements->constEnd(); ++it) { - const AdElement &element = (*it); - - QStringList lst; - lst << element.url() << element.category() << element.type(); - - ListViewItem *item = new ListViewItem(m_list, lst, &element); - item->setBlocked(element.isBlocked()); - item->setBlockedBy(element.blockedBy()); - item->setNode(element.node()); - } - - searchLine->setTreeWidget(m_list); - - layout->addSpacing(KDialog::spacingHint()); - - l = new QLabel(i18n("New filter (can use *?[] wildcards, /RE/ for regular expression, prefix with @@ for white list):"), page); - layout->addWidget(l); - - m_filter = new QLineEdit(page); - layout->addWidget(m_filter); - connect(m_filter, SIGNAL(textChanged(QString)), SLOT(filterTextChanged(QString))); - l->setBuddy(m_filter); - filterTextChanged(QString::null); - - connect(this, SIGNAL(user1Clicked()), this, SLOT(slotConfigureFilters())); - connect(this, SIGNAL(user2Clicked()), this, SLOT(slotAddFilter())); - - // Use itemActivated() signal instead of itemDoubleClicked() to honour - // the KDE single/double click setting, and allow keyboard navigation. - // Activating a item just copies its URL to the "new filter" box and - // sets focus to there, it doesn't add the filter immediately. - //connect(m_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(updateFilter(QTreeWidgetItem*)) ); - connect(m_list, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(updateFilter(QTreeWidgetItem*))); - - m_menu = new KMenu(this); - m_menu->addAction(i18n("Filter this item"), this, SLOT(filterItem())); - m_menu->addAction(i18n("Filter all items at same path"), this, SLOT(filterPath())); - m_menu->addAction(i18n("Filter all items from same host"), this, SLOT(filterHost())); - m_menu->addAction(i18n("Filter all items from same domain"), this, SLOT(filterDomain())); - m_menu->addSeparator(); - m_menu->addAction(i18n("Add this item to white list"), this, SLOT(addWhiteList())); - m_menu->addSeparator(); - m_menu->addAction(i18n("Copy Link Address"), this, SLOT(copyLinkAddress())); - //comment for the moment - //m_menu->addAction( i18n( "Highlight Element" ), this, SLOT(highLightElement()) ); - m_menu->addAction(i18n("View item"), this, SLOT(showElement())); - m_list->setContextMenuPolicy(Qt::CustomContextMenu); - connect(m_list, SIGNAL(customContextMenuRequested(QPoint)), - this, SLOT(showContextMenu(QPoint))); - - resize(800, 400); -} - -AdBlockDlg::~AdBlockDlg() -{ -} - -void AdBlockDlg::filterTextChanged(const QString &text) -{ - enableButton(KDialog::User2, !text.isEmpty()); -} - -void AdBlockDlg::setFilterText(const QString &text) -{ - m_filter->setText(text); - m_filter->setFocus(Qt::OtherFocusReason); -} - -void AdBlockDlg::updateFilter(QTreeWidgetItem *selected) -{ - ListViewItem *item = static_cast(selected); - - if (item->isBlocked()) { - m_filter->clear(); - return; - } - - setFilterText(item->text(0)); -} - -void AdBlockDlg::slotAddFilter() -{ - const QString text = m_filter->text().trimmed(); - if (text.isEmpty()) { - return; - } - - kDebug() << "adding filter" << text; - emit notEmptyFilter(text); - - for (QTreeWidgetItemIterator it(m_list); (*it) != 0; ++it) { - ListViewItem *item = static_cast(*it); - item->setBlocked(item->element()->isBlocked()); - item->setBlockedBy(item->element()->blockedBy()); - } - - enableButton(KDialog::User2, false); // now that filter has been added -} // until it is changed again - -void AdBlockDlg::slotConfigureFilters() -{ - emit configureFilters(); - delayedDestruct(); -} - -void AdBlockDlg::showContextMenu(const QPoint &pos) -{ - QPoint newPos = m_list->viewport()->mapToGlobal(pos); - int column = m_list->columnAt(pos.x()); - if (column == -1) { - return; - } - m_menu->popup(newPos); -} - -void AdBlockDlg::filterItem() -{ - QTreeWidgetItem *item = m_list->currentItem(); - setFilterText(item->text(0)); -} - -KUrl AdBlockDlg::getItem() -{ - QTreeWidgetItem *item = m_list->currentItem(); - KUrl u(item->text(0)); - u.setQuery(QString()); - u.setRef(QString()); - return (u); -} - -void AdBlockDlg::filterPath() -{ - KUrl u(getItem()); - u.setFileName("*"); - setFilterText(u.url()); -} - -void AdBlockDlg::filterHost() -{ - KUrl u(getItem()); - u.setPath("/*"); - setFilterText(u.url()); -} - -void AdBlockDlg::filterDomain() -{ - KUrl u(getItem()); - - QString host = u.host(); - if (host.isEmpty()) { - return; - } - int idx = host.indexOf('.'); - if (idx < 0) { - return; - } - - QString t = u.protocol() + "://*" + host.mid(idx) + "/*"; - setFilterText(t); -} - -void AdBlockDlg::addWhiteList() -{ - QTreeWidgetItem *item = m_list->currentItem(); - setFilterText("@@" + item->text(0)); -} - -void AdBlockDlg::copyLinkAddress() -{ - QApplication::clipboard()->setText(m_list->currentItem()->text(0)); -} - -void AdBlockDlg::highLightElement() -{ - ListViewItem *item = static_cast(m_list->currentItem()); - if (item) { - DOM::Node handle = item->node(); - kDebug() << " m_part :" << m_part; - if (!handle.isNull()) { - m_part->setActiveNode(handle); - } - } -} - -void AdBlockDlg::showElement() -{ - new KRun(m_list->currentItem()->text(0), 0); -} - diff --git a/plugins/adblock/plugin_adblock.desktop b/plugins/adblock/plugin_adblock.desktop deleted file mode 100644 --- a/plugins/adblock/plugin_adblock.desktop +++ /dev/null @@ -1,134 +0,0 @@ -[Desktop Entry] -Name=Adblock -Name[ar]=مانع الإعلانات -Name[ast]=Bloquéu d'anuncios -Name[bg]=Блокиране на реклами -Name[bs]=Adblok -Name[ca]=Adblock -Name[ca@valencia]=Adblock -Name[cs]=Adblock -Name[da]=Adblock -Name[de]=Werbeblocker -Name[el]=Adblock -Name[en_GB]=Adblock -Name[eo]=Reklambloko -Name[es]=Adblock -Name[et]=Adblock -Name[eu]=Adblock -Name[fi]=Mainossuodatin -Name[fr]=Adblock -Name[ga]=Adblock -Name[gl]=Adblock -Name[he]=Adblock -Name[hr]=Adblock -Name[hu]=Adblock -Name[ia]=Adblock (bloco de reclamos) -Name[id]=Adblock -Name[is]=Adblock -Name[it]=Adblock -Name[ja]=Adblock -Name[kk]=Жарнаманы бұғаттау -Name[km]=Adblock -Name[ko]=Adblock -Name[lt]=Adblock -Name[lv]=Adblock -Name[mai]=Adblock -Name[mr]=जाहिरात प्रतिबंध -Name[nb]=Adblock -Name[nds]=Warvenblockeren -Name[nl]=Adblock -Name[nn]=Reklamestopp -Name[pa]=ਐਡਬਲਾਕ -Name[pl]=Adblock -Name[pt]=AdBlock -Name[pt_BR]=Adblock -Name[ro]=Adblock -Name[ru]=Adblock -Name[sk]=Adblock -Name[sl]=Adblock -Name[sr]=Адблок -Name[sr@ijekavian]=Адблок -Name[sr@ijekavianlatin]=AdBlock -Name[sr@latin]=AdBlock -Name[sv]=Reklamblockering -Name[tg]=Эълонҳои Adblock -Name[th]=บล็อคโฆษณา -Name[tr]=Adblock -Name[ug]=ئېلان سۈزگۈچ -Name[uk]=Блокування реклами -Name[wa]=Adblock -Name[x-test]=xxAdblockxx -Name[zh_CN]=广告屏蔽 -Name[zh_TW]=Adblock -Icon=preferences-web-browser-adblock -Comment=Show all blockable html elements -Comment[ar]=تظهر جميع عناصر html القابلة للمنع -Comment[ast]=Amuesa tolos elementos HTML bloquiables -Comment[bg]=Показване на всички блокируеми елементи на html -Comment[bs]=Prikaz svih HTML elemenata koji se mogu blokirati -Comment[ca]=Mostra tots els elements HTML bloquejables -Comment[ca@valencia]=Mostra tots els elements HTML bloquejables -Comment[cs]=Zobrazit všechny blokovatelné HTML prvky -Comment[da]=Vis alle html-elementer der kan blokeres -Comment[de]=Alle blockierbaren HTML-Elemente anzeigen -Comment[el]=Εμφάνιση όλων των στοιχείων html προς φραγή -Comment[en_GB]=Show all blockable html elements -Comment[es]=Muestra todos los elementos html bloqueables -Comment[et]=Kõigi blokeeritavate HTML-elementide näitamine -Comment[eu]=Erakutsi blokeatu daitezkeen html elementu guztiak -Comment[fi]=Näytä kaikki estettävissä olevat HTML-elementit -Comment[fr]=Afficher tous les éléments HTML pouvant être bloqués -Comment[ga]=Taispeáin na heilimintí HTML ar féidir cosc a chur orthu -Comment[gl]=Mostra todos os elementos html bloqueábeis -Comment[he]=הצג את כל אלמנטי ה־html הניתנים לחסימה -Comment[hne]=सब्बो ब्लाक करे जा सके एचटीएमएल अवयव मन ल देखाव -Comment[hr]=Prikaži sve html elemente koje je moguće blokirati -Comment[hu]=Az összes blokkolható HTML-elem megjelenítése -Comment[ia]=Monstra omne elementos blocabile html -Comment[id]=Tampilkan semua elemn html dapat diblok -Comment[is]=Sýna alla útilokanlega HTML-hluti -Comment[it]=Mostra tutti gli elementi HTML bloccabili -Comment[ja]=ブロック可能なすべての HTML 要素を表示します -Comment[kk]=Бұғатталмақ html элементерін көрсету -Comment[km]=បង្ហាញ​ធាតុ html ដែល​អាចទប់ស្កាត់​​បាន​ទាំងអស់ -Comment[ko]=차단 가능한 모든 HTML 구성 요소 보이기 -Comment[ku]=Hemû hêmanên html yên tên asteng kirin nîşan bide -Comment[lt]=Rodyti visus blokuotinus html elementus -Comment[lv]=Rāda visus bloķējamos html elementus -Comment[mr]=सर्व प्रतिबंध करण्याजोगे html तत्व दर्शवा -Comment[nb]=Vis alle html-elementer som kan blokkeres -Comment[nds]=All HTML-Elementen wiesen, de sik blockeren laat -Comment[nl]=Alle blokkeerbare HTML-elementen -Comment[nn]=Vis alle blokkerbare HTML-element -Comment[pa]=ਸਭ ਬਲਾਕ ਕਰਨ ਯੋਗ html ਐਲੀਮੈਂਟ ਵੇਖੋ -Comment[pl]=Pokaż wszystkie blokowane elementy html -Comment[pt]=Mostrar todos os elementos de HTML possíveis de bloquear -Comment[pt_BR]=Exibir todos os elementos HTML bloqueáveis -Comment[ro]=Afișează toate elementele html blocabile -Comment[ru]=Показать все блокируемые элементы html -Comment[sk]=Zobraziť všetky blokovatelné HTML prvky -Comment[sl]=Pokaže vse predmete HTML, ki jih je mogoče onemogočiti -Comment[sr]=Приказ свих ХТМЛ елемената који се могу блокирати -Comment[sr@ijekavian]=Приказ свих ХТМЛ елемената који се могу блокирати -Comment[sr@ijekavianlatin]=Prikaz svih HTML elemenata koji se mogu blokirati -Comment[sr@latin]=Prikaz svih HTML elemenata koji se mogu blokirati -Comment[sv]=Visa alla blockeringsbara HTML-element -Comment[tg]=Намоиши ҳамаи қисмҳои басташавандаи html -Comment[th]=แสดงส่วนต่าง ๆ ของ html ที่สามารถบล็อคได้ -Comment[tr]=Engellenebilir olan tüm html ögelerini göster -Comment[ug]=توسالايدىغان ھەممە ئېلېمېنتلارنى كۆرسەت -Comment[uk]=Показує всі придатні для блокування елементи html -Comment[wa]=Mostrer tos les elemints html blocåves -Comment[x-test]=xxShow all blockable html elementsxx -Comment[zh_CN]=显示所有可屏蔽的 html 元素 -Comment[zh_TW]=顯示所有可阻擋的 html 元素 -X-KDE-Library=adblock -X-KDE-PluginInfo-Author=Daniele Galdi -X-KDE-PluginInfo-Email=daniele.galdi@gmail.com -X-KDE-PluginInfo-Name=adblock -X-KDE-PluginInfo-Version=0.0.5 -X-KDE-PluginInfo-Website=http://www.pigamo.com -X-KDE-PluginInfo-Category=Statusbar -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-ParentApp=konqueror diff --git a/plugins/adblock/plugin_adblock.rc b/plugins/adblock/plugin_adblock.rc deleted file mode 100644 --- a/plugins/adblock/plugin_adblock.rc +++ /dev/null @@ -1,11 +0,0 @@ - - - - &Tools - - - -Extra Toolbar - - -