From 9d0f3b37fcb8344e3f66f9dd48b5265ff184f24f Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 13 May 2019 08:40:26 +0200 Subject: [PATCH] [Notifications] Rename device name to origin name This makes it a bit more generic. Advertise that this may also be used to indicate what email account a notification came from. Differential Revision: https://phabricator.kde.org/D21137 --- .../package/contents/ui/FullRepresentation.qml | 2 +- .../package/contents/ui/NotificationHeader.qml | 4 ++-- .../notifications/package/contents/ui/NotificationItem.qml | 2 +- .../notifications/package/contents/ui/NotificationPopup.qml | 2 +- .../notifications/package/contents/ui/global/Globals.qml | 2 +- libnotificationmanager/notification.cpp | 6 +++--- libnotificationmanager/notification.h | 2 +- libnotificationmanager/notification_p.h | 2 +- libnotificationmanager/notifications.h | 2 +- libnotificationmanager/notificationsmodel.cpp | 2 +- libnotificationmanager/server_p.cpp | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/applets/notifications/package/contents/ui/FullRepresentation.qml b/applets/notifications/package/contents/ui/FullRepresentation.qml index 02f442dd0..3fb98868b 100644 --- a/applets/notifications/package/contents/ui/FullRepresentation.qml +++ b/applets/notifications/package/contents/ui/FullRepresentation.qml @@ -446,7 +446,7 @@ ColumnLayout{ applicationName: model.applicationName applicationIconSource: model.applicationIconName - deviceName: model.deviceName || "" + originName: model.originName || "" time: model.updated || model.created diff --git a/applets/notifications/package/contents/ui/NotificationHeader.qml b/applets/notifications/package/contents/ui/NotificationHeader.qml index 11f3f783e..50cc95647 100644 --- a/applets/notifications/package/contents/ui/NotificationHeader.qml +++ b/applets/notifications/package/contents/ui/NotificationHeader.qml @@ -39,7 +39,7 @@ RowLayout { property var applicationIconSource property string applicationName - property string deviceName + property string originName property string configureActionLabel @@ -88,7 +88,7 @@ RowLayout { Layout.fillWidth: true textFormat: Text.PlainText elide: Text.ElideRight - text: notificationHeading.applicationName + (notificationHeading.deviceName ? " · " + notificationHeading.deviceName : "") + text: notificationHeading.applicationName + (notificationHeading.originName ? " · " + notificationHeading.originName : "") } PlasmaExtras.DescriptiveLabel { diff --git a/applets/notifications/package/contents/ui/NotificationItem.qml b/applets/notifications/package/contents/ui/NotificationItem.qml index 3b0b9953d..cb33b8241 100644 --- a/applets/notifications/package/contents/ui/NotificationItem.qml +++ b/applets/notifications/package/contents/ui/NotificationItem.qml @@ -43,7 +43,7 @@ ColumnLayout { property alias applicationIconSource: notificationHeading.applicationIconSource property alias applicationName: notificationHeading.applicationName - property alias deviceName: notificationHeading.deviceName + property alias originName: notificationHeading.originName property string summary property alias time: notificationHeading.time diff --git a/applets/notifications/package/contents/ui/NotificationPopup.qml b/applets/notifications/package/contents/ui/NotificationPopup.qml index c6fdfe6c8..96373c10b 100644 --- a/applets/notifications/package/contents/ui/NotificationPopup.qml +++ b/applets/notifications/package/contents/ui/NotificationPopup.qml @@ -37,7 +37,7 @@ PlasmaCore.Dialog { property alias applicationName: notificationItem.applicationName property alias applicationIconSource: notificationItem.applicationIconSource - property alias deviceName: notificationItem.deviceName + property alias originName: notificationItem.originName property alias time: notificationItem.time diff --git a/applets/notifications/package/contents/ui/global/Globals.qml b/applets/notifications/package/contents/ui/global/Globals.qml index ce83b1985..2e291b443 100644 --- a/applets/notifications/package/contents/ui/global/Globals.qml +++ b/applets/notifications/package/contents/ui/global/Globals.qml @@ -328,7 +328,7 @@ QtObject { applicationName: model.applicationName applicationIconSource: model.applicationIconName - deviceName: model.deviceName || "" + originName: model.originName || "" time: model.updated || model.created diff --git a/libnotificationmanager/notification.cpp b/libnotificationmanager/notification.cpp index 1146265af..9e55e48e8 100644 --- a/libnotificationmanager/notification.cpp +++ b/libnotificationmanager/notification.cpp @@ -330,7 +330,7 @@ void Notification::Private::processHints(const QVariantMap &hints) applicationName = applicationDisplayName; } - deviceName = hints.value(QStringLiteral("x-kde-device-name")).toString(); + originName = hints.value(QStringLiteral("x-kde-origin-name")).toString(); eventId = hints.value(QStringLiteral("x-kde-eventId")).toString(); @@ -531,9 +531,9 @@ void Notification::setApplicationIconName(const QString &applicationIconName) d->applicationIconName = applicationIconName; } -QString Notification::deviceName() const +QString Notification::originName() const { - return d->deviceName; + return d->originName; } QStringList Notification::actionNames() const diff --git a/libnotificationmanager/notification.h b/libnotificationmanager/notification.h index efb8035af..c2109e3f4 100644 --- a/libnotificationmanager/notification.h +++ b/libnotificationmanager/notification.h @@ -81,7 +81,7 @@ public: QString applicationIconName() const; void setApplicationIconName(const QString &applicationIconName); - QString deviceName() const; + QString originName() const; // should we group the two into a QPair or something? QStringList actionNames() const; diff --git a/libnotificationmanager/notification_p.h b/libnotificationmanager/notification_p.h index b68e68b18..c3e2bc8d1 100644 --- a/libnotificationmanager/notification_p.h +++ b/libnotificationmanager/notification_p.h @@ -67,7 +67,7 @@ public: bool configurableService = false; QString applicationIconName; - QString deviceName; + QString originName; QStringList actionNames; QStringList actionLabels; diff --git a/libnotificationmanager/notifications.h b/libnotificationmanager/notifications.h index a6492fb1a..3dc22e514 100644 --- a/libnotificationmanager/notifications.h +++ b/libnotificationmanager/notifications.h @@ -231,7 +231,7 @@ public: ApplicationNameRole, ///< The user-visible name of the application (e.g. Spectacle) ApplicationIconNameRole, ///< The icon name of the application - DeviceNameRole, ///< The name of the device the notification originally came from, if it was proxied through a sync service like KDE Connect + OriginNameRole, ///< The name of the device or account the notification originally came from, e.g. "My Phone" (in case of device sync) or "foo@example.com" (in case of an email notification) // Jobs JobStateRole, ///< The state of the job, either JobStateJopped, JobStateSuspended, or JobStateRunning. diff --git a/libnotificationmanager/notificationsmodel.cpp b/libnotificationmanager/notificationsmodel.cpp index bfa414c4a..6f8168816 100644 --- a/libnotificationmanager/notificationsmodel.cpp +++ b/libnotificationmanager/notificationsmodel.cpp @@ -292,7 +292,7 @@ QVariant NotificationsModel::data(const QModelIndex &index, int role) const case Notifications::ApplicationNameRole: return notification.applicationName(); case Notifications::ApplicationIconNameRole: return notification.applicationIconName(); - case Notifications::DeviceNameRole: return notification.deviceName(); + case Notifications::OriginNameRole: return notification.originName(); case Notifications::ActionNamesRole: return notification.actionNames(); case Notifications::ActionLabelsRole: return notification.actionLabels(); diff --git a/libnotificationmanager/server_p.cpp b/libnotificationmanager/server_p.cpp index 1d07075d8..f9863d6f8 100644 --- a/libnotificationmanager/server_p.cpp +++ b/libnotificationmanager/server_p.cpp @@ -177,7 +177,7 @@ QStringList ServerPrivate::GetCapabilities() const QStringLiteral("actions"), QStringLiteral("x-kde-urls"), - QStringLiteral("x-kde-device-name"), + QStringLiteral("x-kde-origin-name"), QStringLiteral("x-kde-display-appname"), QStringLiteral("inhibitions")