view ui/createcertlistdialog.h @ 1332:8362e30f7b55

(issue139) Check that pid is not running if the lock can be aquired If the lock on the lockfile can be aquired it might still be possible that another process is running. So we read the pid from the lockfile and check if another process with the same installation prefix as us is running.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 15 Oct 2014 14:19:46 +0200
parents d009da9cfa10
children
line wrap: on
line source
/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */
#ifndef CREATECERTLISTDIALOG_H
#define CREATECERTLISTDIALOG_H

#include <QDialog>
#include <QMainWindow>
#include <QLineEdit>

#include "certificate.h"

#include <polarssl/pk.h>
/**
 * @file createinstallerdialog.h
 * @brief The dialog to select the signing certificate and create a certificate list.
 */

class QListWidget;
class AdministratorWindow;

/** @brief The dialog to select the signing certificate and create a certificate list.*/
class CreateCertListDialog : public QDialog
{
    Q_OBJECT
public:
    /** @brief Create a dialog showing settings for the create certificate list
     * process
     * */
    CreateCertListDialog(AdministratorWindow *parent);
    ~CreateCertListDialog();

    /** @brief write a signed certificate list.
     *
     * @param [in] certs The certificates to include in the list
     * @param [in] filePath The path where the list should be written to
     * @param [in] listDate The date to write in the list
     * @param [in] pk The private key to sign with.
     *
     * @returns true on success false on error.
     */
    static bool writeList(const QList<Certificate>& certs,
            const QString& filePath, const QDateTime& listDate, pk_context *pk);

signals:
    /** @brief signal that is emited when the creation of a new list was successful.*/
    void creationSuccessful();

private:
    void setupGUI();

    QLineEdit *mKeyFile;
    QLineEdit *mSaveDir;
    AdministratorWindow *mAdminWindow;

    pk_context *mPk;

    /** @brief show an error message with QMessageBox
     *
     * @param [in] msg The message to show
     */
    void showErrorMessage(const QString &msg);

    /** @brief load a file into mPk
     *
     * If the file is not a valid key or an error
     * occurs mPk will be NULL after a call to this function.
     *
     * @param [in] fileName the file to load
     */
    void loadKeyFile(const QString& fileName);

private slots:
    /** @brief Open the certificate selection dialog and parse the certificate
     *
     * If the certificate can be parsed mPk is replaced by the new key
     * otherwise an error message is shown to the user.
     */
    void openCertificateSelect();
    void openSaveLocation();
    /** @brief create a valid certificate list file
     *
     * The contents of the certificate list are the certificates
     * shown in the adminWindow. It is signed with the currently
     * loaded certificate in mPk. On errors the user is
     * informed with showErrorMessage */
    void createList();
};

#endif // CREATECERTLISTDIALOG_H

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