Do not initialise file provider module if not enabled in config
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 12 May 2023 04:09:19 +0000 (12:09 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 12 May 2023 08:02:39 +0000 (16:02 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/macOS/fileprovider_mac.mm

index 9cb5b739bd5e335b48d149c814b141b84b2856d5..56db4d2447b076f2e9c2103e619f0f88860b58e6 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <QLoggingCategory>
 
+#include "configfile.h"
+
 #include "fileprovider.h"
 
 namespace OCC {
@@ -32,11 +34,16 @@ FileProvider::FileProvider(QObject * const parent)
     Q_ASSERT(!_instance);
 
     if (!fileProviderAvailable()) {
-        qCDebug(lcMacFileProvider) << "File provider system is not available on this version of macOS.";
+        qCInfo(lcMacFileProvider) << "File provider system is not available on this version of macOS.";
+        deleteLater();
+        return;
+    } else if (!ConfigFile().macFileProviderModuleEnabled()) {
+        qCInfo(lcMacFileProvider) << "File provider module is not enabled in application config.";
+        deleteLater();
         return;
     }
 
-    qCDebug(lcMacFileProvider) << "Initialising file provider domain manager.";
+    qCInfo(lcMacFileProvider) << "Initialising file provider domain manager.";
     _domainManager = std::make_unique<FileProviderDomainManager>(new FileProviderDomainManager(this));
 
     if (_domainManager) {
@@ -54,6 +61,10 @@ FileProvider::FileProvider(QObject * const parent)
 FileProvider *FileProvider::instance()
 {
     if (!fileProviderAvailable()) {
+        qCInfo(lcMacFileProvider) << "File provider system is not available on this version of macOS.";
+        return nullptr;
+    } else if (!ConfigFile().macFileProviderModuleEnabled()) {
+        qCInfo(lcMacFileProvider) << "File provider module is not enabled in application config.";
         return nullptr;
     }