Commit 53f8dcaa authored by jpetrell's avatar jpetrell

Merge branch 'jb51477' into 'master'

[commhistoryd] Hide call and reply notification actions without phone number. Fixes JB#51477

See merge request !45
parents 3669b0fe 55d0c894
......@@ -633,29 +633,34 @@ void NotificationManager::setNotificationProperties(Notification *notification,
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()
<< true));
if (pn->eventType() == CommHistory::Event::IMEvent || pn->hasPhoneNumber()) {
// 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()
<< 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()));
if (pn->hasPhoneNumber()) {
// 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()));
}
}
break;
......@@ -679,23 +684,25 @@ void NotificationManager::setNotificationProperties(Notification *notification,
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));
if (pn->hasPhoneNumber()) {
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;
......
......@@ -297,6 +297,14 @@ bool PersonalNotification::hidden() const
return false;
}
bool PersonalNotification::hasPhoneNumber() const
{
if (m_eventType == CommHistory::Event::SMSEvent || m_eventType == CommHistory::Event::MMSEvent || m_eventType == VOICEMAIL_SMS_EVENT_TYPE) {
return CommHistory::normalizePhoneNumber(m_remoteUid, true).length() > 0;
}
return false;
}
void PersonalNotification::setRemoteUid(const QString& remoteUid)
{
if (m_remoteUid != remoteUid) {
......
......@@ -116,6 +116,8 @@ public:
QDateTime timestamp() const;
bool hidden() const;
bool hasPhoneNumber() const;
void setRemoteUid(const QString& remoteUid);
void setAccount(const QString& account);
void setEventType(uint eventType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment