Commit abf310df authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Sébastien Blin

accounts: handle account avatar signal from daemon

Change-Id: I50bfa8796dd0d4158527af404a20a597e2f8de26
parent 19946642
......@@ -181,6 +181,12 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
&CallbacksHandler::slotDeviceRevokationEnded,
Qt::QueuedConnection);
connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::accountAvatarReceived,
this,
&CallbacksHandler::slotAccountAvatarReceived,
Qt::QueuedConnection);
connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::exportOnRingEnded,
this,
......@@ -491,6 +497,13 @@ CallbacksHandler::slotDeviceRevokationEnded(const QString& accountId,
emit deviceRevocationEnded(accountId, deviceId, status);
}
void
CallbacksHandler::slotAccountAvatarReceived(const QString& accountId,
const QString& userPhoto)
{
emit accountAvatarReceived(accountId, userPhoto);
}
void
CallbacksHandler::slotExportOnRingEnded(const QString& accountId, int status, const QString& pin)
{
......
......@@ -208,6 +208,13 @@ Q_SIGNALS:
const QString& deviceId,
const int status);
/**
* Account avatar has been received
* @param accountId
* @param userPhoto
*/
void accountAvatarReceived(const QString& accountId, const QString& userPhoto);
/**
* Emit exportOnRingEnded
* @param accountId
......@@ -436,6 +443,13 @@ private Q_SLOTS:
const QString& deviceId,
const int status);
/**
* Emit account avatar has been received
* @param accountId
* @param userPhoto
*/
void slotAccountAvatarReceived(const QString& accountId, const QString& userPhoto);
/**
* Emit exportOnRingEnded
* @param accountId
......
......@@ -155,6 +155,13 @@ public Q_SLOTS:
* @param ok
*/
void slotMigrationEnded(const QString& accountId, bool ok);
/**
* Emit accountAvatarReceived
* @param accountId
* @param userPhoto
*/
void slotAccountAvatarReceived(const QString& accountId, const QString& userPhoto);
};
NewAccountModel::NewAccountModel(Lrc& lrc,
......@@ -380,6 +387,7 @@ NewAccountModelPimpl::NewAccountModelPimpl(NewAccountModel& linked,
connect(&callbacksHandler, &CallbacksHandler::nameRegistrationEnded, this, &NewAccountModelPimpl::slotNameRegistrationEnded);
connect(&callbacksHandler, &CallbacksHandler::registeredNameFound, this, &NewAccountModelPimpl::slotRegisteredNameFound);
connect(&callbacksHandler, &CallbacksHandler::migrationEnded, this, &NewAccountModelPimpl::slotMigrationEnded);
connect(&callbacksHandler, &CallbacksHandler::accountAvatarReceived, this, &NewAccountModelPimpl::slotAccountAvatarReceived);
}
NewAccountModelPimpl::~NewAccountModelPimpl()
......@@ -597,6 +605,12 @@ NewAccountModelPimpl::slotMigrationEnded(const QString& accountId, bool ok)
emit linked.migrationEnded(accountId, ok);
}
void
NewAccountModelPimpl::slotAccountAvatarReceived(const QString& accountId, const QString& userPhoto)
{
linked.setAvatar(accountId, userPhoto);
}
void
NewAccountModelPimpl::addToAccounts(const QString& accountId,
std::shared_ptr<Database> db)
......
......@@ -127,6 +127,10 @@ public:
[this] (const std::string &accountId, const std::string &device, int status) {
Q_EMIT this->deviceRevocationEnded(QString(accountId.c_str()), QString(device.c_str()), status);
}),
exportable_callback<ConfigurationSignal::AccountAvatarReceived>(
[this](const std::string& accountId, const std::string& userPhoto) {
Q_EMIT this->accountAvatarReceived(QString(accountId.c_str()), QString(userPhoto.c_str()));
}),
exportable_callback<ConfigurationSignal::ExportOnRingEnded>(
[this] (const std::string &accountId, int status, const std::string &pin) {
Q_EMIT this->exportOnRingEnded(QString(accountId.c_str()), status, QString(pin.c_str()));
......@@ -742,6 +746,7 @@ Q_SIGNALS: // SIGNALS
void contactRemoved(const QString &accountID, const QString &uri, bool banned);
void dataTransferEvent(qulonglong transfer_id, uint code);
void deviceRevocationEnded(const QString& accountId, const QString& deviceId, int status);
void accountAvatarReceived(const QString& accountId, const QString& userPhoto);
void debugMessageReceived(const QString& message);
void composingStatusChanged(const QString& accountId, const QString& contactId, bool isComposing);
};
......
......@@ -852,6 +852,7 @@ Q_SIGNALS: // SIGNALS
void contactRemoved(const QString &accountId, const QString &uri, bool banned);
void dataTransferEvent(uint64_t transfer_id, uint32_t code);
void deviceRevocationEnded(const QString& accountId, const QString& deviceId, int status);
void avatarReceived(const QString& accountId, const QString& userPhoto);
void debugMessageReceived(const std::string& message);
};
......
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