blob: 2173bfc1c62f3dbe9e9bc7d598e6da97e7957d4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#ifndef FILTERDOMAIN_H
#define FILTERDOMAIN_H
#include <QObject>
#include <QVector>
class FilterDomain : public QObject
{
Q_OBJECT
public:
enum MatchType {
Whitelist, // only match added domains
Blacklist, // only match domains not added
WhitelistAll, // match all domains
BlacklistAll // match no domains
};
explicit FilterDomain(MatchType type = Whitelist, QObject *parent = nullptr);
void setType(MatchType type);
void addDomain(const QString &domain);
bool hasMatch(const QString &host) const;
private:
MatchType m_type;
QVector<QString> m_domains;
};
// function taken from KDE/Falkon
bool isMatchingDomain(const QString &domain, const QString &filter);
#endif // FILTERDOMAIN_H
|