File indexing completed on 2024-04-21 05:10:36

0001 /*
0002     This file is part of Akregator.
0003 
0004     SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QUrl>
0012 
0013 #include "akregator_export.h"
0014 
0015 namespace Akregator
0016 {
0017 class AKREGATOR_EXPORT OpenUrlRequest
0018 {
0019 public:
0020     /**
0021      * Akregator-specific options specifying how a link should be handled.
0022      * TODO: check what can be done by overriding KURLArgs flags.
0023      */
0024     enum Options {
0025         None = 0, /**< no explicit options, use default */
0026         NewTab, /**< open in new tab */
0027         ExternalBrowser /**< open in external browser */
0028     };
0029 
0030     explicit OpenUrlRequest(const QUrl &url = QUrl());
0031 
0032     /**
0033      * the Id of the frame that sent the request */
0034     int frameId() const;
0035     void setFrameId(int frameId);
0036 
0037     [[nodiscard]] QUrl url() const;
0038     void setUrl(const QUrl &url);
0039 
0040     [[nodiscard]] Options options() const;
0041     void setOptions(Options options);
0042 
0043     [[nodiscard]] bool openInBackground() const;
0044     void setOpenInBackground(bool background);
0045 
0046     [[nodiscard]] QString debugInfo() const;
0047 
0048     [[nodiscard]] bool wasHandled() const;
0049     void setWasHandled(bool handled);
0050 
0051 private:
0052     int m_frameId = -1;
0053     QUrl m_url;
0054     Options m_options;
0055     bool m_inBackground = false;
0056     bool m_wasHandled = false;
0057 };
0058 } // namespace Akregator