Skip to content
Snippets Groups Projects
Commit 92bd5ce8 authored by Emmanuel Lepage's avatar Emmanuel Lepage
Browse files

[ #12352 ] Fix adding account

parent a6972aa5
No related branches found
No related tags found
No related merge requests found
...@@ -575,6 +575,7 @@ void DlgAccounts::on_button_accountAdd_clicked() ...@@ -575,6 +575,7 @@ void DlgAccounts::on_button_accountAdd_clicked()
QString itemName = QInputDialog::getText(this, "New account", "Enter new account's alias"); QString itemName = QInputDialog::getText(this, "New account", "Enter new account's alias");
itemName = itemName.simplified(); itemName = itemName.simplified();
if (!itemName.isEmpty()) { if (!itemName.isEmpty()) {
AccountList::getInstance()->addAccount(itemName);
int r = listView_accountList->model()->rowCount() - 1; int r = listView_accountList->model()->rowCount() - 1;
listView_accountList->setCurrentIndex(listView_accountList->model()->index(r,0)); listView_accountList->setCurrentIndex(listView_accountList->model()->index(r,0));
frame2_editAccounts->setEnabled(true); frame2_editAccounts->setEnabled(true);
......
...@@ -71,7 +71,7 @@ const QString& account_state_name(const QString& s) ...@@ -71,7 +71,7 @@ const QString& account_state_name(const QString& s)
} //account_state_name } //account_state_name
///Constructors ///Constructors
Account::Account():m_pAccountId(NULL),m_pAccountDetails(NULL) Account::Account():m_pAccountId(NULL),m_pAccountDetails(NULL),m_Temporary(false)
{ {
CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
connect(&callManager,SIGNAL(registrationStateChanged(QString,QString,int)),this,SLOT(accountChanged(QString,QString,int))); connect(&callManager,SIGNAL(registrationStateChanged(QString,QString,int)),this,SLOT(accountChanged(QString,QString,int)));
...@@ -198,6 +198,12 @@ bool Account::isRegistered() const ...@@ -198,6 +198,12 @@ bool Account::isRegistered() const
return (getAccountDetail(ACCOUNT_REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED); 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 ///Return the model index of this item
QModelIndex Account::getIndex() QModelIndex Account::getIndex()
{ {
...@@ -266,6 +272,12 @@ void Account::setEnabled(bool checked) ...@@ -266,6 +272,12 @@ void Account::setEnabled(bool checked)
setAccountDetail(ACCOUNT_ENABLED, checked ? REGISTRATION_ENABLED_TRUE : REGISTRATION_ENABLED_FALSE); 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 * * Mutator *
...@@ -286,6 +298,7 @@ void Account::updateState() ...@@ -286,6 +298,7 @@ void Account::updateState()
///Save the current account to the daemon ///Save the current account to the daemon
void Account::save() void Account::save()
{ {
if (isTemporary()) return;
ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
if (isNew()) { if (isNew()) {
MapStringString details = getAccountDetails(); MapStringString details = getAccountDetails();
......
...@@ -53,6 +53,7 @@ class LIB_EXPORT Account : public QObject { ...@@ -53,6 +53,7 @@ class LIB_EXPORT Account : public QObject {
const QString& getAlias() const; const QString& getAlias() const;
bool isEnabled() const; bool isEnabled() const;
bool isRegistered() const; bool isRegistered() const;
bool isTemporary() const;
QModelIndex getIndex() ; QModelIndex getIndex() ;
QString getStateColorName() const; QString getStateColorName() const;
Qt::GlobalColor getStateColor() const; Qt::GlobalColor getStateColor() const;
...@@ -134,6 +135,7 @@ class LIB_EXPORT Account : public QObject { ...@@ -134,6 +135,7 @@ class LIB_EXPORT Account : public QObject {
void setAccountId (const QString& id ); void setAccountId (const QString& id );
void setAccountDetails (const MapStringString& m ); void setAccountDetails (const MapStringString& m );
void setAccountDetail (const QString& param, const QString& val ); void setAccountDetail (const QString& param, const QString& val );
void setTemporary (const bool value );
#ifdef ENABLE_VIDEO #ifdef ENABLE_VIDEO
void setActiveVideoCodecList(QList<VideoCodec*> codecs); void setActiveVideoCodecList(QList<VideoCodec*> codecs);
QList<VideoCodec*> getActiveVideoCodecList(); QList<VideoCodec*> getActiveVideoCodecList();
...@@ -228,6 +230,9 @@ class LIB_EXPORT Account : public QObject { ...@@ -228,6 +230,9 @@ class LIB_EXPORT Account : public QObject {
private slots: private slots:
void accountChanged(QString accountId,QString stateName, int state); void accountChanged(QString accountId,QString stateName, int state);
private:
bool m_Temporary;
signals: signals:
///The account state (Invalif,Trying,Registered) changed ///The account state (Invalif,Trying,Registered) changed
void stateChanged(QString state); void stateChanged(QString state);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment