diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp index c557f66..7366651 100644 --- a/src/notificationmanager.cpp +++ b/src/notificationmanager.cpp @@ -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; diff --git a/src/personalnotification.cpp b/src/personalnotification.cpp index 56fa765..fffe943 100644 --- a/src/personalnotification.cpp +++ b/src/personalnotification.cpp @@ -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) { diff --git a/src/personalnotification.h b/src/personalnotification.h index 2aa66b6..01c16f6 100644 --- a/src/personalnotification.h +++ b/src/personalnotification.h @@ -116,6 +116,8 @@ class PersonalNotification : public QObject, public Serialisable QDateTime timestamp() const; bool hidden() const; + bool hasPhoneNumber() const; + void setRemoteUid(const QString& remoteUid); void setAccount(const QString& account); void setEventType(uint eventType);