Change all remaining QML file ids to "root"

This commit is contained in:
Tobias Fella
2023-09-05 16:46:58 +02:00
parent f7d2ffac66
commit de3072125e
31 changed files with 211 additions and 206 deletions

View File

@@ -14,7 +14,7 @@ import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.Popup { QQC2.Popup {
id: completionMenu id: root
width: parent.width width: parent.width
visible: completions.count > 0 visible: completions.count > 0
@@ -38,7 +38,7 @@ QQC2.Popup {
} }
function complete() { function complete() {
completionMenu.chatDocumentHandler.complete(completions.currentIndex) root.chatDocumentHandler.complete(completions.currentIndex)
} }
leftPadding: 0 leftPadding: 0
@@ -52,7 +52,7 @@ QQC2.Popup {
id: completions id: completions
anchors.fill: parent anchors.fill: parent
model: completionMenu.chatDocumentHandler.completionModel model: root.chatDocumentHandler.completionModel
currentIndex: 0 currentIndex: 0
keyNavigationWraps: true keyNavigationWraps: true
highlightMoveDuration: 100 highlightMoveDuration: 100
@@ -81,7 +81,7 @@ QQC2.Popup {
subtitleItem.textFormat: Text.PlainText subtitleItem.textFormat: Text.PlainText
} }
} }
onClicked: completionMenu.chatDocumentHandler.complete(completionDelegate.index) onClicked: root.chatDocumentHandler.complete(completionDelegate.index)
} }
} }

View File

@@ -6,15 +6,15 @@ import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigami 2.20 as Kirigami
QQC2.ItemDelegate { QQC2.ItemDelegate {
id: emojiDelegate id: root
property string name property string name
property string emoji property string emoji
property bool showTones: false property bool showTones: false
property bool isImage: false property bool isImage: false
QQC2.ToolTip.text: emojiDelegate.name QQC2.ToolTip.text: root.name
QQC2.ToolTip.visible: hovered && emojiDelegate.name !== "" QQC2.ToolTip.visible: hovered && root.name !== ""
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
leftInset: Kirigami.Units.smallSpacing leftInset: Kirigami.Units.smallSpacing
topInset: Kirigami.Units.smallSpacing topInset: Kirigami.Units.smallSpacing
@@ -24,8 +24,8 @@ QQC2.ItemDelegate {
contentItem: Item { contentItem: Item {
Kirigami.Heading { Kirigami.Heading {
anchors.fill: parent anchors.fill: parent
visible: !emojiDelegate.emoji.startsWith("image") && !emojiDelegate.isImage visible: !root.emoji.startsWith("image") && !root.isImage
text: emojiDelegate.emoji text: root.emoji
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.family: "emoji" font.family: "emoji"
@@ -36,25 +36,25 @@ QQC2.ItemDelegate {
source: "arrow-down" source: "arrow-down"
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
visible: emojiDelegate.showTones visible: root.showTones
} }
} }
Image { Image {
anchors.fill: parent anchors.fill: parent
visible: emojiDelegate.emoji.startsWith("image") || emojiDelegate.isImage visible: root.emoji.startsWith("image") || root.isImage
source: visible ? emojiDelegate.emoji : "" source: visible ? root.emoji : ""
} }
} }
background: Rectangle { background: Rectangle {
color: emojiDelegate.checked ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor color: root.checked ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
Rectangle { Rectangle {
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
anchors.fill: parent anchors.fill: parent
color: Kirigami.Theme.highlightColor color: Kirigami.Theme.highlightColor
opacity: emojiDelegate.hovered && !emojiDelegate.pressed ? 0.2 : 0 opacity: root.hovered && !root.pressed ? 0.2 : 0
} }
} }
} }

View File

@@ -7,7 +7,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.ScrollView { QQC2.ScrollView {
id: emojiGrid id: root
property alias model: emojis.model property alias model: emojis.model
property alias count: emojis.count property alias count: emojis.count
@@ -40,10 +40,10 @@ QQC2.ScrollView {
} }
onModelChanged: currentIndex = -1 onModelChanged: currentIndex = -1
cellWidth: emojis.width / emojiGrid.emojisPerRow cellWidth: emojis.width / root.emojisPerRow
cellHeight: emojiGrid.targetIconSize cellHeight: root.targetIconSize
KeyNavigation.up: emojiGrid.header KeyNavigation.up: root.header
clip: true clip: true
@@ -56,14 +56,14 @@ QQC2.ScrollView {
width: emojis.cellWidth width: emojis.cellWidth
height: emojis.cellHeight height: emojis.cellHeight
isImage: emojiGrid.stickers isImage: root.stickers
Keys.onEnterPressed: clicked() Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
onClicked: { onClicked: {
if (emojiGrid.stickers) { if (root.stickers) {
emojiGrid.stickerChosen(model.index) root.stickerChosen(model.index)
} }
emojiGrid.chosen(modelData.isCustom ? modelData.shortName : modelData.unicode) root.chosen(modelData.isCustom ? modelData.shortName : modelData.unicode)
EmojiModel.emojiUsed(modelData) EmojiModel.emojiUsed(modelData)
} }
Keys.onSpacePressed: pressAndHold() Keys.onSpacePressed: pressAndHold()
@@ -71,7 +71,7 @@ QQC2.ScrollView {
if (EmojiModel.tones(modelData.shortName).length === 0) { if (EmojiModel.tones(modelData.shortName).length === 0) {
return; return;
} }
let tones = tonesPopupComponent.createObject(emojiDelegate, {shortName: modelData.shortName, unicode: modelData.unicode, categoryIconSize: emojiGrid.targetIconSize}) let tones = tonesPopupComponent.createObject(emojiDelegate, {shortName: modelData.shortName, unicode: modelData.unicode, categoryIconSize: root.targetIconSize})
tones.open() tones.open()
tones.forceActiveFocus() tones.forceActiveFocus()
} }
@@ -80,14 +80,14 @@ QQC2.ScrollView {
Kirigami.PlaceholderMessage { Kirigami.PlaceholderMessage {
anchors.centerIn: parent anchors.centerIn: parent
text: emojiGrid.stickers ? i18n("No stickers") : i18n("No emojis") text: root.stickers ? i18n("No stickers") : i18n("No emojis")
visible: emojis.count === 0 visible: emojis.count === 0
} }
} }
Component { Component {
id: tonesPopupComponent id: tonesPopupComponent
EmojiTonesPicker { EmojiTonesPicker {
onChosen: emojiGrid.chosen(emoji) onChosen: root.chosen(emoji)
} }
} }
} }

View File

