Mercurial > trustbridge
changeset 355:5f1494fab517
merged.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 10 Apr 2014 16:03:23 +0200 |
parents | c9315b24b055 (diff) ee59ab0eb7ff (current diff) |
children | 67b471c4d1fc |
files | ui/certificate.cpp ui/certificate.h |
diffstat | 4 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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"); + } +}
--- 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;}
--- 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<QComboBox*>(editor); int ndx = comboBox->findData(value, Qt::UserRole);
--- 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; }