Port away from applicationWindow()
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
@@ -16,8 +17,6 @@ Kirigami.Dialog {
|
||||
|
||||
required property NeoChatConnection connection
|
||||
|
||||
parent: applicationWindow().overlay
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
@@ -25,7 +24,7 @@ Kirigami.Dialog {
|
||||
|
||||
standardButtons: Kirigami.Dialog.NoButton
|
||||
|
||||
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
|
||||
width: Math.min(QQC2.ApplicationWindow.window.width, Kirigami.Units.gridUnit * 24)
|
||||
title: i18nc("@title: dialog to switch between logged in accounts", "Switch Account")
|
||||
|
||||
onVisibleChanged: if (visible) {
|
||||
|
||||
@@ -48,7 +48,7 @@ ColumnLayout {
|
||||
onClicked: {
|
||||
let imageEditor = (Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(imageEditorPage);
|
||||
imageEditor.newPathChanged.connect(function (newPath) {
|
||||
applicationWindow().pageStack.layers.pop();
|
||||
imageEditor.closeDialog();
|
||||
root.attachmentPath = newPath;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ Kirigami.Dialog {
|
||||
|
||||
standardButtons: Kirigami.Dialog.NoButton
|
||||
|
||||
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
|
||||
width: Math.min(QQC2.ApplicationWindow.window.width, Kirigami.Units.gridUnit * 24)
|
||||
title: i18nc("@title:dialog", "Join Room")
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
|
||||
@@ -336,7 +336,7 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
function handleShare(): void {
|
||||
const dialog = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ChooseRoomDialog'), {
|
||||
const dialog = root.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ChooseRoomDialog'), {
|
||||
connection: root.connection
|
||||
}, {
|
||||
title: i18nc("@title", "Share"),
|
||||
|
||||
@@ -34,7 +34,7 @@ Kirigami.Dialog {
|
||||
}
|
||||
]
|
||||
|
||||
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
|
||||
width: Math.min(QQC2.ApplicationWindow.window.width, Kirigami.Units.gridUnit * 24)
|
||||
title: i18nc("@title: create new poll in the room", "Create Poll")
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
|
||||
@@ -15,8 +15,6 @@ Kirigami.Dialog {
|
||||
|
||||
property var connection
|
||||
|
||||
parent: applicationWindow().overlay
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
@@ -24,7 +22,7 @@ Kirigami.Dialog {
|
||||
|
||||
title: i18nc("@title Join <name of a space>", "Join %1", SpaceHierarchyCache.recommendedSpaceDisplayName)
|
||||
|
||||
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
|
||||
width: Math.min(QQC2.ApplicationWindow.window.width, Kirigami.Units.gridUnit * 24)
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
FormCard.AbstractFormDelegate {
|
||||
|
||||
@@ -63,9 +63,9 @@ Kirigami.Page {
|
||||
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
visible: Kirigami.Settings.isMobile || !applicationWindow().pageStack.wideMode
|
||||
visible: Kirigami.Settings.isMobile || !root.Kirigami.PageStack.pageStack.wideMode
|
||||
icon.name: "view-right-new"
|
||||
onTriggered: applicationWindow().openRoomDrawer()
|
||||
onTriggered: (root.QQC2.ApplicationWindow.window as Main).openRoomDrawer()
|
||||
}
|
||||
]
|
||||
|
||||
@@ -202,7 +202,7 @@ Kirigami.Page {
|
||||
}
|
||||
|
||||
function onShowEventSource(eventId) {
|
||||
applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
|
||||
(root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
|
||||
sourceText: root.currentRoom.getEventJsonSource(eventId)
|
||||
}, {
|
||||
title: i18nc("@title:dialog", "Message Source"),
|
||||
|
||||
@@ -23,8 +23,6 @@ Kirigami.Action {
|
||||
text: i18n("Share")
|
||||
tooltip: i18n("Share the selected media")
|
||||
|
||||
visible: false
|
||||
|
||||
/**
|
||||
* This property holds the input data for purpose.
|
||||
*
|
||||
@@ -60,7 +58,7 @@ Kirigami.Action {
|
||||
if (id != root.eventId) {
|
||||
return;
|
||||
}
|
||||
applicationWindow().pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "ShareDialog"), {
|
||||
pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "ShareDialog"), {
|
||||
title: root.text,
|
||||
index: index,
|
||||
model: root._instantiator.model
|
||||
|
||||
@@ -261,7 +261,7 @@ Kirigami.Dialog {
|
||||
icon.name: "delete"
|
||||
icon.color: Kirigami.Theme.negativeTextColor
|
||||
onTriggered: {
|
||||
let dialog = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
|
||||
let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
|
||||
title: i18nc("@title:dialog", "Remove Messages"),
|
||||
placeholder: i18nc("@info:placeholder", "Reason for removing this user's recent messages"),
|
||||
actionText: i18nc("@action:button 'Remove' as in 'Remove these messages'", "Remove"),
|
||||
|
||||
@@ -87,7 +87,7 @@ QQC2.Control {
|
||||
displayHint: Kirigami.DisplayHint.IconOnly
|
||||
|
||||
onTriggered: {
|
||||
let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(applicationWindow().overlay);
|
||||
let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(root.QQC2.Overlay.overlay);
|
||||
dialog.chosen.connect(path => _private.chatBarCache.attachmentPath = path);
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ QQC2.Popup {
|
||||
padding: 2
|
||||
|
||||
implicitHeight: Kirigami.Units.gridUnit * 20 + 2 * padding
|
||||
width: Math.min(contentItem.categoryIconSize * 11 + 2 * padding, applicationWindow().width)
|
||||
width: Math.min(contentItem.categoryIconSize * 11 + 2 * padding, QQC2.ApplicationWindow.window.width)
|
||||
contentItem: EmojiPicker {
|
||||
id: emojiPicker
|
||||
height: 400
|
||||
|
||||
@@ -121,9 +121,9 @@ ColumnLayout {
|
||||
wrapMode: Text.Wrap
|
||||
onLinkActivated: link => UrlHelper.openUrl(link)
|
||||
onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") {
|
||||
applicationWindow().hoverLinkIndicator.text = hoveredLink;
|
||||
(QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = hoveredLink;
|
||||
} else {
|
||||
applicationWindow().hoverLinkIndicator.text = "";
|
||||
(QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ Item {
|
||||
fillMode: Image.PreserveAspectFit
|
||||
autoTransform: true
|
||||
|
||||
paused: !applicationWindow().active
|
||||
paused: !QQC2.ApplicationWindow.window.active
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
@@ -136,9 +137,9 @@ a{
|
||||
RoomManager.resolveResource(link, "join");
|
||||
}
|
||||
onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") {
|
||||
applicationWindow().hoverLinkIndicator.text = hoveredLink;
|
||||
(QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = hoveredLink;
|
||||
} else {
|
||||
applicationWindow().hoverLinkIndicator.text = "";
|
||||
(QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = "";
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
|
||||
@@ -101,16 +101,16 @@ Kirigami.Page {
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: applicationWindow().pageStack
|
||||
target: root.Kirigami.PageStack.pageStack
|
||||
onWideModeChanged: {
|
||||
if (applicationWindow().pageStack.wideMode) {
|
||||
applicationWindow().pageStack.pop();
|
||||
if ((root.Kirigami.PageStack.pageStack as Kirigami.PageRow).wideMode) {
|
||||
root.Kirigami.PageStack.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onBackRequested: event => {
|
||||
event.accepted = true;
|
||||
applicationWindow().pageStack.pop();
|
||||
Kirigami.PageStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ QQC2.ScrollView {
|
||||
icon.name: "list-add-user"
|
||||
|
||||
onClicked: {
|
||||
applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'InviteUserPage'), {
|
||||
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'InviteUserPage'), {
|
||||
room: root.room
|
||||
}, {
|
||||
title: i18nc("@title", "Invite a User")
|
||||
|
||||
@@ -24,7 +24,7 @@ Kirigami.Dialog {
|
||||
|
||||
title: i18nc("@title", "Select new official parent")
|
||||
|
||||
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
|
||||
width: Math.min(QQC2.ApplicationWindow.window.width, Kirigami.Units.gridUnit * 24)
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
|
||||
@@ -26,14 +26,12 @@ Kirigami.Dialog {
|
||||
*/
|
||||
property list<string> restrictedIds: room.restrictedIds
|
||||
|
||||
parent: applicationWindow().overlay
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
|
||||
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
|
||||
width: Math.min(QQC2.ApplicationWindow.window.width, Kirigami.Units.gridUnit * 24)
|
||||
title: i18nc("@title", "Select Spaces")
|
||||
|
||||
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as QQC2
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
@@ -26,7 +27,7 @@ Kirigami.Dialog {
|
||||
|
||||
title: i18nc("@title", "Remove Child")
|
||||
|
||||
width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
|
||||
width: Math.min(QQC2.ApplicationWindow.window.width, Kirigami.Units.gridUnit * 24)
|
||||
|
||||
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ ColumnLayout {
|
||||
visible: root.room.canSendState("invite")
|
||||
text: i18nc("@button", "Invite user to space")
|
||||
icon.name: "list-add-user"
|
||||
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.libneochat', 'InviteUserPage'), {
|
||||
onClicked: (Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat.libneochat', 'InviteUserPage'), {
|
||||
room: root.room
|
||||
}, {
|
||||
title: i18nc("@title", "Invite a User")
|
||||
|
||||
@@ -89,7 +89,7 @@ KirigamiComponents.ConvergentContextMenu {
|
||||
icon.name: "edit-delete-remove"
|
||||
icon.color: "red"
|
||||
onTriggered: {
|
||||
let dialog = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
|
||||
let dialog = (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
|
||||
title: i18nc("@title:dialog", "Remove Message"),
|
||||
placeholder: i18nc("@info:placeholder", "Reason for removing this message"),
|
||||
actionText: i18nc("@action:button 'Remove' as in 'Remove this message'", "Remove"),
|
||||
@@ -134,7 +134,7 @@ KirigamiComponents.ConvergentContextMenu {
|
||||
icon.name: "dialog-warning-symbolic"
|
||||
visible: !author.isLocalMember
|
||||
onTriggered: {
|
||||
let dialog = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
|
||||
let dialog = (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
|
||||
title: i18nc("@title:dialog", "Report Message"),
|
||||
placeholder: i18nc("@info:placeholder", "Reason for reporting this message"),
|
||||
icon: "dialog-warning-symbolic",
|
||||
@@ -263,8 +263,6 @@ KirigamiComponents.ConvergentContextMenu {
|
||||
bottomPadding: 0
|
||||
topPadding: 0
|
||||
|
||||
parent: applicationWindow().overlay
|
||||
|
||||
QQC2.StackView {
|
||||
id: stackView
|
||||
width: parent.width
|
||||
|
||||
@@ -99,26 +99,7 @@ DelegateContextMenu {
|
||||
separator: true
|
||||
}
|
||||
|
||||
Kirigami.Action {
|
||||
visible: author.id === currentRoom.localMember.id || currentRoom.canSendState("redact")
|
||||
text: i18n("Remove…")
|
||||
icon.name: "edit-delete-remove"
|
||||
icon.color: "red"
|
||||
onTriggered: {
|
||||
let dialog = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
|
||||
title: i18nc("@title:dialog", "Remove Message"),
|
||||
placeholder: i18nc("@info:placeholder", "Reason for removing this message"),
|
||||
actionText: i18nc("@action:button 'Remove' as in 'Remove this message'", "Remove"),
|
||||
icon: "delete"
|
||||
}, {
|
||||
title: i18nc("@title:dialog", "Remove Message"),
|
||||
width: Kirigami.Units.gridUnit * 25
|
||||
});
|
||||
dialog.accepted.connect(reason => {
|
||||
currentRoom.redactEvent(root.eventId, reason);
|
||||
});
|
||||
}
|
||||
}
|
||||
DelegateContextMenu.RemoveMessageAction {}
|
||||
|
||||
DelegateContextMenu.PinMessageAction {}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ DelegateContextMenu {
|
||||
text: i18nc("@action:inmenu As in 'Forward this message'", "Forward…")
|
||||
icon.name: "mail-forward-symbolic"
|
||||
onTriggered: {
|
||||
let page = applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ChooseRoomDialog'), {
|
||||
let page = (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ChooseRoomDialog'), {
|
||||
connection: root.connection
|
||||
}, {
|
||||
title: i18nc("@title", "Forward Message"),
|
||||
|
||||
@@ -8,6 +8,7 @@ import QtQuick.Layouts
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.components as KirigamiComponents
|
||||
|
||||
import org.kde.neochat
|
||||
import org.kde.neochat.libneochat as LibNeoChat
|
||||
|
||||
QQC2.ScrollView {
|
||||
@@ -137,7 +138,7 @@ QQC2.ScrollView {
|
||||
if (!messageListView.atYEnd || !_private.room.partiallyReadStats.empty()) {
|
||||
messageListView.positionViewAtBeginning();
|
||||
} else {
|
||||
applicationWindow().pageStack.get(0).forceActiveFocus();
|
||||
(root.Kirigami.PageStack.pageStack as Kirigami.PageRow).get(0).forceActiveFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,7 +150,7 @@ QQC2.ScrollView {
|
||||
target: messageListView.model.sourceModel.timelineMessageModel
|
||||
|
||||
function onModelAboutToBeReset() {
|
||||
applicationWindow().hoverLinkIndicator.text = "";
|
||||
(root.QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = "";
|
||||
_private.hasScrolledUpBefore = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user