# HG changeset patch # User Raimund Renkert # Date 1397547894 -7200 # Node ID 78eec57bc133a175113152e4aea42d6c970fc240 # Parent f9c98f9e9f76e171bf8dea7c2a0627df58da4462# Parent c0d63a7f270ed5c66c9dbcf1eafeca758d5fcf7d merged. diff -r c0d63a7f270e -r 78eec57bc133 ui/CMakeLists.txt --- a/ui/CMakeLists.txt Mon Apr 14 17:00:04 2014 +0000 +++ b/ui/CMakeLists.txt Tue Apr 15 09:44:54 2014 +0200 @@ -32,6 +32,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/certificatetablemodel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/certificatetabledelegate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/createinstallerdialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/createcertlistdialog.cpp ${CERTIFICATELIST_SOURCES} ) diff -r c0d63a7f270e -r 78eec57bc133 ui/administratorwindow.cpp --- a/ui/administratorwindow.cpp Mon Apr 14 17:00:04 2014 +0000 +++ b/ui/administratorwindow.cpp Tue Apr 15 09:44:54 2014 +0200 @@ -17,6 +17,7 @@ #include "certificatetabledelegate.h" #include "createinstallerdialog.h" +#include "createcertlistdialog.h" AdministratorWindow::AdministratorWindow() { createActions(); @@ -93,6 +94,7 @@ // The buttons. bottomLayout->setAlignment(Qt::AlignBottom); saveButton = new QPushButton(tr("Save")); + connect(saveButton, SIGNAL(clicked()), this, SLOT(saveCertificateFile())); loadButton = new QPushButton(tr("Load")); connect(loadButton, SIGNAL(clicked()), this, SLOT(loadCertificateFile())); addButton = new QPushButton(tr("Add")); @@ -131,6 +133,12 @@ } } +void AdministratorWindow::saveCertificateFile() +{ + CreateCertListDialog *dialog = new CreateCertListDialog(this); + dialog->show(); +} + void AdministratorWindow::addCertificates() { QString certFile = QFileDialog::getOpenFileName( diff -r c0d63a7f270e -r 78eec57bc133 ui/administratorwindow.h --- a/ui/administratorwindow.h Mon Apr 14 17:00:04 2014 +0000 +++ b/ui/administratorwindow.h Tue Apr 15 09:44:54 2014 +0200 @@ -31,6 +31,7 @@ void showHelp(); void showAbout(); void loadCertificateFile(); + void saveCertificateFile(); void addCertificates(); private: diff -r c0d63a7f270e -r 78eec57bc133 ui/createcertlistdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/createcertlistdialog.cpp Tue Apr 15 09:44:54 2014 +0200 @@ -0,0 +1,91 @@ +#include "createcertlistdialog.h" +#include +#include +#include +#include +#include +#include +#include +#include + +CreateCertListDialog::CreateCertListDialog(QMainWindow *parent) : + QDialog(parent) +{ + setWindowTitle(tr("adminstrator - Create signed certificate list")); + setupGUI(); +} + +void CreateCertListDialog::setupGUI() +{ + /* Top level layout / widgets */ + QVBoxLayout *topLayout = new QVBoxLayout; + QHBoxLayout *headerLayout = new QHBoxLayout; + QVBoxLayout *centerLayout = new QVBoxLayout; + QHBoxLayout *bottomLayout = new QHBoxLayout; + QHBoxLayout *certLayout = new QHBoxLayout; + QHBoxLayout *saveLayout = new QHBoxLayout; + + QString descString = tr("Create a new, signed certificate list.\n"); + descString.append("Select the certificate and destination directory."); + QLabel *description = new QLabel(descString); + headerLayout->addWidget(description); + + QLabel *certLabel = new QLabel("Select certificate:"); + certLabel->setFixedWidth(140); + mCertFile = new QLineEdit(); + QPushButton *certSelect = new QPushButton("..."); + connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect())); + certSelect->setFixedWidth(30); + certLayout->addWidget(certLabel); + certLayout->addWidget(mCertFile); + certLayout->addWidget(certSelect); + + QLabel *saveLabel = new QLabel("Select target location:"); + saveLabel->setFixedWidth(140); + mSaveFile = new QLineEdit(); + QPushButton *saveSelect = new QPushButton("..."); + connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation())); + saveSelect->setFixedWidth(30); + saveLayout->addWidget(saveLabel); + saveLayout->addWidget(mSaveFile); + saveLayout->addWidget(saveSelect); + + centerLayout->addLayout(certLayout); + centerLayout->addLayout(saveLayout); + + QPushButton *create = new QPushButton(tr("Create List")); + connect(create, SIGNAL(clicked()), this, SLOT(createList())); + bottomLayout->insertStretch(0, 10); + bottomLayout->addWidget(create); + + topLayout->addLayout(headerLayout); + topLayout->addLayout(centerLayout); + topLayout->insertStretch(2, 10); + topLayout->addLayout(bottomLayout); + + setLayout(topLayout); + + return; +} + +void CreateCertListDialog::openCertificateSelect() +{ + QString certFile = QFileDialog::getOpenFileName( + this, tr("Select certificate"), QDir::homePath(), "*.pem *.der *.crt"); + mCertFile->setText(certFile); +} + +void CreateCertListDialog::openSaveLocation() +{ + QString saveFile = QFileDialog::getExistingDirectory( + this, tr("Select target location"), QDir::homePath()); + mSaveFile->setText(saveFile); +} + +void CreateCertListDialog::createList() +{ + qDebug() << "and now create the certificate list using:"; + qDebug() << "certificate: " << mCertFile->text(); + qDebug() << "target" << mSaveFile->text(); + // TODO +} diff -r c0d63a7f270e -r 78eec57bc133 ui/createcertlistdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/createcertlistdialog.h Tue Apr 15 09:44:54 2014 +0200 @@ -0,0 +1,35 @@ +#ifndef CREATECERTLISTDIALOG_H +#define CREATECERTLISTDIALOG_H + +#include +#include +#include +/** + * @file createinstallerdialog.h + * @brief The dialog to show settings and create an installer. + */ + +class QListWidget; + +class CreateCertListDialog : public QDialog +{ + Q_OBJECT +public: + /** @brief Create a dialog showing settings for the create certificate list + * process + * */ + CreateCertListDialog(QMainWindow *parent); + +private: + void setupGUI(); + + QLineEdit *mCertFile; + QLineEdit *mSaveFile; + +private slots: + void openCertificateSelect(); + void openSaveLocation(); + void createList(); +}; + +#endif // CREATECERTLISTDIALOG_H