]>
cloud.milkyroute.net Git - dolphin.git/blob - src/settings/servicemodel.h
47fe54d6a565e20b63a55f59857915b1c6a1caeb
1 /***************************************************************************
2 * Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef SERVICEMODEL_H
21 #define SERVICEMODEL_H
23 #include <QAbstractListModel>
27 * @brief Provides a simple model for enabling/disabling services
29 * The following roles are supported:
30 * - Qt::DisplayRole: Name of the service
31 * - Qt::DecorationRole: Icon name of the service
32 * - Qt::CheckStateRole: Specifies whether the service is enabled
33 * - ServiceModel::DesktopEntryNameRole: Name of the desktop-entry of the service
34 * - ServiceModel::Configurable: Specifies whether the service is configurable by the user
36 class ServiceModel
: public QAbstractListModel
43 DesktopEntryNameRole
= Qt::UserRole
,
47 explicit ServiceModel(QObject
* parent
= 0);
48 ~ServiceModel() override
;
50 bool insertRows(int row
, int count
, const QModelIndex
& parent
= QModelIndex()) override
;
51 bool setData(const QModelIndex
& index
, const QVariant
& value
, int role
= Qt::EditRole
) override
;
52 QVariant
data(const QModelIndex
& index
, int role
= Qt::DisplayRole
) const override
;
53 int rowCount(const QModelIndex
& parent
= QModelIndex()) const override
;
62 QString desktopEntryName
;
65 QList
<ServiceItem
> m_items
;