comparison ui/mainwindow.cpp @ 1153:0495f9187c4b

(issue36) read_and_verify_list expects utf8 filenames.
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 18 Sep 2014 12:53:40 +0200
parents 6ec64a30fd5f
children 98e0712e790b
comparison
equal deleted inserted replaced
1152:46f025a1450c 1153:0495f9187c4b
192 void MainWindow::verifyListData() 192 void MainWindow::verifyListData()
193 { 193 {
194 QString availableFileName = mSettings.value("List/available").toString(); 194 QString availableFileName = mSettings.value("List/available").toString();
195 QString installedFileName = mSettings.value("List/installed").toString(); 195 QString installedFileName = mSettings.value("List/installed").toString();
196 if (!availableFileName.isEmpty()) { 196 if (!availableFileName.isEmpty()) {
197 mListToInstall.readList(availableFileName.toLocal8Bit().constData()); 197 mListToInstall.readList(availableFileName.toUtf8().constData());
198 if (!mListToInstall.isValid()) { 198 if (!mListToInstall.isValid()) {
199 mCurState = TransferError; 199 mCurState = TransferError;
200 // Probably a bug when Qt fileName is encoded and cFileName 200 // Probably a bug when Qt fileName is encoded and cFileName
201 // fails because of this. This needs a unit test! 201 // fails because of this. This needs a unit test!
202 // Maybe check that the file is in our data directory 202 // Maybe check that the file is in our data directory
209 mSettings.remove("List/available"); 209 mSettings.remove("List/available");
210 mSettings.remove("List/availableDate"); 210 mSettings.remove("List/availableDate");
211 } 211 }
212 212
213 if (!installedFileName.isEmpty()) { 213 if (!installedFileName.isEmpty()) {
214 mInstalledList.readList(installedFileName.toLocal8Bit().constData()); 214 mInstalledList.readList(installedFileName.toUtf8().constData());
215 if (!mInstalledList.isValid()) { 215 if (!mInstalledList.isValid()) {
216 // Probably a bug when Qt fileName is encoded and cFileName 216 // Probably a bug when Qt fileName is encoded and cFileName
217 // fails because of this. This needs a unit test! 217 // fails because of this. This needs a unit test!
218 // Maybe check that the file is in our data directory 218 // Maybe check that the file is in our data directory
219 QFile::remove(installedFileName); 219 QFile::remove(installedFileName);
274 /* TODO: Error count. Error handling. Otherwise 274 /* TODO: Error count. Error handling. Otherwise
275 * we can go into an endless loop here */ 275 * we can go into an endless loop here */
276 276
277 /* Retry the download again in 10 - 20 minutes */ 277 /* Retry the download again in 10 - 20 minutes */
278 QTimer::singleShot(600000 + (qrand() % 60000), this, SLOT(checkUpdates())); 278 QTimer::singleShot(600000 + (qrand() % 60000), this, SLOT(checkUpdates()));
279 qDebug() << "Failed to verify list.";
279 } else { 280 } else {
280 if (mTrayIcon->isAlternative()) { 281 if (mTrayIcon->isAlternative()) {
281 mCurMessage = tr("An updated certificate list is available."); 282 mCurMessage = tr("An updated certificate list is available.");
282 } else { 283 } else {
283 mCurMessage = tr("An updated certificate list is available.") +" " + tr("Click here to install."); 284 mCurMessage = tr("An updated certificate list is available.") +" " + tr("Click here to install.");

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