diff --git a/sflphone-client-kde/src/CallTreeView.cpp b/sflphone-client-kde/src/CallTreeView.cpp index e6e3041710a08fc73e4891f9fae9cfc5f0747017..ebab89c543a3abdc157df4f38e768009d085f96e 100644 --- a/sflphone-client-kde/src/CallTreeView.cpp +++ b/sflphone-client-kde/src/CallTreeView.cpp @@ -112,9 +112,7 @@ void CallTreeView::removeCurrent() const CallTreeItem* CallTreeView::currentItem() { - QModelIndex index = selectionModel()->currentIndex(); - - CallTreeModel * treeModel = static_cast<CallTreeModel*>(model()); + QModelIndex index = selectionModel()->currentIndex(); CallTreeItem *item = treeModel->getItem(index); @@ -122,8 +120,12 @@ CallTreeItem* CallTreeView::currentItem() { return 0; } - return item; - + return item; +} + +CallTreeItem* CallTreeView::getItem(const QModelIndex &index) +{ + return treeModel->getItem(index); } void CallTreeView::setCurrentRow(int row) diff --git a/sflphone-client-kde/src/CallTreeView.h b/sflphone-client-kde/src/CallTreeView.h index dd0a50430419d4d88c7ddaaa5249ceb6182487e9..01db724feff177548b9678ad313a3ac068bb797f 100644 --- a/sflphone-client-kde/src/CallTreeView.h +++ b/sflphone-client-kde/src/CallTreeView.h @@ -47,6 +47,7 @@ public: void remove(QModelIndex & index) const; void removeCurrent() const; CallTreeItem* currentItem(); + CallTreeItem* getItem(const QModelIndex &index); void setCurrentRow(int row); int count(); @@ -55,6 +56,9 @@ public: Qt::DropActions supportedDropActions () const; private: CallTreeModel *treeModel; +signals: + void currentItemChanged(); + void itemChanged(); }; #endif // CALLTREE_VIEW_H diff --git a/sflphone-client-kde/src/SFLPhoneView.cpp b/sflphone-client-kde/src/SFLPhoneView.cpp index a6f1bcdf533eae95524a984b5c96f92d8e7e15ff..71f3de328c2893797e2b8b2ba76024506174c493 100644 --- a/sflphone-client-kde/src/SFLPhoneView.cpp +++ b/sflphone-client-kde/src/SFLPhoneView.cpp @@ -134,6 +134,13 @@ SFLPhoneView::SFLPhoneView(QWidget *parent) this, SLOT(updateStatusMessage())); connect(accountList, SIGNAL(accountListUpdated()), this, SLOT(updateWindowCallState())); + + connect(callTree, SIGNAL(currentItemChanged()), + this, SLOT(on_callTree_currentItemChanged())); + connect(callTree, SIGNAL(itemChanged()), + this, SLOT(on_callTree_itemChanged())); + connect(callTree, SIGNAL(itemDoubleClicked(const QModelIndex &)), + this, SLOT(on_callTree_itemDoubleClicked(const QModelIndex&))); } @@ -485,9 +492,11 @@ void SFLPhoneView::updateWindowCallState() CallTreeItem * item; bool transfer = false; - //tells whether the call is in recording position - bool recordActivated = false; + bool recordActivated = false; //tells whether the call is in recording position + enabledActions[SFLPhone::Mailbox] = accountInUse() && ! accountInUse()->getAccountDetail(ACCOUNT_MAILBOX).isEmpty(); + + if(stackedWidget_screen->currentWidget() == page_callList) { item = callTree->currentItem(); @@ -507,6 +516,7 @@ void SFLPhoneView::updateWindowCallState() { call_state state = call->getState(); recordActivated = call->getRecording(); + switch (state) { case CALL_STATE_INCOMING: @@ -552,7 +562,7 @@ void SFLPhoneView::updateWindowCallState() enabledActions[SFLPhone::Hold] = false; enabledActions[SFLPhone::Transfer] = false; enabledActions[SFLPhone::Record] = false; - break; + break; case CALL_STATE_TRANSFER: qDebug() << "Reached CALL_STATE_TRANSFER with call " << call->getCallId(); buttonIconFiles[SFLPhone::Accept] = ICON_EXEC_TRANSF; @@ -1002,21 +1012,22 @@ void SFLPhoneView::on_toolButton_sndVol_clicked(bool checked) } -void SFLPhoneView::on_listWidget_callList_currentItemChanged() +void SFLPhoneView::on_callTree_currentItemChanged() { - qDebug() << "on_listWidget_callList_currentItemChanged"; + qDebug() << "on_callTree_currentItemChanged"; updateWindowCallState(); } -void SFLPhoneView::on_listWidget_callList_itemChanged() +void SFLPhoneView::on_callTree_itemChanged() { - qDebug() << "on_listWidget_callList_itemChanged"; + qDebug() << "on_callTree_itemChanged"; stackedWidget_screen->setCurrentWidget(page_callList); } -void SFLPhoneView::on_listWidget_callList_itemDoubleClicked(CallTreeItem * item) +void SFLPhoneView::on_callTree_itemDoubleClicked(const QModelIndex &index) { - qDebug() << "on_listWidget_callList_itemDoubleClicked"; + qDebug() << "on_callTree_itemDoubleClicked"; + CallTreeItem *item = callTree->getItem(index); Call * call = item->call(); call_state state = call->getCurrentState(); switch(state) diff --git a/sflphone-client-kde/src/SFLPhoneView.h b/sflphone-client-kde/src/SFLPhoneView.h index 47b931edf1ad608c09895eedf0449925ddc02c7a..6683a1c4a1dfd9093ac7a0f5f16dc1b371651d24 100644 --- a/sflphone-client-kde/src/SFLPhoneView.h +++ b/sflphone-client-kde/src/SFLPhoneView.h @@ -170,21 +170,25 @@ private slots: * @param str the string sent by the user */ void typeString(QString str); + /** * Handles the behaviour when the user types a backspace * according to the current state (window, item selected...) */ void backspace(); + /** * Handles the behaviour when the user types escape * according to the current state (window, item selected...) */ void escape(); + /** * Handles the behaviour when the user types enter * according to the current state (window, item selected...) */ void enter(); + /** * Displays a message window with editable text of the selected * phone number in history or address book. @@ -206,12 +210,14 @@ private slots: * @param call the call to add to the call-list's listwidget */ CallTreeItem* addCallToCallList(Call * call); + /** * Adds the call's history-item to the call-history's listwidget. * This function doesn't add anything to the callList object. * @param call the past call to add to the call-history's listwidget */ CallTreeItem* addCallToCallHistory(Call * call); + /** * Adds the contact's item to the addressbook's listwidget. * @param contact the contact to add to the addressbook's listwidget @@ -223,6 +229,7 @@ private slots: * item's state. */ void updateWindowCallState(); + /** * Updates the history's search bar's display according to the current * text searched. @@ -312,11 +319,13 @@ public slots: void on_toolButton_recVol_clicked(bool checked); void on_toolButton_sndVol_clicked(bool checked); - void on_listWidget_callList_currentItemChanged(); - void on_listWidget_callList_itemChanged(); - void on_listWidget_callList_itemDoubleClicked(CallTreeItem * item); + void on_callTree_currentItemChanged(); + void on_callTree_itemChanged(); + void on_callTree_itemDoubleClicked(const QModelIndex &index); + void on_listWidget_callHistory_currentItemChanged(); void on_listWidget_callHistory_itemDoubleClicked(CallTreeItem * item); + void on_listWidget_addressBook_currentItemChanged(); void on_listWidget_addressBook_itemDoubleClicked(CallTreeItem * item);