| 1 | /* |
| 2 | localdomainurifilter.h |
| 3 | |
| 4 | This file is part of the KDE project |
| 5 | SPDX-FileCopyrightText: 2002 Lubos Lunak <llunak@suse.cz> |
| 6 | |
| 7 | SPDX-License-Identifier: GPL-2.0-or-later |
| 8 | */ |
| 9 | |
| 10 | #ifndef LOCALDOMAINURIFILTER_H |
| 11 | #define LOCALDOMAINURIFILTER_H |
| 12 | |
| 13 | #include "kurifilterplugin_p.h" |
| 14 | #include <QRegularExpression> |
| 15 | |
| 16 | /*! |
| 17 | This filter takes care of hostnames in the local search domain. |
| 18 | If you're in domain domain.org which has a host intranet.domain.org |
| 19 | and the typed URI is just intranet, check if there's a host |
| 20 | intranet.domain.org and if yes, it's a network URI. |
| 21 | */ |
| 22 | class LocalDomainUriFilter : public KUriFilterPlugin |
| 23 | { |
| 24 | Q_OBJECT |
| 25 | |
| 26 | public: |
| 27 | using KUriFilterPlugin::KUriFilterPlugin; |
| 28 | bool filterUri(KUriFilterData &data) const override; |
| 29 | |
| 30 | private: |
| 31 | bool exists(const QString &) const; |
| 32 | |
| 33 | const QRegularExpression m_hostPortPattern{ |
| 34 | QRegularExpression::anchoredPattern(expression: uR"--([a-zA-Z0-9][a-zA-Z0-9+-]*(?:\:[0-9]{1,5})?(?:/[\w:@&=+$,-.!~*'()]*)*)--" ), |
| 35 | }; |
| 36 | }; |
| 37 | |
| 38 | #endif |
| 39 | |