comparison ui/mainwindow.cpp @ 274:90432cb1f374

Added a separator to certificate list to demonstrate how it works.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 02 Apr 2014 13:38:56 +0200
parents 1ae15ea73850
children 75f7288ad67b
comparison
equal deleted inserted replaced
273:b6c2fa8457b6 274:90432cb1f374
30 #include "listupdatedialog.h" 30 #include "listupdatedialog.h"
31 #include "helpdialog.h" 31 #include "helpdialog.h"
32 #include "aboutdialog.h" 32 #include "aboutdialog.h"
33 #include "statusdialog.h" 33 #include "statusdialog.h"
34 #include "certificateitemdelegate.h" 34 #include "certificateitemdelegate.h"
35 #include "separatoritemdelegate.h"
35 36
36 MainWindow::MainWindow() { 37 MainWindow::MainWindow() {
37 createActions(); 38 createActions();
38 createTrayIcon(); 39 createTrayIcon();
39 createMenuBar(); 40 createMenuBar();
318 if (!cert.isValid()) { 319 if (!cert.isValid()) {
319 qWarning() << "Invalid certificate in list"; 320 qWarning() << "Invalid certificate in list";
320 continue; 321 continue;
321 } 322 }
322 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); 323 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription());
324 SeparatorItemDelegate *separator = new SeparatorItemDelegate();
323 item->setData(Qt::UserRole, cert.details()); 325 item->setData(Qt::UserRole, cert.details());
324 if (cert.isInstallCert()) { 326 if (cert.isInstallCert()) {
325 // This if statements is for testing! @TODO Remove this! 327 // This if statements is for testing! @TODO Remove this!
326 if (i <= 2) { 328 if (i <= 2) {
327 item->setData(Qt::UserRole + 1, Certificate::InstallOld); 329 item->setData(Qt::UserRole + 1, Certificate::InstallOld);
330 } 332 }
331 else { 333 else {
332 item->setData(Qt::UserRole + 1, Certificate::InstallNew); 334 item->setData(Qt::UserRole + 1, Certificate::InstallNew);
333 item->setFlags(item->flags() | Qt::ItemIsUserCheckable); 335 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
334 item->setCheckState(Qt::Checked); 336 item->setCheckState(Qt::Checked);
337 }
338 if (i == 3) {
339 QListWidgetItem *sep = new QListWidgetItem("New certificates");
340 certificateList->setItemDelegateForRow(i, separator);
341 certificateList->addItem(sep);
342 i++;
335 } 343 }
336 } 344 }
337 else { 345 else {
338 // This if statements is for testing! @TODO Remove this! 346 // This if statements is for testing! @TODO Remove this!
339 if (i > 35) { 347 if (i > 35) {

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