diff --git a/sflphone-client-kde/src/Call.cpp b/sflphone-client-kde/src/Call.cpp index abd4e6a191917a96ece2e20d03cb7fe756985a27..1b8a5c566096fa2b25dc18d27e7209b79fd7953c 100644 --- a/sflphone-client-kde/src/Call.cpp +++ b/sflphone-client-kde/src/Call.cpp @@ -28,8 +28,6 @@ #include <kabc/addressbook.h> #include <kabc/stdaddressbook.h> -#include "CallTreeItem.h" - using namespace KABC; const call_state Call::actionPerformedStateMap [11][5] = @@ -98,9 +96,6 @@ const function Call::stateChangedFunctionMap[11][6] = /*ERROR */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::stop , &Call::nothing } }; - -const char * Call::callStateIcons[11] = {ICON_INCOMING, ICON_RINGING, ICON_CURRENT, ICON_DIALING, ICON_HOLD, ICON_FAILURE, ICON_BUSY, ICON_TRANSFER, ICON_TRANSF_HOLD, "", ""}; - const char * Call::historyIcons[3] = {ICON_HISTORY_INCOMING, ICON_HISTORY_OUTGOING, ICON_HISTORY_MISSED}; void Call::initCallItemWidget() @@ -154,6 +149,7 @@ Call::Call(call_state startState, QString callId, QString peerName, QString peer this->historyItemWidget = NULL; this->startTime = NULL; this->stopTime = NULL; + this->initCallItemWidget(); } Call * Call::buildExistingCall(QString callId) @@ -176,7 +172,7 @@ Call::~Call() { delete startTime; delete stopTime; - //delete itemWidget; + delete itemWidget; //delete historyItemWidget; } @@ -730,26 +726,3 @@ void Call::changeCurrentState(call_state newState) currentState = newState; } -/*void Call::updateItem() -{ - if(currentState != CALL_STATE_OVER) - { - if(currentState == CALL_STATE_CURRENT && recording) - setItemIcon(ICON_CURRENT_REC); - else - { - QString str = QString(callStateIcons[currentState]); - setItemIcon(str); - } - bool transfer = currentState == CALL_STATE_TRANSFER || currentState == CALL_STATE_TRANSF_HOLD; - labelTransferPrefix->setVisible(transfer); - labelTransferNumber->setVisible(transfer); - if(!transfer) - labelTransferNumber->setText(""); - } - else - { -// qDebug() << "Updating item of call of state OVER. Doing nothing."; - } - }*/ - diff --git a/sflphone-client-kde/src/CallTreeItem.cpp b/sflphone-client-kde/src/CallTreeItem.cpp index f14b619a4ca17dc0d1ae16d9507e5e93af156a1f..9f2186bedc56a3e52eb4edde29ed3191eeb2993b 100644 --- a/sflphone-client-kde/src/CallTreeItem.cpp +++ b/sflphone-client-kde/src/CallTreeItem.cpp @@ -19,19 +19,23 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include <QStringList> +#include <QtCore/QStringList> - #include "CallTreeItem.h" +#include <klocale.h> +#include <kdebug.h> - CallTreeItem::CallTreeItem(CallTreeItem *parent) - : parentItem(parent) - { - } +#include "sflphone_const.h" +#include "CallTreeItem.h" - CallTreeItem::CallTreeItem(const Call &data, CallTreeItem *parent) +const char * CallTreeItem::callStateIcons[11] = {ICON_INCOMING, ICON_RINGING, ICON_CURRENT, ICON_DIALING, ICON_HOLD, ICON_FAILURE, ICON_BUSY, ICON_TRANSFER, ICON_TRANSF_HOLD, "", ""}; + +CallTreeItem::CallTreeItem(const QVector<QVariant> &data, CallTreeItem *parent) : parentItem(parent), + itemCall(0), + itemWidget(0), itemData(data) { + } CallTreeItem::~CallTreeItem() @@ -68,10 +72,15 @@ return itemData.value(column); } - QVariant CallTreeItem::data() const - { - return data(0); - } +Call* CallTreeItem::call() const +{ + return itemCall; +} + +QWidget* CallTreeItem::widget() const +{ + return itemWidget; +} bool CallTreeItem::insertChildren(int position, int count, int columns) { @@ -160,3 +169,73 @@ itemData[column] = value; return true; } + + +void CallTreeItem::setCall(Call *call) +{ + itemCall = call; + + itemWidget = new QWidget(); + + labelIcon = new QLabel(); + labelCallNumber = new QLabel(itemCall->getPeerPhoneNumber()); + labelTransferPrefix = new QLabel(i18n("Transfer to : ")); + labelTransferNumber = new QLabel(); + QSpacerItem * horizontalSpacer = new QSpacerItem(16777215, 20, QSizePolicy::Preferred, QSizePolicy::Minimum); + + QHBoxLayout * mainLayout = new QHBoxLayout(); + mainLayout->setContentsMargins ( 3, 1, 2, 1); + mainLayout->setSpacing(4); + QVBoxLayout * descr = new QVBoxLayout(); + descr->setMargin(1); + descr->setSpacing(1); + QHBoxLayout * transfer = new QHBoxLayout(); + transfer->setMargin(0); + transfer->setSpacing(0); + mainLayout->addWidget(labelIcon); + if(! itemCall->getPeerName().isEmpty()) + { + labelPeerName = new QLabel(itemCall->getPeerName()); + descr->addWidget(labelPeerName); + } + descr->addWidget(labelCallNumber); + transfer->addWidget(labelTransferPrefix); + transfer->addWidget(labelTransferNumber); + descr->addLayout(transfer); + mainLayout->addLayout(descr); + mainLayout->addItem(horizontalSpacer); + + itemWidget->setLayout(mainLayout); + updateItem(); +} + +void CallTreeItem::updateItem() +{ + call_state state = itemCall->getState(); + bool recording = itemCall->getRecording(); + + if(state != CALL_STATE_OVER) + { + if(state == CALL_STATE_CURRENT && recording) + { + labelIcon->setPixmap(QPixmap(ICON_CURRENT_REC)); + } + else + { + QString str = QString(callStateIcons[state]); + labelIcon->setPixmap(QPixmap(str)); + } + bool transfer = state == CALL_STATE_TRANSFER || state == CALL_STATE_TRANSF_HOLD; + labelTransferPrefix->setVisible(transfer); + labelTransferNumber->setVisible(transfer); + + if(!transfer) + { + labelTransferNumber->setText(""); + } + } + else + { + qDebug() << "Updating item of call of state OVER. Doing nothing."; + } +} diff --git a/sflphone-client-kde/src/CallTreeItem.h b/sflphone-client-kde/src/CallTreeItem.h index 44e5e33f277eb0237c77e8499160449a9d636f3d..b11a6881476fb7103c886e3a4f973cc44d1fc99e 100644 --- a/sflphone-client-kde/src/CallTreeItem.h +++ b/sflphone-client-kde/src/CallTreeItem.h @@ -27,34 +27,59 @@ #define CALLTREE_ITEM_H #include <QtCore/QList> -#include <QtGui/QTreeWidget> +#include <QtCore/QVariant> +#include <QtCore/QVector> -class Call; +#include <QtGui/QWidget> +#include <QtGui/QLabel> +#include <QtGui/QSpacerItem> +#include <QtGui/QHBoxLayout> +#include <QtGui/QVBoxLayout> -class CallTreeItem : public QTreeWidget +#include "Call.h" + +class CallTreeItem : QObject { public: - CallTreeItem(CallTreeItem *parent = 0); - CallTreeItem(const Call &data, CallTreeItem *parent = 0); + CallTreeItem(const QVector<QVariant> &data, CallTreeItem *parent); ~CallTreeItem(); CallTreeItem *child(int number); int childCount() const; int columnCount() const; - Call* data(int column) const; - Call* data() const; + QVariant data(int column) const; + Call* call() const; + QWidget* widget() const; bool insertChildren(int position, int count, int columns); bool insertColumns(int position, int columns); CallTreeItem *parent(); bool removeChildren(int position, int count); bool removeColumns(int position, int columns); int childNumber() const; - bool setData(int column, const Call &value); + bool setData(int column, const QVariant &value); + void setCall(Call *call); + void updateItem(); + static const char * callStateIcons[11]; private: QList<CallTreeItem*> childItems; - Call *itemData; + QVector<QVariant> itemData; CallTreeItem *parentItem; + Call *itemCall; + + QWidget *itemWidget; + + QLabel * labelIcon; + QLabel * labelPeerName; + QLabel * labelCallNumber; + QLabel * labelTransferPrefix; + QLabel * labelTransferNumber; + + QWidget * historyItemWidget; + QLabel * labelHistoryIcon; + QLabel * labelHistoryPeerName; + QLabel * labelHistoryCallNumber; + QLabel * labelHistoryTime; }; #endif // CALLTREE_ITEM_H diff --git a/sflphone-client-kde/src/CallTreeModel.cpp b/sflphone-client-kde/src/CallTreeModel.cpp index d5c854070f8761e839a046f4d97acbd7b8eda013..f0494ce61b0b8b93fe657563e961d4fe4e487999 100644 --- a/sflphone-client-kde/src/CallTreeModel.cpp +++ b/sflphone-client-kde/src/CallTreeModel.cpp @@ -24,22 +24,26 @@ #include "CallTreeModel.h" #include "CallTreeItem.h" -#include "Call.h" CallTreeModel::CallTreeModel(QObject *parent) - : QAbstractItemModel(parent) + : QAbstractItemModel(parent), + rootItem(0) + { QStringList data = QString("Calls").split("\n"); QVector<QVariant> rootData; rootData << i18n("Calls"); - rootItem = new CallTreeItem(); + rootItem = new CallTreeItem(rootData, 0); setupModelData(data, rootItem); } CallTreeModel::~CallTreeModel() { - delete rootItem; + if(rootItem) + { + delete rootItem; + } } int CallTreeModel::columnCount(const QModelIndex & /* parent */) const @@ -48,6 +52,23 @@ int CallTreeModel::columnCount(const QModelIndex & /* parent */) const } QVariant CallTreeModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + { + return QVariant(); + } + + if (role != Qt::DisplayRole && role != Qt::EditRole) + { + return QVariant(); + } + + CallTreeItem *item = getItem(index); + + return item->data(index.column()); +} + +Call* CallTreeModel::call(const QModelIndex &index, int role) const { if (!index.isValid()) { @@ -61,7 +82,7 @@ QVariant CallTreeModel::data(const QModelIndex &index, int role) const CallTreeItem *item = getItem(index); - return item->data(index.column()); + return item->call(); } Qt::ItemFlags CallTreeModel::flags(const QModelIndex &index) const @@ -175,7 +196,7 @@ bool CallTreeModel::removeColumns(int position, int columns, const QModelIndex & bool CallTreeModel::removeRows(int position, int rows, const QModelIndex &parent) { - TreeItem *parentItem = getItem(parent); + CallTreeItem *parentItem = getItem(parent); bool success = true; beginRemoveRows(parent, position, position + rows - 1); @@ -192,13 +213,6 @@ int CallTreeModel::rowCount(const QModelIndex &parent) const return parentItem->childCount(); } -bool CallTreeModel::setData(const QModelIndex &index, const Call *call, int role) -{ - QVariant value = QVariant(&*value); - - return setData(index, value, role); -} - bool CallTreeModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (role != Qt::EditRole) @@ -217,7 +231,7 @@ bool CallTreeModel::setData(const QModelIndex &index, const QVariant &value, int return result; } -bool TreeModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) +bool CallTreeModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) { if (role != Qt::EditRole || orientation != Qt::Horizontal) { @@ -238,7 +252,7 @@ void CallTreeModel::setupModelData(const QStringList &lines, CallTreeItem *paren { QList<CallTreeItem*> parents; QList<int> indentations; - parents << parent; +// parents << parent; indentations << 0; int number = 0; @@ -289,13 +303,13 @@ void CallTreeModel::setupModelData(const QStringList &lines, CallTreeItem *paren } // Append a new item to the current parent's list of children. - CallTreeItem *parent = parents.last(); + /*CallTreeItem *parent = parents.last(); parent->insertChildren(parent->childCount(), 1, rootItem->columnCount()); for (int column = 0; column < columnData.size(); ++column) { parent->child(parent->childCount() - 1)->setData(column, columnData[column]); - } + }*/ } number++; } diff --git a/sflphone-client-kde/src/CallTreeModel.h b/sflphone-client-kde/src/CallTreeModel.h index be79cf7ad879e2db11f93bb46d41087745cd83a5..1103958383de40ada106b5beccf426933ab89c74 100644 --- a/sflphone-client-kde/src/CallTreeModel.h +++ b/sflphone-client-kde/src/CallTreeModel.h @@ -42,35 +42,29 @@ public: ~CallTreeModel(); QVariant data(const QModelIndex &index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; + Call* call(const QModelIndex &index, int role) const; - QModelIndex index(int row, int column, - const QModelIndex &parent = QModelIndex()) const; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; Qt::ItemFlags flags(const QModelIndex &index) const; - bool setData(const QModelIndex &index, const Call *call, int role = Qt::EditRole); - - bool setHeaderData(int section, Qt::Orientation orientation, - const QVariant &value, int role = Qt::EditRole); + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + bool setCall(const QModelIndex &index, Call *value, int role = Qt::EditRole); + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); - bool insertColumns(int position, int columns, - const QModelIndex &parent = QModelIndex()); - bool removeColumns(int position, int columns, - const QModelIndex &parent = QModelIndex()); - bool insertRows(int position, int rows, - const QModelIndex &parent = QModelIndex()); - bool removeRows(int position, int rows, - const QModelIndex &parent = QModelIndex()); + bool insertColumns(int position, int columns, const QModelIndex &parent = QModelIndex()); + bool removeColumns(int position, int columns, const QModelIndex &parent = QModelIndex()); + bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex()); + bool removeRows(int position, int rows, const QModelIndex &parent = QModelIndex()); CallTreeItem *getItem(const QModelIndex &index) const; private: - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); void setupModelData(const QStringList &lines, CallTreeItem *parent); CallTreeItem *rootItem; }; diff --git a/sflphone-client-kde/src/CallTreeView.cpp b/sflphone-client-kde/src/CallTreeView.cpp index 5be278206783769d0e8b02cf9b9f6156d30d2c76..42fc4bc888124361d8a2601c8569cd172f6e1f0b 100644 --- a/sflphone-client-kde/src/CallTreeView.cpp +++ b/sflphone-client-kde/src/CallTreeView.cpp @@ -27,42 +27,46 @@ CallTreeView::CallTreeView(QWidget * parent) : QTreeView(parent) { - setModel(new CallTreeModel(this)); + treeModel = new CallTreeModel(this); + setModel(treeModel); + setHeaderHidden(true); + setRootIsDecorated(false); + setSelectionMode(QAbstractItemView::SingleSelection); + setDragEnabled(true); + setAcceptDrops(true); + setDropIndicatorShown(true); } CallTreeView::~CallTreeView() { - // + // delete treeModel; } CallTreeItem* CallTreeView::insert(Call *call) { QModelIndex index = selectionModel()->currentIndex(); + int position = index.row()+1; + QModelIndex parent = index.parent(); + CallTreeItem *item; - if (!model()->insertRow(index.row()+1, index.parent())) + if (!treeModel->insertRow(position, parent)) { return 0; } - for (int column = 0; column < model()->columnCount(index.parent()); ++column) - { - QModelIndex child = model()->index(index.row()+1, column, index.parent()); - // TODO - //AAAAAAAAAAARRGG//model()->setData(child, call, Qt::EditRole); - } - QModelIndex child = model()->index(index.row()+1, 0, index.parent()); + treeModel->setData(child, QVariant(""), Qt::EditRole); - // TODO - return ((CallTreeModel*)model())->getItem(child); -// return ((CallTreeModel*)model())->getItem(index.row()+1); + item = treeModel->getItem(child); + item->setCall(call); + setIndexWidget(child, item->widget()); } CallTreeItem* CallTreeView::insert(CallTreeItem *parent, Call *call) { QModelIndex index = selectionModel()->currentIndex(); - - if (model()->columnCount(index) == 0) + + if (treeModel->columnCount(index) == 0) { if (!model()->insertColumn(0, index)) { @@ -71,22 +75,18 @@ CallTreeItem* CallTreeView::insert(CallTreeItem *parent, Call *call) } - if (!model()->insertRow(0, index)) + if (!treeModel->insertRow(0, index)) { return 0; } + + CallTreeItem *item = treeModel->getItem(index); + item->setCall(call); - for (int column = 0; column < model()->columnCount(index); ++column) + for (int column = 0; column < treeModel->columnCount(index); ++column) { - QModelIndex child = model()->index(0, column, index); - //arrgg - //TODO - //model()->setData(child, call, Qt::EditRole); - - if (!model()->headerData(column, Qt::Horizontal).isValid()) - { - model()->setHeaderData(column, Qt::Horizontal, QVariant("[No header]"), Qt::EditRole); - } + QModelIndex child = treeModel->index(0, column, index); + treeModel->setData(child, QVariant(""), Qt::EditRole); } selectionModel()->setCurrentIndex(model()->index(0, 0, index), QItemSelectionModel::ClearAndSelect); @@ -113,7 +113,12 @@ CallTreeItem* CallTreeView::currentItem() CallTreeItem *item = treeModel->getItem(index); + if (!item->call()) + { + return 0; + } return item; + } void CallTreeView::setCurrentRow(int row) @@ -121,10 +126,7 @@ void CallTreeView::setCurrentRow(int row) CallTreeModel * treeModel = static_cast<CallTreeModel*>(model()); QModelIndex currentIndex = selectionModel()->currentIndex(); - QModelIndex index = treeModel->index(row, 0, currentIndex); - - // TODO: check - + QModelIndex index = treeModel->index(0, 0, currentIndex); selectionModel()->setCurrentIndex(index, QItemSelectionModel::Current); } diff --git a/sflphone-client-kde/src/CallTreeView.h b/sflphone-client-kde/src/CallTreeView.h index a89353ad2736f85449274caa651ba855773998c8..a94a8b4367344c8c231910bddd120d94d37a401b 100644 --- a/sflphone-client-kde/src/CallTreeView.h +++ b/sflphone-client-kde/src/CallTreeView.h @@ -46,7 +46,8 @@ public: CallTreeItem* currentItem(); void setCurrentRow(int row); int count(); - +private: + CallTreeModel *treeModel; }; #endif // CALLTREE_VIEW_H diff --git a/sflphone-client-kde/src/SFLPhoneView.cpp b/sflphone-client-kde/src/SFLPhoneView.cpp index 324e262d5015ccfdb782d8ba9c7497d5f3ead6c5..2ddc94bb717feab6e2c5e448bf7b0766b6c3c989 100644 --- a/sflphone-client-kde/src/SFLPhoneView.cpp +++ b/sflphone-client-kde/src/SFLPhoneView.cpp @@ -69,6 +69,9 @@ SFLPhoneView::SFLPhoneView(QWidget *parent) callList = new CallList(this); callTree = new CallTreeView(page_callList); + historyTree = new CallTreeView(page_callHistory); + + page_callList->layout()->addWidget(callTree); historyLoaded = false; @@ -99,11 +102,6 @@ SFLPhoneView::SFLPhoneView(QWidget *parent) pal.setColor(QPalette::AlternateBase, Qt::lightGray); setPalette(pal); -/* listWidget_callList->setSelectionMode(QAbstractItemView::SingleSelection); - listWidget_callList->setDragEnabled(true); - listWidget_callList->setAcceptDrops(true); - listWidget_callList->setDropIndicatorShown(true);*/ - stackedWidget_screen->setCurrentWidget(page_callList); connect(&callManager, SIGNAL(callStateChanged(const QString &, const QString &)), @@ -206,7 +204,6 @@ CallTreeItem* SFLPhoneView::addCallToCallList(Call * call) return callTree->insert(call); // QWidget * widget = call->getItemWidget(); -// callTree->setItemWidget(item, widget); // } } @@ -246,17 +243,20 @@ void SFLPhoneView::typeString(QString str) if(item) { - Call *call = callTree->currentItem()->data(); + Call *call = item->call(); - if(call->getState() == CALL_STATE_CURRENT) + if (call) { - currentCall = call; + if(call->getState() == CALL_STATE_CURRENT) + { + currentCall = call; + } } } for(int i = callList->size() - 1 ; i >= 0 ; i--) { - Call * call = (*callList)[i]; + Call *call = (*callList)[i]; if(currentCall != call && call->getState() == CALL_STATE_CURRENT) { @@ -274,12 +274,12 @@ void SFLPhoneView::typeString(QString str) qDebug() << "Typing when no item is selected. Opening an item."; candidate = callList->addDialingCall(); addCallToCallList(candidate); - callTree->setCurrentRow(callTree->count() - 1); + callTree->setCurrentRow(callTree->count() + 1); } if(!currentCall && candidate) { - callTree->currentItem()->data(0)->appendItemText(str); + candidate->appendItemText(str); } } if(stackedWidget_screen->currentWidget() == page_callHistory) @@ -309,7 +309,7 @@ void SFLPhoneView::backspace() } else { - Call * call = callTree->currentItem()->data(0); + Call * call = callTree->currentItem()->call(); if(!call) { qDebug() << "Error : Backspace on unexisting call."; @@ -336,7 +336,7 @@ void SFLPhoneView::escape() } else { - Call * call = item->data(0); + Call * call = item->call(); if(!call) { @@ -381,7 +381,7 @@ void SFLPhoneView::enter() } else { - Call * call = item->data(0); + Call * call = item->call(); if(!call) { qDebug() << "Error : Enter on unexisting call."; @@ -412,7 +412,7 @@ void SFLPhoneView::enter() { changeScreen(SCREEN_MAIN); - Call * pastCall = item->data(); + Call * pastCall = item->call(); if (!pastCall) { qDebug() << "pastCall null"; @@ -515,11 +515,14 @@ void SFLPhoneView::updateWindowCallState() } else { - Call * call = item->data(); - call_state state = call->getState(); - recordActivated = call->getRecording(); - switch (state) + Call * call = item->call(); + + if (call) { + 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; @@ -588,6 +591,7 @@ void SFLPhoneView::updateWindowCallState() default: qDebug() << "Error : Reached unexisting state for call " << call->getCallId() << "!"; break; + } } } } @@ -1027,7 +1031,7 @@ void SFLPhoneView::on_listWidget_callList_itemChanged() void SFLPhoneView::on_listWidget_callList_itemDoubleClicked(CallTreeItem * item) { qDebug() << "on_listWidget_callList_itemDoubleClicked"; - Call * call = item->data(); + Call * call = item->call(); call_state state = call->getCurrentState(); switch(state) { @@ -1046,7 +1050,7 @@ void SFLPhoneView::on_listWidget_callHistory_itemDoubleClicked(CallTreeItem * it { qDebug() << "on_listWidget_callHistory_itemDoubleClicked"; changeScreen(SCREEN_MAIN); - Call * pastCall = item->data(); + Call * pastCall = item->call(); Call * call = callList->addDialingCall(pastCall->getPeerName(), pastCall->getAccountId()); call->appendItemText(pastCall->getPeerPhoneNumber()); addCallToCallList(call); @@ -1148,7 +1152,7 @@ void SFLPhoneView::editBeforeCall() CallTreeItem * item = historyTree->currentItem(); if(item) { - Call * call = item->data(); + Call * call = item->call(); if(call) { name = call->getPeerName(); @@ -1234,7 +1238,7 @@ void SFLPhoneView::accept() } else { - Call * call = item->data(); + Call * call = item->call(); if(!call) { qDebug() << "Error : Accept triggered on unexisting call."; @@ -1259,7 +1263,7 @@ void SFLPhoneView::accept() if(stackedWidget_screen->currentWidget() == page_callHistory) { changeScreen(SCREEN_MAIN); - Call * pastCall = historyTree->currentItem()->data(); + Call * pastCall = historyTree->currentItem()->call(); Call * call = callList->addDialingCall(pastCall->getPeerName()); call->appendItemText(pastCall->getPeerPhoneNumber()); addCallToCallList(call); @@ -1289,7 +1293,7 @@ void SFLPhoneView::refuse() } else { - action(item->data(), CALL_ACTION_REFUSE); + action(item->call(), CALL_ACTION_REFUSE); } } if(stackedWidget_screen->currentWidget() == page_callHistory) @@ -1311,7 +1315,7 @@ void SFLPhoneView::hold() } else { - action(item->data(), CALL_ACTION_HOLD); + action(item->call(), CALL_ACTION_HOLD); } } @@ -1324,7 +1328,7 @@ void SFLPhoneView::transfer() } else { - action(item->data(), CALL_ACTION_TRANSFER); + action(item->call(), CALL_ACTION_TRANSFER); } } @@ -1337,7 +1341,7 @@ void SFLPhoneView::record() } else { - action(item->data(), CALL_ACTION_RECORD); + action(item->call(), CALL_ACTION_RECORD); } }