File: PackageKitSourcesBackend.h

package info (click to toggle)
plasma-discover 6.5.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,288 kB
  • sloc: cpp: 30,576; xml: 2,710; python: 311; sh: 5; makefile: 5
file content (42 lines) | stat: -rw-r--r-- 1,106 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 *   SPDX-FileCopyrightText: 2016 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
 *
 *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
 */

#pragma once

#include <PackageKit/Transaction>
#include <resources/AbstractSourcesBackend.h>

class QStandardItem;
class PKSourcesModel;

class PackageKitSourcesBackend : public AbstractSourcesBackend
{
    Q_OBJECT
public:
    PackageKitSourcesBackend(AbstractResourcesBackend *parent);

    QString idDescription() override;

    bool supportsAdding() const override
    {
        return false;
    }
    bool addSource(const QString &id) override;
    bool removeSource(const QString &id) override;

    QAbstractItemModel *sources() override;
    QVariantList actions() const override;

    void transactionError(PackageKit::Transaction::Error, const QString &message);

private:
    void resetSources();
    void addRepositoryDetails(const QString &id, const QString &description, bool enabled);
    QStandardItem *findItemForId(const QString &id) const;

    PKSourcesModel *m_sources;
    QVariantList m_actions;
};