give missed calls and SMSs persistent status
see https://plus.google.com/108821248346337473429/posts/jYbeLLZCL9H
This commit is contained in:
parent
eb38ad5330
commit
e869fc019f
3 changed files with 9 additions and 6 deletions
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
public Q_SLOTS:
|
||||
virtual bool receivePackage(const NetworkPackage& np);
|
||||
virtual void connected() { };
|
||||
virtual void connected() { }
|
||||
|
||||
/**
|
||||
* @returns 0 if not muted, 1 if muted or -1 if there was an error
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PingPlugin >(); )
|
||||
|
||||
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PING, "kdeconnect.plugin.ping");
|
||||
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PING, "kdeconnect.plugin.ping")
|
||||
|
||||
PingPlugin::PingPlugin(QObject* parent, const QVariantList& args)
|
||||
: KdeConnectPlugin(parent, args)
|
||||
|
|
|
@ -43,6 +43,7 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
|
|||
const QString phoneNumber = np.get<QString>("phoneNumber", i18n("unknown number"));
|
||||
|
||||
QString content, type, icon;
|
||||
KNotification::NotificationFlags flags = KNotification::CloseOnTimeout;
|
||||
|
||||
const QString title = device()->name();
|
||||
|
||||
|
@ -54,26 +55,28 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
|
|||
type = "missedCall";
|
||||
icon = "call-start";
|
||||
content = i18n("Missed call from %1", phoneNumber);
|
||||
flags = KNotification::Persistent;
|
||||
} else if (event == "sms") {
|
||||
type = "smsReceived";
|
||||
icon = "mail-receive";
|
||||
QString messageBody = np.get<QString>("messageBody","");
|
||||
content = i18n("SMS from %1: %2", phoneNumber, messageBody);
|
||||
flags = KNotification::Persistent;
|
||||
} else if (event == "talking") {
|
||||
return NULL;
|
||||
} else {
|
||||
#ifdef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
return NULL;
|
||||
#else
|
||||
type = "unknownEvent";
|
||||
icon = "pda";
|
||||
content = i18n("Unknown telephony event: %2", event);
|
||||
icon = "phone";
|
||||
content = i18n("Unknown telephony event: %1", event);
|
||||
#endif
|
||||
}
|
||||
|
||||
qCDebug(KDECONNECT_PLUGIN_TELEPHONY) << "Creating notification with type:" << type;
|
||||
|
||||
KNotification* notification = new KNotification(type, KNotification::CloseOnTimeout, this); //, KNotification::Persistent
|
||||
KNotification* notification = new KNotification(type, flags, this);
|
||||
notification->setPixmap(QIcon::fromTheme(icon).pixmap(48, 48));
|
||||
notification->setComponentName("kdeconnect");
|
||||
notification->setTitle(title);
|
||||
|
|
Loading…
Reference in a new issue