[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdeconnect-kde] plugins/telephony: If the package contains a photo,  show it in the notification
From:       Àlex_Fiestas <afiestas () kde ! org>
Date:       2016-03-07 10:34:58
Message-ID: E1acsV8-0001jG-VS () scm ! kde ! org
[Download RAW message or body]

Git commit 5d80bf9f235b8094a5a0296a2386cae553f80c0f by Àlex 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/5d80bf9f235b8094a5a0296a2386cae553f80c0f

diff --git a/plugins/telephony/telephonyplugin.cpp \
b/plugins/telephony/telephonyplugin.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 = np.get<QString>("event");
     const QString phoneNumber = np.get<QString>("phoneNumber", i18n("unknown \
                number"));
     const QString contactName = np.get<QString>("contactName", phoneNumber);
+    const QByteArray phoneThumbnail = \
QByteArray::fromBase64(np.get<QByteArray>("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);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic