diff ui/mainwindow.cpp @ 719:49bf73b5c7de

(Issue34) Show / hide details area depending on available changes
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 02 Jul 2014 16:35:16 +0200
parents e7a070e64b80
children b0929968562a
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Wed Jul 02 16:27:46 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Jul 02 16:35:16 2014 +0200
@@ -834,14 +834,6 @@
     mChangeCount = mUpdatesRemove->selectedCertCount() +
         mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size();
 
-    if (mUpdatesManual->certificates().size()) {
-        mUpdatesDetailsManual->show();
-        mUpdatesManualCertificates->show();
-    } else {
-        mUpdatesDetailsManual->hide();
-        mUpdatesManualCertificates->hide();
-    }
-
     /* Show a different tip in case of manual changes, updates aviailable, updates and manual
      * changes available */
     if (changeCount() && !mUpdatesManual->certificates().size()) {
@@ -869,6 +861,16 @@
         mInstallButton->setText(" " + tr("Apply changes"));
     }
 
+    if (mUpdatesManual->certificates().size()) {
+        mUpdatesDetailsManual->show();
+        mUpdatesDetailsManual->setText(tr("Show details"));
+        mUpdatesManualCertificates->show();
+    } else {
+        mUpdatesDetailsManual->hide();
+        mUpdatesManualCertificates->hide();
+        mUpdatesManual->hide();
+    }
+
     if (mUpdatesNew->certificates().size()) {
         mUpdatesNewCertificates->setText("<h3>" +
                 tr("Install new trusted certificates (%1/%2)")
@@ -876,9 +878,11 @@
                 .arg(mUpdatesNew->certificates().size()) +
                 "</h3>");
         mUpdatesDetailsNew->show();
+        mUpdatesDetailsNew->setText(tr("Show details"));
         mUpdatesNewCertificates->show();
     } else {
         mUpdatesDetailsNew->hide();
+        mUpdatesNew->hide();
         mUpdatesNewCertificates->hide();
     }
 
@@ -889,10 +893,12 @@
                 .arg(mUpdatesRemove->certificates().size()) +
                 "</h3>");
         mUpdatesRemoveCertificates->show();
+        mUpdatesDetailsRemove->setText(tr("Show details"));
         mUpdatesDetailsRemove->show();
     } else {
         mUpdatesRemoveCertificates->hide();
         mUpdatesDetailsRemove->hide();
+        mUpdatesRemove->hide();
     }
 }
 

http://wald.intevation.org/projects/trustbridge/