mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Enable file provider domains per the settings in the file provider domain manager
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
1db59fecc1
commit
ee6c081603
3 changed files with 19 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "fileproviderdomainmanager.h"
|
||||
#include "fileprovidersettingscontroller.h"
|
||||
#include "pushnotifications.h"
|
||||
|
||||
#include "gui/accountmanager.h"
|
||||
|
@ -447,10 +448,21 @@ void FileProviderDomainManager::setupFileProviderDomains()
|
|||
|
||||
d->findExistingFileProviderDomains();
|
||||
|
||||
for(auto &accountState : AccountManager::instance()->accounts()) {
|
||||
const auto vfsEnabledAccounts = FileProviderSettingsController::instance()->vfsEnabledAccounts();
|
||||
auto domainsToRemove = d->configuredDomainIds();
|
||||
|
||||
for (const auto &accountUserIdAtHost : vfsEnabledAccounts) {
|
||||
domainsToRemove.removeAll(accountUserIdAtHost);
|
||||
|
||||
const auto accountState = AccountManager::instance()->accountFromUserId(accountUserIdAtHost);
|
||||
addFileProviderDomainForAccount(accountState.data());
|
||||
}
|
||||
|
||||
for (const auto &remainingDomainUserId : domainsToRemove) {
|
||||
const auto accountState = AccountManager::instance()->accountFromUserId(remainingDomainUserId);
|
||||
removeFileProviderDomainForAccount(accountState.data());
|
||||
}
|
||||
|
||||
emit domainSetupComplete();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
QWidget *const parent = nullptr,
|
||||
const QQuickWidget::ResizeMode resizeMode = QQuickWidget::SizeRootObjectToView);
|
||||
|
||||
[[nodiscard]] QStringList vfsEnabledAccounts() const;
|
||||
[[nodiscard]] Q_INVOKABLE bool vfsEnabledForAccount(const QString &userIdAtHost) const;
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -183,6 +183,11 @@ QQuickWidget *FileProviderSettingsController::settingsViewWidget(const QString &
|
|||
return settingsViewWidget;
|
||||
}
|
||||
|
||||
QStringList FileProviderSettingsController::vfsEnabledAccounts() const
|
||||
{
|
||||
return d->enabledAccounts();
|
||||
}
|
||||
|
||||
bool FileProviderSettingsController::vfsEnabledForAccount(const QString &userIdAtHost) const
|
||||
{
|
||||
return d->vfsEnabledForAccount(userIdAtHost);
|
||||
|
|
Loading…
Reference in a new issue