changeset 720:3d669400104a

(Issue23) Fix certificate selection On show always the first certificate was selected and setSelected also only set the first certificate.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 02 Jul 2014 17:03:44 +0200
parents 49bf73b5c7de
children abc76948d8e5
files ui/certificatelistwidget.cpp ui/certificatelistwidget.h
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ui/certificatelistwidget.cpp	Wed Jul 02 16:35:16 2014 +0200
+++ b/ui/certificatelistwidget.cpp	Wed Jul 02 17:03:44 2014 +0200
@@ -233,8 +233,10 @@
 
 void CertificateListWidget::setSelected(int index)
 {
+    if (index <= 0) {
+        index = 0;
+    }
     mCertificateList->setFocus();
-    if (mCertificateList->count() > 0) {
-        mCertificateList->item(0)->setSelected(true);
-    }
+    mCertificateList->item(index)->setSelected(true);
+    mCertificateList->setCurrentRow(index);
 }
--- a/ui/certificatelistwidget.h	Wed Jul 02 16:35:16 2014 +0200
+++ b/ui/certificatelistwidget.h	Wed Jul 02 17:03:44 2014 +0200
@@ -42,6 +42,7 @@
     int selectedCertCount();
     bool contains(const Certificate &cert);
     void setSelected(int index);
+    int selected() { return mCertificateList->currentRow(); }
 
 private:
     void setupGUI();

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