File indexing completed on 2025-02-16 04:34:39
0001 /* 0002 This file is part of Choqok, the KDE micro-blogging client 0003 0004 SPDX-FileCopyrightText: 2010-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0007 */ 0008 0009 #ifndef FILTER_H 0010 #define FILTER_H 0011 0012 #include <QObject> 0013 0014 class KConfigGroup; 0015 class Filter : public QObject 0016 { 0017 Q_OBJECT 0018 public: 0019 enum FilterType { Contain = 0, ExactMatch, RegExp, DoesNotContain }; 0020 enum FilterField { Content = 0, AuthorUsername, ReplyToUsername, Source }; 0021 enum FilterAction { None = 0, Remove, Highlight}; 0022 0023 /** 0024 Just use this constructor when filter is new 0025 */ 0026 explicit Filter(const QString &filterText, FilterField field = Content, 0027 FilterType type = Contain, FilterAction action = Remove, 0028 bool dontHide = false, QObject *parent = nullptr); 0029 explicit Filter(const KConfigGroup &config, QObject *parent = nullptr); 0030 virtual ~Filter(); 0031 0032 QString filterText() const; 0033 void setFilterText(const QString &text); 0034 0035 FilterField filterField() const; 0036 void setFilterField(FilterField field); 0037 0038 FilterType filterType() const; 0039 void setFilterType(FilterType type); 0040 0041 FilterAction filterAction() const; 0042 void setFilterAction(FilterAction action); 0043 0044 bool dontHideReplies() const; 0045 void setDontHideReplies(bool dontHide); 0046 0047 void writeConfig(); 0048 0049 private: 0050 class Private; 0051 Private *const d; 0052 }; 0053 0054 #endif // FILTER_H