Commit 8f2b65ee authored by Emmanuel Lepage's avatar Emmanuel Lepage

Restore and improve support for Call history

parent 7ef79e87
......@@ -27,6 +27,7 @@ SET( sflphone_client_kde_SRCS
AccountWizard.cpp
AccountItemWidget.cpp
widgets/CallTreeItem.cpp
widgets/HistoryTreeItem.cpp
ActionSetAccountFirst.cpp
conf/ConfigurationDialog.cpp
conf/dlggeneral.cpp
......
......@@ -41,7 +41,7 @@ SFLPhone* SFLPhone::m_sApp = NULL;
SFLPhone::SFLPhone(QWidget *parent)
: KXmlGuiWindow(parent),
initialized_(false),
view(new SFLPhoneView(this))
m_pView(new SFLPhoneView(this))
{
setupActions();
m_sApp = this;
......@@ -52,6 +52,15 @@ SFLPhone* SFLPhone::app()
return m_sApp;
}
SFLPhoneView* SFLPhone::view()
{
return m_pView;
}
CallView* SFLPhone::model()
{
return m_pView->model();
}
SFLPhone::~SFLPhone()
{
saveState();
......@@ -73,25 +82,26 @@ bool SFLPhone::initialize()
addDockWidget(Qt::TopDockWidgetArea,m_pContactCD);
// tell the KXmlGuiWindow that this is indeed the main widget
//setCentralWidget(view);
//setCentralWidget(m_pView);
m_pCentralDW = new QDockWidget(this);
m_pCentralDW->setWidget(view);
m_pCentralDW->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
m_pCentralDW->setWidget(m_pView);
m_pCentralDW->setWindowTitle("Call");
m_pCentralDW->setFeatures(QDockWidget::NoDockWidgetFeatures);
m_pView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
m_pCentralDW->setStyleSheet("\
QDockWidget::title {\
display:none;\
margin:0px;\
padding:0px;\
spacing:0px;\
max-height:0px;\
}\
\
QDockWidget::title {\
margin:0px;\
padding:0px;\
spacing:0px;\
max-height:0px;\
}\
\
");
m_pCentralDW->setTitleBarWidget(new QWidget());
m_pCentralDW->setContentsMargins(0,0,0,0);
view->setContentsMargins(0,0,0,0);
m_pView->setContentsMargins(0,0,0,0);
addDockWidget(Qt::TopDockWidgetArea,m_pCentralDW);
......@@ -118,8 +128,8 @@ bool SFLPhone::initialize()
setObjectNames();
QMetaObject::connectSlotsByName(this);
view->on_stackedWidget_screen_currentChanged(SCREEN_MAIN);
view->loadWindow();
m_pView->on_stackedWidget_screen_currentChanged(SCREEN_MAIN);
m_pView->loadWindow();
move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2);
//if( ! configurationManager.isStartHidden()) {
......@@ -137,7 +147,7 @@ bool SFLPhone::initialize()
void SFLPhone::setObjectNames()
{
view->setObjectName("view");
m_pView->setObjectName("m_pView");
statusBar()->setObjectName("statusBar");
trayIcon->setObjectName("trayIcon");
}
......@@ -177,7 +187,7 @@ void SFLPhone::setupActions()
action_close = KStandardAction::close(this, SLOT(close()), this);
action_quit = KStandardAction::quit(this, SLOT(quitButton()), this);
action_configureSflPhone = KStandardAction::preferences(view, SLOT(configureSflPhone()), this);
action_configureSflPhone = KStandardAction::preferences(m_pView, SLOT(configureSflPhone()), this);
action_configureSflPhone->setText(i18n("Configure SFLphone"));
action_displayVolumeControls = new KAction(KIcon(QIcon(ICON_DISPLAY_VOLUME_CONSTROLS)), i18n("Display volume controls"), this);
......@@ -189,16 +199,16 @@ void SFLPhone::setupActions()
action_displayDialpad->setChecked(/*configurationManager.getDialpad()*/true);
action_accountCreationWizard = new KAction(i18n("Account creation wizard"), this);
connect(action_accept, SIGNAL(triggered()), view, SLOT(accept()));
connect(action_refuse, SIGNAL(triggered()), view, SLOT(refuse()));
connect(action_hold, SIGNAL(triggered()), view, SLOT(hold()));
connect(action_transfer, SIGNAL(triggered()), view, SLOT(transfer()));
connect(action_record, SIGNAL(triggered()), view, SLOT(record()));
connect(action_screen, SIGNAL(triggered(QAction *)), this, SLOT(updateScreen(QAction *)));
connect(action_mailBox, SIGNAL(triggered()), view, SLOT(mailBox()));
connect(action_displayVolumeControls, SIGNAL(toggled(bool)), view, SLOT(displayVolumeControls(bool)));
connect(action_displayDialpad, SIGNAL(toggled(bool)), view, SLOT(displayDialpad(bool)));
connect(action_accountCreationWizard, SIGNAL(triggered()), view, SLOT(accountCreationWizard()));
connect(action_accept, SIGNAL(triggered()), m_pView, SLOT(accept()));
connect(action_refuse, SIGNAL(triggered()), m_pView, SLOT(refuse()));
connect(action_hold, SIGNAL(triggered()), m_pView, SLOT(hold()));
connect(action_transfer, SIGNAL(triggered()), m_pView, SLOT(transfer()));
connect(action_record, SIGNAL(triggered()), m_pView, SLOT(record()));
connect(action_screen, SIGNAL(triggered(QAction *)), this , SLOT(updateScreen(QAction *)));
connect(action_mailBox, SIGNAL(triggered()), m_pView, SLOT(mailBox()));
connect(action_displayVolumeControls, SIGNAL(toggled(bool)), m_pView, SLOT(displayVolumeControls(bool)));
connect(action_displayDialpad, SIGNAL(toggled(bool)), m_pView, SLOT(displayDialpad(bool)));
connect(action_accountCreationWizard, SIGNAL(triggered()), m_pView, SLOT(accountCreationWizard()));
action_screen->addAction(action_main);
action_screen->addAction(action_history);
......@@ -245,7 +255,7 @@ void SFLPhone::setupActions()
SFLPhoneView * SFLPhone::getView()
{
return view;
return m_pView;
}
bool SFLPhone::queryClose()
......@@ -258,12 +268,12 @@ bool SFLPhone::queryClose()
void SFLPhone::quitButton()
{
InstanceInterface & instance = InstanceInterfaceSingleton::getInstance();
//qDebug() << "quitButton : " << view->callTree->count() << " calls open.";
//qDebug() << "quitButton : " << m_pView->callTree->count() << " calls open.";
//if(view->callTree->count() > 0 && instance.getRegistrationCount() <= 1) {
//if(m_pView->callTree->count() > 0 && instance.getRegistrationCount() <= 1) {
//qDebug() << "Attempting to quit when still having some calls open.";
//}
view->saveState();
m_pView->saveState();
instance.Unregister(getpid());
qApp->quit();
}
......@@ -293,21 +303,21 @@ void SFLPhone::changeEvent(QEvent* event)
}
}
void SFLPhone::on_view_statusMessageChangeAsked(const QString & message)
void SFLPhone::on_m_pView_statusMessageChangeAsked(const QString & message)
{
qDebug() << "on_view_statusMessageChangeAsked : " + message;
qDebug() << "on_m_pView_statusMessageChangeAsked : " + message;
statusBarWidget->setText(message);
}
void SFLPhone::on_view_windowTitleChangeAsked(const QString & message)
void SFLPhone::on_m_pView_windowTitleChangeAsked(const QString & message)
{
qDebug() << "on_view_windowTitleChangeAsked : " + message;
qDebug() << "on_m_pView_windowTitleChangeAsked : " + message;
setWindowTitle(message);
}
void SFLPhone::on_view_enabledActionsChangeAsked(const bool * enabledActions)
void SFLPhone::on_m_pView_enabledActionsChangeAsked(const bool * enabledActions)
{
qDebug() << "on_view_enabledActionsChangeAsked";
qDebug() << "on_m_pView_enabledActionsChangeAsked";
action_accept->setVisible(enabledActions[SFLPhone::Accept]);
action_refuse->setVisible(enabledActions[SFLPhone::Refuse]);
action_hold->setVisible(enabledActions[SFLPhone::Hold]);
......@@ -316,9 +326,9 @@ void SFLPhone::on_view_enabledActionsChangeAsked(const bool * enabledActions)
action_mailBox->setVisible(enabledActions[SFLPhone::Mailbox]);
}
void SFLPhone::on_view_actionIconsChangeAsked(const QString * actionIcons)
void SFLPhone::on_m_pView_actionIconsChangeAsked(const QString * actionIcons)
{
qDebug() << "on_view_actionIconsChangeAsked";
qDebug() << "on_m_pView_actionIconsChangeAsked";
action_accept->setIcon(QIcon(actionIcons[SFLPhone::Accept]));
action_refuse->setIcon(QIcon(actionIcons[SFLPhone::Refuse]));
action_hold->setIcon(QIcon(actionIcons[SFLPhone::Hold]));
......@@ -327,9 +337,9 @@ void SFLPhone::on_view_actionIconsChangeAsked(const QString * actionIcons)
action_mailBox->setIcon(QIcon(actionIcons[SFLPhone::Mailbox]));
}
void SFLPhone::on_view_actionTextsChangeAsked(const QString * actionTexts)
void SFLPhone::on_m_pView_actionTextsChangeAsked(const QString * actionTexts)
{
qDebug() << "on_view_actionTextsChangeAsked";
qDebug() << "on_m_pView_actionTextsChangeAsked";
action_accept->setText(actionTexts[SFLPhone::Accept]);
action_refuse->setText(actionTexts[SFLPhone::Refuse]);
action_hold->setText(actionTexts[SFLPhone::Hold]);
......@@ -339,13 +349,13 @@ void SFLPhone::on_view_actionTextsChangeAsked(const QString * actionTexts)
}
void SFLPhone::on_view_transferCheckStateChangeAsked(bool transferCheckState)
void SFLPhone::on_m_pView_transferCheckStateChangeAsked(bool transferCheckState)
{
qDebug() << "Changing transfer action checkState";
action_transfer->setChecked(transferCheckState);
}
void SFLPhone::on_view_recordCheckStateChangeAsked(bool recordCheckState)
void SFLPhone::on_m_pView_recordCheckStateChangeAsked(bool recordCheckState)
{
qDebug() << "Changing record action checkState";
action_record->setChecked(recordCheckState);
......@@ -353,14 +363,14 @@ void SFLPhone::on_view_recordCheckStateChangeAsked(bool recordCheckState)
void SFLPhone::updateScreen(QAction * action)
{
if(action == action_main) view->changeScreen(SCREEN_MAIN);
else if(action == action_history) view->changeScreen(SCREEN_HISTORY);
else if(action == action_addressBook) view->changeScreen(SCREEN_ADDRESS);
if(action == action_main) m_pView->changeScreen(SCREEN_MAIN);
else if(action == action_history) m_pView->changeScreen(SCREEN_HISTORY);
else if(action == action_addressBook) m_pView->changeScreen(SCREEN_ADDRESS);
}
void SFLPhone::on_view_screenChanged(int screen)
void SFLPhone::on_m_pView_screenChanged(int screen)
{
qDebug() << "on_view_screenChanged";
qDebug() << "on_m_pView_screenChanged";
if(screen == SCREEN_MAIN) action_main->setChecked(true);
else if(screen == SCREEN_HISTORY) action_history->setChecked(true);
else if(screen == SCREEN_ADDRESS) action_addressBook->setChecked(true);
......@@ -378,7 +388,7 @@ QList<QAction*> SFLPhone::getCallActions()
return callActions;
}
void SFLPhone::on_view_incomingCall(const Call * call)
void SFLPhone::on_m_pView_incomingCall(const Call * call)
{
//ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
//trayIconSignal();
......@@ -391,7 +401,7 @@ void SFLPhone::on_view_incomingCall(const Call * call)
//}
}
void SFLPhone::on_view_addressBookEnableAsked(bool enabled)
void SFLPhone::on_m_pView_addressBookEnableAsked(bool enabled)
{
action_addressBook->setVisible(enabled);
}
......@@ -45,6 +45,7 @@
#include "widgets/SFLPhoneTray.h"
class SFLPhoneView;
class CallView;
/**
* This class represents the SFLphone main window
......@@ -94,7 +95,7 @@ private:
KAction * action_configureSflPhone;
KAction * action_accountCreationWizard;
SFLPhoneView * view;
SFLPhoneView * m_pView;
QMenu *trayIconMenu;
bool iconChanged;
SFLPhoneTray *trayIcon;
......@@ -128,19 +129,21 @@ public:
friend class SFLPhoneView;
static SFLPhone* app();
SFLPhoneView* view();
CallView* model();
private slots:
void on_view_statusMessageChangeAsked(const QString & message);
void on_view_windowTitleChangeAsked(const QString & message);
void on_view_enabledActionsChangeAsked(const bool * enabledActions);
void on_view_actionIconsChangeAsked(const QString * actionIcons);
void on_view_actionTextsChangeAsked(const QString * actionTexts);
void on_view_transferCheckStateChangeAsked(bool transferCheckState);
void on_view_recordCheckStateChangeAsked(bool recordCheckState);
void on_view_addressBookEnableAsked(bool enabled);
void on_view_screenChanged(int screen);
void on_view_incomingCall(const Call * call);
void on_m_pView_statusMessageChangeAsked(const QString & message);
void on_m_pView_windowTitleChangeAsked(const QString & message);
void on_m_pView_enabledActionsChangeAsked(const bool * enabledActions);
void on_m_pView_actionIconsChangeAsked(const QString * actionIcons);
void on_m_pView_actionTextsChangeAsked(const QString * actionTexts);
void on_m_pView_transferCheckStateChangeAsked(bool transferCheckState);
void on_m_pView_recordCheckStateChangeAsked(bool recordCheckState);
void on_m_pView_addressBookEnableAsked(bool enabled);
void on_m_pView_screenChanged(int screen);
void on_m_pView_incomingCall(const Call * call);
void updateScreen(QAction * action);
......
......@@ -57,9 +57,9 @@ using namespace KABC;
SFLPhoneView::SFLPhoneView(QWidget *parent)
: QWidget(parent),
wizard(0),
addressBookTree(CallView::Address),
callTreeModel(CallView::ActiveCall),
historyTreeModel(CallView::History)
addressBookTree(new CallView(CallView::Address)),
callTreeModel(new CallView(CallView::ActiveCall)),
historyTreeModel(new CallView(CallView::History))
{
setupUi(this);
......@@ -74,15 +74,15 @@ SFLPhoneView::SFLPhoneView(QWidget *parent)
//historyTree = new CallTreeWidget(page_callHistory);
//callTree = new CallTreeWidget(this);
//historyTree = new CallTreeWidget(this);
callTreeModel.setTitle("Calls");
historyTreeModel.setTitle("History");
callTreeModel->setTitle("Calls");
historyTreeModel->setTitle("History");
page_callList->layout()->addWidget(callTreeModel.getWidget());
page_callHistory->layout()->addWidget(historyTreeModel.getWidget());
page_callList->layout()->addWidget(callTreeModel->getWidget());
page_callHistory->layout()->addWidget(historyTreeModel->getWidget());
historyLoaded = false;
// for(int i = 0 ; i < callTreeModel.size() ; i++) {
// for(int i = 0 ; i < callTreeModel->size() ; i++) {
// Call * call = (*callList)[i];
// if(call->getState() == CALL_STATE_OVER) {
// addCallToCallHistory(call);
......@@ -142,11 +142,11 @@ SFLPhoneView::SFLPhoneView(QWidget *parent)
connect(CallView::getAccountList(), SIGNAL(accountListUpdated()),
this, SLOT(updateWindowCallState()));
connect(callTreeModel.getWidget(), SIGNAL(itemChanged()), //currentItemChanged
connect(callTreeModel->getWidget(), SIGNAL(itemChanged()), //currentItemChanged
this, SLOT(on_callTree_currentItemChanged()));
connect(callTreeModel.getWidget(), SIGNAL(itemChanged()), //ITem changed
connect(callTreeModel->getWidget(), SIGNAL(itemChanged()), //ITem changed
this, SLOT(on_callTree_itemChanged()));
connect(callTreeModel.getWidget(), SIGNAL(doubleClicked(const QModelIndex &)),
connect(callTreeModel->getWidget(), SIGNAL(doubleClicked(const QModelIndex &)),
this, SLOT(on_callTree_itemDoubleClicked(const QModelIndex&)));
......@@ -161,7 +161,7 @@ SFLPhoneView::~SFLPhoneView()
void SFLPhoneView::saveState()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
configurationManager.setHistory(callTreeModel.getHistory());
configurationManager.setHistory(callTreeModel->getHistoryCallId());
}
void SFLPhoneView::loadWindow()
......@@ -186,10 +186,15 @@ QErrorMessage * SFLPhoneView::getErrorWindow()
return errorWindow;
}
CallView* SFLPhoneView::model()
{
return callTreeModel;
}
// Call* SFLPhoneView::addCallToCallList(Call * call)
// {
// // return callTree->insert(call);
// return callTreeModel.addCall(call);
// return callTreeModel->addCall(call);
// }
// Call* SFLPhoneView::addCallToCallHistory(Call * call)
......@@ -216,7 +221,7 @@ void SFLPhoneView::typeString(QString str)
CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
if(stackedWidget_screen->currentWidget() == page_callList) {
Call* call = callTreeModel.getCurrentItem();
Call* call = callTreeModel->getCurrentItem();
callManager.playDTMF(str);
Call *currentCall = 0;
Call *candidate = 0;
......@@ -227,13 +232,13 @@ void SFLPhoneView::typeString(QString str)
}
}
// for(int i = callTreeModel.size() - 1 ; i >= 0 ; i--)
// for(int i = callTreeModel->size() - 1 ; i >= 0 ; i--)
// {
// Call *call2 = (*callList)[i];
//
//
// }
foreach (Call* call2, callTreeModel.getCallList()) {
foreach (Call* call2, callTreeModel->getCallList()) {
if(currentCall != call2 && call2->getState() == CALL_STATE_CURRENT) {
action(call2, CALL_ACTION_HOLD);
}
......@@ -244,9 +249,9 @@ void SFLPhoneView::typeString(QString str)
if(!currentCall && !candidate) {
qDebug() << "Typing when no item is selected. Opening an item.";
candidate = callTreeModel.addDialingCall();
candidate = callTreeModel->addDialingCall();
//callTree->setCurrentRow(callTree->count() + 1); //TODO
//callTreeModel.selectItem(addCallToCallList(candidate));
//callTreeModel->selectItem(addCallToCallList(candidate));
}
if(!currentCall && candidate) {
......@@ -270,19 +275,19 @@ void SFLPhoneView::backspace()
qDebug() << "backspace";
if(stackedWidget_screen->currentWidget() == page_callList) {
qDebug() << "In call list.";
Call* call = callTreeModel.getCurrentItem();
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 (callTreeModel->getCurrentItem())
callTreeModel->removeItem(callTreeModel->getCurrentItem());
if(call->getHistoryState() != NONE) {
//historyTree->insert(call);
historyTreeModel.addCall(call);
historyTreeModel->addCall(call);
}
}
}
......@@ -294,7 +299,7 @@ void SFLPhoneView::escape()
qDebug() << "escape";
if(stackedWidget_screen->currentWidget() == page_callList ) {
qDebug() << "In call list.";
Call* call = callTreeModel.getCurrentItem();
Call* call = callTreeModel->getCurrentItem();
if(!call) {
qDebug() << "Escape when no item is selected. Doing nothing.";
}
......@@ -322,7 +327,7 @@ void SFLPhoneView::enter()
qDebug() << "enter";
if(stackedWidget_screen->currentWidget() == page_callList ) {
qDebug() << "In call list.";
Call* call = callTreeModel.getCurrentItem();
Call* call = callTreeModel->getCurrentItem();
if(!call) {
qDebug() << "Error : Enter on unexisting call.";
}
......@@ -339,18 +344,18 @@ void SFLPhoneView::enter()
if(stackedWidget_screen->currentWidget() == page_callHistory) {
qDebug() << "In call history.";
Call * pastCall = historyTreeModel.getCurrentItem();
Call * pastCall = historyTreeModel->getCurrentItem();
if (!pastCall) {
qDebug() << "pastCall null";
}
else {
changeScreen(SCREEN_MAIN);
Call * call = callTreeModel.addDialingCall(pastCall->getPeerName(), pastCall->getAccountId());
Call * call = callTreeModel->addDialingCall(pastCall->getPeerName(), pastCall->getAccountId());
call->appendText(pastCall->getPeerPhoneNumber());
//addCallToCallList(call);
//callTree->setCurrentRow(callTree->count() - 1);
//callTree->setCurrentItem(addCallToCallList(call));
//callTreeModel.selectItem(addCallToCallList(call));
//callTreeModel->selectItem(addCallToCallList(call));
action(call, CALL_ACTION_ACCEPT);
}
}
......@@ -363,9 +368,9 @@ void SFLPhoneView::enter()
// else {
// changeScreen(SCREEN_MAIN);
// //ContactItemWidget * w = (ContactItemWidget *) (listWidget_addressBook->itemWidget(item));
// Call * call = callTreeModel.addDialingCall(w->getContactName());
// Call * call = callTreeModel->addDialingCall(w->getContactName());
// call->appendText(w->getContactNumber());
// //callTreeModel.selectItem(addCallToCallList(call));
// //callTreeModel->selectItem(addCallToCallList(call));
// action(call, CALL_ACTION_ACCEPT);
// }
}
......@@ -411,7 +416,7 @@ void SFLPhoneView::updateWindowCallState()
if(stackedWidget_screen->currentWidget() == page_callList) {
call = callTreeModel.getCurrentItem();
call = callTreeModel->getCurrentItem();
if (!call) {
qDebug() << "No item selected.";
enabledActions[SFLPhone::Refuse] = false;
......@@ -496,7 +501,7 @@ void SFLPhoneView::updateWindowCallState()
}
}
if(stackedWidget_screen->currentWidget() == page_callHistory) {
call = historyTreeModel.getCurrentItem();
call = historyTreeModel->getCurrentItem();
buttonIconFiles[SFLPhone::Accept] = ICON_ACCEPT;
actionTexts[SFLPhone::Accept] = ACTION_LABEL_CALL_BACK;
if (!call) {
......@@ -558,12 +563,12 @@ void SFLPhoneView::updateCallHistory()
listWidget_callHistory->takeItem(0);
}
QString textSearched = lineEdit_searchHistory->text();
foreach (Call* call, historyTreeModel.getCallList()) {
foreach (Call* call, historyTreeModel->getCallList()) {
qDebug() << "" << call->getCallId();
if( call->getState() == CALL_STATE_OVER && call->getHistoryState() != NONE && (call->getPeerPhoneNumber().contains(textSearched) || call->getPeerName().contains(textSearched)) ) {
qDebug() << "call->getPeerPhoneNumber()=" << call->getPeerPhoneNumber() << " contains textSearched=" << textSearched;
//addCallToCallHistory(call);
historyTreeModel.addCall(call);
historyTreeModel->addCall(call);
}
}
// alternateColors(listWidget_callHistory);
......@@ -910,9 +915,9 @@ void SFLPhoneView::on_listWidget_callHistory_itemDoubleClicked(Call* call)
qDebug() << "on_listWidget_callHistory_itemDoubleClicked";
changeScreen(SCREEN_MAIN);
Call* pastCall = call;
Call* call2 = callTreeModel.addDialingCall(pastCall->getPeerName(), pastCall->getAccountId());
Call* call2 = callTreeModel->addDialingCall(pastCall->getPeerName(), pastCall->getAccountId());
call2->appendText(pastCall->getPeerPhoneNumber());
//callTreeModel.selectItem(addCallToCallList(call2));
//callTreeModel->selectItem(addCallToCallList(call2));
action(call2, CALL_ACTION_ACCEPT);
}
......@@ -1004,7 +1009,7 @@ void SFLPhoneView::editBeforeCall()
QString name;
QString number;
if(stackedWidget_screen->currentWidget() == page_callHistory) {
Call* call = historyTreeModel.getCurrentItem();
Call* call = historyTreeModel->getCurrentItem();
if(call) {
name = call->getPeerName();
number = call->getPeerPhoneNumber();
......@@ -1026,9 +1031,9 @@ void SFLPhoneView::editBeforeCall()
QString newNumber = QInputDialog::getText(this, i18n("Edit before call"), QString(), QLineEdit::Normal, number, &ok);
if(ok) {
changeScreen(SCREEN_MAIN);
Call* call = callTreeModel.addDialingCall(name);
Call* call = callTreeModel->addDialingCall(name);
call->appendText(newNumber);
//callTreeModel.selectItem(addCallToCallList(call));
//callTreeModel->selectItem(addCallToCallList(call));
action(call, CALL_ACTION_ACCEPT);
}
}
......@@ -1083,19 +1088,19 @@ void SFLPhoneView::accountCreationWizard()
void SFLPhoneView::accept()
{
if(stackedWidget_screen->currentWidget() == page_callList) {
Call* call = callTreeModel.getCurrentItem();
Call* call = callTreeModel->getCurrentItem();
if(!call) {
qDebug() << "Calling when no item is selected. Opening an item.";
callTreeModel.addDialingCall();
//callTreeModel.selectItem(addCallToCallList(newCall));
callTreeModel->addDialingCall();
//callTreeModel->selectItem(addCallToCallList(newCall));
}
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();
//callTreeModel.selectItem(addCallToCallList(newCall));
callTreeModel->addDialingCall();
//callTreeModel->selectItem(addCallToCallList(newCall));
}
else {
action(call, CALL_ACTION_ACCEPT);
......@@ -1105,19 +1110,19 @@ void SFLPhoneView::accept()
if(stackedWidget_screen->currentWidget() == page_callHistory) {
changeScreen(SCREEN_MAIN);
Call* pastCall = historyTreeModel.getCurrentItem();
Call* call = callTreeModel.addDialingCall(pastCall->getPeerName());
Call* pastCall = historyTreeModel->getCurrentItem();
Call* call = callTreeModel->addDialingCall(pastCall->getPeerName());
call->appendText(pastCall->getPeerPhoneNumber());
//callTreeModel.selectItem(addCallToCallList(call));
//callTreeModel->selectItem(addCallToCallList(call));
action(call, CALL_ACTION_ACCEPT);
}
if(stackedWidget_screen->currentWidget() == page_addressBook) {
// changeScreen(SCREEN_MAIN);
// ContactItemWidget * w = (ContactItemWidget *) (listWidget_addressBook->itemWidget(listWidget_addressBook->currentItem()));
// Call * call = callTreeModel.addDialingCall(w->getContactName());
// Call * call = callTreeModel->addDialingCall(w->getContactName());
// call->appendText(w->getContactNumber());
// //callTreeModel.selectItem(addCallToCallList(call));
// //callTreeModel->selectItem(addCallToCallList(call));
// action(call, CALL_ACTION_ACCEPT);
}
}
......@@ -1125,7 +1130,7 @@ void SFLPhoneView::accept()
void SFLPhoneView::refuse()
{
if(stackedWidget_screen->currentWidget() == page_callList) {
Call* call = callTreeModel.getCurrentItem();
Call* call = callTreeModel->getCurrentItem();
if(!call) {
qDebug() << "Error : Hanging up when no item selected. Should not happen.";
}
......@@ -1145,7 +1150,7 @@ void SFLPhoneView::refuse()
void SFLPhoneView::hold()
{
Call* call = callTreeModel.getCurrentItem();
Call* call = callTreeModel->getCurrentItem();
if(!call) {
qDebug() << "Error : Holding when no item selected. Should not happen.";
}
......@@ -1156,7 +1161,7 @@ void SFLPhoneView::hold()
void SFLPhoneView::transfer()
{
Call* call = callTreeModel.getCurrentItem();