@@ -8,7 +8,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.Popup { QQC2.Popup {
id: tones id: root
signal chosen(string emoji) signal chosen(string emoji)
@@ -20,14 +20,14 @@ QQC2.Popup {
required property string shortName required property string shortName
required property string unicode required property string unicode
required property int categoryIconSize required property int categoryIconSize
width: tones.categoryIconSize * tonesList.count + 2 * padding width: root.categoryIconSize * tonesList.count + 2 * padding
height: tones.categoryIconSize + 2 * padding height: root.categoryIconSize + 2 * padding
y: -height y: -height
padding: 2 padding: 2
modal: true modal: true
dim: true dim: true
clip: false clip: false
onOpened: x = Math.min(parent.mapFromGlobal(QQC2.Overlay.overlay.width - tones.width, 0).x, -(width - parent.width) / 2) onOpened: x = Math.min(parent.mapFromGlobal(QQC2.Overlay.overlay.width - root.width, 0).x, -(width - parent.width) / 2)
background: Kirigami.ShadowedRectangle { background: Kirigami.ShadowedRectangle {
color: Kirigami.Theme.backgroundColor color: Kirigami.Theme.backgroundColor
radius: Kirigami.Units.mediumSpacing radius: Kirigami.Units.mediumSpacing
@@ -47,7 +47,7 @@ QQC2.Popup {
width: parent.width width: parent.width
height: parent.height height: parent.height
orientation: Qt.Horizontal orientation: Qt.Horizontal
model: EmojiModel.tones(tones.shortName) model: EmojiModel.tones(root.shortName)
keyNavigationEnabled: true keyNavigationEnabled: true
keyNavigationWraps: true keyNavigationWraps: true
@@ -57,15 +57,15 @@ QQC2.Popup {
emoji: modelData.unicode emoji: modelData.unicode
name: modelData.shortName name: modelData.shortName
width: tones.categoryIconSize width: root.categoryIconSize
height: width height: width
Keys.onEnterPressed: clicked() Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
onClicked: { onClicked: {
tones.chosen(modelData.unicode) root.chosen(modelData.unicode)
EmojiModel.emojiUsed(modelData) EmojiModel.emojiUsed(modelData)
tones.close() root.close()
} }
} }
} }

View File

@@ -8,7 +8,7 @@ import QtQuick.Particles 2.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
Item { Item {
id: item id: root
property bool enabled: false property bool enabled: false
property int effectInterval: Kirigami.Units.veryLongDuration*10; property int effectInterval: Kirigami.Units.veryLongDuration*10;
property color darkSnowColor: "grey" property color darkSnowColor: "grey"
@@ -30,12 +30,12 @@ Item {
Timer { Timer {
id: confettiTimer id: confettiTimer
interval: item.effectInterval; interval: root.effectInterval;
running: false; running: false;
repeat: false; repeat: false;
triggeredOnStart: true; triggeredOnStart: true;
onTriggered: { onTriggered: {
if (item.enabled) { if (root.enabled) {
confettiSystem.running = !confettiSystem.running confettiSystem.running = !confettiSystem.running
} }
} }
@@ -92,12 +92,12 @@ Item {
Timer { Timer {
id: snowTimer id: snowTimer
interval: item.effectInterval; interval: root.effectInterval;
running: false; running: false;
repeat: false; repeat: false;
triggeredOnStart: true; triggeredOnStart: true;
onTriggered: { onTriggered: {
if (item.enabled) { if (root.enabled) {
snowSystem.running = !snowSystem.running snowSystem.running = !snowSystem.running
} }
} }
@@ -127,7 +127,7 @@ Item {
width: 10 width: 10
height: width height: width
radius: width radius: width
color: item.isThemeDark ? "white" : darkSnowColor color: root.isThemeDark ? "white" : darkSnowColor
scale: Math.random() scale: Math.random()
opacity: Math.random() opacity: Math.random()
} }
@@ -157,12 +157,12 @@ Item {
Timer { Timer {
id: fireworksTimer id: fireworksTimer
interval: item.effectInterval; interval: root.effectInterval;
running: false; running: false;
repeat: false; repeat: false;
triggeredOnStart: true; triggeredOnStart: true;
onTriggered: { onTriggered: {
if (item.enabled) { if (root.enabled) {
fireworksInternalTimer.running = !fireworksInternalTimer.running fireworksInternalTimer.running = !fireworksInternalTimer.running
} }
} }
@@ -206,8 +206,8 @@ Item {
id: fireworksParticleA id: fireworksParticleA
system: fireworksSystem system: fireworksSystem
source: "qrc:/glowdot.png" source: "qrc:/glowdot.png"
alphaVariation: item.isThemeDark ? 0.1 : 0.1 alphaVariation: root.isThemeDark ? 0.1 : 0.1
alpha: item.isThemeDark ? 0.5 : 1 alpha: root.isThemeDark ? 0.5 : 1
groups: ["a"] groups: ["a"]
opacity: fireworksSystem.opacity opacity: fireworksSystem.opacity
entryEffect: ImageParticle.Scale entryEffect: ImageParticle.Scale
@@ -217,9 +217,9 @@ Item {
ImageParticle { ImageParticle {
system: fireworksSystem system: fireworksSystem
source: "qrc:/glowdot.png" source: "qrc:/glowdot.png"
color: item.isThemeDark ? "white" : "gold" color: root.isThemeDark ? "white" : "gold"
alphaVariation: item.isThemeDark ? 0.1 : 0.1 alphaVariation: root.isThemeDark ? 0.1 : 0.1
alpha: item.isThemeDark ? 0.5 : 1 alpha: root.isThemeDark ? 0.5 : 1
groups: ["light"] groups: ["light"]
opacity: fireworksSystem.opacity opacity: fireworksSystem.opacity
entryEffect: ImageParticle.Scale entryEffect: ImageParticle.Scale
@@ -230,8 +230,8 @@ Item {
id: fireworksParticleB id: fireworksParticleB
system: fireworksSystem system: fireworksSystem
source: "qrc:/glowdot.png" source: "qrc:/glowdot.png"
alphaVariation: item.isThemeDark ? 0.1 : 0.1 alphaVariation: root.isThemeDark ? 0.1 : 0.1
alpha: item.isThemeDark ? 0.5 : 1 alpha: root.isThemeDark ? 0.5 : 1
groups: ["b"] groups: ["b"]
opacity: fireworksSystem.opacity opacity: fireworksSystem.opacity
entryEffect: ImageParticle.Scale entryEffect: ImageParticle.Scale
@@ -257,7 +257,7 @@ Item {
onTriggered: { onTriggered: {
container.destroy(); container.destroy();
var randomHue = Math.random() var randomHue = Math.random()
var lightness = item.isThemeDark ? 0.8 : 0.7 var lightness = root.isThemeDark ? 0.8 : 0.7
fireworksParticleA.color = Qt.hsla(randomHue, 0.8, lightness, 1) fireworksParticleA.color = Qt.hsla(randomHue, 0.8, lightness, 1)
fireworksParticleB.color = Qt.hsla(1-randomHue, 0.8, lightness, 1) fireworksParticleB.color = Qt.hsla(1-randomHue, 0.8, lightness, 1)
} }

View File

@@ -9,7 +9,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.Page { Kirigami.Page {
id: locationsPage id: root
required property var room required property var room
@@ -31,7 +31,7 @@ Kirigami.Page {
MapItemView { MapItemView {
model: LocationsModel { model: LocationsModel {
id: locationsModel id: locationsModel
room: locationsPage.room room: root.room
} }
delegate: LocationMapItem { delegate: LocationMapItem {
isLive: true isLive: true
@@ -42,7 +42,7 @@ Kirigami.Page {
MapItemView { MapItemView {
model: LiveLocationsModel { model: LiveLocationsModel {
id: liveLocationsModel id: liveLocationsModel
room: locationsPage.room room: root.room
} }
delegate: LocationMapItem {} delegate: LocationMapItem {}
} }

View File

@@ -8,7 +8,7 @@ import QtQuick 2.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
Gradient { Gradient {
id: gradient id: root
orientation: Gradient.Horizontal orientation: Gradient.Horizontal
@@ -25,7 +25,7 @@ Gradient {
from: -2.0 from: -2.0
to: 2.0 to: 2.0
duration: 700 duration: 700
target: gradient target: root
properties: "pos" properties: "pos"
} }
PauseAnimation { PauseAnimation {
@@ -33,7 +33,7 @@ Gradient {
} }
} }
GradientStop { position: gradient.pos-gradient.offset; color: gradient.translucent } GradientStop { position: root.pos-root.offset; color: root.translucent }
GradientStop { position: gradient.pos; color: gradient.bright } GradientStop { position: root.pos; color: root.bright }
GradientStop { position: gradient.pos+gradient.offset; color: gradient.translucent } GradientStop { position: root.pos+root.offset; color: root.translucent }
} }

View File

@@ -11,7 +11,8 @@ import org.kde.kirigami 2.15 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.ItemDelegate { QQC2.ItemDelegate {
id: readMarkerDelegate id: root
padding: Kirigami.Units.largeSpacing padding: Kirigami.Units.largeSpacing
topInset: Kirigami.Units.largeSpacing topInset: Kirigami.Units.largeSpacing
topPadding: Kirigami.Units.largeSpacing * 2 topPadding: Kirigami.Units.largeSpacing * 2
@@ -41,7 +42,7 @@ QQC2.ItemDelegate {
State { State {
name: "alignLeft" name: "alignLeft"
AnchorChanges { AnchorChanges {
target: readMarkerDelegate target: root
anchors.horizontalCenter: undefined anchors.horizontalCenter: undefined
anchors.left: parent ? parent.left : undefined anchors.left: parent ? parent.left : undefined
} }
@@ -49,7 +50,7 @@ QQC2.ItemDelegate {
State { State {
name: "alignCenter" name: "alignCenter"
AnchorChanges { AnchorChanges {
target: readMarkerDelegate target: root
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
anchors.left: undefined anchors.left: undefined
} }
@@ -72,7 +73,7 @@ QQC2.ItemDelegate {
background: Kirigami.ShadowedRectangle { background: Kirigami.ShadowedRectangle {
id: readMarkerBackground id: readMarkerBackground
color: { color: {
if (readMarkerDelegate.isTemporaryHighlighted) { if (root.isTemporaryHighlighted) {
return Kirigami.Theme.positiveBackgroundColor return Kirigami.Theme.positiveBackgroundColor
} else { } else {
return Kirigami.Theme.backgroundColor return Kirigami.Theme.backgroundColor
@@ -80,7 +81,7 @@ QQC2.ItemDelegate {
} }
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
opacity: readMarkerDelegate.isTemporaryHighlighted ? 1 : 0.6 opacity: root.isTemporaryHighlighted ? 1 : 0.6
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
shadow.size: Kirigami.Units.smallSpacing shadow.size: Kirigami.Units.smallSpacing
shadow.color: Qt.rgba(0.0, 0.0, 0.0, 0.10) shadow.color: Qt.rgba(0.0, 0.0, 0.0, 0.10)

View File

@@ -11,7 +11,7 @@ import org.kde.kirigami 2.15 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.ItemDelegate { QQC2.ItemDelegate {
id: sectionDelegate id: root
property alias labelText: sectionLabel.text property alias labelText: sectionLabel.text
property var maxWidth: Number.POSITIVE_INFINITY property var maxWidth: Number.POSITIVE_INFINITY
@@ -44,6 +44,6 @@ QQC2.ItemDelegate {
background: Rectangle { background: Rectangle {
color: Config.blur ? "transparent" : Kirigami.Theme.backgroundColor color: Config.blur ? "transparent" : Kirigami.Theme.backgroundColor
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: sectionDelegate.colorSet Kirigami.Theme.colorSet: root.colorSet
} }
} }

View File

@@ -11,7 +11,7 @@ import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.Control { QQC2.Control {
id: stateDelegate id: root
readonly property bool sectionVisible: model.showSection readonly property bool sectionVisible: model.showSection
@@ -23,7 +23,7 @@ QQC2.Control {
State { State {
name: "alignLeft" name: "alignLeft"
AnchorChanges { AnchorChanges {
target: stateDelegate target: root
anchors.horizontalCenter: undefined anchors.horizontalCenter: undefined
anchors.left: parent ? parent.left : undefined anchors.left: parent ? parent.left : undefined
} }
@@ -31,7 +31,7 @@ QQC2.Control {
State { State {
name: "alignCenter" name: "alignCenter"
AnchorChanges { AnchorChanges {
target: stateDelegate target: root
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
anchors.left: undefined anchors.left: undefined
} }
@@ -204,6 +204,6 @@ QQC2.Control {
endPercentWidth: Config.compactLayout ? 100 : 85 endPercentWidth: Config.compactLayout ? 100 : 85
maxWidth: Config.compactLayout ? -1 : Kirigami.Units.gridUnit * 60 maxWidth: Config.compactLayout ? -1 : Kirigami.Units.gridUnit * 60
parentWidth: stateDelegate.parent ? stateDelegate.parent.width : 0 parentWidth: root.parent ? root.parent.width : 0
} }
} }

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.15 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.Dialog { QQC2.Dialog {
id: confirmEncryptionDialog id: root
property NeoChatRoom room property NeoChatRoom room
@@ -31,15 +31,15 @@ QQC2.Dialog {
QQC2.Button { QQC2.Button {
text: i18n("Cancel") text: i18n("Cancel")
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
onClicked: confirmEncryptionDialog.close() onClicked: root.close()
} }
QQC2.Button { QQC2.Button {
text: i18n("Activate Encryption") text: i18n("Activate Encryption")
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
onClicked: { onClicked: {
confirmEncryptionDialog.room.activateEncryption() root.room.activateEncryption()
confirmEncryptionDialog.close(); root.close();
} }
} }
} }

View File

@@ -9,7 +9,7 @@ import org.kde.kirigami 2.15 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.Popup { QQC2.Popup {
id: emojiPopup id: root
/** /**
* @brief The current room that user is viewing. * @brief The current room that user is viewing.
@@ -25,7 +25,7 @@ QQC2.Popup {
Connections { Connections {
target: RoomManager target: RoomManager
function onCurrentRoomChanged() { function onCurrentRoomChanged() {
emojiPopup.close() root.close()
} }
} }
@@ -64,11 +64,11 @@ QQC2.Popup {
id: emojiPicker id: emojiPicker
height: 400 height: 400
currentRoom: root.currentRoom currentRoom: root.currentRoom
includeCustom: emojiPopup.includeCustom includeCustom: root.includeCustom
showQuickReaction: emojiPopup.showQuickReaction showQuickReaction: root.showQuickReaction
onChosen: emoji => { onChosen: emoji => {
emojiPopup.chosen(emoji) root.chosen(emoji)
if (emojiPopup.closeOnChosen) emojiPopup.close() if (root.closeOnChosen) root.close()
} }
} }
} }

View File

@@ -9,7 +9,7 @@ import org.kde.kirigami 2.19 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Column { Column {
id: emojiItem id: root
property string emoji property string emoji
property string description property string description
@@ -23,7 +23,7 @@ Column {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: emojiItem.emoji text: root.emoji
font.family: "emoji" font.family: "emoji"
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 4 font.pointSize: Kirigami.Theme.defaultFont.pointSize * 4
} }
@@ -32,7 +32,7 @@ Column {
y: parent.height * 0.75 y: parent.height * 0.75
width: parent.width width: parent.width
height: parent.height * 0.25 height: parent.height * 0.25
text: emojiItem.description text: root.description
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }

View File

@@ -7,7 +7,7 @@ import QtQml 2.15
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Row { Row {
id: emojiRow id: root
property alias model: repeater.model property alias model: repeater.model
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -16,7 +16,7 @@ Row {
delegate: EmojiItem { delegate: EmojiItem {
emoji: modelData.emoji emoji: modelData.emoji
description: modelData.description description: modelData.description
width: emojiRow.height width: root.height
height: width height: width
} }
} }

View File

@@ -9,7 +9,7 @@ import org.kde.kirigami 2.19 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Column { Column {
id: emojiSas id: root
required property var model required property var model
@@ -25,12 +25,12 @@ Column {
EmojiRow { EmojiRow {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: Kirigami.Units.gridUnit * 4 height: Kirigami.Units.gridUnit * 4
model: emojiSas.model.slice(0, 4) model: root.model.slice(0, 4)
} }
EmojiRow { EmojiRow {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: Kirigami.Units.gridUnit * 4 height: Kirigami.Units.gridUnit * 4
model: emojiSas.model.slice(4, 7) model: root.model.slice(4, 7)
} }
Row { Row {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -38,13 +38,13 @@ Column {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
text: i18n("They match") text: i18n("They match")
icon.name: "dialog-ok" icon.name: "dialog-ok"
onClicked: emojiSas.accept() onClicked: root.accept()
} }
QQC2.Button { QQC2.Button {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
text: i18n("They don't match") text: i18n("They don't match")
icon.name: "dialog-cancel" icon.name: "dialog-cancel"
onClicked: emojiSas.reject() onClicked: root.reject()
} }
} }
} }

View File

@@ -10,7 +10,8 @@ import org.kde.kirigami 2.19 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.Page { Kirigami.Page {
id: dialog id: root
title: i18n("Session Verification") title: i18n("Session Verification")
required property var session required property var session
@@ -18,31 +19,31 @@ Kirigami.Page {
Item { Item {
anchors.fill: parent anchors.fill: parent
VerificationCanceled { VerificationCanceled {
visible: dialog.session.state === KeyVerificationSession.CANCELED visible: root.session.state === KeyVerificationSession.CANCELED
anchors.centerIn: parent anchors.centerIn: parent
reason: dialog.session.error reason: root.session.error
} }
EmojiSas { EmojiSas {
anchors.centerIn: parent anchors.centerIn: parent
visible: dialog.session.state === KeyVerificationSession.WAITINGFORVERIFICATION visible: root.session.state === KeyVerificationSession.WAITINGFORVERIFICATION
model: dialog.session.sasEmojis model: root.session.sasEmojis
onReject: dialog.session.cancelVerification(KeyVerificationSession.MISMATCHED_SAS) onReject: root.session.cancelVerification(KeyVerificationSession.MISMATCHED_SAS)
onAccept: dialog.session.sendMac() onAccept: root.session.sendMac()
} }
Message { Message {
visible: dialog.session.state === KeyVerificationSession.WAITINGFORREADY visible: root.session.state === KeyVerificationSession.WAITINGFORREADY
anchors.centerIn: parent anchors.centerIn: parent
icon: "security-medium-symbolic" icon: "security-medium-symbolic"
text: i18n("Waiting for device to accept verification.") text: i18n("Waiting for device to accept verification.")
} }
Message { Message {
visible: dialog.session.state === KeyVerificationSession.INCOMING visible: root.session.state === KeyVerificationSession.INCOMING
anchors.centerIn: parent anchors.centerIn: parent
icon: "security-medium-symbolic" icon: "security-medium-symbolic"
text: i18n("Incoming key verification request from device **%1**", dialog.session.remoteDeviceId) text: i18n("Incoming key verification request from device **%1**", root.session.remoteDeviceId)
} }
Message { Message {
visible: dialog.session.state === KeyVerificationSession.WAITINGFORMAC visible: root.session.state === KeyVerificationSession.WAITINGFORMAC
anchors.centerIn: parent anchors.centerIn: parent
icon: "security-medium-symbolic" icon: "security-medium-symbolic"
text: i18n("Waiting for other party to verify.") text: i18n("Waiting for other party to verify.")
@@ -50,35 +51,35 @@ Kirigami.Page {
Kirigami.BasicListItem { Kirigami.BasicListItem {
id: emojiVerification id: emojiVerification
text: "Emoji Verification" text: "Emoji Verification"
visible: dialog.session.state === KeyVerificationSession.READY visible: root.session.state === KeyVerificationSession.READY
subtitle: i18n("Compare a set of emoji on both devices") subtitle: i18n("Compare a set of emoji on both devices")
onClicked: { onClicked: {
dialog.session.sendStartSas() root.session.sendStartSas()
} }
} }
Message { Message {
visible: dialog.session.state === KeyVerificationSession.DONE visible: root.session.state === KeyVerificationSession.DONE
anchors.centerIn: parent anchors.centerIn: parent
text: i18n("Successfully verified device **%1**", dialog.session.remoteDeviceId) text: i18n("Successfully verified device **%1**", root.session.remoteDeviceId)
icon: "security-high" icon: "security-high"
} }
} }
footer: QQC2.ToolBar { footer: QQC2.ToolBar {
visible: dialog.session.state === KeyVerificationSession.INCOMING visible: root.session.state === KeyVerificationSession.INCOMING
QQC2.DialogButtonBox { QQC2.DialogButtonBox {
anchors.fill: parent anchors.fill: parent
Item { Layout.fillWidth: true } Item { Layout.fillWidth: true }
QQC2.Button { QQC2.Button {
text: i18n("Accept") text: i18n("Accept")
icon.name: "dialog-ok" icon.name: "dialog-ok"
onClicked: dialog.session.sendReady() onClicked: root.session.sendReady()
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
} }
QQC2.Button { QQC2.Button {
text: i18n("Decline") text: i18n("Decline")
icon.name: "dialog-cancel" icon.name: "dialog-cancel"
onClicked: dialog.session.cancelVerification("m.user", "Declined") onClicked: root.session.cancelVerification("m.user", "Declined")
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
} }
} }

View File

@@ -9,7 +9,8 @@ import org.kde.kirigami 2.19 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Column { Column {
id: message id: root
required property string icon required property string icon
required property string text required property string text
@@ -18,10 +19,10 @@ Column {
width: Kirigami.Units.iconSizes.enormous width: Kirigami.Units.iconSizes.enormous
height: width height: width
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
source: message.icon source: root.icon
} }
QQC2.Label { QQC2.Label {
text: message.text text: root.text
textFormat: Text.MarkdownText textFormat: Text.MarkdownText
} }
} }

View File

@@ -7,14 +7,14 @@ import QtQml 2.15
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Message { Message {
id: verificationCanceled id: root
required property int reason required property int reason
anchors.centerIn: parent anchors.centerIn: parent
icon: "security-low" icon: "security-low"
text: { text: {
switch(verificationCanceled.reason) { switch(root.reason) {
case KeyVerificationSession.NONE: case KeyVerificationSession.NONE:
return i18n("The session verification was canceled for unknown reason."); return i18n("The session verification was canceled for unknown reason.");
case KeyVerificationSession.TIMEOUT: case KeyVerificationSession.TIMEOUT:

View File

@@ -6,27 +6,27 @@ import QtQuick 2.15
import QtQuick.Layouts 1.10 import QtQuick.Layouts 1.10
Labs.Menu { Labs.Menu {
id: editMenu id: root
required property Item field required property Item field
Labs.MenuItem { Labs.MenuItem {
enabled: editMenu.field !== null && editMenu.field.canUndo enabled: root.field !== null && root.field.canUndo
text: i18nc("text editing menu action", "Undo") text: i18nc("text editing menu action", "Undo")
shortcut: StandardKey.Undo shortcut: StandardKey.Undo
onTriggered: { onTriggered: {
editMenu.field.undo() root.field.undo()
editMenu.close() root.close()
} }
} }
Labs.MenuItem { Labs.MenuItem {
enabled: editMenu.field !== null && editMenu.field.canRedo enabled: root.field !== null && root.field.canRedo
text: i18nc("text editing menu action", "Redo") text: i18nc("text editing menu action", "Redo")
shortcut: StandardKey.Redo shortcut: StandardKey.Redo
onTriggered: { onTriggered: {
editMenu.field.undo() root.field.undo()
editMenu.close() root.close()
} }
} }
@@ -34,42 +34,42 @@ Labs.Menu {
} }
Labs.MenuItem { Labs.MenuItem {
enabled: editMenu.field !== null && editMenu.field.selectedText enabled: root.field !== null && root.field.selectedText
text: i18nc("text editing menu action", "Cut") text: i18nc("text editing menu action", "Cut")
shortcut: StandardKey.Cut shortcut: StandardKey.Cut
onTriggered: { onTriggered: {
editMenu.field.cut() root.field.cut()
editMenu.close() root.close()
} }
} }
Labs.MenuItem { Labs.MenuItem {
enabled: editMenu.field !== null && editMenu.field.selectedText enabled: root.field !== null && root.field.selectedText
text: i18nc("text editing menu action", "Copy") text: i18nc("text editing menu action", "Copy")
shortcut: StandardKey.Copy shortcut: StandardKey.Copy
onTriggered: { onTriggered: {
editMenu.field.copy() root.field.copy()
editMenu.close() root.close()
} }
} }
Labs.MenuItem { Labs.MenuItem {
enabled: editMenu.field !== null && editMenu.field.canPaste enabled: root.field !== null && root.field.canPaste
text: i18nc("text editing menu action", "Paste") text: i18nc("text editing menu action", "Paste")
shortcut: StandardKey.Paste shortcut: StandardKey.Paste
onTriggered: { onTriggered: {
editMenu.field.paste() root.field.paste()
editMenu.close() root.close()
} }
} }
Labs.MenuItem { Labs.MenuItem {
enabled: editMenu.field !== null && editMenu.field.selectedText !== "" enabled: root.field !== null && root.field.selectedText !== ""
text: i18nc("text editing menu action", "Delete") text: i18nc("text editing menu action", "Delete")
shortcut: "" shortcut: ""
onTriggered: { onTriggered: {
editMenu.field.remove(editMenu.field.selectionStart, editMenu.field.selectionEnd) root.field.remove(root.field.selectionStart, root.field.selectionEnd)
editMenu.close() root.close()
} }
} }
@@ -77,12 +77,12 @@ Labs.Menu {
} }
Labs.MenuItem { Labs.MenuItem {
enabled: editMenu.field !== null enabled: root.field !== null
text: i18nc("text editing menu action", "Select All") text: i18nc("text editing menu action", "Select All")
shortcut: StandardKey.SelectAll shortcut: StandardKey.SelectAll
onTriggered: { onTriggered: {
editMenu.field.selectAll() root.field.selectAll()
editMenu.close() root.close()
} }
} }
} }

View File

@@ -13,7 +13,8 @@ import org.kde.kirigami 2.14 as Kirigami
* TODO add Android support * TODO add Android support
*/ */
Kirigami.Action { Kirigami.Action {
id: shareAction id: root
icon.name: "emblem-shared-symbolic" icon.name: "emblem-shared-symbolic"
text: i18n("Share") text: i18n("Share")
tooltip: i18n("Share the selected media") tooltip: i18n("Share the selected media")
@@ -40,12 +41,12 @@ Kirigami.Action {
const purposeModel = Qt.createQmlObject('import org.kde.purpose 1.0 as Purpose; const purposeModel = Qt.createQmlObject('import org.kde.purpose 1.0 as Purpose;
Purpose.PurposeAlternativesModel { Purpose.PurposeAlternativesModel {
pluginType: "Export" pluginType: "Export"
}', shareAction._instantiator); }', root._instantiator);
purposeModel.inputData = Qt.binding(function() { purposeModel.inputData = Qt.binding(function() {
return shareAction.inputData; return root.inputData;
}); });
_instantiator.model = purposeModel; _instantiator.model = purposeModel;
shareAction.visible = true; root.visible = true;
} }
delegate: Kirigami.Action { delegate: Kirigami.Action {
@@ -55,16 +56,16 @@ Purpose.PurposeAlternativesModel {
onTriggered: { onTriggered: {
doBeforeSharing(); doBeforeSharing();
applicationWindow().pageStack.pushDialogLayer('qrc:/ShareDialog.qml', { applicationWindow().pageStack.pushDialogLayer('qrc:/ShareDialog.qml', {
title: shareAction.tooltip, title: root.tooltip,
index: index, index: index,
model: shareAction._instantiator.model model: root._instantiator.model
}) })
} }
} }
onObjectAdded: (index, object) => { onObjectAdded: (index, object) => {
object.index = index; object.index = index;
shareAction.children.push(object) root.children.push(object)
} }
onObjectRemoved: (index, object) => shareAction.children = Array.from(shareAction.children).filter(obj => obj.pluginId !== object.pluginId) onObjectRemoved: (index, object) => root.children = Array.from(root.children).filter(obj => obj.pluginId !== object.pluginId)
} }
} }

View File

@@ -13,7 +13,7 @@ import org.kde.notification 1.0
import org.kde.kirigami 2.14 as Kirigami import org.kde.kirigami 2.14 as Kirigami
Kirigami.Page { Kirigami.Page {
id: window id: root
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
@@ -25,7 +25,7 @@ Kirigami.Page {
QQC2.Action { QQC2.Action {
shortcut: 'Escape' shortcut: 'Escape'
onTriggered: window.closeDialog() onTriggered: root.closeDialog()
} }
Notification { Notification {
@@ -54,15 +54,15 @@ Kirigami.Page {
sharingSuccess.sendEvent(); sharingSuccess.sendEvent();
Clipboard.saveText(jobView.output.url); Clipboard.saveText(jobView.output.url);
} }
window.closeDialog() root.closeDialog()
} else if (state === Purpose.PurposeJobController.Error) { } else if (state === Purpose.PurposeJobController.Error) {
// Show failure notification // Show failure notification
sharingFailed.sendEvent(); sharingFailed.sendEvent();
window.closeDialog() root.closeDialog()
} else if (state === Purpose.PurposeJobController.Cancelled) { } else if (state === Purpose.PurposeJobController.Cancelled) {
// Do nothing // Do nothing
window.closeDialog() root.closeDialog()
} }
} }
} }

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.Page { Kirigami.Page {
id: banSheet id: root
property NeoChatRoom room property NeoChatRoom room
property string userId property string userId
@@ -35,14 +35,14 @@ Kirigami.Page {
icon.name: "im-ban-user" icon.name: "im-ban-user"
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
onClicked: { onClicked: {
banSheet.room.ban(banSheet.userId, reason.text) root.room.ban(root.userId, reason.text)
banSheet.closeDialog() root.closeDialog()
} }
} }
QQC2.Button { QQC2.Button {
text: i18nc("@action", "Cancel") text: i18nc("@action", "Cancel")
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
onClicked: banSheet.closeDialog() onClicked: root.closeDialog()
} }
} }
} }

View File

@@ -11,7 +11,7 @@ import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Loader { Loader {
id: loadRoot id: root
required property var author required property var author
required property string eventId required property string eventId
@@ -31,7 +31,7 @@ Loader {
currentRoom.chatBoxEditId = eventId; currentRoom.chatBoxEditId = eventId;
currentRoom.chatBoxReplyId = ""; currentRoom.chatBoxReplyId = "";
} }
visible: author.id === Controller.activeConnection.localUserId && (loadRoot.eventType === DelegateType.Emote || loadRoot.eventType === DelegateType.Message) visible: author.id === Controller.activeConnection.localUserId && (root.eventType === DelegateType.Emote || root.eventType === DelegateType.Message)
}, },
Kirigami.Action { Kirigami.Action {
text: i18n("Reply") text: i18n("Reply")
@@ -50,7 +50,7 @@ Loader {
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}) })
page.chosen.connect(function(targetRoomId) { page.chosen.connect(function(targetRoomId) {
Controller.activeConnection.room(targetRoomId).postHtmlMessage(loadRoot.plainText, loadRoot.htmlText ? loadRoot.htmlText : loadRoot.plainText) Controller.activeConnection.room(targetRoomId).postHtmlMessage(root.plainText, root.htmlText ? root.htmlText : root.plainText)
page.closeDialog() page.closeDialog()
}) })
} }
@@ -68,7 +68,7 @@ Loader {
Kirigami.Action { Kirigami.Action {
text: i18n("Copy") text: i18n("Copy")
icon.name: "edit-copy" icon.name: "edit-copy"
onTriggered: Clipboard.saveText(loadRoot.selectedText === "" ? loadRoot.plainText : loadRoot.selectedText) onTriggered: Clipboard.saveText(root.selectedText === "" ? root.plainText : root.selectedText)
}, },
Kirigami.Action { Kirigami.Action {
text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report") text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report")
@@ -84,7 +84,7 @@ Loader {
icon.name: "code-context" icon.name: "code-context"
onTriggered: { onTriggered: {
applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', { applicationWindow().pageStack.pushDialogLayer('qrc:/MessageSourceSheet.qml', {
sourceText: loadRoot.source sourceText: root.eventSource
}, { }, {
title: i18n("Message Source"), title: i18n("Message Source"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
@@ -95,7 +95,7 @@ Loader {
text: i18n("Copy Link") text: i18n("Copy Link")
icon.name: "edit-copy" icon.name: "edit-copy"
onTriggered: { onTriggered: {
Clipboard.saveText("https://matrix.to/#/" + currentRoom.id + "/" + loadRoot.eventId) Clipboard.saveText("https://matrix.to/#/" + currentRoom.id + "/" + root.eventId)
} }
} }
] ]
@@ -106,7 +106,7 @@ Loader {
QQC2.Menu { QQC2.Menu {
id: menu id: menu
Instantiator { Instantiator {
model: loadRoot.nestedActions model: root.nestedActions
delegate: QQC2.Menu { delegate: QQC2.Menu {
id: menuItem id: menuItem
visible: modelData.visible visible: modelData.visible
@@ -131,12 +131,12 @@ Loader {
} }
Repeater { Repeater {
model: loadRoot.actions model: root.actions
QQC2.MenuItem { QQC2.MenuItem {
id: menuItem id: menuItem
visible: modelData.visible visible: modelData.visible
action: modelData action: modelData
onClicked: loadRoot.item.close(); onClicked: root.item.close();
} }
} }
QQC2.Menu { QQC2.Menu {
@@ -150,7 +150,7 @@ Loader {
Instantiator { Instantiator {
model: WebShortcutModel { model: WebShortcutModel {
id: webshortcutmodel id: webshortcutmodel
selectedText: loadRoot.selectedText ? loadRoot.selectedText : loadRoot.plainText selectedText: root.selectedText ? root.selectedText : root.plainText
onOpenUrl: RoomManager.visitNonMatrix(url) onOpenUrl: RoomManager.visitNonMatrix(url)
} }
delegate: QQC2.MenuItem { delegate: QQC2.MenuItem {
@@ -222,7 +222,7 @@ Loader {
text: modelData.text text: modelData.text
onClicked: { onClicked: {
modelData.triggered() modelData.triggered()
loadRoot.item.close(); root.item.close();
} }
implicitHeight: visible ? Kirigami.Units.gridUnit * 3 : 0 implicitHeight: visible ? Kirigami.Units.gridUnit * 3 : 0
} }
@@ -285,7 +285,7 @@ Loader {
onClicked: { onClicked: {
currentRoom.toggleReaction(eventId, modelData); currentRoom.toggleReaction(eventId, modelData);
loadRoot.item.close(); root.item.close();
} }
} }
} }
@@ -295,7 +295,7 @@ Loader {
} }
Repeater { Repeater {
id: listViewAction id: listViewAction
model: loadRoot.actions model: root.actions
Kirigami.BasicListItem { Kirigami.BasicListItem {
icon: modelData.icon.name icon: modelData.icon.name
@@ -305,14 +305,14 @@ Loader {
text: modelData.text text: modelData.text
onClicked: { onClicked: {
modelData.triggered() modelData.triggered()
loadRoot.item.close(); root.item.close();
} }
implicitHeight: visible ? Kirigami.Units.gridUnit * 3 : 0 implicitHeight: visible ? Kirigami.Units.gridUnit * 3 : 0
} }
} }
Repeater { Repeater {
model: loadRoot.nestedActions model: root.nestedActions
Kirigami.BasicListItem { Kirigami.BasicListItem {
action: modelData action: modelData

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.Page { Kirigami.Page {
id: deleteSheet id: root
property NeoChatRoom room property NeoChatRoom room
property string eventId property string eventId
@@ -37,18 +37,18 @@ Kirigami.Page {
icon.name: "delete" icon.name: "delete"
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
onClicked: { onClicked: {
if (deleteSheet.userId.length > 0) { if (root.userId.length > 0) {
deleteSheet.room.deleteMessagesByUser(deleteSheet.userId, reason.text) root.room.deleteMessagesByUser(root.userId, reason.text)
} else { } else {
deleteSheet.room.redactEvent(deleteSheet.eventId, reason.text); root.room.redactEvent(root.eventId, reason.text);
} }
deleteSheet.closeDialog() root.closeDialog()
} }
} }
QQC2.Button { QQC2.Button {
text: i18nc("@action", "Cancel") text: i18nc("@action", "Cancel")
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
onClicked: deleteSheet.closeDialog() onClicked: root.closeDialog()
} }
} }
} }

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.Page { Kirigami.Page {
id: reportSheet id: root
property NeoChatRoom room property NeoChatRoom room
property string eventId property string eventId
@@ -35,14 +35,14 @@ Kirigami.Page {
icon.name: "dialog-warning-symbolic" icon.name: "dialog-warning-symbolic"
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
onClicked: { onClicked: {
reportSheet.room.reportEvent(eventId, reason.text) root.room.reportEvent(eventId, reason.text)
reportSheet.closeDialog() root.closeDialog()
} }
} }
QQC2.Button { QQC2.Button {
text: i18nc("@action", "Cancel") text: i18nc("@action", "Cancel")
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
onClicked: reportSheet.closeDialog() onClicked: root.closeDialog()
} }
} }
} }

View File

@@ -11,7 +11,7 @@ import org.kde.kirigamiaddons.delegates 1.0 as Delegates
import org.kde.neochat 1.0 import org.kde.neochat 1.0
QQC2.ToolBar { QQC2.ToolBar {
id: userInfo id: root
padding: 0 padding: 0
@@ -33,7 +33,7 @@ QQC2.ToolBar {
id: addButton id: addButton
width: parent.width width: parent.width
highlighted: focus || (addAccount.highlighted || addAccount.ListView.isCurrentItem) && !addAccount.pressed highlighted: focus || (addAccount.highlighted || addAccount.ListView.isCurrentItem) && !addAccount.pressed
Component.onCompleted: userInfo.addAccount = this Component.onCompleted: root.addAccount = this
icon { icon {
name: "list-add" name: "list-add"
width: Kirigami.Units.iconSizes.smallMedium width: Kirigami.Units.iconSizes.smallMedium

View File

@@ -10,23 +10,24 @@ import org.kde.kirigami 2.15 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.ApplicationWindow { Kirigami.ApplicationWindow {
id: window id: root
required property NeoChatRoom currentRoom required property NeoChatRoom currentRoom
minimumWidth: Kirigami.Units.gridUnit * 10 minimumWidth: Kirigami.Units.gridUnit * 10
minimumHeight: Kirigami.Units.gridUnit * 15 minimumHeight: Kirigami.Units.gridUnit * 15
Shortcut { Shortcut {
sequence: StandardKey.Cancel sequence: StandardKey.Cancel
onActivated: window.close() onActivated: root.close()
} }
pageStack.initialPage: RoomPage { pageStack.initialPage: RoomPage {
visible: true visible: true
currentRoom: window.currentRoom currentRoom: root.currentRoom
disableCancelShortcut: true disableCancelShortcut: true
} }
onCurrentRoomChanged: if (!currentRoom) { onCurrentRoomChanged: if (!currentRoom) {
window.close() root.close()
} }
property Item hoverLinkIndicator: QQC2.Control { property Item hoverLinkIndicator: QQC2.Control {

View File

@@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami
import org.kde.neochat 1.0 import org.kde.neochat 1.0
Kirigami.ScrollablePage { Kirigami.ScrollablePage {
id: searchPage id: root
property NeoChatRoom currentRoom property NeoChatRoom currentRoom
@@ -22,7 +22,7 @@ Kirigami.ScrollablePage {
id: searchModel id: searchModel
connection: Controller.activeConnection connection: Controller.activeConnection
searchText: searchField.text searchText: searchField.text
room: searchPage.currentRoom room: root.currentRoom
} }
header: RowLayout { header: RowLayout {

View File

@@ -12,7 +12,7 @@ import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.neochat 1.0 import org.kde.neochat 1.0
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
id: deviceDelegate id: root
required property string id required property string id
required property string timestamp required property string timestamp
@@ -21,7 +21,7 @@ FormCard.AbstractFormDelegate {
property bool editDeviceName: false property bool editDeviceName: false
property bool showVerifyButton property bool showVerifyButton
onClicked: deviceDelegate.editDeviceName = true onClicked: root.editDeviceName = true
contentItem: RowLayout { contentItem: RowLayout {
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
@@ -35,11 +35,11 @@ FormCard.AbstractFormDelegate {
id: deviceLabel id: deviceLabel
Layout.fillWidth: true Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
visible: !deviceDelegate.editDeviceName visible: !root.editDeviceName
QQC2.Label { QQC2.Label {
Layout.fillWidth: true Layout.fillWidth: true
text: deviceDelegate.displayName text: root.displayName
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.Wrap wrapMode: Text.Wrap
maximumLineCount: 2 maximumLineCount: 2
@@ -47,7 +47,7 @@ FormCard.AbstractFormDelegate {
QQC2.Label { QQC2.Label {
Layout.fillWidth: true Layout.fillWidth: true
text: i18nc("@label", "%1, Last activity: %2", deviceDelegate.id, deviceDelegate.timestamp) text: i18nc("@label", "%1, Last activity: %2", root.id, root.timestamp)
color: Kirigami.Theme.disabledTextColor color: Kirigami.Theme.disabledTextColor
font: Kirigami.Theme.smallFont font: Kirigami.Theme.smallFont
elide: Text.ElideRight elide: Text.ElideRight
@@ -59,29 +59,29 @@ FormCard.AbstractFormDelegate {
Accessible.description: i18n("New device name") Accessible.description: i18n("New device name")
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: deviceLabel.implicitHeight Layout.preferredHeight: deviceLabel.implicitHeight
visible: deviceDelegate.editDeviceName visible: root.editDeviceName
text: deviceDelegate.displayName text: root.displayName
rightActions: [ rightActions: [
Kirigami.Action { Kirigami.Action {
text: i18n("Cancel editing display name") text: i18n("Cancel editing display name")
icon.name: "edit-delete-remove" icon.name: "edit-delete-remove"
onTriggered: { onTriggered: {
deviceDelegate.editDeviceName = false root.editDeviceName = false
} }
}, },
Kirigami.Action { Kirigami.Action {
text: i18n("Confirm new display name") text: i18n("Confirm new display name")
icon.name: "checkmark" icon.name: "checkmark"
visible: nameField.text !== deviceDelegate.displayName visible: nameField.text !== root.displayName
onTriggered: { onTriggered: {
devicesModel.setName(deviceDelegate.id, nameField.text) devicesModel.setName(root.id, nameField.text)
} }
} }
] ]
onAccepted: devicesModel.setName(deviceDelegate.id, nameField.text) onAccepted: devicesModel.setName(root.id, nameField.text)
} }
QQC2.ToolButton { QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
@@ -89,7 +89,7 @@ FormCard.AbstractFormDelegate {
id: editDeviceAction id: editDeviceAction
text: i18n("Edit device name") text: i18n("Edit device name")
icon.name: "document-edit" icon.name: "document-edit"
onTriggered: deviceDelegate.editDeviceName = true onTriggered: root.editDeviceName = true
} }
QQC2.ToolTip { QQC2.ToolTip {
text: editDeviceAction.text text: editDeviceAction.text
@@ -98,13 +98,13 @@ FormCard.AbstractFormDelegate {
} }
QQC2.ToolButton { QQC2.ToolButton {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
visible: deviceDelegate.showVerifyButton visible: root.showVerifyButton
action: Kirigami.Action { action: Kirigami.Action {
id: verifyDeviceAction id: verifyDeviceAction
text: i18n("Verify device") text: i18n("Verify device")
icon.name: "security-low-symbolic" icon.name: "security-low-symbolic"
onTriggered: { onTriggered: {
devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, deviceDelegate.id) devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, root.id)
} }
} }
QQC2.ToolTip { QQC2.ToolTip {
@@ -119,7 +119,7 @@ FormCard.AbstractFormDelegate {
text: i18n("Logout device") text: i18n("Logout device")
icon.name: "edit-delete-remove" icon.name: "edit-delete-remove"
onTriggered: { onTriggered: {
passwordSheet.deviceId = deviceDelegate.id passwordSheet.deviceId = root.id
passwordSheet.open() passwordSheet.open()
} }
} }

View File

@@ -9,7 +9,7 @@ import QtQuick.Layouts 1.15
import org.kde.neochat 1.0 import org.kde.neochat 1.0
KirigamiSettings.CategorizedSettings { KirigamiSettings.CategorizedSettings {
id: settingsPage id: root
required property NeoChatConnection connection required property NeoChatConnection connection
@@ -66,7 +66,7 @@ KirigamiSettings.CategorizedSettings {
page: Qt.resolvedUrl("DevicesPage.qml") page: Qt.resolvedUrl("DevicesPage.qml")
initialProperties: { initialProperties: {
return { return {
connection: settingsPage.connection connection: root.connection
} }
} }
}, },

View File

@@ -9,7 +9,7 @@ import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami import org.kde.kirigami 2.15 as Kirigami
QQC2.RadioButton { QQC2.RadioButton {
id: delegate id: root
implicitWidth: contentItem.implicitWidth implicitWidth: contentItem.implicitWidth
implicitHeight: contentItem.implicitHeight implicitHeight: contentItem.implicitHeight
@@ -20,7 +20,7 @@ QQC2.RadioButton {
contentItem: ColumnLayout { contentItem: ColumnLayout {
Kirigami.ShadowedRectangle { Kirigami.ShadowedRectangle {
implicitWidth: implicitHeight * 1.6 implicitWidth: implicitHeight * 1.6
implicitHeight: delegate.thin ? Kirigami.Units.gridUnit * 5 : Kirigami.Units.gridUnit * 6 implicitHeight: root.thin ? Kirigami.Units.gridUnit * 5 : Kirigami.Units.gridUnit * 6
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
@@ -31,9 +31,9 @@ QQC2.RadioButton {
shadow.color: Qt.rgba(0, 0, 0, 0.3) shadow.color: Qt.rgba(0, 0, 0, 0.3)
color: { color: {
if (delegate.checked) { if (root.checked) {
return Kirigami.Theme.highlightColor; return Kirigami.Theme.highlightColor;
} else if (delegate.hovered) { } else if (root.hovered) {
// Match appearance of hovered list items // Match appearance of hovered list items
return Qt.rgba(Kirigami.Theme.highlightColor.r, return Qt.rgba(Kirigami.Theme.highlightColor.r,
Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.g,
@@ -54,7 +54,7 @@ QQC2.RadioButton {
QQC2.Label { QQC2.Label {
id: label id: label
Layout.fillWidth: true Layout.fillWidth: true
text: delegate.text text: root.text
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
} }