Access to shared medias and documents from contact page #LINQT-2432

This commit is contained in:
Gaelle Braud 2026-03-17 16:31:50 +01:00
parent f99399d83c
commit 2817e48a68
10 changed files with 172 additions and 44 deletions

View file

@ -54,6 +54,14 @@ FriendCore::FriendCore(const std::shared_ptr<linphone::Friend> &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=<URL> & CardDAV
}
std::shared_ptr<FriendModel> FriendCore::getFriendModel() {
std::shared_ptr<FriendModel> FriendCore::getModel() {
return mFriendModel;
}

View file

@ -147,7 +147,7 @@ public:
bool isCardDAV() const;
bool getReadOnly() const;
std::shared_ptr<FriendModel> getFriendModel();
std::shared_ptr<FriendModel> getModel();
Q_INVOKABLE void remove();
Q_INVOKABLE void save();

View file

@ -57,8 +57,8 @@ void MagicSearchList::setSelf(const QSharedPointer<MagicSearchList> &me) {
auto haveContact =
std::find_if(mList.begin(), mList.end(), [friendCore](const QSharedPointer<QObject> &item) {
auto itemCore = item.objectCast<FriendCore>();
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() &&

View file

@ -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

View file

@ -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()
}
}
}
}
}

View file

@ -311,7 +311,6 @@ FocusScope {
}
content: Control.SplitView {
anchors.fill: parent
orientation: Qt.Vertical
handle: Rectangle {
id: splitViewHandle

View file

@ -75,7 +75,6 @@ MainRightPanel {
content: ContactLayout {
id: contactLayoutItem
anchors.fill: parent
contact: mainItem.contact
button.text: mainItem.saveButtonText
button.Keys.onPressed: (event) => {

View file

@ -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
}
}

View file

@ -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

View file

@ -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()
}
}
}