File indexing completed on 2024-11-17 04:55:36
0001 /* 0002 * SPDX-FileCopyrightText: 2013 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QVariantList> 0010 #include <resources/AbstractResourcesBackend.h> 0011 0012 class DummyReviewsBackend; 0013 class StandardBackendUpdater; 0014 class DummyResource; 0015 class DummyBackend : public AbstractResourcesBackend 0016 { 0017 Q_OBJECT 0018 Q_PROPERTY(int startElements MEMBER m_startElements) 0019 public: 0020 explicit DummyBackend(QObject *parent = nullptr); 0021 0022 int updatesCount() const override; 0023 AbstractBackendUpdater *backendUpdater() const override; 0024 AbstractReviewsBackend *reviewsBackend() const override; 0025 ResultsStream *search(const AbstractResourcesBackend::Filters &search) override; 0026 ResultsStream *findResourceByPackageName(const QUrl &search); 0027 QHash<QString, DummyResource *> resources() const 0028 { 0029 return m_resources; 0030 } 0031 bool isValid() const override 0032 { 0033 return true; 0034 } // No external file dependencies that could cause runtime errors 0035 0036 Transaction *installApplication(AbstractResource *app) override; 0037 Transaction *installApplication(AbstractResource *app, const AddonList &addons) override; 0038 Transaction *removeApplication(AbstractResource *app) override; 0039 bool isFetching() const override 0040 { 0041 return m_fetching; 0042 } 0043 void checkForUpdates() override; 0044 QString displayName() const override; 0045 bool hasApplications() const override; 0046 InlineMessage *explainDysfunction() const override; 0047 public Q_SLOTS: 0048 void toggleFetching(); 0049 0050 private: 0051 void populate(const QString &name); 0052 0053 QHash<QString, DummyResource *> m_resources; 0054 StandardBackendUpdater *m_updater; 0055 DummyReviewsBackend *m_reviews; 0056 bool m_fetching; 0057 int m_startElements; 0058 };