Run qmlformat over everything

This commit is contained in:
Tobias Fella
2024-01-31 22:45:40 +01:00
parent 6029c0d0b3
commit fe52d26f05
126 changed files with 1481 additions and 1183 deletions

View File

@@ -40,9 +40,8 @@ FormCard.FormCardPage {
if (fileDialog) { if (fileDialog) {
return; return;
} }
fileDialog = openFileDialog.createObject(this); fileDialog = openFileDialog.createObject(this);
fileDialog.chosen.connect((receivedSource) => { fileDialog.chosen.connect(receivedSource => {
if (!receivedSource) { if (!receivedSource) {
return; return;
} }
@@ -137,7 +136,9 @@ FormCard.FormCardPage {
visible: root.connection !== undefined && root.connection.canChangePassword === false visible: root.connection !== undefined && root.connection.canChangePassword === false
text: i18n("Your server doesn't support changing your password") text: i18n("Your server doesn't support changing your password")
} }
FormCard.FormDelegateSeparator { visible: root.connection !== undefined && root.connection.canChangePassword === false } FormCard.FormDelegateSeparator {
visible: root.connection !== undefined && root.connection.canChangePassword === false
}
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
id: currentPassword id: currentPassword
label: i18n("Current Password:") label: i18n("Current Password:")
@@ -212,7 +213,11 @@ FormCard.FormCardPage {
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
id: deactivateAccountButton id: deactivateAccountButton
text: i18n("Deactivate Account") text: i18n("Deactivate Account")
onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ConfirmDeactivateAccountDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Confirm Deactivating Account")}) onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ConfirmDeactivateAccountDialog.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Confirm Deactivating Account")
})
} }
} }

View File

@@ -24,24 +24,24 @@ QQC2.Menu {
connection: root.connection connection: root.connection
}, { }, {
title: i18n("Account editor") title: i18n("Account editor")
}); })
} }
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Notification settings") text: i18n("Notification settings")
icon.name: "notifications" icon.name: "notifications"
onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", {
defaultPage: "notifications", defaultPage: "notifications",
connection: root.connection, connection: root.connection
}, { }, {
title: i18n("Configure") title: i18n("Configure")
}); })
} }
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Devices") text: i18n("Devices")
icon.name: "computer-symbolic" icon.name: "computer-symbolic"
onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", {
defaultPage: "devices", defaultPage: "devices",
connection: root.connection, connection: root.connection
}, { }, {
title: i18n("Configure") title: i18n("Configure")
}) })

View File

@@ -80,7 +80,7 @@ FormCard.FormCardPage {
connection: accountDelegate.connection connection: accountDelegate.connection
onAccepted: { onAccepted: {
if (AccountRegistry.accountCount === 1) { if (AccountRegistry.accountCount === 1) {
root.Window.window.close() root.Window.window.close();
} }
} }
} }
@@ -93,7 +93,9 @@ FormCard.FormCardPage {
} }
} }
} }
FormCard.FormDelegateSeparator { below: addAccountDelegate } FormCard.FormDelegateSeparator {
below: addAccountDelegate
}
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
id: addAccountDelegate id: addAccountDelegate
@@ -107,7 +109,7 @@ FormCard.FormCardPage {
target: Controller target: Controller
function onConnectionAdded() { function onConnectionAdded() {
if (pageStack.layers.depth > 2) { if (pageStack.layers.depth > 2) {
pageStack.layers.pop() pageStack.layers.pop();
} }
} }
} }

View File

@@ -31,7 +31,9 @@ FormCard.FormCardPage {
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
QQC2.ButtonGroup { id: themeGroup } QQC2.ButtonGroup {
id: themeGroup
}
ThemeRadioButton { ThemeRadioButton {
thin: timelineModeSetting.width < Kirigami.Units.gridUnit * 22 thin: timelineModeSetting.width < Kirigami.Units.gridUnit * 22
innerObject: [ innerObject: [
@@ -196,7 +198,9 @@ FormCard.FormCardPage {
} }
} }
FormCard.FormDelegateSeparator { below: compactRoomListDelegate } FormCard.FormDelegateSeparator {
below: compactRoomListDelegate
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: compactRoomListDelegate id: compactRoomListDelegate
@@ -208,7 +212,11 @@ FormCard.FormCardPage {
} }
} }
FormCard.FormDelegateSeparator { above: compactRoomListDelegate ; below: colorSchemeDelegate.item ; visible: colorSchemeDelegate.visible } FormCard.FormDelegateSeparator {
above: compactRoomListDelegate
below: colorSchemeDelegate.item
visible: colorSchemeDelegate.visible
}
Loader { Loader {
id: colorSchemeDelegate id: colorSchemeDelegate
@@ -231,7 +239,10 @@ FormCard.FormCardPage {
} }
} }
FormCard.FormDelegateSeparator { above: showFancyEffectsDelegate ; below: hasWindowSystemDelegate } FormCard.FormDelegateSeparator {
above: showFancyEffectsDelegate
below: hasWindowSystemDelegate
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: hasWindowSystemDelegate id: hasWindowSystemDelegate
@@ -245,7 +256,10 @@ FormCard.FormCardPage {
} }
} }
FormCard.FormDelegateSeparator { above: hasWindowSystemDelegate; below: transparencyDelegate } FormCard.FormDelegateSeparator {
above: hasWindowSystemDelegate
below: transparencyDelegate
}
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
id: transparencyDelegate id: transparencyDelegate
@@ -269,7 +283,9 @@ FormCard.FormCardPage {
} }
Layout.fillWidth: true Layout.fillWidth: true
HoverHandler { id: sliderHover } HoverHandler {
id: sliderHover
}
QQC2.ToolTip.visible: sliderHover.hovered && !enabled QQC2.ToolTip.visible: sliderHover.hovered && !enabled
QQC2.ToolTip.text: i18n("Only enabled if the transparent chat page is enabled.") QQC2.ToolTip.text: i18n("Only enabled if the transparent chat page is enabled.")
} }
@@ -280,7 +296,11 @@ FormCard.FormCardPage {
} }
} }
FormCard.FormDelegateSeparator { above: transparencyDelegate; below: showLocalMessagesOnRightDelegate; visible: transparencyDelegate.visible } FormCard.FormDelegateSeparator {
above: transparencyDelegate
below: showLocalMessagesOnRightDelegate
visible: transparencyDelegate.visible
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showLocalMessagesOnRightDelegate id: showLocalMessagesOnRightDelegate
@@ -288,25 +308,27 @@ FormCard.FormCardPage {
checked: Config.showLocalMessagesOnRight checked: Config.showLocalMessagesOnRight
enabled: !Config.isShowLocalMessagesOnRightImmutable && !Config.compactLayout enabled: !Config.isShowLocalMessagesOnRightImmutable && !Config.compactLayout
onToggled: { onToggled: {
Config.showLocalMessagesOnRight = checked Config.showLocalMessagesOnRight = checked;
Config.save() Config.save();
} }
} }
FormCard.FormDelegateSeparator { above: showLocalMessagesOnRightDelegate; below: showLinkPreviewDelegate } FormCard.FormDelegateSeparator {
above: showLocalMessagesOnRightDelegate
below: showLinkPreviewDelegate
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showLinkPreviewDelegate id: showLinkPreviewDelegate
text: i18n("Show links preview in the chat messages") text: i18n("Show links preview in the chat messages")
checked: Config.showLinkPreview checked: Config.showLinkPreview
onToggled: { onToggled: {
Config.showLinkPreview = checked Config.showLinkPreview = checked;
Config.save() Config.save();
} }
} }
} }
FormCard.FormHeader { FormCard.FormHeader {
title: i18n("Show Avatar") title: i18n("Show Avatar")
} }
@@ -315,8 +337,8 @@ FormCard.FormCardPage {
text: i18n("In chat") text: i18n("In chat")
checked: Config.showAvatarInTimeline checked: Config.showAvatarInTimeline
onToggled: { onToggled: {
Config.showAvatarInTimeline = checked Config.showAvatarInTimeline = checked;
Config.save() Config.save();
} }
enabled: !Config.isShowAvatarInTimelineImmutable enabled: !Config.isShowAvatarInTimelineImmutable
} }
@@ -326,8 +348,8 @@ FormCard.FormCardPage {
checked: Config.showAvatarInRoomDrawer checked: Config.showAvatarInRoomDrawer
enabled: !Config.isShowAvatarInRoomDrawerImmutable enabled: !Config.isShowAvatarInRoomDrawerImmutable
onToggled: { onToggled: {
Config.showAvatarInRoomDrawer = checked Config.showAvatarInRoomDrawer = checked;
Config.save() Config.save();
} }
} }
} }

View File

@@ -27,11 +27,10 @@ QQC2.Popup {
text: i18n("Choose local file") text: i18n("Choose local file")
onClicked: { onClicked: {
root.close() root.close();
var fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay);
var fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay) fileDialog.chosen.connect(path => root.chosen(path));
fileDialog.chosen.connect(path => root.chosen(path)) fileDialog.open();
fileDialog.open()
} }
} }
@@ -46,11 +45,11 @@ QQC2.Popup {
icon.name: 'insert-image' icon.name: 'insert-image'
text: i18n("Clipboard image") text: i18n("Clipboard image")
onClicked: { onClicked: {
const path = StandardPaths.standardLocations(StandardPaths.CacheLocation)[0] + "/screenshots/" + (new Date()).getTime() + ".png" const path = StandardPaths.standardLocations(StandardPaths.CacheLocation)[0] + "/screenshots/" + (new Date()).getTime() + ".png";
if (!Clipboard.saveImage(path)) { if (!Clipboard.saveImage(path)) {
return; return;
} }
root.chosen(path) root.chosen(path);
root.close(); root.close();
} }
} }

View File

@@ -13,7 +13,7 @@ import org.kde.neochat
ColumnLayout { ColumnLayout {
id: root id: root
signal attachmentCancelled() signal attachmentCancelled
property string attachmentPath property string attachmentPath
@@ -47,7 +47,7 @@ ColumnLayout {
onClicked: { onClicked: {
let imageEditor = applicationWindow().pageStack.layers.push(imageEditorPage); let imageEditor = applicationWindow().pageStack.layers.push(imageEditorPage);
imageEditor.newPathChanged.connect(function(newPath) { imageEditor.newPathChanged.connect(function (newPath) {
applicationWindow().pageStack.layers.pop(); applicationWindow().pageStack.layers.pop();
root.attachmentPath = newPath; root.attachmentPath = newPath;
}); });
@@ -61,7 +61,7 @@ ColumnLayout {
action: Kirigami.Action { action: Kirigami.Action {
text: i18n("Cancel sending attachment") text: i18n("Cancel sending attachment")
icon.name: "dialog-close" icon.name: "dialog-close"
onTriggered: attachmentCancelled(); onTriggered: attachmentCancelled()
shortcut: "Escape" shortcut: "Escape"
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
@@ -81,14 +81,14 @@ ColumnLayout {
onSourceChanged: { onSourceChanged: {
// Reset source size height, which affect implicitHeight // Reset source size height, which affect implicitHeight
sourceSize.height = -1 sourceSize.height = -1;
} }
onSourceSizeChanged: { onSourceSizeChanged: {
if (implicitHeight > Kirigami.Units.gridUnit * 8) { if (implicitHeight > Kirigami.Units.gridUnit * 8) {
// This can save a lot of RAM when loading large images. // This can save a lot of RAM when loading large images.
// It also improves visual quality for large images. // It also improves visual quality for large images.
sourceSize.height = Kirigami.Units.gridUnit * 8 sourceSize.height = Kirigami.Units.gridUnit * 8;
} }
} }

View File

@@ -67,7 +67,7 @@ MessageDelegate {
target: playButton target: playButton
icon.name: "media-playback-stop" icon.name: "media-playback-stop"
onClicked: { onClicked: {
root.room.cancelFileTransfer(root.eventId) root.room.cancelFileTransfer(root.eventId);
} }
} }
}, },
@@ -78,7 +78,7 @@ MessageDelegate {
target: playButton target: playButton
icon.name: "media-playback-start" icon.name: "media-playback-start"
onClicked: { onClicked: {
audio.play() audio.play();
} }
} }
}, },

View File

@@ -15,8 +15,8 @@ Delegates.RoundedItemDelegate {
property url source property url source
signal contextMenuRequested() signal contextMenuRequested
signal selected() signal selected
padding: Kirigami.Units.largeSpacing padding: Kirigami.Units.largeSpacing
@@ -24,9 +24,9 @@ Delegates.RoundedItemDelegate {
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
Accessible.onPressAction: selected(); Accessible.onPressAction: selected()
Keys.onSpacePressed: selected(); Keys.onSpacePressed: selected()
Keys.onEnterPressed: selected(); Keys.onEnterPressed: selected()
onPressAndHold: root.contextMenuRequested() onPressAndHold: root.contextMenuRequested()

View File

@@ -44,8 +44,8 @@ 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: {
root.room.ban(root.userId, reason.text) root.room.ban(root.userId, reason.text);
root.closeDialog() root.closeDialog();
} }
} }
QQC2.Button { QQC2.Button {

View File

@@ -183,7 +183,7 @@ QQC2.Control {
Connections { Connections {
target: replyLoader.item target: replyLoader.item
function onReplyClicked() { function onReplyClicked() {
replyClicked(root.replyId) replyClicked(root.replyId);
} }
} }
} }
@@ -202,20 +202,22 @@ QQC2.Control {
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
color: if (root.author.isLocalUser) { color: if (root.author.isLocalUser) {
return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15) return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15);
} else if (root.showHighlight) { } else if (root.showHighlight) {
return Kirigami.Theme.positiveBackgroundColor return Kirigami.Theme.positiveBackgroundColor;
} else { } else {
return Kirigami.Theme.backgroundColor return Kirigami.Theme.backgroundColor;
} }
radius: Kirigami.Units.smallSpacing radius: Kirigami.Units.smallSpacing
shadow { shadow {
size: Kirigami.Units.smallSpacing size: Kirigami.Units.smallSpacing
color: root.showHighlight ? Qt.rgba(0.0, 0.0, 0.0, 0.10) : Qt.rgba(Kirigami.Theme.textColor.r, Kirigami.Theme.textColor.g, Kirigami.Theme.textColor.b, 0.10) color: root.showHighlight ? Qt.rgba(0.0, 0.0, 0.0, 0.10) : Qt.rgba(Kirigami.Theme.textColor.r, Kirigami.Theme.textColor.g, Kirigami.Theme.textColor.b, 0.10)
} }
Behavior on color { Behavior on color {
ColorAnimation { duration: Kirigami.Units.shortDuration } ColorAnimation {
duration: Kirigami.Units.shortDuration
}
} }
} }

View File

@@ -20,7 +20,7 @@ LoginStep {
url: "http://localhost:20847" url: "http://localhost:20847"
implicitHeight: 500 implicitHeight: 500
onLoadingChanged: { onLoadingChanged: {
webview.runJavaScript("document.body.style.background = '" + Kirigami.Theme.backgroundColor + "'") webview.runJavaScript("document.body.style.background = '" + Kirigami.Theme.backgroundColor + "'");
} }
Timer { Timer {
@@ -29,15 +29,15 @@ LoginStep {
running: true running: true
interval: 300 interval: 300
onTriggered: { onTriggered: {
if(!webview.visible) { if (!webview.visible) {
return return;
} }
webview.runJavaScript("!!grecaptcha ? grecaptcha.getResponse() : \"\"", function(response){ webview.runJavaScript("!!grecaptcha ? grecaptcha.getResponse() : \"\"", function (response) {
if(!webview.visible || !response) if (!webview.visible || !response)
return return;
timer.running = false; timer.running = false;
Registration.recaptchaResponse = response; Registration.recaptchaResponse = response;
}) });
} }
} }
} }

View File

@@ -25,7 +25,7 @@ KirigamiSettings.CategorizedSettings {
return { return {
room: root.room, room: root.room,
connection: root.connection connection: root.connection
} };
} }
}, },
KirigamiSettings.SettingAction { KirigamiSettings.SettingAction {
@@ -36,7 +36,7 @@ KirigamiSettings.CategorizedSettings {
initialProperties: { initialProperties: {
return { return {
room: root.room room: root.room
} };
} }
}, },
KirigamiSettings.SettingAction { KirigamiSettings.SettingAction {
@@ -47,7 +47,7 @@ KirigamiSettings.CategorizedSettings {
initialProperties: { initialProperties: {
return { return {
room: root.room room: root.room
} };
} }
}, },
KirigamiSettings.SettingAction { KirigamiSettings.SettingAction {
@@ -58,7 +58,7 @@ KirigamiSettings.CategorizedSettings {
initialProperties: { initialProperties: {
return { return {
room: root.room room: root.room
} };
} }
} }
] ]

View File

@@ -57,15 +57,15 @@ QQC2.Control {
property bool isBusy: root.currentRoom && root.currentRoom.hasFileUploading property bool isBusy: root.currentRoom && root.currentRoom.hasFileUploading
// Matrix does not allow sending attachments in replies // Matrix does not allow sending attachments in replies
visible: _private.chatBarCache.replyId.length === 0 && _private.chatBarCache.attachmentPath.length === 0 visible: _private.chatBarCache.replyId.length === 0 && _private.chatBarCache.attachmentPath.length === 0
icon.name: "mail-attachment" icon.name: "mail-attachment"
text: i18n("Attach an image or file") text: i18n("Attach an image or file")
displayHint: Kirigami.DisplayHint.IconOnly displayHint: Kirigami.DisplayHint.IconOnly
onTriggered: { onTriggered: {
let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(applicationWindow().overlay) let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(applicationWindow().overlay);
dialog.chosen.connect(path => _private.chatBarCache.attachmentPath = path) dialog.chosen.connect(path => _private.chatBarCache.attachmentPath = path);
dialog.open() dialog.open();
} }
tooltip: text tooltip: text
@@ -83,9 +83,9 @@ QQC2.Control {
onTriggered: { onTriggered: {
if (emojiDialog.visible) { if (emojiDialog.visible) {
emojiDialog.close() emojiDialog.close();
} else { } else {
emojiDialog.open() emojiDialog.open();
} }
} }
tooltip: text tooltip: text
@@ -98,7 +98,9 @@ QQC2.Control {
displayHint: QQC2.AbstractButton.IconOnly displayHint: QQC2.AbstractButton.IconOnly
onTriggered: { onTriggered: {
locationChooser.createObject(QQC2.ApplicationWindow.overlay, {room: root.currentRoom}).open() locationChooser.createObject(QQC2.ApplicationWindow.overlay, {
room: root.currentRoom
}).open();
} }
tooltip: text tooltip: text
}, },
@@ -113,7 +115,7 @@ QQC2.Control {
checkable: true checkable: true
onTriggered: { onTriggered: {
_private.postMessage() _private.postMessage();
} }
tooltip: text tooltip: text
@@ -123,7 +125,7 @@ QQC2.Control {
/** /**
* @brief A message has been sent from the chat bar. * @brief A message has been sent from the chat bar.
*/ */
signal messageSent() signal messageSent
spacing: 0 spacing: 0
@@ -134,7 +136,7 @@ QQC2.Control {
color: Kirigami.Theme.backgroundColor color: Kirigami.Theme.backgroundColor
Kirigami.Separator { Kirigami.Separator {
anchors.left: parent.left anchors.left: parent.left
anchors.right:parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
} }
} }
@@ -146,7 +148,8 @@ QQC2.Control {
contentItem: ColumnLayout { contentItem: ColumnLayout {
spacing: 0 spacing: 0
Item { // Required to adjust for the top separator Item {
// Required to adjust for the top separator
Layout.preferredHeight: 1 Layout.preferredHeight: 1
Layout.fillWidth: true Layout.fillWidth: true
} }
@@ -200,17 +203,17 @@ QQC2.Control {
onTextChanged: { onTextChanged: {
if (!repeatTimer.running && Config.typingNotifications) { if (!repeatTimer.running && Config.typingNotifications) {
var textExists = text.length > 0 var textExists = text.length > 0;
root.currentRoom.sendTypingNotification(textExists) root.currentRoom.sendTypingNotification(textExists);
textExists ? repeatTimer.start() : repeatTimer.stop() textExists ? repeatTimer.start() : repeatTimer.stop();
} }
_private.chatBarCache.text = text _private.chatBarCache.text = text;
} }
onSelectedTextChanged: { onSelectedTextChanged: {
if (selectedText.length > 0) { if (selectedText.length > 0) {
quickFormatBar.selectionStart = selectionStart quickFormatBar.selectionStart = selectionStart;
quickFormatBar.selectionEnd = selectionEnd quickFormatBar.selectionEnd = selectionEnd;
quickFormatBar.open() quickFormatBar.open();
} }
} }
@@ -225,42 +228,42 @@ QQC2.Control {
Keys.onDeletePressed: { Keys.onDeletePressed: {
if (selectedText.length > 0) { if (selectedText.length > 0) {
remove(selectionStart, selectionEnd) remove(selectionStart, selectionEnd);
} else { } else {
remove(cursorPosition, cursorPosition + 1) remove(cursorPosition, cursorPosition + 1);
} }
if (textField.text == selectedText || textField.text.length <= 1) { if (textField.text == selectedText || textField.text.length <= 1) {
root.currentRoom.sendTypingNotification(false) root.currentRoom.sendTypingNotification(false);
repeatTimer.stop() repeatTimer.stop();
} }
if (quickFormatBar.visible) { if (quickFormatBar.visible) {
quickFormatBar.close() quickFormatBar.close();
} }
} }
Keys.onEnterPressed: event => { Keys.onEnterPressed: event => {
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.complete() completionMenu.complete();
} else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile) { } else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile) {
textField.insert(cursorPosition, "\n") textField.insert(cursorPosition, "\n");
} else { } else {
_private.postMessage(); _private.postMessage();
} }
} }
Keys.onReturnPressed: event => { Keys.onReturnPressed: event => {
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.complete() completionMenu.complete();
} else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile) { } else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile) {
textField.insert(cursorPosition, "\n") textField.insert(cursorPosition, "\n");
} else { } else {
_private.postMessage(); _private.postMessage();
} }
} }
Keys.onTabPressed: { Keys.onTabPressed: {
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.complete() completionMenu.complete();
} }
} }
Keys.onPressed: (event) => { Keys.onPressed: event => {
if (event.key === Qt.Key_V && event.modifiers & Qt.ControlModifier) { if (event.key === Qt.Key_V && event.modifiers & Qt.ControlModifier) {
event.accepted = _private.pasteImage(); event.accepted = _private.pasteImage();
} else if (event.key === Qt.Key_Up && event.modifiers & Qt.ControlModifier) { } else if (event.key === Qt.Key_Up && event.modifiers & Qt.ControlModifier) {
@@ -268,26 +271,26 @@ QQC2.Control {
} else if (event.key === Qt.Key_Up && textField.text.length === 0) { } else if (event.key === Qt.Key_Up && textField.text.length === 0) {
root.currentRoom.editLastMessage(); root.currentRoom.editLastMessage();
} else if (event.key === Qt.Key_Up && completionMenu.visible) { } else if (event.key === Qt.Key_Up && completionMenu.visible) {
completionMenu.decrementIndex() completionMenu.decrementIndex();
} else if (event.key === Qt.Key_Down && completionMenu.visible) { } else if (event.key === Qt.Key_Down && completionMenu.visible) {
completionMenu.incrementIndex() completionMenu.incrementIndex();
} else if (event.key === Qt.Key_Backspace) { } else if (event.key === Qt.Key_Backspace) {
if (textField.text == selectedText || textField.text.length <= 1) { if (textField.text == selectedText || textField.text.length <= 1) {
root.currentRoom.sendTypingNotification(false) root.currentRoom.sendTypingNotification(false);
repeatTimer.stop() repeatTimer.stop();
} }
if (quickFormatBar.visible && selectedText.length > 0) { if (quickFormatBar.visible && selectedText.length > 0) {
quickFormatBar.close() quickFormatBar.close();
} }
} }
} }
Keys.onShortcutOverride: event => { Keys.onShortcutOverride: event => {
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.close() completionMenu.close();
} else if ((_private.chatBarCache.isReplying || _private.chatBarCache.attachmentPath.length > 0) && event.key === Qt.Key_Escape) { } else if ((_private.chatBarCache.isReplying || _private.chatBarCache.attachmentPath.length > 0) && event.key === Qt.Key_Escape) {
_private.chatBarCache.attachmentPath = "" _private.chatBarCache.attachmentPath = "";
_private.chatBarCache.replyId = "" _private.chatBarCache.replyId = "";
_private.chatBarCache.threadId = "" _private.chatBarCache.threadId = "";
event.accepted = true; event.accepted = true;
} }
} }
@@ -358,7 +361,7 @@ QQC2.Control {
onAttachmentCancelled: { onAttachmentCancelled: {
_private.chatBarCache.attachmentPath = ""; _private.chatBarCache.attachmentPath = "";
root.forceActiveFocus() root.forceActiveFocus();
} }
} }
} }
@@ -370,11 +373,11 @@ QQC2.Control {
function postMessage() { function postMessage() {
root.actionsHandler.handleMessageEvent(_private.chatBarCache); root.actionsHandler.handleMessageEvent(_private.chatBarCache);
repeatTimer.stop() repeatTimer.stop();
root.currentRoom.markAllMessagesAsRead(); root.currentRoom.markAllMessagesAsRead();
textField.clear(); textField.clear();
_private.chatBarCache.replyId = ""; _private.chatBarCache.replyId = "";
messageSent() messageSent();
} }
function formatText(format, selectionStart, selectionEnd) { function formatText(format, selectionStart, selectionEnd) {
@@ -386,21 +389,19 @@ QQC2.Control {
*/ */
let innerText = textField.text.substr(selectionStart, selectionEnd - selectionStart); let innerText = textField.text.substr(selectionStart, selectionEnd - selectionStart);
if (innerText.charAt(innerText.length - 1) === " ") { if (innerText.charAt(innerText.length - 1) === " ") {
let trimmedRightString = innerText.replace(/\s*$/,""); let trimmedRightString = innerText.replace(/\s*$/, "");
let trimDifference = innerText.length - trimmedRightString.length; let trimDifference = innerText.length - trimmedRightString.length;
selectionEnd -= trimDifference; selectionEnd -= trimDifference;
} }
if (innerText.charAt(0) === " ") { if (innerText.charAt(0) === " ") {
let trimmedLeftString = innerText.replace(/^\s*/,""); let trimmedLeftString = innerText.replace(/^\s*/, "");
let trimDifference = innerText.length - trimmedLeftString.length; let trimDifference = innerText.length - trimmedLeftString.length;
selectionStart = selectionStart + trimDifference; selectionStart = selectionStart + trimDifference;
} }
let startText = textField.text.substr(0, selectionStart); let startText = textField.text.substr(0, selectionStart);
// Needs updating with the new selectionStart and selectionEnd with white space trimmed. // Needs updating with the new selectionStart and selectionEnd with white space trimmed.
innerText = textField.text.substr(selectionStart, selectionEnd - selectionStart); innerText = textField.text.substr(selectionStart, selectionEnd - selectionStart);
let endText = textField.text.substr(selectionEnd); let endText = textField.text.substr(selectionEnd);
textField.text = ""; textField.text = "";
textField.text = startText + format.start + innerText + format.end + format.extra + endText; textField.text = startText + format.start + innerText + format.end + format.extra + endText;
@@ -495,13 +496,14 @@ QQC2.Control {
currentRoom: root.currentRoom currentRoom: root.currentRoom
onChosen: emoji => insertText(emoji) onChosen: emoji => insertText(emoji)
onClosed: if (emojiAction.checked) emojiAction.checked = false onClosed: if (emojiAction.checked) {
emojiAction.checked = false;
}
} }
function insertText(text) { function insertText(text) {
let initialCursorPosition = textField.cursorPosition; let initialCursorPosition = textField.cursorPosition;
textField.text = textField.text.substr(0, initialCursorPosition) + text + textField.text.substr(initialCursorPosition);
textField.text = textField.text.substr(0, initialCursorPosition) + text + textField.text.substr(initialCursorPosition) textField.cursorPosition = initialCursorPosition + text.length;
textField.cursorPosition = initialCursorPosition + text.length
} }
} }

View File

@@ -32,7 +32,7 @@ Kirigami.ScrollablePage {
id: roomDelegate id: roomDelegate
filterText: "" filterText: ""
onSelected: { onSelected: {
root.chosen(roomDelegate.currentRoom.id) root.chosen(roomDelegate.currentRoom.id);
} }
connection: root.connection connection: root.connection
} }

View File

@@ -16,7 +16,7 @@ FormCard.FormComboBoxDelegate {
textRole: "display" textRole: "display"
valueRole: "display" valueRole: "display"
model: ColorSchemer.model model: ColorSchemer.model
Component.onCompleted: currentIndex = ColorSchemer.indexForScheme(Config.colorScheme); Component.onCompleted: currentIndex = ColorSchemer.indexForScheme(Config.colorScheme)
onCurrentValueChanged: { onCurrentValueChanged: {
ColorSchemer.apply(currentIndex); ColorSchemer.apply(currentIndex);
Config.colorScheme = ColorSchemer.nameForIndex(currentIndex); Config.colorScheme = ColorSchemer.nameForIndex(currentIndex);

View File

@@ -21,7 +21,9 @@ QQC2.Popup {
visible: completions.count > 0 visible: completions.count > 0
onVisibleChanged: if (visible) root.open() onVisibleChanged: if (visible) {
root.open();
}
RoomListModel { RoomListModel {
id: roomListModel id: roomListModel
@@ -33,15 +35,15 @@ QQC2.Popup {
} }
function incrementIndex() { function incrementIndex() {
completions.incrementCurrentIndex() completions.incrementCurrentIndex();
} }
function decrementIndex() { function decrementIndex() {
completions.decrementCurrentIndex() completions.decrementCurrentIndex();
} }
function complete() { function complete() {
root.chatDocumentHandler.complete(completions.currentIndex) root.chatDocumentHandler.complete(completions.currentIndex);
} }
leftPadding: 0 leftPadding: 0

View File

@@ -35,8 +35,8 @@ FormCard.FormCardPage {
icon.name: "emblem-warning" icon.name: "emblem-warning"
enabled: passwordField.text.length > 0 enabled: passwordField.text.length > 0
onClicked: { onClicked: {
root.connection.deactivateAccount(passwordField.text) root.connection.deactivateAccount(passwordField.text);
root.closeDialog() root.closeDialog();
} }
} }
} }

View File

@@ -38,7 +38,7 @@ QQC2.Dialog {
text: i18n("Activate Encryption") text: i18n("Activate Encryption")
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
onClicked: { onClicked: {
root.room.activateEncryption() root.room.activateEncryption();
root.close(); root.close();
} }
} }

View File

@@ -21,7 +21,7 @@ Loader {
property NeoChatRoom room property NeoChatRoom room
required property NeoChatConnection connection required property NeoChatConnection connection
signal closed() signal closed
Component { Component {
id: regularMenu id: regularMenu
@@ -30,7 +30,7 @@ Loader {
id: newWindow id: newWindow
text: i18n("Open in New Window") text: i18n("Open in New Window")
icon.name: "window-new" icon.name: "window-new"
onTriggered: RoomManager.openWindow(room); onTriggered: RoomManager.openWindow(room)
visible: !Kirigami.Settings.isMobile visible: !Kirigami.Settings.isMobile
} }
@@ -60,11 +60,11 @@ Loader {
text: room.isDirectChat() ? i18nc("@action:inmenu", "Copy user's Matrix ID to Clipboard") : i18nc("@action:inmenu", "Copy Address to Clipboard") text: room.isDirectChat() ? i18nc("@action:inmenu", "Copy user's Matrix ID to Clipboard") : i18nc("@action:inmenu", "Copy Address to Clipboard")
icon.name: "edit-copy" icon.name: "edit-copy"
onTriggered: if (room.isDirectChat()) { onTriggered: if (room.isDirectChat()) {
Clipboard.saveText(room.directChatRemoteUser.id) Clipboard.saveText(room.directChatRemoteUser.id);
} else if (room.canonicalAlias.length === 0) { } else if (room.canonicalAlias.length === 0) {
Clipboard.saveText(room.id) Clipboard.saveText(room.id);
} else { } else {
Clipboard.saveText(room.canonicalAlias) Clipboard.saveText(room.canonicalAlias);
} }
} }
@@ -80,40 +80,40 @@ Loader {
checked: room.pushNotificationState === PushNotificationState.Default checked: room.pushNotificationState === PushNotificationState.Default
enabled: room.pushNotificationState != PushNotificationState.Unknown enabled: room.pushNotificationState != PushNotificationState.Unknown
onTriggered: { onTriggered: {
room.pushNotificationState = PushNotificationState.Default room.pushNotificationState = PushNotificationState.Default;
} }
} }
QQC2.MenuItem { QQC2.MenuItem {
text: i18nc("As in 'notify for all messages'","All") text: i18nc("As in 'notify for all messages'", "All")
icon.name: "notifications" icon.name: "notifications"
checkable: true checkable: true
autoExclusive: true autoExclusive: true
checked: room.pushNotificationState === PushNotificationState.All checked: room.pushNotificationState === PushNotificationState.All
enabled: room.pushNotificationState != PushNotificationState.Unknown enabled: room.pushNotificationState != PushNotificationState.Unknown
onTriggered: { onTriggered: {
room.pushNotificationState = PushNotificationState.All room.pushNotificationState = PushNotificationState.All;
} }
} }
QQC2.MenuItem { QQC2.MenuItem {
text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'","@Mentions and Keywords") text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'", "@Mentions and Keywords")
icon.name: "im-user" icon.name: "im-user"
checkable: true checkable: true
autoExclusive: true autoExclusive: true
checked: room.pushNotificationState === PushNotificationState.MentionKeyword checked: room.pushNotificationState === PushNotificationState.MentionKeyword
enabled: room.pushNotificationState != PushNotificationState.Unknown enabled: room.pushNotificationState != PushNotificationState.Unknown
onTriggered: { onTriggered: {
room.pushNotificationState = PushNotificationState.MentionKeyword room.pushNotificationState = PushNotificationState.MentionKeyword;
} }
} }
QQC2.MenuItem { QQC2.MenuItem {
text: i18nc("As in 'do not notify for any messages'","Off") text: i18nc("As in 'do not notify for any messages'", "Off")
icon.name: "notifications-disabled" icon.name: "notifications-disabled"
checkable: true checkable: true
autoExclusive: true autoExclusive: true
checked: room.pushNotificationState === PushNotificationState.Mute checked: room.pushNotificationState === PushNotificationState.Mute
enabled: room.pushNotificationState != PushNotificationState.Unknown enabled: room.pushNotificationState != PushNotificationState.Unknown
onTriggered: { onTriggered: {
room.pushNotificationState = PushNotificationState.Mute room.pushNotificationState = PushNotificationState.Mute;
} }
} }
} }
@@ -121,7 +121,12 @@ Loader {
QQC2.MenuItem { QQC2.MenuItem {
text: i18n("Room Settings") text: i18n("Room Settings")
icon.name: "configure" icon.name: "configure"
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: connection}, { title: i18n("Room Settings") }) onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {
room: room,
connection: connection
}, {
title: i18n("Room Settings")
})
} }
QQC2.MenuSeparator {} QQC2.MenuSeparator {}
@@ -133,7 +138,7 @@ Loader {
} }
onClosed: { onClosed: {
root.closed() root.closed();
} }
} }
} }
@@ -190,8 +195,13 @@ Loader {
QQC2.ToolButton { QQC2.ToolButton {
icon.name: 'settings-configure' icon.name: 'settings-configure'
onClicked: { onClicked: {
QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") }) QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {
drawer.close() room: room,
connection: root.connection
}, {
title: i18n("Room Settings")
});
drawer.close();
} }
} }
} }
@@ -214,8 +224,8 @@ Loader {
text: i18n("Leave Room") text: i18n("Leave Room")
icon.name: "go-previous" icon.name: "go-previous"
onClicked: { onClicked: {
RoomManager.leaveRoom(room) RoomManager.leaveRoom(room);
drawer.close() drawer.close();
} }
Layout.fillWidth: true Layout.fillWidth: true
} }

View File

@@ -49,22 +49,30 @@ FormCard.FormCardPage {
valueRole: "isSpace" valueRole: "isSpace"
Component.onCompleted: { Component.onCompleted: {
currentIndex = indexOfValue(root.isSpace) currentIndex = indexOfValue(root.isSpace);
roomTypeModel.append({"text": i18n("Room"), "isSpace": false}); roomTypeModel.append({
roomTypeModel.append({"text": i18n("Space"), "isSpace": true}); "text": i18n("Room"),
roomTypeCombo.currentIndex = 0 "isSpace": false
roomTypeCombo.isInitialising = false });
roomTypeModel.append({
"text": i18n("Space"),
"isSpace": true
});
roomTypeCombo.currentIndex = 0;
roomTypeCombo.isInitialising = false;
} }
onCurrentValueChanged: { onCurrentValueChanged: {
if (!isInitialising) { if (!isInitialising) {
root.isSpace = currentValue root.isSpace = currentValue;
} }
} }
} }
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
id: roomNameField id: roomNameField
label: i18n("Name:") label: i18n("Name:")
onAccepted: if (roomNameField.text.length > 0) roomTopicField.forceActiveFocus(); onAccepted: if (roomNameField.text.length > 0) {
roomTopicField.forceActiveFocus();
}
} }
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
@@ -88,8 +96,8 @@ FormCard.FormCardPage {
} else { } else {
root.connection.createRoom(roomNameField.text, roomTopicField.text, root.parentId, newOfficialCheck.checked); root.connection.createRoom(roomNameField.text, roomTopicField.text, root.parentId, newOfficialCheck.checked);
} }
root.newChild(roomNameField.text) root.newChild(roomNameField.text);
root.closeDialog() root.closeDialog();
} }
} }
} }
@@ -103,7 +111,11 @@ FormCard.FormCardPage {
visible: !chosenRoomDelegate.visible visible: !chosenRoomDelegate.visible
text: i18nc("@action:button", "Pick room") text: i18nc("@action:button", "Pick room")
onClicked: { onClicked: {
let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Explore Rooms")
});
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
chosenRoomDelegate.roomId = roomId; chosenRoomDelegate.roomId = roomId;
chosenRoomDelegate.displayName = displayName; chosenRoomDelegate.displayName = displayName;
@@ -113,7 +125,7 @@ FormCard.FormCardPage {
chosenRoomDelegate.memberCount = memberCount; chosenRoomDelegate.memberCount = memberCount;
chosenRoomDelegate.isJoined = isJoined; chosenRoomDelegate.isJoined = isJoined;
chosenRoomDelegate.visible = true; chosenRoomDelegate.visible = true;
}) });
} }
} }
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
@@ -158,7 +170,7 @@ FormCard.FormCardPage {
QQC2.Label { QQC2.Label {
Layout.fillWidth: true Layout.fillWidth: true
visible: text visible: text
text: chosenRoomDelegate.topic ? chosenRoomDelegate.topic.replace(/(\r\n\t|\n|\r\t)/gm," ") : "" text: chosenRoomDelegate.topic ? chosenRoomDelegate.topic.replace(/(\r\n\t|\n|\r\t)/gm, " ") : ""
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
@@ -182,7 +194,11 @@ FormCard.FormCardPage {
} }
onClicked: { onClicked: {
let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Explore Rooms")
});
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
chosenRoomDelegate.roomId = roomId; chosenRoomDelegate.roomId = roomId;
chosenRoomDelegate.displayName = displayName; chosenRoomDelegate.displayName = displayName;
@@ -192,7 +208,7 @@ FormCard.FormCardPage {
chosenRoomDelegate.memberCount = memberCount; chosenRoomDelegate.memberCount = memberCount;
chosenRoomDelegate.isJoined = isJoined; chosenRoomDelegate.isJoined = isJoined;
chosenRoomDelegate.visible = true; chosenRoomDelegate.visible = true;
}) });
} }
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {

View File

@@ -68,7 +68,7 @@ FormCard.AbstractFormDelegate {
text: i18n("Cancel editing display name") text: i18n("Cancel editing display name")
icon.name: "edit-delete-remove" icon.name: "edit-delete-remove"
onTriggered: { onTriggered: {
root.editDeviceName = false root.editDeviceName = false;
} }
}, },
Kirigami.Action { Kirigami.Action {
@@ -76,7 +76,7 @@ FormCard.AbstractFormDelegate {
icon.name: "checkmark" icon.name: "checkmark"
visible: nameField.text !== root.displayName visible: nameField.text !== root.displayName
onTriggered: { onTriggered: {
devicesModel.setName(root.id, nameField.text) devicesModel.setName(root.id, nameField.text);
} }
} }
] ]
@@ -104,7 +104,7 @@ FormCard.AbstractFormDelegate {
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, root.id) devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, root.id);
} }
} }
QQC2.ToolTip { QQC2.ToolTip {
@@ -119,8 +119,8 @@ FormCard.AbstractFormDelegate {
text: i18n("Logout device") text: i18n("Logout device")
icon.name: "edit-delete-remove" icon.name: "edit-delete-remove"
onTriggered: { onTriggered: {
passwordSheet.deviceId = root.id passwordSheet.deviceId = root.id;
passwordSheet.open() passwordSheet.open();
} }
} }
QQC2.ToolTip { QQC2.ToolTip {

View File

@@ -44,6 +44,3 @@ ColumnLayout {
} }
} }
} }

View File

@@ -53,7 +53,7 @@ FormCard.FormCardPage {
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
Layout.fillWidth: true Layout.fillWidth: true
visible: root.connection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device visible: root.connection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device
contentItem: Kirigami.LoadingPlaceholder { } contentItem: Kirigami.LoadingPlaceholder {}
} }
Kirigami.InlineMessage { Kirigami.InlineMessage {
@@ -87,9 +87,9 @@ FormCard.FormCardPage {
text: i18nc("As in 'Remove this device'", "Remove") text: i18nc("As in 'Remove this device'", "Remove")
icon.name: "delete" icon.name: "delete"
onTriggered: { onTriggered: {
devicesModel.logout(passwordSheet.deviceId, passwordField.text) devicesModel.logout(passwordSheet.deviceId, passwordField.text);
passwordField.text = "" passwordField.text = "";
passwordSheet.close() passwordSheet.close();
} }
} }
] ]

View File

@@ -33,12 +33,12 @@ ColumnLayout {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
onClicked: { onClicked: {
RoomManager.resolveResource(root.room.directChatRemoteUser.id, "mention") RoomManager.resolveResource(root.room.directChatRemoteUser.id, "mention");
} }
contentItem: KirigamiComponents.Avatar { contentItem: KirigamiComponents.Avatar {
name: root.room ? root.room.displayName : "" name: root.room ? root.room.displayName : ""
source: root.room ? ("image://mxc/" + root.room.avatarMediaId) : "" source: root.room ? ("image://mxc/" + root.room.avatarMediaId) : ""
Rectangle { Rectangle {
visible: root.room.usesEncryption visible: root.room.usesEncryption

View File

@@ -15,8 +15,8 @@ Labs.Menu {
text: i18nc("text editing menu action", "Undo") text: i18nc("text editing menu action", "Undo")
shortcut: StandardKey.Undo shortcut: StandardKey.Undo
onTriggered: { onTriggered: {
root.field.undo() root.field.undo();
root.close() root.close();
} }
} }
@@ -25,21 +25,20 @@ Labs.Menu {
text: i18nc("text editing menu action", "Redo") text: i18nc("text editing menu action", "Redo")
shortcut: StandardKey.Redo shortcut: StandardKey.Redo
onTriggered: { onTriggered: {
root.field.undo() root.field.undo();
root.close() root.close();
} }
} }
Labs.MenuSeparator { Labs.MenuSeparator {}
}
Labs.MenuItem { Labs.MenuItem {
enabled: root.field !== null && root.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: {
root.field.cut() root.field.cut();
root.close() root.close();
} }
} }
@@ -48,8 +47,8 @@ Labs.Menu {
text: i18nc("text editing menu action", "Copy") text: i18nc("text editing menu action", "Copy")
shortcut: StandardKey.Copy shortcut: StandardKey.Copy
onTriggered: { onTriggered: {
root.field.copy() root.field.copy();
root.close() root.close();
} }
} }
@@ -58,8 +57,8 @@ Labs.Menu {
text: i18nc("text editing menu action", "Paste") text: i18nc("text editing menu action", "Paste")
shortcut: StandardKey.Paste shortcut: StandardKey.Paste
onTriggered: { onTriggered: {
root.field.paste() root.field.paste();
root.close() root.close();
} }
} }
@@ -68,21 +67,20 @@ Labs.Menu {
text: i18nc("text editing menu action", "Delete") text: i18nc("text editing menu action", "Delete")
shortcut: "" shortcut: ""
onTriggered: { onTriggered: {
root.field.remove(root.field.selectionStart, root.field.selectionEnd) root.field.remove(root.field.selectionStart, root.field.selectionEnd);
root.close() root.close();
} }
} }
Labs.MenuSeparator { Labs.MenuSeparator {}
}
Labs.MenuItem { Labs.MenuItem {
enabled: root.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: {
root.field.selectAll() root.field.selectAll();
root.close() root.close();
} }
} }
} }

View File

@@ -12,7 +12,9 @@ import org.kde.neochat
LoginStep { LoginStep {
id: root id: root
onActiveFocusChanged: if (activeFocus) emailField.forceActiveFocus() onActiveFocusChanged: if (activeFocus) {
emailField.forceActiveFocus();
}
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
id: emailField id: emailField
@@ -21,7 +23,7 @@ LoginStep {
onTextChanged: Registration.email = text onTextChanged: Registration.email = text
Keys.onReturnPressed: { Keys.onReturnPressed: {
if (root.nextAction.enabled) { if (root.nextAction.enabled) {
root.nextAction.trigger() root.nextAction.trigger();
} }
} }
} }
@@ -44,11 +46,11 @@ LoginStep {
enabled: emailField.text.length > 0 enabled: emailField.text.length > 0
onTriggered: { onTriggered: {
if (confirmMessage.visible) { if (confirmMessage.visible) {
Registration.registerAccount() Registration.registerAccount();
} else { } else {
Registration.registerEmail() Registration.registerEmail();
confirmMessage.visible = true confirmMessage.visible = true;
resendButton.visible = true resendButton.visible = true;
} }
} }
} }

View File

@@ -25,16 +25,16 @@ QQC2.Popup {
Connections { Connections {
target: RoomManager target: RoomManager
function onCurrentRoomChanged() { function onCurrentRoomChanged() {
root.close() root.close();
} }
} }
onVisibleChanged: { onVisibleChanged: {
if (!visible) { if (!visible) {
emojiPicker.clearSearchField() emojiPicker.clearSearchField();
return return;
} }
emojiPicker.forceActiveFocus() emojiPicker.forceActiveFocus();
} }
background: Kirigami.ShadowedRectangle { background: Kirigami.ShadowedRectangle {
@@ -68,8 +68,10 @@ QQC2.Popup {
includeCustom: root.includeCustom includeCustom: root.includeCustom
showQuickReaction: root.showQuickReaction showQuickReaction: root.showQuickReaction
onChosen: emoji => { onChosen: emoji => {
root.chosen(emoji) root.chosen(emoji);
if (root.closeOnChosen) root.close() if (root.closeOnChosen) {
root.close();
}
} }
} }
} }

View File

@@ -22,7 +22,7 @@ QQC2.ScrollView {
signal stickerChosen(int index) signal stickerChosen(int index)
onActiveFocusChanged: if (activeFocus) { onActiveFocusChanged: if (activeFocus) {
emojis.forceActiveFocus() emojis.forceActiveFocus();
} }
GridView { GridView {
@@ -34,9 +34,9 @@ QQC2.ScrollView {
currentIndex: -1 currentIndex: -1
keyNavigationEnabled: true keyNavigationEnabled: true
onActiveFocusChanged: if (activeFocus && currentIndex === -1) { onActiveFocusChanged: if (activeFocus && currentIndex === -1) {
currentIndex = 0 currentIndex = 0;
} else { } else {
currentIndex = -1 currentIndex = -1;
} }
onModelChanged: currentIndex = -1 onModelChanged: currentIndex = -1
@@ -61,19 +61,23 @@ QQC2.ScrollView {
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
onClicked: { onClicked: {
if (root.stickers) { if (root.stickers) {
root.stickerChosen(model.index) root.stickerChosen(model.index);
} }
root.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()
onPressAndHold: { onPressAndHold: {
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: root.targetIconSize}) let tones = tonesPopupComponent.createObject(emojiDelegate, {
tones.open() shortName: modelData.shortName,
tones.forceActiveFocus() unicode: modelData.unicode,
categoryIconSize: root.targetIconSize
});
tones.open();
tones.forceActiveFocus();
} }
showTones: !!modelData && EmojiModel.tones(modelData.shortName).length > 0 showTones: !!modelData && EmojiModel.tones(modelData.shortName).length > 0
} }

View File

@@ -20,9 +20,9 @@ ColumnLayout {
readonly property var currentEmojiModel: { readonly property var currentEmojiModel: {
if (includeCustom) { if (includeCustom) {
EmojiModel.categoriesWithCustom EmojiModel.categoriesWithCustom;
} else { } else {
EmojiModel.categories EmojiModel.categories;
} }
} }
@@ -73,8 +73,12 @@ ColumnLayout {
focus: true focus: true
orientation: ListView.Horizontal orientation: ListView.Horizontal
Keys.onReturnPressed: if (emojiGrid.count > 0) emojiGrid.focus = true Keys.onReturnPressed: if (emojiGrid.count > 0) {
Keys.onEnterPressed: if (emojiGrid.count > 0) emojiGrid.focus = true emojiGrid.focus = true;
}
Keys.onEnterPressed: if (emojiGrid.count > 0) {
emojiGrid.focus = true;
}
KeyNavigation.down: emojiGrid.count > 0 ? emojiGrid : categories KeyNavigation.down: emojiGrid.count > 0 ? emojiGrid : categories
KeyNavigation.tab: emojiGrid.count > 0 ? emojiGrid : categories KeyNavigation.tab: emojiGrid.count > 0 ? emojiGrid : categories
@@ -208,6 +212,6 @@ ColumnLayout {
} }
function clearSearchField() { function clearSearchField() {
searchField.text = "" searchField.text = "";
} }
} }

View File

@@ -15,8 +15,8 @@ Column {
required property var model required property var model
signal accept() signal accept
signal reject() signal reject
visible: dialog.session.state === KeyVerificationSession.WAITINGFORVERIFICATION visible: dialog.session.state === KeyVerificationSession.WAITINGFORVERIFICATION
anchors.centerIn: parent anchors.centerIn: parent
@@ -46,7 +46,7 @@ Column {
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: root.reject() onClicked: root.reject()
} }
} }
} }

View File

@@ -63,9 +63,9 @@ QQC2.Popup {
Keys.onEnterPressed: clicked() Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()
onClicked: { onClicked: {
root.chosen(modelData.unicode) root.chosen(modelData.unicode);
EmojiModel.emojiUsed(modelData) EmojiModel.emojiUsed(modelData);
root.close() root.close();
} }
} }
} }

View File

@@ -24,8 +24,7 @@ FormCard.FormCardPage {
property bool newEmoticon: false property bool newEmoticon: false
required property var emoticonType required property var emoticonType
title: emoticonType === EmoticonFormCard.Stickers ? (newEmoticon ? i18nc("@title", "Add Sticker") : i18nc("@title", "Edit Sticker")) title: emoticonType === EmoticonFormCard.Stickers ? (newEmoticon ? i18nc("@title", "Add Sticker") : i18nc("@title", "Edit Sticker")) : (newEmoticon ? i18nc("@title", "Add Emoji") : i18nc("@title", "Edit Emoji"))
: (newEmoticon ? i18nc("@title", "Add Emoji") : i18nc("@title", "Edit Emoji"))
FormCard.FormHeader { FormCard.FormHeader {
title: emoticonType === EmoticonFormCard.Stickers ? i18n("Sticker") : i18n("Emoji") title: emoticonType === EmoticonFormCard.Stickers ? i18n("Sticker") : i18n("Emoji")
@@ -67,23 +66,22 @@ FormCard.FormCardPage {
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
property var fileDialog: null; property var fileDialog: null
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (fileDialog != null) { if (fileDialog != null) {
return; return;
} }
fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.Overlay);
fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.Overlay) fileDialog.chosen.connect(function (receivedSource) {
fileDialog.chosen.connect(function(receivedSource) {
mouseArea.fileDialog = null; mouseArea.fileDialog = null;
if (!receivedSource) { if (!receivedSource) {
return; return;
} }
parent.source = receivedSource; parent.source = receivedSource;
}); });
fileDialog.onRejected.connect(function() { fileDialog.onRejected.connect(function () {
mouseArea.fileDialog = null; mouseArea.fileDialog = null;
}); });
fileDialog.open(); fileDialog.open();
@@ -112,19 +110,19 @@ FormCard.FormCardPage {
enabled: !root.newEmoticon || (image.source.toString().length > 0 && shortcode.text && description.text) enabled: !root.newEmoticon || (image.source.toString().length > 0 && shortcode.text && description.text)
onClicked: { onClicked: {
if (root.newEmoticon) { if (root.newEmoticon) {
model.addEmoticon(image.source, shortcode.text, description.text, emoticonType === EmoticonFormCard.Stickers ? "sticker" : "emoticon") model.addEmoticon(image.source, shortcode.text, description.text, emoticonType === EmoticonFormCard.Stickers ? "sticker" : "emoticon");
} else { } else {
if (description.text !== root.description) { if (description.text !== root.description) {
root.model.setEmoticonBody(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, description.text) root.model.setEmoticonBody(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, description.text);
} }
if (shortcode.text !== root.shortcode) { if (shortcode.text !== root.shortcode) {
root.model.setEmoticonShortcode(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, shortcode.text) root.model.setEmoticonShortcode(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, shortcode.text);
} }
if (image.source + "" !== root.url) { if (image.source + "" !== root.url) {
root.model.setEmoticonImage(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, image.source) root.model.setEmoticonImage(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, image.source);
} }
} }
root.closeDialog() root.closeDialog();
} }
} }
} }

View File

@@ -51,7 +51,7 @@ FormCard.FormCard {
emoticonType: root.emoticonType emoticonType: root.emoticonType
}, { }, {
title: root.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Edit Emoji") : i18nc("@title", "Edit Sticker") title: root.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Edit Emoji") : i18nc("@title", "Edit Sticker")
}); })
contentItem: ColumnLayout { contentItem: ColumnLayout {
Image { Image {
@@ -101,7 +101,7 @@ FormCard.FormCard {
emoticonType: root.emoticonType emoticonType: root.emoticonType
}, { }, {
title: root.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Add Emoji") : i18nc("@title", "Add Sticker") title: root.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Add Emoji") : i18nc("@title", "Add Sticker")
}); })
contentItem: ColumnLayout { contentItem: ColumnLayout {
spacing: 0 spacing: 0
Kirigami.Icon { Kirigami.Icon {

View File

@@ -31,7 +31,6 @@ FormCard.FormCardPage {
connection: root.connection connection: root.connection
} }
property Component emoticonEditorPage: Component { property Component emoticonEditorPage: Component {
id: emoticonEditorPage id: emoticonEditorPage
EmoticonEditorPage {} EmoticonEditorPage {}

View File

@@ -21,22 +21,34 @@ RowLayout {
text: i18n("Explore rooms") text: i18n("Explore rooms")
icon.name: "compass" icon.name: "compass"
onTriggered: { onTriggered: {
let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Explore Rooms")
});
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join") RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join");
}) });
} }
} }
property Kirigami.Action chatAction: Kirigami.Action { property Kirigami.Action chatAction: Kirigami.Action {
text: i18n("Find your friends") text: i18n("Find your friends")
icon.name: "list-add-user" icon.name: "list-add-user"
onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Find your friends")
})
} }
property Kirigami.Action roomAction: Kirigami.Action { property Kirigami.Action roomAction: Kirigami.Action {
text: i18n("Create a Room") text: i18n("Create a Room")
icon.name: "system-users-symbolic" icon.name: "system-users-symbolic"
onTriggered: { onTriggered: {
pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Create a Room")}) pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Create a Room")
});
} }
shortcut: StandardKey.New shortcut: StandardKey.New
} }
@@ -44,7 +56,13 @@ RowLayout {
text: i18n("Create a Space") text: i18n("Create a Space")
icon.name: "list-add" icon.name: "list-add"
onTriggered: { onTriggered: {
pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space")}, {title: i18nc("@title", "Create a Space")}) pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {
connection: root.connection,
isSpace: true,
title: i18nc("@title", "Create a Space")
}, {
title: i18nc("@title", "Create a Space")
});
} }
} }
@@ -72,7 +90,7 @@ RowLayout {
menu.open(); menu.open();
} else { } else {
const menu = desktopMenu.createObject(menuButton); const menu = desktopMenu.createObject(menuButton);
menu.closed.connect(menuButton.toggle) menu.closed.connect(menuButton.toggle);
menu.open(); menu.open();
} }
} }

View File

@@ -52,10 +52,14 @@ ColumnLayout {
text: i18n("Explore rooms") text: i18n("Explore rooms")
icon.name: "compass" icon.name: "compass"
onTriggered: { onTriggered: {
let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Explore Rooms")
});
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join") RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join");
}) });
exploreTabBar.currentIndex = -1; exploreTabBar.currentIndex = -1;
} }
}, },
@@ -63,7 +67,11 @@ ColumnLayout {
text: i18n("Find your friends") text: i18n("Find your friends")
icon.name: "list-add-user" icon.name: "list-add-user"
onTriggered: { onTriggered: {
pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Find your friends")
});
exploreTabBar.currentIndex = -1; exploreTabBar.currentIndex = -1;
} }
}, },
@@ -132,8 +140,12 @@ ColumnLayout {
text: i18n("Create a Room") text: i18n("Create a Room")
icon.name: "system-users-symbolic" icon.name: "system-users-symbolic"
onTriggered: { onTriggered: {
pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Create a Room")}) pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {
explorePopup.close() connection: root.connection
}, {
title: i18nc("@title", "Create a Room")
});
explorePopup.close();
} }
shortcut: StandardKey.New shortcut: StandardKey.New
} }
@@ -144,8 +156,14 @@ ColumnLayout {
text: i18n("Create a Space") text: i18n("Create a Space")
icon.name: "list-add" icon.name: "list-add"
onTriggered: { onTriggered: {
pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space")}, {title: i18nc("@title", "Create a Space")}) pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {
explorePopup.close() connection: root.connection,
isSpace: true,
title: i18nc("@title", "Create a Space")
}, {
title: i18nc("@title", "Create a Space")
});
explorePopup.close();
} }
} }
} }

View File

@@ -41,13 +41,7 @@ SearchPage {
* upon as required, e.g. joining or entering the room or adding the room as * upon as required, e.g. joining or entering the room or adding the room as
* the child of a space. * the child of a space.
*/ */
signal roomSelected(string roomId, signal roomSelected(string roomId, string displayName, url avatarUrl, string alias, string topic, int memberCount, bool isJoined)
string displayName,
url avatarUrl,
string alias,
string topic,
int memberCount,
bool isJoined)
title: i18nc("@action:title", "Explore Rooms") title: i18nc("@action:title", "Explore Rooms")
@@ -101,7 +95,9 @@ SearchPage {
QtObject { QtObject {
id: _private id: _private
function openManualRoomDialog() { function openManualRoomDialog() {
let dialog = manualRoomDialog.createObject(applicationWindow().overlay, {connection: root.connection}); let dialog = manualRoomDialog.createObject(applicationWindow().overlay, {
connection: root.connection
});
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
root.roomSelected(roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined); root.roomSelected(roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined);
root.closeDialog(); root.closeDialog();

View File

@@ -30,25 +30,13 @@ Delegates.RoundedItemDelegate {
* upon as required, e.g. joining or entering the room or adding the room as * upon as required, e.g. joining or entering the room or adding the room as
* the child of a space. * the child of a space.
*/ */
signal roomSelected(string roomId, signal roomSelected(string roomId, string displayName, url avatarUrl, string alias, string topic, int memberCount, bool isJoined)
string displayName,
url avatarUrl,
string alias,
string topic,
int memberCount,
bool isJoined)
onClicked: { onClicked: {
if (!isJoined) { if (!isJoined) {
justJoined = true; justJoined = true;
} }
root.roomSelected(root.roomId, root.roomSelected(root.roomId, root.displayName, root.avatarUrl, root.alias, root.topic, root.memberCount, root.isJoined);
root.displayName,
root.avatarUrl,
root.alias,
root.topic,
root.memberCount,
root.isJoined)
} }
contentItem: RowLayout { contentItem: RowLayout {
@@ -85,7 +73,7 @@ Delegates.RoundedItemDelegate {
QQC2.Label { QQC2.Label {
Layout.fillWidth: true Layout.fillWidth: true
visible: text visible: text
text: root.topic ? root.topic.replace(/(\r\n\t|\n|\r\t)/gm," ") : "" text: root.topic ? root.topic.replace(/(\r\n\t|\n|\r\t)/gm, " ") : ""
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap

View File

@@ -10,33 +10,33 @@ import org.kde.kirigami as Kirigami
Item { Item {
id: root 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"
property bool isThemeDark: Kirigami.Theme.backgroundColor.hslLightness <= darkSnowColor.hslLightness property bool isThemeDark: Kirigami.Theme.backgroundColor.hslLightness <= darkSnowColor.hslLightness
function showConfettiEffect() { function showConfettiEffect() {
confettiTimer.start() confettiTimer.start();
} }
function showSnowEffect() { function showSnowEffect() {
snowTimer.start() snowTimer.start();
} }
function showFireworksEffect() { function showFireworksEffect() {
fireworksTimer.start() fireworksTimer.start();
} }
// Confetti // Confetti
Timer { Timer {
id: confettiTimer id: confettiTimer
interval: root.effectInterval; interval: root.effectInterval
running: false; running: false
repeat: false; repeat: false
triggeredOnStart: true; triggeredOnStart: true
onTriggered: { onTriggered: {
if (root.enabled) { if (root.enabled) {
confettiSystem.running = !confettiSystem.running confettiSystem.running = !confettiSystem.running;
} }
} }
} }
@@ -48,15 +48,17 @@ Item {
running: false running: false
onRunningChanged: { onRunningChanged: {
if (running) { if (running) {
opacity = 1 opacity = 1;
} else { } else {
opacity = 0 opacity = 0;
} }
} }
Behavior on opacity { Behavior on opacity {
SequentialAnimation { SequentialAnimation {
NumberAnimation { duration: Kirigami.Units.longDuration } NumberAnimation {
duration: Kirigami.Units.longDuration
}
} }
} }
@@ -76,8 +78,8 @@ Item {
top: parent.top top: parent.top
} }
sizeVariation: Kirigami.Units.iconSizes.small/2 sizeVariation: Kirigami.Units.iconSizes.small / 2
lifeSpan: Kirigami.Units.veryLongDuration*10 lifeSpan: Kirigami.Units.veryLongDuration * 10
size: Kirigami.Units.iconSizes.small size: Kirigami.Units.iconSizes.small
velocity: AngleDirection { velocity: AngleDirection {
@@ -92,13 +94,13 @@ Item {
Timer { Timer {
id: snowTimer id: snowTimer
interval: root.effectInterval; interval: root.effectInterval
running: false; running: false
repeat: false; repeat: false
triggeredOnStart: true; triggeredOnStart: true
onTriggered: { onTriggered: {
if (root.enabled) { if (root.enabled) {
snowSystem.running = !snowSystem.running snowSystem.running = !snowSystem.running;
} }
} }
} }
@@ -110,15 +112,17 @@ Item {
running: false running: false
onRunningChanged: { onRunningChanged: {
if (running) { if (running) {
opacity = 1 opacity = 1;
} else { } else {
opacity = 0 opacity = 0;
} }
} }
Behavior on opacity { Behavior on opacity {
SequentialAnimation { SequentialAnimation {
NumberAnimation { duration: Kirigami.Units.longDuration } NumberAnimation {
duration: Kirigami.Units.longDuration
}
} }
} }
@@ -141,7 +145,7 @@ Item {
} }
sizeVariation: Kirigami.Units.iconSizes.medium sizeVariation: Kirigami.Units.iconSizes.medium
lifeSpan: Kirigami.Units.veryLongDuration*10 lifeSpan: Kirigami.Units.veryLongDuration * 10
size: Kirigami.Units.iconSizes.large size: Kirigami.Units.iconSizes.large
emitRate: 42 emitRate: 42
@@ -157,13 +161,13 @@ Item {
Timer { Timer {
id: fireworksTimer id: fireworksTimer
interval: root.effectInterval; interval: root.effectInterval
running: false; running: false
repeat: false; repeat: false
triggeredOnStart: true; triggeredOnStart: true
onTriggered: { onTriggered: {
if (root.enabled) { if (root.enabled) {
fireworksInternalTimer.running = !fireworksInternalTimer.running fireworksInternalTimer.running = !fireworksInternalTimer.running;
} }
} }
} }
@@ -175,11 +179,11 @@ Item {
running: false running: false
repeat: true repeat: true
onTriggered: { onTriggered: {
var x = Math.random() * parent.width var x = Math.random() * parent.width;
var y = Math.random() * parent.height var y = Math.random() * parent.height;
customEmit(x, y) customEmit(x, y);
customEmit(x, y) customEmit(x, y);
customEmit(x, y) customEmit(x, y);
} }
} }
@@ -189,15 +193,17 @@ Item {
running: fireworksInternalTimer.running running: fireworksInternalTimer.running
onRunningChanged: { onRunningChanged: {
if (running) { if (running) {
opacity = 1 opacity = 1;
} else { } else {
opacity = 0 opacity = 0;
} }
} }
Behavior on opacity { Behavior on opacity {
SequentialAnimation { SequentialAnimation {
NumberAnimation { duration: Kirigami.Units.longDuration } NumberAnimation {
duration: Kirigami.Units.longDuration
}
} }
} }
} }
@@ -256,39 +262,42 @@ Item {
running: true running: true
onTriggered: { onTriggered: {
container.destroy(); container.destroy();
var randomHue = Math.random() var randomHue = Math.random();
var lightness = root.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);
} }
} }
velocity: AngleDirection {angleVariation:360; magnitude: 200} velocity: AngleDirection {
angleVariation: 360
magnitude: 200
}
} }
} }
function customEmit(x,y) { function customEmit(x, y) {
var currentSize = Math.round(Math.random() * 200) + 40 var currentSize = Math.round(Math.random() * 200) + 40;
var currentLifeSpan = Math.round(Math.random() * 1000) + 100 var currentLifeSpan = Math.round(Math.random() * 1000) + 100;
for (var i=0; i<8; i++) { for (var i = 0; i < 8; i++) {
var obj = emitterComp.createObject(parent); var obj = emitterComp.createObject(parent);
obj.x = x obj.x = x;
obj.y = y obj.y = y;
obj.targetX = Math.random() * currentSize - currentSize/2 + obj.x obj.targetX = Math.random() * currentSize - currentSize / 2 + obj.x;
obj.targetY = Math.random() * currentSize - currentSize/2 + obj.y obj.targetY = Math.random() * currentSize - currentSize / 2 + obj.y;
obj.life = Math.round(Math.random() * 23) + 150 obj.life = Math.round(Math.random() * 23) + 150;
obj.emitRate = Math.round(Math.random() * 32) + 5 obj.emitRate = Math.round(Math.random() * 32) + 5;
obj.lifeSpan = currentLifeSpan obj.lifeSpan = currentLifeSpan;
const group = Math.round(Math.random() * 3); const group = Math.round(Math.random() * 3);
switch (group) { switch (group) {
case 0: case 0:
obj.group = "light"; obj.group = "light";
break; break;
case 1: case 1:
obj.group = "a"; obj.group = "a";
break; break;
case 2: case 2:
obj.group = "b"; obj.group = "b";
break; break;
} }
} }
} }

View File

@@ -43,7 +43,7 @@ MessageDelegate {
property bool autoOpenFile: false property bool autoOpenFile: false
onDownloadedChanged: { onDownloadedChanged: {
itineraryModel.path = root.progressInfo.localPath itineraryModel.path = root.progressInfo.localPath;
if (autoOpenFile) { if (autoOpenFile) {
openSavedFile(); openSavedFile();
} }
@@ -52,9 +52,9 @@ MessageDelegate {
onOpenContextMenu: RoomManager.viewEventMenu(eventId, author, delegateType, plainText, "", "", mediaInfo.mimeType, progressInfo) onOpenContextMenu: RoomManager.viewEventMenu(eventId, author, delegateType, plainText, "", "", mediaInfo.mimeType, progressInfo)
function saveFileAs() { function saveFileAs() {
const dialog = fileDialog.createObject(QQC2.ApplicationWindow.overlay) const dialog = fileDialog.createObject(QQC2.ApplicationWindow.overlay);
dialog.open() dialog.open();
dialog.currentFile = dialog.folder + "/" + root.room.fileNameToDownload(root.eventId) dialog.currentFile = dialog.folder + "/" + root.room.fileNameToDownload(root.eventId);
} }
function openSavedFile() { function openSavedFile() {
@@ -183,10 +183,10 @@ MessageDelegate {
fileMode: FileDialog.SaveFile fileMode: FileDialog.SaveFile
folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation)
onAccepted: { onAccepted: {
Config.lastSaveDirectory = folder Config.lastSaveDirectory = folder;
Config.save() Config.save();
if (autoOpenFile) { if (autoOpenFile) {
UrlHelper.copyTo(root.progressInfo.localPath, file) UrlHelper.copyTo(root.progressInfo.localPath, file);
} else { } else {
root.room.download(root.eventId, file); root.room.download(root.eventId, file);
} }
@@ -213,9 +213,9 @@ MessageDelegate {
text: model.name text: model.name
} }
QQC2.Label { QQC2.Label {
text: model.coach ? i18n("Coach: %1, Seat: %2", model.coach, model.seat) : "" text: model.coach ? i18n("Coach: %1, Seat: %2", model.coach, model.seat) : ""
visible: model.coach visible: model.coach
opacity: 0.7 opacity: 0.7
} }
} }
RowLayout { RowLayout {
@@ -234,7 +234,7 @@ MessageDelegate {
} }
ColumnLayout { ColumnLayout {
QQC2.Label { QQC2.Label {
text: model.arrivalStation + (model.arrivalPlatform ? (" [" + model.arrivalPlatform + "]") : "") text: model.arrivalStation + (model.arrivalPlatform ? (" [" + model.arrivalPlatform + "]") : "")
} }
QQC2.Label { QQC2.Label {
text: model.arrivalTime text: model.arrivalTime

View File

@@ -43,16 +43,16 @@ MessageDelegateContextMenu {
text: i18n("Open Externally") text: i18n("Open Externally")
icon.name: "document-open" icon.name: "document-open"
onTriggered: { onTriggered: {
currentRoom.openEventMediaExternally(root.eventId) currentRoom.openEventMediaExternally(root.eventId);
} }
}, },
Kirigami.Action { Kirigami.Action {
text: i18n("Save As") text: i18n("Save As")
icon.name: "document-save" icon.name: "document-save"
onTriggered: { onTriggered: {
var dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay) var dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay);
dialog.open() dialog.open();
dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(eventId) dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(eventId);
} }
}, },
Kirigami.Action { Kirigami.Action {
@@ -61,14 +61,14 @@ MessageDelegateContextMenu {
onTriggered: { onTriggered: {
currentRoom.mainCache.replyId = eventId; currentRoom.mainCache.replyId = eventId;
currentRoom.editCache.editId = ""; currentRoom.editCache.editId = "";
RoomManager.requestFullScreenClose() RoomManager.requestFullScreenClose();
} }
}, },
Kirigami.Action { Kirigami.Action {
text: i18n("Copy") text: i18n("Copy")
icon.name: "edit-copy" icon.name: "edit-copy"
onTriggered: { onTriggered: {
currentRoom.copyEventMedia(root.eventId) currentRoom.copyEventMedia(root.eventId);
} }
}, },
Kirigami.Action { Kirigami.Action {
@@ -76,7 +76,10 @@ MessageDelegateContextMenu {
text: i18n("Remove") text: i18n("Remove")
icon.name: "edit-delete-remove" icon.name: "edit-delete-remove"
icon.color: "red" icon.color: "red"
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {
room: currentRoom,
eventId: eventId
}, {
title: i18nc("@title", "Remove Message"), title: i18nc("@title", "Remove Message"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}) })
@@ -85,7 +88,10 @@ MessageDelegateContextMenu {
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")
icon.name: "dialog-warning-symbolic" icon.name: "dialog-warning-symbolic"
visible: author.id !== currentRoom.localUser.id visible: author.id !== currentRoom.localUser.id
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {
room: currentRoom,
eventId: eventId
}, {
title: i18nc("@title", "Report Message"), title: i18nc("@title", "Report Message"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}) })
@@ -109,10 +115,10 @@ MessageDelegateContextMenu {
'urls': [], 'urls': [],
'mimeType': [root.mimeType] 'mimeType': [root.mimeType]
} }
property string filename: StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(eventId); property string filename: StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(eventId)
doBeforeSharing: () => { doBeforeSharing: () => {
currentRoom.downloadFile(eventId, filename) currentRoom.downloadFile(eventId, filename);
} }
Component.onCompleted: { Component.onCompleted: {
shareAction.inputData = { shareAction.inputData = {
@@ -132,9 +138,9 @@ MessageDelegateContextMenu {
if (!currentFile) { if (!currentFile) {
return; return;
} }
Config.lastSaveDirectory = folder Config.lastSaveDirectory = folder;
Config.save() Config.save();
currentRoom.downloadFile(eventId, currentFile) currentRoom.downloadFile(eventId, currentFile);
} }
} }
} }

View File

@@ -36,8 +36,7 @@ ApplicationWindow {
MapView { MapView {
id: mapView id: mapView
anchors.fill: parent anchors.fill: parent
map.center: root.liveLocationModel ? QtPositioning.coordinate(root.liveLocationModel.boundingBox.y, root.liveLocationModel.boundingBox.x) map.center: root.liveLocationModel ? QtPositioning.coordinate(root.liveLocationModel.boundingBox.y, root.liveLocationModel.boundingBox.x) : QtPositioning.coordinate(root.latitude, root.longitude)
: QtPositioning.coordinate(root.latitude, root.longitude)
map.zoomLevel: 15 map.zoomLevel: 15
map.plugin: OsmLocationPlugin.plugin map.plugin: OsmLocationPlugin.plugin
LocationMapItem { LocationMapItem {
@@ -57,7 +56,7 @@ ApplicationWindow {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated() {
Qt.openUrlExternally(link) Qt.openUrlExternally(link);
} }
} }
} }

View File

@@ -48,15 +48,13 @@ FormCard.FormCardPage {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
onClicked: { onClicked: {
const fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay) const fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay);
fileDialog.chosen.connect(function (path) {
fileDialog.chosen.connect(function(path) { if (!path)
if (!path) return return;
room.changeAvatar(path);
room.changeAvatar(path) });
}) fileDialog.open();
fileDialog.open()
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
@@ -107,11 +105,10 @@ FormCard.FormCardPage {
text: i18n("Save") text: i18n("Save")
onClicked: { onClicked: {
if (room.name != roomNameField.text) { if (room.name != roomNameField.text) {
room.setName(roomNameField.text) room.setName(roomNameField.text);
} }
if (room.topic != roomTopicField.text) { if (room.topic != roomTopicField.text) {
room.setTopic(roomTopicField.text) room.setTopic(roomTopicField.text);
} }
} }
} }
@@ -129,7 +126,7 @@ FormCard.FormCardPage {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
onClicked: { onClicked: {
Clipboard.saveText(room.id) Clipboard.saveText(room.id);
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
@@ -149,8 +146,8 @@ FormCard.FormCardPage {
onClicked: { onClicked: {
if (room.canSwitchVersions()) { if (room.canSwitchVersions()) {
roomUpgradeSheet.currentRoomVersion = room.version roomUpgradeSheet.currentRoomVersion = room.version;
roomUpgradeSheet.open() roomUpgradeSheet.open();
} }
} }
@@ -186,7 +183,7 @@ FormCard.FormCardPage {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
onClicked: { onClicked: {
room.setCanonicalAlias(modelData) room.setCanonicalAlias(modelData);
} }
QQC2.ToolTip { QQC2.ToolTip {
text: setCanonicalAliasButton.text text: setCanonicalAliasButton.text
@@ -201,7 +198,7 @@ FormCard.FormCardPage {
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
onClicked: { onClicked: {
room.unmapAlias(modelData) room.unmapAlias(modelData);
} }
QQC2.ToolTip { QQC2.ToolTip {
text: deleteButton.text text: deleteButton.text
@@ -209,13 +206,12 @@ FormCard.FormCardPage {
} }
} }
] ]
} }
} }
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
visible: room.canSendState("m.room.canonical_alias") visible: room.canSendState("m.room.canonical_alias")
contentItem : RowLayout { contentItem: RowLayout {
Kirigami.ActionTextField { Kirigami.ActionTextField {
id: aliasAddField id: aliasAddField
@@ -227,12 +223,12 @@ FormCard.FormCardPage {
icon.name: "edit-clear" icon.name: "edit-clear"
visible: aliasAddField.text.length > 0 visible: aliasAddField.text.length > 0
onTriggered: { onTriggered: {
aliasAddField.text = "" aliasAddField.text = "";
} }
} }
onAccepted: { onAccepted: {
room.mapAlias(aliasAddField.text) room.mapAlias(aliasAddField.text);
} }
} }
QQC2.Button { QQC2.Button {
@@ -245,7 +241,7 @@ FormCard.FormCardPage {
enabled: aliasAddField.text.length > 0 enabled: aliasAddField.text.length > 0
onClicked: { onClicked: {
room.mapAlias(aliasAddField.text) room.mapAlias(aliasAddField.text);
} }
QQC2.ToolTip { QQC2.ToolTip {
@@ -266,7 +262,7 @@ FormCard.FormCardPage {
checked: room.defaultUrlPreviewState checked: room.defaultUrlPreviewState
visible: room.canSendState("org.matrix.room.preview_urls") visible: room.canSendState("org.matrix.room.preview_urls")
onToggled: { onToggled: {
room.defaultUrlPreviewState = checked room.defaultUrlPreviewState = checked;
} }
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
@@ -275,7 +271,7 @@ FormCard.FormCardPage {
description: room.defaultUrlPreviewState ? i18n("URL previews are enabled by default in this room") : i18n("URL previews are disabled by default in this room") description: room.defaultUrlPreviewState ? i18n("URL previews are enabled by default in this room") : i18n("URL previews are disabled by default in this room")
checked: room.urlPreviewEnabled checked: room.urlPreviewEnabled
onToggled: { onToggled: {
room.urlPreviewEnabled = checked room.urlPreviewEnabled = checked;
} }
} }
} }
@@ -353,7 +349,7 @@ FormCard.FormCardPage {
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
visible: root.room.canSendState("m.space.parent") visible: root.room.canSendState("m.space.parent")
text: i18nc("@action:button", "Add new official parent") text: i18nc("@action:button", "Add new official parent")
onClicked: selectParentDialog.createObject(applicationWindow().overlay).open(); onClicked: selectParentDialog.createObject(applicationWindow().overlay).open()
Component { Component {
id: selectParentDialog id: selectParentDialog
@@ -418,11 +414,10 @@ FormCard.FormCardPage {
QQC2.Button { QQC2.Button {
text: i18n("Confirm") text: i18n("Confirm")
onClicked: { onClicked: {
room.switchVersion(spinBox.value) room.switchVersion(spinBox.value);
roomUpgradeSheet.close() roomUpgradeSheet.close();
} }
} }
} }
} }
} }

View File

@@ -26,12 +26,15 @@ FormCard.FormCardPage {
visible: Controller.supportSystemTray visible: Controller.supportSystemTray
enabled: !Config.isSystemTrayImmutable enabled: !Config.isSystemTrayImmutable
onToggled: { onToggled: {
Config.systemTray = checked Config.systemTray = checked;
Config.save() Config.save();
} }
} }
FormCard.FormDelegateSeparator { above: closeDelegate; below: minimizeDelegate } FormCard.FormDelegateSeparator {
above: closeDelegate
below: minimizeDelegate
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: minimizeDelegate id: minimizeDelegate
@@ -40,12 +43,15 @@ FormCard.FormCardPage {
visible: Controller.supportSystemTray && !Kirigami.Settings.isMobile visible: Controller.supportSystemTray && !Kirigami.Settings.isMobile
enabled: Config.systemTray && !Config.isMinimizeToSystemTrayOnStartupImmutable enabled: Config.systemTray && !Config.isMinimizeToSystemTrayOnStartupImmutable
onToggled: { onToggled: {
Config.minimizeToSystemTrayOnStartup = checked Config.minimizeToSystemTrayOnStartup = checked;
Config.save() Config.save();
} }
} }
FormCard.FormDelegateSeparator { above: minimizeDelegate; below: automaticallyDelegate } FormCard.FormDelegateSeparator {
above: minimizeDelegate
below: automaticallyDelegate
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: automaticallyDelegate id: automaticallyDelegate
@@ -54,8 +60,8 @@ FormCard.FormCardPage {
enabled: !Config.isAutoRoomInfoDrawerImmutable enabled: !Config.isAutoRoomInfoDrawerImmutable
visible: Qt.platform.os !== "android" visible: Qt.platform.os !== "android"
onToggled: { onToggled: {
Config.autoRoomInfoDrawer = checked Config.autoRoomInfoDrawer = checked;
Config.save() Config.save();
} }
} }
} }
@@ -69,12 +75,15 @@ FormCard.FormCardPage {
checked: Config.showDeletedMessages checked: Config.showDeletedMessages
enabled: !Config.isShowDeletedMessagesImmutable enabled: !Config.isShowDeletedMessagesImmutable
onToggled: { onToggled: {
Config.showDeletedMessages = checked Config.showDeletedMessages = checked;
Config.save() Config.save();
} }
} }
FormCard.FormDelegateSeparator { above: showDeletedMessages; below: showStateEvents } FormCard.FormDelegateSeparator {
above: showDeletedMessages
below: showStateEvents
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showStateEvents id: showStateEvents
@@ -82,15 +91,16 @@ FormCard.FormCardPage {
checked: Config.showStateEvent checked: Config.showStateEvent
enabled: !Config.isShowStateEventImmutable enabled: !Config.isShowStateEventImmutable
onToggled: { onToggled: {
Config.showStateEvent = checked Config.showStateEvent = checked;
Config.save() Config.save();
} }
} }
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {
visible: Config.showStateEvent visible: Config.showStateEvent
above: showStateEvents above: showStateEvents
below: showLeaveJoinEventDelegate } below: showLeaveJoinEventDelegate
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: showLeaveJoinEventDelegate id: showLeaveJoinEventDelegate
@@ -99,8 +109,8 @@ FormCard.FormCardPage {
checked: Config.showLeaveJoinEvent checked: Config.showLeaveJoinEvent
enabled: !Config.isShowLeaveJoinEventImmutable enabled: !Config.isShowLeaveJoinEventImmutable
onToggled: { onToggled: {
Config.showLeaveJoinEvent = checked Config.showLeaveJoinEvent = checked;
Config.save() Config.save();
} }
} }
@@ -117,8 +127,8 @@ FormCard.FormCardPage {
checked: Config.showRename checked: Config.showRename
enabled: !Config.isShowRenameImmutable enabled: !Config.isShowRenameImmutable
onToggled: { onToggled: {
Config.showRename = checked Config.showRename = checked;
Config.save() Config.save();
} }
} }
@@ -135,8 +145,8 @@ FormCard.FormCardPage {
checked: Config.showAvatarUpdate checked: Config.showAvatarUpdate
enabled: !Config.isShowAvatarUpdateImmutable enabled: !Config.isShowAvatarUpdateImmutable
onToggled: { onToggled: {
Config.showAvatarUpdate = checked Config.showAvatarUpdate = checked;
Config.save() Config.save();
} }
} }
} }
@@ -150,19 +160,22 @@ FormCard.FormCardPage {
checked: Config.allowQuickEdit checked: Config.allowQuickEdit
enabled: !Config.isAllowQuickEditImmutable enabled: !Config.isAllowQuickEditImmutable
onToggled: { onToggled: {
Config.allowQuickEdit = checked Config.allowQuickEdit = checked;
Config.save() Config.save();
} }
} }
FormCard.FormDelegateSeparator { above: quickEditCheckbox; below: typingNotificationsDelegate } FormCard.FormDelegateSeparator {
above: quickEditCheckbox
below: typingNotificationsDelegate
}
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: typingNotificationsDelegate id: typingNotificationsDelegate
text: i18n("Send typing notifications") text: i18n("Send typing notifications")
checked: Config.typingNotifications checked: Config.typingNotifications
enabled: !Config.isTypingNotificationsImmutable enabled: !Config.isTypingNotificationsImmutable
onToggled: { onToggled: {
Config.typingNotifications = checked Config.typingNotifications = checked;
Config.save() Config.save();
} }
} }
} }
@@ -175,8 +188,8 @@ FormCard.FormCardPage {
checked: Config.developerTools checked: Config.developerTools
enabled: !Config.isDeveloperToolsImmutable enabled: !Config.isDeveloperToolsImmutable
onToggled: { onToggled: {
Config.developerTools = checked Config.developerTools = checked;
Config.save() Config.save();
} }
} }
} }

View File

@@ -47,24 +47,32 @@ Labs.MenuBar {
Labs.MenuItem { Labs.MenuItem {
text: i18nc("menu", "Find your friends") text: i18nc("menu", "Find your friends")
enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0 enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0
onTriggered: pushReplaceLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) onTriggered: pushReplaceLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Find your friends")
})
} }
Labs.MenuItem { Labs.MenuItem {
text: i18nc("menu", "New Group…") text: i18nc("menu", "New Group…")
enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0 enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0
shortcut: StandardKey.New shortcut: StandardKey.New
onTriggered: { onTriggered: {
const dialog = createRoomDialog.createObject(root.overlay) const dialog = createRoomDialog.createObject(root.overlay);
dialog.open() dialog.open();
} }
} }
Labs.MenuItem { Labs.MenuItem {
text: i18nc("menu", "Browse Chats…") text: i18nc("menu", "Browse Chats…")
onTriggered: { onTriggered: {
let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Explore Rooms")
});
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join") RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join");
}) });
} }
} }
} }

View File

@@ -30,7 +30,7 @@ FormCard.FormCardPage {
checked: root.pushRuleModel.globalNotificationsEnabled checked: root.pushRuleModel.globalNotificationsEnabled
enabled: root.pushRuleModel.globalNotificationsSet enabled: root.pushRuleModel.globalNotificationsSet
onToggled: { onToggled: {
root.pushRuleModel.globalNotificationsEnabled = checked root.pushRuleModel.globalNotificationsEnabled = checked;
} }
} }
} }
@@ -42,8 +42,8 @@ FormCard.FormCardPage {
Repeater { Repeater {
model: KSortFilterProxyModel { model: KSortFilterProxyModel {
sourceModel: root.pushRuleModel sourceModel: root.pushRuleModel
filterRowCallback: function(source_row, source_parent) { filterRowCallback: function (source_row, source_parent) {
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole);
return sectionRole == PushRuleSection.Room; return sectionRole == PushRuleSection.Room;
} }
} }
@@ -59,8 +59,8 @@ FormCard.FormCardPage {
Repeater { Repeater {
model: KSortFilterProxyModel { model: KSortFilterProxyModel {
sourceModel: root.pushRuleModel sourceModel: root.pushRuleModel
filterRowCallback: function(source_row, source_parent) { filterRowCallback: function (source_row, source_parent) {
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole);
return sectionRole == PushRuleSection.Mentions; return sectionRole == PushRuleSection.Mentions;
} }
} }
@@ -77,8 +77,8 @@ FormCard.FormCardPage {
model: KSortFilterProxyModel { model: KSortFilterProxyModel {
sourceModel: root.pushRuleModel sourceModel: root.pushRuleModel
filterRowCallback: function(source_row, source_parent) { filterRowCallback: function (source_row, source_parent) {
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole);
return sectionRole == PushRuleSection.Keywords; return sectionRole == PushRuleSection.Keywords;
} }
} }
@@ -88,7 +88,7 @@ FormCard.FormCardPage {
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
Layout.fillWidth: true Layout.fillWidth: true
contentItem : RowLayout { contentItem: RowLayout {
Kirigami.ActionTextField { Kirigami.ActionTextField {
id: keywordAddField id: keywordAddField
@@ -101,13 +101,13 @@ FormCard.FormCardPage {
icon.name: "edit-clear" icon.name: "edit-clear"
visible: keywordAddField.text.length > 0 visible: keywordAddField.text.length > 0
onTriggered: { onTriggered: {
keywordAddField.text = "" keywordAddField.text = "";
} }
} }
onAccepted: { onAccepted: {
root.pushRuleModel.addKeyword(keywordAddField.text) root.pushRuleModel.addKeyword(keywordAddField.text);
keywordAddField.text = "" keywordAddField.text = "";
} }
} }
QQC2.Button { QQC2.Button {
@@ -120,8 +120,8 @@ FormCard.FormCardPage {
enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown
onClicked: { onClicked: {
root.pushRuleModel.addKeyword(keywordAddField.text) root.pushRuleModel.addKeyword(keywordAddField.text);
keywordAddField.text = "" keywordAddField.text = "";
} }
QQC2.ToolTip { QQC2.ToolTip {
@@ -140,8 +140,8 @@ FormCard.FormCardPage {
Repeater { Repeater {
model: KSortFilterProxyModel { model: KSortFilterProxyModel {
sourceModel: root.pushRuleModel sourceModel: root.pushRuleModel
filterRowCallback: function(source_row, source_parent) { filterRowCallback: function (source_row, source_parent) {
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole);
return sectionRole == PushRuleSection.Invites; return sectionRole == PushRuleSection.Invites;
} }
} }
@@ -161,8 +161,8 @@ FormCard.FormCardPage {
model: KSortFilterProxyModel { model: KSortFilterProxyModel {
id: unknownModel id: unknownModel
sourceModel: root.pushRuleModel sourceModel: root.pushRuleModel
filterRowCallback: function(source_row, source_parent) { filterRowCallback: function (source_row, source_parent) {
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole);
return sectionRole == PushRuleSection.Unknown; return sectionRole == PushRuleSection.Unknown;
} }
} }
@@ -175,9 +175,9 @@ FormCard.FormCardPage {
id: ruleDelegate id: ruleDelegate
NotificationRuleItem { NotificationRuleItem {
onDeleteRule: { onDeleteRule: {
root.pushRuleModel.removeKeyword(id) root.pushRuleModel.removeKeyword(id);
} }
onActionChanged: (action) => root.pushRuleModel.setPushRuleAction(id, action) onActionChanged: action => root.pushRuleModel.setPushRuleAction(id, action)
} }
} }
} }

View File

@@ -31,7 +31,7 @@ ColumnLayout {
Layout.preferredHeight: Kirigami.Units.iconSizes.large Layout.preferredHeight: Kirigami.Units.iconSizes.large
name: root.room ? root.room.displayName : "" name: root.room ? root.room.displayName : ""
source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : "" source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : ""
Rectangle { Rectangle {
visible: room.usesEncryption visible: room.usesEncryption
@@ -54,7 +54,6 @@ ColumnLayout {
} }
} }
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter

View File

@@ -12,7 +12,9 @@ import org.kde.neochat
LoginStep { LoginStep {
id: root id: root
onActiveFocusChanged: if (activeFocus) urlField.forceActiveFocus() onActiveFocusChanged: if (activeFocus) {
urlField.forceActiveFocus();
}
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
id: urlField id: urlField
@@ -24,7 +26,7 @@ LoginStep {
statusMessage: Registration.status === Registration.ServerNoRegistration ? i18n("Registration is disabled on this server.") : "" statusMessage: Registration.status === Registration.ServerNoRegistration ? i18n("Registration is disabled on this server.") : ""
Keys.onReturnPressed: { Keys.onReturnPressed: {
if (root.nextAction.enabled) { if (root.nextAction.enabled) {
root.nextAction.trigger() root.nextAction.trigger();
} }
} }
} }
@@ -38,7 +40,7 @@ LoginStep {
nextAction: Kirigami.Action { nextAction: Kirigami.Action {
text: Registration.testing ? i18n("Loading") : null text: Registration.testing ? i18n("Loading") : null
enabled: Registration.status > Registration.ServerNoRegistration enabled: Registration.status > Registration.ServerNoRegistration
onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml"); onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml")
} }
previousAction: Kirigami.Action { previousAction: Kirigami.Action {
onTriggered: root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml") onTriggered: root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml")

View File

@@ -35,7 +35,7 @@ QQC2.Control {
/** /**
* @brief Request that the chat bar be focussed. * @brief Request that the chat bar be focussed.
*/ */
signal focusChatBar() signal focusChatBar
topPadding: 0 topPadding: 0
bottomPadding: 0 bottomPadding: 0
@@ -51,7 +51,7 @@ QQC2.Control {
if (visible) { if (visible) {
// HACK: delay disapearing by 200ms, otherwise this can create some glitches // HACK: delay disapearing by 200ms, otherwise this can create some glitches
// See https://invent.kde.org/network/neochat/-/issues/333 // See https://invent.kde.org/network/neochat/-/issues/333
showActionsTimer.restart() showActionsTimer.restart();
} }
} }
Timer { Timer {
@@ -124,7 +124,7 @@ QQC2.Control {
id: emojiDialog id: emojiDialog
currentRoom: root.currentRoom currentRoom: root.currentRoom
showQuickReaction: true showQuickReaction: true
onChosen: (emoji) => { onChosen: emoji => {
root.currentRoom.toggleReaction(root.delegate.eventId, emoji); root.currentRoom.toggleReaction(root.delegate.eventId, emoji);
if (!Kirigami.Settings.isMobile) { if (!Kirigami.Settings.isMobile) {
root.focusChatBar(); root.focusChatBar();

View File

@@ -129,32 +129,34 @@ MessageDelegate {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds
onTapped: { onTapped: {
imageContainer.QQC2.ToolTip.hide() imageContainer.QQC2.ToolTip.hide();
if (root.mediaInfo.animated) { if (root.mediaInfo.animated) {
imageContainer.imageItem.paused = true imageContainer.imageItem.paused = true;
} }
root.ListView.view.interactive = false root.ListView.view.interactive = false;
// We need to make sure the index is that of the MediaMessageFilterModel. // We need to make sure the index is that of the MediaMessageFilterModel.
if (root.ListView.view.model instanceof MessageFilterModel) { if (root.ListView.view.model instanceof MessageFilterModel) {
RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index)) RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index));
} else { } else {
RoomManager.maximizeMedia(root.index) RoomManager.maximizeMedia(root.index);
} }
} }
} }
function downloadAndOpen() { function downloadAndOpen() {
if (downloaded) { if (downloaded) {
openSavedFile() openSavedFile();
} else { } else {
openOnFinished = true openOnFinished = true;
root.room.downloadFile(root.eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId)) root.room.downloadFile(root.eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId));
} }
} }
function openSavedFile() { function openSavedFile() {
if (UrlHelper.openUrl(root.progressInfo.localPath)) return; if (UrlHelper.openUrl(root.progressInfo.localPath))
if (UrlHelper.openUrl(root.progressInfo.localDir)) return; return;
if (UrlHelper.openUrl(root.progressInfo.localDir))
return;
} }
MediaSizeHelper { MediaSizeHelper {

View File

@@ -13,10 +13,10 @@ import org.kde.kquickimageeditor as KQuickImageEditor
Kirigami.Page { Kirigami.Page {
id: rootEditorView id: rootEditorView
property bool resizing: false; property bool resizing: false
required property string imagePath required property string imagePath
signal newPathChanged(string newPath); signal newPathChanged(string newPath)
title: i18n("Edit") title: i18n("Edit")
leftPadding: 0 leftPadding: 0
@@ -27,7 +27,7 @@ Kirigami.Page {
function crop() { function crop() {
const ratioX = editImage.paintedWidth / editImage.nativeWidth; const ratioX = editImage.paintedWidth / editImage.nativeWidth;
const ratioY = editImage.paintedHeight / editImage.nativeHeight; const ratioY = editImage.paintedHeight / editImage.nativeHeight;
rootEditorView.resizing = false rootEditorView.resizing = false;
imageDoc.crop(selectionTool.selectionX / ratioX, selectionTool.selectionY / ratioY, selectionTool.selectionWidth / ratioX, selectionTool.selectionHeight / ratioY); imageDoc.crop(selectionTool.selectionX / ratioX, selectionTool.selectionY / ratioY, selectionTool.selectionWidth / ratioX, selectionTool.selectionHeight / ratioY);
} }
@@ -36,7 +36,7 @@ Kirigami.Page {
id: undoAction id: undoAction
text: i18nc("@action:button Undo modification", "Undo") text: i18nc("@action:button Undo modification", "Undo")
icon.name: "edit-undo" icon.name: "edit-undo"
onTriggered: imageDoc.undo(); onTriggered: imageDoc.undo()
visible: imageDoc.edited visible: imageDoc.edited
}, },
Kirigami.Action { Kirigami.Action {
@@ -45,19 +45,17 @@ Kirigami.Page {
icon.name: "dialog-ok" icon.name: "dialog-ok"
onTriggered: { onTriggered: {
let newPath = Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + (new Date()).getTime() + "." + imagePath.split('.').pop(); let newPath = Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + (new Date()).getTime() + "." + imagePath.split('.').pop();
if (imageDoc.saveAs(newPath)) {; if (imageDoc.saveAs(newPath)) {
newPathChanged(newPath); newPathChanged(newPath);
} else { } else {
msg.type = Kirigami.MessageType.Error msg.type = Kirigami.MessageType.Error;
msg.text = i18n("Unable to save file. Check if you have the correct permission to edit the cache directory.") msg.text = i18n("Unable to save file. Check if you have the correct permission to edit the cache directory.");
msg.visible = true; msg.visible = true;
} }
} }
} }
] ]
KQuickImageEditor.ImageItem { KQuickImageEditor.ImageItem {
id: editImage id: editImage
// Assigning this to the contentItem and setting the padding causes weird positioning issues // Assigning this to the contentItem and setting the padding causes weird positioning issues
@@ -68,17 +66,17 @@ Kirigami.Page {
Shortcut { Shortcut {
sequence: StandardKey.Undo sequence: StandardKey.Undo
onActivated: undoAction.trigger(); onActivated: undoAction.trigger()
} }
Shortcut { Shortcut {
sequences: [StandardKey.Save, "Enter"] sequences: [StandardKey.Save, "Enter"]
onActivated: saveAction.trigger(); onActivated: saveAction.trigger()
} }
Shortcut { Shortcut {
sequence: StandardKey.SaveAs sequence: StandardKey.SaveAs
onActivated: saveAsAction.trigger(); onActivated: saveAsAction.trigger()
} }
KQuickImageEditor.ImageDocument { KQuickImageEditor.ImageDocument {
@@ -104,15 +102,15 @@ Kirigami.Page {
Connections { Connections {
target: selectionTool.selectionArea target: selectionTool.selectionArea
function onDoubleClicked() { function onDoubleClicked() {
rootEditorView.crop() rootEditorView.crop();
} }
} }
} }
onImageChanged: { onImageChanged: {
selectionTool.selectionX = 0 selectionTool.selectionX = 0;
selectionTool.selectionY = 0 selectionTool.selectionY = 0;
selectionTool.selectionWidth = Qt.binding(() => selectionTool.width) selectionTool.selectionWidth = Qt.binding(() => selectionTool.width);
selectionTool.selectionHeight = Qt.binding(() => selectionTool.height) selectionTool.selectionHeight = Qt.binding(() => selectionTool.height);
} }
} }
@@ -123,48 +121,47 @@ Kirigami.Page {
actions: [ actions: [
Kirigami.Action { Kirigami.Action {
icon.name: rootEditorView.resizing ? "dialog-cancel" : "transform-crop" icon.name: rootEditorView.resizing ? "dialog-cancel" : "transform-crop"
text: rootEditorView.resizing ? i18n("Cancel") : i18nc("@action:button Crop an image", "Crop"); text: rootEditorView.resizing ? i18n("Cancel") : i18nc("@action:button Crop an image", "Crop")
onTriggered: { onTriggered: {
resizeRectangle.width = editImage.paintedWidth resizeRectangle.width = editImage.paintedWidth;
resizeRectangle.height = editImage.paintedHeight resizeRectangle.height = editImage.paintedHeight;
resizeRectangle.x = editImage.horizontalPadding resizeRectangle.x = editImage.horizontalPadding;
resizeRectangle.y = editImage.verticalPadding resizeRectangle.y = editImage.verticalPadding;
resizeRectangle.insideX = 100 resizeRectangle.insideX = 100;
resizeRectangle.insideY = 100 resizeRectangle.insideY = 100;
resizeRectangle.insideWidth = 100 resizeRectangle.insideWidth = 100;
resizeRectangle.insideHeight = 100 resizeRectangle.insideHeight = 100;
rootEditorView.resizing = !rootEditorView.resizing; rootEditorView.resizing = !rootEditorView.resizing;
} }
}, },
Kirigami.Action { Kirigami.Action {
icon.name: "dialog-ok" icon.name: "dialog-ok"
visible: rootEditorView.resizing visible: rootEditorView.resizing
text: i18nc("@action:button Crop an image", "Crop"); text: i18nc("@action:button Crop an image", "Crop")
onTriggered: rootEditorView.crop(); onTriggered: rootEditorView.crop()
}, },
Kirigami.Action { Kirigami.Action {
icon.name: "object-rotate-left" icon.name: "object-rotate-left"
text: i18nc("@action:button Rotate an image to the left", "Rotate left"); text: i18nc("@action:button Rotate an image to the left", "Rotate left")
onTriggered: imageDoc.rotate(-90); onTriggered: imageDoc.rotate(-90)
visible: !rootEditorView.resizing visible: !rootEditorView.resizing
}, },
Kirigami.Action { Kirigami.Action {
icon.name: "object-rotate-right" icon.name: "object-rotate-right"
text: i18nc("@action:button Rotate an image to the right", "Rotate right"); text: i18nc("@action:button Rotate an image to the right", "Rotate right")
onTriggered: imageDoc.rotate(90); onTriggered: imageDoc.rotate(90)
visible: !rootEditorView.resizing visible: !rootEditorView.resizing
}, },
Kirigami.Action { Kirigami.Action {
icon.name: "object-flip-vertical" icon.name: "object-flip-vertical"
text: i18nc("@action:button Mirror an image vertically", "Flip"); text: i18nc("@action:button Mirror an image vertically", "Flip")
onTriggered: imageDoc.mirror(false, true); onTriggered: imageDoc.mirror(false, true)
visible: !rootEditorView.resizing visible: !rootEditorView.resizing
}, },
Kirigami.Action { Kirigami.Action {
icon.name: "object-flip-horizontal" icon.name: "object-flip-horizontal"
text: i18nc("@action:button Mirror an image horizontally", "Mirror"); text: i18nc("@action:button Mirror an image horizontally", "Mirror")
onTriggered: imageDoc.mirror(true, false); onTriggered: imageDoc.mirror(true, false)
visible: !rootEditorView.resizing visible: !rootEditorView.resizing
} }
] ]

View File

@@ -26,14 +26,14 @@ Kirigami.PlaceholderMessage {
} }
} }
QQC2.Button { QQC2.Button {
Layout.alignment : Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: i18n("Reject") text: i18n("Reject")
onClicked: RoomManager.leaveRoom(root.currentRoom); onClicked: RoomManager.leaveRoom(root.currentRoom)
} }
QQC2.Button { QQC2.Button {
Layout.alignment : Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: i18n("Accept") text: i18n("Accept")
onClicked: { onClicked: {

View File

@@ -45,7 +45,7 @@ Kirigami.ScrollablePage {
highlighted: true highlighted: true
onClicked: { onClicked: {
room.inviteToRoom(identifierField.text) room.inviteToRoom(identifierField.text);
} }
} }
} }
@@ -105,7 +105,7 @@ Kirigami.ScrollablePage {
onToggled: { onToggled: {
if (inRoom) { if (inRoom) {
checked = true checked = true;
} else { } else {
room.inviteToRoom(delegate.userId); room.inviteToRoom(delegate.userId);
applicationWindow().pageStack.layers.pop(); applicationWindow().pageStack.layers.pop();

View File

@@ -74,7 +74,9 @@ Kirigami.Page {
visible: root.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"

View File

@@ -31,7 +31,7 @@ Loader {
* When the content of the link preview is larger than this it will be * When the content of the link preview is larger than this it will be
* elided/hidden until maximized. * elided/hidden until maximized.
*/ */
property var defaultHeight : Kirigami.Units.gridUnit * 3 + Kirigami.Units.smallSpacing * 2 property var defaultHeight: Kirigami.Units.gridUnit * 3 + Kirigami.Units.smallSpacing * 2
/** /**
* @brief Whether the loading indicator should animate if visible. * @brief Whether the loading indicator should animate if visible.
@@ -146,4 +146,3 @@ Loader {
} }
} }
} }

View File

@@ -42,8 +42,10 @@ MessageDelegate {
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onTapped: { onTapped: {
let map = fullScreenMap.createObject(parent, {liveLocationModel: liveLocationModel}); let map = fullScreenMap.createObject(parent, {
map.open() liveLocationModel: liveLocationModel
});
map.open();
} }
onLongPressed: openMessageContext("") onLongPressed: openMessageContext("")
} }
@@ -54,7 +56,7 @@ MessageDelegate {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated() {
Qt.openUrlExternally(link) Qt.openUrlExternally(link);
} }
} }
} }

View File

@@ -23,7 +23,7 @@ LoginStep {
Connections { Connections {
target: Controller target: Controller
function onConnectionAdded(connection) { function onConnectionAdded(connection) {
connection.syncDone.connect(() => root.closeDialog()) connection.syncDone.connect(() => root.closeDialog());
} }
} }
} }

View File

@@ -50,7 +50,7 @@ Components.AbstractMaximizeComponent {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
root.location = mapView.map.toCoordinate(Qt.point(mouseX, mouseY), false) root.location = mapView.map.toCoordinate(Qt.point(mouseX, mouseY), false);
} }
} }
@@ -84,7 +84,7 @@ Components.AbstractMaximizeComponent {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated() {
Qt.openUrlExternally(link) Qt.openUrlExternally(link);
} }
} }
} }

View File

@@ -58,8 +58,13 @@ MessageDelegate {
TapHandler { TapHandler {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onTapped: { onTapped: {
let map = fullScreenMap.createObject(parent, {latitude: root.latitude, longitude: root.longitude, asset: root.asset, author: root.author}); let map = fullScreenMap.createObject(parent, {
map.open() latitude: root.latitude,
longitude: root.longitude,
asset: root.asset,
author: root.author
});
map.open();
} }
onLongPressed: openMessageContext("") onLongPressed: openMessageContext("")
} }
@@ -70,13 +75,13 @@ MessageDelegate {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated() {
Qt.openUrlExternally(link) Qt.openUrlExternally(link);
} }
} }
} }
Component { Component {
id: fullScreenMap id: fullScreenMap
FullScreenMap { } FullScreenMap {}
} }
RichLabel { RichLabel {

View File

@@ -67,8 +67,8 @@ MapQuickItem {
anchors.bottom: mainIcon.top anchors.bottom: mainIcon.top
anchors.horizontalCenter: mainIcon.horizontalCenter anchors.horizontalCenter: mainIcon.horizontalCenter
transform: Rotation { transform: Rotation {
origin.x: headingIcon.width/2 origin.x: headingIcon.width / 2
origin.y: headingIcon.height + mainIcon.height/2 origin.y: headingIcon.height + mainIcon.height / 2
angle: root.heading angle: root.heading
} }
} }

View File

@@ -55,7 +55,7 @@ Kirigami.Page {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated() {
Qt.openUrlExternally(link) Qt.openUrlExternally(link);
} }
} }
} }

View File

@@ -13,10 +13,11 @@ import org.kde.neochat
LoginStep { LoginStep {
id: root id: root
onActiveFocusChanged: if (activeFocus) matrixIdField.forceActiveFocus() onActiveFocusChanged: if (activeFocus)
matrixIdField.forceActiveFocus()
Component.onCompleted: { Component.onCompleted: {
LoginHelper.matrixId = "" LoginHelper.matrixId = "";
} }
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
@@ -25,16 +26,16 @@ LoginStep {
placeholderText: "@user:example.org" placeholderText: "@user:example.org"
Accessible.name: i18n("Matrix ID") Accessible.name: i18n("Matrix ID")
onTextChanged: { onTextChanged: {
LoginHelper.matrixId = text LoginHelper.matrixId = text;
} }
Keys.onReturnPressed: { Keys.onReturnPressed: {
root.nextAction.trigger() root.nextAction.trigger();
} }
} }
nextAction: Kirigami.Action { nextAction: Kirigami.Action {
text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue") text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue")
onTriggered: { onTriggered: {
if (LoginHelper.supportsSso && LoginHelper.supportsPassword) { if (LoginHelper.supportsSso && LoginHelper.supportsPassword) {
processed("qrc:/org/kde/neochat/qml/LoginMethod.qml"); processed("qrc:/org/kde/neochat/qml/LoginMethod.qml");
@@ -48,7 +49,7 @@ LoginStep {
} }
previousAction: Kirigami.Action { previousAction: Kirigami.Action {
onTriggered: { onTriggered: {
root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml") root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml");
} }
} }
} }

View File

@@ -11,7 +11,9 @@ import org.kde.neochat
LoginStep { LoginStep {
id: root id: root
onActiveFocusChanged: if (activeFocus) loginPasswordButton.forceActiveFocus() onActiveFocusChanged: if (activeFocus) {
loginPasswordButton.forceActiveFocus();
}
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
id: loginPasswordButton id: loginPasswordButton

View File

@@ -11,7 +11,9 @@ import org.kde.neochat
LoginStep { LoginStep {
id: root id: root
onActiveFocusChanged: if (activeFocus) loginButton.forceActiveFocus(Qt.TabFocusReason) onActiveFocusChanged: if (activeFocus) {
loginButton.forceActiveFocus(Qt.TabFocusReason);
}
Layout.fillWidth: true Layout.fillWidth: true

View File

@@ -27,8 +27,8 @@ ColumnLayout {
signal showMessage(string message) signal showMessage(string message)
/// Clears any error messages currently being shown /// Clears any error messages currently being shown
signal clearError() signal clearError
/// Closes the login dialog /// Closes the login dialog
signal closeDialog() signal closeDialog
} }

View File

@@ -20,13 +20,7 @@ Kirigami.Dialog {
/** /**
* @brief Signal emitted when a valid room id or alias is entered. * @brief Signal emitted when a valid room id or alias is entered.
*/ */
signal roomSelected(string roomId, signal roomSelected(string roomId, string displayName, url avatarUrl, string alias, string topic, int memberCount, bool isJoined)
string displayName,
url avatarUrl,
string alias,
string topic,
int memberCount,
bool isJoined)
title: i18nc("@title", "Room ID or Alias") title: i18nc("@title", "Room ID or Alias")
@@ -54,7 +48,7 @@ Kirigami.Dialog {
if (roomIdAliasText.room) { if (roomIdAliasText.room) {
roomId = roomIdAliasText.room.id; roomId = roomIdAliasText.room.id;
displayName = roomIdAliasText.room.displayName; displayName = roomIdAliasText.room.displayName;
avatarUrl = roomIdAliasText.room.avatarUrl.toString().length > 0 ? connection.makeMediaUrl(roomIdAliasText.room.avatarUrl) : "" avatarUrl = roomIdAliasText.room.avatarUrl.toString().length > 0 ? connection.makeMediaUrl(roomIdAliasText.room.avatarUrl) : "";
alias = roomIdAliasText.room.canonicalAlias; alias = roomIdAliasText.room.canonicalAlias;
topic = roomIdAliasText.room.topic; topic = roomIdAliasText.room.topic;
memberCount = roomIdAliasText.room.joinedCount; memberCount = roomIdAliasText.room.joinedCount;
@@ -112,7 +106,7 @@ Kirigami.Dialog {
} }
onVisibleChanged: { onVisibleChanged: {
roomIdAliasText.forceActiveFocus() roomIdAliasText.forceActiveFocus();
timer.restart() timer.restart();
} }
} }

View File

@@ -20,7 +20,7 @@ Kirigami.Dialog {
/** /**
* @brief Thrown when a user is selected. * @brief Thrown when a user is selected.
*/ */
signal userSelected() signal userSelected
title: i18nc("@title", "User ID") title: i18nc("@title", "User ID")
@@ -37,7 +37,7 @@ Kirigami.Dialog {
text: i18n("OK") text: i18n("OK")
icon.name: "dialog-ok" icon.name: "dialog-ok"
onTriggered: { onTriggered: {
root.connection.openOrCreateDirectChat(userIdText.text) root.connection.openOrCreateDirectChat(userIdText.text);
root.accept(); root.accept();
} }
} }
@@ -75,7 +75,7 @@ Kirigami.Dialog {
} }
onVisibleChanged: { onVisibleChanged: {
userIdText.forceActiveFocus() userIdText.forceActiveFocus();
timer.restart() timer.restart();
} }
} }

View File

@@ -257,7 +257,7 @@ TimelineDelegate {
/** /**
* @brief Open the any message media externally. * @brief Open the any message media externally.
*/ */
signal openExternally() signal openExternally
/** /**
* @brief The reply has been clicked. * @brief The reply has been clicked.
@@ -293,7 +293,9 @@ TimelineDelegate {
*/ */
property bool isTemporaryHighlighted: false property bool isTemporaryHighlighted: false
onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) temporaryHighlightTimer.start() onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) {
temporaryHighlightTimer.start();
}
Timer { Timer {
id: temporaryHighlightTimer id: temporaryHighlightTimer
@@ -329,20 +331,20 @@ TimelineDelegate {
Component.onCompleted: { Component.onCompleted: {
if (root.isReply && root.replyDelegateType === DelegateType.Other) { if (root.isReply && root.replyDelegateType === DelegateType.Other) {
root.room.loadReply(root.eventId, root.replyId) root.room.loadReply(root.eventId, root.replyId);
} }
} }
// show hover actions // show hover actions
onHoveredChanged: { onHoveredChanged: {
if (hovered && !Kirigami.Settings.isMobile) { if (hovered && !Kirigami.Settings.isMobile) {
root.setHoverActionsToDelegate() root.setHoverActionsToDelegate();
} }
} }
KirigamiComponents.AvatarButton { KirigamiComponents.AvatarButton {
id: avatar id: avatar
width: visible || Config.showAvatarInTimeline ? Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2: 0 width: visible || Config.showAvatarInTimeline ? Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2 : 0
height: width height: width
anchors { anchors {
left: parent.left left: parent.left
@@ -351,9 +353,7 @@ TimelineDelegate {
topMargin: Kirigami.Units.smallSpacing topMargin: Kirigami.Units.smallSpacing
} }
visible: (root.showAuthor || root.alwaysShowAuthor) && visible: (root.showAuthor || root.alwaysShowAuthor) && Config.showAvatarInTimeline && (Config.compactLayout || !_private.showUserMessageOnRight)
Config.showAvatarInTimeline &&
(Config.compactLayout || !_private.showUserMessageOnRight)
name: root.author.displayName name: root.author.displayName
source: root.author.avatarSource source: root.author.avatarSource
color: root.author.color color: root.author.color
@@ -409,7 +409,9 @@ TimelineDelegate {
replyDisplay: root.replyDisplay replyDisplay: root.replyDisplay
replyMediaInfo: root.replyMediaInfo replyMediaInfo: root.replyMediaInfo
onReplyClicked: (eventId) => {root.replyClicked(eventId)} onReplyClicked: eventId => {
root.replyClicked(eventId);
}
showBackground: root.cardBackground && !Config.compactLayout showBackground: root.cardBackground && !Config.compactLayout
} }
@@ -440,7 +442,7 @@ TimelineDelegate {
visible: root.showReactions visible: root.showReactions
model: root.reaction model: root.reaction
onReactionClicked: (reaction) => root.room.toggleReaction(root.eventId, reaction) onReactionClicked: reaction => root.room.toggleReaction(root.eventId, reaction)
} }
AvatarFlow { AvatarFlow {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
@@ -463,13 +465,13 @@ TimelineDelegate {
} }
function isVisibleInTimeline() { function isVisibleInTimeline() {
let yoff = Math.round(y - ListView.view.contentY); let yoff = Math.round(y - ListView.view.contentY);
return (yoff + height > 0 && yoff < ListView.view.height) return (yoff + height > 0 && yoff < ListView.view.height);
} }
function setHoverActionsToDelegate() { function setHoverActionsToDelegate() {
if (ListView.view.setHoverActionsToDelegate) { if (ListView.view.setHoverActionsToDelegate) {
ListView.view.setHoverActionsToDelegate(root) ListView.view.setHoverActionsToDelegate(root);
} }
} }

View File

@@ -115,11 +115,11 @@ Loader {
}, { }, {
title: i18nc("@title", "Forward Message"), title: i18nc("@title", "Forward Message"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}) });
page.chosen.connect(function(targetRoomId) { page.chosen.connect(function (targetRoomId) {
root.connection.room(targetRoomId).postHtmlMessage(root.plainText, root.htmlText.length > 0 ? root.htmlText : root.plainText) root.connection.room(targetRoomId).postHtmlMessage(root.plainText, root.htmlText.length > 0 ? root.htmlText : root.plainText);
page.closeDialog() page.closeDialog();
}) });
} }
}, },
Kirigami.Action { Kirigami.Action {
@@ -127,7 +127,10 @@ Loader {
text: i18n("Remove") text: i18n("Remove")
icon.name: "edit-delete-remove" icon.name: "edit-delete-remove"
icon.color: "red" icon.color: "red"
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {
room: currentRoom,
eventId: eventId
}, {
title: i18nc("@title", "Remove Message"), title: i18nc("@title", "Remove Message"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}) })
@@ -141,7 +144,10 @@ Loader {
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")
icon.name: "dialog-warning-symbolic" icon.name: "dialog-warning-symbolic"
visible: !author.isLocalUser visible: !author.isLocalUser
onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {
room: currentRoom,
eventId: eventId
}, {
title: i18nc("@title", "Report Message"), title: i18nc("@title", "Report Message"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}) })
@@ -156,7 +162,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 + "/" + root.eventId) Clipboard.saveText("https://matrix.to/#/" + currentRoom.id + "/" + root.eventId);
} }
} }
] ]
@@ -180,12 +186,14 @@ Loader {
icon.name: modelData.icon.name icon.name: modelData.icon.name
onTriggered: modelData.trigger() onTriggered: modelData.trigger()
} }
onObjectAdded: (index, object) => {menuItem.insertItem(0, object)} onObjectAdded: (index, object) => {
menuItem.insertItem(0, object);
}
} }
} }
onObjectAdded: (index, object) => { onObjectAdded: (index, object) => {
object.visible = false; object.visible = false;
menu.addMenu(object) menu.addMenu(object);
} }
} }
@@ -194,7 +202,7 @@ Loader {
QQC2.MenuItem { QQC2.MenuItem {
visible: modelData.visible visible: modelData.visible
action: modelData action: modelData
onClicked: root.item.close(); onClicked: root.item.close()
} }
} }
QQC2.Menu { QQC2.Menu {
@@ -202,7 +210,7 @@ Loader {
title: i18n("Search for '%1'", webshortcutmodel.trunkatedSearchText) title: i18n("Search for '%1'", webshortcutmodel.trunkatedSearchText)
property bool isVisible: webshortcutmodel.enabled property bool isVisible: webshortcutmodel.enabled
Component.onCompleted: { Component.onCompleted: {
webshortcutmenu.parent.visible = isVisible webshortcutmenu.parent.visible = isVisible;
} }
onIsVisibleChanged: webshortcutmenu.parent.visible = isVisible onIsVisibleChanged: webshortcutmenu.parent.visible = isVisible
Instantiator { Instantiator {
@@ -279,7 +287,7 @@ Loader {
visible: modelData.visible visible: modelData.visible
text: modelData.text text: modelData.text
onClicked: { onClicked: {
modelData.triggered() modelData.triggered();
root.item.close(); root.item.close();
} }
} }
@@ -315,7 +323,7 @@ Loader {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
onLinkActivated: RoomManager.resolveResource(link, "join"); onLinkActivated: RoomManager.resolveResource(link, "join")
} }
} }
} }
@@ -361,7 +369,7 @@ Loader {
visible: modelData.visible visible: modelData.visible
text: modelData.text text: modelData.text
onClicked: { onClicked: {
modelData.triggered() modelData.triggered();
root.item.close(); root.item.close();
} }
} }
@@ -401,4 +409,3 @@ Loader {
} }
} }
} }

View File

@@ -14,8 +14,8 @@ QQC2.TextArea {
required property NeoChatRoom room required property NeoChatRoom room
onRoomChanged: { onRoomChanged: {
_private.chatBarCache = room.editCache _private.chatBarCache = room.editCache;
_private.chatBarCache.relationIdChanged.connect(_private.updateEditText) _private.chatBarCache.relationIdChanged.connect(_private.updateEditText);
} }
/** /**
@@ -37,37 +37,37 @@ QQC2.TextArea {
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap
onTextChanged: { onTextChanged: {
_private.chatBarCache.text = text _private.chatBarCache.text = text;
} }
Keys.onEnterPressed: { Keys.onEnterPressed: {
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.complete() completionMenu.complete();
} else if (event.modifiers & Qt.ShiftModifier) { } else if (event.modifiers & Qt.ShiftModifier) {
root.insert(cursorPosition, "\n") root.insert(cursorPosition, "\n");
} else { } else {
root.postEdit(); root.postEdit();
} }
} }
Keys.onReturnPressed: { Keys.onReturnPressed: {
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.complete() completionMenu.complete();
} else if (event.modifiers & Qt.ShiftModifier) { } else if (event.modifiers & Qt.ShiftModifier) {
root.insert(cursorPosition, "\n") root.insert(cursorPosition, "\n");
} else { } else {
root.postEdit(); root.postEdit();
} }
} }
Keys.onTabPressed: { Keys.onTabPressed: {
if (completionMenu.visible) { if (completionMenu.visible) {
completionMenu.complete() completionMenu.complete();
} }
} }
Keys.onPressed: event => { Keys.onPressed: event => {
if (event.key === Qt.Key_Up && completionMenu.visible) { if (event.key === Qt.Key_Up && completionMenu.visible) {
completionMenu.decrementIndex() completionMenu.decrementIndex();
} else if (event.key === Qt.Key_Down && completionMenu.visible) { } else if (event.key === Qt.Key_Down && completionMenu.visible) {
completionMenu.incrementIndex() completionMenu.incrementIndex();
} }
} }
@@ -156,12 +156,10 @@ QQC2.TextArea {
function updateEditText() { function updateEditText() {
if (chatBarCache?.isEditing && chatBarCache.relationMessage.length > 0) { if (chatBarCache?.isEditing && chatBarCache.relationMessage.length > 0) {
root.text = chatBarCache.relationMessage root.text = chatBarCache.relationMessage;
root.forceActiveFocus(); root.forceActiveFocus();
root.cursorPosition = root.length; root.cursorPosition = root.length;
} }
} }
} }
} }

View File

@@ -100,4 +100,3 @@ Kirigami.Page {
} }
} }
} }

View File

@@ -37,7 +37,7 @@ Components.AlbumMaximizeComponent {
downloadAction: Components.DownloadAction { downloadAction: Components.DownloadAction {
id: downloadAction id: downloadAction
onTriggered: { onTriggered: {
currentRoom.downloadFile(root.currentEventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.currentEventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(root.currentEventId)) currentRoom.downloadFile(root.currentEventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.currentEventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(root.currentEventId));
} }
} }
@@ -46,7 +46,7 @@ Components.AlbumMaximizeComponent {
function onFileTransferProgress(id, progress, total) { function onFileTransferProgress(id, progress, total) {
if (id == root.currentEventId) { if (id == root.currentEventId) {
downloadAction.progress = progress / total * 100.0 downloadAction.progress = progress / total * 100.0;
} }
} }
} }
@@ -55,7 +55,7 @@ Components.AlbumMaximizeComponent {
target: content target: content
function onCurrentIndexChanged() { function onCurrentIndexChanged() {
downloadAction.progress = currentProgressInfo.progress / currentProgressInfo.total * 100.0 downloadAction.progress = currentProgressInfo.progress / currentProgressInfo.total * 100.0;
} }
} }
@@ -87,25 +87,18 @@ Components.AlbumMaximizeComponent {
} }
} }
} }
onItemRightClicked: RoomManager.viewEventMenu(root.currentEventId, onItemRightClicked: RoomManager.viewEventMenu(root.currentEventId, root.currentAuthor, root.currentDelegateType, root.currentPlainText, "", "", root.currentMimeType, root.currentProgressInfo)
root.currentAuthor,
root.currentDelegateType,
root.currentPlainText,
"",
"",
root.currentMimeType,
root.currentProgressInfo)
onSaveItem: { onSaveItem: {
var dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay) var dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay);
dialog.open() dialog.open();
dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(root.currentEventId) dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(root.currentEventId);
} }
Connections { Connections {
target: RoomManager target: RoomManager
function onCloseFullScreen() { function onCloseFullScreen() {
root.close() root.close();
} }
} }
@@ -115,12 +108,12 @@ Components.AlbumMaximizeComponent {
fileMode: FileDialog.SaveFile fileMode: FileDialog.SaveFile
folder: root.saveFolder folder: root.saveFolder
onAccepted: { onAccepted: {
Config.lastSaveDirectory = folder Config.lastSaveDirectory = folder;
Config.save() Config.save();
if (!currentFile) { if (!currentFile) {
return; return;
} }
currentRoom.downloadFile(rooteventId, currentFile) currentRoom.downloadFile(rooteventId, currentFile);
} }
} }
} }

View File

@@ -27,7 +27,7 @@ FormCard.FormCardPage {
checked: currentType === 0 checked: currentType === 0
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
onToggled: { onToggled: {
currentType = 0 currentType = 0;
} }
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
@@ -35,7 +35,7 @@ FormCard.FormCardPage {
checked: currentType === 1 checked: currentType === 1
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
onToggled: { onToggled: {
currentType = 1 currentType = 1;
} }
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
@@ -43,7 +43,7 @@ FormCard.FormCardPage {
checked: currentType === 2 checked: currentType === 2
enabled: !Config.isProxyTypeImmutable enabled: !Config.isProxyTypeImmutable
onToggled: { onToggled: {
currentType = 2 currentType = 2;
} }
} }
} }
@@ -58,7 +58,7 @@ FormCard.FormCardPage {
text: Config.proxyHost text: Config.proxyHost
inputMethodHints: Qt.ImhUrlCharactersOnly inputMethodHints: Qt.ImhUrlCharactersOnly
onEditingFinished: { onEditingFinished: {
proxyConfigChanged = true proxyConfigChanged = true;
} }
} }
FormCard.FormSpinBoxDelegate { FormCard.FormSpinBoxDelegate {
@@ -67,11 +67,11 @@ FormCard.FormCardPage {
value: Config.proxyPort value: Config.proxyPort
from: 0 from: 0
to: 65536 to: 65536
textFromValue: function(value, locale) { textFromValue: function (value, locale) {
return value // it will add a thousands separator if we don't do this, not sure why return value; // it will add a thousands separator if we don't do this, not sure why
} }
onValueChanged: { onValueChanged: {
proxyConfigChanged = true proxyConfigChanged = true;
} }
} }
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
@@ -80,7 +80,7 @@ FormCard.FormCardPage {
text: Config.proxyUser text: Config.proxyUser
inputMethodHints: Qt.ImhUrlCharactersOnly inputMethodHints: Qt.ImhUrlCharactersOnly
onEditingFinished: { onEditingFinished: {
proxyConfigChanged = true proxyConfigChanged = true;
} }
} }
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
@@ -90,7 +90,7 @@ FormCard.FormCardPage {
echoMode: TextInput.Password echoMode: TextInput.Password
inputMethodHints: Qt.ImhUrlCharactersOnly inputMethodHints: Qt.ImhUrlCharactersOnly
onEditingFinished: { onEditingFinished: {
proxyConfigChanged = true proxyConfigChanged = true;
} }
} }
} }
@@ -102,24 +102,24 @@ FormCard.FormCardPage {
Layout.fillWidth: true Layout.fillWidth: true
} }
QQC2.Button { QQC2.Button {
text: i18n("Apply") text: i18n("Apply")
enabled: currentType !== Config.proxyType || proxyConfigChanged enabled: currentType !== Config.proxyType || proxyConfigChanged
onClicked: { onClicked: {
Config.proxyType = currentType Config.proxyType = currentType;
Config.proxyHost = hostField.text Config.proxyHost = hostField.text;
Config.proxyPort = portField.value Config.proxyPort = portField.value;
Config.proxyUser = userField.text Config.proxyUser = userField.text;
Config.proxyPassword = passwordField.text Config.proxyPassword = passwordField.text;
Config.save() Config.save();
proxyConfigChanged = false proxyConfigChanged = false;
ProxyController.setApplicationProxy() ProxyController.setApplicationProxy();
} }
} }
} }
} }
Component.onCompleted: { Component.onCompleted: {
currentType = Config.proxyType currentType = Config.proxyType;
} }
} }

View File

@@ -24,17 +24,17 @@ FormCard.AbstractFormDelegate {
readonly property bool highlightOn: isNotificationRuleHighlight(ruleAction) readonly property bool highlightOn: isNotificationRuleHighlight(ruleAction)
signal actionChanged(int action) signal actionChanged(int action)
signal deleteRule() signal deleteRule
enabled: ruleAction !== PushRuleAction.Unknown enabled: ruleAction !== PushRuleAction.Unknown
text: name text: name
onClicked: { onClicked: {
notificationAction = nextNotificationRuleAction(notificationAction) notificationAction = nextNotificationRuleAction(notificationAction);
} }
contentItem : RowLayout { contentItem: RowLayout {
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
QQC2.Label { QQC2.Label {
@@ -78,7 +78,7 @@ FormCard.AbstractFormDelegate {
enabled: root.enabled enabled: root.enabled
down: checked down: checked
onToggled: { onToggled: {
root.actionChanged(root.notifcationRuleAction()) root.actionChanged(root.notifcationRuleAction());
} }
QQC2.ToolTip { QQC2.ToolTip {
@@ -99,7 +99,7 @@ FormCard.AbstractFormDelegate {
enabled: (onButton.checked || !root.notificationsOnModifiable) && root.enabled enabled: (onButton.checked || !root.notificationsOnModifiable) && root.enabled
down: checked down: checked
onToggled: { onToggled: {
root.actionChanged(root.notifcationRuleAction()) root.actionChanged(root.notifcationRuleAction());
} }
QQC2.ToolTip { QQC2.ToolTip {
@@ -121,7 +121,7 @@ FormCard.AbstractFormDelegate {
enabled: (onButton.checked || !root.notificationsOnModifiable) && root.enabled enabled: (onButton.checked || !root.notificationsOnModifiable) && root.enabled
down: checked down: checked
onToggled: { onToggled: {
root.actionChanged(root.notifcationRuleAction()) root.actionChanged(root.notifcationRuleAction());
} }
QQC2.ToolTip { QQC2.ToolTip {
@@ -138,7 +138,7 @@ FormCard.AbstractFormDelegate {
visible: root.deletable visible: root.deletable
onClicked: { onClicked: {
root.deleteRule() root.deleteRule();
} }
} }
} }
@@ -147,57 +147,49 @@ FormCard.AbstractFormDelegate {
function notifcationRuleAction() { function notifcationRuleAction() {
if (onButton.checked) { if (onButton.checked) {
if (noisyButton.checked && highlightButton.checked && root.highlightable) { if (noisyButton.checked && highlightButton.checked && root.highlightable) {
return PushRuleAction.NoisyHighlight return PushRuleAction.NoisyHighlight;
} else if (noisyButton.checked) { } else if (noisyButton.checked) {
return PushRuleAction.Noisy return PushRuleAction.Noisy;
} else if (highlightButton.checked && root.highlightable) { } else if (highlightButton.checked && root.highlightable) {
return PushRuleAction.Highlight return PushRuleAction.Highlight;
} else { } else {
return PushRuleAction.On return PushRuleAction.On;
} }
} else { } else {
return PushRuleAction.Off return PushRuleAction.Off;
} }
} }
function nextNotificationRuleAction(action) { function nextNotificationRuleAction(action) {
let finished = false let finished = false;
if (action == PushRuleAction.NoisyHighlight) { if (action == PushRuleAction.NoisyHighlight) {
action = PushRuleAction.Off action = PushRuleAction.Off;
} else { } else {
action += 1 action += 1;
} }
while (!finished) { while (!finished) {
if (action == PushRuleAction.Off && !root.notificationsOnModifiable) { if (action == PushRuleAction.Off && !root.notificationsOnModifiable) {
action = PushRuleAction.On action = PushRuleAction.On;
} else if (action == PushRuleAction.Noisy) { } else if (action == PushRuleAction.Noisy) {
action = PushRuleAction.Highlight action = PushRuleAction.Highlight;
} else if (action == PushRuleAction.Highlight && !root.highlightable) { } else if (action == PushRuleAction.Highlight && !root.highlightable) {
action = PushRuleAction.Off action = PushRuleAction.Off;
} else { } else {
finished = true finished = true;
} }
} }
actionChanged(action);
actionChanged(action)
} }
function isNotificationRuleOn(action) { function isNotificationRuleOn(action) {
return action == PushRuleAction.On || return action == PushRuleAction.On || action == PushRuleAction.Noisy || action == PushRuleAction.Highlight || action == PushRuleAction.NoisyHighlight;
action == PushRuleAction.Noisy ||
action == PushRuleAction.Highlight ||
action == PushRuleAction.NoisyHighlight
} }
function isNotificationRuleNoisy(action) { function isNotificationRuleNoisy(action) {
return action == PushRuleAction.Noisy || return action == PushRuleAction.Noisy || action == PushRuleAction.NoisyHighlight;
action == PushRuleAction.NoisyHighlight
} }
function isNotificationRuleHighlight(action) { function isNotificationRuleHighlight(action) {
return action == PushRuleAction.Highlight || return action == PushRuleAction.Highlight || action == PushRuleAction.NoisyHighlight;
action == PushRuleAction.NoisyHighlight
} }
} }

View File

@@ -15,11 +15,12 @@ LoginStep {
Connections { Connections {
target: LoginHelper target: LoginHelper
function onConnected() { function onConnected() {
processed("qrc:/org/kde/neochat/qml/Loading.qml") processed("qrc:/org/kde/neochat/qml/Loading.qml");
} }
} }
onActiveFocusChanged: if(activeFocus) passwordField.forceActiveFocus() onActiveFocusChanged: if (activeFocus)
passwordField.forceActiveFocus()
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
id: passwordField id: passwordField
@@ -32,7 +33,7 @@ LoginStep {
statusMessage: LoginHelper.isInvalidPassword ? i18n("Invalid username or password") : "" statusMessage: LoginHelper.isInvalidPassword ? i18n("Invalid username or password") : ""
Keys.onReturnPressed: { Keys.onReturnPressed: {
root.nextAction.trigger() root.nextAction.trigger();
} }
} }
@@ -40,7 +41,7 @@ LoginStep {
text: i18nc("@action:button", "Login") text: i18nc("@action:button", "Login")
enabled: passwordField.text.length > 0 && !LoginHelper.isLoggingIn enabled: passwordField.text.length > 0 && !LoginHelper.isLoggingIn
onTriggered: { onTriggered: {
root.clearError() root.clearError();
LoginHelper.login(); LoginHelper.login();
} }
} }

View File

@@ -38,8 +38,8 @@ FormCard.FormCardPage {
sourceModel: userListModel sourceModel: userListModel
sortRoleName: "powerLevel" sortRoleName: "powerLevel"
sortOrder: Qt.DescendingOrder sortOrder: Qt.DescendingOrder
filterRowCallback: function(source_row, source_parent) { filterRowCallback: function (source_row, source_parent) {
let powerLevelRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), UserListModel.PowerLevelRole) let powerLevelRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), UserListModel.PowerLevelRole);
return powerLevelRole > 0; return powerLevelRole > 0;
} }
} }
@@ -68,20 +68,31 @@ FormCard.FormCardPage {
* before the first delegate sets it's current index. * before the first delegate sets it's current index.
*/ */
if (powerLevelModel.count == 0) { if (powerLevelModel.count == 0) {
powerLevelModel.append({"text": i18n("Member (0)"), "powerLevel": 0}); powerLevelModel.append({
powerLevelModel.append({"text": i18n("Moderator (50)"), "powerLevel": 50}); "text": i18n("Member (0)"),
powerLevelModel.append({"text": i18n("Admin (100)"), "powerLevel": 100}); "powerLevel": 0
});
powerLevelModel.append({
"text": i18n("Moderator (50)"),
"powerLevel": 50
});
powerLevelModel.append({
"text": i18n("Admin (100)"),
"powerLevel": 100
});
} }
currentIndex = indexOfValue(powerLevel) currentIndex = indexOfValue(powerLevel);
} }
onActivated: { onActivated: {
room.setUserPowerLevel(userId, currentValue) room.setUserPowerLevel(userId, currentValue);
} }
} }
} }
} }
} }
FormCard.FormDelegateSeparator { below: userListSearchCard } FormCard.FormDelegateSeparator {
below: userListSearchCard
}
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
id: userListSearchCard id: userListSearchCard
visible: room.canSendState("m.room.power_levels") visible: room.canSendState("m.room.power_levels")
@@ -111,7 +122,6 @@ FormCard.FormCardPage {
let maxHeight = userListSearchField.mapToGlobal(userListSearchField.x, userListSearchField.y).y - Kirigami.Units.largeSpacing * 3; let maxHeight = userListSearchField.mapToGlobal(userListSearchField.x, userListSearchField.y).y - Kirigami.Units.largeSpacing * 3;
let minHeight = Kirigami.Units.gridUnit * 2 + userListSearchPopup.padding * 2; let minHeight = Kirigami.Units.gridUnit * 2 + userListSearchPopup.padding * 2;
let filterContentHeight = userListView.contentHeight + userListSearchPopup.padding * 2; let filterContentHeight = userListView.contentHeight + userListSearchPopup.padding * 2;
return Math.max(Math.min(filterContentHeight, maxHeight), minHeight); return Math.max(Math.min(filterContentHeight, maxHeight), minHeight);
} }
padding: Kirigami.Units.smallSpacing padding: Kirigami.Units.smallSpacing
@@ -157,9 +167,9 @@ FormCard.FormCardPage {
onFilterTextChanged: { onFilterTextChanged: {
if (filterText.length > 0 && !userListSearchPopup.visible) { if (filterText.length > 0 && !userListSearchPopup.visible) {
userListSearchPopup.open() userListSearchPopup.open();
} else if (filterText.length <= 0 && userListSearchPopup.visible) { } else if (filterText.length <= 0 && userListSearchPopup.visible) {
userListSearchPopup.close() userListSearchPopup.close();
} }
} }
} }
@@ -204,7 +214,7 @@ FormCard.FormCardPage {
action: Kirigami.Action { action: Kirigami.Action {
id: editPowerLevelAction id: editPowerLevelAction
onTriggered: { onTriggered: {
userListSearchPopup.close() userListSearchPopup.close();
let dialog = powerLevelDialog.createObject(applicationWindow().overlay, { let dialog = powerLevelDialog.createObject(applicationWindow().overlay, {
room: root.room, room: root.room,
userId: userListItem.userId, userId: userListItem.userId,
@@ -240,7 +250,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.defaultUserPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.defaultUserPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.defaultUserPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.defaultUserPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Default power level to set the room state") text: i18n("Default power level to set the room state")
@@ -249,7 +261,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.statePowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.statePowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.statePowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.statePowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Default power level to send messages") text: i18n("Default power level to send messages")
@@ -258,7 +272,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.defaultEventPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.defaultEventPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.defaultEventPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.defaultEventPowerLevel = currentValue;
}
} }
} }
@@ -274,7 +290,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.invitePowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.invitePowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.invitePowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.invitePowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Kick users") text: i18n("Kick users")
@@ -282,7 +300,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.kickPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.kickPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.kickPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.kickPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Ban users") text: i18n("Ban users")
@@ -290,7 +310,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.banPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.banPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.banPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.banPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Remove message sent by other users") text: i18n("Remove message sent by other users")
@@ -298,7 +320,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.redactPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.redactPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.redactPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.redactPowerLevel = currentValue;
}
} }
} }
@@ -315,7 +339,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.powerLevelPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.powerLevelPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.powerLevelPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.powerLevelPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room name") text: i18n("Change the room name")
@@ -324,7 +350,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.namePowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.namePowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.namePowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.namePowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room avatar") text: i18n("Change the room avatar")
@@ -333,7 +361,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.avatarPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.avatarPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.avatarPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.avatarPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room canonical alias") text: i18n("Change the room canonical alias")
@@ -342,7 +372,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.canonicalAliasPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.canonicalAliasPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.canonicalAliasPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.canonicalAliasPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room topic") text: i18n("Change the room topic")
@@ -351,7 +383,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.topicPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.topicPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.topicPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.topicPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Enable encryption for the room") text: i18n("Enable encryption for the room")
@@ -360,7 +394,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.encryptionPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.encryptionPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.encryptionPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.encryptionPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Change the room history visibility") text: i18n("Change the room history visibility")
@@ -369,7 +405,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.historyVisibilityPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.historyVisibilityPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.historyVisibilityPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.historyVisibilityPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Set pinned events") text: i18n("Set pinned events")
@@ -378,7 +416,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.pinnedEventsPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.pinnedEventsPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.pinnedEventsPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.pinnedEventsPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Upgrade the room") text: i18n("Upgrade the room")
@@ -387,7 +427,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.tombstonePowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.tombstonePowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.tombstonePowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.tombstonePowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Set the room server access control list (ACL)") text: i18n("Set the room server access control list (ACL)")
@@ -396,7 +438,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.serverAclPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.serverAclPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.serverAclPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.serverAclPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
visible: room.isSpace visible: room.isSpace
@@ -406,7 +450,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.spaceChildPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.spaceChildPowerLevel = currentValue;
}
} }
FormCard.FormComboBoxDelegate { FormCard.FormComboBoxDelegate {
text: i18n("Set the parent space of this room") text: i18n("Set the parent space of this room")
@@ -415,7 +461,9 @@ FormCard.FormCardPage {
valueRole: "powerLevel" valueRole: "powerLevel"
model: powerLevelModel model: powerLevelModel
Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel) Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel)
onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.spaceParentPowerLevel = currentValue onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) {
room.spaceParentPowerLevel = currentValue;
}
} }
} }
} }

View File

@@ -53,7 +53,7 @@ MessageDelegate {
} }
} }
Label { Label {
visible: root.pollHandler.kind == "org.matrix.msc3381.poll.disclosed" || root.pollHandler.hasEnded visible: root.pollHandler.kind == "org.matrix.msc3381.poll.disclosed" || root.pollHandler.hasEnded
text: i18np("Based on votes by %1 user", "Based on votes by %1 users", root.pollHandler.answerCount) + (root.pollHandler.hasEnded ? (" " + i18nc("as in 'this vote has ended'", "(Ended)")) : "") text: i18np("Based on votes by %1 user", "Based on votes by %1 users", root.pollHandler.answerCount) + (root.pollHandler.hasEnded ? (" " + i18nc("as in 'this vote has ended'", "(Ended)")) : "")
font.pointSize: questionLabel.font.pointSize * 0.8 font.pointSize: questionLabel.font.pointSize * 0.8
} }

View File

@@ -24,7 +24,7 @@ Kirigami.Dialog {
onOpened: { onOpened: {
if (root.opened) { if (root.opened) {
powerLevelComboBox.currentIndex = powerLevelComboBox.indexOfValue(root.powerLevel) powerLevelComboBox.currentIndex = powerLevelComboBox.indexOfValue(root.powerLevel);
} }
} }
@@ -41,9 +41,18 @@ Kirigami.Dialog {
// Done this way so we can have translated strings. // Done this way so we can have translated strings.
Component.onCompleted: { Component.onCompleted: {
powerLevelModel.append({"text": i18n("Member (0)"), "powerLevel": 0}); powerLevelModel.append({
powerLevelModel.append({"text": i18n("Moderator (50)"), "powerLevel": 50}); "text": i18n("Member (0)"),
powerLevelModel.append({"text": i18n("Admin (100)"), "powerLevel": 100}); "powerLevel": 0
});
powerLevelModel.append({
"text": i18n("Moderator (50)"),
"powerLevel": 50
});
powerLevelModel.append({
"text": i18n("Admin (100)"),
"powerLevel": 100
});
} }
} }
} }
@@ -52,9 +61,9 @@ Kirigami.Dialog {
text: i18n("Confirm") text: i18n("Confirm")
icon.name: "dialog-ok" icon.name: "dialog-ok"
onTriggered: { onTriggered: {
root.room.setUserPowerLevel(root.userId, powerLevelComboBox.currentValue) root.room.setUserPowerLevel(root.userId, powerLevelComboBox.currentValue);
root.close() root.close();
root.destroy() root.destroy();
} }
} }
] ]

View File

@@ -32,31 +32,31 @@ FormCard.FormCardPage {
checked: room.pushNotificationState === PushNotificationState.Default checked: room.pushNotificationState === PushNotificationState.Default
enabled: room.pushNotificationState !== PushNotificationState.Unknown enabled: room.pushNotificationState !== PushNotificationState.Unknown
onToggled: { onToggled: {
room.pushNotificationState = PushNotificationState.Default room.pushNotificationState = PushNotificationState.Default;
} }
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18nc("As in 'notify for all messages'","All") text: i18nc("As in 'notify for all messages'", "All")
checked: room.pushNotificationState === PushNotificationState.All checked: room.pushNotificationState === PushNotificationState.All
enabled: room.pushNotificationState !== PushNotificationState.Unknown enabled: room.pushNotificationState !== PushNotificationState.Unknown
onToggled: { onToggled: {
room.pushNotificationState = PushNotificationState.All room.pushNotificationState = PushNotificationState.All;
} }
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'","@Mentions and Keywords") text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'", "@Mentions and Keywords")
checked: room.pushNotificationState === PushNotificationState.MentionKeyword checked: room.pushNotificationState === PushNotificationState.MentionKeyword
enabled: room.pushNotificationState !== PushNotificationState.Unknown enabled: room.pushNotificationState !== PushNotificationState.Unknown
onToggled: { onToggled: {
room.pushNotificationState = PushNotificationState.MentionKeyword room.pushNotificationState = PushNotificationState.MentionKeyword;
} }
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18nc("As in 'do not notify for any messages'","Off") text: i18nc("As in 'do not notify for any messages'", "Off")
checked: room.pushNotificationState === PushNotificationState.Mute checked: room.pushNotificationState === PushNotificationState.Mute
enabled: room.pushNotificationState !== PushNotificationState.Unknown enabled: room.pushNotificationState !== PushNotificationState.Unknown
onToggled: { onToggled: {
room.pushNotificationState = PushNotificationState.Mute room.pushNotificationState = PushNotificationState.Mute;
} }
} }
} }
@@ -69,9 +69,9 @@ FormCard.FormCardPage {
model: KSortFilterProxyModel { model: KSortFilterProxyModel {
sourceModel: root.pushRuleModel sourceModel: root.pushRuleModel
filterRowCallback: function(source_row, source_parent) { filterRowCallback: function (source_row, source_parent) {
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole);
let roomIdRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.RoomIdRole) let roomIdRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.RoomIdRole);
return sectionRole == PushRuleSection.RoomKeywords && roomIdRole == root.room.id; return sectionRole == PushRuleSection.RoomKeywords && roomIdRole == root.room.id;
} }
} }
@@ -82,16 +82,16 @@ FormCard.FormCardPage {
id: ruleDelegate id: ruleDelegate
NotificationRuleItem { NotificationRuleItem {
onDeleteRule: { onDeleteRule: {
root.pushRuleModel.removeKeyword(id) root.pushRuleModel.removeKeyword(id);
} }
onActionChanged: (action) => root.pushRuleModel.setPushRuleAction(id, action) onActionChanged: action => root.pushRuleModel.setPushRuleAction(id, action)
} }
} }
} }
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
Layout.fillWidth: true Layout.fillWidth: true
contentItem : RowLayout { contentItem: RowLayout {
Kirigami.ActionTextField { Kirigami.ActionTextField {
id: keywordAddField id: keywordAddField
@@ -104,13 +104,13 @@ FormCard.FormCardPage {
icon.name: "edit-clear" icon.name: "edit-clear"
visible: keywordAddField.text.length > 0 visible: keywordAddField.text.length > 0
onTriggered: { onTriggered: {
keywordAddField.text = "" keywordAddField.text = "";
} }
} }
onAccepted: { onAccepted: {
root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id) root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id);
keywordAddField.text = "" keywordAddField.text = "";
} }
} }
QQC2.Button { QQC2.Button {
@@ -123,8 +123,8 @@ FormCard.FormCardPage {
enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown && keywordAddField.text.length > 0 enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown && keywordAddField.text.length > 0
onClicked: { onClicked: {
root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id) root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id);
keywordAddField.text = "" keywordAddField.text = "";
} }
QQC2.ToolTip { QQC2.ToolTip {

View File

@@ -27,10 +27,10 @@ QQC2.Popup {
const format = { const format = {
start: "**", start: "**",
end: "**", end: "**",
extra: "", extra: ""
} };
formattingSelected(format, selectionStart, selectionEnd) formattingSelected(format, selectionStart, selectionEnd);
root.close() root.close();
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
@@ -46,10 +46,10 @@ QQC2.Popup {
const format = { const format = {
start: "*", start: "*",
end: "*", end: "*",
extra: "", extra: ""
} };
formattingSelected(format, selectionStart, selectionEnd) formattingSelected(format, selectionStart, selectionEnd);
root.close() root.close();
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
@@ -65,10 +65,10 @@ QQC2.Popup {
const format = { const format = {
start: "<del>", start: "<del>",
end: "</del>", end: "</del>",
extra: "", extra: ""
} };
formattingSelected(format, selectionStart, selectionEnd) formattingSelected(format, selectionStart, selectionEnd);
root.close() root.close();
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
@@ -84,10 +84,10 @@ QQC2.Popup {
const format = { const format = {
start: "`", start: "`",
end: "`", end: "`",
extra: "", extra: ""
} };
formattingSelected(format, selectionStart, selectionEnd) formattingSelected(format, selectionStart, selectionEnd);
root.close() root.close();
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
@@ -103,10 +103,10 @@ QQC2.Popup {
const format = { const format = {
start: selectionStart == 0 ? ">" : "\n>", start: selectionStart == 0 ? ">" : "\n>",
end: "\n\n", end: "\n\n",
extra: "", extra: ""
} };
formattingSelected(format, selectionStart, selectionEnd) formattingSelected(format, selectionStart, selectionEnd);
root.close() root.close();
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
@@ -122,10 +122,10 @@ QQC2.Popup {
const format = { const format = {
start: "[", start: "[",
end: "](", end: "](",
extra: ")", extra: ")"
} };
formattingSelected(format, selectionStart, selectionEnd) formattingSelected(format, selectionStart, selectionEnd);
root.close() root.close();
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text

View File

@@ -26,7 +26,6 @@ QQC2.Dialog {
anchors.centerIn: applicationWindow().overlay anchors.centerIn: applicationWindow().overlay
Shortcut { Shortcut {
sequence: "Ctrl+K" sequence: "Ctrl+K"
onActivated: root.open() onActivated: root.open()
@@ -34,28 +33,28 @@ QQC2.Dialog {
onVisibleChanged: { onVisibleChanged: {
if (!visible) { if (!visible) {
return return;
} }
searchField.forceActiveFocus() searchField.forceActiveFocus();
searchField.text = "" searchField.text = "";
roomList.currentIndex = 0 roomList.currentIndex = 0;
} }
header: Kirigami.SearchField { header: Kirigami.SearchField {
id: searchField id: searchField
Keys.onDownPressed: { Keys.onDownPressed: {
roomList.forceActiveFocus() roomList.forceActiveFocus();
if (roomList.currentIndex < roomList.count - 1) { if (roomList.currentIndex < roomList.count - 1) {
roomList.currentIndex++ roomList.currentIndex++;
} else { } else {
roomList.currentIndex = 0 roomList.currentIndex = 0;
} }
} }
Keys.onUpPressed: { Keys.onUpPressed: {
if (roomList.currentIndex === 0) { if (roomList.currentIndex === 0) {
roomList.currentIndex = roomList.count - 1 roomList.currentIndex = roomList.count - 1;
} else { } else {
roomList.currentIndex-- roomList.currentIndex--;
} }
} }
Keys.onEnterPressed: { Keys.onEnterPressed: {

View File

@@ -71,4 +71,3 @@ Flow {
} }
} }
} }

View File

@@ -19,7 +19,9 @@ TimelineDelegate {
property bool isTemporaryHighlighted: false property bool isTemporaryHighlighted: false
onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) temporaryHighlightTimer.start() onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) {
temporaryHighlightTimer.start();
}
Timer { Timer {
id: temporaryHighlightTimer id: temporaryHighlightTimer
@@ -36,9 +38,9 @@ TimelineDelegate {
id: readMarkerBackground id: readMarkerBackground
color: { color: {
if (root.isTemporaryHighlighted) { if (root.isTemporaryHighlighted) {
return Kirigami.Theme.positiveBackgroundColor return Kirigami.Theme.positiveBackgroundColor;
} else { } else {
return Kirigami.Theme.backgroundColor return Kirigami.Theme.backgroundColor;
} }
} }
Kirigami.Theme.inherit: false Kirigami.Theme.inherit: false
@@ -51,7 +53,11 @@ TimelineDelegate {
border.width: 1 border.width: 1
Behavior on color { Behavior on color {
ColorAnimation {target: readMarkerBackground; duration: Kirigami.Units.veryLongDuration; easing.type: Easing.InOutCubic} ColorAnimation {
target: readMarkerBackground
duration: Kirigami.Units.veryLongDuration
easing.type: Easing.InOutCubic
}
} }
} }
} }

View File

@@ -11,7 +11,9 @@ import org.kde.neochat
LoginStep { LoginStep {
id: root id: root
onActiveFocusChanged: if (activeFocus) passwordField.forceActiveFocus() onActiveFocusChanged: if (activeFocus) {
passwordField.forceActiveFocus();
}
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
id: passwordField id: passwordField
@@ -19,7 +21,7 @@ LoginStep {
echoMode: TextInput.Password echoMode: TextInput.Password
onTextChanged: Registration.password = text onTextChanged: Registration.password = text
Keys.onReturnPressed: { Keys.onReturnPressed: {
confirmPasswordField.forceActiveFocus() confirmPasswordField.forceActiveFocus();
} }
} }
@@ -31,15 +33,15 @@ LoginStep {
statusMessage: passwordField.text.length === confirmPasswordField.text.length && passwordField.text !== confirmPasswordField.text ? i18n("The passwords do not match.") : "" statusMessage: passwordField.text.length === confirmPasswordField.text.length && passwordField.text !== confirmPasswordField.text ? i18n("The passwords do not match.") : ""
Keys.onReturnPressed: { Keys.onReturnPressed: {
if (root.nextAction.enabled) { if (root.nextAction.enabled) {
root.nextAction.trigger() root.nextAction.trigger();
} }
} }
} }
nextAction: Kirigami.Action { nextAction: Kirigami.Action {
onTriggered: { onTriggered: {
passwordField.enabled = false passwordField.enabled = false;
Registration.registerAccount() Registration.registerAccount();
} }
enabled: passwordField.text === confirmPasswordField.text enabled: passwordField.text === confirmPasswordField.text
} }

View File

@@ -46,11 +46,11 @@ Kirigami.Page {
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
onClicked: { onClicked: {
if (root.userId.length > 0) { if (root.userId.length > 0) {
root.room.deleteMessagesByUser(root.userId, reason.text) root.room.deleteMessagesByUser(root.userId, reason.text);
} else { } else {
root.room.redactEvent(root.eventId, reason.text); root.room.redactEvent(root.eventId, reason.text);
} }
root.closeDialog() root.closeDialog();
} }
} }
QQC2.Button { QQC2.Button {

View File

@@ -73,7 +73,7 @@ RowLayout {
/** /**
* @brief The reply has been clicked. * @brief The reply has been clicked.
*/ */
signal replyClicked() signal replyClicked
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
@@ -118,20 +118,20 @@ RowLayout {
sourceComponent: { sourceComponent: {
switch (root.type) { switch (root.type) {
case DelegateType.Image: case DelegateType.Image:
case DelegateType.Sticker: case DelegateType.Sticker:
return imageComponent; return imageComponent;
case DelegateType.Message: case DelegateType.Message:
case DelegateType.Notice: case DelegateType.Notice:
return textComponent; return textComponent;
case DelegateType.File: case DelegateType.File:
case DelegateType.Video: case DelegateType.Video:
case DelegateType.Audio: case DelegateType.Audio:
return mimeComponent; return mimeComponent;
case DelegateType.Encrypted: case DelegateType.Encrypted:
return encryptedComponent; return encryptedComponent;
default: default:
return textComponent; return textComponent;
} }
} }
} }

View File

@@ -89,7 +89,7 @@ RowLayout {
text: i18nc("@action:button", "Cancel reply") text: i18nc("@action:button", "Cancel reply")
icon.name: "dialog-close" icon.name: "dialog-close"
onClicked: { onClicked: {
root.cancel() root.cancel();
} }
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered

View File

@@ -44,8 +44,8 @@ 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: {
root.room.reportEvent(eventId, reason.text) root.room.reportEvent(eventId, reason.text);
root.closeDialog() root.closeDialog();
} }
} }
QQC2.Button { QQC2.Button {

View File

@@ -106,8 +106,8 @@ a{
textFormat: Text.RichText textFormat: Text.RichText
onLinkActivated: link => { onLinkActivated: link => {
spoilerRevealed = true spoilerRevealed = true;
RoomManager.resolveResource(link, "join") RoomManager.resolveResource(link, "join");
} }
onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") { onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") {
applicationWindow().hoverLinkIndicator.text = hoveredLink; applicationWindow().hoverLinkIndicator.text = hoveredLink;

View File

@@ -94,7 +94,7 @@ ColumnLayout {
}, { }, {
title: i18n("Event Source"), title: i18n("Event Source"),
width: Kirigami.Units.gridUnit * 25 width: Kirigami.Units.gridUnit * 25
}); })
} }
} }
} }

View File

@@ -31,7 +31,7 @@ Delegates.RoundedItemDelegate {
readonly property bool hasNotifications: currentRoom.pushNotificationState === PushNotificationState.MentionKeyword || currentRoom.isLowPriority ? highlightCount > 0 : notificationCount > 0 readonly property bool hasNotifications: currentRoom.pushNotificationState === PushNotificationState.MentionKeyword || currentRoom.isLowPriority ? highlightCount > 0 : notificationCount > 0
signal selected() signal selected
Accessible.name: root.displayName Accessible.name: root.displayName
Accessible.onPressAction: select() Accessible.onPressAction: select()
@@ -48,7 +48,7 @@ Delegates.RoundedItemDelegate {
if (button === Qt.RightButton) { if (button === Qt.RightButton) {
root.createRoomListContextMenu(); root.createRoomListContextMenu();
} else { } else {
select() select();
} }
} }
} }
@@ -57,7 +57,7 @@ Delegates.RoundedItemDelegate {
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
Components.Avatar { Components.Avatar {
source: root.avatar ? "image://mxc/" + root.avatar : "" source: root.avatar ? "image://mxc/" + root.avatar : ""
name: root.displayName name: root.displayName
visible: Config.showAvatarInRoomDrawer visible: Config.showAvatarInRoomDrawer
implicitHeight: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) implicitHeight: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2)
@@ -149,11 +149,11 @@ Delegates.RoundedItemDelegate {
function select() { function select() {
RoomManager.resolveResource(currentRoom.id); RoomManager.resolveResource(currentRoom.id);
root.selected() root.selected();
} }
function createRoomListContextMenu() { function createRoomListContextMenu() {
const component = Qt.createComponent("qrc:/org/kde/neochat/qml/ContextMenu.qml") const component = Qt.createComponent("qrc:/org/kde/neochat/qml/ContextMenu.qml");
if (component.status === Component.Error) { if (component.status === Component.Error) {
console.error(component.errorString()); console.error(component.errorString());
} }
@@ -165,13 +165,12 @@ Delegates.RoundedItemDelegate {
configButton.visible = true; configButton.visible = true;
configButton.down = true; configButton.down = true;
} }
menu.closed.connect(function() { menu.closed.connect(function () {
configButton.down = undefined; configButton.down = undefined;
configButton.visible = Qt.binding(() => { configButton.visible = Qt.binding(() => {
return root.hovered && !Kirigami.Settings.isMobile return root.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList;
&& !Config.compactRoomList;
}); });
}) });
menu.open() menu.open();
} }
} }

View File

@@ -27,7 +27,7 @@ Kirigami.OverlayDrawer {
if (Config.roomDrawerWidth === -1) { if (Config.roomDrawerWidth === -1) {
return Kirigami.Units.gridUnit * 20; return Kirigami.Units.gridUnit * 20;
} else { } else {
return Config.roomDrawerWidth return Config.roomDrawerWidth;
} }
} }
@@ -53,9 +53,9 @@ Kirigami.OverlayDrawer {
return; return;
} }
if (Qt.application.layoutDirection === Qt.RightToLeft) { if (Qt.application.layoutDirection === Qt.RightToLeft) {
root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth - _lastX + mapToGlobal(mouseX, mouseY).x)) root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth - _lastX + mapToGlobal(mouseX, mouseY).x));
} else { } else {
root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth + _lastX - mapToGlobal(mouseX, mouseY).x)) root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth + _lastX - mapToGlobal(mouseX, mouseY).x));
} }
} }
} }
@@ -65,7 +65,8 @@ Kirigami.OverlayDrawer {
// If modal has been changed and the drawer is closed automatically then dim on popup open will have been switched off in main.qml so switch it back on after the animation completes. // If modal has been changed and the drawer is closed automatically then dim on popup open will have been switched off in main.qml so switch it back on after the animation completes.
// This is to avoid dim being active for a split second when the drawer is switched to modal which looks terrible. // This is to avoid dim being active for a split second when the drawer is switched to modal which looks terrible.
onAnimatingChanged: if (dim === false) dim = undefined onAnimatingChanged: if (dim === false)
dim = undefined
topPadding: 0 topPadding: 0
bottomPadding: 0 bottomPadding: 0
@@ -101,7 +102,12 @@ Kirigami.OverlayDrawer {
text: i18n("Room settings") text: i18n("Room settings")
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") }) onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {
room: room,
connection: root.connection
}, {
title: i18n("Room Settings")
})
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay

