Mercurial > trustbridge
annotate ui/listupdatedialog.cpp @ 128:95d35ec93bbe
Supply the cinst process with checked items not with selected ones
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 24 Mar 2014 10:18:31 +0000 |
parents | 04dcc0fb1eca |
children | 39b7930fbca9 |
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> |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
12 #include "certificate.h" |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 ListUpdateDialog::ListUpdateDialog(QDialog *parent, |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 const CertificateList &listToInstall) : |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 QDialog(parent), |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 mCertificateList(listToInstall) |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 { |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
19 qDebug() << "I am a happy list update dialog"; |
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; |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
27 QHBoxLayout *listLayout = new QHBoxLayout; |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
28 QPushButton *executeUpdate = new QPushButton(tr("Update Stores")); |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
29 connect(executeUpdate, &QPushButton::clicked, |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
30 this, &ListUpdateDialog::executeUpdate); |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
31 |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
32 /* The remove groups */ |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
33 QVBoxLayout *removeGroupLayout = new QVBoxLayout; |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
34 mRemoveListWidget = new QListWidget; |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
35 removeGroupLayout->addWidget(mRemoveListWidget); |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
36 QGroupBox *removeGroup = new QGroupBox(tr("Select certificates to be removed")); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
37 removeGroup->setLayout(removeGroupLayout); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
38 |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
39 foreach (const Certificate& cert, mCertificateList.getRemoveCertificates()) { |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
40 if (!cert.isValid()) { |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
41 qWarning() << "Invalid certificate in list"; |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
42 continue; |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
43 } |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
44 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
45 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
|
46 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
|
47 item->setData(Qt::UserRole, cert.base64Line()); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
48 item->setCheckState(Qt::Checked); |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
49 mRemoveListWidget->addItem(item); |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
50 } |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
51 |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
52 /* The install group */ |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
53 QVBoxLayout *installGroupLayout = new QVBoxLayout; |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
54 mInstallListWidget = new QListWidget; |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
55 QGroupBox *installGroup = new QGroupBox(tr("Select certificates to install")); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
56 installGroupLayout->addWidget(mInstallListWidget); |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
57 installGroup->setLayout(installGroupLayout); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
58 |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
59 foreach (const Certificate& cert, mCertificateList.getInstallCertificates()) { |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
60 if (!cert.isValid()) { |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
61 qWarning() << "Invalid certificate in list"; |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
62 continue; |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
63 } |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
64 QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
65 item->setFlags(item->flags() | Qt::ItemIsUserCheckable); |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
66 item->setData(Qt::ToolTipRole, cert.details()); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
67 item->setData(Qt::UserRole, cert.base64Line()); |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
68 item->setCheckState(Qt::Checked); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
69 mInstallListWidget->addItem(item); |
80
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
70 } |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
71 |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
72 /* Add groups to layout */ |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
73 listLayout->addWidget(installGroup); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
74 listLayout->addWidget(removeGroup); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
75 |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
76 /* Fill top level layout */ |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
77 topLayout->addLayout(listLayout); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
78 topLayout->addWidget(executeUpdate); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
79 |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
80 setLayout(topLayout); |
01286d0872ca
Add some UI in listupdatedialog
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
81 |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
82 return; |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
83 } |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
84 |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
85 void ListUpdateDialog::executeUpdate() { |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
86 /* 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 } |
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
94 QString instPath = myDir.absoluteFilePath(instProcName); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
95 |
127
04dcc0fb1eca
Set cinst process path to be the directory of the executable running
Andre Heinecke <aheinecke@intevation.de>
parents:
98
diff
changeset
|
96 installerProcess.setProgram(instPath); |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
97 installerProcess.start(); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
98 installerProcess.waitForStarted(); |
98
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
99 if (installerProcess.state() == QProcess::NotRunning) { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
100 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
|
101 /* 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
|
102 return; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
103 } |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
104 |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
105 installerProcess.write("-----BEGIN CERTIFICATE LIST-----\r\n"); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
106 installerProcess.write(mCertificateList.rawData().toLatin1()); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
107 installerProcess.write("-----END CERTIFICATE LIST-----\r\n"); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
108 |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
109 /* Items to install */ |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
110 for (int i = 0; i < mInstallListWidget->count(); i++) { |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
111 QListWidgetItem *item = mInstallListWidget->item(i); |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
112 if (!item->checkState() == Qt::Checked) { |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
113 continue; |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
114 } |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
115 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
|
116 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
|
117 } |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
118 |
128
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
119 /* Items to remove */ |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
120 for (int i = 0; i < mRemoveListWidget->count(); i++) { |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
121 QListWidgetItem *item = mRemoveListWidget->item(i); |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
122 if (!item->checkState() == Qt::Checked) { |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
123 continue; |
95d35ec93bbe
Supply the cinst process with checked items not with selected ones
Andre Heinecke <aheinecke@intevation.de>
parents:
127
diff
changeset
|
124 } |
85
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
125 installerProcess.write(item->data(Qt::UserRole).toString().toLatin1()); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
126 installerProcess.write("\r\n"); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
127 } |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
128 |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
129 installerProcess.closeWriteChannel(); |
e52df5870c4f
Add basic interaction with another process
Andre Heinecke <aheinecke@intevation.de>
parents:
82
diff
changeset
|
130 installerProcess.waitForFinished(); |
98
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
131 |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
132 if (installerProcess.exitStatus() == QProcess::CrashExit) { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
133 /* Woops */ |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
134 qWarning() << "Installer process crashed"; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
135 } 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
|
136 /* 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
|
137 * qt changed.. */ |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
138 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
|
139 return; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
140 } |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
141 |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
142 if (installerProcess.exitCode() == 0) { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
143 qDebug() << "Success!"; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
144 } else { |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
145 /* 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
|
146 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
|
147 qDebug() << "output: " << installerProcess.readAllStandardOutput(); |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
148 return; |
6090e673c707
Add some error handling. Change process path for testing
Andre Heinecke <aheinecke@intevation.de>
parents:
85
diff
changeset
|
149 } |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
80
diff
changeset
|
150 } |