From 5d80bf9f235b8094a5a0296a2386cae553f80c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20Fiestas?= Date: Mon, 7 Mar 2016 11:34:41 +0100 Subject: [PATCH] If the package contains a photo, show it in the notification If the received packet has a photo, set it as pixmap in the notification, otherwise keep showing the icon. REVIEW:127298 --- plugins/telephony/telephonyplugin.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp index c774c41b9..449a22d13 100644 --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -47,6 +47,7 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np) const QString event = np.get("event"); const QString phoneNumber = np.get("phoneNumber", i18n("unknown number")); const QString contactName = np.get("contactName", phoneNumber); + const QByteArray phoneThumbnail = QByteArray::fromBase64(np.get("phoneThumbnail", "")); QString content, type, icon; KNotification::NotificationFlags flags = KNotification::CloseOnTimeout | KNotification::CloseWhenWidgetActivated; @@ -83,7 +84,13 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np) qCDebug(KDECONNECT_PLUGIN_TELEPHONY) << "Creating notification with type:" << type; KNotification* notification = new KNotification(type, flags, this); - notification->setIconName(icon); + if (!phoneThumbnail.isEmpty()) { + QPixmap photo; + photo.loadFromData(phoneThumbnail, "JPEG"); + notification->setPixmap(photo); + } else { + notification->setIconName(icon); + } notification->setComponentName("kdeconnect"); notification->setTitle(title); notification->setText(content);