aheinecke@404: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik aheinecke@404: * Software engineering by Intevation GmbH aheinecke@404: * aheinecke@404: * This file is Free Software under the GNU GPL (v>=2) aheinecke@404: * and comes with ABSOLUTELY NO WARRANTY! aheinecke@404: * See LICENSE.txt for details. aheinecke@404: */ rrenkert@333: #ifndef ADMINSTRATORWINDOW_H rrenkert@333: #define ADMINSTRATORWINDOW_H rrenkert@333: rrenkert@333: /** rrenkert@333: * @file administratorwindow.h rrenkert@333: * @brief Administrator UI controller rrenkert@333: */ rrenkert@333: rrenkert@333: #include rrenkert@333: #include rrenkert@333: #include rrenkert@335: #include rrenkert@333: #include rrenkert@333: rrenkert@343: #include "certificatelist.h" rrenkert@343: #include "certificatetablemodel.h" rrenkert@343: rrenkert@333: class QMenu; rrenkert@333: class QAction; andre@1316: class QSortFilterProxyModel; rrenkert@333: andre@1255: /** @brief Main Window of the Administrator application andre@1255: * andre@1255: * The controlling class of the Admin application. Holds andre@1255: * the certificate data and the settings of the application. andre@1255: */ rrenkert@333: class AdministratorWindow : public QMainWindow rrenkert@333: { rrenkert@333: Q_OBJECT rrenkert@333: rrenkert@333: public: rrenkert@333: AdministratorWindow(); rrenkert@333: aheinecke@463: /** @brief obtain a reference to the certificates currently in the model aheinecke@463: * @returns the currently shown certificates aheinecke@453: */ aheinecke@463: const QList& certificates() const { aheinecke@463: return certificateModel->certificates(); aheinecke@463: } aheinecke@453: aheinecke@453: /** @brief get the settings for this application aheinecke@453: * @returns a reference the applications settings object aheinecke@453: */ aheinecke@453: QSettings* settings() {return &mSettings;} aheinecke@453: rrenkert@562: /** @brief log the diff between the initial certificate list and the list rrenkert@562: * saved as current. rrenkert@562: * rrenkert@562: * @param currentCerts Path to the current certificate list file. emanuel@1053: * @param keyFingerprint The fingerprint of the signing key used. rrenkert@562: */ andre@679: void logChanges(const QString ¤tCerts, const QString &keyFingerprint); rrenkert@562: rrenkert@565: /** @brief get the currently changed certificates. rrenkert@565: * @return a list of certificates. rrenkert@565: */ rrenkert@565: QList currentChanges(); rrenkert@565: rrenkert@333: private slots: andre@1255: /** @brief Create the SW Packages for the target platforms. */ rrenkert@333: void createInstaller(); andre@1255: /** @brief Shows the About dialog. */ rrenkert@333: void showAbout(); andre@1255: /** @brief Opens the Help in a browser window. */ andre@1001: void showHelp(); andre@1255: /** @brief Presents a Dialog to load a certificate list and handles the loading. */ rrenkert@344: void loadCertificateFile(); andre@1317: /** @brief Loads the current certificate list. */ andre@1317: void loadCurrentCertificates(); andre@1255: /** @brief Save the current selection of certificates as a certificate list. */ rrenkert@368: void saveCertificateFile(); andre@1255: /** @brief Add certificates to the certificate table. */ rrenkert@358: void addCertificates(); andre@1255: /** @brief Remove certificates from the current certificate table. */ rrenkert@376: void removeCertificates(); andre@1255: /** @brief Changes the state of a certificate when it was clicked. */ rrenkert@376: void clickedCertificate(const QModelIndex&); rrenkert@333: rrenkert@333: private: andre@1255: /** @brief Setup UI Actions */ rrenkert@333: void createActions(); andre@1255: /** @brief Setup UI Menu Bar */ rrenkert@333: void createMenuBar(); andre@1255: /** @brief Create the UI elements of the Window */ rrenkert@333: void createContent(); andre@1255: /** @brief Load a certificate list into the table view */ rrenkert@344: void loadCertificateTable(); andre@1255: /** @brief Add a list of certificates to the table view andre@1255: * andre@1255: * @param[in] certs The certificates to add. andre@1255: */ rrenkert@358: void addToCertificateTable(const QList &certs); andre@1255: /** @brief write a log file for the list creation. andre@1255: * andre@1255: * This creates a log entry containing all pertinent information of a andre@1255: * certificate list creation. It records changes andre@1255: * made to the certificate list and notes down the current time and andre@1255: * the key used to sign the certificate list. andre@1255: * andre@1255: * @param [in] list the certificate list that is about to be created and should andre@1255: * be logged. andre@1255: * @param [in] keyFingerprint the encoded fingerprint of the signing key used. andre@1255: * andre@1255: * @returns A byte array containing the log information in latin1 encoding. andre@1255: */ andre@679: QByteArray createLogEntries(const CertificateList &list, const QString &keyFingerprint); rrenkert@333: aheinecke@453: QSettings mSettings; rrenkert@333: rrenkert@333: QMenuBar *menuBar; rrenkert@333: rrenkert@335: QTableView *certificateView; aheinecke@453: CertificateList mCertList; rrenkert@343: CertificateTabelModel *certificateModel; andre@1316: QSortFilterProxyModel *mFilterModel; rrenkert@333: QPushButton *saveButton; rrenkert@333: QPushButton *loadButton; rrenkert@333: QPushButton *addButton; rrenkert@333: QPushButton *removeButton; rrenkert@333: }; rrenkert@333: rrenkert@333: #endif // ADMINSTRATORWINDOW_H