From kde-commits Mon Mar 07 10:34:58 2016 From: =?utf-8?q?=C3=80lex_Fiestas?= Date: Mon, 07 Mar 2016 10:34:58 +0000 To: kde-commits Subject: [kdeconnect-kde] plugins/telephony: If the package contains a photo, show it in the notification Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=145734690709198 Git commit 5d80bf9f235b8094a5a0296a2386cae553f80c0f by =C3=80lex Fiestas. Committed on 07/03/2016 at 10:34. Pushed by afiestas into branch 'master'. 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 M +8 -1 plugins/telephony/telephonyplugin.cpp http://commits.kde.org/kdeconnect-kde/5d80bf9f235b8094a5a0296a2386cae553f80= c0f diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/tele= phonyplugin.cpp index c774c41..449a22d 100644 --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -47,6 +47,7 @@ KNotification* TelephonyPlugin::createNotification(const = NetworkPackage& np) const QString event =3D np.get("event"); const QString phoneNumber =3D np.get("phoneNumber", i18n("unk= nown number")); const QString contactName =3D np.get("contactName", phoneNumb= er); + const QByteArray phoneThumbnail =3D QByteArray::fromBase64(np.get("phoneThumbnail", "")); = QString content, type, icon; KNotification::NotificationFlags flags =3D KNotification::CloseOnTimeo= ut | KNotification::CloseWhenWidgetActivated; @@ -83,7 +84,13 @@ KNotification* TelephonyPlugin::createNotification(const= NetworkPackage& np) qCDebug(KDECONNECT_PLUGIN_TELEPHONY) << "Creating notification with ty= pe:" << type; = KNotification* notification =3D 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);