Commit cfc1c80e authored by Andreas Traczyk's avatar Andreas Traczyk

callwidget: fix deselection of conversation when changing account

Change-Id: If16a9371cfc182cdff7bd87205674483fb596633
parent 2cd356a8
......@@ -798,7 +798,7 @@ CallWidget::setSelectedAccount(const std::string& accountId)
// First, we get back to the welcome view (except if in call)
if (ui->stackedWidget->currentWidget() != ui->videoPage &&
ui->stackedWidget->currentWidget() != ui->welcomePage) {
Utils::setStackWidget(ui->stackedWidget, ui->welcomePage);
backToWelcomePage();
}
// We setup the ringIdLabel and the QRCode
......@@ -1176,6 +1176,10 @@ CallWidget::selectConversation( const lrc::api::conversation::Info& item,
void
CallWidget::deselectConversation()
{
if (LRCInstance::getSelectedConvUid().empty()) {
return;
}
auto currentConversationModel = LRCInstance::getCurrentConversationModel();
if (currentConversationModel == nullptr) {
......@@ -1183,7 +1187,7 @@ CallWidget::deselectConversation()
}
currentConversationModel->selectConversation("");
LRCInstance::setSelectedConvId("");
LRCInstance::setSelectedConvId();
ui->smartList->selectionModel()->clear();
disconnect(imConnection_);
......
......@@ -121,7 +121,7 @@ public:
return instance().selectedAccountId_;
};
static void setSelectedAccountId(const std::string& accountId) {
static void setSelectedAccountId(const std::string& accountId = {}) {
instance().selectedAccountId_ = accountId;
QSettings settings("jami.net", "Jami");
settings.setValue(SettingsKey::selectedAccount, QString::fromStdString(accountId));
......@@ -131,7 +131,7 @@ public:
return instance().selectedConvUid_;
};
static void setSelectedConvId(const std::string& convUid) {
static void setSelectedConvId(const std::string& convUid = {}) {
instance().selectedConvUid_ = convUid;
};
......
......@@ -492,13 +492,13 @@ void SettingsWidget::delAccountSlot()
auto ret = delDialog.exec();
if (ret == QDialog::Accepted) {
LRCInstance::setSelectedAccountId("");
LRCInstance::setSelectedAccountId();
if (!LRCInstance::accountModel().getAccountList().size()) {
emit NavigationRequested(ScreenEnum::WizardScreen);
} else {
LRCInstance::setSelectedConvId("");
LRCInstance::setSelectedConvId();
emit NavigationRequested(ScreenEnum::CallScreen);
}
}
......
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