annotate ui/administratorwindow.cpp @ 395:a63601810211

Resized administrator main window and columns.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 15 Apr 2014 16:44:55 +0200
parents 7e0a188d6848
children 26651cc0cc47
rev   line source
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 #include "administratorwindow.h"
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 #include <QDebug>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4 #include <QMessageBox>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 #include <QAction>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 #include <QMenu>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 #include <QApplication>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #include <QHBoxLayout>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #include <QVBoxLayout>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 #include <QGroupBox>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 #include <QSplitter>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 #include <QLabel>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 #include <QImage>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 #include <QCheckBox>
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
15 #include <QHeaderView>
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
16 #include <QFileDialog>
394
7e0a188d6848 Load the last certificate list from data dir on startup.
Raimund Renkert <rrenkert@intevation.de>
parents: 376
diff changeset
17 #include <QStandardPaths>
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18
348
e6aa82466420 Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
19 #include "certificatetabledelegate.h"
362
857ae1ffdd6f Open the new dialog from the main menu.
Raimund Renkert <rrenkert@intevation.de>
parents: 358
diff changeset
20 #include "createinstallerdialog.h"
368
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
21 #include "createcertlistdialog.h"
348
e6aa82466420 Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
22
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 AdministratorWindow::AdministratorWindow() {
394
7e0a188d6848 Load the last certificate list from data dir on startup.
Raimund Renkert <rrenkert@intevation.de>
parents: 376
diff changeset
24 QString path = QStandardPaths::locate(
7e0a188d6848 Load the last certificate list from data dir on startup.
Raimund Renkert <rrenkert@intevation.de>
parents: 376
diff changeset
25 QStandardPaths::DataLocation, QString("certlist_last.txt"));
7e0a188d6848 Load the last certificate list from data dir on startup.
Raimund Renkert <rrenkert@intevation.de>
parents: 376
diff changeset
26 certList.readList(path.toLocal8Bit());
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 createActions();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 createMenuBar();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 createContent();
394
7e0a188d6848 Load the last certificate list from data dir on startup.
Raimund Renkert <rrenkert@intevation.de>
parents: 376
diff changeset
30 loadCertificateTable();
395
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
31 resize(1110, 700);
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 void AdministratorWindow::createActions()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 void AdministratorWindow::createMenuBar()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 menuBar = new QMenuBar(this);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 QMenu *menu = new QMenu(tr("Menu"), menuBar);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 menuBar->addMenu(menu);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 QAction *createInstaller = menu->addAction(tr("Create Installer"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 QAction *settings = menu->addAction(tr("Settings"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 menu->addSeparator();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 QAction *help = menu->addAction(tr("Help"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 QAction *about = menu->addAction(tr("About"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 menu->addSeparator();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 QAction *quit = menu->addAction(tr("Quit"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 connect(createInstaller, SIGNAL(triggered()), this, SLOT(createInstaller()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 connect(settings, SIGNAL(triggered()), this, SLOT(showSettings()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 connect(help, SIGNAL(triggered()), this, SLOT(showHelp()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 connect(about, SIGNAL(triggered()), this, SLOT(showAbout()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 setMenuBar(menuBar);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 void AdministratorWindow::createContent()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 // Create a central widget containing the main layout.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 QWidget *base = new QWidget;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 // Layouts and Container
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 QVBoxLayout *mainLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 QVBoxLayout *certLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 QHBoxLayout *headerLayout = new QHBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 QVBoxLayout *headerTextLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 QHBoxLayout *bottomLayout = new QHBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 // The certificate list
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
72 certificateView = new QTableView;
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
73 certificateModel = new CertificateTabelModel();
348
e6aa82466420 Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
74 CertificateTableDelegate *delegate = new CertificateTableDelegate(certificateView);
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
75 certificateView->setModel(certificateModel);
348
e6aa82466420 Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
76 certificateView->setItemDelegate(delegate);
395
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
77 certificateView->resizeColumnsToContents();
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
78 certificateView->setColumnWidth(0, 60);
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
79 certificateView->setSelectionBehavior(QAbstractItemView::SelectRows);
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
80 connect(certificateView, SIGNAL(clicked(const QModelIndex&)), this,
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
81 SLOT(clickedCertificate(const QModelIndex&)));
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
82 certificateView->verticalHeader()->setVisible(false);
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
83 certLayout->addWidget(certificateView);
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 certBox->setLayout(certLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 // The header (icon, about text)
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 QImage *logoImage = new QImage(":/img/logo.png");
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 QLabel *logo = new QLabel;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 logo->setBackgroundRole(QPalette::Base);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 logo->setPixmap(QPixmap::fromImage(*logoImage));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 QLabel *title = new QLabel("<h2>" + tr("Administrator Application") + "</h2>");
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 QLabel *subTitle = new QLabel("This Software creates a signed file containing certificates");
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 headerTextLayout->addWidget(title);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 headerTextLayout->addWidget(subTitle);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 headerLayout->addWidget(logo);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 headerLayout->addLayout(headerTextLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 headerLayout->setStretch(0, 0);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 headerLayout->setStretch(1, 10);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 // The buttons.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 bottomLayout->setAlignment(Qt::AlignBottom);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 saveButton = new QPushButton(tr("Save"));
368
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
103 connect(saveButton, SIGNAL(clicked()), this, SLOT(saveCertificateFile()));
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 loadButton = new QPushButton(tr("Load"));
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
105 connect(loadButton, SIGNAL(clicked()), this, SLOT(loadCertificateFile()));
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 addButton = new QPushButton(tr("Add"));
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
107 connect(addButton, SIGNAL(clicked()), this, SLOT(addCertificates()));
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 removeButton = new QPushButton(tr("Remove"));
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
109 removeButton->setEnabled(false);
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
110 connect(removeButton, SIGNAL(clicked()), this, SLOT(removeCertificates()));
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 bottomLayout->addWidget(saveButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 bottomLayout->addWidget(loadButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 bottomLayout->addWidget(addButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 bottomLayout->addWidget(removeButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 bottomLayout->insertStretch(4, 10);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 mainLayout->addLayout(headerLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 mainLayout->addWidget(certBox);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 mainLayout->addLayout(bottomLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
122 // QMainWindow allready has a layout. All child layouts and widgets are
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123 // managed in the central widget.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 base->setLayout(mainLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 setCentralWidget(base);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
128 void AdministratorWindow::loadCertificateFile()
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
129 {
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
130 QString certFile = QFileDialog::getOpenFileName(
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
131 this, tr("Select certificate file"), "/home/rrenkert/local-home/projects/m13/src/repo/ui/tests/data/", "*.txt");
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
132 qDebug() << "selected: " + certFile;
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
133 certList.readList(certFile.toLocal8Bit().constData());
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
134 if (!certList.isValid()) {
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
135 qDebug() << "Not a valid list.";
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
136 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
137 else {
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
138 loadCertificateTable();
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
139 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
140 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
141
368
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
142 void AdministratorWindow::saveCertificateFile()
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
143 {
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
144 CreateCertListDialog *dialog = new CreateCertListDialog(this);
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
145 dialog->show();
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
146 }
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
147
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
148 void AdministratorWindow::addCertificates()
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
149 {
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
150 QString certFile = QFileDialog::getOpenFileName(
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
151 this, tr("Select certificate"), "/home/rrenkert/local-home/projects/m13/src/repo/ui/tests/data/", "*.pem *.der");
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
152 QList<Certificate> certs = Certificate::fromFileName(certFile);
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
153 addToCertificateTable(certs);
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
154 }
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
155
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
156 void AdministratorWindow::removeCertificates()
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
157 {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
158 QModelIndexList list = certificateView->selectionModel()->selectedRows();
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
159 for (int i = list.size() -1 ; i >= 0; i--) {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
160 certificateModel->removeRow(list.at(i).row(), list.at(i));
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
161 }
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
162 }
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
163
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
164 void AdministratorWindow::loadCertificateTable() {
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
165 foreach(const Certificate &cert, certList.getCertificates()) {
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
166 certificateModel->addCertificate(cert, true);
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
167 }
395
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
168 certificateView->resizeColumnsToContents();
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
169 certificateView->setColumnWidth(0, 60);
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
170 }
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
171
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
172 void AdministratorWindow::addToCertificateTable(const QList<Certificate> &certs)
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
173 {
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
174 foreach(const Certificate &cert, certs) {
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
175 certificateModel->addCertificate(cert, false);
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
176 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
177 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
178
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
179 void AdministratorWindow::showSettings()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
180 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
181 qDebug() << "show settingsdialog";
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
182 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
183
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
184 void AdministratorWindow::showHelp()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
185 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
186 qDebug() << "show helpdialog";
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
187 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
188
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
189 void AdministratorWindow::showAbout()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
190 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
191 qDebug() << "show aboutdialog";
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
192 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
193
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
194 void AdministratorWindow::createInstaller()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
195 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
196 qDebug() << "create Installer";
362
857ae1ffdd6f Open the new dialog from the main menu.
Raimund Renkert <rrenkert@intevation.de>
parents: 358
diff changeset
197 CreateInstallerDialog *dialog = new CreateInstallerDialog(this);
857ae1ffdd6f Open the new dialog from the main menu.
Raimund Renkert <rrenkert@intevation.de>
parents: 358
diff changeset
198 dialog->show();
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
199 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
200
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
201 void AdministratorWindow::clickedCertificate(const QModelIndex &index)
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
202 {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
203 if (index.data(Qt::UserRole).toBool()) {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
204 removeButton->setEnabled(false);
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
205 }
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
206 else {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
207 removeButton->setEnabled(true);
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
208 }
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
209 }

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