diff --git a/src/Account.cpp b/src/Account.cpp index 6e4f05e0cc52e257d072067ef813efdbcd430ab9..e3b349d930f2cdcdddf0c4bb3097617638990b4c 100644 --- a/src/Account.cpp +++ b/src/Account.cpp @@ -183,7 +183,7 @@ bool Account::isEnabled() const ///Is this account registered bool Account::isRegistered() const { - return (getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED); + return (getAccountDetail(ACCOUNT_REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED); } @@ -232,8 +232,8 @@ void Account::updateState() if(! isNew()) { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); MapStringString details = configurationManager.getAccountDetails(getAccountId()).value(); - QString status = details[REGISTRATION_STATUS]; - setAccountDetail(REGISTRATION_STATUS, status); //Update -internal- object state + QString status = details[ACCOUNT_REGISTRATION_STATUS]; + setAccountDetail(ACCOUNT_REGISTRATION_STATUS, status); //Update -internal- object state } } diff --git a/src/AccountList.cpp b/src/AccountList.cpp index 30c440de2cf37e91b4b7b3e07fca06a531679e4c..9b46222014f547b8befa3c7219948395a00aeee3 100644 --- a/src/AccountList.cpp +++ b/src/AccountList.cpp @@ -143,7 +143,7 @@ QVector<Account*> AccountList::getAccountsByState(const QString& state) { QVector<Account *> v; for (int i = 0; i < m_pAccounts->size(); ++i) { - if ((*m_pAccounts)[i]->getAccountDetail(REGISTRATION_STATUS) == state) + if ((*m_pAccounts)[i]->getAccountDetail(ACCOUNT_REGISTRATION_STATUS) == state) v += (*m_pAccounts)[i]; } return v; @@ -157,7 +157,7 @@ QVector<Account*> AccountList::registeredAccounts() const Account* current; for (int i = 0; i < m_pAccounts->count(); ++i) { current = (*m_pAccounts)[i]; - if(current->getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED) { + if(current->getAccountDetail(ACCOUNT_REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED) { qDebug() << current->getAlias() << " : " << current; registeredAccounts.append(current); } @@ -171,11 +171,11 @@ Account* AccountList::firstRegisteredAccount() const Account* current; for (int i = 0; i < m_pAccounts->count(); ++i) { current = (*m_pAccounts)[i]; - if(current && current->getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED) { + if(current && current->getAccountDetail(ACCOUNT_REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED) { return current; } else { - qDebug() << "Account " << ((current)?current->getAccountId():"") << " is not registered (" << ((current)?current->getAccountDetail(REGISTRATION_STATUS):"") << ") State:" << ((current)?current->getAccountDetail(REGISTRATION_STATUS):""); + qDebug() << "Account " << ((current)?current->getAccountId():"") << " is not registered (" << ((current)?current->getAccountDetail(ACCOUNT_REGISTRATION_STATUS):"") << ") State:" << ((current)?current->getAccountDetail(ACCOUNT_REGISTRATION_STATUS):""); } } return NULL; diff --git a/src/CallModel.cpp b/src/CallModel.cpp index 66c37d1f39618cb30c86b023e0a3b91b6e070cd8..79acc3b3df532e8ae78b120b7f289b311b003a3b 100644 --- a/src/CallModel.cpp +++ b/src/CallModel.cpp @@ -60,7 +60,12 @@ void CallModelBase::on1_callStateChanged(const QString &callID, const QString &s qDebug() << "Call found" << call; call->stateChanged(state); } - //updateWindowCallState(); //NEED_PORT + + if (call->getCurrentState() == CALL_STATE_OVER) { + addToHistory(call); + emit historyChanged(); + } + emit callStateChanged(call); } diff --git a/src/CallModel.h b/src/CallModel.h index 7644138291457ed5aa2a1c0ba8de6840a383fe4e..924264d8f9907556eafa1ba2bc373069b484dc1b 100644 --- a/src/CallModel.h +++ b/src/CallModel.h @@ -54,6 +54,7 @@ public: virtual Call* findCallByCallId ( const QString& callId ) = 0; virtual Call* addRingingCall ( const QString& callId ) = 0; virtual Call* addIncomingCall ( const QString& callId ) = 0; + virtual void addToHistory ( Call* call ) = 0; virtual Call* addCall ( Call* call , Call* parent =0 ); virtual Call* getCall ( const QString& callId ) const = 0; public slots: @@ -67,15 +68,16 @@ public slots: 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 ); + 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 ); + void historyChanged ( ); }; /** @@ -109,6 +111,7 @@ class LIB_EXPORT CallModel : public CallModelBase { void removeCall ( Call* call ); void attendedTransfer ( Call* toTransfer , Call* target ); void transfer ( Call* toTransfer , QString target ); + void addToHistory ( Call* call ); virtual bool selectItem(Call* item) { Q_UNUSED(item); return false;} diff --git a/src/CallModel.hpp b/src/CallModel.hpp index 8fb295df4de58fd0e407396aa166953017ccbe92..2145ac8cf2901c67eca394acac68c3269b090f5a 100644 --- a/src/CallModel.hpp +++ b/src/CallModel.hpp @@ -419,6 +419,14 @@ template<typename CallWidget, typename Index> const CallHash& CallModel<CallWidg return m_sHistoryCalls; } +///Add to history +template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::addToHistory(Call* call) +{ + if (call) { + m_sHistoryCalls[call->getStartTimeStamp()] = call; + } +} + /***************************************************************************** * * * Account related code * @@ -442,7 +450,7 @@ template<typename CallWidget, typename Index> QString CallModel<CallWidget,Index template<typename CallWidget, typename Index> Account* CallModel<CallWidget,Index>::getCurrentAccount() { Account* priorAccount = getAccountList()->getAccountById(m_sPriorAccountId); - if(priorAccount && priorAccount->getAccountDetail(REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED ) { + if(priorAccount && priorAccount->getAccountDetail(ACCOUNT_REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED ) { return priorAccount; } else { diff --git a/src/sflphone_const.h b/src/sflphone_const.h index 500cca98cf09c24c4a25a53963febed4f9c074de..14d75422623f5a614bcc137288bbebe9dae690d6 100644 --- a/src/sflphone_const.h +++ b/src/sflphone_const.h @@ -173,6 +173,10 @@ #define ACCOUNT_MAILBOX "Account.mailbox" #define ACCOUNT_USERAGENT "Account.useragent" #define ACCOUNT_REGISTRATION_EXPIRE "Account.registrationExpire" +#define ACCOUNT_REGISTRATION_STATUS "Account.registrationStatus" +#define ACCOUNT_REGISTRATION_STATE_CODE "Account.registrationCode" +#define ACCOUNT_REGISTRATION_STATE_DESC "Account.registrationDescription" + #define ACCOUNT_SIP_STUN_SERVER "STUN.server" #define ACCOUNT_SIP_STUN_ENABLED "STUN.enable" #define ACCOUNT_DTMF_TYPE "Account.dtmfType" @@ -211,16 +215,6 @@ #define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec" #define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec" -#define LOCAL_INTERFACE "Account.localInterface" -#define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" -#define LOCAL_PORT "Account.localPort" -#define PUBLISHED_PORT "Account.publishedPort" -#define PUBLISHED_ADDRESS "Account.publishedAddress" - -#define REGISTRATION_STATUS "Registration.Status" -#define REGISTRATION_STATE_CODE "Registration.code" -#define REGISTRATION_STATE_DESCRIPTION "Registration.description" - #define SHORTCUT_PICKUP "pickUp" #define SHORTCUT_HANGUP "hangUp" #define SHORTCUT_POPUP "popupWindow" @@ -236,6 +230,12 @@ #define CONFIG_ACCOUNT_DEFAULT_REALM "*" #define CONFIG_ACCOUNT_USERAGENT "Account.useragent" +#define LOCAL_INTERFACE "Account.localInterface" +#define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" +#define LOCAL_PORT "Account.localPort" +#define PUBLISHED_PORT "Account.publishedPort" +#define PUBLISHED_ADDRESS "Account.publishedAddress" + /** Maybe to remove **/ // #define ACCOUNT_EXPIRE "Account.expire"