File indexing completed on 2025-01-19 04:47:00

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include "adblockplugin_private_export.h"
0009 
0010 #include <KConfigGroup>
0011 #include <QTreeView>
0012 
0013 class AdblockFilterListsModel;
0014 class QSortFilterProxyModel;
0015 
0016 class LIBADBLOCKPLUGIN_TESTS_EXPORT AdblockFilterTreeView : public QTreeView
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit AdblockFilterTreeView(QWidget *parent = nullptr);
0021     ~AdblockFilterTreeView() override;
0022 
0023     void setFilterString(const QString &str);
0024 
0025     void saveSettings();
0026     void loadSettings();
0027 
0028 Q_SIGNALS:
0029     void settingsChanged();
0030 
0031 protected:
0032     void contextMenuEvent(QContextMenuEvent *event) override;
0033 
0034 private:
0035     void slotAddAdblock();
0036     void slotModifyAdblock(const QModelIndex &index);
0037     void slotDeleteAdblock(const QModelIndex &index);
0038     bool mSettingsChanged = false;
0039     AdblockFilterListsModel *const mAdblockFilterListsModel;
0040     QSortFilterProxyModel *const mSortFilterProxyModel;
0041 };