diff ui/mainwindow.h @ 372:6cc124e79066

Add save/load unselected and add role enumerator Explicitly naming the roles avoids confusion and makes the code more readable
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 11:56:29 +0200
parents 75f7288ad67b
children 9e38a4bcd44e
line wrap: on
line diff
--- a/ui/mainwindow.h	Tue Apr 15 11:04:34 2014 +0200
+++ b/ui/mainwindow.h	Tue Apr 15 11:56:29 2014 +0200
@@ -46,6 +46,12 @@
         TransferError
     };
 
+    enum ItemRole {
+        DetailsRole = Qt::UserRole, /* The certificate details for the window */
+        StatusRole, /* Certificate status */
+        B64LineRole /* The I:/R: <cert> line */
+    };
+
     CurrentState getState() {return mCurState;}
     void setState(CurrentState state) {mCurState = state;}
 
@@ -67,6 +73,27 @@
     void installerError(const QString& errMsg);
     void installCerts();
 
+    /** @brief saves the currently unselected certificates
+     *
+     * This creates / updates a qsettings section that
+     * [unselected] that contains the certificates that
+     * were unselected previously.
+     *
+     * Unselected are certificates that are unchecked
+     * in the certListWidget
+     *
+     * Returns false on error.
+     */
+    bool saveUnselectedCertificates();
+
+    /** @brief loads previously unselected certificates from settings
+     *
+     * The certificates are strored in the list mPreviouslyUnselected.
+     *
+     * On error mPreviouslyUnselected is empty after this call.
+     */
+    void loadUnselectedCertificates();
+
 private:
     /** @brief check the integrity of available files.
      *
@@ -100,7 +127,11 @@
     CurrentState mCurState;
     QMenuBar *mMenuBar;
 
+    /* The current list that should be installed */
     CertificateList mListToInstall;
+    /* Previously made "unselect" choices in the form of
+     * base64lines with I:/R: prefix */
+    QStringList mPreviouslyUnselected;
 
     QListWidget *mCertListWidget;
     QTextEdit *certificateDetails;

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