Add user information to the invitation page
Currently the invite page kinda sucks. If someone invites you to a room, you have no idea who from the UI - which is a safety issue. Now the invite page shows you who invited you, and it has a slightly different layout & text for one-on-one chats and room invites. Also the buttons on this page are improved with fixed capitalization and icons!
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
|
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
|
||||||
|
// SPDX-FileCopyrightText: 2025 Joshua Goins <josh@redstrate.com>
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
@@ -6,22 +7,89 @@ import QtQuick.Controls as QQC2
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
import org.kde.kirigamiaddons.components as KirigamiComponents
|
||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
Kirigami.PlaceholderMessage {
|
ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property NeoChatRoom currentRoom
|
required property NeoChatRoom currentRoom
|
||||||
|
readonly property var invitingMember: currentRoom.member(currentRoom.invitingUserId())
|
||||||
|
|
||||||
text: i18n("Accept this invitation?")
|
spacing: Kirigami.Units.smallSpacing
|
||||||
explanation: root.currentRoom.connection.canCheckMutualRooms ? i18n("You can reject invitations from unknown users under Security settings.") : ""
|
|
||||||
RowLayout {
|
KirigamiComponents.Avatar {
|
||||||
|
id: avatar
|
||||||
|
Layout.preferredWidth: Kirigami.Units.iconSizes.huge
|
||||||
|
Layout.preferredHeight: Kirigami.Units.iconSizes.huge
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
|
name: root.invitingMember.displayName
|
||||||
|
source: root.invitingMember.avatarUrl
|
||||||
|
color: root.invitingMember.color
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: !root.currentRoom.isDirectChat()
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
|
sourceComponent: ColumnLayout {
|
||||||
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
|
QQC2.Label {
|
||||||
|
text: i18nc("@info:label", "%1 has invited you to join", root.invitingMember.displayName)
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Kirigami.Heading {
|
||||||
|
text: root.currentRoom.displayName
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: root.currentRoom.isDirectChat()
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
|
sourceComponent: ColumnLayout {
|
||||||
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
|
Kirigami.Heading {
|
||||||
|
text: root.currentRoom.displayName
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.Label {
|
||||||
|
text: i18nc("@info:label", "is inviting you to chat.")
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QQC2.Label {
|
||||||
|
color: Kirigami.Theme.disabledTextColor
|
||||||
|
text: i18n("You can reject invitations from unknown users under Security settings.")
|
||||||
|
visible: root.currentRoom.connection.canCheckMutualRooms
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
Layout.topMargin: Kirigami.Units.mediumSpacing
|
||||||
|
|
||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: i18nc("@action:button The thing being rejected is an invitation to chat", "Reject and ignore user")
|
text: i18nc("@action:button The thing being rejected is an invitation to chat", "Reject and Ignore User")
|
||||||
|
icon.name: "list-remove-symbolic"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
RoomManager.leaveRoom(root.currentRoom);
|
RoomManager.leaveRoom(root.currentRoom);
|
||||||
@@ -30,18 +98,18 @@ Kirigami.PlaceholderMessage {
|
|||||||
}
|
}
|
||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: i18n("Reject")
|
icon.name: "cards-block-symbolic"
|
||||||
|
text: i18nc("@action:button", "Reject")
|
||||||
|
|
||||||
onClicked: RoomManager.leaveRoom(root.currentRoom)
|
onClicked: RoomManager.leaveRoom(root.currentRoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.Button {
|
QQC2.Button {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: i18n("Accept")
|
icon.name: "dialog-ok-symbolic"
|
||||||
|
text: i18nc("@action:button", "Accept")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: root.currentRoom.acceptInvitation()
|
||||||
root.currentRoom.acceptInvitation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user