From bdca325aafb8a21f86957ae372797afb2462c1f8 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 16 Oct 2024 17:04:00 +0200 Subject: [PATCH] Fix menu size in details call logs and add focus for escaping. --- Linphone/view/Page/Layout/Main/MainLayout.qml | 1 - Linphone/view/Page/Main/Call/CallPage.qml | 138 +++++++++++------- 2 files changed, 83 insertions(+), 56 deletions(-) diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index 3e124ccc..e6c66ad8 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -119,7 +119,6 @@ Item { Binding on currentIndex { when: mainItem.contextualMenuOpenedComponent != undefined value: -1 - restoreMode: Binding.RestoreBindingOrValue } model: [ {icon: AppIcons.phone, selectedIcon: AppIcons.phoneSelected, label: qsTr("Appels")}, diff --git a/Linphone/view/Page/Main/Call/CallPage.qml b/Linphone/view/Page/Main/Call/CallPage.qml index 03c0ec4c..39651b2d 100644 --- a/Linphone/view/Page/Main/Call/CallPage.qml +++ b/Linphone/view/Page/Main/Call/CallPage.qml @@ -664,64 +664,92 @@ AbstractMainPage { popup.x: width property var friendGuiObj: UtilsCpp.findFriendByAddress(contactDetail.contactAddress) property var friendGui: friendGuiObj ? friendGuiObj.value : null - popup.contentItem: ColumnLayout { - Button { - background: Item {} - contentItem: IconLabel { + popup.contentItem: FocusScope { + implicitHeight: detailsButtons.implicitHeight + implicitWidth: detailsButtons.implicitWidth + Keys.onPressed: (event)=> { + if (event.key == Qt.Key_Left || event.key == Qt.Key_Escape) { + detailOptions.popup.close() + event.accepted = true; + } + } + ColumnLayout { + id: detailsButtons + anchors.fill: parent + Button { text: detailOptions.friendGui ? qsTr("Voir le contact") : qsTr("Ajouter aux contacts") - iconSource: AppIcons.plusCircle - } - onClicked: { - detailOptions.close() - if (detailOptions.friendGui) mainWindow.displayContactPage(contactDetail.contactAddress) - else mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress) - } - } - Button { - background: Item {} - contentItem: IconLabel { - text: qsTr("Copier l'adresse SIP") - iconSource: AppIcons.copy - } - onClicked: { - detailOptions.close() - var success = UtilsCpp.copyToClipboard(mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress) - if (success) UtilsCpp.showInformationPopup(qsTr("Copié"), qsTr("L'adresse a été copiée dans le presse-papier"), true) - else UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Erreur lors de la copie de l'adresse"), false) - } - } - // Button { - // background: Item {} - // enabled: false - // contentItem: IconLabel { - // text: qsTr("Bloquer") - // iconSource: AppIcons.empty - // } - // onClicked: console.debug("[CallPage.qml] TODO : block user") - // } - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: 2 * DefaultStyle.dp - color: DefaultStyle.main2_400 - } - - Button { - background: Item {} - contentItem: IconLabel { - text: qsTr("Supprimer l'historique") - iconSource: AppIcons.trashCan - colorizationColor: DefaultStyle.danger_500main - } - Connections { - target: deleteForUserPopup - function onAccepted() { - detailListView.model.removeEntriesWithFilter() - mainItem.listViewUpdated() + icon.source: AppIcons.plusCircle + icon.width: 24 * DefaultStyle.dp + icon.height: 24 * DefaultStyle.dp + spacing: 10 * DefaultStyle.dp + textSize: 14 * DefaultStyle.dp + textWeight: 400 * DefaultStyle.dp + textColor: DefaultStyle.main2_500main + contentImageColor: DefaultStyle.main2_600 + background: Item {} + onClicked: { + detailOptions.close() + if (detailOptions.friendGui) mainWindow.displayContactPage(contactDetail.contactAddress) + else mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress) } } - onClicked: { - detailOptions.close() - deleteForUserPopup.open() + Button { + text: qsTr("Copier l'adresse SIP") + icon.source: AppIcons.copy + icon.width: 24 * DefaultStyle.dp + icon.height: 24 * DefaultStyle.dp + spacing: 10 * DefaultStyle.dp + textSize: 14 * DefaultStyle.dp + textWeight: 400 * DefaultStyle.dp + textColor: DefaultStyle.main2_500main + contentImageColor: DefaultStyle.main2_600 + background: Item {} + + onClicked: { + detailOptions.close() + var success = UtilsCpp.copyToClipboard(mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress) + if (success) UtilsCpp.showInformationPopup(qsTr("Copié"), qsTr("L'adresse a été copiée dans le presse-papier"), true) + else UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Erreur lors de la copie de l'adresse"), false) + } + } + // Button { + // background: Item {} + // enabled: false + // contentItem: IconLabel { + // text: qsTr("Bloquer") + // iconSource: AppIcons.empty + // } + // onClicked: console.debug("[CallPage.qml] TODO : block user") + // } + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: 2 * DefaultStyle.dp + color: DefaultStyle.main2_400 + } + + Button { + text: qsTr("Supprimer l'historique") + icon.source: AppIcons.trashCan + icon.width: 24 * DefaultStyle.dp + icon.height: 24 * DefaultStyle.dp + spacing: 10 * DefaultStyle.dp + textSize: 14 * DefaultStyle.dp + textWeight: 400 * DefaultStyle.dp + textColor: DefaultStyle.danger_500main + contentImageColor: DefaultStyle.danger_500main + background: Item {} + + Connections { + target: deleteForUserPopup + function onAccepted() { + detailListView.model.removeEntriesWithFilter() + mainItem.listViewUpdated() + } + } + onClicked: { + detailOptions.close() + deleteForUserPopup.open() + } } } }