File: AlpineApkSourcesBackend.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 (46 lines) | stat: -rw-r--r-- 1,390 bytes parent folder | download | duplicates (2)
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
43
44
45
46
/*
 *   SPDX-FileCopyrightText: 2020 Alexey Minnekhanov <alexey.min@gmail.com>
 *
 *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
 */

#ifndef ALPINEAPKSOURCESBACKEND_H
#define ALPINEAPKSOURCESBACKEND_H

#include "resources/AbstractSourcesBackend.h"

#include <QStandardItemModel>

#include <QtApkRepository.h>

class DiscoverAction;

class AlpineApkSourcesBackend : public AbstractSourcesBackend
{
public:
    explicit AlpineApkSourcesBackend(AbstractResourcesBackend *parent);

    QAbstractItemModel *sources() override;
    bool addSource(const QString &id) override;
    bool removeSource(const QString &id) override;
    QString idDescription() override;
    QVariantList actions() const override;
    bool supportsAdding() const override;
    bool canMoveSources() const override;
    bool moveSource(const QString &sourceId, int delta) override;

private:
    QStandardItem *sourceForId(const QString &id) const;
    bool addSourceFull(const QString &id, const QString &comment, bool enabled);
    void loadSources();
    void saveSources();
    void fillModelFromRepos();
    void onItemChanged(QStandardItem *item);

    QStandardItemModel *m_sourcesModel = nullptr;
    DiscoverAction *m_refreshAction = nullptr;
    DiscoverAction *m_saveAction = nullptr;
    QVector<QtApk::Repository> m_repos;
};

#endif // ALPINEAPKSOURCESBACKEND_H