# HG changeset patch # User Andre Heinecke # Date 1404313424 -7200 # Node ID 3d669400104a64a4fc5689c8aeb0adef049fb0a9 # Parent 49bf73b5c7dea7c8b9a3c3f7f59871d67c9e922e (Issue23) Fix certificate selection On show always the first certificate was selected and setSelected also only set the first certificate. diff -r 49bf73b5c7de -r 3d669400104a ui/certificatelistwidget.cpp --- 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); } diff -r 49bf73b5c7de -r 3d669400104a ui/certificatelistwidget.h --- 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();