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