changeset 203:60c5df8e7980

Reinitialize certificatelist when readFile is called
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 26 Mar 2014 13:29:09 +0100
parents 0861069fd6d0
children 825b42da1855
files ui/certificatelist.cpp ui/certificatelist.h ui/tests/certlistparsertest.cpp
diffstat 3 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ui/certificatelist.cpp	Wed Mar 26 12:52:53 2014 +0100
+++ b/ui/certificatelist.cpp	Wed Mar 26 13:29:09 2014 +0100
@@ -13,6 +13,11 @@
     char *data = NULL;
     size_t size = 0;
 
+    mCertificatesRemove.clear();
+    mCertificatesInstall.clear();
+    mDate = QDateTime();
+    mData = QString();
+
     mStatus = read_and_verify_list(fileName, &data, &size);
 
     if (!isValid()) {
--- a/ui/certificatelist.h	Wed Mar 26 12:52:53 2014 +0100
+++ b/ui/certificatelist.h	Wed Mar 26 13:29:09 2014 +0100
@@ -54,7 +54,6 @@
     const QString& rawData() const {return mData;}
 
 private:
-    QString mFileName;
     QList<Certificate> mCertificatesInstall;
     QList<Certificate> mCertificatesRemove;
     QString mData;
--- a/ui/tests/certlistparsertest.cpp	Wed Mar 26 12:52:53 2014 +0100
+++ b/ui/tests/certlistparsertest.cpp	Wed Mar 26 13:29:09 2014 +0100
@@ -54,9 +54,10 @@
     Certificate cert;
     QVERIFY(!cert.isValid());
 
-    CertificateList *certList2= testWithFile(fname);
-    const QList<Certificate> instList2 = certList2->getInstallCertificates();
-    const QList<Certificate> remoList2 = certList2->getRemoveCertificates();
+    certList->readList(fileName.toLocal8Bit().data());
+
+    const QList<Certificate> instList2 = certList->getInstallCertificates();
+    const QList<Certificate> remoList2 = certList->getRemoveCertificates();
     QVERIFY(instLines.size() == instList2.size());
     QVERIFY(remoLines.size() == remoList2.size());
 

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