Mercurial > trustbridge
comparison ui/listupdatedialog.cpp @ 98:6090e673c707
Add some error handling. Change process path for testing
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 21 Mar 2014 10:50:01 +0000 |
parents | e52df5870c4f |
children | 04dcc0fb1eca |
comparison
equal
deleted
inserted
replaced
97:e478deca18f5 | 98:6090e673c707 |
---|---|
79 | 79 |
80 void ListUpdateDialog::executeUpdate() { | 80 void ListUpdateDialog::executeUpdate() { |
81 /* TODO move this in another dialog and call it async*/ | 81 /* TODO move this in another dialog and call it async*/ |
82 QProcess installerProcess; | 82 QProcess installerProcess; |
83 | 83 |
84 installerProcess.setProgram("cinst"); | 84 installerProcess.setProgram("../cinst/cinst"); |
85 installerProcess.start(); | 85 installerProcess.start(); |
86 installerProcess.waitForStarted(); | 86 installerProcess.waitForStarted(); |
87 if (installerProcess.state() == QProcess::NotRunning) { | |
88 qWarning() << "Failed to start installer Process."; | |
89 /* TODO ERROR message for the user */ | |
90 return; | |
91 } | |
87 installerProcess.write("-----BEGIN CERTIFICATE LIST-----\r\n"); | 92 installerProcess.write("-----BEGIN CERTIFICATE LIST-----\r\n"); |
88 installerProcess.write(mCertificateList.rawData().toLatin1()); | 93 installerProcess.write(mCertificateList.rawData().toLatin1()); |
89 installerProcess.write("-----END CERTIFICATE LIST-----\r\n"); | 94 installerProcess.write("-----END CERTIFICATE LIST-----\r\n"); |
90 | 95 |
91 QList<QListWidgetItem *> selectedItems = mInstallListWidget->selectedItems(); | 96 QList<QListWidgetItem *> selectedItems = mInstallListWidget->selectedItems(); |
96 installerProcess.write("\r\n"); | 101 installerProcess.write("\r\n"); |
97 } | 102 } |
98 | 103 |
99 installerProcess.closeWriteChannel(); | 104 installerProcess.closeWriteChannel(); |
100 installerProcess.waitForFinished(); | 105 installerProcess.waitForFinished(); |
101 qDebug() << "cinst output: " << installerProcess.readAllStandardOutput(); | 106 |
102 qDebug() << " Done " << " exitCode: " << installerProcess.exitCode(); | 107 if (installerProcess.exitStatus() == QProcess::CrashExit) { |
103 qDebug() << " Done " << " exitStatus: " << installerProcess.exitStatus(); | 108 /* Woops */ |
109 qWarning() << "Installer process crashed"; | |
110 } else if (installerProcess.exitStatus() != QProcess::NormalExit) { | |
111 /* Can not Happen. there are only those two values but maybe | |
112 * qt changed.. */ | |
113 qWarning() << "Exit status neither normal nor crash."; | |
114 return; | |
115 } | |
116 | |
117 if (installerProcess.exitCode() == 0) { | |
118 qDebug() << "Success!"; | |
119 } else { | |
120 /* TODO handle errors defined by errorcodes.h */ | |
121 qDebug() << "Installer Process returned: " << installerProcess.exitCode(); | |
122 qDebug() << "output: " << installerProcess.readAllStandardOutput(); | |
123 return; | |
124 } | |
104 } | 125 } |