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)) {
+ return QIcon(QLatin1String(":/client/theme/lock-broken.svg"));
}
return QFileIconProvider().icon(x._isExternal ? QFileIconProvider::Network : QFileIconProvider::Folder);
case Qt::ForegroundRole:
return (*it);
}
+bool ClientSideEncryption::isAnyParentFolderEncrypted(const QString &path) const
+{
+ int slashPosition = 0;
+
+ while ((slashPosition = path.indexOf("/", slashPosition + 1)) != -1) {
+ // Ignore the last slash
+ if (slashPosition == path.length() - 1) break;
+
+ if (isFolderEncrypted(path.left(slashPosition + 1))) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &iv, QFile *input, QFile *output, QByteArray& returnTag)
{
if (!input->open(QIODevice::ReadOnly)) {
// to be used together with FolderStatusModel::FolderInfo::_path.
bool isFolderEncrypted(const QString& path) const;
+ bool isAnyParentFolderEncrypted(const QString &path) const;
void setFolderEncryptedStatus(const QString& path, bool status);
void forgetSensitiveData();
<file>theme/change.svg</file>
<file>theme/lock-http.svg</file>
<file>theme/lock-https.svg</file>
+ <file>theme/lock-broken.svg</file>
<file>theme/network.svg</file>
<file>theme/account.svg</file>
<file>theme/colored/add.svg</file>
--- /dev/null
+<svg width="64" height="64" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><path d="m32 4c-9.276 0-15.868 7.4576-16 16v10h-6v18.914l-6 6 5.6562 5.6562 50.914-50.914-5.6562-5.6562-8.7266 8.7266c-2.6278-5.2025-7.9771-8.6518-14.188-8.7266zm0 8c4.5949 0 7.4656 3.2614 7.9062 7.0078l-10.992 10.992h-4.9141v-10c0-4.696 2.988-8 8-8zm16.227 18-30 30h35.773v-30z" fill="#c13030"/></svg>