Fix warning dialog box message when trying to encrypt folders that have not been...
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 11 Aug 2023 07:08:32 +0000 (15:08 +0800)
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>
Tue, 22 Aug 2023 20:11:50 +0000 (22:11 +0200)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/accountsettings.cpp

index cc300174d5067c15df338e09b01fdc1b58d02ac4..7613595cd55df84f70e70a07d6284fd130c618ce 100644 (file)
@@ -329,10 +329,18 @@ void AccountSettings::doExpand()
     }
 }
 
-bool AccountSettings::canEncryptOrDecrypt(const FolderStatusModel::SubFolderInfo* info) {
-    if (info->_folder->syncResult().status() != SyncResult::Status::Success) {
+bool AccountSettings::canEncryptOrDecrypt(const FolderStatusModel::SubFolderInfo *info)
+{
+    if (const auto folderSyncStatus = info->_folder->syncResult().status(); folderSyncStatus != SyncResult::Status::Success) {
+        auto message = tr("Please wait for the folder to sync before trying to encrypt it.");
+        if (folderSyncStatus == SyncResult::Status::Problem) {
+            message = tr("The folder has a minor sync problem. Encryption of this folder will be possible once it has synced successfully");
+        } else if (folderSyncStatus == SyncResult::Status::Error) {
+            message = tr("The folder has a sync error. Encryption of this folder will be possible once it has synced successfully");
+        }
+
         QMessageBox msgBox;
-        msgBox.setText("Please wait for the folder to sync before trying to encrypt it.");
+        msgBox.setText(message);
         msgBox.exec();
         return false;
     }