1 /* ============================================================ 2 * Falkon - Qt web browser 3 * Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * ============================================================ */ 18 #ifndef ADBLOCKTREEWIDGET_H 19 #define ADBLOCKTREEWIDGET_H 20 21 #include "qzcommon.h" 22 #include "treewidget.h" 23 24 class AdBlockSubscription; 25 class AdBlockRule; 26 27 class FALKON_EXPORT AdBlockTreeWidget : public TreeWidget 28 { 29 Q_OBJECT 30 public: 31 explicit AdBlockTreeWidget(AdBlockSubscription* subscription, QWidget* parent = 0); 32 33 AdBlockSubscription* subscription() const; 34 35 void showRule(const AdBlockRule* rule); 36 void refresh(); 37 38 public Q_SLOTS: 39 void addRule(); 40 void removeRule(); 41 42 private Q_SLOTS: 43 void contextMenuRequested(const QPoint &pos); 44 void itemChanged(QTreeWidgetItem* item); 45 void copyFilter(); 46 47 void subscriptionUpdated(); 48 void subscriptionError(const QString &message); 49 50 private: 51 void adjustItemFeatures(QTreeWidgetItem* item, const AdBlockRule* rule); 52 void keyPressEvent(QKeyEvent* event) override; 53 54 AdBlockSubscription* m_subscription; 55 QTreeWidgetItem* m_topItem; 56 57 QString m_ruleToBeSelected; 58 bool m_itemChangingBlock; 59 }; 60 61 #endif // ADBLOCKTREEWIDGET_H 62