File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030// NSUserDefaults entries
3131constexpr auto enabledAccountsSettingsKey = " enabledAccounts" ;
3232
33+ bool domainRestorationRequiresXpcReconfiguration (const QString &storedIdentifier, const QString &restoredIdentifier)
34+ {
35+ return !storedIdentifier.isEmpty () && !restoredIdentifier.isEmpty () && storedIdentifier != restoredIdentifier;
36+ }
37+
3338} // namespace
3439
3540namespace OCC {
@@ -265,6 +270,7 @@ void ensureDomainConfigurationMatchesMode()
265270 if (modeEnabled) {
266271 const auto domains = Mac::FileProvider::instance ()->domainManager ()->getDomains ();
267272 QSet<QString> existingDomainIdentifiers;
273+ auto restoredDomain = false ;
268274
269275 for (NSFileProviderDomain * const domain : domains) {
270276 existingDomainIdentifiers.insert (QString::fromNSString (domain.identifier ));
@@ -293,9 +299,15 @@ void ensureDomainConfigurationMatchesMode()
293299
294300 if (newIdentifier.isEmpty () == false ) {
295301 AccountManager::instance ()->setFileProviderDomainIdentifier (userIdAtHost, newIdentifier);
302+ restoredDomain |= domainRestorationRequiresXpcReconfiguration (identifier, newIdentifier);
296303 }
297304 }
298305 }
306+
307+ if (restoredDomain) {
308+ // A changed identifier means addDomainForAccount() registered a new domain; rediscover its XPC service.
309+ Mac::FileProvider::instance ()->configureXPC ();
310+ }
299311 } else {
300312 for (const auto &accountState : accountStates) {
301313 const auto account = accountState->account ();
You can’t perform that action at this time.
0 commit comments