changeset 84:00a93409e93e

Keep raw data around to later pass it to the installer
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 20 Mar 2014 16:21:27 +0000
parents ba8a548ff252
children e52df5870c4f
files ui/certificatelist.cpp ui/certificatelist.h
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ui/certificatelist.cpp	Thu Mar 20 16:20:44 2014 +0000
+++ b/ui/certificatelist.cpp	Thu Mar 20 16:21:27 2014 +0000
@@ -22,13 +22,13 @@
 
     // Take the data into the Qt Universe where memory is plentiful
     // and CPU's are fast :)
-    QStringList lines = QString::fromLatin1(data, size).split("\n");
+    mData = QString::fromLatin1(data, size);
     free(data);
     data = NULL;
+    QStringList lines = mData.split("\n");
 
     for (int i = 0; i < lines.size(); ++i) {
         QString curLine = lines[i].trimmed();
-        qDebug() << "Reading line: " << curLine;
         if (curLine.startsWith("F:")) {
             if (curLine.right(1) != PARSER_VERSION) {
                 qDebug() << "Invalid Format Version";
@@ -49,11 +49,9 @@
 
             mDate = QDateTime::fromMSecsSinceEpoch(timestamp * 1000);
         } else if (curLine.startsWith("I:")) {
-            mCertificatesInstall << Certificate(
-                    QByteArray::fromBase64(curLine.remove(0,2).toLatin1()));
+            mCertificatesInstall << Certificate(curLine);
         } else if (curLine.startsWith("R:")) {
-            mCertificatesInstall << Certificate(
-                    QByteArray::fromBase64(curLine.remove(0,2).toLatin1()));
+            mCertificatesInstall << Certificate(curLine);
         } else if (curLine.startsWith("S:")) {
             // Signature is verified in read_and_verify_list
             continue;
--- a/ui/certificatelist.h	Thu Mar 20 16:20:44 2014 +0000
+++ b/ui/certificatelist.h	Thu Mar 20 16:21:27 2014 +0000
@@ -44,13 +44,20 @@
      */
     bool isValid() const {return mStatus == Valid;}
 
+    /* @brief get a list of certificate objects that should be installed */
     const QList<Certificate>& getInstallCertificates() const;
+
+    /* @brief get a list of certificate objects that should be removed */
     const QList<Certificate>& getRemoveCertificates() const;
 
+    /* @brief get the raw certificate list */
+    const QString& rawData() const {return mData;}
+
 private:
     QString mFileName;
     QList<Certificate> mCertificatesInstall;
     QList<Certificate> mCertificatesRemove;
+    QString mData;
     list_status_t mStatus;
     QDateTime mDate;
 };

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