# HG changeset patch # User Raimund Renkert # Date 1397138603 -7200 # Node ID 5f1494fab517923272b067fe73e8cbe0c8b2916f # Parent c9315b24b055a9746a93943bf2211c467d17c3fa# Parent ee59ab0eb7ffb5dbb644d427a0b01a25ee8461ca merged. diff -r ee59ab0eb7ff -r 5f1494fab517 ui/certificate.cpp --- a/ui/certificate.cpp Thu Apr 10 15:31:02 2014 +0200 +++ b/ui/certificate.cpp Thu Apr 10 16:03:23 2014 +0200 @@ -164,3 +164,13 @@ return retval; } + +void Certificate::setInstallCert(bool install) +{ + if (install && mBaseLine.startsWith("R:")) { + mBaseLine.replace(0, 1, "I"); + } + else if (!install && mBaseLine.startsWith("I:")) { + mBaseLine.replace(0, 1, "R"); + } +} diff -r ee59ab0eb7ff -r 5f1494fab517 ui/certificate.h --- a/ui/certificate.h Thu Apr 10 15:31:02 2014 +0200 +++ b/ui/certificate.h Thu Apr 10 16:03:23 2014 +0200 @@ -76,6 +76,12 @@ **/ bool isInstallCert() const {return mBaseLine.startsWith("I:");} + /** @brief Set the install instruction for this certificate. + * + * Set the base 64 line prefix to "I:" or "R:". + **/ + void setInstallCert(bool install); + /** @brief get the subject OU from the certificate */ QString subjectOU() const {return mSubjectOU;} diff -r ee59ab0eb7ff -r 5f1494fab517 ui/certificatetabledelegate.cpp --- a/ui/certificatetabledelegate.cpp Thu Apr 10 15:31:02 2014 +0200 +++ b/ui/certificatetabledelegate.cpp Thu Apr 10 16:03:23 2014 +0200 @@ -54,7 +54,6 @@ // Get the current value from the model. QString value = index.data(Qt::DisplayRole).toString(); - qDebug() << "model value is: " + index.data(Qt::DisplayRole).toString(); // Find the index in comboxbox items and set the current index. QComboBox *comboBox = static_cast(editor); int ndx = comboBox->findData(value, Qt::UserRole); diff -r ee59ab0eb7ff -r 5f1494fab517 ui/certificatetablemodel.cpp --- a/ui/certificatetablemodel.cpp Thu Apr 10 15:31:02 2014 +0200 +++ b/ui/certificatetablemodel.cpp Thu Apr 10 16:03:23 2014 +0200 @@ -45,7 +45,16 @@ bool CertificateTabelModel::setData(const QModelIndex &index, const QVariant &value, int role) { - //TODO + if (index.row() > certificates.size() || index.row() < 0) { + return false; + } + + bool newValue = value.toBool(); + Certificate &cert = certificates[index.row()]; + cert.setInstallCert(newValue); + + emit dataChanged(index, index); + return true; }