Mercurial > trustbridge
comparison ui/mainwindow.cpp @ 1234:ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 24 Sep 2014 16:25:27 +0200 |
parents | 7da9ec20eae4 |
children | 33a17569812a |
comparison
equal
deleted
inserted
replaced
1233:7da9ec20eae4 | 1234:ad4fc3649ffb |
---|---|
31 #include <QToolButton> | 31 #include <QToolButton> |
32 #include <QStandardPaths> | 32 #include <QStandardPaths> |
33 #include <QDesktopServices> | 33 #include <QDesktopServices> |
34 | 34 |
35 #include "certificatelist.h" | 35 #include "certificatelist.h" |
36 #include "certificateitemwidget.h" | |
36 #include "downloader.h" | 37 #include "downloader.h" |
37 #include "helpdialog.h" | 38 #include "helpdialog.h" |
38 #include "aboutdialog.h" | 39 #include "aboutdialog.h" |
39 #include "separatoritemdelegate.h" | 40 #include "separatoritemdelegate.h" |
40 #include "installwrapper.h" | 41 #include "installwrapper.h" |
1254 // No new list available, add old certificates. | 1255 // No new list available, add old certificates. |
1255 foreach (const Certificate &cert, mInstalledList.getCertificates()) { | 1256 foreach (const Certificate &cert, mInstalledList.getCertificates()) { |
1256 bool state = !mPreviouslyUnselected.contains(cert.base64Line()); | 1257 bool state = !mPreviouslyUnselected.contains(cert.base64Line()); |
1257 if (cert.isInstallCert()) { | 1258 if (cert.isInstallCert()) { |
1258 oldInstallCerts.append(cert); | 1259 oldInstallCerts.append(cert); |
1259 QToolButton* actionBtn = new QToolButton(); | 1260 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1260 QIcon btnIcon; | 1261 QIcon btnIcon; |
1261 if (!state) { | 1262 if (!state) { |
1262 btnIcon.addFile(":/img/cert-to-be-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1263 btnIcon.addFile(":/img/cert-to-be-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1263 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1264 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1264 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed.")); | 1265 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed.")); |
1272 actionBtn->setIcon(btnIcon); | 1273 actionBtn->setIcon(btnIcon); |
1273 mInstallList->addCertificate(cert, state, actionBtn); | 1274 mInstallList->addCertificate(cert, state, actionBtn); |
1274 } | 1275 } |
1275 else { | 1276 else { |
1276 oldRemoveCerts.append(cert); | 1277 oldRemoveCerts.append(cert); |
1277 QToolButton* actionBtn = new QToolButton(); | 1278 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1278 QIcon btnIcon; | 1279 QIcon btnIcon; |
1279 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); | 1280 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
1280 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed.")); | 1281 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed.")); |
1281 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1282 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1282 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1283 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1297 if (cert.isInstallCert()) { | 1298 if (cert.isInstallCert()) { |
1298 // Certificate with status "install". | 1299 // Certificate with status "install". |
1299 if (mInstalledList.getCertificates().contains(cert)) { | 1300 if (mInstalledList.getCertificates().contains(cert)) { |
1300 // Was in the old list. | 1301 // Was in the old list. |
1301 oldInstallCerts.append(cert); | 1302 oldInstallCerts.append(cert); |
1302 QToolButton* actionBtn = new QToolButton(); | 1303 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1303 QIcon btnIcon; | 1304 QIcon btnIcon; |
1304 actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed.")); | 1305 actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed.")); |
1305 actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed.")); | 1306 actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed.")); |
1306 btnIcon.addFile(":/img/cert-is-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1307 btnIcon.addFile(":/img/cert-is-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1307 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1308 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1309 mInstallList->addCertificate(cert, state, actionBtn); | 1310 mInstallList->addCertificate(cert, state, actionBtn); |
1310 } | 1311 } |
1311 else { | 1312 else { |
1312 // Is a brand new certificate | 1313 // Is a brand new certificate |
1313 newInstallCerts.append(cert); | 1314 newInstallCerts.append(cert); |
1314 QToolButton* actionBtn = new QToolButton(); | 1315 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1315 QIcon btnIcon; | 1316 QIcon btnIcon; |
1316 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed.")); | 1317 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed.")); |
1317 actionBtn->setProperty("ToolTip_On", tr("Certificate will not be installed.")); | 1318 actionBtn->setProperty("ToolTip_On", tr("Certificate will not be installed.")); |
1318 btnIcon.addFile(":/img/cert-to-be-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1319 btnIcon.addFile(":/img/cert-to-be-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1319 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1320 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1325 // Certificate with status "remove". | 1326 // Certificate with status "remove". |
1326 if (mInstalledList.getCertificates().contains(cert)) { | 1327 if (mInstalledList.getCertificates().contains(cert)) { |
1327 // Was in the old list. | 1328 // Was in the old list. |
1328 oldRemoveCerts.append(cert); | 1329 oldRemoveCerts.append(cert); |
1329 // Is removed, so set editable to false. | 1330 // Is removed, so set editable to false. |
1330 QToolButton* actionBtn = new QToolButton(); | 1331 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1331 QIcon btnIcon; | 1332 QIcon btnIcon; |
1332 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); | 1333 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
1333 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed.")); | 1334 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed.")); |
1334 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1335 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1335 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1336 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1343 } | 1344 } |
1344 else { | 1345 else { |
1345 // Was in the old list with status "install" and now has the | 1346 // Was in the old list with status "install" and now has the |
1346 // status "remove". | 1347 // status "remove". |
1347 newRemoveCerts.append(cert); | 1348 newRemoveCerts.append(cert); |
1348 QToolButton* actionBtn = new QToolButton(); | 1349 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1349 QIcon btnIcon; | 1350 QIcon btnIcon; |
1350 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); | 1351 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
1351 actionBtn->setProperty("ToolTip_On", tr("Certificate will not be removed.")); | 1352 actionBtn->setProperty("ToolTip_On", tr("Certificate will not be removed.")); |
1352 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1353 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1353 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1354 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |