Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/calendar/eventpluginsmanager.cpp
Show All 35 Lines | 35 | { | |||
---|---|---|---|---|---|
36 | Q_OBJECT | 36 | Q_OBJECT | ||
37 | public: | 37 | public: | ||
38 | EventPluginsModel(EventPluginsManager *manager) : QAbstractListModel(manager) | 38 | EventPluginsModel(EventPluginsManager *manager) : QAbstractListModel(manager) | ||
39 | { | 39 | { | ||
40 | m_manager = manager; | 40 | m_manager = manager; | ||
41 | m_roles = QAbstractListModel::roleNames(); | 41 | m_roles = QAbstractListModel::roleNames(); | ||
42 | m_roles.insert(Qt::EditRole, QByteArrayLiteral("checked")); | 42 | m_roles.insert(Qt::EditRole, QByteArrayLiteral("checked")); | ||
43 | m_roles.insert(Qt::UserRole, QByteArrayLiteral("configUi")); | 43 | m_roles.insert(Qt::UserRole, QByteArrayLiteral("configUi")); | ||
44 | m_roles.insert(Qt::UserRole + 1, QByteArrayLiteral("pluginPath")); | ||||
44 | }; | 45 | }; | ||
45 | 46 | | |||
46 | // make these two available to the manager | 47 | // make these two available to the manager | ||
47 | void beginResetModel() | 48 | void beginResetModel() | ||
48 | { | 49 | { | ||
49 | QAbstractListModel::beginResetModel(); | 50 | QAbstractListModel::beginResetModel(); | ||
50 | } | 51 | } | ||
51 | 52 | | |||
Show All 33 Lines | 79 | switch (role) { | |||
85 | case Qt::UserRole: | 86 | case Qt::UserRole: | ||
86 | { | 87 | { | ||
87 | // The currentPlugin path contains the full path including | 88 | // The currentPlugin path contains the full path including | ||
88 | // the plugin filename, so it needs to be cut off from the last '/' | 89 | // the plugin filename, so it needs to be cut off from the last '/' | ||
89 | const QStringRef pathRef = currentPlugin.leftRef(currentPlugin.lastIndexOf('/')); | 90 | const QStringRef pathRef = currentPlugin.leftRef(currentPlugin.lastIndexOf('/')); | ||
90 | const QString qmlFilePath = metadata.configUi; | 91 | const QString qmlFilePath = metadata.configUi; | ||
91 | return QString(pathRef % '/' % qmlFilePath); | 92 | return QString(pathRef % '/' % qmlFilePath); | ||
92 | } | 93 | } | ||
94 | case Qt::UserRole + 1: | ||||
95 | return currentPlugin; | ||||
93 | case Qt::EditRole: | 96 | case Qt::EditRole: | ||
94 | return m_manager->m_enabledPlugins.contains(currentPlugin); | 97 | return m_manager->m_enabledPlugins.contains(currentPlugin); | ||
95 | } | 98 | } | ||
96 | 99 | | |||
97 | return QVariant(); | 100 | return QVariant(); | ||
98 | 101 | | |||
99 | } | 102 | } | ||
100 | 103 | | |||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |