comparison ui/administratorwindow.cpp @ 462:091ad56c2715

Change current certificates file name. Some cleanups.
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 23 Apr 2014 15:32:24 +0000
parents 6dec8101793c
children 9d3880db6ba7
comparison
equal deleted inserted replaced
461:1ce835c40eb7 462:091ad56c2715
30 #include "aboutdialog.h" 30 #include "aboutdialog.h"
31 31
32 AdministratorWindow::AdministratorWindow() { 32 AdministratorWindow::AdministratorWindow() {
33 setWindowTitle(tr("TrustBridge Administration")); 33 setWindowTitle(tr("TrustBridge Administration"));
34 QString path = QStandardPaths::locate( 34 QString path = QStandardPaths::locate(
35 QStandardPaths::DataLocation, QString("certlist_last.txt")); 35 QStandardPaths::DataLocation, QString("current_certificates.txt"));
36 mCertList.readList(path.toLocal8Bit()); 36 mCertList.readList(path.toLocal8Bit());
37 createActions(); 37 createActions();
38 createMenuBar(); 38 createMenuBar();
39 createContent(); 39 createContent();
40 loadCertificateTable(); 40 loadCertificateTable();
136 setCentralWidget(base); 136 setCentralWidget(base);
137 } 137 }
138 138
139 void AdministratorWindow::loadCertificateFile() 139 void AdministratorWindow::loadCertificateFile()
140 { 140 {
141 QString path = QStandardPaths::locate(
142 QStandardPaths::DataLocation, QString("certlist_last.txt"));
143 QString certFile = QFileDialog::getOpenFileName( 141 QString certFile = QFileDialog::getOpenFileName(
144 this, tr("Select certificate list file"), path, "*.txt"); 142 this, tr("Select certificate list file"), QDir::homePath(), "*.txt");
145 qDebug() << "selected: " + certFile;
146 mCertList.readList(certFile.toLocal8Bit().constData()); 143 mCertList.readList(certFile.toLocal8Bit().constData());
147 if (!mCertList.isValid()) { 144 if (!mCertList.isValid()) {
148 qDebug() << "Not a valid list."; 145 qDebug() << "Not a valid list.";
149 } 146 } else {
150 else {
151 certificateModel->removeAll(); 147 certificateModel->removeAll();
152 loadCertificateTable(); 148 loadCertificateTable();
153 } 149 }
154 } 150 }
155 151
160 } 156 }
161 157
162 void AdministratorWindow::addCertificates() 158 void AdministratorWindow::addCertificates()
163 { 159 {
164 QStringList certFiles = QFileDialog::getOpenFileNames( 160 QStringList certFiles = QFileDialog::getOpenFileNames(
165 this, tr("Select certificate"), QDir::homePath(), "*.pem *.der"); 161 this, tr("Select certificate"), QDir::homePath(), "*.pem *.der *.crt");
166 for (int i = 0; i < certFiles.size(); i++) { 162 for (int i = 0; i < certFiles.size(); i++) {
167 QString certFile = certFiles.at(i); 163 QString certFile = certFiles.at(i);
168 QList<Certificate> certs = Certificate::fromFileName(certFile); 164 QList<Certificate> certs = Certificate::fromFileName(certFile);
169 addToCertificateTable(certs); 165 addToCertificateTable(certs);
170 } 166 }

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