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

List:       kde-commits
Subject:    extragear/office/skrooge
From:       Stephane Mankowski <stephane () mankowski ! fr>
Date:       2011-02-06 16:45:14
Message-ID: 20110206164514.31B25AC8D0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1219159 by smankowski:

feature: Possibility to merge accounts by using massive update on name of accounts

 M  +1 -0      CHANGELOG  
 M  +23 -1     skrooge_bank/skgbankpluginwidget.cpp  


--- trunk/extragear/office/skrooge/CHANGELOG #1219158:1219159
@@ -32,6 +32,7 @@
   *New feature: Property dock is able to display all properties
   *New feature: New "About" panel using KDE 4.6 features
   *New feature: Better mass update on "account", "payee", "tracker" and "unit" pages
+  *New feature: Possibility to merge accounts by using massive update on name of \
accounts  
  -- maintainer Stephane MANKOWSKI <stephane@mankowski.fr>  xxx
 
--- trunk/extragear/office/skrooge/skrooge_bank/skgbankpluginwidget.cpp \
#1219158:1219159 @@ -306,7 +306,7 @@
 
 SKGError SKGBankPluginWidget::setInitialBalanceFromEditor(SKGAccountObject& \
iAccount)  {
-    return iAccount.setInitialBalance(ui.kAmountEdit->value(), \
ui.kUnitEdit->getUnit()); +    return (ui.kAmountEdit->text()!=NOUPDATE &&  \
ui.kUnitEdit->text()!=NOUPDATE ? iAccount.setInitialBalance(ui.kAmountEdit->value(), \
ui.kUnitEdit->getUnit()) : SKGError());  }
 
 void SKGBankPluginWidget::onAddAccountClicked()
@@ -375,6 +375,28 @@
         SKGObjectBase::SKGListSKGObjectBase selection = getSelectedObjects();
 
         int nb = selection.count();
+
+        //Is it a massive modification of accounts to merge them ?
+        if(nb > 1 && ui.kAccountCreatorAccount->text() != NOUPDATE && \
!ui.kAccountCreatorAccount->text().startsWith(QLatin1String("="))) { +            \
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor)); +            int code = \
KMessageBox::questionYesNo(this, i18nc("Question", "You are trying to modify all \
names of selected accounts.\nDo you want to merge them?")); +            \
QApplication::restoreOverrideCursor(); +            if(code == KMessageBox::Yes) {
+                //Do the merge
+                SKGBEGINTRANSACTION(*getDocument(), i18nc("Noun, name of the user \
action", "Merge accounts"), err); +                SKGAccountObject accountObj1 = \
selection[0]; +                for(int i = 1; err.isSucceeded() && i < nb; ++i) {
+                    SKGAccountObject accountObj = selection[i];
+                    err = accountObj1.merge(accountObj);
+                }
+
+                //Change selection for the rest of the operation
+                selection.clear();
+                selection.push_back(accountObj1);
+                nb = 1;
+            }
+        }
+
         SKGBEGINPROGRESSTRANSACTION(*getDocument(), i18nc("Updating an account", \
"Account update"), err, nb);  for(int i = 0; err.isSucceeded() && i < nb; ++i) {
             SKGAccountObject accountObj = selection[i];


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

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