Skip to content

Commit

Permalink
enable reversed locale layout in QML
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien committed Nov 29, 2024
1 parent 907b07c commit 4c96657
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/gui/ResolveConflictsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ApplicationWindow {
flags: Qt.Window | Qt.Dialog
visible: true

LayoutMirroring.enabled: Application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true

width: Style.minimumWidthResolveConflictsDialog
height: Style.minimumHeightResolveConflictsDialog
minimumWidth: Style.minimumWidthResolveConflictsDialog
Expand Down
5 changes: 4 additions & 1 deletion src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ namespace {
" --isvfsenabled : whether to set a VFS or non-VFS folder (1 for 'yes' or 0 for 'no') when creating an account via command-line.\n"
" --remotedirpath : (optional) path to a remote subfolder when creating an account via command-line.\n"
" --serverurl : a server URL to use when creating an account via command-line.\n"
" --forcelegacyconfigimport : forcefully import account configurations from legacy clients (if available).\n";
" --forcelegacyconfigimport : forcefully import account configurations from legacy clients (if available).\n"
" --reverse : use a reverse layout direction.\n";

QString applicationTrPath()
{
Expand Down Expand Up @@ -814,6 +815,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); });
Expand Down
3 changes: 3 additions & 0 deletions src/gui/filedetails/FileDetailsWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ ApplicationWindow {
property var accountState
property string localPath: ""

LayoutMirroring.enabled: Application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true

width: 400
height: 500
minimumWidth: 300
Expand Down
3 changes: 3 additions & 0 deletions src/gui/macOS/ui/FileProviderEvictionDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ApplicationWindow {
property var materialisedItemsModel: null
property string accountUserIdAtHost: ""

LayoutMirroring.enabled: Application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true

title: qsTr("Evict materialised files")
color: palette.base
flags: Qt.Dialog | Qt.WindowStaysOnTopHint
Expand Down
3 changes: 3 additions & 0 deletions src/gui/tray/CallNotificationDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ ApplicationWindow {
Systray.destroyDialog(root);
}

LayoutMirroring.enabled: Application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true

width: root.windowWidth
height: rootBackground.height

Expand Down
3 changes: 3 additions & 0 deletions src/gui/tray/EditFileLocallyLoadingDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ ApplicationWindow {

color: palette.base

LayoutMirroring.enabled: Application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true

width: 320
height: contentLayout.implicitHeight

Expand Down
3 changes: 3 additions & 0 deletions src/gui/tray/MainWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import com.nextcloud.desktopclient
ApplicationWindow {
id: trayWindow

LayoutMirroring.enabled: Application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true

title: Systray.windowTitle
// If the main dialog is displayed as a regular window we want it to be quadratic
width: Systray.useNormalWindow ? Style.trayWindowHeight : Style.trayWindowWidth
Expand Down

0 comments on commit 4c96657

Please sign in to comment.