Move direct chat confirmation dialog to separate file
This commit is contained in:
@@ -271,6 +271,7 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
|
||||
qml/CodeMaximizeComponent.qml
|
||||
qml/EditStateDialog.qml
|
||||
qml/ConsentDialog.qml
|
||||
qml/AskDirectChatConfirmation.qml
|
||||
)
|
||||
|
||||
add_subdirectory(settings)
|
||||
|
||||
40
src/qml/AskDirectChatConfirmation.qml
Normal file
40
src/qml/AskDirectChatConfirmation.qml
Normal file
@@ -0,0 +1,40 @@
|
||||
// SPDX-FileCopyrightText: 2024 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
Kirigami.Dialog {
|
||||
id: root
|
||||
|
||||
required property var user
|
||||
|
||||
width: Math.min(Kirigami.Units.gridUnit * 24, QQC2.ApplicationWindow.window.width)
|
||||
height: Kirigami.Units.gridUnit * 8
|
||||
|
||||
standardButtons: QQC2.Dialog.Close
|
||||
title: i18nc("@title:dialog", "Start a chat")
|
||||
|
||||
contentItem: QQC2.Label {
|
||||
text: i18n("Do you want to start a chat with %1?", root.user.displayName)
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.Wrap
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
customFooterActions: [
|
||||
Kirigami.Action {
|
||||
text: i18nc("@action:button", "Start Chat")
|
||||
icon.name: "im-user"
|
||||
onTriggered: {
|
||||
root.user.requestDirectChat();
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -125,10 +125,11 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
|
||||
function onAskDirectChatConfirmation(user) {
|
||||
askDirectChatConfirmationComponent.createObject(this, {
|
||||
Qt.createComponent("org.kde.neochat", "AskDirectChatConfirmation").createObject(this, {
|
||||
user: user
|
||||
}).open();
|
||||
}
|
||||
|
||||
function onExternalUrl(url) {
|
||||
let dialog = Qt.createComponent("org.kde.neochat", "ConfirmUrlDialog").createObject(applicationWindow());
|
||||
dialog.link = url;
|
||||
@@ -310,41 +311,6 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: askDirectChatConfirmationComponent
|
||||
|
||||
Kirigami.Dialog {
|
||||
id: askDirectChatConfirmation
|
||||
|
||||
required property var user
|
||||
|
||||
width: Math.min(Kirigami.Units.gridUnit * 24, root.width)
|
||||
height: Kirigami.Units.gridUnit * 8
|
||||
|
||||
standardButtons: QQC2.Dialog.Close
|
||||
title: i18n("Start a chat")
|
||||
|
||||
contentItem: QQC2.Label {
|
||||
text: i18n("Do you want to start a chat with %1?", askDirectChatConfirmation.user.displayName)
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.Wrap
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
customFooterActions: [
|
||||
Kirigami.Action {
|
||||
text: i18nc("@action", "Start Chat")
|
||||
icon.name: "im-user"
|
||||
onTriggered: {
|
||||
askDirectChatConfirmation.user.requestDirectChat();
|
||||
askDirectChatConfirmation.close();
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
property QQC2.Control hoverLinkIndicator: QQC2.Control {
|
||||
parent: root.overlay.parent
|
||||
property alias text: linkText.rawText
|
||||
|
||||
Reference in New Issue
Block a user