comparison 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
comparison
equal deleted inserted replaced
371:6b78a89c1e17 372:6cc124e79066
44 NewListAvailable, 44 NewListAvailable,
45 NewSoftwareAvailable, 45 NewSoftwareAvailable,
46 TransferError 46 TransferError
47 }; 47 };
48 48
49 enum ItemRole {
50 DetailsRole = Qt::UserRole, /* The certificate details for the window */
51 StatusRole, /* Certificate status */
52 B64LineRole /* The I:/R: <cert> line */
53 };
54
49 CurrentState getState() {return mCurState;} 55 CurrentState getState() {return mCurState;}
50 void setState(CurrentState state) {mCurState = state;} 56 void setState(CurrentState state) {mCurState = state;}
51 57
52 private slots: 58 private slots:
53 void showMessage(); 59 void showMessage();
64 void showAbout(); 70 void showAbout();
65 void showDetails(QListWidgetItem*); 71 void showDetails(QListWidgetItem*);
66 void resizeButtons(); 72 void resizeButtons();
67 void installerError(const QString& errMsg); 73 void installerError(const QString& errMsg);
68 void installCerts(); 74 void installCerts();
75
76 /** @brief saves the currently unselected certificates
77 *
78 * This creates / updates a qsettings section that
79 * [unselected] that contains the certificates that
80 * were unselected previously.
81 *
82 * Unselected are certificates that are unchecked
83 * in the certListWidget
84 *
85 * Returns false on error.
86 */
87 bool saveUnselectedCertificates();
88
89 /** @brief loads previously unselected certificates from settings
90 *
91 * The certificates are strored in the list mPreviouslyUnselected.
92 *
93 * On error mPreviouslyUnselected is empty after this call.
94 */
95 void loadUnselectedCertificates();
69 96
70 private: 97 private:
71 /** @brief check the integrity of available files. 98 /** @brief check the integrity of available files.
72 * 99 *
73 * Do not use this as a trust check as this only works on 100 * Do not use this as a trust check as this only works on
98 QAction *mCheckUpdates; 125 QAction *mCheckUpdates;
99 QAction *mQuitAction; 126 QAction *mQuitAction;
100 CurrentState mCurState; 127 CurrentState mCurState;
101 QMenuBar *mMenuBar; 128 QMenuBar *mMenuBar;
102 129
130 /* The current list that should be installed */
103 CertificateList mListToInstall; 131 CertificateList mListToInstall;
132 /* Previously made "unselect" choices in the form of
133 * base64lines with I:/R: prefix */
134 QStringList mPreviouslyUnselected;
104 135
105 QListWidget *mCertListWidget; 136 QListWidget *mCertListWidget;
106 QTextEdit *certificateDetails; 137 QTextEdit *certificateDetails;
107 QPushButton *installButton; 138 QPushButton *installButton;
108 QPushButton *quitButton; 139 QPushButton *quitButton;

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