diff ui/mainwindow.cpp @ 375:9e38a4bcd44e

Move certificateitem role into the certificateitemdelagate where it belongs.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 12:06:03 +0200
parents 6cc124e79066
children 3be838c3e4d8
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Tue Apr 15 12:05:22 2014 +0200
+++ b/ui/mainwindow.cpp	Tue Apr 15 12:06:03 2014 +0200
@@ -326,18 +326,18 @@
         }
         QListWidgetItem* item = new QListWidgetItem(cert.shortDescription());
         SeparatorItemDelegate *separator = new SeparatorItemDelegate();
-        item->setData(DetailsRole, cert.details());
-        item->setData(B64LineRole, cert.base64Line());
+        item->setData(CertificateItemDelegate::DetailsRole, cert.details());
+        item->setData(CertificateItemDelegate::B64LineRole, cert.base64Line());
         Qt::CheckState checkedState = mPreviouslyUnselected.contains(cert.base64Line()) ?
             Qt::Unchecked : Qt::Checked;
         if (cert.isInstallCert()) {
             // This if statements is for testing! @TODO Remove this!
             if (i <= 2) {
-                item->setData(StatusRole, Certificate::InstallOld);
+                item->setData(CertificateItemDelegate::StatusRole, Certificate::InstallOld);
                 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
             }
             else {
-                item->setData(StatusRole, Certificate::InstallNew);
+                item->setData(CertificateItemDelegate::StatusRole, Certificate::InstallNew);
                 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
             }
             if (i == 3) {
@@ -351,12 +351,12 @@
         else {
             // This if statements is for testing! @TODO Remove this!
             if (i > 35) {
-                item->setData(StatusRole, Certificate::RemoveNew);
+                item->setData(CertificateItemDelegate::StatusRole, Certificate::RemoveNew);
                 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
                 item->setCheckState(checkedState);
             }
             else {
-                item->setData(StatusRole, Certificate::RemoveOld);
+                item->setData(CertificateItemDelegate::StatusRole, Certificate::RemoveOld);
                 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
             }
         }
@@ -393,7 +393,7 @@
 
 void MainWindow::showDetails(QListWidgetItem *item)
 {
-    QString details = item->data(DetailsRole).toString();
+    QString details = item->data(CertificateItemDelegate::DetailsRole).toString();
     certificateDetails->setPlainText(details);
 }
 
@@ -413,10 +413,10 @@
     for (int i = 0; i < mCertListWidget->count(); i++) {
         QListWidgetItem *item = mCertListWidget->item(i);
         if (item->checkState() == Qt::Checked) {
-            choices << item->data(B64LineRole).toString();
+            choices << item->data(CertificateItemDelegate::B64LineRole).toString();
             continue;
         }
-        QString certLine = item->data(B64LineRole).toString();
+        QString certLine = item->data(CertificateItemDelegate::B64LineRole).toString();
         if (certLine.startsWith("I:")) {
             certLine[0] = 'R';
             choices << certLine;
@@ -466,7 +466,7 @@
         QListWidgetItem *item = mCertListWidget->item(i);
         if (item->checkState() != Qt::Checked) {
             mSettings.setValue(QString::fromLatin1("cert%1").arg(i),
-                    item->data(B64LineRole).toString());
+                    item->data(CertificateItemDelegate::B64LineRole).toString());
         }
     }
     mSettings.endGroup();

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