Navigation Menu

Skip to content

Commit

Permalink
[buteo-syncfw] Remove listener on account change.
Browse files Browse the repository at this point in the history
Previously, we were using a listener on account change at the
manager level, but it was not used. To listen to account changes
it's better to setup connections for each account in the
registerAccountListener() method.
  • Loading branch information
dcaliste committed Mar 19, 2021
1 parent f2e3962 commit 77b860c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
24 changes: 2 additions & 22 deletions msyncd/AccountsHelper.cpp
Expand Up @@ -36,16 +36,15 @@ AccountsHelper::AccountsHelper(ProfileManager &aProfileManager, QObject *aParent
: QObject(aParent), iProfileManager(aProfileManager)
{
iAccountManager = new Accounts::Manager(this);
// Connect to signal for account creation, deletion, and modification
// Connect to signal for account creation and deletion.
QObject::connect(iAccountManager, SIGNAL(accountCreated(Accounts::AccountId)),
this, SLOT(createProfileForAccount(Accounts::AccountId)));
QObject::connect(iAccountManager, SIGNAL(accountRemoved(Accounts::AccountId)),
this, SLOT(slotAccountRemoved(Accounts::AccountId)));
QObject::connect(iAccountManager, SIGNAL(accountUpdated(Accounts::AccountId)),
this, SLOT(slotAccountUpdated(Accounts::AccountId)));

// load accounts after return from contructor, to allow connection with class signals
// that can be fired by 'registerAccountListeners' function
// Handle account modifications with a listener per account.
QTimer::singleShot(0, this, SLOT(registerAccountListeners()));
}

Expand Down Expand Up @@ -239,25 +238,6 @@ void AccountsHelper::setSyncSchedule(SyncProfile *syncProfile, Accounts::Account
}
}

void AccountsHelper::slotAccountUpdated(Accounts::AccountId id)
{
#if 0 // Not required for scheduler settings; they will be handled by slotSchedulerSettingsChanged
FUNCTION_CALL_TRACE;
QList<SyncProfile*> syncProfiles = getProfilesByAccountId(id);
foreach(SyncProfile *syncProfile, syncProfiles)
{
if (syncProfile) {
setSyncSchedule(syncProfile, id);
iProfileManager.updateProfile(*syncProfile);
emit scheduleUpdated(syncProfile->name());
delete syncProfile;
}
}
#else
Q_UNUSED(id);
#endif
}

QList<SyncProfile*> AccountsHelper::getProfilesByAccountId(Accounts::AccountId id)
{
FUNCTION_CALL_TRACE;
Expand Down
6 changes: 0 additions & 6 deletions msyncd/AccountsHelper.h
Expand Up @@ -80,12 +80,6 @@ public Q_SLOTS:
*/
void slotAccountRemoved(Accounts::AccountId id);

/*! \brief slot for Accounts::Manager displayNameChanged signal
* *
* \param id of the accounts
*/
void slotAccountUpdated(Accounts::AccountId id);

void slotSchedulerSettingsChanged(const char *aKey);
Q_SIGNALS:

Expand Down

0 comments on commit 77b860c

Please sign in to comment.