diff --git a/CHANGELOG.md b/CHANGELOG.md index 2443c6ae9..be8b49cf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Accept/decline CLI commands. - Colored Emojis with its own font family. - OAuth2 connection to retrieve remote provisioning (Experimental and not usable without configuration). +- Add/View contact from a message. ## 5.0.11 - undefined diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index 48a6a5131..4471d59cc 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -706,6 +706,16 @@ Server url ikke konfigureret. 'Reply' : Reply to a message from menu Besvar + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index ead09e45f..dfc6704a5 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -706,6 +706,16 @@ Server URL ist nicht konfiguriert. 'Reply' : Reply to a message from menu Antworten + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index e3ac80b71..6441a15a2 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -706,6 +706,16 @@ Server URL not configured. 'Reply' : Reply to a message from menu Reply + + menuViewContact + 'View contact' : Menu item to view the contact. + View contact + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + Add to contacts + ChatNoticeModel diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index c67ab4cac..969633c13 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -706,6 +706,16 @@ URL del servidor no configurada. 'Reply' : Reply to a message from menu Responder + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index 48d197e00..d7c480e42 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -706,6 +706,16 @@ URL du serveur non configurée. 'Reply' : Reply to a message from menu Répondre + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index 0f6bb8a14..d4e22857a 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -704,6 +704,16 @@ A kiszolgáló URL-je nincs konfigurálva. 'Reply' : Reply to a message from menu Válasz + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index e15f5e616..0c932f038 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -706,6 +706,16 @@ URL del server non configurato. 'Reply' : Reply to a message from menu Rispondi + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index 9549aad97..5d9883e97 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -704,6 +704,16 @@ 'Reply' : Reply to a message from menu + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index d6c057619..b9a609c4b 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -708,6 +708,16 @@ Nesukonfigūruotas serverio url. 'Reply' : Reply to a message from menu + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index bcf555efa..ed26f4f1d 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -706,6 +706,16 @@ URL do servidor não configurado. 'Reply' : Reply to a message from menu + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index 70e3aba2f..388e52168 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -708,6 +708,16 @@ 'Reply' : Reply to a message from menu Ответить + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index 52ddf97d6..929f6ac0f 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -706,6 +706,16 @@ Serverwebbadressen är inte konfigurerad. 'Reply' : Reply to a message from menu Svara + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index 390a86688..17ee2158c 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -704,6 +704,16 @@ Sunucu url'si yapılandırılmadı. 'Reply' : Reply to a message from menu Yanıtla + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index 7e0fcc580..6680c13d7 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -708,6 +708,16 @@ 'Reply' : Reply to a message from menu + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index a31af7584..60de93b66 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -704,6 +704,16 @@ 'Reply' : Reply to a message from menu 回复 + + menuViewContact + 'View contact' : Menu item to view the contact. + + + + menuAddContact + 'Add to contacts' : Menu item to add the contact to address book. + + ChatNoticeModel diff --git a/linphone-app/src/components/chat-events/ChatMessageModel.cpp b/linphone-app/src/components/chat-events/ChatMessageModel.cpp index 061eb3ef6..62fd79860 100644 --- a/linphone-app/src/components/chat-events/ChatMessageModel.cpp +++ b/linphone-app/src/components/chat-events/ChatMessageModel.cpp @@ -158,7 +158,7 @@ QString ChatMessageModel::getToSipAddress() const{ } ContactModel * ChatMessageModel::getContactModel() const{ - return mChatMessage ? CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(Utils::coreStringToAppString(mChatMessage->getFromAddress()->asString())).get() : nullptr; + return mChatMessage ? CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(Utils::cleanSipAddress(Utils::coreStringToAppString(mChatMessage->getFromAddress()->asStringUriOnly()))).get() : nullptr; } bool ChatMessageModel::isEphemeral() const{ diff --git a/linphone-app/ui/modules/Common/Styles/Menus/MenuItemStyle.qml b/linphone-app/ui/modules/Common/Styles/Menus/MenuItemStyle.qml index 34163b43b..f38e0cff1 100644 --- a/linphone-app/ui/modules/Common/Styles/Menus/MenuItemStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Menus/MenuItemStyle.qml @@ -53,6 +53,10 @@ QtObject { property string view : 'contact_view_custom' } + property QtObject entry: QtObject{ + property int iconSize: 30 + } + property QtObject normal : QtObject{ property int leftMargin: 5 diff --git a/linphone-app/ui/modules/Linphone/Chat/Chat.qml b/linphone-app/ui/modules/Linphone/Chat/Chat.qml index 4501e3330..3227cffba 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Chat.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Chat.qml @@ -28,6 +28,9 @@ Rectangle { // --------------------------------------------------------------------------- signal messageToSend (string text) + signal addContactClicked(string contactAddress) + signal viewContactClicked(string contactAddress) + // --------------------------------------------------------------------------- @@ -314,6 +317,8 @@ Rectangle { container.goToMessage(message) // sometimes, there is no access to chat id (maybe because of cleaning component while loading new items). Use a global intermediate. } onConferenceIcsCopied: container.noticeBannerText = qsTr('conferencesCopiedICS') + onAddContactClicked: container.addContactClicked(contactAddress) + onViewContactClicked: container.viewContactClicked(contactAddress) } } } diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatMenu.qml b/linphone-app/ui/modules/Linphone/Chat/ChatMenu.qml index bf15ef14e..41feec40e 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatMenu.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatMenu.qml @@ -31,12 +31,15 @@ Item { signal copySelectionDone() signal replyClicked() signal forwardClicked() + signal addContactClicked(string contactAddress) + signal viewContactClicked(string contactAddress) function open(){ messageMenu.popup() } property string chatTextContent: chatMessageModel && chatMessageModel.content + property bool isContact: (chatMessageModel && chatMessageModel.contactModel) || false Menu { @@ -48,7 +51,7 @@ Item { //: 'Copy' : Text menu to copy selected text in message into clipboard : qsTr('menuCopy')) iconMenu: MenuItemStyle.copy.icon - iconSizeMenu: MenuItemStyle.copy.iconSize + iconSizeMenu: MenuItemStyle.entry.iconSize iconLayoutDirection: Qt.RightToLeft menuItemStyle : MenuItemStyle.aux onTriggered: { @@ -67,7 +70,7 @@ Item { enabled: TextToSpeech.available text: qsTr('menuPlayMe') iconMenu: MenuItemStyle.speaker.icon - iconSizeMenu: MenuItemStyle.speaker.iconSize + iconSizeMenu: MenuItemStyle.entry.iconSize iconLayoutDirection: Qt.RightToLeft menuItemStyle : MenuItemStyle.aux onTriggered: TextToSpeech.say(container.chatTextContent) @@ -77,7 +80,7 @@ Item { //: 'Forward' : Forward a message from menu text: qsTr('menuForward') iconMenu: MenuItemStyle.forward.icon - iconSizeMenu: MenuItemStyle.forward.iconSize + iconSizeMenu: MenuItemStyle.entry.iconSize iconLayoutDirection: Qt.RightToLeft menuItemStyle : MenuItemStyle.aux onTriggered: container.forwardClicked() @@ -87,7 +90,7 @@ Item { //: 'Reply' : Reply to a message from menu text: qsTr('menuReply') iconMenu: MenuItemStyle.reply.icon - iconSizeMenu: MenuItemStyle.reply.iconSize + iconSizeMenu: MenuItemStyle.entry.iconSize iconLayoutDirection: Qt.RightToLeft menuItemStyle : MenuItemStyle.aux onTriggered: container.replyClicked() @@ -101,17 +104,30 @@ Item { : qsTr('menuDeliveryStatus') ) iconMenu: MenuItemStyle.imdn.icon - iconSizeMenu: MenuItemStyle.imdn.iconSize + iconSizeMenu: MenuItemStyle.entry.iconSize iconLayoutDirection: Qt.RightToLeft menuItemStyle : MenuItemStyle.aux visible: container.deliveryCount > 0 onTriggered: container.deliveryStatusClicked() } + MenuItem { + text: container.isContact + //: 'View contact' : Menu item to view the contact. + ? qsTr('menuViewContact') + //: 'Add to contacts' : Menu item to add the contact to address book. + : qsTr('menuAddContact') + iconMenu: container.isContact ? MenuItemStyle.contact.view : MenuItemStyle.contact.add + iconSizeMenu: MenuItemStyle.entry.iconSize + iconLayoutDirection: Qt.RightToLeft + menuItemStyle : MenuItemStyle.aux + visible: !chatMessageModel.isOutgoing + onTriggered: container.isContact ? container.viewContactClicked(container.chatMessageModel.fromSipAddress) : container.addContactClicked(container.chatMessageModel.fromSipAddress) + } MenuItem { //: 'Delete' : Item menu to delete a message text: qsTr('menuDelete') iconMenu: MenuItemStyle.deleteEntry.icon - iconSizeMenu: MenuItemStyle.deleteEntry.iconSize + iconSizeMenu: MenuItemStyle.entry.iconSize iconLayoutDirection: Qt.RightToLeft menuItemStyle : MenuItemStyle.auxError onTriggered: container.removeEntryRequested() diff --git a/linphone-app/ui/modules/Linphone/Chat/IncomingMessage.qml b/linphone-app/ui/modules/Linphone/Chat/IncomingMessage.qml index 12da118b7..7fb191bd8 100644 --- a/linphone-app/ui/modules/Linphone/Chat/IncomingMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/IncomingMessage.qml @@ -18,6 +18,8 @@ RowLayout { signal forwardClicked() signal goToMessage(ChatMessageModel message) signal conferenceIcsCopied() + signal addContactClicked(string contactAddress) + signal viewContactClicked(string contactAddress) implicitHeight: message.height spacing: 0 @@ -70,6 +72,8 @@ RowLayout { onForwardClicked: parent.forwardClicked() onGoToMessage: parent.goToMessage(message) onConferenceIcsCopied: parent.conferenceIcsCopied() + onAddContactClicked: parent.addContactClicked(contactAddress) + onViewContactClicked: parent.viewContactClicked(contactAddress) Layout.fillWidth: true diff --git a/linphone-app/ui/modules/Linphone/Chat/Message.qml b/linphone-app/ui/modules/Linphone/Chat/Message.qml index 4efb2daf7..2903361f0 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Message.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Message.qml @@ -36,6 +36,8 @@ Item { signal forwardClicked() signal goToMessage(ChatMessageModel message) signal conferenceIcsCopied() + signal addContactClicked(string contactAddress) + signal viewContactClicked(string contactAddress) // --------------------------------------------------------------------------- property string lastTextSelected @@ -211,5 +213,7 @@ Item { onCopySelectionDone: container.copySelectionDone() onReplyClicked: container.replyClicked() onForwardClicked: container.forwardClicked() + onAddContactClicked: container.addContactClicked(contactAddress) + onViewContactClicked: container.viewContactClicked(contactAddress) } } diff --git a/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml b/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml index a727d707c..7d33d5ada 100644 --- a/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml @@ -21,6 +21,8 @@ Item { signal forwardClicked() signal goToMessage(ChatMessageModel message) signal conferenceIcsCopied() + signal addContactClicked(string contactAddress) + signal viewContactClicked(string contactAddress) Message { id: message @@ -31,6 +33,8 @@ Item { onForwardClicked: parent.forwardClicked() onGoToMessage: parent.goToMessage(message) onConferenceIcsCopied: parent.conferenceIcsCopied() + onAddContactClicked: parent.addContactClicked(contactAddress) + onViewContactClicked: parent.viewContactClicked(contactAddress) anchors { left: parent.left diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index a80df77f2..586ef3156 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -665,6 +665,12 @@ ColumnLayout { updateFilter() } } + onAddContactClicked: window.setView('ContactEdit', { + sipAddress: contactAddress + }) + onViewContactClicked: window.setView('ContactEdit', { + sipAddress: contactAddress + }) } Connections {