From b07aec57a05674ecf9709e62fc242ff81c6f4781 Mon Sep 17 00:00:00 2001 From: Mathieu Leduc-Hamel <mlhamel@arak4.(none)> Date: Tue, 9 Feb 2010 16:30:12 -0500 Subject: [PATCH] [#2488] Reimplement missing signal --- sflphone-client-kde/src/CallTreeView.cpp | 12 ++++++---- sflphone-client-kde/src/CallTreeView.h | 4 ++++ sflphone-client-kde/src/SFLPhoneView.cpp | 29 ++++++++++++++++-------- sflphone-client-kde/src/SFLPhoneView.h | 15 +++++++++--- 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/sflphone-client-kde/src/CallTreeView.cpp b/sflphone-client-kde/src/CallTreeView.cpp index e6e3041710..ebab89c543 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 dd0a504304..01db724fef 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 a6f1bcdf53..71f3de328c 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 47b931edf1..6683a1c4a1 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); -- GitLab