Warning, file /system/dolphin/src/settings/servicemodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef SERVICEMODEL_H 0008 #define SERVICEMODEL_H 0009 0010 #include <QAbstractListModel> 0011 #include <QList> 0012 0013 /** 0014 * @brief Provides a simple model for enabling/disabling services 0015 * 0016 * The following roles are supported: 0017 * - Qt::DisplayRole: Name of the service 0018 * - Qt::DecorationRole: Icon name of the service 0019 * - Qt::CheckStateRole: Specifies whether the service is enabled 0020 * - ServiceModel::DesktopEntryNameRole: Name of the desktop-entry of the service 0021 * - ServiceModel::Configurable: Specifies whether the service is configurable by the user 0022 */ 0023 class ServiceModel : public QAbstractListModel 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 enum Role { DesktopEntryNameRole = Qt::UserRole }; 0029 0030 explicit ServiceModel(QObject *parent = nullptr); 0031 ~ServiceModel() override; 0032 0033 bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; 0034 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; 0035 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0036 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0037 void clear(); 0038 Qt::ItemFlags flags(const QModelIndex &index) const override; 0039 0040 private: 0041 struct ServiceItem { 0042 Qt::CheckState checked; 0043 QString icon; 0044 QString text; 0045 QString desktopEntryName; 0046 }; 0047 0048 QList<ServiceItem> m_items; 0049 }; 0050 0051 #endif