Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'jb50340-action-names' into 'master'
[commhistoryd] Add displayName to notification actions. JB#50340

See merge request mer-core/commhistory-daemon!34
  • Loading branch information
blam committed Jun 29, 2020
2 parents edf1e74 + ee71e0a commit b5006bd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/locstrings.h
Expand Up @@ -61,6 +61,10 @@
#define txt_qtn_msg_contact_card_label qtTrId("qtn_msg_contact_card_label")
//% "%1 | %2"
#define txt_qtn_msg_notification_new_vcard(STR) qtTrId("qtn_msg_received_contact_card").arg(txt_qtn_msg_contact_card_label).arg(STR)
//% "Show Messages"
#define txt_qtn_msg_notification_show_messages qtTrId("txt_qtn_msg_notification_show_messages")
//% "Reply"
#define txt_qtn_msg_notification_reply qtTrId("qtn_msg_notification_reply")
//% "%n attachment(s)"
#define txt_qtn_mms_notification_attachment(NUM) qtTrId("qtn_mms_notification_attachment", NUM)
//% "%1 | %2"
Expand All @@ -75,9 +79,15 @@
#define txt_qtn_call_type_private qtTrId("qtn_call_type_private")
//% "Voicemail"
#define txt_qtn_call_type_voicemail qtTrId("qtn_call_type_voicemail")
//% "Show call history"
#define txt_qtn_call_notification_show_call_history qtTrId("txt_qtn_call_notification_show_call_history")

//% "Tap to listen"
#define txt_qtn_voicemail_prompt qtTrId("qtn_voicemail_prompt")
//% "Call voicemail"
#define txt_qtn_voicemail_notification_call qtTrId("txt_qtn_voicemail_notification_call")
//% "Show voicemail"
#define txt_qtn_voicemail_notification_show_voicemail qtTrId("txt_qtn_voicemail_notification_show_voicemail")

//% "Multimedia message was delivered to %1"
#define txt_qtn_msg_notification_delivered(STR) qtTrId("qtn_mms_info_delivered").arg(STR)
Expand Down
18 changes: 14 additions & 4 deletions src/notificationmanager.cpp
Expand Up @@ -549,10 +549,10 @@ QString NotificationManager::notificationText(const CommHistory::Event& event, c
return text;
}

static QVariant dbusAction(const QString &name, const QString &service, const QString &path, const QString &iface,
static QVariant dbusAction(const QString &name, const QString &displayName, const QString &service, const QString &path, const QString &iface,
const QString &method, const QVariantList &arguments = QVariantList())
{
return Notification::remoteAction(name, QString(), service, path, iface, method, arguments);
return Notification::remoteAction(name, displayName, service, path, iface, method, arguments);
}

void NotificationManager::setNotificationProperties(Notification *notification, PersonalNotification *pn, bool grouped)
Expand All @@ -564,12 +564,14 @@ void NotificationManager::setNotificationProperties(Notification *notification,

if (pn->eventType() != VOICEMAIL_SMS_EVENT_TYPE && grouped) {
remoteActions.append(dbusAction("default",
txt_qtn_msg_notification_show_messages,
MESSAGING_SERVICE_NAME,
OBJECT_PATH,
MESSAGING_INTERFACE,
SHOW_INBOX_METHOD));
} else {
remoteActions.append(dbusAction("default",
txt_qtn_msg_notification_reply,
MESSAGING_SERVICE_NAME,
OBJECT_PATH,
MESSAGING_INTERFACE,
Expand All @@ -580,6 +582,7 @@ void NotificationManager::setNotificationProperties(Notification *notification,
}

remoteActions.append(dbusAction("app",
QString(),
MESSAGING_SERVICE_NAME,
OBJECT_PATH,
MESSAGING_INTERFACE,
Expand All @@ -589,12 +592,14 @@ void NotificationManager::setNotificationProperties(Notification *notification,
case PersonalNotification::Voice:

remoteActions.append(dbusAction("default",
txt_qtn_call_notification_show_call_history,
CALL_HISTORY_SERVICE_NAME,
CALL_HISTORY_OBJECT_PATH,
CALL_HISTORY_INTERFACE,
CALL_HISTORY_METHOD,
QVariantList() << CALL_HISTORY_PARAMETER));
remoteActions.append(dbusAction("app",
QString(),
CALL_HISTORY_SERVICE_NAME,
CALL_HISTORY_OBJECT_PATH,
CALL_HISTORY_INTERFACE,
Expand All @@ -605,11 +610,13 @@ void NotificationManager::setNotificationProperties(Notification *notification,
case PersonalNotification::Voicemail:

remoteActions.append(dbusAction("default",
txt_qtn_voicemail_notification_show_voicemail,
CALL_HISTORY_SERVICE_NAME,
VOICEMAIL_OBJECT_PATH,
VOICEMAIL_INTERFACE,
VOICEMAIL_METHOD));
remoteActions.append(dbusAction("app",
QString(),
CALL_HISTORY_SERVICE_NAME,
VOICEMAIL_OBJECT_PATH,
VOICEMAIL_INTERFACE,
Expand Down Expand Up @@ -806,27 +813,30 @@ void NotificationManager::slotVoicemailWaitingChanged()

voicemailNotification.setItemCount(voicemailCount);

QString displayName;
QString service;
QString path;
QString iface;
QString method;
QVariantList args;
if (!voicemailNumber.isEmpty()) {
displayName = txt_qtn_voicemail_notification_call;
service = VOICEMAIL_WAITING_SERVICE;
path = VOICEMAIL_WAITING_OBJECT_PATH;
iface = VOICEMAIL_WAITING_INTERFACE;
method = VOICEMAIL_WAITING_METHOD;
args.append(QVariant(QVariantList() << QString(QStringLiteral("tel://")) + voicemailNumber));
} else {
displayName = txt_qtn_call_notification_show_call_history;
service = CALL_HISTORY_SERVICE_NAME;
path = CALL_HISTORY_OBJECT_PATH;
iface = CALL_HISTORY_INTERFACE;
method = CALL_HISTORY_METHOD;
args.append(CALL_HISTORY_PARAMETER);
}

voicemailNotification.setRemoteActions(QVariantList() << dbusAction("default", service, path, iface, method, args)
<< dbusAction("app", service, path, iface, method, args));
voicemailNotification.setRemoteActions(QVariantList() << dbusAction("default", displayName, service, path, iface, method, args)
<< dbusAction("app", QString(), service, path, iface, method, args));

voicemailNotification.setReplacesId(currentId);
voicemailNotification.publish();
Expand Down

0 comments on commit b5006bd

Please sign in to comment.