changeset 128:95d35ec93bbe

Supply the cinst process with checked items not with selected ones
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 24 Mar 2014 10:18:31 +0000
parents 04dcc0fb1eca
children 39b7930fbca9
files ui/listupdatedialog.cpp
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ui/listupdatedialog.cpp	Mon Mar 24 10:16:16 2014 +0000
+++ b/ui/listupdatedialog.cpp	Mon Mar 24 10:18:31 2014 +0000
@@ -43,6 +43,8 @@
         }
         QListWidgetItem* item = new QListWidgetItem(cert.shortDescription());
         item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
+        item->setData(Qt::ToolTipRole, cert.details());
+        item->setData(Qt::UserRole, cert.base64Line());
         item->setCheckState(Qt::Checked);
         mRemoveListWidget->addItem(item);
     }
@@ -99,14 +101,27 @@
         /* TODO ERROR message for the user */
         return;
     }
+
     installerProcess.write("-----BEGIN CERTIFICATE LIST-----\r\n");
     installerProcess.write(mCertificateList.rawData().toLatin1());
     installerProcess.write("-----END CERTIFICATE LIST-----\r\n");
 
-    QList<QListWidgetItem *> selectedItems = mInstallListWidget->selectedItems();
-    selectedItems << mRemoveListWidget->selectedItems();
+    /* Items to install */
+    for (int i = 0; i < mInstallListWidget->count(); i++) {
+        QListWidgetItem *item = mInstallListWidget->item(i);
+        if (!item->checkState() == Qt::Checked) {
+            continue;
+        }
+        installerProcess.write(item->data(Qt::UserRole).toString().toLatin1());
+        installerProcess.write("\r\n");
+    }
 
-    foreach (const QListWidgetItem * item, selectedItems) {
+    /* Items to remove */
+    for (int i = 0; i < mRemoveListWidget->count(); i++) {
+        QListWidgetItem *item = mRemoveListWidget->item(i);
+        if (!item->checkState() == Qt::Checked) {
+            continue;
+        }
         installerProcess.write(item->data(Qt::UserRole).toString().toLatin1());
         installerProcess.write("\r\n");
     }

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