Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@nextcloud.com>2020-06-30 18:47:10 +0300
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>2020-07-01 19:58:29 +0300
commitcb9ba9702b2fa3ebaabbfc2845554ec0308e25c8 (patch)
treedaa16a1fa90c87af4e3b5d176496d08e3c4eb32b /src/gui/folderstatusmodel.cpp
parentd2e8cd4469162b203de6d9aaad2618014813dcbf (diff)
Properly display encryption status for non root folder connection
Since the e2e oracle works only in term of absolute remote paths and that our model x._path was relative, we need to properly convert. Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Diffstat (limited to 'src/gui/folderstatusmodel.cpp')
-rw-r--r--src/gui/folderstatusmodel.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 88cf04db9..e92c63cd4 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -153,13 +153,17 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
return QString(QLatin1String("<qt>") + Utility::escape(x._size < 0 ? x._name : tr("%1 (%2)").arg(x._name, Utility::octetsToString(x._size))) + QLatin1String("</qt>"));
case Qt::CheckStateRole:
return x._checked;
- case Qt::DecorationRole:
- if (_accountState->account()->e2e()->isFolderEncrypted(x._path)) {
+ case Qt::DecorationRole: {
+ Q_ASSERT(x._folder->remotePath().startsWith('/'));
+ const auto rootPath = x._folder->remotePath().mid(1);
+ const auto absoluteRemotePath = rootPath.isEmpty() ? x._path : rootPath + '/' + x._path;
+ if (_accountState->account()->e2e()->isFolderEncrypted(absoluteRemotePath)) {
return QIcon(QLatin1String(":/client/theme/lock-https.svg"));
- } else if (x._size > 0 && _accountState->account()->e2e()->isAnyParentFolderEncrypted(x._path)) {
+ } else if (x._size > 0 && _accountState->account()->e2e()->isAnyParentFolderEncrypted(absoluteRemotePath)) {
return QIcon(QLatin1String(":/client/theme/lock-broken.svg"));
}
return QFileIconProvider().icon(x._isExternal ? QFileIconProvider::Network : QFileIconProvider::Folder);
+ }
case Qt::ForegroundRole:
if (x._isUndecided) {
return QColor(Qt::red);