comparison ui/mainwindow.cpp @ 718:e7a070e64b80

(Issue26) Make updates tip and install button depend on changes
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 02 Jul 2014 16:27:46 +0200
parents 77c9c2dfc8ac
children 49bf73b5c7de
comparison
equal deleted inserted replaced
717:77c9c2dfc8ac 718:e7a070e64b80
563 updatesHeaderLayout->addWidget(mLastCertUpdate, 3, 0, 1, 1); 563 updatesHeaderLayout->addWidget(mLastCertUpdate, 3, 0, 1, 1);
564 updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight); 564 updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight);
565 updatesHeaderLayout->setRowMinimumHeight(4, 15); 565 updatesHeaderLayout->setRowMinimumHeight(4, 15);
566 566
567 /* Header 2: Action text and buttons */ 567 /* Header 2: Action text and buttons */
568 QLabel *updatesTip = 568 mUpdatesTip =
569 new QLabel(tr("You should apply the following, recommended changes to your certificate stores.")); 569 new QLabel(tr("There are currently no changes for your certificate stores."));
570 updatesTip->setWordWrap(true); 570 mUpdatesTip->setWordWrap(true);
571 QHBoxLayout *updatesHeaderActionButtonLayout = new QHBoxLayout; 571 QHBoxLayout *updatesHeaderActionButtonLayout = new QHBoxLayout;
572 mQuitButton = new QPushButton(" " + tr("Quit without saving")); 572 mQuitButton = new QPushButton(" " + tr("Quit without saving"));
573 mQuitButton->setIcon(QIcon(":/img/application-exit.png")); 573 mQuitButton->setIcon(QIcon(":/img/application-exit.png"));
574 mQuitButton->setFixedHeight(30); 574 mQuitButton->setFixedHeight(30);
575 QPushButton *installButton = new QPushButton(" " + tr("Apply changes")); 575
576 installButton->setFixedHeight(30); 576 mInstallButton = new QPushButton(" " + tr("Install certificates again"));
577 mInstallButton->setFixedHeight(30);
577 #ifdef Q_OS_WIN 578 #ifdef Q_OS_WIN
578 if (is_admin()) { 579 if (is_admin()) {
579 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield); 580 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
580 installButton->setIcon(uacShield); 581 mInstallButton->setIcon(uacShield);
581 } 582 }
582 #else 583 #else
583 installButton->setIcon(QIcon(":/img/view-refresh.png")); 584 mInstallButton->setIcon(QIcon(":/img/view-refresh.png"));
584 #endif 585 #endif
585 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp())); 586 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
586 connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); 587 connect(mInstallButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
587 588
588 // addWidget(*Widget, row, column, rowspan, colspan) 589 // addWidget(*Widget, row, column, rowspan, colspan)
589 updatesHeaderLayout->addWidget(updatesTip, 5, 0, 1, 2); 590 updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 2);
590 updatesHeaderActionButtonLayout->addWidget(installButton); 591 updatesHeaderActionButtonLayout->addWidget(mInstallButton);
591 updatesHeaderActionButtonLayout->addWidget(mQuitButton); 592 updatesHeaderActionButtonLayout->addWidget(mQuitButton);
592 updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 1); 593 updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 1);
593 updatesHeaderLayout->setRowMinimumHeight(7, 10); 594 updatesHeaderLayout->setRowMinimumHeight(7, 10);
594 595
595 /* The central panels. */ 596 /* The central panels. */
839 } else { 840 } else {
840 mUpdatesDetailsManual->hide(); 841 mUpdatesDetailsManual->hide();
841 mUpdatesManualCertificates->hide(); 842 mUpdatesManualCertificates->hide();
842 } 843 }
843 844
845 /* Show a different tip in case of manual changes, updates aviailable, updates and manual
846 * changes available */
847 if (changeCount() && !mUpdatesManual->certificates().size()) {
848 mUpdatesTip->setText(
849 tr("You should apply the following, recommended changes to your certificate stores."));
850 } else if (changeCount()) {
851 mUpdatesTip->setText(
852 tr("You can apply the following, changes to your certificate stores."));
853 } else {
854 mUpdatesTip->setText(
855 tr("There are currently no changes for your certificate stores."));
856 }
857
844 if (!changeCount()) { 858 if (!changeCount()) {
845 /* No changes */ 859 /* No changes */
846 mQuitButton->setText(" " + tr("Quit")); 860 mQuitButton->setText(" " + tr("Quit"));
847 mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") + 861 mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") +
848 "</h2>"); 862 "</h2>");
863 mInstallButton->setText(" " + tr("Install certificates again"));
849 } else { 864 } else {
850 mQuitButton->setText(" " + tr("Quit without saving")); 865 mQuitButton->setText(" " + tr("Quit without saving"));
851 mUpdatesHeader->setText("<h2>" + tr("Changes to certificate stores (%1)") 866 mUpdatesHeader->setText("<h2>" + tr("Changes to certificate stores (%1)")
852 .arg(changeCount()) + 867 .arg(changeCount()) +
853 "</h2>"); 868 "</h2>");
869 mInstallButton->setText(" " + tr("Apply changes"));
854 } 870 }
855 871
856 if (mUpdatesNew->certificates().size()) { 872 if (mUpdatesNew->certificates().size()) {
857 mUpdatesNewCertificates->setText("<h3>" + 873 mUpdatesNewCertificates->setText("<h3>" +
858 tr("Install new trusted certificates (%1/%2)") 874 tr("Install new trusted certificates (%1/%2)")

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