Mercurial > trustbridge
comparison ui/listupdatedialog.cpp @ 214:aab742690bee
Fix check for selected items and wait for bytes written.
According to the documentation closing the write channel
should suffice. But in testing it did not sent over everything.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 26 Mar 2014 17:17:19 +0100 |
parents | 3ebebd055d3a |
children | 431b058e903d |
comparison
equal
deleted
inserted
replaced
213:3ebebd055d3a | 214:aab742690bee |
---|---|
15 ListUpdateDialog::ListUpdateDialog(QMainWindow *parent, | 15 ListUpdateDialog::ListUpdateDialog(QMainWindow *parent, |
16 const CertificateList &listToInstall) : | 16 const CertificateList &listToInstall) : |
17 QDialog(parent), | 17 QDialog(parent), |
18 mCertificateList(listToInstall) | 18 mCertificateList(listToInstall) |
19 { | 19 { |
20 qDebug() << "I am a happy list update dialog"; | |
21 setupGUI(); | 20 setupGUI(); |
22 } | 21 } |
23 | 22 |
24 void ListUpdateDialog::setupGUI() | 23 void ListUpdateDialog::setupGUI() |
25 { | 24 { |
126 installerProcess.write("-----END CERTIFICATE LIST-----\r\n"); | 125 installerProcess.write("-----END CERTIFICATE LIST-----\r\n"); |
127 | 126 |
128 /* Items to install */ | 127 /* Items to install */ |
129 for (int i = 0; i < mCertListWidget->count(); i++) { | 128 for (int i = 0; i < mCertListWidget->count(); i++) { |
130 QListWidgetItem *item = mCertListWidget->item(i); | 129 QListWidgetItem *item = mCertListWidget->item(i); |
131 if (!item->checkState() == Qt::Checked && | 130 if (item->checkState() 1= Qt::Checked && |
132 item->data(Qt::UserRole).toString().startsWith("I:")) { | 131 item->data(Qt::UserRole).toString().startsWith("I:")) { |
133 continue; | 132 continue; |
134 } | 133 } |
135 installerProcess.write(item->data(Qt::UserRole).toString().toLatin1()); | 134 installerProcess.write(item->data(Qt::UserRole).toString().toLatin1()); |
136 installerProcess.write("\r\n"); | 135 installerProcess.write("\r\n"); |
137 } | 136 } |
138 | 137 |
139 /* Items to remove */ | 138 /* Items to remove */ |
140 for (int i = 0; i < mCertListWidget->count(); i++) { | 139 for (int i = 0; i < mCertListWidget->count(); i++) { |
141 QListWidgetItem *item = mCertListWidget->item(i); | 140 QListWidgetItem *item = mCertListWidget->item(i); |
142 if (!item->checkState() == Qt::Checked && | 141 if (!item->checkState() != Qt::Checked && |
143 item->data(Qt::UserRole).toString().startsWith("R:")) { | 142 item->data(Qt::UserRole).toString().startsWith("R:")) { |
144 continue; | 143 continue; |
145 } | 144 } |
146 installerProcess.write(item->data(Qt::UserRole).toString().toLatin1()); | 145 installerProcess.write(item->data(Qt::UserRole).toString().toLatin1()); |
147 installerProcess.write("\r\n"); | 146 installerProcess.write("\r\n"); |
148 } | 147 } |
149 | 148 |
149 installerProcess.waitForBytesWritten(); | |
150 installerProcess.closeWriteChannel(); | 150 installerProcess.closeWriteChannel(); |
151 installerProcess.waitForFinished(); | 151 installerProcess.waitForFinished(); |
152 | 152 |
153 if (installerProcess.exitStatus() == QProcess::CrashExit) { | 153 if (installerProcess.exitStatus() == QProcess::CrashExit) { |
154 /* Woops */ | 154 /* Woops */ |