Commit 475d0885 authored by Sébastien Blin's avatar Sébastien Blin

callbackshandler: connect to volatileAccountDetailsChanged

Change-Id: I4d658afc5adb4b81ca12b3bcfe484eb3315eae7b
parent feed316a
......@@ -98,6 +98,12 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
&CallbacksHandler::slotAccountDetailsChanged,
Qt::QueuedConnection);
connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::volatileAccountDetailsChanged,
this,
&CallbacksHandler::slotVolatileAccountDetailsChanged,
Qt::QueuedConnection);
connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::accountsChanged,
this,
......@@ -343,6 +349,13 @@ CallbacksHandler::slotAccountDetailsChanged(const QString& accountId,
emit accountDetailsChanged(accountId.toStdString(), convertMap(details));
}
void
CallbacksHandler::slotVolatileAccountDetailsChanged(const QString& accountId,
const MapStringString& details)
{
emit volatileAccountDetailsChanged(accountId.toStdString(), convertMap(details));
}
void
CallbacksHandler::slotAccountsChanged()
{
......
......@@ -121,6 +121,13 @@ Q_SIGNALS:
*/
void accountDetailsChanged(const std::string& accountId,
const std::map<std::string,std::string>& details);
/**
* Connect this signal to know when the volatile account details have changed
* @param accountId the one who changes
* @param details the new details
*/
void volatileAccountDetailsChanged(const std::string& accountId,
const std::map<std::string,std::string>& details);
/**
* Connect this signal to know when the accounts list changed
*/
......@@ -335,6 +342,13 @@ private Q_SLOTS:
*/
void slotAccountDetailsChanged(const QString& accountId,
const MapStringString& details);
/**
* Emit volatileAccountDetailsChanged
* @param accountId
* @param details
*/
void slotVolatileAccountDetailsChanged(const QString& accountId,
const MapStringString& details);
/**
* Emit accountsChanged
*/
......
......@@ -126,6 +126,12 @@ public Q_SLOTS:
*/
void slotAccountDetailsChanged(const std::string& accountID, const std::map<std::string, std::string>& details);
/**
* @param accountId
* @param details
*/
void slotVolatileAccountDetailsChanged(const std::string& accountID, const std::map<std::string, std::string>& details);
/**
* Emit nameRegistrationEnded
* @param accountId
......@@ -357,6 +363,7 @@ NewAccountModelPimpl::NewAccountModelPimpl(NewAccountModel& linked,
connect(&callbacksHandler, &CallbacksHandler::accountsChanged, this, &NewAccountModelPimpl::updateAccounts);
connect(&callbacksHandler, &CallbacksHandler::accountStatusChanged, this, &NewAccountModelPimpl::slotAccountStatusChanged);
connect(&callbacksHandler, &CallbacksHandler::accountDetailsChanged, this, &NewAccountModelPimpl::slotAccountDetailsChanged);
connect(&callbacksHandler, &CallbacksHandler::volatileAccountDetailsChanged, this, &NewAccountModelPimpl::slotVolatileAccountDetailsChanged);
connect(&callbacksHandler, &CallbacksHandler::exportOnRingEnded, this, &NewAccountModelPimpl::slotExportOnRingEnded);
connect(&callbacksHandler, &CallbacksHandler::nameRegistrationEnded, this, &NewAccountModelPimpl::slotNameRegistrationEnded);
connect(&callbacksHandler, &CallbacksHandler::registeredNameFound, this, &NewAccountModelPimpl::slotRegisteredNameFound);
......@@ -463,6 +470,22 @@ NewAccountModelPimpl::slotAccountDetailsChanged(const std::string& accountId, co
emit linked.accountStatusChanged(accountId);
}
void
NewAccountModelPimpl::slotVolatileAccountDetailsChanged(const std::string& accountId, const std::map<std::string, std::string>& details)
{
auto account = accounts.find(accountId);
if (account == accounts.end()) {
throw std::out_of_range("NewAccountModelPimpl::slotVolatileAccountDetailsChanged, can't find " + accountId);
}
auto& accountInfo = account->second.first;
auto new_usernameIt = details.find(DRing::Account::VolatileProperties::REGISTERED_NAME);
if (new_usernameIt == details.end())
return;
accountInfo.registeredName = new_usernameIt->second;
emit linked.profileUpdated(accountId);
}
void
NewAccountModelPimpl::slotExportOnRingEnded(const std::string& accountID, int status, const std::string& pin)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment