From a6386982ebadf0ace46ccd3b55555303a85fd371 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> Date: Fri, 23 Sep 2011 11:54:31 -0400 Subject: [PATCH] Remove dead code --- kde/src/CallView.cpp | 2 +- kde/src/CallView.h | 4 +- kde/src/SFLPhone.cpp | 6 +- kde/src/SFLPhoneView.cpp | 366 +++++++++++--------------- kde/src/SFLPhoneView.h | 8 - kde/src/lib/CallModel.cpp | 15 -- kde/src/lib/CallModel.h | 33 +-- kde/src/lib/CallModel.hpp | 7 +- kde/src/ui/SFLPhoneView_base.ui | 38 +-- kde/src/widgets/ContactItemWidget.cpp | 2 +- 10 files changed, 183 insertions(+), 298 deletions(-) diff --git a/kde/src/CallView.cpp b/kde/src/CallView.cpp index 15f6bc647a..10896cf233 100644 --- a/kde/src/CallView.cpp +++ b/kde/src/CallView.cpp @@ -5,7 +5,7 @@ #include <QtGui/QInputDialog> ///Retrieve current and older calls from the daemon, fill history and the calls TreeView and enable drag n' drop -CallView::CallView(ModelType type, QWidget* parent) : QTreeWidget(parent), TreeWidgetCallModel(type) +CallView::CallView(QWidget* parent, ModelType type) : QTreeWidget(parent), TreeWidgetCallModel(type) { if (type == ActiveCall) initCall(); diff --git a/kde/src/CallView.h b/kde/src/CallView.h index 717903014b..5fe2c97f03 100644 --- a/kde/src/CallView.h +++ b/kde/src/CallView.h @@ -24,10 +24,10 @@ class CallTreeItemDelegate : public QItemDelegate typedef CallModel<CallTreeItem*,QTreeWidgetItem*> TreeWidgetCallModel; -class CallView : private QTreeWidget, public TreeWidgetCallModel { +class CallView : public QTreeWidget, public TreeWidgetCallModel { Q_OBJECT public: - CallView(ModelType type, QWidget* parent =0); + CallView(QWidget* parent =0,ModelType type = ActiveCall); bool selectItem(Call* item); Call* getCurrentItem(); bool removeItem(Call* item); diff --git a/kde/src/SFLPhone.cpp b/kde/src/SFLPhone.cpp index 286724caff..a8da9f520d 100755 --- a/kde/src/SFLPhone.cpp +++ b/kde/src/SFLPhone.cpp @@ -74,7 +74,10 @@ bool SFLPhone::initialize() qDebug() << "Already initialized."; return false; } - + + //Keep these template paramater or the static attribute wont be share between this and the call view, they need to be + CallModel<CallTreeItem*,QTreeWidgetItem*>* histoModel = new CallModel<CallTreeItem*,QTreeWidgetItem*>(CallModel<CallTreeItem*,QTreeWidgetItem*>::History); + histoModel->initHistory(); ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); // accept dnd @@ -130,7 +133,6 @@ bool SFLPhone::initialize() setObjectNames(); QMetaObject::connectSlotsByName(this); - m_pView->on_stackedWidget_screen_currentChanged(SCREEN_MAIN); m_pView->loadWindow(); move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2); diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp index 83d6f041d0..61a2b1f0e1 100755 --- a/kde/src/SFLPhoneView.cpp +++ b/kde/src/SFLPhoneView.cpp @@ -56,10 +56,7 @@ using namespace KABC; SFLPhoneView::SFLPhoneView(QWidget *parent) : QWidget(parent), - wizard(0), - addressBookTree(new CallView(CallView::Address)), - callTreeModel(new CallView(CallView::ActiveCall)), - historyTreeModel(new CallView(CallView::History)) + wizard(0) { setupUi(this); @@ -68,18 +65,10 @@ SFLPhoneView::SFLPhoneView(QWidget *parent) errorWindow = new QErrorMessage(this); callTreeModel->setTitle("Calls"); - historyTreeModel->setTitle("History"); - - page_callList->layout()->addWidget(callTreeModel->getWidget()); - page_callHistory->layout()->addWidget(historyTreeModel->getWidget()); - - historyLoaded = false; QPalette pal = QPalette(palette()); pal.setColor(QPalette::AlternateBase, Qt::lightGray); setPalette(pal); - - stackedWidget_screen->setCurrentWidget(page_callList); //BEGIN Port to CallModel connect(&callManager, SIGNAL(callStateChanged(const QString &, const QString &)), @@ -123,7 +112,7 @@ SFLPhoneView::SFLPhoneView(QWidget *parent) this, SLOT(on_callTree_itemDoubleClicked(const QModelIndex&))); -} +} @@ -163,58 +152,54 @@ void SFLPhoneView::typeString(QString str) { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); - if(stackedWidget_screen->currentWidget() == page_callList) { - Call* call = callTreeModel->getCurrentItem(); - callManager.playDTMF(str); - Call *currentCall = 0; - Call *candidate = 0; - - if(call) { - if(call->getState() == CALL_STATE_CURRENT) { - currentCall = call; - } + Call* call = callTreeModel->getCurrentItem(); + callManager.playDTMF(str); + Call *currentCall = 0; + Call *candidate = 0; + + if(call) { + if(call->getState() == CALL_STATE_CURRENT) { + currentCall = call; } + } - foreach (Call* call2, callTreeModel->getCallList()) { - if(currentCall != call2 && call2->getState() == CALL_STATE_CURRENT) { - action(call2, CALL_ACTION_HOLD); - } - else if(call2->getState() == CALL_STATE_DIALING) { - candidate = call2; - } + foreach (Call* call2, callTreeModel->getCallList()) { + if(currentCall != call2 && call2->getState() == CALL_STATE_CURRENT) { + action(call2, CALL_ACTION_HOLD); } - - if(!currentCall && !candidate) { - qDebug() << "Typing when no item is selected. Opening an item."; - candidate = callTreeModel->addDialingCall(); + else if(call2->getState() == CALL_STATE_DIALING) { + candidate = call2; } + } - if(!currentCall && candidate) { - candidate->appendText(str); - } + if(!currentCall && !candidate) { + qDebug() << "Typing when no item is selected. Opening an item."; + candidate = callTreeModel->addDialingCall(); + } + + if(!currentCall && candidate) { + candidate->appendText(str); } } void SFLPhoneView::backspace() { qDebug() << "backspace"; - if(stackedWidget_screen->currentWidget() == page_callList) { - qDebug() << "In call list."; - Call* call = callTreeModel->getCurrentItem(); - if(!call) { - qDebug() << "Error : Backspace on unexisting call."; - } - else { - call->backspaceItemText(); - if(call->getState() == CALL_STATE_OVER) { - if (callTreeModel->getCurrentItem()) - callTreeModel->removeItem(callTreeModel->getCurrentItem()); - - if(call->getHistoryState() != NONE) { - //historyTree->insert(call); - historyTreeModel->addCall(call); - } - } + qDebug() << "In call list."; + Call* call = callTreeModel->getCurrentItem(); + if(!call) { + qDebug() << "Error : Backspace on unexisting call."; + } + else { + call->backspaceItemText(); + if(call->getState() == CALL_STATE_OVER) { + if (callTreeModel->getCurrentItem()) + callTreeModel->removeItem(callTreeModel->getCurrentItem()); + +// if(call->getHistoryState() != NONE) { +// //historyTree->insert(call); +// historyTreeModel->addCall(call); +// } } } } @@ -222,19 +207,17 @@ void SFLPhoneView::backspace() void SFLPhoneView::escape() { qDebug() << "escape"; - if(stackedWidget_screen->currentWidget() == page_callList ) { - qDebug() << "In call list."; - Call* call = callTreeModel->getCurrentItem(); - if(!call) { - //qDebug() << "Escape when no item is selected. Doing nothing."; + qDebug() << "In call list."; + Call* call = callTreeModel->getCurrentItem(); + if(!call) { + //qDebug() << "Escape when no item is selected. Doing nothing."; + } + else { + if(call->getState() == CALL_STATE_TRANSFER || call->getState() == CALL_STATE_TRANSF_HOLD) { + action(call, CALL_ACTION_TRANSFER); } else { - if(call->getState() == CALL_STATE_TRANSFER || call->getState() == CALL_STATE_TRANSF_HOLD) { - action(call, CALL_ACTION_TRANSFER); - } - else { - action(call, CALL_ACTION_REFUSE); - } + action(call, CALL_ACTION_REFUSE); } } } @@ -242,20 +225,18 @@ void SFLPhoneView::escape() void SFLPhoneView::enter() { qDebug() << "enter"; - if(stackedWidget_screen->currentWidget() == page_callList ) { - qDebug() << "In call list."; - Call* call = callTreeModel->getCurrentItem(); - if(!call) { - qDebug() << "Error : Enter on unexisting call."; + qDebug() << "In call list."; + Call* call = callTreeModel->getCurrentItem(); + if(!call) { + qDebug() << "Error : Enter on unexisting call."; + } + else { + int state = call->getState(); + if(state == CALL_STATE_INCOMING || state == CALL_STATE_DIALING || state == CALL_STATE_TRANSFER || state == CALL_STATE_TRANSF_HOLD) { + action(call, CALL_ACTION_ACCEPT); } else { - int state = call->getState(); - if(state == CALL_STATE_INCOMING || state == CALL_STATE_DIALING || state == CALL_STATE_TRANSFER || state == CALL_STATE_TRANSF_HOLD) { - action(call, CALL_ACTION_ACCEPT); - } - else { - qDebug() << "Enter when call selected not in appropriate state. Doing nothing."; - } + qDebug() << "Enter when call selected not in appropriate state. Doing nothing."; } } } @@ -296,90 +277,87 @@ void SFLPhoneView::updateWindowCallState() enabledActions[SFLPhone::Mailbox] = CallView::getCurrentAccount() && ! CallView::getCurrentAccount()->getAccountDetail(ACCOUNT_MAILBOX).isEmpty(); - - if(stackedWidget_screen->currentWidget() == page_callList) { - call = callTreeModel->getCurrentItem(); - if (!call) { - qDebug() << "No item selected."; - enabledActions[SFLPhone::Refuse] = false; - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - enabledActions[SFLPhone::Record] = false; - } - else { - call_state state = call->getState(); - recordActivated = call->getRecording(); - - switch (state) { - case CALL_STATE_INCOMING: - qDebug() << "Reached CALL_STATE_INCOMING with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Accept] = ICON_ACCEPT; - buttonIconFiles[SFLPhone::Refuse] = ICON_REFUSE; - actionTexts[SFLPhone::Accept] = ACTION_LABEL_ACCEPT; - actionTexts[SFLPhone::Refuse] = ACTION_LABEL_REFUSE; - break; - case CALL_STATE_RINGING: - qDebug() << "Reached CALL_STATE_RINGING with call " << call->getCallId(); - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - break; - case CALL_STATE_CURRENT: - qDebug() << "details = " << CallManagerInterfaceSingleton::getInstance().getCallDetails(call->getCallId()).value(); - qDebug() << "Reached CALL_STATE_CURRENT with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Record] = ICON_REC_DEL_ON; - break; - case CALL_STATE_DIALING: - qDebug() << "Reached CALL_STATE_DIALING with call " << call->getCallId(); - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - enabledActions[SFLPhone::Record] = false; - actionTexts[SFLPhone::Accept] = ACTION_LABEL_ACCEPT; - buttonIconFiles[SFLPhone::Accept] = ICON_ACCEPT; - break; - case CALL_STATE_HOLD: - qDebug() << "Reached CALL_STATE_HOLD with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Hold] = ICON_UNHOLD; - actionTexts[SFLPhone::Hold] = ACTION_LABEL_UNHOLD; - break; - case CALL_STATE_FAILURE: - qDebug() << "Reached CALL_STATE_FAILURE with call " << call->getCallId(); - enabledActions[SFLPhone::Accept] = false; - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - enabledActions[SFLPhone::Record] = false; - break; - case CALL_STATE_BUSY: - qDebug() << "Reached CALL_STATE_BUSY with call " << call->getCallId(); - enabledActions[SFLPhone::Accept] = false; - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - enabledActions[SFLPhone::Record] = false; - break; - case CALL_STATE_TRANSFER: - qDebug() << "Reached CALL_STATE_TRANSFER with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Accept] = ICON_EXEC_TRANSF; - actionTexts[SFLPhone::Transfer] = ACTION_LABEL_GIVE_UP_TRANSF; - transfer = true; - buttonIconFiles[SFLPhone::Record] = ICON_REC_DEL_ON; - break; - case CALL_STATE_TRANSF_HOLD: - qDebug() << "Reached CALL_STATE_TRANSF_HOLD with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Accept] = ICON_EXEC_TRANSF; - buttonIconFiles[SFLPhone::Hold] = ICON_UNHOLD; - actionTexts[SFLPhone::Transfer] = ACTION_LABEL_GIVE_UP_TRANSF; - actionTexts[SFLPhone::Hold] = ACTION_LABEL_UNHOLD; - transfer = true; - break; - case CALL_STATE_OVER: - qDebug() << "Error : Reached CALL_STATE_OVER with call " << call->getCallId() << "!"; - break; - case CALL_STATE_ERROR: - qDebug() << "Error : Reached CALL_STATE_ERROR with call " << call->getCallId() << "!"; - break; - default: - qDebug() << "Error : Reached unexisting state for call " << call->getCallId() << "!"; - break; - } + call = callTreeModel->getCurrentItem(); + if (!call) { + qDebug() << "No item selected."; + enabledActions[SFLPhone::Refuse] = false; + enabledActions[SFLPhone::Hold] = false; + enabledActions[SFLPhone::Transfer] = false; + enabledActions[SFLPhone::Record] = false; + } + else { + call_state state = call->getState(); + recordActivated = call->getRecording(); + + switch (state) { + case CALL_STATE_INCOMING: + qDebug() << "Reached CALL_STATE_INCOMING with call " << call->getCallId(); + buttonIconFiles[SFLPhone::Accept] = ICON_ACCEPT; + buttonIconFiles[SFLPhone::Refuse] = ICON_REFUSE; + actionTexts[SFLPhone::Accept] = ACTION_LABEL_ACCEPT; + actionTexts[SFLPhone::Refuse] = ACTION_LABEL_REFUSE; + break; + case CALL_STATE_RINGING: + qDebug() << "Reached CALL_STATE_RINGING with call " << call->getCallId(); + enabledActions[SFLPhone::Hold] = false; + enabledActions[SFLPhone::Transfer] = false; + break; + case CALL_STATE_CURRENT: + qDebug() << "details = " << CallManagerInterfaceSingleton::getInstance().getCallDetails(call->getCallId()).value(); + qDebug() << "Reached CALL_STATE_CURRENT with call " << call->getCallId(); + buttonIconFiles[SFLPhone::Record] = ICON_REC_DEL_ON; + break; + case CALL_STATE_DIALING: + qDebug() << "Reached CALL_STATE_DIALING with call " << call->getCallId(); + enabledActions[SFLPhone::Hold] = false; + enabledActions[SFLPhone::Transfer] = false; + enabledActions[SFLPhone::Record] = false; + actionTexts[SFLPhone::Accept] = ACTION_LABEL_ACCEPT; + buttonIconFiles[SFLPhone::Accept] = ICON_ACCEPT; + break; + case CALL_STATE_HOLD: + qDebug() << "Reached CALL_STATE_HOLD with call " << call->getCallId(); + buttonIconFiles[SFLPhone::Hold] = ICON_UNHOLD; + actionTexts[SFLPhone::Hold] = ACTION_LABEL_UNHOLD; + break; + case CALL_STATE_FAILURE: + qDebug() << "Reached CALL_STATE_FAILURE with call " << call->getCallId(); + enabledActions[SFLPhone::Accept] = false; + enabledActions[SFLPhone::Hold] = false; + enabledActions[SFLPhone::Transfer] = false; + enabledActions[SFLPhone::Record] = false; + break; + case CALL_STATE_BUSY: + qDebug() << "Reached CALL_STATE_BUSY with call " << call->getCallId(); + enabledActions[SFLPhone::Accept] = false; + enabledActions[SFLPhone::Hold] = false; + enabledActions[SFLPhone::Transfer] = false; + enabledActions[SFLPhone::Record] = false; + break; + case CALL_STATE_TRANSFER: + qDebug() << "Reached CALL_STATE_TRANSFER with call " << call->getCallId(); + buttonIconFiles[SFLPhone::Accept] = ICON_EXEC_TRANSF; + actionTexts[SFLPhone::Transfer] = ACTION_LABEL_GIVE_UP_TRANSF; + transfer = true; + buttonIconFiles[SFLPhone::Record] = ICON_REC_DEL_ON; + break; + case CALL_STATE_TRANSF_HOLD: + qDebug() << "Reached CALL_STATE_TRANSF_HOLD with call " << call->getCallId(); + buttonIconFiles[SFLPhone::Accept] = ICON_EXEC_TRANSF; + buttonIconFiles[SFLPhone::Hold] = ICON_UNHOLD; + actionTexts[SFLPhone::Transfer] = ACTION_LABEL_GIVE_UP_TRANSF; + actionTexts[SFLPhone::Hold] = ACTION_LABEL_UNHOLD; + transfer = true; + break; + case CALL_STATE_OVER: + qDebug() << "Error : Reached CALL_STATE_OVER with call " << call->getCallId() << "!"; + break; + case CALL_STATE_ERROR: + qDebug() << "Error : Reached CALL_STATE_ERROR with call " << call->getCallId() << "!"; + break; + default: + qDebug() << "Error : Reached unexisting state for call " << call->getCallId() << "!"; + break; } } @@ -623,7 +601,6 @@ void SFLPhoneView::on_callTree_currentItemChanged() void SFLPhoneView::on_callTree_itemChanged() { qDebug() << "on_callTree_itemChanged"; - stackedWidget_screen->setCurrentWidget(page_callList); } void SFLPhoneView::on_callTree_itemDoubleClicked(QTreeWidgetItem* call, int column) @@ -646,20 +623,6 @@ Q_UNUSED(column) // } } -void SFLPhoneView::on_stackedWidget_screen_currentChanged(int index) -{ - qDebug() << "on_stackedWidget_screen_currentChanged"; - switch(index) { - case SCREEN_MAIN: - qDebug() << "Switched to call list screen."; - emit windowTitleChangeAsked(i18n("SFLphone") + " - " + i18n("Main screen")); - break; - default: - qDebug() << "Error : reached an unknown index \"" << index << "\" with stackedWidget_screen."; - break; - } -} - void SFLPhoneView::contextMenuEvent(QContextMenuEvent *event) { KMenu menu(this); @@ -745,36 +708,32 @@ void SFLPhoneView::accountCreationWizard() void SFLPhoneView::accept() { - if(stackedWidget_screen->currentWidget() == page_callList) { - Call* call = callTreeModel->getCurrentItem(); - if(!call) { - qDebug() << "Calling when no item is selected. Opening an item."; + Call* call = callTreeModel->getCurrentItem(); + if(!call) { + qDebug() << "Calling when no item is selected. Opening an item."; + callTreeModel->addDialingCall(); + } + else { + int state = call->getState(); + if(state == CALL_STATE_RINGING || state == CALL_STATE_CURRENT || state == CALL_STATE_HOLD || state == CALL_STATE_BUSY) + { + qDebug() << "Calling when item currently ringing, current, hold or busy. Opening an item."; callTreeModel->addDialingCall(); } else { - int state = call->getState(); - if(state == CALL_STATE_RINGING || state == CALL_STATE_CURRENT || state == CALL_STATE_HOLD || state == CALL_STATE_BUSY) - { - qDebug() << "Calling when item currently ringing, current, hold or busy. Opening an item."; - callTreeModel->addDialingCall(); - } - else { - action(call, CALL_ACTION_ACCEPT); - } + action(call, CALL_ACTION_ACCEPT); } } } void SFLPhoneView::refuse() { - if(stackedWidget_screen->currentWidget() == page_callList) { - Call* call = callTreeModel->getCurrentItem(); - if(!call) { - qDebug() << "Error : Hanging up when no item selected. Should not happen."; - } - else { - action(call, CALL_ACTION_REFUSE); - } + Call* call = callTreeModel->getCurrentItem(); + if(!call) { + qDebug() << "Error : Hanging up when no item selected. Should not happen."; + } + else { + action(call, CALL_ACTION_REFUSE); } } @@ -902,19 +861,6 @@ void SFLPhoneView::on1_audioManagerChanged() void SFLPhoneView::changeScreen(int screen) { qDebug() << "changeScreen"; - switch(screen) { - case SCREEN_MAIN: - stackedWidget_screen->setCurrentWidget(page_callList); - break; - case SCREEN_HISTORY: - stackedWidget_screen->setCurrentWidget(page_callHistory); - break; - case SCREEN_ADDRESS: - stackedWidget_screen->setCurrentWidget(page_addressBook); - break; - default: - break; - } updateWindowCallState(); emit screenChanged(screen); } diff --git a/kde/src/SFLPhoneView.h b/kde/src/SFLPhoneView.h index 49a8169eac..80036b9d23 100755 --- a/kde/src/SFLPhoneView.h +++ b/kde/src/SFLPhoneView.h @@ -66,12 +66,6 @@ private: //CallList * callList; QErrorMessage * errorWindow; //Account used prioritary if defined and registered. If not, the first registered account in accountList is used. - - bool historyLoaded; - - CallView* addressBookTree; - CallView* callTreeModel; - CallView* historyTreeModel; protected: @@ -259,8 +253,6 @@ public slots: void on_callTree_itemChanged(); void on_callTree_itemDoubleClicked(QTreeWidgetItem* item, int column); - void on_stackedWidget_screen_currentChanged(int index); - void on1_callStateChanged(const QString &callID, const QString &state); void on1_error(MapStringString details); void on1_incomingCall(const QString &accountID, const QString &callID/*, const QString &from*/); diff --git a/kde/src/lib/CallModel.cpp b/kde/src/lib/CallModel.cpp index 71653f719a..1ab0b33170 100644 --- a/kde/src/lib/CallModel.cpp +++ b/kde/src/lib/CallModel.cpp @@ -19,18 +19,3 @@ ***************************************************************************/ #include <CallModel.h> - - - -//template<> QString CallModel<InternalCallModelStruct>::priorAccountId; -//template<> AccountList* CallModel<InternalCallModelStruct>::accountList; -//template<> bool CallModel<InternalCallModelStruct>::instanceInit(false); -//template<> bool CallModel<InternalCallModelStruct>::callInit(false); -//template<> bool CallModel<InternalCallModelStruct>::historyInit(false); - -//template<> QHash<QString, Call*> CallModel<InternalCallModelStruct>::activeCalls; -//template<> QHash<QString, Call*> CallModel<InternalCallModelStruct>::historyCalls; -//template<> QHash<Call*, InternalCallModelStruct*> CallModel<InternalCallModelStruct>::privateCallList_call; -//template<> QHash<QString, InternalCallModelStruct*> CallModel<InternalCallModelStruct>::privateCallList_callId; - - diff --git a/kde/src/lib/CallModel.h b/kde/src/lib/CallModel.h index 7e7da8a3b2..f7294806b8 100644 --- a/kde/src/lib/CallModel.h +++ b/kde/src/lib/CallModel.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #ifndef CALL_MODEL_H #define CALL_MODEL_H @@ -44,20 +44,6 @@ * @note This model intend to be reimplemented by the view, not used alone * @note Most of the member are static to preserve ressources and QObject::connect() */ - - -// template <typename T, typename Index> class CallModel; -// template <typename Widget, typename Index> class InternalCallModelStruct : public QModelIndex { -// -// friend class CallModel<Widget,Index>; -// //InternalCallModelStruct* parent; -// Widget* call; -// Call* call_real; -// Index* treeItem; //For the view -// QList<InternalCallModelStruct*> children; //For the view -// bool conference; -// }; - template <typename CallWidget, typename Index> class LIB_EXPORT CallModel { //Q_OBJECT @@ -71,6 +57,9 @@ class LIB_EXPORT CallModel { CallModel(ModelType type); virtual ~CallModel() {} + virtual bool initCall(); + virtual bool initHistory(); + virtual Call* addCall(Call* call, Call* parent =0); int size(); Call* findCallByCallId(QString callId); @@ -148,17 +137,13 @@ class LIB_EXPORT CallModel { QList<InternalCallModelStruct*> children; //For the view bool conference; }; - typedef QHash<Call*, InternalCallModelStruct*> InternalCall; - typedef QHash<QString, InternalCallModelStruct*> InternalCallId; + typedef QHash<Call*, InternalCallModelStruct*> InternalCall; + typedef QHash<QString, InternalCallModelStruct*> InternalCallId; typedef QHash<CallWidget, InternalCallModelStruct*> InternalWidget; - typedef QHash<Index, InternalCallModelStruct*> InternalIndex; + typedef QHash<Index, InternalCallModelStruct*> InternalIndex; static QHash<QString, Call*> activeCalls; - static QHash<QString, Call*> historyCalls;/* - static QHash<Call*, InternalCallModelStruct<T, Index>* > privateCallList_call; - static QHash<QString, InternalCallModelStruct<T, Index>* > privateCallList_callId; - static QHash<T, InternalCallModelStruct<T, Index>* > privateCallList_widget; - static QHash<Index, InternalCallModelStruct<T, Index>* > privateCallList_index;*/ + static QHash<QString, Call*> historyCalls; static InternalCall privateCallList_call; static InternalCallId privateCallList_callId; @@ -170,8 +155,6 @@ class LIB_EXPORT CallModel { static AccountList* accountList; static bool callInit; static bool historyInit; - virtual bool initCall(); - virtual bool initHistory(); private: static bool instanceInit; diff --git a/kde/src/lib/CallModel.hpp b/kde/src/lib/CallModel.hpp index a04ec7407a..c00046d985 100644 --- a/kde/src/lib/CallModel.hpp +++ b/kde/src/lib/CallModel.hpp @@ -67,11 +67,12 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>:: //Fill the history list //@warning This solution wont scale to multiple call or history model implementation. Some static addCall + foreach for each call would be needed if this case ever become unavoidable template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::initHistory() -{ - if (!historyInit) { +{qDebug() << "\n\n\n\nInit history"; + if (!historyInit) {qDebug() << "In if"; ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); QStringList historyMap = configurationManager.getHistory().value(); - foreach (QString historyCallId, historyMap) { + qDebug() << historyMap.size(); + foreach (QString historyCallId, historyMap) {qDebug() << "Here"; QStringList param = historyCallId.split("|"); if (param.count() <= 10) { //If this ever change, look at the gnome client diff --git a/kde/src/ui/SFLPhoneView_base.ui b/kde/src/ui/SFLPhoneView_base.ui index ceb8fb3b24..c564894726 100755 --- a/kde/src/ui/SFLPhoneView_base.ui +++ b/kde/src/ui/SFLPhoneView_base.ui @@ -15,43 +15,13 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QStackedWidget" name="stackedWidget_screen"> + <widget class="CallView" name="callTreeModel" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="currentIndex"> - <number>1</number> - </property> - <widget class="QWidget" name="page_callList"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"/> - </widget> - <widget class="QWidget" name="page_callHistory"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"/> - </widget> - <widget class="QWidget" name="page_addressBook"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QVBoxLayout" name="verticalLayout_5"/> - </widget> </widget> </item> <item> @@ -199,6 +169,12 @@ <header>widgets/Dialpad.h</header> <container>1</container> </customwidget> + <customwidget> + <class>CallView</class> + <extends>QWidget</extends> + <header location="global">CallView.h</header> + <container>1</container> + </customwidget> </customwidgets> <resources> <include location="../qrc/resources.qrc"/> diff --git a/kde/src/widgets/ContactItemWidget.cpp b/kde/src/widgets/ContactItemWidget.cpp index 3b580fddaf..88fa06185f 100644 --- a/kde/src/widgets/ContactItemWidget.cpp +++ b/kde/src/widgets/ContactItemWidget.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #include <QtCore/QStringList> #include <QtCore/QMimeData> -- GitLab