Fix menu size in details call logs and add focus for escaping.

This commit is contained in:
Julien Wadel 2024-10-16 17:04:00 +02:00
parent 6f2e1af53a
commit bdca325aaf
2 changed files with 83 additions and 56 deletions

View file

@ -119,7 +119,6 @@ Item {
Binding on currentIndex { Binding on currentIndex {
when: mainItem.contextualMenuOpenedComponent != undefined when: mainItem.contextualMenuOpenedComponent != undefined
value: -1 value: -1
restoreMode: Binding.RestoreBindingOrValue
} }
model: [ model: [
{icon: AppIcons.phone, selectedIcon: AppIcons.phoneSelected, label: qsTr("Appels")}, {icon: AppIcons.phone, selectedIcon: AppIcons.phoneSelected, label: qsTr("Appels")},

View file

@ -664,13 +664,29 @@ AbstractMainPage {
popup.x: width popup.x: width
property var friendGuiObj: UtilsCpp.findFriendByAddress(contactDetail.contactAddress) property var friendGuiObj: UtilsCpp.findFriendByAddress(contactDetail.contactAddress)
property var friendGui: friendGuiObj ? friendGuiObj.value : null property var friendGui: friendGuiObj ? friendGuiObj.value : null
popup.contentItem: ColumnLayout { popup.contentItem: FocusScope {
Button { implicitHeight: detailsButtons.implicitHeight
background: Item {} implicitWidth: detailsButtons.implicitWidth
contentItem: IconLabel { Keys.onPressed: (event)=> {
text: detailOptions.friendGui ? qsTr("Voir le contact") : qsTr("Ajouter aux contacts") if (event.key == Qt.Key_Left || event.key == Qt.Key_Escape) {
iconSource: AppIcons.plusCircle detailOptions.popup.close()
event.accepted = true;
} }
}
ColumnLayout {
id: detailsButtons
anchors.fill: parent
Button {
text: detailOptions.friendGui ? qsTr("Voir le contact") : qsTr("Ajouter aux contacts")
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: { onClicked: {
detailOptions.close() detailOptions.close()
if (detailOptions.friendGui) mainWindow.displayContactPage(contactDetail.contactAddress) if (detailOptions.friendGui) mainWindow.displayContactPage(contactDetail.contactAddress)
@ -678,11 +694,17 @@ AbstractMainPage {
} }
} }
Button { Button {
background: Item {}
contentItem: IconLabel {
text: qsTr("Copier l'adresse SIP") text: qsTr("Copier l'adresse SIP")
iconSource: AppIcons.copy 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: { onClicked: {
detailOptions.close() detailOptions.close()
var success = UtilsCpp.copyToClipboard(mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress) var success = UtilsCpp.copyToClipboard(mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress)
@ -706,12 +728,17 @@ AbstractMainPage {
} }
Button { Button {
background: Item {}
contentItem: IconLabel {
text: qsTr("Supprimer l'historique") text: qsTr("Supprimer l'historique")
iconSource: AppIcons.trashCan icon.source: AppIcons.trashCan
colorizationColor: DefaultStyle.danger_500main 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 { Connections {
target: deleteForUserPopup target: deleteForUserPopup
function onAccepted() { function onAccepted() {
@ -726,6 +753,7 @@ AbstractMainPage {
} }
} }
} }
}
detailContent: RoundedPane { detailContent: RoundedPane {
id: detailControl id: detailControl
Layout.preferredWidth: 360 * DefaultStyle.dp Layout.preferredWidth: 360 * DefaultStyle.dp