fix #LINQT-1705 allow adding ldap friend in app contacts

This commit is contained in:
gaelle 2025-03-28 10:41:11 +01:00 committed by Gaelle Braud
parent 62884832c4
commit fb009fa17a
2 changed files with 139 additions and 148 deletions

View file

@ -103,19 +103,13 @@ FocusScope {
Item {
Layout.fillWidth: true
}
Loader {
id: buttonsLayoutLoader
asynchronous: true
active: mainItem.showActions || mainItem.showContactMenu
|| mainItem.multiSelectionEnabled
Layout.rightMargin: active ? Math.round(10 * DefaultStyle.dp) : 0
sourceComponent: RowLayout {
RowLayout {
id: actionsRow
z: 1
visible: actionButtons.visible || friendPopup.visible
|| mainItem.multiSelectionEnabled
visible: mainItem.showActions || actionButtons.visible || mainItem.showContactMenu || mainItem.multiSelectionEnabled
spacing: visible ? Math.round(16 * DefaultStyle.dp) : 0
enabled: visible
Layout.rightMargin: Math.round(5 * DefaultStyle.dp)
EffectImage {
id: isSelectedCheck
visible: mainItem.multiSelectionEnabled
@ -186,9 +180,7 @@ FocusScope {
z: 1
popup.x: 0
popup.padding: Math.round(10 * DefaultStyle.dp)
visible: mainItem.showContactMenu
&& (contactArea.containsMouse || hovered
|| popup.opened)
visible: mainItem.showContactMenu && (contactArea.containsMouse || mainItem.isLastHovered || hovered || popup.opened)
enabled: visible
popup.contentItem: ColumnLayout {
@ -255,7 +247,6 @@ FocusScope {
}
}
}
}
MouseArea {
id: contactArea
@ -265,7 +256,7 @@ FocusScope {
hoverEnabled: true
acceptedButtons: Qt.AllButtons
z: -1
focus: !buttonsLayoutLoader.active
focus: !actionButtons.visible
onContainsMouseChanged: {
mainItem.containsMouseChanged(containsMouse)
}
@ -274,7 +265,7 @@ FocusScope {
radius: Math.round(8 * DefaultStyle.dp)
opacity: 0.7
color: mainItem.isSelected ? DefaultStyle.main2_200 : DefaultStyle.main2_100
visible: mainItem.isLastHovered || mainItem.isSelected
visible: mainItem.isLastHovered || mainItem.isSelected || friendPopup.hovered
}
Keys.onPressed: event => {
if (event.key == Qt.Key_Space
@ -288,7 +279,7 @@ FocusScope {
forceActiveFocus()
if (mouse && mouse.button == Qt.RightButton
&& mainItem.showContactMenu) {
friendPopup.open()
if (friendPopup) friendPopup.open()
} else {
mainItem.clicked(mouse)
}

View file

@ -533,17 +533,17 @@ ConferenceInfoGui{
|| false
property bool isCardDAV: contactDetail.contact?.core?.isCardDAV
|| false
property bool isLocalFriend: contactDetail.contact && !isLdap && !isCardDAV
//: "Voir le contact"
text: contactDetail.contact ? qsTr("menu_see_existing_contact") :
text: isLocalFriend ? qsTr("menu_see_existing_contact") :
//: "Ajouter aux contacts"
qsTr("menu_add_address_to_contacts")
icon.source: AppIcons.plusCircle
icon.width: Math.round(32 * DefaultStyle.dp)
icon.height: Math.round(32 * DefaultStyle.dp)
visible: !isLdap && !isCardDAV
onClicked: {
detailOptions.close()
if (contactDetail.contact)
if (isLocalFriend)
mainWindow.displayContactPage(
contactDetail.contactAddress)
else