[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [sflphone-kde] src: [ #14078 ] Handle unselected outdated and modified account when cancelling
From:       Emmanuel Lepage Vallee <emmanuel.lepage () savoirfairelinux ! com>
Date:       2012-07-31 19:00:11
Message-ID: 20120731190011.CD569A6094 () git ! kde ! org
[Download RAW message or body]

Git commit 96b13b7cd2030c9c06c2c333ccc201b0787b93fa by Emmanuel Lepage Vallee.
Committed on 31/07/2012 at 21:00.
Pushed by lepagevalleeemmanuel into branch 'master'.

[ #14078 ] Handle unselected outdated and modified account when cancelling

M  +1    -1    src/accountwizard.cpp
M  +8    -3    src/conf/dlgaccounts.cpp
M  +7    -2    src/lib/account.cpp
M  +1    -0    src/sflphone.cpp

http://commits.kde.org/sflphone-kde/96b13b7cd2030c9c06c2c333ccc201b0787b93fa

diff --git a/src/accountwizard.cpp b/src/accountwizard.cpp
index 94c4ebd..0ca4a61 100755
--- a/src/accountwizard.cpp
+++ b/src/accountwizard.cpp
@@ -521,7 +521,7 @@ WizardAccountSIPFormPage::WizardAccountSIPFormPage(QWidget \
*parent)  checkBox_enableZrtp = new QCheckBox;
 
    lineEdit_alias->setPlaceholderText    ( i18n("Anything, used only locally")       \
                );
-   lineEdit_server->setPlaceholderText   ( i18n("Exemple: sip.sflphone.org or \
192.168.0.2")    ); +   lineEdit_server->setPlaceholderText   ( i18n("Example: \
sip.sflphone.org or 192.168.0.2")    );  lineEdit_user->setPlaceholderText     ( \
i18n("Usually your extension number")               );  \
lineEdit_password->setPlaceholderText ( i18n("SIP password, ask your network \
administrator"));  lineEdit_voicemail->setPlaceholderText( i18n("Usually the same as \
                the username")            );
diff --git a/src/conf/dlgaccounts.cpp b/src/conf/dlgaccounts.cpp
index 999f841..d46595e 100755
--- a/src/conf/dlgaccounts.cpp
+++ b/src/conf/dlgaccounts.cpp
@@ -231,9 +231,14 @@ void DlgAccounts::saveAccount(QModelIndex item)
 
 void DlgAccounts::cancel()
 {
-   Account* account = \
AccountList::getInstance()->getAccountByModelIndex(listView_accountList->currentIndex());
                
-   if (account) {
-      account->performAction(CANCEL);
+//    Account* account = \
AccountList::getInstance()->getAccountByModelIndex(listView_accountList->currentIndex());
 +//    if (account) {
+//       account->performAction(CANCEL);
+//    }
+   const QVector<Account*> accs = AccountList::getInstance()->getAccounts();
+   foreach (Account* a, accs) {
+      if (a->currentState() == MODIFIED || a->currentState() == OUTDATED)
+         a->performAction(CANCEL);
    }
 }
 
diff --git a/src/lib/account.cpp b/src/lib/account.cpp
index 58aa9f4..e900aff 100644
--- a/src/lib/account.cpp
+++ b/src/lib/account.cpp
@@ -288,16 +288,21 @@ void Account::setAccountDetails(const MapStringString& m)
 ///Set a specific detail
 bool Account::setAccountDetail(const QString& param, const QString& val)
 {
+   bool changed = (*m_pAccountDetails)[param] != val;
    QString buf = (*m_pAccountDetails)[param];
    if (param == ACCOUNT_REGISTRATION_STATUS) {
       (*m_pAccountDetails)[param] = val;
-      emit detailChanged(this,param,val,buf);
+      if (changed) {
+         emit detailChanged(this,param,val,buf);
+      }
    }
    else {
       performAction(AccountEditAction::MODIFY);
       if (m_CurrentState == MODIFIED || m_CurrentState == NEW) {
          (*m_pAccountDetails)[param] = val;
-         emit detailChanged(this,param,val,buf);
+         if (changed) {
+            emit detailChanged(this,param,val,buf);
+         }
       }
    }
    return m_CurrentState == MODIFIED || m_CurrentState == NEW;
diff --git a/src/sflphone.cpp b/src/sflphone.cpp
index f8be920..882296d 100755
--- a/src/sflphone.cpp
+++ b/src/sflphone.cpp
@@ -234,6 +234,7 @@ bool SFLPhone::initialize()
 
    connect(m_pAccountStatus, SIGNAL(currentIndexChanged(int)), this, \
SLOT(currentAccountIndexChanged(int)) );  connect(AccountList::getInstance(), \
SIGNAL(priorAccountChanged(Account*)),this,SLOT(currentPriorAccountChanged(Account*)));
 +   currentPriorAccountChanged(AccountList::getCurrentAccount());
    
    return true;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic