Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'jb50340-action-display-names' into 'master'
[commhistory-daemon] Update notification action display names. JB#50340

See merge request mer-core/commhistory-daemon!40
  • Loading branch information
blam committed Aug 20, 2020
2 parents cb66d7d + f964831 commit 77dd5f8
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 28 deletions.
8 changes: 4 additions & 4 deletions src/constants.h
Expand Up @@ -55,10 +55,10 @@ namespace RTComLogger {
#define VOICEMAIL_METHOD QLatin1String("voicemail")
#define REPLACE_TYPE QLatin1String("sms-replace-number")

#define VOICEMAIL_WAITING_SERVICE QLatin1String("com.jolla.voicecall.ui")
#define VOICEMAIL_WAITING_OBJECT_PATH QLatin1String("/")
#define VOICEMAIL_WAITING_INTERFACE QLatin1String("com.jolla.voicecall.ui")
#define VOICEMAIL_WAITING_METHOD QLatin1String("openUrl")
#define VOICECALL_SERVICE QLatin1String("com.jolla.voicecall.ui")
#define VOICECALL_OBJECT_PATH QLatin1String("/")
#define VOICECALL_INTERFACE QLatin1String("com.jolla.voicecall.ui")
#define VOICECALL_DIAL_METHOD QLatin1String("dial")

// Custom hints for identifying notifications
#define ACCOUNT_PATH_HINT QLatin1String("x-org-nemomobile-qmlmessages.account.path")
Expand Down
12 changes: 6 additions & 6 deletions src/locstrings.h
Expand Up @@ -61,10 +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")
//% "Call"
#define txt_qtn_msg_notification_call qtTrId("qtn_msg_notification_call")
//% "%n attachment(s)"
#define txt_qtn_mms_notification_attachment(NUM) qtTrId("qtn_mms_notification_attachment", NUM)
//% "%1 | %2"
Expand All @@ -79,15 +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")
//% "Call back"
#define txt_qtn_call_notification_call_back qtTrId("txt_qtn_call_notification_call_back")
//% "Send message"
#define txt_qtn_call_notification_send_message qtTrId("txt_qtn_call_notification_send_message")

//% "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
79 changes: 61 additions & 18 deletions src/notificationmanager.cpp
Expand Up @@ -609,36 +609,62 @@ void NotificationManager::setNotificationProperties(Notification *notification,
case PersonalNotification::Messaging:

if (pn->eventType() != VOICEMAIL_SMS_EVENT_TYPE && grouped) {
// Default action: show the inbox
remoteActions.append(dbusAction("default",
txt_qtn_msg_notification_show_messages,
QString(),
MESSAGING_SERVICE_NAME,
OBJECT_PATH,
MESSAGING_INTERFACE,
SHOW_INBOX_METHOD));
} else {
// Default action: show the message
remoteActions.append(dbusAction("default",
QString(),
MESSAGING_SERVICE_NAME,
OBJECT_PATH,
MESSAGING_INTERFACE,
START_CONVERSATION_METHOD,
QVariantList() << pn->account()
<< pn->targetId()
<< false));
}

if (pn->eventType() == CommHistory::Event::IMEvent
|| pn->eventType() == CommHistory::Event::SMSEvent
|| pn->eventType() == CommHistory::Event::MMSEvent) {
// Named action: "Reply"
remoteActions.append(dbusAction(QString(),
txt_qtn_msg_notification_reply,
MESSAGING_SERVICE_NAME,
OBJECT_PATH,
MESSAGING_INTERFACE,
START_CONVERSATION_METHOD,
QVariantList() << pn->account()
<< pn->targetId()
<< static_cast<uint>(pn->chatType())));
<< true));
}

if (pn->eventType() == CommHistory::Event::SMSEvent
|| pn->eventType() == CommHistory::Event::MMSEvent
|| pn->eventType() == VOICEMAIL_SMS_EVENT_TYPE) {
// Named action: "Call"
remoteActions.append(dbusAction(QString(),
txt_qtn_msg_notification_call,
VOICECALL_SERVICE,
VOICECALL_OBJECT_PATH,
VOICECALL_INTERFACE,
VOICECALL_DIAL_METHOD,
QVariantList() << pn->remoteUid()));
}

remoteActions.append(dbusAction("app",
QString(),
MESSAGING_SERVICE_NAME,
OBJECT_PATH,
MESSAGING_INTERFACE,
SHOW_INBOX_METHOD));
break;

case PersonalNotification::Voice:

// Missed calls.
// Default action: show Call History
remoteActions.append(dbusAction("default",
txt_qtn_call_notification_show_call_history,
QString(),
CALL_HISTORY_SERVICE_NAME,
CALL_HISTORY_OBJECT_PATH,
CALL_HISTORY_INTERFACE,
Expand All @@ -651,12 +677,32 @@ void NotificationManager::setNotificationProperties(Notification *notification,
CALL_HISTORY_INTERFACE,
CALL_HISTORY_METHOD,
QVariantList() << CALL_HISTORY_PARAMETER));

remoteActions.append(dbusAction(QString(),
txt_qtn_call_notification_call_back,
VOICECALL_SERVICE,
VOICECALL_OBJECT_PATH,
VOICECALL_INTERFACE,
VOICECALL_DIAL_METHOD,
QVariantList() << pn->remoteUid()));

remoteActions.append(dbusAction(QString(),
txt_qtn_call_notification_send_message,
MESSAGING_SERVICE_NAME,
OBJECT_PATH,
MESSAGING_INTERFACE,
START_CONVERSATION_METHOD,
QVariantList() << pn->account()
<< pn->targetId()
<< true));

break;

case PersonalNotification::Voicemail:

// Default action: show voicemail
remoteActions.append(dbusAction("default",
txt_qtn_voicemail_notification_show_voicemail,
QString(),
CALL_HISTORY_SERVICE_NAME,
VOICEMAIL_OBJECT_PATH,
VOICEMAIL_INTERFACE,
Expand Down Expand Up @@ -846,29 +892,26 @@ 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;
service = VOICECALL_SERVICE;
path = VOICECALL_OBJECT_PATH;
iface = VOICECALL_INTERFACE;
method = VOICECALL_DIAL_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", displayName, service, path, iface, method, args)
voicemailNotification.setRemoteActions(QVariantList() << dbusAction("default", QString(), service, path, iface, method, args)
<< dbusAction("app", QString(), service, path, iface, method, args));

voicemailNotification.setReplacesId(currentId);
Expand Down

0 comments on commit 77dd5f8

Please sign in to comment.