Skip to content
Snippets Groups Projects
Unverified Commit 371da8f1 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

mainwindow: connect to updateProfile signal for the account combobox


This is needed to update the combobox when the user change the
avatar or the alias.

Change-Id: I3c836cfb0929e608b240728f6d042c5c81ef5d07
Reviewed-by: default avatarHugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com>
parent 576bfb0e
No related branches found
No related tags found
No related merge requests found
......@@ -329,6 +329,7 @@ public:
QMetaObject::Connection newConversationConnection_;
QMetaObject::Connection conversationRemovedConnection_;
QMetaObject::Connection accountStatusChangedConnection_;
QMetaObject::Connection profileUpdatedConnection_;
private:
CppImpl() = delete;
......@@ -360,6 +361,7 @@ private:
void slotNewInteraction(const std::string& accountId, const std::string& conversation,
uint64_t, const lrc::api::interaction::Info& interaction);
void slotCloseInteraction(const std::string& accountId, const std::string& conversation, uint64_t);
void slotProfileUpdated(const std::string& id);
};
inline namespace gtk_callbacks
......@@ -944,6 +946,11 @@ CppImpl::init()
accountStatusChangedConnection_ = QObject::connect(&lrc_->getAccountModel(),
&lrc::api::NewAccountModel::accountStatusChanged,
[this](const std::string& id){ slotAccountStatusChanged(id); });
profileUpdatedConnection_ = QObject::connect(&lrc_->getAccountModel(),
&lrc::api::NewAccountModel::profileUpdated,
[this](const std::string& id){
slotProfileUpdated(id);
});
newAccountConnection_ = QObject::connect(&lrc_->getAccountModel(),
&lrc::api::NewAccountModel::accountAdded,
[this](const std::string& id){ slotAccountAddedFromLrc(id); });
......@@ -1156,6 +1163,7 @@ CppImpl::~CppImpl()
QObject::disconnect(slotNewInteraction_);
QObject::disconnect(slotReadInteraction_);
QObject::disconnect(accountStatusChangedConnection_);
QObject::disconnect(profileUpdatedConnection_);
g_clear_object(&widgets->welcome_view);
g_clear_object(&widgets->webkit_chat_container);
......@@ -2076,6 +2084,15 @@ CppImpl::slotShowIncomingCallView(const std::string& id, lrc::api::conversation:
changeView(INCOMING_CALL_VIEW_TYPE, origin);
}
void
CppImpl::slotProfileUpdated(const std::string& id)
{
auto currentIdx = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->combobox_account_selector));
if (currentIdx == -1)
currentIdx = 0; // If no account selected, select the first account
refreshAccountSelectorWidget(currentIdx, id);
}
}} // namespace <anonymous>::details
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment