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

List:       kde-commits
Subject:    extragear/office/skrooge/skrooge_operation
From:       Guillaume De Bure <guillaume.debure () gmail ! com>
Date:       2010-07-28 18:26:22
Message-ID: 20100728182622.3C68CAC779 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1156230 by gdebure:

Attempt at providing a more intelligent way of switching mode in the "information zone" :
* If several operations are selected, show the total amount for the selection
* If a 0 or 1 operation is selected, show the balance information
* Upon checking an operation, automatically switch to reconciliation mode

Still needs some work, but provides a first working basis...

 M  +49 -9     skgoperationpluginwidget.cpp  
 M  +3 -0      skgoperationpluginwidget.h  


--- trunk/extragear/office/skrooge/skrooge_operation/skgoperationpluginwidget.cpp #1156229:1156230
@@ -370,9 +370,20 @@
                 ui.kTrackerEdit->setText ( NOUPDATE );
                 ui.kCommentEdit->setText ( NOUPDATE );
                 ui.kPayeeEdit->setText ( NOUPDATE );
+                
+                if (modeInfoZone != 1) displaySelectionAmount();                
+                
             }
             else
             {
+                
+                if (obj.getStatus() == SKGOperationObject::POINTED) {
+                    displayReconciliationInfo();
+                }
+                else if (modeInfoZone != 1) {
+                    displayBalance();
+                }
+                
                 //It is a single selection
                 //Is it a split ?
                 int nbSubOperations = obj.getNbSubOperations();
@@ -2067,28 +2078,57 @@
     SKGTRACEIN ( 10, "SKGOperationPluginWidget::onRotateAccountTools" );
     if ( modeInfoZone==0 )
     {
-        //Switch to reconciliation mode
-        ui.kReconciliatorFrame2->show();
-        ui.kInfo->hide();
-        modeInfoZone=1;
+        displayReconciliationInfo();
     }
     else if ( modeInfoZone==1 )
     {
-        //Switch to information on selection mode
-        ui.kReconciliatorFrame2->hide();
-        ui.kInfo->show();
-        modeInfoZone=2;
+        displaySelectionAmount();
     }
     else
     {
-        //Switch to information mode
+        displayBalance();
+    }
+}
+
+
+void SKGOperationPluginWidget::displayBalance()
+{
         ui.kReconciliatorFrame2->hide();
         ui.kInfo->show();
         modeInfoZone=0;
+    onRefreshInformationZone();
     }
+
+void SKGOperationPluginWidget::displayReconciliationInfo()
+{
+    if (ui.kDisplayAccountCombo->currentIndex() != 0) 
+    {
+        // Only show reconciliation info if only one account is displayed
+        ui.kReconciliatorFrame2->show();
+        ui.kInfo->hide();
+        modeInfoZone=1;
     onRefreshInformationZone();
 }
+    else
+    {
+        // If more than one account is displayed, skip reconciliation mode
+        // (it doesn't make sense to reconciliate several accounts at once)
+        // and move to the next modeInfoZone
+        modeInfoZone = 1;
+        onRotateAccountTools();
+    }
+}
 
+void SKGOperationPluginWidget::displaySelectionAmount()
+{
+    ui.kReconciliatorFrame2->hide();
+    ui.kInfo->show();
+    modeInfoZone=2;
+    onRefreshInformationZone();
+}
+
+
+
 void SKGOperationPluginWidget::onValidatePointedOperations()
 {
     SKGError err;
--- trunk/extragear/office/skrooge/skrooge_operation/skgoperationpluginwidget.h #1156229:1156230
@@ -156,6 +156,9 @@
     void onBtnModeClicked();
     void onTemplateModeClicked();
     void cleanEditor();
+    void displaySelectionAmount();
+    void displayReconciliationInfo();
+    void displayBalance();
 
 private:
     Q_DISABLE_COPY ( SKGOperationPluginWidget );
[prev in list] [next in list] [prev in thread] [next in thread] 

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