Mercurial > trustbridge
comparison 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 |
comparison
equal
deleted
inserted
replaced
523:ca583ffe728a | 524:a097dd86cb4d |
---|---|
48 #include "aboutdialog.h" | 48 #include "aboutdialog.h" |
49 #include "statusdialog.h" | 49 #include "statusdialog.h" |
50 #include "certificateitemdelegate.h" | 50 #include "certificateitemdelegate.h" |
51 #include "separatoritemdelegate.h" | 51 #include "separatoritemdelegate.h" |
52 #include "installwrapper.h" | 52 #include "installwrapper.h" |
53 #include "util.h" | |
53 | 54 |
54 MainWindow::MainWindow(bool trayMode): | 55 MainWindow::MainWindow(bool trayMode): |
55 mTrayMode(trayMode) | 56 mTrayMode(trayMode) |
56 { | 57 { |
57 createActions(); | 58 createActions(); |
390 connect(mAutoUpdateOption, SIGNAL(stateChanged(int)), | 391 connect(mAutoUpdateOption, SIGNAL(stateChanged(int)), |
391 this, SLOT(saveAutoUpdate(int))); | 392 this, SLOT(saveAutoUpdate(int))); |
392 connect(mAutoStartOption, SIGNAL(stateChanged(int)), | 393 connect(mAutoStartOption, SIGNAL(stateChanged(int)), |
393 this, SLOT(saveAutoStart(int))); | 394 this, SLOT(saveAutoStart(int))); |
394 mSettings.beginGroup("settings"); | 395 mSettings.beginGroup("settings"); |
395 int autoUpdate = mSettings.value("autoupdate").toInt(); | 396 bool autoUpdate = mSettings.value("autoupdate", false).toBool(); |
396 int autoStart = mSettings.value("autostart").toInt(); | 397 bool autoStart = mSettings.value("autostart", true).toBool(); |
397 mSettings.endGroup(); | 398 mSettings.endGroup(); |
398 mAutoUpdateOption->setCheckState(autoUpdate > 0 ? Qt::Checked : Qt::Unchecked); | 399 mAutoUpdateOption->setCheckState(autoUpdate ? Qt::Checked : Qt::Unchecked); |
399 mAutoStartOption->setCheckState(autoStart > 0 ? Qt::Checked : Qt::Unchecked); | 400 mAutoStartOption->setCheckState(autoStart ? Qt::Checked : Qt::Unchecked); |
400 | 401 |
401 | 402 |
402 // The buttons. | 403 // The buttons. |
403 bottomLayout->setAlignment(Qt::AlignBottom); | 404 bottomLayout->setAlignment(Qt::AlignBottom); |
404 installButton = new QPushButton(tr("Install selected")); | 405 installButton = new QPushButton(tr("Install selected")); |
411 bottomLayout->insertStretch(0, 10); | 412 bottomLayout->insertStretch(0, 10); |
412 bottomLayout->addWidget(installButton); | 413 bottomLayout->addWidget(installButton); |
413 bottomLayout->setAlignment(installButton, Qt::AlignBottom); | 414 bottomLayout->setAlignment(installButton, Qt::AlignBottom); |
414 bottomLayout->addWidget(quitButton); | 415 bottomLayout->addWidget(quitButton); |
415 bottomLayout->setAlignment(quitButton, Qt::AlignBottom); | 416 bottomLayout->setAlignment(quitButton, Qt::AlignBottom); |
417 | |
418 #ifdef Q_OS_WIN | |
419 if (is_admin()) { | |
420 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield); | |
421 installButton->setIcon(uacShield); | |
422 } | |
423 #endif | |
416 | 424 |
417 // The certificate details | 425 // The certificate details |
418 QGroupBox *detailBox = new QGroupBox(tr("Details")); | 426 QGroupBox *detailBox = new QGroupBox(tr("Details")); |
419 QLabel *subjectCN = new QLabel(tr("Subject Common Name:")); | 427 QLabel *subjectCN = new QLabel(tr("Subject Common Name:")); |
420 QLabel *subjectOU = new QLabel(tr("Subject Organisation:")); | 428 QLabel *subjectOU = new QLabel(tr("Subject Organisation:")); |
523 .arg(mInstalledList.date().toString())); | 531 .arg(mInstalledList.date().toString())); |
524 mNewListDate->setText(tr("New List Date: %1").arg(mListToInstall.date().toString())); | 532 mNewListDate->setText(tr("New List Date: %1").arg(mListToInstall.date().toString())); |
525 } | 533 } |
526 | 534 |
527 // Add separators and certificates to list widget. | 535 // Add separators and certificates to list widget. |
528 mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++)); | 536 if (!newInstallCerts.isEmpty()) { |
529 foreach (const Certificate &cert, newInstallCerts) { | 537 mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++)); |
530 mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++)); | 538 foreach (const Certificate &cert, newInstallCerts) { |
531 } | 539 mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++)); |
532 | 540 } |
533 mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++)); | 541 } |
534 foreach (const Certificate &cert, newRemoveCerts) { | 542 |
535 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++)); | 543 if (!newRemoveCerts.isEmpty()) { |
536 } | 544 mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++)); |
537 | 545 foreach (const Certificate &cert, newRemoveCerts) { |
538 mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++)); | 546 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++)); |
539 foreach (const Certificate &cert, oldInstallCerts) { | 547 } |
540 mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++)); | 548 } |
541 } | 549 |
542 | 550 if (!oldInstallCerts.isEmpty()) { |
543 mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++)); | 551 mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++)); |
544 foreach (const Certificate &cert, oldRemoveCerts) { | 552 foreach (const Certificate &cert, oldInstallCerts) { |
545 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++)); | 553 mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++)); |
554 } | |
555 } | |
556 | |
557 if (!oldRemoveCerts.isEmpty()) { | |
558 mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++)); | |
559 foreach (const Certificate &cert, oldRemoveCerts) { | |
560 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++)); | |
561 } | |
546 } | 562 } |
547 } | 563 } |
548 | 564 |
549 QListWidgetItem* MainWindow::createSeparator(const QString &text, int index) | 565 QListWidgetItem* MainWindow::createSeparator(const QString &text, int index) |
550 { | 566 { |
730 } | 746 } |
731 | 747 |
732 void MainWindow::saveAutoUpdate(int state) | 748 void MainWindow::saveAutoUpdate(int state) |
733 { | 749 { |
734 mSettings.beginGroup("settings"); | 750 mSettings.beginGroup("settings"); |
735 mSettings.setValue("autoupdate", state); | 751 mSettings.setValue("autoupdate", state != Qt::Unchecked); |
736 mSettings.endGroup(); | 752 mSettings.endGroup(); |
737 } | 753 } |
738 | 754 |
739 void MainWindow::saveAutoStart(int state) | 755 void MainWindow::saveAutoStart(int state) |
740 { | 756 { |
741 mSettings.beginGroup("settings"); | 757 mSettings.beginGroup("settings"); |
742 mSettings.setValue("autostart", state); | 758 mSettings.setValue("autostart", state != Qt::Unchecked); |
743 mSettings.endGroup(); | 759 mSettings.endGroup(); |
744 } | 760 } |
745 | 761 |
746 void MainWindow::closeApp() | 762 void MainWindow::closeApp() |
747 { | 763 { |