From 9176afe2631b87d6fe08f71c49aab66d786bd2fa Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Thu, 5 Mar 2020 18:13:09 +0100 Subject: [PATCH] Make sure all cases are handled --- src/common/vfs.h | 1 + src/gui/wizard/owncloudwizard.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/vfs.h b/src/common/vfs.h index 669e3f5b6..ab39ea8fc 100644 --- a/src/common/vfs.h +++ b/src/common/vfs.h @@ -96,6 +96,7 @@ public: WithSuffix, WindowsCfApi, }; + Q_ENUM(Mode) static QString modeToString(Mode mode); static Optional modeFromString(const QString &str); diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index 951cc7036..0bd3b67f5 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -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); -- 2.30.2