diff --git a/src/app/mainview/components/ChatViewHeader.qml b/src/app/mainview/components/ChatViewHeader.qml index 1c5c1f4268f01fd220b9d128cf1537c22474f080..6e0f60df5c29ea2cc33d55a2f1b7a102afe69daf 100644 --- a/src/app/mainview/components/ChatViewHeader.qml +++ b/src/app/mainview/components/ChatViewHeader.qml @@ -199,19 +199,6 @@ Rectangle { onClicked: pluginSelector() } - JamiPushButton { - id: sendContactRequestButton - QWKSetParentHitTestVisible { - } - objectName: "sendContactRequestButton" - - visible: CurrentConversation.isTemporary || CurrentConversation.isBanned - source: JamiResources.add_people_24dp_svg - toolTipText: JamiStrings.addToConversations - - onClicked: CurrentConversation.isBanned ? MessagesAdapter.unbanConversation(CurrentConversation.id) : MessagesAdapter.sendConversationRequest() - } - JamiPushButton { id: searchMessagesButton QWKSetParentHitTestVisible { diff --git a/src/app/mainview/components/SidePanel.qml b/src/app/mainview/components/SidePanel.qml index c564e847afea54d39c7f5d21ec4e07e89423f792..2de2cb67be78455722b61c25127f0613ac6f9dd2 100644 --- a/src/app/mainview/components/SidePanel.qml +++ b/src/app/mainview/components/SidePanel.qml @@ -173,8 +173,10 @@ SidePanelBase { color: JamiTheme.backgroundColor } - header: AccountComboBox { QWKSetParentHitTestVisible {} + header: AccountComboBox { id: accountComboBox + QWKSetParentHitTestVisible { + } Shortcut { sequence: "Ctrl+J" context: Qt.ApplicationShortcut @@ -258,6 +260,13 @@ SidePanelBase { height: parent.height Layout.fillWidth: true + Behavior on width { + NumberAnimation { + duration: 1000 + easing.type: Easing.InOutQuad + } + } + onSearchBarTextChanged: function (text) { // not calling positionViewAtBeginning will cause // sort animation visual bugs @@ -285,7 +294,7 @@ SidePanelBase { preferredSize: startBar.height - visible: !swarmMemberSearchList.visible && CurrentAccount.type !== Profile.Type.SIP + visible: !swarmMemberSearchList.visible && CurrentAccount.type !== Profile.Type.SIP && !contactSearchBar.textContent source: smartListLayout.visible ? JamiResources.create_swarm_svg : JamiResources.round_close_24dp_svg toolTipText: smartListLayout.visible ? JamiStrings.newGroup : JamiStrings.cancel @@ -297,9 +306,7 @@ SidePanelBase { SidePanelTabBar { id: sidePanelTabBar - visible: ConversationsAdapter.pendingRequestCount && - !contactSearchBar.textContent && - smartListLayout.visible + visible: ConversationsAdapter.pendingRequestCount && !contactSearchBar.textContent && smartListLayout.visible contentHeight: childrenRect.height width: page.width @@ -379,6 +386,33 @@ SidePanelBase { } model: ConversationsAdapter.searchListProxyModel + + delegate: SmartListItemDelegate { + extraButtons.contentItem: JamiPushButton { + id: sendContactRequestButton + QWKSetParentHitTestVisible { + } + + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + visible: isTemporary || isBanned + source: JamiResources.add_people_24dp_svg + toolTipText: JamiStrings.addToConversations + + onClicked: { + console.log(isBanned); + if (isBanned) { + LRCInstance.selectConversation(UID); + MessagesAdapter.unbanConversation(CurrentConversation.id); + } else { + LRCInstance.selectConversation(UID); + MessagesAdapter.sendConversationRequest(); + } + } + } + extraButtons.height: sendContactRequestButton.height; + extraButtons.width: sendContactRequestButton.width; + } headerLabel: JamiStrings.searchResults headerVisible: true } diff --git a/src/app/mainview/components/SmartListItemDelegate.qml b/src/app/mainview/components/SmartListItemDelegate.qml index 9e75159e9ea8e252e0e53fde23b0e3528a0d150a..461f40749621c811ffa0bedb6ecfbb6f9d5abcc4 100644 --- a/src/app/mainview/components/SmartListItemDelegate.qml +++ b/src/app/mainview/components/SmartListItemDelegate.qml @@ -33,11 +33,15 @@ ItemDelegate { width: ListView.view.width height: JamiTheme.smartListItemHeight + property alias extraButtons: extraButtons + property string accountId: "" property string convId: "" highlighted: ListView.isCurrentItem property bool interactive: true + property bool isTemporary: false + property bool isBanned: false property int lastInteractionTimeStamp: LastInteractionTimeStamp property string lastInteractionFormattedDate: MessagesAdapter.getBestFormattedDate(lastInteractionTimeStamp) @@ -66,6 +70,8 @@ ItemDelegate { // Store to avoid undefined at the end root.accountId = Qt.binding(() => CurrentAccount.id); root.convId = UID; + root.isTemporary = ContactType == Profile.Type.TEMPORARY; + root.isBanned = isBanned; } RowLayout { @@ -85,6 +91,7 @@ ItemDelegate { Layout.preferredWidth: JamiTheme.smartListAvatarSize Layout.preferredHeight: JamiTheme.smartListAvatarSize + Rectangle { id: overlayHighlighted visible: highlighted && !interactive @@ -239,6 +246,10 @@ ItemDelegate { } } + Control { + id: extraButtons + } + Accessible.role: Accessible.Button Accessible.name: Title === undefined ? "" : Title Accessible.description: LastInteraction === undefined ? "" : LastInteraction diff --git a/tests/qml/src/tst_ChatView.qml b/tests/qml/src/tst_ChatView.qml index b58af8c7e81b3bf67a41164dfdfea641bbc42391..c74d4fbe6f015945bbc0b9fc7509e4210aa7f04d 100644 --- a/tests/qml/src/tst_ChatView.qml +++ b/tests/qml/src/tst_ChatView.qml @@ -46,9 +46,7 @@ ListSelectionView { function test_checkBasicVisibility() { var chatviewHeader = findChild(uut, "chatViewHeader") var detailsButton = findChild(chatviewHeader, "detailsButton") - var sendContactRequestButton = findChild(chatviewHeader, "sendContactRequestButton") compare(detailsButton.visible, true) - compare(sendContactRequestButton.visible, false) var chatViewFooter = findChild(uut, "chatViewFooter") CurrentConversation.isTemporary = true