Changeset View
Changeset View
Standalone View
Standalone View
interfaces/notificationsmodel.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | QHash<int, QByteArray> NotificationsModel::roleNames() const | 55 | QHash<int, QByteArray> NotificationsModel::roleNames() const | ||
56 | { | 56 | { | ||
57 | //Role names for QML | 57 | //Role names for QML | ||
58 | QHash<int, QByteArray> names = QAbstractItemModel::roleNames(); | 58 | QHash<int, QByteArray> names = QAbstractItemModel::roleNames(); | ||
59 | names.insert(DbusInterfaceRole, "dbusInterface"); | 59 | names.insert(DbusInterfaceRole, "dbusInterface"); | ||
60 | names.insert(AppNameModelRole, "appName"); | 60 | names.insert(AppNameModelRole, "appName"); | ||
61 | names.insert(IdModelRole, "notificationId"); | 61 | names.insert(IdModelRole, "notificationId"); | ||
62 | names.insert(DismissableModelRole, "dismissable"); | 62 | names.insert(DismissableModelRole, "dismissable"); | ||
63 | names.insert(RepliableModelRole, "repliable"); | ||||
64 | names.insert(IconPathModelRole, "appIcon"); | ||||
63 | return names; | 65 | return names; | ||
64 | } | 66 | } | ||
65 | 67 | | |||
66 | NotificationsModel::~NotificationsModel() | 68 | NotificationsModel::~NotificationsModel() | ||
67 | { | 69 | { | ||
68 | } | 70 | } | ||
69 | 71 | | |||
70 | QString NotificationsModel::deviceId() const | 72 | QString NotificationsModel::deviceId() const | ||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 182 | switch (role) { | |||
187 | case ContentModelRole: | 189 | case ContentModelRole: | ||
188 | return QString(); //To implement in the Android side | 190 | return QString(); //To implement in the Android side | ||
189 | case AppNameModelRole: | 191 | case AppNameModelRole: | ||
190 | return notification->appName(); | 192 | return notification->appName(); | ||
191 | case DbusInterfaceRole: | 193 | case DbusInterfaceRole: | ||
192 | return qVariantFromValue<QObject*>(notification); | 194 | return qVariantFromValue<QObject*>(notification); | ||
193 | case DismissableModelRole: | 195 | case DismissableModelRole: | ||
194 | return notification->dismissable(); | 196 | return notification->dismissable(); | ||
197 | case RepliableModelRole: | ||||
198 | return !notification->replyId().isEmpty(); | ||||
199 | case IconPathModelRole: | ||||
200 | return notification->iconPath(); | ||||
195 | default: | 201 | default: | ||
196 | return QVariant(); | 202 | return QVariant(); | ||
197 | } | 203 | } | ||
198 | } | 204 | } | ||
199 | 205 | | |||
200 | NotificationDbusInterface* NotificationsModel::getNotification(const QModelIndex& index) const | 206 | NotificationDbusInterface* NotificationsModel::getNotification(const QModelIndex& index) const | ||
201 | { | 207 | { | ||
202 | if (!index.isValid()) { | 208 | if (!index.isValid()) { | ||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |