File indexing completed on 2024-11-24 04:54:53

0001 /*
0002  *   SPDX-FileCopyrightText: 2014 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 <QStandardItemModel>
0010 #include <resources/AbstractSourcesBackend.h>
0011 
0012 class DiscoverAction;
0013 
0014 class DummySourcesBackend : public AbstractSourcesBackend
0015 {
0016 public:
0017     explicit DummySourcesBackend(AbstractResourcesBackend *parent);
0018 
0019     QAbstractItemModel *sources() override;
0020     bool addSource(const QString &id) override;
0021     bool removeSource(const QString &id) override;
0022     QString idDescription() override
0023     {
0024         return QStringLiteral("Random weird text");
0025     }
0026     QVariantList actions() const override;
0027     bool supportsAdding() const override
0028     {
0029         return true;
0030     }
0031 
0032     bool canMoveSources() const override
0033     {
0034         return true;
0035     }
0036     bool moveSource(const QString &sourceId, int delta) override;
0037 
0038 private:
0039     QStandardItem *sourceForId(const QString &id) const;
0040 
0041     QStandardItemModel *m_sources;
0042     DiscoverAction *m_testAction;
0043 };