[PATCH 2 of 3] (issue157) Reload list after successful creation

Wald Commits scm-commit at wald.intevation.org
Mon Oct 13 17:42:00 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1413214872 -7200
# Node ID d009da9cfa10d2f35bdedfa76fa4657a51609f4d
# Parent  ff9cd05e861ea0e38931fe13e077477b15ce547a
(issue157) Reload list after successful creation

diff -r ff9cd05e861e -r d009da9cfa10 ui/administratorwindow.cpp
--- 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()));
     }
 }
 
diff -r ff9cd05e861e -r d009da9cfa10 ui/administratorwindow.h
--- 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. */
diff -r ff9cd05e861e -r d009da9cfa10 ui/createcertlistdialog.cpp
--- 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();
 }
diff -r ff9cd05e861e -r d009da9cfa10 ui/createcertlistdialog.h
--- 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();


More information about the Trustbridge-commits mailing list