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
This commit is contained in:
parent
6e17178c0f
commit
5d80bf9f23
1 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue