From d7cc9f815d73f05349efe950dd07df3f8ce7e114 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 2 Feb 2022 17:31:36 +0100 Subject: [PATCH] fix review comments add --reverse option on command line add support in one more qml window Signed-off-by: Matthieu Gallien --- src/gui/UserStatusSelectorDialog.qml | 2 +- src/gui/application.cpp | 5 ++++- src/gui/tray/FileActivityDialog.qml | 3 +++ src/gui/tray/Window.qml | 6 +++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gui/UserStatusSelectorDialog.qml b/src/gui/UserStatusSelectorDialog.qml index 14ab3b8533df6..bd11be2476b6b 100644 --- a/src/gui/UserStatusSelectorDialog.qml +++ b/src/gui/UserStatusSelectorDialog.qml @@ -22,7 +22,7 @@ Window { flags: Qt.Dialog - LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLef + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.childrenInherit: true UserStatusSelector { diff --git a/src/gui/application.cpp b/src/gui/application.cpp index b1a3561eacda6..a08e9ed4c64ca 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -83,7 +83,8 @@ namespace { " --logflush : flush the log file after every write.\n" " --logdebug : also output debug-level messages in the log.\n" " --confdir : Use the given configuration folder.\n" - " --background : launch the application in the background.\n"; + " --background : launch the application in the background.\n" + " --reverse : use a reverse layout direction.\n"; QString applicationTrPath() { @@ -640,6 +641,8 @@ void Application::parseOptions(const QStringList &options) _backgroundMode = true; } else if (option == QLatin1String("--version") || option == QLatin1String("-v")) { _versionOnly = true; + } else if (option == QLatin1String("--reverse")) { + setLayoutDirection(layoutDirection() == Qt::LeftToRight ? Qt::RightToLeft : Qt::LeftToRight); } else if (option.endsWith(QStringLiteral(APPLICATION_DOTVIRTUALFILE_SUFFIX))) { // virtual file, open it after the Folder were created (if the app is not terminated) QTimer::singleShot(0, this, [this, option] { openVirtualFile(option); }); diff --git a/src/gui/tray/FileActivityDialog.qml b/src/gui/tray/FileActivityDialog.qml index 58264ef28c615..2bd49e7abefbc 100644 --- a/src/gui/tray/FileActivityDialog.qml +++ b/src/gui/tray/FileActivityDialog.qml @@ -10,6 +10,9 @@ Window { property alias model: activityModel + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + LayoutMirroring.childrenInherit: true + NC.FileActivityListModel { id: activityModel } diff --git a/src/gui/tray/Window.qml b/src/gui/tray/Window.qml index 5efaacd4155ef..949ee472ca9c2 100644 --- a/src/gui/tray/Window.qml +++ b/src/gui/tray/Window.qml @@ -25,9 +25,6 @@ Window { property int fileActivityDialogObjectId: -1 - LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLef - LayoutMirroring.childrenInherit: true - readonly property int maxMenuHeight: Style.trayWindowHeight - Style.trayWindowHeaderHeight - 2 * Style.trayWindowBorderWidth function openFileActivityDialog(objectName, objectId) { @@ -36,6 +33,9 @@ Window { fileActivityDialogLoader.refresh(); } + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + LayoutMirroring.childrenInherit: true + Component.onCompleted: Systray.forceWindowInit(trayWindow) // Close tray window when focus is lost (e.g. click somewhere else on the screen)