Purpose

rbrepositoriesmodel.h
1/*
2 SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef RBREPOSITORIESMODEL_H
8#define RBREPOSITORIESMODEL_H
9
10#include <KJob>
11#include <QAbstractListModel>
12#include <QUrl>
13
14class RepositoriesModel : public QAbstractListModel
15{
17 Q_PROPERTY(QUrl server READ server WRITE setServer)
18public:
19 RepositoriesModel(QObject *parent = nullptr);
20
21 int rowCount(const QModelIndex &parent) const override;
22 QVariant data(const QModelIndex &index, int role) const override;
23
24 void refresh();
25
26 QUrl server() const
27 {
28 return m_server;
29 }
30 void setServer(const QUrl &server)
31 {
32 if (m_server != server) {
33 m_server = server;
34 refresh();
35 }
36 }
37
38 void receivedProjects(KJob *j);
39 Q_SCRIPTABLE int findRepository(const QString &name);
40
42 void repositoriesChanged();
43
44private:
45 struct Value {
46 QVariant name;
47 QVariant path;
48 bool operator<(const Value &v1) const
49 {
50 return name.toString() < v1.name.toString();
51 }
52 };
53 QList<Value> m_values;
54 QUrl m_server;
55};
56
57#endif
QString name(StandardShortcut id)
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:05 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.