diff --git a/kde/src/conf/dlgaccounts.cpp b/kde/src/conf/dlgaccounts.cpp index 645568ce76492a1c58b0bd239e4ba5ecf34ffd62..b94a89b6227099f5c88d6fadf26043d4d3509794 100755 --- a/kde/src/conf/dlgaccounts.cpp +++ b/kde/src/conf/dlgaccounts.cpp @@ -575,6 +575,7 @@ void DlgAccounts::on_button_accountAdd_clicked() QString itemName = QInputDialog::getText(this, "New account", "Enter new account's alias"); itemName = itemName.simplified(); if (!itemName.isEmpty()) { + AccountList::getInstance()->addAccount(itemName); int r = listView_accountList->model()->rowCount() - 1; listView_accountList->setCurrentIndex(listView_accountList->model()->index(r,0)); frame2_editAccounts->setEnabled(true); diff --git a/kde/src/lib/Account.cpp b/kde/src/lib/Account.cpp index 3cc6cf8867b21ecfbc290427ffdc909d55f78cdc..e25fc86621f700eb5d2ed8b39379b5a776277432 100644 --- a/kde/src/lib/Account.cpp +++ b/kde/src/lib/Account.cpp @@ -71,7 +71,7 @@ const QString& account_state_name(const QString& s) } //account_state_name ///Constructors -Account::Account():m_pAccountId(NULL),m_pAccountDetails(NULL) +Account::Account():m_pAccountId(NULL),m_pAccountDetails(NULL),m_Temporary(false) { CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); connect(&callManager,SIGNAL(registrationStateChanged(QString,QString,int)),this,SLOT(accountChanged(QString,QString,int))); @@ -198,6 +198,12 @@ bool Account::isRegistered() const return (getAccountDetail(ACCOUNT_REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED); } +///If this account is really part of the model or just "in progress" that can be canceled +bool Account::isTemporary() const +{ + return m_Temporary; +} + ///Return the model index of this item QModelIndex Account::getIndex() { @@ -266,6 +272,12 @@ void Account::setEnabled(bool checked) setAccountDetail(ACCOUNT_ENABLED, checked ? REGISTRATION_ENABLED_TRUE : REGISTRATION_ENABLED_FALSE); } +///Set if the account is temporary (work in progress, can be cancelled) +void Account::setTemporary(bool value) +{ + m_Temporary = value; +} + /***************************************************************************** * * * Mutator * @@ -286,6 +298,7 @@ void Account::updateState() ///Save the current account to the daemon void Account::save() { + if (isTemporary()) return; ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); if (isNew()) { MapStringString details = getAccountDetails(); diff --git a/kde/src/lib/Account.h b/kde/src/lib/Account.h index f03ce62af7a12af08e965d0ce1b32f826f05d3a6..5ea7d5ea88b265eee601dfb35b8009e74c65305a 100644 --- a/kde/src/lib/Account.h +++ b/kde/src/lib/Account.h @@ -53,6 +53,7 @@ class LIB_EXPORT Account : public QObject { const QString& getAlias() const; bool isEnabled() const; bool isRegistered() const; + bool isTemporary() const; QModelIndex getIndex() ; QString getStateColorName() const; Qt::GlobalColor getStateColor() const; @@ -134,6 +135,7 @@ class LIB_EXPORT Account : public QObject { void setAccountId (const QString& id ); void setAccountDetails (const MapStringString& m ); void setAccountDetail (const QString& param, const QString& val ); + void setTemporary (const bool value ); #ifdef ENABLE_VIDEO void setActiveVideoCodecList(QList<VideoCodec*> codecs); QList<VideoCodec*> getActiveVideoCodecList(); @@ -228,6 +230,9 @@ class LIB_EXPORT Account : public QObject { private slots: void accountChanged(QString accountId,QString stateName, int state); + private: + bool m_Temporary; + signals: ///The account state (Invalif,Trying,Registered) changed void stateChanged(QString state);