mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Add method to signal file provider domain via file provider settings controller
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
1d01f67790
commit
f1c7811962
2 changed files with 25 additions and 0 deletions
|
@ -49,6 +49,7 @@ public slots:
|
|||
void setVfsEnabledForAccount(const QString &userIdAtHost, const bool setEnabled);
|
||||
|
||||
void createEvictionWindowForAccount(const QString &userIdAtHost);
|
||||
void signalFileProviderDomain(const QString &userIdAtHost);
|
||||
void createDebugArchive(const QString &userIdAtHost);
|
||||
|
||||
signals:
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "gui/macOS/fileprovider.h"
|
||||
#include "gui/macOS/fileprovideritemmetadata.h"
|
||||
#include "gui/macOS/fileprovidermaterialiseditemsmodel.h"
|
||||
#include "gui/macOS/fileproviderutils.h"
|
||||
|
||||
// Objective-C imports
|
||||
#import <Foundation/Foundation.h>
|
||||
|
@ -161,6 +162,24 @@ public:
|
|||
return _materialisedFiles.value(userIdAtHost);
|
||||
}
|
||||
|
||||
void signalFileProviderDomain(const QString &userIdAtHost) const
|
||||
{
|
||||
qCInfo(lcFileProviderSettingsController) << "Signalling file provider domain" << userIdAtHost;
|
||||
NSFileProviderDomain * const domain = FileProviderUtils::domainForIdentifier(userIdAtHost);
|
||||
NSFileProviderManager * const manager = [NSFileProviderManager managerForDomain:domain];
|
||||
[manager signalEnumeratorForContainerItemIdentifier:NSFileProviderRootContainerItemIdentifier
|
||||
completionHandler:^(NSError *const error) {
|
||||
if (error != nil) {
|
||||
qCWarning(lcFileProviderSettingsController) << "Could not signal file provider domain, error"
|
||||
<< error.localizedDescription;
|
||||
return;
|
||||
}
|
||||
|
||||
qCInfo(lcFileProviderSettingsController) << "Successfully signalled file provider domain";
|
||||
// TODO: Provide some feedback in the UI
|
||||
}];
|
||||
}
|
||||
|
||||
private:
|
||||
[[nodiscard]] NSArray<NSString *> *nsEnabledAccounts() const
|
||||
{
|
||||
|
@ -386,6 +405,11 @@ void FileProviderSettingsController::createEvictionWindowForAccount(const QStrin
|
|||
dialog->show();
|
||||
}
|
||||
|
||||
void FileProviderSettingsController::signalFileProviderDomain(const QString &userIdAtHost)
|
||||
{
|
||||
d->signalFileProviderDomain(userIdAtHost);
|
||||
}
|
||||
|
||||
void FileProviderSettingsController::createDebugArchive(const QString &userIdAtHost)
|
||||
{
|
||||
const auto filename = QFileDialog::getSaveFileName(nullptr,
|
||||
|
|
Loading…
Reference in a new issue