mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-21 21:52:03 +02:00
add_contact: refactor and change behavior
Change-Id: Ie8cfa5a39b25cd34c7706596a1c607dd1b8c8060
This commit is contained in:
parent
0f7e33cf33
commit
7fdd2f5740
4 changed files with 50 additions and 20 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue