Commit 61065ec8 authored by Olivier SOLDANO's avatar Olivier SOLDANO

ui: fix chat inactive after call

The signal clicked() of the smartlist in callwidget
which wasn't captured hence forbidding chat view to be shown
after a contact tab was clicked

Change-Id: If53d99b663c98e0221f75a1e987447a48235558a
Tuleap: #1094
parent 1efcca9e
......@@ -177,6 +177,11 @@ CallWidget::CallWidget(QWidget* parent) :
this,
SLOT(smartListSelectionChanged(QItemSelection,QItemSelection)));
connect(RecentModel::instance().selectionModel(),
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
this,
SLOT(smartListCurrentChanged(QModelIndex,QModelIndex)));
connect(RecentModel::instance().selectionModel(), &QItemSelectionModel::selectionChanged, [=](const QItemSelection &selected, const QItemSelection &deselected) {
Q_UNUSED(deselected)
if (selected.size()) {
......@@ -605,26 +610,19 @@ CallWidget::on_smartList_doubleClicked(const QModelIndex& index)
}
void
CallWidget::smartListSelectionChanged(const QItemSelection& newSel, const QItemSelection& oldSel) {
Q_UNUSED(oldSel)
if (newSel.indexes().empty()) {
setActualCall(nullptr);
return ui->stackedWidget->setCurrentWidget(ui->welcomePage);
}
auto newIdx = newSel.indexes().first();
if (not newIdx.isValid())
CallWidget::smartListCurrentChanged(const QModelIndex &currentIdx, const QModelIndex &previousIdx)
{
Q_UNUSED(previousIdx);
if (not currentIdx.isValid())
return;
auto newIdxCall = RecentModel::instance().getActiveCall(newIdx);
if (newIdxCall && newIdxCall != actualCall_) {
setActualCall(newIdxCall);
} else if (newIdxCall == nullptr){
auto currentIdxCall = RecentModel::instance().getActiveCall(currentIdx);
if (currentIdxCall && currentIdxCall != actualCall_) {
setActualCall(currentIdxCall);
} else if (currentIdxCall == nullptr){
setActualCall(nullptr);
ui->instantMessagingWidget->hide();
showIMOutOfCall(newIdx);
showIMOutOfCall(currentIdx);
} else {
setActualCall(nullptr);
ui->instantMessagingWidget->hide();
......@@ -633,6 +631,18 @@ CallWidget::smartListSelectionChanged(const QItemSelection& newSel, const QItemS
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
}
}
void
CallWidget::smartListSelectionChanged(const QItemSelection& newSel, const QItemSelection& oldSel) {
Q_UNUSED(oldSel)
if (newSel.indexes().empty()) {
setActualCall(nullptr);
return ui->stackedWidget->setCurrentWidget(ui->welcomePage);
}
auto newIdx = newSel.indexes().first();
smartListCurrentChanged(newIdx, newIdx);
}
void
CallWidget::placeCall()
......
......@@ -91,6 +91,7 @@ private slots:
void callStateChanged(Call* call, Call::State previousState);
void findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec);
void smartListSelectionChanged(const QItemSelection& newSel, const QItemSelection& oldSel);
void smartListCurrentChanged(const QModelIndex &currentIdx, const QModelIndex &previousIdx);
void slotAccountMessageReceived(const QMap<QString,QString> message,ContactMethod* cm,Media::Media::Direction dir);
void onIncomingMessage(::Media::TextRecording* t, ContactMethod* cm);
void callChangedSlot();
......
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