Fix qml warnings in ChatBar
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
// SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
|
// SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
@@ -87,9 +89,15 @@ QQC2.Control {
|
|||||||
displayHint: Kirigami.DisplayHint.IconOnly
|
displayHint: Kirigami.DisplayHint.IconOnly
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(root.QQC2.Overlay.overlay);
|
if (Clipboard.hasImage) {
|
||||||
dialog.chosen.connect(path => _private.chatBarCache.attachmentPath = path);
|
let dialog = attachDialog.createObject(root.QQC2.Overlay.overlay) as AttachDialog;
|
||||||
dialog.open();
|
dialog.chosen.connect(path => _private.chatBarCache.attachmentPath = path);
|
||||||
|
dialog.open();
|
||||||
|
} else {
|
||||||
|
let dialog = openFileDialog.createObject(root.QQC2.Overlay.overlay) as OpenFileDialog;
|
||||||
|
dialog.chosen.connect(path => _private.chatBarCache.attachmentPath = path);
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltip: text
|
tooltip: text
|
||||||
@@ -122,9 +130,9 @@ QQC2.Control {
|
|||||||
displayHint: QQC2.AbstractButton.IconOnly
|
displayHint: QQC2.AbstractButton.IconOnly
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
locationChooser.createObject(QQC2.Overlay.overlay, {
|
(locationChooser.createObject(QQC2.Overlay.overlay, {
|
||||||
room: root.currentRoom
|
room: root.currentRoom
|
||||||
}).open();
|
}) as LocationChooser).open();
|
||||||
}
|
}
|
||||||
tooltip: text
|
tooltip: text
|
||||||
},
|
},
|
||||||
@@ -136,9 +144,9 @@ QQC2.Control {
|
|||||||
displayHint: QQC2.AbstractButton.IconOnly
|
displayHint: QQC2.AbstractButton.IconOnly
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
newPollDialog.createObject(QQC2.Overlay.overlay, {
|
(newPollDialog.createObject(QQC2.Overlay.overlay, {
|
||||||
room: root.currentRoom
|
room: root.currentRoom
|
||||||
}).open();
|
}) as NewPollDialog).open();
|
||||||
}
|
}
|
||||||
tooltip: text
|
tooltip: text
|
||||||
},
|
},
|
||||||
@@ -402,7 +410,7 @@ QQC2.Control {
|
|||||||
ReplyComponent {
|
ReplyComponent {
|
||||||
id: replyComponent
|
id: replyComponent
|
||||||
replyContentModel: ContentProvider.contentModelForEvent(root.currentRoom, _private.chatBarCache.replyId, true)
|
replyContentModel: ContentProvider.contentModelForEvent(root.currentRoom, _private.chatBarCache.replyId, true)
|
||||||
Message.maxContentWidth: replyLoader.item.width
|
Message.maxContentWidth: (replyLoader.item as Item).width
|
||||||
|
|
||||||
// When the user replies to a message and the preview is loaded, make sure the text field is focused again
|
// When the user replies to a message and the preview is loaded, make sure the text field is focused again
|
||||||
Component.onCompleted: textField.forceActiveFocus(Qt.OtherFocusReason)
|
Component.onCompleted: textField.forceActiveFocus(Qt.OtherFocusReason)
|
||||||
|
|||||||
Reference in New Issue
Block a user