View File

@@ -44,7 +44,12 @@ Kirigami.Page {
displayHint: Kirigami.DisplayHint.IconOnly displayHint: Kirigami.DisplayHint.IconOnly
text: i18n("Settings") text: i18n("Settings")
icon.name: "settings-configure" icon.name: "settings-configure"
onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: root.room, connection: root.connection}, { title: i18n("Room Settings") }) onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {
room: root.room,
connection: root.connection
}, {
title: i18n("Room Settings")
})
} }
] ]
@@ -96,14 +101,14 @@ Kirigami.Page {
target: applicationWindow().pageStack target: applicationWindow().pageStack
onWideModeChanged: { onWideModeChanged: {
if (applicationWindow().pageStack.wideMode) { if (applicationWindow().pageStack.wideMode) {
console.log("widemode pop") console.log("widemode pop");
applicationWindow().pageStack.pop() applicationWindow().pageStack.pop();
} }
} }
} }
onBackRequested: event => { onBackRequested: event => {
event.accepted = true; event.accepted = true;
applicationWindow().pageStack.pop() applicationWindow().pageStack.pop();
} }
} }

View File

@@ -82,7 +82,12 @@ QQC2.ScrollView {
Layout.fillWidth: true Layout.fillWidth: true
onClicked: { onClicked: {
applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/DevtoolsPage.qml", {room: root.room, connection: root.connection}, {title: i18n("Developer Tools")}) applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/DevtoolsPage.qml", {
room: root.room,
connection: root.connection
}, {
title: i18n("Developer Tools")
});
} }
} }
@@ -99,7 +104,7 @@ QQC2.ScrollView {
room: root.room room: root.room
}, { }, {
title: i18nc("@action:title", "Search") title: i18nc("@action:title", "Search")
}) });
} }
} }
@@ -142,7 +147,11 @@ QQC2.ScrollView {
icon.name: "list-add-user" icon.name: "list-add-user"
onClicked: { onClicked: {
applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", {room: root.room}, {title: i18nc("@title", "Invite a User")}) applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", {
room: root.room
}, {
title: i18nc("@title", "Invite a User")
});
} }
QQC2.ToolTip.text: i18n("Invite user to room") QQC2.ToolTip.text: i18n("Invite user to room")
@@ -160,7 +169,9 @@ QQC2.ScrollView {
id: userListSearchField id: userListSearchField
visible: !root.room.isDirectChat() visible: !root.room.isDirectChat()
onVisibleChanged: if (visible) forceActiveFocus() onVisibleChanged: if (visible) {
forceActiveFocus();
}
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: Kirigami.Units.largeSpacing Layout.leftMargin: Kirigami.Units.largeSpacing
Layout.rightMargin: Kirigami.Units.largeSpacing Layout.rightMargin: Kirigami.Units.largeSpacing
@@ -168,7 +179,7 @@ QQC2.ScrollView {
focusSequence: "Ctrl+Shift+F" focusSequence: "Ctrl+Shift+F"
onAccepted: sortedMessageEventModel.filterString = text; onAccepted: sortedMessageEventModel.filterString = text
} }
} }
@@ -205,7 +216,7 @@ QQC2.ScrollView {
onClicked: { onClicked: {
userDelegate.highlighted = true; userDelegate.highlighted = true;
RoomManager.resolveResource(userDelegate.userId, "mention") RoomManager.resolveResource(userDelegate.userId, "mention");
} }
contentItem: RowLayout { contentItem: RowLayout {
@@ -258,6 +269,6 @@ QQC2.ScrollView {
if (root.headerItem) { if (root.headerItem) {
root.headerItem.userListSearchField.text = ""; root.headerItem.userListSearchField.text = "";
} }
userList.currentIndex = -1 userList.currentIndex = -1;
} }
} }

View File

@@ -47,7 +47,7 @@ Kirigami.Page {
Connections { Connections {
target: RoomManager target: RoomManager
function onCurrentRoomChanged() { function onCurrentRoomChanged() {
itemSelection.setCurrentIndex(roomListModel.index(roomListModel.rowForRoom(RoomManager.currentRoom), 0), ItemSelectionModel.SelectCurrent) itemSelection.setCurrentIndex(roomListModel.index(roomListModel.rowForRoom(RoomManager.currentRoom), 0), ItemSelectionModel.SelectCurrent);
} }
} }
@@ -74,24 +74,24 @@ Kirigami.Page {
} }
function goToNextRoom() { function goToNextRoom() {
goToNextRoomFiltered((item) => item.visible); goToNextRoomFiltered(item => item.visible);
} }
function goToPreviousRoom() { function goToPreviousRoom() {
goToPreviousRoomFiltered((item) => item.visible); goToPreviousRoomFiltered(item => item.visible);
} }
function goToNextUnreadRoom() { function goToNextUnreadRoom() {
goToNextRoomFiltered((item) => (item.visible && item.hasUnread)); goToNextRoomFiltered(item => (item.visible && item.hasUnread));
} }
function goToPreviousUnreadRoom() { function goToPreviousUnreadRoom() {
goToPreviousRoomFiltered((item) => (item.visible && item.hasUnread)); goToPreviousRoomFiltered(item => (item.visible && item.hasUnread));
} }
titleDelegate: Loader { titleDelegate: Loader {
Layout.fillWidth: true Layout.fillWidth: true
sourceComponent: Kirigami.Settings.isMobile ? userInfo : exploreComponent sourceComponent: Kirigami.Settings.isMobile ? userInfo : exploreComponent
} }
padding: 0 padding: 0
@@ -107,7 +107,7 @@ Kirigami.Page {
connection: root.connection connection: root.connection
onSelectionChanged: root.spaceChanging = true; onSelectionChanged: root.spaceChanging = true
onSpacesUpdated: sortFilterRoomListModel.invalidate() onSpacesUpdated: sortFilterRoomListModel.invalidate()
} }
@@ -145,7 +145,7 @@ Kirigami.Page {
rightPadding: Kirigami.Units.largeSpacing rightPadding: Kirigami.Units.largeSpacing
bottomPadding: Kirigami.Units.largeSpacing bottomPadding: Kirigami.Units.largeSpacing
onClicked: quickView.item.open(); onClicked: quickView.item.open()
Kirigami.Icon { Kirigami.Icon {
anchors.centerIn: parent anchors.centerIn: parent
@@ -181,10 +181,10 @@ Kirigami.Page {
keyword: sortFilterRoomListModel.filterText keyword: sortFilterRoomListModel.filterText
}, { }, {
title: i18nc("@title", "Explore Rooms") title: i18nc("@title", "Explore Rooms")
}) });
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join") RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join");
}) });
} }
} }
@@ -192,7 +192,11 @@ Kirigami.Page {
id: userSearchAction id: userSearchAction
icon.name: sortFilterRoomListModel.filterText.length > 0 ? "search" : "list-add" icon.name: sortFilterRoomListModel.filterText.length > 0 ? "search" : "list-add"
text: sortFilterRoomListModel.filterText.length > 0 ? i18n("Search in friend directory") : i18n("Find your friends") text: sortFilterRoomListModel.filterText.length > 0 ? i18n("Search in friend directory") : i18n("Find your friends")
onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Find your friends")
})
} }
} }
@@ -208,8 +212,8 @@ Kirigami.Page {
sourceModel: root.roomListModel sourceModel: root.roomListModel
roomSortOrder: SortFilterRoomListModel.Categories roomSortOrder: SortFilterRoomListModel.Categories
onLayoutChanged: { onLayoutChanged: {
layoutTimer.restart() layoutTimer.restart();
listView.currentIndex = sortFilterRoomListModel.mapFromSource(itemSelection.currentIndex).row listView.currentIndex = sortFilterRoomListModel.mapFromSource(itemSelection.currentIndex).row;
} }
activeSpaceId: spaceDrawer.selectedSpaceId activeSpaceId: spaceDrawer.selectedSpaceId
mode: spaceDrawer.showDirectChats ? SortFilterRoomListModel.DirectChats : SortFilterRoomListModel.Rooms mode: spaceDrawer.showDirectChats ? SortFilterRoomListModel.DirectChats : SortFilterRoomListModel.Rooms
@@ -317,7 +321,11 @@ Kirigami.Page {
icon.width: Kirigami.Units.gridUnit * 2 icon.width: Kirigami.Units.gridUnit * 2
icon.height: Kirigami.Units.gridUnit * 2 icon.height: Kirigami.Units.gridUnit * 2
onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {
connection: root.connection
}, {
title: i18nc("@title", "Find your friends")
})
} }
} }
} }
@@ -402,8 +410,8 @@ Kirigami.Page {
ExploreComponentMobile { ExploreComponentMobile {
connection: root.connection connection: root.connection
onTextChanged: (newText) => { onTextChanged: newText => {
sortFilterRoomListModel.filterText = newText sortFilterRoomListModel.filterText = newText;
} }
} }
} }

View File

@@ -125,7 +125,7 @@ Kirigami.Page {
actionsHandler: root.actionsHandler actionsHandler: root.actionsHandler
onFocusChatBar: { onFocusChatBar: {
if (chatBarLoader.item) { if (chatBarLoader.item) {
chatBarLoader.item.forceActiveFocus() chatBarLoader.item.forceActiveFocus();
} }
} }
} }
@@ -175,9 +175,9 @@ Kirigami.Page {
Connections { Connections {
target: RoomManager target: RoomManager
function onCurrentRoomChanged() { function onCurrentRoomChanged() {
if(!RoomManager.currentRoom) { if (!RoomManager.currentRoom) {
if(pageStack.lastItem === root) { if (pageStack.lastItem === root) {
pageStack.pop() pageStack.pop();
} }
} else if (root.currentRoom.isInvite) { } else if (root.currentRoom.isInvite) {
root.currentRoom.clearInvitationNotification(); root.currentRoom.clearInvitationNotification();
@@ -205,7 +205,7 @@ Kirigami.Page {
Connections { Connections {
target: root.connection target: root.connection
function onJoinedRoom(room, invited) { function onJoinedRoom(room, invited) {
if(root.currentRoom.id === invited.id) { if (root.currentRoom.id === invited.id) {
RoomManager.resolveResource(room.id); RoomManager.resolveResource(room.id);
} }
} }
@@ -219,10 +219,10 @@ Kirigami.Page {
return; return;
} else if (event.key === Qt.Key_PageUp) { } else if (event.key === Qt.Key_PageUp) {
event.accepted = true; event.accepted = true;
timelineViewLoader.item.pageUp() timelineViewLoader.item.pageUp();
} else if (event.key === Qt.Key_PageDown) { } else if (event.key === Qt.Key_PageDown) {
event.accepted = true; event.accepted = true;
timelineViewLoader.item.pageDown() timelineViewLoader.item.pageDown();
} }
} }
@@ -237,14 +237,14 @@ Kirigami.Page {
function warning(title, message) { function warning(title, message) {
banner.text = `${title}<br />${message}`; banner.text = `${title}<br />${message}`;
banner.type = Kirigami.MessageType.Warning; banner.type = Kirigami.MessageType.Warning;
banner.visible = true; banner.visible = true;
} }
Connections { Connections {
target: RoomManager target: RoomManager
function onShowUserDetail(user) { function onShowUserDetail(user) {
root.showUserDetail(user) root.showUserDetail(user);
} }
function onShowEventSource(eventId) { function onShowEventSource(eventId) {
@@ -283,19 +283,19 @@ Kirigami.Page {
function onShowMaximizedMedia(index) { function onShowMaximizedMedia(index) {
var popup = maximizeComponent.createObject(QQC2.Overlay.overlay, { var popup = maximizeComponent.createObject(QQC2.Overlay.overlay, {
initialIndex: index initialIndex: index
}) });
popup.closed.connect(() => { popup.closed.connect(() => {
timelineViewLoader.item.interactive = true timelineViewLoader.item.interactive = true;
popup.destroy() popup.destroy();
}) });
popup.open() popup.open();
} }
} }
function showUserDetail(user) { function showUserDetail(user) {
userDetailDialog.createObject(QQC2.ApplicationWindow.overlay, { userDetailDialog.createObject(QQC2.ApplicationWindow.overlay, {
room: root.currentRoom, room: root.currentRoom,
user: root.currentRoom.getUser(user.id), user: root.currentRoom.getUser(user.id)
}).open(); }).open();
} }

View File

@@ -30,7 +30,9 @@ FormCard.FormCardPage {
enabled: room.canEncryptRoom enabled: room.canEncryptRoom
checked: room.usesEncryption checked: room.usesEncryption
onToggled: if (checked) { onToggled: if (checked) {
let dialog = confirmEncryptionDialog.createObject(applicationWindow().overlay, {room: room}); let dialog = confirmEncryptionDialog.createObject(applicationWindow().overlay, {
room: room
});
dialog.open(); dialog.open();
} }
} }
@@ -51,8 +53,7 @@ FormCard.FormCardPage {
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18nc("@option:check", "Space members") text: i18nc("@option:check", "Space members")
description: i18n("Anyone in the selected spaces can find and join.") + description: i18n("Anyone in the selected spaces can find and join.") + (!["8", "9", "10"].includes(room.version) ? `\n${needUpgradeRoom}` : "")
(!["8", "9", "10"].includes(room.version) ? `\n${needUpgradeRoom}` : "")
checked: room.joinRule === "restricted" checked: room.joinRule === "restricted"
enabled: room.canSendState("m.room.join_rules") && ["8", "9", "10"].includes(room.version) enabled: room.canSendState("m.room.join_rules") && ["8", "9", "10"].includes(room.version)
onCheckedChanged: if (checked && room.joinRule != "restricted") { onCheckedChanged: if (checked && room.joinRule != "restricted") {
@@ -64,7 +65,7 @@ FormCard.FormCardPage {
text: i18n("Select spaces") text: i18n("Select spaces")
icon.name: "list-add" icon.name: "list-add"
onClicked: selectSpacesDialog.createObject(applicationWindow().overlay).open(); onClicked: selectSpacesDialog.createObject(applicationWindow().overlay).open()
QQC2.ToolTip.text: text QQC2.ToolTip.text: text
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
@@ -80,8 +81,7 @@ FormCard.FormCardPage {
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
text: i18nc("@option:check", "Knock") text: i18nc("@option:check", "Knock")
description: i18n("People not in the room need to request an invite to join the room.") + description: i18n("People not in the room need to request an invite to join the room.") + (!["7", "8", "9", "10"].includes(room.version) ? `\n${needUpgradeRoom}` : "")
(!["7", "8", "9", "10"].includes(room.version) ? `\n${needUpgradeRoom}` : "")
checked: room.joinRule === "knock" checked: room.joinRule === "knock"
// https://spec.matrix.org/v1.4/rooms/#feature-matrix // https://spec.matrix.org/v1.4/rooms/#feature-matrix
enabled: room.canSendState("m.room.join_rules") && ["7", "8", "9", "10"].includes(room.version) enabled: room.canSendState("m.room.join_rules") && ["7", "8", "9", "10"].includes(room.version)
@@ -110,7 +110,7 @@ FormCard.FormCardPage {
checked: room.historyVisibility === "world_readable" checked: room.historyVisibility === "world_readable"
enabled: room.canSendState("m.room.history_visibility") enabled: room.canSendState("m.room.history_visibility")
onCheckedChanged: if (checked) { onCheckedChanged: if (checked) {
room.historyVisibility = "world_readable" room.historyVisibility = "world_readable";
} }
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
@@ -119,7 +119,7 @@ FormCard.FormCardPage {
checked: room.historyVisibility === "shared" checked: room.historyVisibility === "shared"
enabled: room.canSendState("m.room.history_visibility") enabled: room.canSendState("m.room.history_visibility")
onCheckedChanged: if (checked) { onCheckedChanged: if (checked) {
room.historyVisibility = "shared" room.historyVisibility = "shared";
} }
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
@@ -128,7 +128,7 @@ FormCard.FormCardPage {
checked: room.historyVisibility === "invited" checked: room.historyVisibility === "invited"
enabled: room.canSendState("m.room.history_visibility") enabled: room.canSendState("m.room.history_visibility")
onCheckedChanged: if (checked) { onCheckedChanged: if (checked) {
room.historyVisibility = "invited" room.historyVisibility = "invited";
} }
} }
FormCard.FormRadioDelegate { FormCard.FormRadioDelegate {
@@ -137,7 +137,7 @@ FormCard.FormCardPage {
checked: room.historyVisibility === "joined" checked: room.historyVisibility === "joined"
enabled: room.canSendState("m.room.history_visibility") enabled: room.canSendState("m.room.history_visibility")
onCheckedChanged: if (checked) { onCheckedChanged: if (checked) {
room.historyVisibility = "joined" room.historyVisibility = "joined";
} }
} }
} }
@@ -150,7 +150,7 @@ FormCard.FormCardPage {
// At the point this is executed, the state in the room is not yet changed. // At the point this is executed, the state in the room is not yet changed.
// The value will be updated when room.onEncryption() emitted. // The value will be updated when room.onEncryption() emitted.
// This is in case if user simply closed the dialog. // This is in case if user simply closed the dialog.
enableEncryptionSwitch.checked = false enableEncryptionSwitch.checked = false;
} }
} }
} }
@@ -158,8 +158,7 @@ FormCard.FormCardPage {
property Connections connections: Connections { property Connections connections: Connections {
target: room target: room
onEncryption: { onEncryption: {
enableEncryptionSwitch.checked = room.usesEncryption enableEncryptionSwitch.checked = room.usesEncryption;
} }
} }
} }

View File

@@ -41,7 +41,7 @@ Kirigami.ApplicationWindow {
} }
onCurrentRoomChanged: if (!currentRoom) { onCurrentRoomChanged: if (!currentRoom) {
root.close() root.close();
} }
property Item hoverLinkIndicator: QQC2.Control { property Item hoverLinkIndicator: QQC2.Control {
@@ -58,7 +58,7 @@ Kirigami.ApplicationWindow {
} }
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
background: Rectangle { background: Rectangle {
color: Kirigami.Theme.backgroundColor color: Kirigami.Theme.backgroundColor
} }
} }
} }

View File

@@ -110,7 +110,7 @@ Kirigami.ScrollablePage {
Keys.onEnterPressed: searchButton.clicked() Keys.onEnterPressed: searchButton.clicked()
Keys.onReturnPressed: searchButton.clicked() Keys.onReturnPressed: searchButton.clicked()
onTextChanged: { onTextChanged: {
searchTimer.restart() searchTimer.restart();
if (model) { if (model) {
model.searchText = text; model.searchText = text;
} }
@@ -121,7 +121,7 @@ Kirigami.ScrollablePage {
icon.name: "search" icon.name: "search"
onClicked: { onClicked: {
if (typeof model.search === 'function') { if (typeof model.search === 'function') {
model.search() model.search();
} }
} }
} }
@@ -130,7 +130,7 @@ Kirigami.ScrollablePage {
interval: 500 interval: 500
running: true running: true
onTriggered: if (typeof model.search === 'function') { onTriggered: if (typeof model.search === 'function') {
model.search() model.search();
} }
} }
} }
@@ -162,4 +162,3 @@ Kirigami.ScrollablePage {
} }
} }
} }

View File

@@ -37,7 +37,7 @@ Kirigami.Dialog {
text: i18n("OK") text: i18n("OK")
icon.name: "dialog-ok" icon.name: "dialog-ok"
onTriggered: { onTriggered: {
root.room.addParent(chosenRoomDelegate.roomId, makeCanonicalCheck.checked, existingOfficialCheck.checked) root.room.addParent(chosenRoomDelegate.roomId, makeCanonicalCheck.checked, existingOfficialCheck.checked);
root.close(); root.close();
} }
} }
@@ -49,7 +49,12 @@ Kirigami.Dialog {
visible: !chosenRoomDelegate.visible visible: !chosenRoomDelegate.visible
text: i18nc("@action:button", "Pick room") text: i18nc("@action:button", "Pick room")
onClicked: { onClicked: {
let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.room.connection, showOnlySpaces: true}, {title: i18nc("@title", "Choose Parent Space")}) let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {
connection: root.room.connection,
showOnlySpaces: true
}, {
title: i18nc("@title", "Choose Parent Space")
});
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
chosenRoomDelegate.roomId = roomId; chosenRoomDelegate.roomId = roomId;
chosenRoomDelegate.displayName = displayName; chosenRoomDelegate.displayName = displayName;
@@ -59,7 +64,7 @@ Kirigami.Dialog {
chosenRoomDelegate.memberCount = memberCount; chosenRoomDelegate.memberCount = memberCount;
chosenRoomDelegate.isJoined = isJoined; chosenRoomDelegate.isJoined = isJoined;
chosenRoomDelegate.visible = true; chosenRoomDelegate.visible = true;
}) });
} }
} }
FormCard.AbstractFormDelegate { FormCard.AbstractFormDelegate {
@@ -104,7 +109,7 @@ Kirigami.Dialog {
QQC2.Label { QQC2.Label {
Layout.fillWidth: true Layout.fillWidth: true
visible: text visible: text
text: chosenRoomDelegate.topic ? chosenRoomDelegate.topic.replace(/(\r\n\t|\n|\r\t)/gm," ") : "" text: chosenRoomDelegate.topic ? chosenRoomDelegate.topic.replace(/(\r\n\t|\n|\r\t)/gm, " ") : ""
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
@@ -128,7 +133,12 @@ Kirigami.Dialog {
} }
onClicked: { onClicked: {
let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.room.connection, showOnlySpaces: true}, {title: i18nc("@title", "Explore Rooms")}) let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {
connection: root.room.connection,
showOnlySpaces: true
}, {
title: i18nc("@title", "Explore Rooms")
});
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
chosenRoomDelegate.roomId = roomId; chosenRoomDelegate.roomId = roomId;
chosenRoomDelegate.displayName = displayName; chosenRoomDelegate.displayName = displayName;
@@ -138,7 +148,7 @@ Kirigami.Dialog {
chosenRoomDelegate.memberCount = memberCount; chosenRoomDelegate.memberCount = memberCount;
chosenRoomDelegate.isJoined = isJoined; chosenRoomDelegate.isJoined = isJoined;
chosenRoomDelegate.visible = true; chosenRoomDelegate.visible = true;
}) });
} }
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {

Some files were not shown because too many files have changed in this diff Show More