Commit 19a0ad8b authored by Emmanuel Lepage's avatar Emmanuel Lepage

[#7021] Refactor KDE client dbus handling, add a missing call in daemon and...

[#7021] Refactor KDE client dbus handling, add a missing call in daemon and port the DataEngine to the new API
parent f4ad4a50
......@@ -1108,6 +1108,7 @@ void ManagerImpl::removeParticipant (const std::string& call_id)
removeStream(call_id);
getMainBuffer()->stateInfo();
_dbus.getCallManager()->conferenceChanged (conf->getConfID(), conf->getStateStr());
}
void ManagerImpl::processRemainingParticipant (const std::string &current_call_id, Conference *conf)
......
......@@ -10,49 +10,34 @@
#include "../../src/lib/sflphone_const.h"
SFLPhoneEngine::SFLPhoneEngine(QObject* parent, const QVariantList& args)
: Plasma::DataEngine(parent, args), CallModelConvenience(ActiveCall)
: Plasma::DataEngine(parent, args)
{
Q_UNUSED(args)
initCall();
initHistory();
m_pModel = new CallModelConvenience(CallModelConvenience::ActiveCall);
m_pModel->initCall();
m_pModel->initHistory();
ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
connect(&callManager, SIGNAL(callStateChanged(const QString&, const QString&)),
this, SLOT(callStateChangedSignal(const QString&, const QString&)));
connect(&callManager, SIGNAL(incomingCall(const QString&, const QString&, const QString&)),
this, SLOT(incomingCallSignal(const QString&, const QString&)));
connect(&callManager, SIGNAL(conferenceCreated(const QString&)),
this, SLOT(conferenceCreatedSignal(const QString&)));
connect(&callManager, SIGNAL(conferenceChanged(const QString&, const QString&)),
this, SLOT(conferenceChangedSignal(const QString&, const QString&)));
connect(&callManager, SIGNAL(conferenceRemoved(const QString&)),
this, SLOT(conferenceRemovedSignal(const QString&)));
connect(&callManager, SIGNAL(incomingMessage(const QString&, const QString&)),
this, SLOT(incomingMessageSignal(const QString&, const QString&)));
connect(&callManager, SIGNAL(voiceMailNotify(const QString&, int)),
this, SLOT(voiceMailNotifySignal(const QString&, int)));
connect(&configurationManager, SIGNAL(accountsChanged()),
this, SLOT(accountChanged()));
connect(&configurationManager, SIGNAL(accountsChanged()),
getAccountList(), SLOT(updateAccounts()));
//setMinimumPollingInterval(1000);
connect(m_pModel , SIGNAL( callStateChanged(Call*)) , this , SLOT(callStateChangedSignal(Call*) ));
connect(&callManager , SIGNAL( incomingCall(Call*)) , this , SLOT(incomingCallSignal(Call*) ));
connect(&callManager , SIGNAL( conferenceCreated(Call*)) , this , SLOT(conferenceCreatedSignal(Call*) ));
connect(&callManager , SIGNAL( conferenceChanged(Call*)) , this , SLOT(conferenceChangedSignal(Call*) ));
}
bool SFLPhoneEngine::sourceRequestEvent(const QString &name)
{
if (name == "history") {
if ( name == "history" ) {
updateHistory();
}
else if (name == "calls") {
else if ( name == "calls" ) {
updateCallList();
}
else if (name == "conferences") {
else if ( name == "conferences" ) {
updateConferenceList();
}
else if (name == "info") {
else if ( name == "info" ) {
updateInfo();
}
return true;//updateSourceEvent(name);
......@@ -100,22 +85,22 @@ QString SFLPhoneEngine::getCallStateName(call_state state)
void SFLPhoneEngine::updateHistory()
{
foreach (Call* oldCall, getHistory()) {
historyCall[oldCall->getCallId()]["Name"] = oldCall->getPeerName();
historyCall[oldCall->getCallId()]["Number"] = oldCall->getPeerPhoneNumber();
historyCall[oldCall->getCallId()]["Date"] = oldCall->getStopTimeStamp();
foreach (Call* oldCall, m_pModel->getHistory()) {
historyCall[oldCall->getCallId()][ "Name" ] = oldCall->getPeerName();
historyCall[oldCall->getCallId()][ "Number" ] = oldCall->getPeerPhoneNumber();
historyCall[oldCall->getCallId()][ "Date" ] = oldCall->getStopTimeStamp();
setData("history", I18N_NOOP(oldCall->getCallId()), historyCall[oldCall->getCallId()]);
}
}
void SFLPhoneEngine::updateCallList()
{
foreach (Call* call, getCalls()) {
if ((!isConference(call)) && (call->getState() != CALL_STATE_OVER)) {
currentCall[call->getCallId()]["Name"] = call->getPeerName();
currentCall[call->getCallId()]["Number"] = call->getPeerPhoneNumber();
currentCall[call->getCallId()]["StateName"] = getCallStateName(call->getState());
currentCall[call->getCallId()]["State"] = call->getState();
foreach (Call* call, m_pModel->getCalls()) {
if ((!m_pModel->isConference(call)) && (call->getState() != CALL_STATE_OVER)) {
currentCall[call->getCallId()][ "Name" ] = call->getPeerName();
currentCall[call->getCallId()][ "Number" ] = call->getPeerPhoneNumber();
currentCall[call->getCallId()][ "StateName" ] = getCallStateName(call->getState());
currentCall[call->getCallId()][ "State" ] = call->getState();
setData("calls", call->getCallId(), currentCall[call->getCallId()]);
}
}
......@@ -123,8 +108,8 @@ void SFLPhoneEngine::updateCallList()
void SFLPhoneEngine::updateConferenceList()
{
foreach (Call* call, getCalls()) {
if (isConference(call)) {
foreach (Call* call, m_pModel->getCalls()) {
if (m_pModel->isConference(call)) {
CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
currentConferences[call->getConfId()] = callManager.getParticipantList(call->getConfId());
setData("conferences", call->getConfId(), currentConferences[call->getConfId()]);
......@@ -139,54 +124,34 @@ void SFLPhoneEngine::updateContacts()
void SFLPhoneEngine::updateInfo()
{
qDebug() << "Currentaccount: " << getCurrentAccountId();
setData("info", I18N_NOOP("Account"), getCurrentAccountId());
qDebug() << "Currentaccount: " << m_pModel->getCurrentAccountId();
setData("info", I18N_NOOP("Account"), m_pModel->getCurrentAccountId());
}
void SFLPhoneEngine::callStateChangedSignal(const QString& callId, const QString& state)
void SFLPhoneEngine::callStateChangedSignal(Call* call)
{
qDebug() << "Signal : Call State Changed for call " << callId << " . New state : " << state;
Call* call = findCallByCallId(callId);
if(!call) {
if(state == CALL_STATE_CHANGE_RINGING) {
call = addRingingCall(callId);
//addCallToCallList(call);
}
else {
qDebug() << "Call doesn't exist in this client. Might have been initialized by another client instance before this one started.";
return;
}
}
else {
call->stateChanged(state);
}
Q_UNUSED(call)
updateCallList();
}
void SFLPhoneEngine::incomingCallSignal(const QString& accountId, const QString& callId)
void SFLPhoneEngine::incomingCallSignal(Call* call)
{
Q_UNUSED(accountId)
addIncomingCall(callId);
Q_UNUSED(call)
updateCallList();
}
void SFLPhoneEngine::conferenceCreatedSignal(const QString& confId)
void SFLPhoneEngine::conferenceCreatedSignal(Call* conf)
{
addConference(confId);
Q_UNUSED(conf)
updateConferenceList();
}
void SFLPhoneEngine::conferenceChangedSignal(const QString& confId, const QString& state)
void SFLPhoneEngine::conferenceChangedSignal(Call* conf)
{
conferenceChanged(confId, state);
Q_UNUSED(conf)
updateConferenceList();
}
void SFLPhoneEngine::conferenceRemovedSignal(const QString& confId)
{
conferenceRemoved(confId);
}
void SFLPhoneEngine::incomingMessageSignal(const QString& accountId, const QString& message)
{
Q_UNUSED(accountId)
......
......@@ -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 SFLPHONEENGINE_H
#define SFLPHONEENGINE_H
......@@ -27,8 +27,9 @@
#include "../../src/lib/CallModel.h"
typedef QHash<QString,QVariant> HashStringString;
class SFLPhoneEngine : public Plasma::DataEngine, public CallModelConvenience
class Call;
class SFLPhoneEngine : public Plasma::DataEngine
{
Q_OBJECT
......@@ -41,23 +42,24 @@ class SFLPhoneEngine : public Plasma::DataEngine, public CallModelConvenience
bool updateSourceEvent(const QString& source);
private:
QHash<QString, HashStringString > historyCall;
QHash<QString, HashStringString > currentCall;
QHash<QString, QStringList> currentConferences;
QHash<QString, HashStringString > historyCall ;
QHash<QString, HashStringString > currentCall ;
QHash<QString, QStringList> currentConferences ;
CallModelConvenience* m_pModel;
QString getCallStateName(call_state state);
void updateHistory();
void updateCallList();
void updateContacts();
void updateConferenceList();
void updateHistory ();
void updateCallList ();
void updateContacts ();
void updateConferenceList ();
void updateInfo();
private slots:
void callStateChangedSignal(const QString& callId, const QString& state);
void incomingCallSignal(const QString& accountId, const QString& callId);
void conferenceCreatedSignal(const QString& confId);
void conferenceChangedSignal(const QString& confId, const QString& state);
void conferenceRemovedSignal(const QString& confId);
void incomingMessageSignal(const QString& accountId, const QString& message);
void voiceMailNotifySignal(const QString& accountId, int count);
void callStateChangedSignal (Call* call);
void incomingCallSignal (Call* conf);
void conferenceCreatedSignal (Call* conf);
void conferenceChangedSignal (Call* conf);
//void conferenceRemovedSignal(const QString& confId);
void incomingMessageSignal( const QString& accountId, const QString& message );
void voiceMailNotifySignal( const QString& accountId, int count );
void accountChanged();
};
......
This diff is collapsed.
......@@ -24,10 +24,10 @@ class CallTreeItemDelegate : public QItemDelegate
typedef CallModel<CallTreeItem*,QTreeWidgetItem*> TreeWidgetCallModel;
class CallView : public QTreeWidget, public TreeWidgetCallModel {
class CallView : public QTreeWidget/*, public TreeWidgetCallModel*/ {
Q_OBJECT
public:
CallView(QWidget* parent =0,ModelType type = ActiveCall);
CallView(QWidget* parent =0);
bool selectItem(Call* item);
Call* getCurrentItem();
bool removeItem(Call* item);
......@@ -35,10 +35,6 @@ class CallView : public QTreeWidget, public TreeWidgetCallModel {
void setTitle(QString title);
bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action);
virtual QMimeData* mimeData( const QList<QTreeWidgetItem *> items) const;
virtual Call* addCall(Call* call, Call* parent =0);
virtual Call* addConference(const QString &confID);
virtual bool conferenceChanged(const QString &confId, const QString &state);
virtual void conferenceRemoved(const QString &confId);
private:
QTreeWidgetItem* extractItem(QString callId);
......@@ -58,12 +54,18 @@ class CallView : public QTreeWidget, public TreeWidgetCallModel {
void destroyCall(Call* toDestroy);
void itemDoubleClicked(QTreeWidgetItem* item, int column);
void itemClicked(QTreeWidgetItem* item, int column);
Call* addCall(Call* call, Call* parent =0);
Call* addConference(Call* conf);
bool conferenceChanged(Call* conf);
void conferenceRemoved(Call* conf);
//D-Bus handling
// void callStateChangedSignal(const QString& callId, const QString& state);
// void incomingCallSignal(const QString& accountId, const QString& callId);
void conferenceCreatedSignal(const QString& confId);
void conferenceChangedSignal(const QString& confId, const QString& state);
void conferenceRemovedSignal(const QString& confId);
// void conferenceCreatedSignal(const QString& confId);
// void conferenceChangedSignal(const QString& confId, const QString& state);
// void conferenceRemovedSignal(const QString& confId);
// void incomingMessageSignal(const QString& accountId, const QString& message);
// void voiceMailNotifySignal(const QString& accountId, int count);
......
......@@ -40,6 +40,7 @@
#include "conf/ConfigurationSkeleton.h"
SFLPhone* SFLPhone::m_sApp = NULL;
TreeWidgetCallModel* SFLPhone::m_pModel = NULL;
SFLPhone::SFLPhone(QWidget *parent)
: KXmlGuiWindow(parent),
......@@ -48,7 +49,7 @@ SFLPhone::SFLPhone(QWidget *parent)
{
setupActions();
m_sApp = this;
}
}
SFLPhone* SFLPhone::app()
{
......@@ -59,9 +60,13 @@ SFLPhoneView* SFLPhone::view()
{
return m_pView;
}
CallView* SFLPhone::model()
TreeWidgetCallModel* SFLPhone::model()
{
return m_pView->model();
if (!m_pModel) {
m_pModel = new TreeWidgetCallModel(TreeWidgetCallModel::ActiveCall);
m_pModel->initCall();
}
return m_pModel;
}
ContactDock* SFLPhone::contactDock()
......
......@@ -47,6 +47,8 @@
class SFLPhoneView;
class CallView;
typedef CallModel<CallTreeItem*,QTreeWidgetItem*> TreeWidgetCallModel;
/**
* This class represents the SFLphone main window
* It implements the methods relative to windowing
......@@ -83,7 +85,6 @@ private:
KAction * action_hold;
KAction * action_transfer;
KAction * action_record;
QActionGroup * action_screen;
KAction * action_main;
KAction * action_mailBox;
KAction * action_close;
......@@ -92,6 +93,7 @@ private:
KAction * action_displayDialpad;
KAction * action_configureSflPhone;
KAction * action_accountCreationWizard;
QActionGroup * action_screen;
SFLPhoneView * m_pView;
QMenu *trayIconMenu;
......@@ -105,7 +107,7 @@ private:
BookmarkDock* m_pBookmarkDW;
static SFLPhone* m_sApp;
static TreeWidgetCallModel* m_pModel;
private:
void setObjectNames();
......@@ -127,7 +129,7 @@ public:
static SFLPhone* app();
SFLPhoneView* view();
CallView* model();
static TreeWidgetCallModel* model();
ContactDock* contactDock();
HistoryDock* historyDock();
......
This diff is collapsed.
......@@ -253,16 +253,16 @@ public slots:
//void on_callTree_itemChanged();
//void on_callTree_itemDoubleClicked(QTreeWidgetItem* item, int column);
void on1_callStateChanged(const QString &callID, const QString &state);
// 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*/);
void on1_incomingCall(Call* call);
//void on1_incomingMessage(const QString &accountID, const QString &message);
void on1_voiceMailNotify(const QString &accountID, int count);
void on1_volumeChanged(const QString &device, double value);
//void on1_audioManagerChanged();
void on1_incomingConference(const QString &confID);
void on1_changingConference(const QString &confID, const QString &state);
void on1_conferenceRemoved(const QString &confId);
// void on1_incomingConference(const QString &confID);
// void on1_changingConference(const QString &confID, const QString &state);
// void on1_conferenceRemoved(const QString &confId);
void changeScreen(int screen);
signals:
......
......@@ -472,8 +472,9 @@ call_state Call::stateChanged(const QString& newStateName)
call_state Call::actionPerformed(call_action action)
{
call_state previousState = currentState;
Q_ASSERT_X((previousState>10) || (previousState<0),"perform action","Invalid previous state ("+QString::number(previousState)+")");
Q_ASSERT_X((state>4) || (state < 0),"perform action","Invalid action ("+QString::number(actuon)+")");
Q_ASSERT_X((previousState>10) || (previousState<0),"perform action","Invalid previous state ("+QString::number(previousState)+")");
Q_ASSERT_X((state>4) || (state < 0),"perform action","Invalid action ("+QString::number(action)+")");
Q_ASSERT_X((action>5) || (action < 0),"perform action","Invalid action ("+QString::number(action)+")");
//update the state
changeCurrentState(actionPerformedStateMap[previousState][action]);
//execute the action associated with this transition
......
......@@ -19,3 +19,111 @@
**************************************************************************/
#include <CallModel.h>
bool CallModelBase::dbusInit = false;
CallModelBase::CallModelBase(QObject* parent) : QObject(parent)
{
if (!dbusInit) {
CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
connect(&callManager, SIGNAL( callStateChanged (const QString &, const QString & ) ), this , SLOT( on1_callStateChanged ( const QString &, const QString & ) ) );
connect(&callManager, SIGNAL( incomingCall (const QString &, const QString &, const QString & ) ), this , SLOT( on1_incomingCall ( const QString &, const QString & ) ) );
connect(&callManager, SIGNAL( conferenceCreated (const QString & ) ), this , SLOT( on1_incomingConference( const QString & ) ) );
connect(&callManager, SIGNAL( conferenceChanged (const QString &, const QString & ) ), this , SLOT( on1_changingConference( const QString &, const QString & ) ) );
connect(&callManager, SIGNAL( conferenceRemoved (const QString & ) ), this , SLOT( on1_conferenceRemoved ( const QString & ) ) );
connect(&callManager, SIGNAL( voiceMailNotify (const QString &, int ) ), this , SLOT( on1_voiceMailNotify ( const QString &, int ) ) );
connect(&callManager, SIGNAL( volumeChanged (const QString &, double ) ), this , SLOT( on1_volumeChanged ( const QString &, double ) ) );
dbusInit = true;
}
}
void CallModelBase::on1_callStateChanged(const QString &callID, const QString &state)
{
//This code is part of the CallModel iterface too
qDebug() << "Signal : Call State Changed for call " << callID << " . New state : " << state;
Call* call = findCallByCallId(callID);
if(!call) {
qDebug() << "Call not found";
if(state == CALL_STATE_CHANGE_RINGING) {
call = addRingingCall(callID);
}
else {
qDebug() << "Call doesn't exist in this client. Might have been initialized by another client instance before this one started.";
return;
}
}
else {
qDebug() << "Call found" << call;
call->stateChanged(state);
}
//updateWindowCallState(); //NEED_PORT
emit callStateChanged(call);
}
void CallModelBase::on1_incomingCall(const QString & accountID, const QString & callID)
{
qDebug() << "Signal : Incoming Call ! ID = " << callID;
Call* call = addIncomingCall(callID);
//NEED_PORT
// changeScreen(SCREEN_MAIN);
//
// SFLPhone::app()->activateWindow();
// SFLPhone::app()->raise();
// SFLPhone::app()->setVisible(true);
//emit incomingCall(call);
emit incomingCall(call);
}
void CallModelBase::on1_incomingConference(const QString &confID)
{
Call* conf = addConference(confID);
qDebug() << "---------------Adding conference" << conf << confID << "---------------";
emit conferenceCreated(conf);
}
void CallModelBase::on1_changingConference(const QString &confID, const QString &state)
{
Call* conf = getCall(confID);
qDebug() << "Changing conference state" << conf << confID;
if (conf) {
changeConference(confID, state);
emit conferenceChanged(conf);
}
else {
qDebug() << "Trying to affect a conference that does not exist (anymore)";
}
}
void CallModelBase::on1_conferenceRemoved(const QString &confId)
{
Call* conf = getCall(confId);
emit aboutToRemoveConference(conf);
removeConference(confId);
emit conferenceRemoved(confId);
}
void CallModelBase::on1_voiceMailNotify(const QString &accountID, int count)
{
qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID;
emit voiceMailNotify(accountID,count);
}
void CallModelBase::on1_volumeChanged(const QString & device, double value)
{
// qDebug() << "Signal : Volume Changed !";
// if(! (toolButton_recVol->isChecked() && value == 0.0))
// updateRecordBar();
// if(! (toolButton_sndVol->isChecked() && value == 0.0))
// updateVolumeBar();
emit volumeChanged(device,value);
}
Call* CallModelBase::addCall(Call* call, Call* parent)
{
emit callAdded(call,parent);
return call;
}
//More code in CallModel.hpp
\ No newline at end of file
......@@ -40,14 +40,48 @@
typedef QHash<QString, Call*> CallHash;
typedef QList<Call*> CallList;
class LIB_EXPORT CallModelBase : public QObject
{
Q_OBJECT
public:
CallModelBase(QObject* parent = 0);
virtual bool changeConference ( const QString &confId, const QString &state ) = 0;
virtual void removeConference ( const QString &confId ) = 0;
virtual Call* addConference ( const QString &confID ) = 0;
virtual Call* findCallByCallId ( QString callId ) = 0;
virtual Call* addRingingCall ( const QString& callId ) = 0;
virtual Call* addIncomingCall ( const QString& callId ) = 0;
virtual Call* addCall ( Call* call , Call* parent =0 );
virtual Call* getCall ( const QString callId ) const = 0;
public slots:
void on1_callStateChanged ( const QString& callID , const QString &state );
void on1_incomingCall ( const QString& accountID , const QString & callID );
void on1_incomingConference ( const QString& confID );
void on1_changingConference ( const QString& confID , const QString &state );
void on1_conferenceRemoved ( const QString& confId );
void on1_voiceMailNotify ( const QString& accountID , int count );
void on1_volumeChanged ( const QString& device , double value );
private:
static bool dbusInit;
signals:
void callStateChanged (Call* call );
void incomingCall (Call* call );
void conferenceCreated (Call* conf );
void conferenceChanged (Call* conf );
void conferenceRemoved (const QString& confId );
void aboutToRemoveConference (Call* conf );
void voiceMailNotify (const QString& accountID , int count );
void volumeChanged (const QString& device , double value );
void callAdded (Call* call , Call* parent );
};
/**
* Note from the author: It was previously done by a QAbstractModel + QTreeView, but the sip-call use case is incompatible
* with the MVC model. The MVC never got to a point were it was bug-free and the code was getting dirty. The Mirror model
* solution may be less "clean" than MVC, but is 3 time smaller and easier to improve (in fact, possible to improve).
*/
template <typename CallWidget, typename Index>
class LIB_EXPORT CallModel {
//Q_OBJECT
class LIB_EXPORT CallModel : public CallModelBase {
public:
enum ModelType {
ActiveCall,
......@@ -76,8 +110,8 @@ class LIB_EXPORT CallModel {
bool mergeConferences ( Call* conf1, Call* conf2 );
bool addParticipant ( Call* call2, Call* conference );
bool detachParticipant ( Call* call );
virtual bool conferenceChanged ( const QString &confId, const QString &state );
virtual void conferenceRemoved ( const QString &confId );
virtual bool changeConference ( const QString &confId, const QString &state );
virtual void removeConference ( const QString &confId );
virtual Call* addConference ( const QString &confID );
void removeConference ( Call* call );
......
......@@ -20,7 +20,7 @@ template <typename CallWidget, typename Index> typename CallModel<CallWidget,In
****************************************************************************/
///Retrieve current and older calls from the daemon, fill history and the calls TreeView and enable drag n' drop
template<typename CallWidget, typename Index> CallModel<CallWidget,Index>::CallModel(ModelType type)
template<typename CallWidget, typename Index> CallModel<CallWidget,Index>::CallModel(ModelType type) : CallModelBase(0)
{
Q_UNUSED(type)
init();
......@@ -135,6 +135,7 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,
template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::addCall(Call* call, Call* parent)
{
Q_UNUSED(parent)
qDebug() << "-------------------Adding call" << call << "-------------------";
InternalStruct* aNewStruct = new InternalStruct;
aNewStruct->call_real = call;
aNewStruct->conference = false;
......@@ -143,7 +144,7 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
m_pPrivateCallList_callId[call->getCallId()] = aNewStruct;
//setCurrentItem(callItem);
CallModelBase::addCall(call,parent);
return call;
}
......@@ -245,9 +246,10 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
InternalStruct* aNewStruct = new InternalStruct;
aNewStruct->call_real = newConf;
aNewStruct->conference = true;
m_pPrivateCallList_call[newConf] = aNewStruct;
m_pPrivateCallList_callId[newConf->getConfId()] = aNewStruct; //WARNING It may break something is it is done wrong
m_pPrivateCallList_call[newConf] = aNewStruct;
m_pPrivateCallList_callId[confID] = aNewStruct;
return newConf;
}
......@@ -292,7 +294,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
}
///Executed when the daemon signal a modification in an existing conference. Update the call list and update the TreeView
template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::conferenceChanged(const QString& confId, const QString& state)
template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::changeConference(const QString& confId, const QString& state)
{
qDebug() << "Conf changed2";
Q_UNUSED(state)
......@@ -310,7 +312,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
}
///Remove a conference from the model and the TreeView
template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::conferenceRemoved(const QString &confId)
template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::removeConference(const QString &confId)
{
qDebug() << "Ending conversation containing " << m_pPrivateCallList_callId[confId]->children.size() << " participants";
removeConference(getCall(confId));
......@@ -539,7 +541,7 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,
///Update the index associated with this call
template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::updateIndex (Call* call, Index value )
{
{
if (!m_pPrivateCallList_call[call]) {
m_pPrivateCallList_call[call] = new InternalStruct;
m_pPrivateCallList_call[call]->call_real = call;
......
......@@ -282,27 +282,27 @@
typedef enum
{
/** Ringing incoming call */
CALL_STATE_INCOMING,
CALL_STATE_INCOMING =0,
/** Ringing outgoing call */
CALL_STATE_RINGING,
CALL_STATE_RINGING=1,
/** Call to which the user can speak and hear */
CALL_STATE_CURRENT,
CALL_STATE_CURRENT=2,
/** Call which numbers are being added by the user */
CALL_STATE_DIALING,
CALL_STATE_DIALING=3,
/** Call is on hold */
CALL_STATE_HOLD,
CALL_STATE_HOLD=4,
/** Call has failed */
CALL_STATE_FAILURE,
CALL_STATE_FAILURE=5,
/** Call is busy */
CALL_STATE_BUSY,
CALL_STATE_BUSY=6,
/** Call is being transfered. During this state, the user can enter the new number. */
CALL_STATE_TRANSFER,
CALL_STATE_TRANSFER=7,
/** Call is on hold for transfer */
CALL_STATE_TRANSF_HOLD,
CALL_STATE_TRANSF_HOLD=8,
/** Call is over and should not be used */
CALL_STATE_OVER,
CALL_STATE_OVER=9,
/** This state should never be reached */
CALL_STATE_ERROR
CALL_STATE_ERROR=10
} call_state;
/** MIME API */
......
......@@ -54,7 +54,7 @@ int main(int argc, char **argv)
KCmdLineArgs::addCmdLineOptions(options);
//configuration dbus
CallView::init();
TreeWidgetCallModel::init();
SFLPhoneApplication app;
......
......@@ -115,6 +115,7 @@ void CallTreeItem::setCall(Call *call)
void CallTreeItem::updated()
{
qDebug() << "Updating tree item";
Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(itemCall->getPeerPhoneNumber());
if (contact) {
labelIcon->setPixmap(*contact->getPhoto());
......
......@@ -238,9 +238,10 @@ void HistoryTreeItem::sendEmail()
void HistoryTreeItem::callAgain()
{
qDebug() << "Calling "<< itemCall->getPeerPhoneNumber();
SFLPhone::app()->model()->addDialingCall(m_pName, SFLPhone::app()->model()->getCurrentAccountId())->setCallNumber(m_pPhoneNumber);