nextcloud / nextcloud/desktop

More cleverly handle `xdg-user-dirs`-style folders using `QStandardPaths`

Open
#3,957 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
1d 17h
Merged PRs (30d)
123

Description

## How to use GitHub

* Please use the 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you want to have the same feature implemented.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
* Subscribe to receive notifications on status change and new comments.

## Problem

Currently, while Nextcloud Desktop does support multiple folder connections, it seems to be set up around the assumption that a user will just sync the folder located at `~/Nextcloud`.

If a user manually creates folder connections for each of the `xdg-user-dirs`-style folders (e.g. `~/Desktop`, `~/Documents`, and so on) while also syncing all other items within `~/Nextcloud` (i.e. the WebDAV root), Nextcloud Desktop will repeatedly warn that the XDG-style folder are subfolders of an existing folder connection.

Additionally, the user will have to manually deselect each of the `xdg-user-dirs`-style folders from the `~/Nextcloud` folder connection in order to prevent duplicate connections (what the above warnings are concerned about). Because this is a manual process, it is somewhat prone to user error, so duplicate folder connections may very well occur.

## Proposed Solution

Qt provides [a class called `QStandardPaths`](https://doc.qt.io/qt-5/qstandardpaths.html) for automatically determining standard paths including the `xdg-user-dirs`-style folders stated above on all the platforms Qt supports (i.e. not just XDG-compliant ones). Nextcloud Desktop could offer to create folder connections with each of the `xdg-user-dirs`-style folders using a simple checkbox and then automatically exclude those folders from the default `~/Nextcloud` folder connections.

To elaborate: the onboarding wizard could offer a list of `xdg-user-dirs`-style folders with checkboxes *before* the manual folder-connection step, and any folder connections created in this step would have their remotes hidden from the manual (i.e. usually the default `~/Nextcloud` connection) step that follows (with a checkbox to optionally show and allow duplicate connections). This process would be similarly available with the mini-wizard for "Add folder connection", and if the user were to add an `xdg-user-dirs`-style folder connection after the fact using the mini-wizard, the wizard would offer to switch the new connection from any existing parent connections in order to avoid duplicates.

This process would require a small number of new user-interface designs.

## Related Issues

Similar changes in Nextcloud Server could facilitate the above process. That is, Nextcloud Server could itself implement `xdg-user-dirs`-style folders such that the remote would more closely resemble the local user folder, with the `~/Nextcloud` folder actually being a subfolder of the remote `~`.

Implementing this in full compliance with [the `xdg-user-dirs` standard](https://freedesktop.org/wiki/Software/xdg-user-dirs/) (possibly even porting [the underlying library](https://gitlab.freedesktop.org/xdg/xdg-user-dirs) from C to PHP) could also facilitate consistent localization (a key feature of `xdg-user-dirs`) while avoiding conflicts.

Additionally, following XDG standards both locally (using `QStandardPaths`) and remotely (by porting `xdg-user-dirs`, among others) could facilitate adding more clever cloud synchronization for individual applications' data folders, i.e. using application icons, etc. in the main interface, but this is kind of a separate issue.

## Conclusion

This isn't just an offhanded suggestion; it's a persistent source of frustration for me, and I have, indeed, misconfigured folder connections in the myriad times I have set up Nextcloud Desktop. (In particular, fact that Linux uses `~/Videos` while macOS uses `~/Movies` has caused me to have separate folders with each name in my Nextcloud remote.)

I could create a related issue over at Nextcloud Server, but I have yet to do so.

Also, I just woke up, so while I have proofread this (and I've been thinking about the issue for the better part of a year), I can come back and add more illustrations (i.e. screenshots) and commentary.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.