diff --git a/Linphone/core/friend/FriendCore.cpp b/Linphone/core/friend/FriendCore.cpp index a819d22e1..1ad581949 100644 --- a/Linphone/core/friend/FriendCore.cpp +++ b/Linphone/core/friend/FriendCore.cpp @@ -54,6 +54,14 @@ FriendCore::FriendCore(const std::shared_ptr &contact, bool is mPictureUri = Utils::coreStringToAppString(contact->getPhoto()); mFullName = mFriendModel->getFullName(); auto defaultAddress = contact->getAddress(); + if (!defaultAddress) { + for (auto &address : contact->getAddresses()) { + if (address) { + defaultAddress = address; + break; + } + } + } auto vcard = contact->getVcard(); if (vcard) { mOrganization = Utils::coreStringToAppString(vcard->getOrganization()); @@ -731,7 +739,7 @@ bool FriendCore::getReadOnly() const { // [misc]vcards-contacts-list= & CardDAV } -std::shared_ptr FriendCore::getFriendModel() { +std::shared_ptr FriendCore::getModel() { return mFriendModel; } diff --git a/Linphone/core/friend/FriendCore.hpp b/Linphone/core/friend/FriendCore.hpp index 0ffe51668..b4df1d73e 100644 --- a/Linphone/core/friend/FriendCore.hpp +++ b/Linphone/core/friend/FriendCore.hpp @@ -147,7 +147,7 @@ public: bool isCardDAV() const; bool getReadOnly() const; - std::shared_ptr getFriendModel(); + std::shared_ptr getModel(); Q_INVOKABLE void remove(); Q_INVOKABLE void save(); diff --git a/Linphone/core/search/MagicSearchList.cpp b/Linphone/core/search/MagicSearchList.cpp index 05f7339de..4f439304f 100644 --- a/Linphone/core/search/MagicSearchList.cpp +++ b/Linphone/core/search/MagicSearchList.cpp @@ -57,8 +57,8 @@ void MagicSearchList::setSelf(const QSharedPointer &me) { auto haveContact = std::find_if(mList.begin(), mList.end(), [friendCore](const QSharedPointer &item) { auto itemCore = item.objectCast(); - auto itemModel = itemCore->getFriendModel(); - auto friendModel = friendCore->getFriendModel(); + auto itemModel = itemCore->getModel(); + auto friendModel = friendCore->getModel(); return itemCore->getDefaultAddress().length() > 0 && itemCore->getDefaultAddress() == friendCore->getDefaultAddress() || itemModel && friendModel && itemModel->getFriend() == friendModel->getFriend() && diff --git a/Linphone/view/CMakeLists.txt b/Linphone/view/CMakeLists.txt index 54d73d826..b9daf643d 100644 --- a/Linphone/view/CMakeLists.txt +++ b/Linphone/view/CMakeLists.txt @@ -133,6 +133,7 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Page/Form/Chat/SelectedChatView.qml view/Page/Form/Contact/ContactDescription.qml view/Page/Form/Contact/ContactEdition.qml + view/Page/Form/Contact/ContactSharedFiles.qml view/Page/Form/Login/LoginPage.qml view/Page/Form/Login/SIPLoginPage.qml view/Page/Form/Meeting/AddParticipantsForm.qml diff --git a/Linphone/view/Control/Container/Main/MainRightPanel.qml b/Linphone/view/Control/Container/Main/MainRightPanel.qml index 7f63c27aa..c9c16c419 100644 --- a/Linphone/view/Control/Container/Main/MainRightPanel.qml +++ b/Linphone/view/Control/Container/Main/MainRightPanel.qml @@ -10,8 +10,9 @@ ColumnLayout { id: mainItem property color panelColor: DefaultStyle.grey_100 property alias headerContentItem: rightPanelHeader.contentItem - property alias content: rightPanelContent.children + property alias content: rightPanelContent.contentItem property alias header: rightPanelHeader + property int contentTopPadding: 0 spacing: 0 Control.Control { @@ -41,16 +42,20 @@ ColumnLayout { } } } - Rectangle { + Control.Control { id: rightPanelContent - color: mainItem.panelColor Layout.fillWidth: true Layout.fillHeight: true - MouseArea { - anchors.fill: parent - onClicked: { - rightPanelContent.forceActiveFocus() - } - } + topPadding: mainItem.contentTopPadding + background: Rectangle { + anchors.fill: parent + color: mainItem.panelColor + MouseArea { + anchors.fill: parent + onClicked: { + rightPanelContent.forceActiveFocus() + } + } + } } } diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index 58f13cd34..9ac57d6d1 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -311,7 +311,6 @@ FocusScope { } content: Control.SplitView { - anchors.fill: parent orientation: Qt.Vertical handle: Rectangle { id: splitViewHandle diff --git a/Linphone/view/Page/Form/Contact/ContactEdition.qml b/Linphone/view/Page/Form/Contact/ContactEdition.qml index 37ad6a7d7..74caaf3db 100644 --- a/Linphone/view/Page/Form/Contact/ContactEdition.qml +++ b/Linphone/view/Page/Form/Contact/ContactEdition.qml @@ -75,7 +75,6 @@ MainRightPanel { content: ContactLayout { id: contactLayoutItem - anchors.fill: parent contact: mainItem.contact button.text: mainItem.saveButtonText button.Keys.onPressed: (event) => { diff --git a/Linphone/view/Page/Form/Contact/ContactSharedFiles.qml b/Linphone/view/Page/Form/Contact/ContactSharedFiles.qml new file mode 100644 index 000000000..90f20549f --- /dev/null +++ b/Linphone/view/Page/Form/Contact/ContactSharedFiles.qml @@ -0,0 +1,60 @@ +import QtCore +import QtQuick +import QtQuick.Controls.Basic as Control +import QtQuick.Dialogs +import QtQuick.Effects +import QtQuick.Layouts +import Linphone +import UtilsCpp +import SettingsCpp +import 'qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js' as Utils +import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle + +MainRightPanel { + id: mainItem + + property FriendGui contact + property int filter + contentTopPadding: Utils.getSizeWithScreenRatio(24) + + property string title: filter === ChatMessageFileProxy.FilterContentType.Medias + //: "Shared medias" + ? qsTr("contact_shared_medias_title") + //: "Shared documents" + : qsTr("contact_shared_documents_title") + + signal close() + + headerContentItem: RowLayout { + Text { + text: mainItem.title + font { + pixelSize: Utils.getSizeWithScreenRatio(20) + weight: Typography.h4.weight + } + } + Item{Layout.fillWidth: true} + Button { + style: ButtonStyle.noBackground + Layout.preferredWidth: Utils.getSizeWithScreenRatio(30) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(30) + icon.source: AppIcons.closeX + icon.width: Utils.getSizeWithScreenRatio(24) + icon.height: Utils.getSizeWithScreenRatio(24) + //: Close %1 + Accessible.name: qsTr("close_accessible_name").arg(mainItem.title) + onClicked: { + mainItem.close() + } + } + } + + content: MessageSharedFilesInfos { + showTitle: false + property var chatObj: mainItem.contact + ? UtilsCpp.getChatForAddress(mainItem.contact.core.defaultAddress) + : null + chatGui: chatObj && chatObj.value || null + filter: mainItem.filter + } +} \ No newline at end of file diff --git a/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml b/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml index 4c40fffd9..c15ddb955 100644 --- a/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml +++ b/Linphone/view/Page/Layout/Chat/MessageInfosLayout.qml @@ -22,12 +22,15 @@ ColumnLayout { property alias listView: listView property var parentView property alias content: contentLayout.children + property bool showTitle: true spacing: Utils.getSizeWithScreenRatio(25) signal goBackRequested() RowLayout { + id: titleLayout + visible: mainItem.showTitle BigButton { icon.source: AppIcons.leftArrow style: ButtonStyle.noBackground diff --git a/Linphone/view/Page/Main/Contact/ContactPage.qml b/Linphone/view/Page/Main/Contact/ContactPage.qml index 135270a1d..082f2c4e7 100644 --- a/Linphone/view/Page/Main/Contact/ContactPage.qml +++ b/Linphone/view/Page/Main/Contact/ContactPage.qml @@ -612,40 +612,85 @@ AbstractMainPage { } } ContactDetailLayout { - visible: false//!SettingsCpp.disableChatFeature - //: "Medias" - label: qsTr("contact_details_medias_title") + visible: !SettingsCpp.disableChatFeature + //: "Medias & documents" + label: qsTr("contact_details_medias_and_documents_title") Layout.fillWidth: true - content: Button { - style: ButtonStyle.noBackground - contentItem: RowLayout { - EffectImage { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - imageSource: AppIcons.shareNetwork - colorizationColor: DefaultStyle.main2_600 - } - Text { - //: "Afficher les medias partagés" - text: qsTr("contact_details_medias_subtitle") - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight + content: ColumnLayout { + spacing: Utils.getSizeWithScreenRatio(10) + Button { + Layout.fillWidth: true + style: ButtonStyle.noBackground + contentItem: RowLayout { + EffectImage { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageSource: AppIcons.shareNetwork + colorizationColor: DefaultStyle.main2_600 + } + Text { + //: "Show shared medias" + text: qsTr("contact_details_medias_subtitle") + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + Item { + Layout.fillWidth: true + } + EffectImage { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageSource: AppIcons.rightArrow + colorizationColor: DefaultStyle.main2_600 } } - Item { - Layout.fillWidth: true - } - EffectImage { - Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) - imageSource: AppIcons.rightArrow - colorizationColor: DefaultStyle.main2_600 + onClicked: { + rightPanelStackView.push(contactSharedFiles, { + "filter": ChatMessageFileProxy.FilterContentType.Medias}) } + Accessible.name: qsTr("contact_details_medias_subtitle") + } + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(1) + color: DefaultStyle.main2_200 + } + Button { + Layout.fillWidth: true + style: ButtonStyle.noBackground + contentItem: RowLayout { + EffectImage { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageSource: AppIcons.pdf + colorizationColor: DefaultStyle.main2_600 + } + Text { + //: "Show shared documents" + text: qsTr("contact_details_documents_subtitle") + font { + pixelSize: Typography.p1.pixelSize + weight: Typography.p1.weight + } + } + Item { + Layout.fillWidth: true + } + EffectImage { + Layout.preferredWidth: Utils.getSizeWithScreenRatio(24) + Layout.preferredHeight: Utils.getSizeWithScreenRatio(24) + imageSource: AppIcons.rightArrow + colorizationColor: DefaultStyle.main2_600 + } + } + onClicked: { + rightPanelStackView.push(contactSharedFiles, { + "filter": ChatMessageFileProxy.FilterContentType.Documents}) + } + Accessible.name: qsTr("contact_details_documents_subtitle") } - onClicked: console.debug( - "TODO : go to shared media") - Accessible.name: qsTr("contact_details_medias_subtitle") } } ContactDetailLayout { @@ -884,4 +929,12 @@ AbstractMainPage { } } } + + Component { + id: contactSharedFiles + ContactSharedFiles { + contact: mainItem.selectedContact + onClose: rightPanelStackView.pop() + } + } }