File indexing completed on 2024-05-19 05:54:10

0001 /*
0002     SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com>
0003     SPDX-FileCopyrightText: 2020 Tomaz Canabrava <tcanabrava@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef URL_FILTER_HOTSPOT
0009 #define URL_FILTER_HOTSPOT
0010 
0011 #include "RegExpFilterHotspot.h"
0012 
0013 #include <QList>
0014 class QAction;
0015 
0016 namespace Konsole
0017 {
0018 /**
0019  * Hotspot type created by UrlFilter instances.  The activate() method opens a web browser
0020  * at the given URL when called.
0021  */
0022 class KONSOLEPRIVATE_EXPORT UrlFilterHotSpot : public RegExpFilterHotSpot
0023 {
0024 public:
0025     UrlFilterHotSpot(int startLine, int startColumn, int endLine, int endColumn, const QStringList &capturedTexts);
0026     ~UrlFilterHotSpot() override;
0027 
0028     QList<QAction *> actions() override;
0029 
0030     /**
0031      * Open a web browser at the current URL.  The url itself can be determined using
0032      * the capturedTexts() method.
0033      */
0034     void activate(QObject *object = nullptr) override;
0035 
0036 private:
0037     enum UrlType {
0038         StandardUrl,
0039         Email,
0040         Unknown,
0041     };
0042     UrlType urlType() const;
0043 };
0044 
0045 }
0046 #endif