Show broken encryption icon only in non-empty folders
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 2 Jun 2020 14:03:50 +0000 (16:03 +0200)
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>
Tue, 2 Jun 2020 15:50:18 +0000 (15:50 +0000)
This should address Tobias' concerns regarding the icon being
misleading. Now we basically do the following inside an encrypted folder
parent:
 * encrypted folders get the encrypted icon;
 * non-encrypted empty folders get the regular folder icon;
 * non-encrypted non-empty folders get the broken encryption icon.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/folderstatusmodel.cpp

index 52370bfa562dc45e37af26487450d62da092dac2..8d0c2e8816b8a75167ecdc4ce1549416a9145ba4 100644 (file)
@@ -158,7 +158,7 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
         case Qt::DecorationRole:
             if (_accountState->account()->e2e()->isFolderEncrypted(x._path)) {
                 return QIcon(QLatin1String(":/client/theme/lock-https.svg"));
-            } else if (_accountState->account()->e2e()->isAnyParentFolderEncrypted(x._path)) {
+            } else if (x._size > 0 && _accountState->account()->e2e()->isAnyParentFolderEncrypted(x._path)) {
                 return QIcon(QLatin1String(":/client/theme/lock-broken.svg"));
             }
             return QFileIconProvider().icon(x._isExternal ? QFileIconProvider::Network : QFileIconProvider::Folder);