Fix various qml warnings
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2024 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Qt.labs.qmlmodels
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
@@ -34,7 +36,7 @@ QQC2.Control {
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: Kirigami.Units.largeSpacing
|
||||
Layout.preferredHeight: active ? item.implicitHeight : 0
|
||||
Layout.preferredHeight: active ? (item as Item).implicitHeight : 0
|
||||
|
||||
active: visible
|
||||
visible: root.chatBarCache.replyId.length > 0 || root.chatBarCache.attachmentPath.length > 0
|
||||
@@ -71,7 +73,7 @@ QQC2.Control {
|
||||
root.chatBarCache.text = text;
|
||||
}
|
||||
|
||||
Keys.onEnterPressed: {
|
||||
Keys.onEnterPressed: event => {
|
||||
if (completionMenu.visible) {
|
||||
completionMenu.complete();
|
||||
} else if (event.modifiers & Qt.ShiftModifier) {
|
||||
@@ -80,7 +82,7 @@ QQC2.Control {
|
||||
_private.post();
|
||||
}
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
Keys.onReturnPressed: event => {
|
||||
if (completionMenu.visible) {
|
||||
completionMenu.complete();
|
||||
} else if (event.modifiers & Qt.ShiftModifier) {
|
||||
@@ -108,7 +110,7 @@ QQC2.Control {
|
||||
height: implicitHeight
|
||||
y: -height - 5
|
||||
z: 10
|
||||
connection: root.Message.room.connection
|
||||
connection: root.Message.room.connection as NeoChatConnection
|
||||
chatDocumentHandler: documentHandler
|
||||
margins: 0
|
||||
Behavior on height {
|
||||
@@ -165,7 +167,7 @@ QQC2.Control {
|
||||
text: i18nc("@action:button", "Attach an image or file")
|
||||
icon.name: "mail-attachment"
|
||||
onClicked: {
|
||||
let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(QQC2.Overlay.overlay);
|
||||
let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(QQC2.Overlay.overlay) as QQC2.Dialog;
|
||||
dialog.chosen.connect(path => root.chatBarCache.attachmentPath = path);
|
||||
dialog.open();
|
||||
}
|
||||
@@ -225,8 +227,6 @@ QQC2.Control {
|
||||
Message.maxContentWidth: paneLoader.item.width
|
||||
}
|
||||
QQC2.Button {
|
||||
id: cancelButton
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
|
||||
@@ -261,9 +261,9 @@ QQC2.Control {
|
||||
function updateText() {
|
||||
// This could possibly be undefined due to some esoteric QtQuick issue. Referencing it somewhere in JS is enough.
|
||||
documentHandler.document;
|
||||
if (chatBarCache?.isEditing && chatBarCache.relationMessage.length > 0) {
|
||||
textArea.text = chatBarCache.relationMessage;
|
||||
documentHandler.updateMentions(chatBarCache.editId);
|
||||
if (root.chatBarCache?.isEditing && root.chatBarCache.relationMessage.length > 0) {
|
||||
textArea.text = root.chatBarCache.relationMessage;
|
||||
documentHandler.updateMentions(root.chatBarCache.editId);
|
||||
textArea.forceActiveFocus();
|
||||
textArea.cursorPosition = textArea.text.length;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2024 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Qt.labs.qmlmodels
|
||||
@@ -117,6 +119,7 @@ DelegateChooser {
|
||||
DelegateChoice {
|
||||
roleValue: MessageComponentType.Location
|
||||
delegate: MimeComponent {
|
||||
required property string display
|
||||
mimeIconSource: "mark-location"
|
||||
label: display
|
||||
}
|
||||
@@ -125,6 +128,7 @@ DelegateChooser {
|
||||
DelegateChoice {
|
||||
roleValue: MessageComponentType.LiveLocation
|
||||
delegate: MimeComponent {
|
||||
required property string display
|
||||
mimeIconSource: "mark-location"
|
||||
label: display
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
@@ -103,7 +104,7 @@ Kirigami.Page {
|
||||
|
||||
Connections {
|
||||
target: root.Kirigami.PageStack.pageStack
|
||||
onWideModeChanged: {
|
||||
function onWideModeChanged(): void {
|
||||
if ((root.Kirigami.PageStack.pageStack as Kirigami.PageRow).wideMode) {
|
||||
root.Kirigami.PageStack.pop();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
@@ -44,7 +46,7 @@ FormCard.FormCardPage {
|
||||
id: accountDelegate
|
||||
required property NeoChatConnection connection
|
||||
Layout.fillWidth: true
|
||||
onClicked: root.QQC2.ApplicationWindow.window.pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
|
||||
onClicked: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
|
||||
connection: accountDelegate.connection
|
||||
}, {
|
||||
title: i18n("Account editor")
|
||||
@@ -124,8 +126,8 @@ FormCard.FormCardPage {
|
||||
property Connections connections: Connections {
|
||||
target: Controller
|
||||
function onConnectionAdded() {
|
||||
if (pageStack.layers.depth > 2) {
|
||||
pageStack.layers.pop();
|
||||
if ((root.Kirigami.PageStack.pageStack as Kirigami.PageRow).layers.depth > 2) {
|
||||
(root.Kirigami.PageStack.pageStack as Kirigami.PageRow).layers.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
@@ -27,8 +29,8 @@ FormCard.FormCardPage {
|
||||
FormCard.FormCheckDelegate {
|
||||
text: i18n("Enable notifications for this account")
|
||||
description: {
|
||||
if (connection.pushNotificationsAvailable) {
|
||||
if (connection.enablePushNotifications) {
|
||||
if (root.connection.pushNotificationsAvailable) {
|
||||
if (root.connection.enablePushNotifications) {
|
||||
return i18n("Notifications can appear even when NeoChat isn't running.");
|
||||
} else {
|
||||
return i18n("Push notifications are available but could not be enabled.");
|
||||
@@ -52,8 +54,6 @@ FormCard.FormCardPage {
|
||||
spacing: Kirigami.Units.largeSpacing
|
||||
Kirigami.Icon {
|
||||
source: "data-information"
|
||||
width: Kirigami.Units.iconSizes.sizeForLabels
|
||||
height: Kirigami.Units.iconSizes.sizeForLabels
|
||||
}
|
||||
QQC2.Label {
|
||||
text: i18nc("@info", "These are the default notification settings for all rooms. You can customize notifications per-room in the room list or room settings.")
|
||||
@@ -78,7 +78,7 @@ FormCard.FormCardPage {
|
||||
}
|
||||
}
|
||||
|
||||
delegate: ruleDelegate
|
||||
delegate: root.ruleDelegate
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ FormCard.FormCardPage {
|
||||
}
|
||||
}
|
||||
|
||||
delegate: ruleDelegate
|
||||
delegate: root.ruleDelegate
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ FormCard.FormCardPage {
|
||||
}
|
||||
}
|
||||
|
||||
delegate: ruleDelegate
|
||||
delegate: root.ruleDelegate
|
||||
}
|
||||
FormCard.AbstractFormDelegate {
|
||||
Layout.fillWidth: true
|
||||
@@ -176,7 +176,7 @@ FormCard.FormCardPage {
|
||||
}
|
||||
}
|
||||
|
||||
delegate: ruleDelegate
|
||||
delegate: root.ruleDelegate
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,12 +197,11 @@ FormCard.FormCardPage {
|
||||
}
|
||||
}
|
||||
|
||||
delegate: ruleDelegate
|
||||
delegate: root.ruleDelegate
|
||||
}
|
||||
}
|
||||
|
||||
property Component ruleDelegate: Component {
|
||||
id: ruleDelegate
|
||||
NotificationRuleItem {
|
||||
onDeleteRule: {
|
||||
root.pushRuleModel.removeKeyword(id);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2024 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
@@ -37,6 +39,8 @@ FormCard.FormCardPage {
|
||||
id: repeater
|
||||
model: root.connection.ignoredUsers()
|
||||
delegate: FormCard.AbstractFormDelegate {
|
||||
id: ignoredUserDelegate
|
||||
required property string modelData
|
||||
topPadding: Kirigami.Units.smallSpacing
|
||||
bottomPadding: Kirigami.Units.smallSpacing
|
||||
|
||||
@@ -46,7 +50,7 @@ FormCard.FormCardPage {
|
||||
|
||||
QQC2.Label {
|
||||
Layout.fillWidth: true
|
||||
text: modelData
|
||||
text: ignoredUserDelegate.modelData
|
||||
elide: Text.ElideRight
|
||||
Accessible.ignored: true // base class sets this text on root already
|
||||
}
|
||||
@@ -54,7 +58,7 @@ FormCard.FormCardPage {
|
||||
QQC2.ToolButton {
|
||||
text: i18nc("@action:button", "Unignore this user")
|
||||
icon.name: "list-remove-symbolic"
|
||||
onClicked: root.connection.removeFromIgnoredUsers(modelData)
|
||||
onClicked: root.connection.removeFromIgnoredUsers(ignoredUserDelegate.modelData)
|
||||
display: QQC2.Button.IconOnly
|
||||
QQC2.ToolTip.text: text
|
||||
QQC2.ToolTip.visible: hovered
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
@@ -56,6 +58,7 @@ Kirigami.Dialog {
|
||||
model: root.room.parentObjects(true)
|
||||
|
||||
delegate: FormCard.FormCheckDelegate {
|
||||
id: parentDelegate
|
||||
required property var modelData
|
||||
|
||||
text: modelData.displayName
|
||||
@@ -67,8 +70,8 @@ Kirigami.Dialog {
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
|
||||
|
||||
source: modelData.avatarUrl.toString().length > 0 ? connection.makeMediaUrl(modelData.avatarUrl) : ""
|
||||
name: modelData.displayName
|
||||
source: parentDelegate.modelData.avatarUrl.toString().length > 0 ? root.room.connection.makeMediaUrl(parentDelegate.modelData.avatarUrl) : ""
|
||||
name: parentDelegate.modelData.displayName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import Qt.labs.qmlmodels
|
||||
|
||||
@@ -63,12 +62,10 @@ DelegateChooser {
|
||||
roleValue: DelegateType.Other
|
||||
delegate: NeoChatConfig.showAllEvents ? hiddenDelegate : emptyDelegate
|
||||
|
||||
Component {
|
||||
id: hiddenDelegate
|
||||
property Component hiddenDelegate : Component {
|
||||
HiddenDelegate {}
|
||||
}
|
||||
Component {
|
||||
id: emptyDelegate
|
||||
property Component emptyDelegate : Component {
|
||||
Item {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2020 Black Hat <bhat@encom.eu.org>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user