changeset 1317:d009da9cfa10

(issue157) Reload list after successful creation
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 13 Oct 2014 17:41:12 +0200
parents ff9cd05e861e
children 45082ec23e76
files ui/administratorwindow.cpp ui/administratorwindow.h ui/createcertlistdialog.cpp ui/createcertlistdialog.h
diffstat 4 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ui/administratorwindow.cpp	Mon Oct 13 17:23:35 2014 +0200
+++ b/ui/administratorwindow.cpp	Mon Oct 13 17:41:12 2014 +0200
@@ -37,14 +37,20 @@
 
 AdministratorWindow::AdministratorWindow() {
     setWindowTitle(tr("TrustBridge Administration"));
-    QString path = QStandardPaths::locate(
-        QStandardPaths::DataLocation, QString("current_certificates.txt"));
-    mCertList.readList(path.toLocal8Bit());
     createActions();
     createMenuBar();
     createContent();
+    loadCurrentCertificates();
+    resize(1190, 500);
+}
+
+void AdministratorWindow::loadCurrentCertificates()
+{
+    QString path = QStandardPaths::locate(
+        QStandardPaths::DataLocation, QString("current_certificates.txt"));
+    certificateModel->removeAll();
+    mCertList.readList(path.toLocal8Bit());
     loadCertificateTable();
-    resize(1190, 500);
 }
 
 void AdministratorWindow::createActions()
@@ -170,6 +176,7 @@
     if (ret == QDialog::Accepted) {
         CreateCertListDialog *dialog = new CreateCertListDialog(this);
         dialog->show();
+        connect (dialog, SIGNAL(creationSuccessful()), this, SLOT(loadCurrentCertificates()));
     }
 }
 
--- a/ui/administratorwindow.h	Mon Oct 13 17:23:35 2014 +0200
+++ b/ui/administratorwindow.h	Mon Oct 13 17:41:12 2014 +0200
@@ -72,6 +72,8 @@
     void showHelp();
     /** @brief Presents a Dialog to load a certificate list and handles the loading. */
     void loadCertificateFile();
+    /** @brief Loads the current certificate list. */
+    void loadCurrentCertificates();
     /** @brief Save the current selection of certificates as a certificate list. */
     void saveCertificateFile();
     /** @brief Add certificates to the certificate table. */
--- a/ui/createcertlistdialog.cpp	Mon Oct 13 17:23:35 2014 +0200
+++ b/ui/createcertlistdialog.cpp	Mon Oct 13 17:41:12 2014 +0200
@@ -300,5 +300,7 @@
     mAdminWindow->logChanges(curCerts, keyFingerprint);
 
     QMessageBox::information(this, "", tr("Saved certificate list:\n%1").arg(fileName));
+    emit creationSuccessful();
+
     close();
 }
--- a/ui/createcertlistdialog.h	Mon Oct 13 17:23:35 2014 +0200
+++ b/ui/createcertlistdialog.h	Mon Oct 13 17:41:12 2014 +0200
@@ -46,6 +46,9 @@
     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();

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