diff ui/mainwindow.cpp @ 524:a097dd86cb4d

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 29 Apr 2014 15:26:43 +0200
parents ca583ffe728a d1812e171d0c
children 3edbe1af2c85
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Tue Apr 29 15:26:02 2014 +0200
+++ b/ui/mainwindow.cpp	Tue Apr 29 15:26:43 2014 +0200
@@ -50,6 +50,7 @@
 #include "certificateitemdelegate.h"
 #include "separatoritemdelegate.h"
 #include "installwrapper.h"
+#include "util.h"
 
 MainWindow::MainWindow(bool trayMode):
     mTrayMode(trayMode)
@@ -392,11 +393,11 @@
     connect(mAutoStartOption, SIGNAL(stateChanged(int)),
         this, SLOT(saveAutoStart(int)));
     mSettings.beginGroup("settings");
-    int autoUpdate = mSettings.value("autoupdate").toInt();
-    int autoStart = mSettings.value("autostart").toInt();
+    bool autoUpdate = mSettings.value("autoupdate", false).toBool();
+    bool autoStart = mSettings.value("autostart", true).toBool();
     mSettings.endGroup();
-    mAutoUpdateOption->setCheckState(autoUpdate > 0 ? Qt::Checked : Qt::Unchecked);
-    mAutoStartOption->setCheckState(autoStart > 0 ? Qt::Checked : Qt::Unchecked);
+    mAutoUpdateOption->setCheckState(autoUpdate ? Qt::Checked : Qt::Unchecked);
+    mAutoStartOption->setCheckState(autoStart ? Qt::Checked : Qt::Unchecked);
 
 
     // The buttons.
@@ -414,6 +415,13 @@
     bottomLayout->addWidget(quitButton);
     bottomLayout->setAlignment(quitButton, Qt::AlignBottom);
 
+#ifdef Q_OS_WIN
+    if (is_admin()) {
+        QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
+        installButton->setIcon(uacShield);
+    }
+#endif
+
     // The certificate details
     QGroupBox *detailBox = new QGroupBox(tr("Details"));
     QLabel *subjectCN = new QLabel(tr("Subject Common Name:"));
@@ -525,24 +533,32 @@
     }
 
     // Add separators and certificates to list widget.
-    mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++));
-    foreach (const Certificate &cert, newInstallCerts) {
-        mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++));
+    if (!newInstallCerts.isEmpty()) {
+        mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++));
+        foreach (const Certificate &cert, newInstallCerts) {
+            mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++));
+        }
     }
 
-    mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++));
-    foreach (const Certificate &cert, newRemoveCerts) {
-        mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++));
+    if (!newRemoveCerts.isEmpty()) {
+        mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++));
+        foreach (const Certificate &cert, newRemoveCerts) {
+            mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++));
+        }
     }
 
-    mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++));
-    foreach (const Certificate &cert, oldInstallCerts) {
-        mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++));
+    if (!oldInstallCerts.isEmpty()) {
+        mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++));
+        foreach (const Certificate &cert, oldInstallCerts) {
+            mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++));
+        }
     }
 
-    mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++));
-    foreach (const Certificate &cert, oldRemoveCerts) {
-        mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++));
+    if (!oldRemoveCerts.isEmpty()) {
+        mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++));
+        foreach (const Certificate &cert, oldRemoveCerts) {
+            mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++));
+        }
     }
 }
 
@@ -732,14 +748,14 @@
 void MainWindow::saveAutoUpdate(int state)
 {
     mSettings.beginGroup("settings");
-    mSettings.setValue("autoupdate", state);
+    mSettings.setValue("autoupdate", state != Qt::Unchecked);
     mSettings.endGroup();
 }
 
 void MainWindow::saveAutoStart(int state)
 {
     mSettings.beginGroup("settings");
-    mSettings.setValue("autostart", state);
+    mSettings.setValue("autostart", state != Qt::Unchecked);
     mSettings.endGroup();
 }
 

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