diff --git a/callwidget.cpp b/callwidget.cpp index 5f44e8f37847af588207dbb499b9f2ec8287de3b..297616a110c50d0d05fb63e5586dcdb06a83e8b6 100644 --- a/callwidget.cpp +++ b/callwidget.cpp @@ -172,26 +172,11 @@ CallWidget::CallWidget(QWidget* parent) : connect(ui->smartList, &SmartList::btnVideoClicked, this, &CallWidget::btnComBarVideoClicked); - connect(RecentModel::instance().selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - 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()) { - auto idx = selected.indexes().first(); - auto realIdx = RecentModel::instance().peopleProxy()->mapFromSource(idx); - ui->smartList->selectionModel()->setCurrentIndex(realIdx, QItemSelectionModel::ClearAndSelect); - } else - ui->smartList->clearSelection(); - }); - connect(&NameDirectory::instance(), SIGNAL(registeredNameFound(const Account*,NameDirectory::LookupStatus,const QString&,const QString&)), this, SLOT(contactLineEdit_registeredNameFound(const Account*,NameDirectory::LookupStatus,const QString&,const QString&))); @@ -616,33 +601,21 @@ CallWidget::smartListCurrentChanged(const QModelIndex ¤tIdx, const QModelI if (not currentIdx.isValid()) return; + //catch call of current index auto currentIdxCall = RecentModel::instance().getActiveCall(currentIdx); - if (currentIdxCall && currentIdxCall != actualCall_) { + + if (currentIdxCall && currentIdxCall != actualCall_) { //if it is different from actual call, switch between the two setActualCall(currentIdxCall); - } else if (currentIdxCall == nullptr){ + } else if (currentIdxCall == nullptr){ // if there is no call attached to this smartlist index (contact tab) setActualCall(nullptr); - ui->instantMessagingWidget->hide(); - showIMOutOfCall(currentIdx); - } else { + showIMOutOfCall(currentIdx); //change page to messaging page with correct behaviour + } else { // if non defined behaviour disconnect instant messaging and return to welcome page setActualCall(nullptr); - ui->instantMessagingWidget->hide(); if (imConnection_) disconnect(imConnection_); 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() diff --git a/callwidget.h b/callwidget.h index 99a1cc2345cbcd7bdc690d1722f10a781db16757..274cfd984c63d17fa876f8120aa60b9ac9f1a4e8 100644 --- a/callwidget.h +++ b/callwidget.h @@ -90,7 +90,6 @@ private slots: void callIncoming(Call* call); 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 ¤tIdx, const QModelIndex &previousIdx); void slotAccountMessageReceived(const QMap<QString,QString> message,ContactMethod* cm,Media::Media::Direction dir); void onIncomingMessage(::Media::TextRecording* t, ContactMethod* cm);