Commit 4913047f authored by Edric Milaret's avatar Edric Milaret

im: fix wrong disconnect

- connection object captured could'nt be good
- also fix wrong usage of messagePresent variable

Change-Id: Ie75dc0d3a5d31108b4830972d372ac2bdbc19e36
Tuleap: #232
parent 3e1ffe6d
...@@ -613,10 +613,14 @@ CallWidget::on_contactMethodComboBox_currentIndexChanged(const QString& number) ...@@ -613,10 +613,14 @@ CallWidget::on_contactMethodComboBox_currentIndexChanged(const QString& number)
ui->listMessageView->setVisible(messagesPresent); ui->listMessageView->setVisible(messagesPresent);
ui->noMessagesLabel->setVisible(!messagesPresent); ui->noMessagesLabel->setVisible(!messagesPresent);
if (not messagesPresent) { if (not messagesPresent) {
QMetaObject::Connection connection = connect(txtRecording->instantMessagingModel(), &QAbstractItemModel::rowsInserted, [&]() { imVisibleConnection_ = connect(txtRecording->instantMessagingModel(),
&QAbstractItemModel::rowsInserted,
[this, txtRecording]() {
if (imVisibleConnection_)
disconnect(imVisibleConnection_);
auto messagesPresent = txtRecording->instantMessagingModel()->rowCount() > 0;
ui->listMessageView->setVisible(messagesPresent); ui->listMessageView->setVisible(messagesPresent);
ui->noMessagesLabel->setVisible(!messagesPresent); ui->noMessagesLabel->setVisible(!messagesPresent);
disconnect(connection);
}); });
} }
} }
......
...@@ -103,6 +103,7 @@ private: ...@@ -103,6 +103,7 @@ private:
QModelIndex highLightedIndex_; QModelIndex highLightedIndex_;
ImDelegate* imDelegate_; ImDelegate* imDelegate_;
QMetaObject::Connection imConnection_; QMetaObject::Connection imConnection_;
QMetaObject::Connection imVisibleConnection_;
QPropertyAnimation* messagingPageAnim_; QPropertyAnimation* messagingPageAnim_;
QPropertyAnimation* welcomePageAnim_; QPropertyAnimation* welcomePageAnim_;
......
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