File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed
Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class FileProviderDomainManager : public QObject
2424 ~FileProviderDomainManager () override ;
2525
2626 static AccountStatePtr accountStateFromFileProviderDomainIdentifier (const QString &domainIdentifier);
27- static QString fileProviderDomainIdentifierFromAccountState (const AccountStatePtr &accountState );
27+ QString fileProviderDomainIdentifierFromAccountId (const QString &accountId );
2828
2929 void start ();
3030 void * domainForAccount (const OCC::AccountState * const accountState);
Original file line number Diff line number Diff line change @@ -308,6 +308,18 @@ void findExistingFileProviderDomains()
308308 return nil ;
309309 }
310310
311+ QString fileProviderDomainIdentifierForAccountId (const QString &accountId)
312+ {
313+ if (@available (macOS 11.0 , *)) {
314+ if (_registeredDomains.contains (accountId)) {
315+ const auto fileProviderDomain = _registeredDomains[accountId];
316+ return QString::fromNSString ([fileProviderDomain identifier ]);
317+ }
318+ }
319+
320+ return {};
321+ }
322+
311323 void addFileProviderDomain (const AccountState * const accountState)
312324 {
313325 if (@available (macOS 11.0 , *)) {
@@ -597,6 +609,7 @@ QStringList getAccountIdsOfFoundFileProviderDomains() const
597609 }
598610
599611private:
612+ // ! keys are accountId, i.e. userIdAtHostWithPort
600613 QHash<QString, NSFileProviderDomain*> _registeredDomains;
601614};
602615
@@ -806,9 +819,13 @@ QStringList getAccountIdsOfFoundFileProviderDomains() const
806819 return accountForReceivedDomainIdentifier;
807820}
808821
809- QString FileProviderDomainManager::fileProviderDomainIdentifierFromAccountState (const AccountStatePtr &accountState )
822+ QString FileProviderDomainManager::fileProviderDomainIdentifierFromAccountId (const QString &accountId )
810823{
811- return uuidDomainIdentifierForAccount (accountState->account ());
824+ if (!d || accountId.isEmpty ()) {
825+ return {};
826+ }
827+
828+ return d->fileProviderDomainIdentifierForAccountId (accountId);
812829}
813830
814831void * FileProviderDomainManager::domainForAccount (const AccountState * const accountState)
Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ private slots:
4343 void slotAccountStateChanged (AccountState::State state) const ;
4444
4545private:
46+ // ! keys are File Provider domain identifiers
4647 QHash<QString, void *> _clientCommServices;
48+ // ! keys are File Provider domain identifiers
4749 QHash<QString, QDateTime> _unreachableFileProviderDomains;
4850};
4951
Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ void ownCloudGui::slotComputeOverallSyncStatus()
318318 }
319319 allPaused = false ;
320320 const auto fileProvider = Mac::FileProvider::instance ();
321- const auto accountFpId = Mac::FileProviderDomainManager::fileProviderDomainIdentifierFromAccountState (accountState );
321+ const auto accountFpId = fileProvider-> domainManager ()-> fileProviderDomainIdentifierFromAccountId (userIdAtHostWithPort );
322322 const auto displayName = account->displayName ();
323323 const auto accountTooltipLabel = displayName.isEmpty () ? userIdAtHostWithPort : displayName;
324324
You can’t perform that action at this time.
0 commit comments