Make sure all cases are handled
authorHannah von Reth <hannah.vonreth@owncloud.com>
Thu, 5 Mar 2020 17:13:09 +0000 (18:13 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:08 +0000 (10:59 +0100)
src/common/vfs.h
src/gui/wizard/owncloudwizard.cpp

index 669e3f5b68d094fe78e4968531a71c43830f705d..ab39ea8fc1036aaec55b6b970c777e717b0d7b54 100644 (file)
@@ -96,6 +96,7 @@ public:
         WithSuffix,
         WindowsCfApi,
     };
+    Q_ENUM(Mode)
     static QString modeToString(Mode mode);
     static Optional<Mode> modeFromString(const QString &str);
 
index 951cc7036e0f0a36765a6b73efa8025fb9246753..0bd3b67f5b3abc955779f47e8fd2a508b7dbc16a 100644 (file)
@@ -334,7 +334,9 @@ void OwncloudWizard::askExperimentalVirtualFilesFeature(QWidget *receiver, const
 {
     const auto bestVfsMode = bestAvailableVfsMode();
     QMessageBox *msgBox = nullptr;
-    if (bestVfsMode == Vfs::WindowsCfApi) {
+    switch (bestVfsMode)
+    {
+    case Vfs::WindowsCfApi:
         msgBox = new QMessageBox(
             QMessageBox::Warning,
             tr("Enable technical preview feature?"),
@@ -348,8 +350,8 @@ void OwncloudWizard::askExperimentalVirtualFilesFeature(QWidget *receiver, const
                "and your selective sync settings will be reset."), QMessageBox::NoButton, receiver);
         msgBox->addButton(tr("Enable virtual files"), QMessageBox::AcceptRole);
         msgBox->addButton(tr("Continue to use selective sync"), QMessageBox::RejectRole);
-    } else {
-        ASSERT(bestVfsMode == Vfs::WithSuffix)
+        break;
+    case Vfs::WithSuffix:
         msgBox = new QMessageBox(
             QMessageBox::Warning,
             tr("Enable experimental feature?"),
@@ -368,6 +370,9 @@ void OwncloudWizard::askExperimentalVirtualFilesFeature(QWidget *receiver, const
                 .arg(APPLICATION_DOTVIRTUALFILE_SUFFIX), QMessageBox::NoButton, receiver);
         msgBox->addButton(tr("Enable experimental placeholder mode"), QMessageBox::AcceptRole);
         msgBox->addButton(tr("Stay safe"), QMessageBox::RejectRole);
+        break;
+    case Vfs::Off:
+        Q_UNREACHABLE();
     }
     connect(msgBox, &QMessageBox::finished, receiver, [callback, msgBox](int result) {
         callback(result == QMessageBox::AcceptRole);