Why can't we be friends
Update the UX to refer to structure direct chats as friends. The direct chats are pulled into their own tab in the space drawer. The `UserDetailDialog` is also updated to check whether a direct chat already exists and if not ask to invite as friend. 
This commit is contained in:
@@ -196,6 +196,7 @@ Kirigami.Page {
|
||||
listView.currentIndex = sortFilterRoomListModel.mapFromSource(itemSelection.currentIndex).row
|
||||
}
|
||||
activeSpaceId: spaceDrawer.selectedSpaceId
|
||||
mode: spaceDrawer.showDirectChats ? SortFilterRoomListModel.DirectChats : SortFilterRoomListModel.Rooms
|
||||
}
|
||||
|
||||
section {
|
||||
|
||||
@@ -23,6 +23,8 @@ QQC2.Control {
|
||||
|
||||
property string selectedSpaceId
|
||||
|
||||
property bool showDirectChats: false
|
||||
|
||||
contentItem: Loader {
|
||||
id: sidebarColumn
|
||||
z: 0
|
||||
@@ -86,8 +88,56 @@ QQC2.Control {
|
||||
source: "globe"
|
||||
}
|
||||
|
||||
checked: root.selectedSpaceId === ""
|
||||
onClicked: root.selectedSpaceId = ""
|
||||
checked: root.selectedSpaceId === "" && root.showDirectChats === false
|
||||
onClicked: {
|
||||
root.showDirectChats = false
|
||||
root.selectedSpaceId = ""
|
||||
}
|
||||
}
|
||||
AvatarTabButton {
|
||||
id: directChatButton
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width - Kirigami.Units.smallSpacing
|
||||
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
|
||||
Layout.topMargin: Kirigami.Units.smallSpacing / 2
|
||||
|
||||
text: i18nc("@button View all one-on-one chats with your friends.", "Friends")
|
||||
contentItem: Kirigami.Icon {
|
||||
source: "system-users"
|
||||
}
|
||||
|
||||
checked: root.showDirectChats === true
|
||||
onClicked: {
|
||||
root.showDirectChats = true
|
||||
root.selectedSpaceId = ""
|
||||
}
|
||||
|
||||
QQC2.Label {
|
||||
id: notificationCountLabel
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Kirigami.Units.smallSpacing / 2
|
||||
z: 1
|
||||
width: Math.max(notificationCountTextMetrics.advanceWidth + Kirigami.Units.smallSpacing * 2, height)
|
||||
height: Kirigami.Units.iconSizes.smallMedium
|
||||
|
||||
text: root.connection.directChatNotifications > 0 ? root.connection.directChatNotifications : ""
|
||||
visible: root.connection.directChatNotifications > 0 || root.connection.directChatInvites
|
||||
color: Kirigami.Theme.textColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
background: Rectangle {
|
||||
visible: true
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Button
|
||||
color: Kirigami.Theme.positiveTextColor
|
||||
radius: height / 2
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
id: notificationCountTextMetrics
|
||||
text: notificationCountLabel.text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
@@ -117,7 +167,10 @@ QQC2.Control {
|
||||
text: displayName
|
||||
source: avatar ? ("image://mxc/" + avatar) : ""
|
||||
|
||||
onSelected: root.selectedSpaceId = roomId
|
||||
onSelected: {
|
||||
root.showDirectChats = false
|
||||
root.selectedSpaceId = roomId
|
||||
}
|
||||
checked: root.selectedSpaceId === roomId
|
||||
onContextMenuRequested: root.createContextMenu(currentRoom)
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ Kirigami.Dialog {
|
||||
FormCard.FormButtonDelegate {
|
||||
visible: !root.user.isLocalUser
|
||||
action: Kirigami.Action {
|
||||
text: i18n("Open a private chat")
|
||||
text: root.room.connection.directChatExists(root.user.object) ? i18nc("%1 is the name of the user.", "Chat with %1", root.user.displayName) : i18n("Invite to private chat")
|
||||
icon.name: "document-send"
|
||||
onTriggered: {
|
||||
root.room.connection.openOrCreateDirectChat(root.user.object)
|
||||
|
||||
Reference in New Issue
Block a user