Skip to content

Commit

Permalink
only empty top folders offer the menu entry to encrypt
Browse files Browse the repository at this point in the history
in the contextual menu shown in files explorer will show encrypt menu

entry only for top folders that are non-encrypted and empty

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>

[skip ci]
  • Loading branch information
mgallien authored and backportbot[bot] committed Aug 22, 2024
1 parent 326ab74 commit db7deb1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/socketapi/socketapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,15 @@ QString SocketApi::FileData::folderRelativePathNoVfsSuffix() const
return result;
}

bool SocketApi::FileData::isFolderEmpty() const
{
if (FileSystem::isDir(localPath)) {
const auto nativeFolder = QDir{localPath};
return nativeFolder.isEmpty();
}
return false;
}

SyncFileStatus SocketApi::FileData::syncFileStatus() const
{
if (!folder)
Expand Down
2 changes: 2 additions & 0 deletions src/gui/socketapi/socketapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ private slots:
// Relative path of the file locally, without any vfs suffix
[[nodiscard]] QString folderRelativePathNoVfsSuffix() const;

[[nodiscard]] bool isFolderEmpty() const;

Folder *folder = nullptr;
// Absolute path of the file locally. (May be a virtual file)
QString localPath;
Expand Down

0 comments on commit db7deb1

Please sign in to comment.