Mercurial > trustbridge
annotate ui/listupdatedialog.cpp @ 231:c342b93c5bd1
Refactoring.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 28 Mar 2014 10:45:55 +0100 |
parents | 431b058e903d |
children | 6a7eb102716d |
rev | line source |
---|---|
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
1 #include "listupdatedialog.h" |
127
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
2 #include <QCoreApplication> |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
3 #include <QDebug> |
127
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
4 #include <QDir> |
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
5 #include <QFileInfo> |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
6 #include <QProcess> |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
7 #include <QPushButton> |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
8 #include <QGroupBox> |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
9 #include <QHBoxLayout> |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
10 #include <QListWidget> |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
11 #include <QVBoxLayout> |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
12 #include <QLabel> |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
13 #include "certificate.h" |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 |
153
252ffe6e27fd
Changed type of MainWindow from QDialog to QMainWindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
129
diff
changeset
|
15 ListUpdateDialog::ListUpdateDialog(QMainWindow *parent, |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 const CertificateList &listToInstall) : |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 QDialog(parent), |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 mCertificateList(listToInstall) |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
19 { |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
20 setupGUI(); |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
21 } |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
22 |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
23 void ListUpdateDialog::setupGUI() |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 { |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
25 /* Top level layout / widgets */ |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
26 QVBoxLayout *topLayout = new QVBoxLayout; |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
27 QHBoxLayout *headerLayout = new QHBoxLayout; |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
28 QHBoxLayout *listLayout = new QHBoxLayout; |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
29 QHBoxLayout *bottomLayout = new QHBoxLayout; |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
30 |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
31 QImage *logoImage = new QImage(":/img/logo-small.png"); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
32 QLabel *logo = new QLabel; |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
33 logo->setBackgroundRole(QPalette::Base); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
34 logo->setPixmap(QPixmap::fromImage(*logoImage)); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
35 QLabel *title = new QLabel("<h3>" + tr("Update Certificate") + "</h3>"); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
36 headerLayout->addWidget(logo); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
37 headerLayout->addWidget(title); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
38 headerLayout->setStretch(0, 0); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
39 headerLayout->setStretch(1, 10); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
40 |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
41 QPushButton *executeUpdate = new QPushButton(tr("Update Stores")); |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
42 connect(executeUpdate, &QPushButton::clicked, |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
43 this, &ListUpdateDialog::executeUpdate); |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
44 QPushButton *install = new QPushButton(tr("Install selected")); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
45 QPushButton *later = new QPushButton(tr("Remind me later")); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
46 bottomLayout->insertStretch(0, 10); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
47 bottomLayout->addWidget(executeUpdate); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
48 bottomLayout->addWidget(install); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
49 bottomLayout->addWidget(later); |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
50 |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
51 /* The certificate groups */ |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
52 mCertListWidget = new QListWidget; |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
53 connect(mCertListWidget, SIGNAL(itemClicked(QListWidgetItem*)), |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
54 this, SLOT(showDetails(QListWidgetItem*))); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
55 mDetailWidget = new QTextEdit; |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
56 mDetailWidget->setReadOnly(true); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
57 listLayout->addWidget(mCertListWidget); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
58 listLayout->addWidget(mDetailWidget); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
59 QGroupBox *certGroup = new QGroupBox(tr("Select certificates")); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
60 certGroup->setLayout(listLayout); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
61 |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
62 foreach (const Certificate& cert, mCertificateList.getInstallCertificates()) { |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
63 if (!cert.isValid()) { |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
64 qWarning() << "Invalid certificate in list"; |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
65 continue; |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
66 } |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
67 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
68 item->setFlags(item->flags() | Qt::ItemIsUserCheckable); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
69 item->setData(Qt::ToolTipRole, cert.details()); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
70 item->setData(Qt::UserRole, cert.base64Line()); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
71 item->setCheckState(Qt::Checked); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
72 QIcon *certIcon = new QIcon(":/img/list-add.png"); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
73 item->setIcon(*certIcon); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
74 mCertListWidget->addItem(item); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
75 } |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
76 |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
77 foreach (const Certificate& cert, mCertificateList.getRemoveCertificates()) { |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
78 if (!cert.isValid()) { |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
79 qWarning() << "Invalid certificate in list"; |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
80 continue; |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
81 } |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
82 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
83 item->setFlags(item->flags() | Qt::ItemIsUserCheckable); |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
84 item->setData(Qt::ToolTipRole, cert.details()); |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
85 item->setData(Qt::UserRole, cert.base64Line()); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
86 item->setCheckState(Qt::Checked); |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
87 QIcon *certIcon = new QIcon(":/img/list-remove.png"); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
88 item->setIcon(*certIcon); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
89 mCertListWidget->addItem(item); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
90 } |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
91 |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
92 |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
93 /* Fill top level layout */ |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
94 topLayout->addLayout(headerLayout); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
95 topLayout->addWidget(certGroup); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
96 topLayout->addLayout(bottomLayout); |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
97 |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
98 setLayout(topLayout); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
99 |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
100 return; |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
101 } |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
102 |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
103 void ListUpdateDialog::executeUpdate() { |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
104 /* TODO move this in another dialog and call it async*/ |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
105 QProcess installerProcess; |
127
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
106 QFileInfo fi(QCoreApplication::applicationFilePath()); |
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
107 QDir myDir = fi.absoluteDir(); |
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
108 QString instProcName = "cinst"; |
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
109 if (!fi.suffix().isEmpty()) { |
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
110 instProcName += "." + fi.suffix(); |
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
111 } |
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
112 QString instPath = myDir.absoluteFilePath(instProcName); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
113 |
127
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
114 installerProcess.setProgram(instPath); |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
115 installerProcess.start(); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
116 installerProcess.waitForStarted(); |
98
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
117 if (installerProcess.state() == QProcess::NotRunning) { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
118 qWarning() << "Failed to start installer Process."; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
119 /* TODO ERROR message for the user */ |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
120 return; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
121 } |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
122 |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
123 installerProcess.write("-----BEGIN CERTIFICATE LIST-----\r\n"); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
124 installerProcess.write(mCertificateList.rawData().toLatin1()); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
125 installerProcess.write("-----END CERTIFICATE LIST-----\r\n"); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
126 |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
127 /* Items to install */ |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
128 for (int i = 0; i < mCertListWidget->count(); i++) { |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
129 QListWidgetItem *item = mCertListWidget->item(i); |
221
431b058e903d
Fix typo that happend in rebase conflict resolution
Andre Heinecke <aheinecke@intevation.de>
parents:
214
diff
changeset
|
130 if (item->checkState() != Qt::Checked && |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
131 item->data(Qt::UserRole).toString().startsWith("I:")) { |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
132 continue; |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
133 } |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
134 installerProcess.write(item->data(Qt::UserRole).toString().toLatin1()); |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
135 installerProcess.write("\r\n"); |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
136 } |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
137 |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
138 /* Items to remove */ |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
139 for (int i = 0; i < mCertListWidget->count(); i++) { |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
140 QListWidgetItem *item = mCertListWidget->item(i); |
214
aab742690bee
Fix check for selected items and wait for bytes written.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
213
diff
changeset
|
141 if (!item->checkState() != Qt::Checked && |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
142 item->data(Qt::UserRole).toString().startsWith("R:")) { |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
143 continue; |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
144 } |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
145 installerProcess.write(item->data(Qt::UserRole).toString().toLatin1()); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
146 installerProcess.write("\r\n"); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
147 } |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
148 |
214
aab742690bee
Fix check for selected items and wait for bytes written.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
213
diff
changeset
|
149 installerProcess.waitForBytesWritten(); |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
150 installerProcess.closeWriteChannel(); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
151 installerProcess.waitForFinished(); |
98
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
152 |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
153 if (installerProcess.exitStatus() == QProcess::CrashExit) { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
154 /* Woops */ |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
155 qWarning() << "Installer process crashed"; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
156 } else if (installerProcess.exitStatus() != QProcess::NormalExit) { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
157 /* Can not Happen. there are only those two values but maybe |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
158 * qt changed.. */ |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
159 qWarning() << "Exit status neither normal nor crash."; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
160 return; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
161 } |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
162 |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
163 if (installerProcess.exitCode() == 0) { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
164 qDebug() << "Success!"; |
129
39b7930fbca9
Print debug output also on success
Andre Heinecke <aheinecke@intevation.de>
parents:
128
diff
changeset
|
165 qDebug() << "output: " << installerProcess.readAllStandardOutput(); |
98
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
166 } else { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
167 /* TODO handle errors defined by errorcodes.h */ |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
168 qDebug() << "Installer Process returned: " << installerProcess.exitCode(); |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
169 qDebug() << "output: " << installerProcess.readAllStandardOutput(); |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
170 return; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
171 } |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
172 } |
213
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
173 |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
174 void ListUpdateDialog::showDetails(QListWidgetItem *item) |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
175 { |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
176 QString details = item->data(Qt::ToolTipRole).toString(); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
177 mDetailWidget->setPlainText(details); |
3ebebd055d3a
Refactored the list update dialog. Now it looks a bit more like the mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
178 } |