File indexing completed on 2024-05-19 04:58:32

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #ifndef ADBLOCKDIALOG_H
0019 #define ADBLOCKDIALOG_H
0020 
0021 #include <QDialog>
0022 
0023 #include "qzcommon.h"
0024 #include "ui_adblockdialog.h"
0025 
0026 class AdBlockSubscription;
0027 class AdBlockTreeWidget;
0028 class AdBlockManager;
0029 class AdBlockRule;
0030 
0031 class FALKON_EXPORT AdBlockDialog : public QDialog, public Ui_AdBlockDialog
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     explicit AdBlockDialog(QWidget* parent = nullptr);
0037 
0038     void showRule(const AdBlockRule* rule) const;
0039 
0040 private Q_SLOTS:
0041     void addRule();
0042     void removeRule();
0043 
0044     void addSubscription();
0045     void removeSubscription();
0046 
0047     void currentChanged(int index);
0048     void filterString(const QString &string);
0049     void enableAdBlock(bool state);
0050 
0051     void aboutToShowMenu();
0052     void learnAboutRules();
0053 
0054     void loadSubscriptions();
0055     void load();
0056 
0057 private:
0058     AdBlockManager* m_manager;
0059     AdBlockTreeWidget* m_currentTreeWidget;
0060     AdBlockSubscription* m_currentSubscription;
0061 
0062     QAction* m_actionAddRule;
0063     QAction* m_actionRemoveRule;
0064     QAction* m_actionAddSubscription;
0065     QAction* m_actionRemoveSubscription;
0066 
0067     bool m_loaded;
0068 };
0069 
0070 #endif // ADBLOCKDIALOG_H
0071