| 1 | // SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 | // SPDX-FileCopyrightText: 2009 Jeremy Whiting <jpwhiting@kde.org> |
| 3 | // SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org> |
| 4 | // SPDX-FileCopyrightText: 2021 Dan Leinir Turthra Jensen <admin@leinir.dk> |
| 5 | // SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org> |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #include <QObject> |
| 10 | |
| 11 | #include "knewstuffcore_export.h" |
| 12 | |
| 13 | class Engine; |
| 14 | |
| 15 | namespace KNSCore |
| 16 | { |
| 17 | |
| 18 | class ProviderBase; |
| 19 | |
| 20 | /** |
| 21 | * @short KNewStuff Base Provider class. |
| 22 | * |
| 23 | * This class provides accessors for the provider object. |
| 24 | * It should not be used directly by the application. |
| 25 | * This class is the base class and will be instantiated for |
| 26 | * static website providers. |
| 27 | * |
| 28 | * @author Jeremy Whiting <jpwhiting@kde.org> |
| 29 | * @since 6.9 |
| 30 | */ |
| 31 | class KNEWSTUFFCORE_EXPORT ProviderCore : public QObject |
| 32 | { |
| 33 | Q_OBJECT |
| 34 | Q_PROPERTY(QString version READ version NOTIFY basicsLoaded) |
| 35 | Q_PROPERTY(QUrl website READ website NOTIFY basicsLoaded) |
| 36 | Q_PROPERTY(QUrl host READ host NOTIFY basicsLoaded) |
| 37 | Q_PROPERTY(QString contactEmail READ contactEmail NOTIFY basicsLoaded) |
| 38 | Q_PROPERTY(bool supportsSsl READ supportsSsl NOTIFY basicsLoaded) |
| 39 | public: |
| 40 | ~ProviderCore() override; |
| 41 | Q_DISABLE_COPY_MOVE(ProviderCore) |
| 42 | |
| 43 | [[nodiscard]] QString version() const; |
| 44 | [[nodiscard]] QUrl website() const; |
| 45 | [[nodiscard]] QUrl host() const; |
| 46 | /** |
| 47 | * The general contact email for this provider |
| 48 | * @return The general contact email for this provider |
| 49 | */ |
| 50 | [[nodiscard]] QString contactEmail() const; |
| 51 | /** |
| 52 | * Whether or not the provider supports SSL connections |
| 53 | * @return True if the server supports SSL connections, false if not |
| 54 | */ |
| 55 | [[nodiscard]] bool supportsSsl() const; |
| 56 | |
| 57 | Q_SIGNALS: |
| 58 | void basicsLoaded(); |
| 59 | |
| 60 | private: |
| 61 | friend class EngineBase; |
| 62 | friend class EngineBasePrivate; |
| 63 | friend class ResultsStream; |
| 64 | friend class ProviderBubbleWrap; |
| 65 | friend class Transaction; |
| 66 | friend class TransactionPrivate; |
| 67 | friend class ::Engine; // quick engine |
| 68 | ProviderCore(ProviderBase *base, QObject *parent = nullptr); |
| 69 | const std::unique_ptr<class ProviderCorePrivate> d; |
| 70 | }; |
| 71 | |
| 72 | } // namespace KNSCore |
| 73 | |