Skip to content

Commit c384e04

Browse files
committed
fix(file-provider): Resolved circular object initializer dependency.
- Moved some logic (most notably removeOrphanedDomains and restoreMissingDomains) from FileProviderDomainManager into the more appropriate FileProviderSettingsController - Dissolved updateFileProviderDomains() - Removed domainSetupComplete signal - Introduced migrateToAppSandbox() implementation FileProviderSettingsController - Improved logging messages Signed-off-by: Iva Horn <[email protected]>
1 parent 8f82f0c commit c384e04

File tree

7 files changed

+202
-239
lines changed

7 files changed

+202
-239
lines changed

src/gui/macOS/fileprovider.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ class FileProvider : public QObject
2828
static FileProvider *instance();
2929
~FileProvider() override;
3030

31+
void configureXPC();
3132
[[nodiscard]] FileProviderXPC *xpc() const;
3233
[[nodiscard]] FileProviderDomainManager *domainManager() const;
3334
[[nodiscard]] FileProviderSocketServer *socketServer() const;
3435

35-
private slots:
36-
void configureXPC();
37-
3836
private:
3937
std::unique_ptr<FileProviderDomainManager> _domainManager;
4038
std::unique_ptr<FileProviderSocketServer> _socketServer;

src/gui/macOS/fileprovider_mac.mm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,14 @@
2424
: QObject(parent)
2525
{
2626
Q_ASSERT(!_instance);
27+
qCDebug(lcMacFileProvider) << "Initializing...";
2728

28-
qCInfo(lcMacFileProvider) << "Initialising file provider domain manager.";
2929
_domainManager = std::make_unique<FileProviderDomainManager>(this);
3030

3131
if (_domainManager) {
32-
connect(_domainManager.get(), &FileProviderDomainManager::domainSetupComplete, this, &FileProvider::configureXPC);
3332
_domainManager->start();
34-
qCDebug(lcMacFileProvider()) << "Initialized file provider domain manager";
3533
}
3634

37-
qCDebug(lcMacFileProvider) << "Initialising file provider socket server.";
3835
_socketServer = std::make_unique<FileProviderSocketServer>(this);
3936

4037
if (_socketServer) {
@@ -47,6 +44,7 @@
4744
if (!_instance) {
4845
_instance = new FileProvider();
4946
}
47+
5048
return _instance;
5149
}
5250

@@ -58,6 +56,7 @@
5856
void FileProvider::configureXPC()
5957
{
6058
_xpc = std::make_unique<FileProviderXPC>(new FileProviderXPC(this));
59+
6160
if (_xpc) {
6261
qCInfo(lcMacFileProvider) << "Initialised file provider XPC.";
6362
_xpc->connectToFileProviderDomains();

src/gui/macOS/fileproviderdomainmanager.h

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
#pragma once
77

88
#include <QObject>
9+
#include <QList>
910

1011
#include "accountstate.h"
1112

1213
#ifdef __OBJC__
1314
@class NSFileProviderDomain;
1415
#else
15-
class NSFileProviderDomain;
16+
struct NSFileProviderDomain;
1617
#endif
1718

1819
namespace OCC {
@@ -29,28 +30,39 @@ class FileProviderDomainManager : public QObject
2930
explicit FileProviderDomainManager(QObject * const parent = nullptr);
3031
~FileProviderDomainManager() override;
3132

32-
void start();
33+
/**
34+
* @brief Add a new file provider domain for the given account.
35+
* @return The raw identifier of the added domain as a string.
36+
*/
37+
QString addDomainForAccount(const OCC::AccountState * const accountState);
3338

34-
NSFileProviderDomain *domainForAccount(const OCC::Account *account) const;
39+
/**
40+
* @brief Remove all file provider domains managed by this application.
41+
*/
42+
void removeAllDomains();
3543

36-
signals:
37-
void domainSetupComplete();
44+
/**
45+
* @brief Reconnect all file provider domains.
46+
*/
47+
void reconnectAll();
3848

39-
public slots:
4049
/**
41-
* @brief Add a new file provider domain for the given account.
42-
* @return The raw identifier of the added domain as a string.
50+
* @brief Remove a file provider domain independent from an account.
4351
*/
44-
QString addFileProviderDomainForAccount(const OCC::AccountState * const accountState);
52+
void removeDomain(NSFileProviderDomain *domain);
4553

4654
/**
4755
* @brief Remove the file provider domain for the given account.
4856
*/
49-
void removeFileProviderDomainForAccount(const OCC::AccountState * const accountState);
57+
void removeDomainByAccount(const OCC::AccountState * const accountState);
5058

51-
private slots:
52-
void updateFileProviderDomains();
59+
void start();
5360

61+
[[nodiscard]] QList<NSFileProviderDomain *> getDomains() const;
62+
63+
NSFileProviderDomain *domainForAccount(const OCC::Account *account) const;
64+
65+
private slots:
5466
void disconnectFileProviderDomainForAccount(const OCC::AccountState * const accountState, const QString &reason);
5567
void reconnectFileProviderDomainForAccount(const OCC::AccountState * const accountState);
5668

0 commit comments

Comments
 (0)