comparison ui/mainwindow.cpp @ 1145:a41338b18273

(issue130) Do not show error when software was not found and handle it in setLastMod
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 18 Sep 2014 11:09:34 +0200
parents a4282bc67a8b
children 5fdda2ad19fb
comparison
equal deleted inserted replaced
1144:a4282bc67a8b 1145:a41338b18273
552 } 552 }
553 553
554 void MainWindow::setLastModifiedSWDate(const QDateTime &date) 554 void MainWindow::setLastModifiedSWDate(const QDateTime &date)
555 { 555 {
556 mSettings.beginGroup("Software"); 556 mSettings.beginGroup("Software");
557 #ifdef IS_TAG_BUILD
558 /* We accept an invalid date to force installing any avialable update
559 * in release mode. Otherwise we default to current datetime when we
560 * did not find out version.*/
557 mSettings.setValue("installedDate", date); 561 mSettings.setValue("installedDate", date);
562 #else
563 mSettings.setValue("installedDate", date.isValid() ? date : QDateTime::currentDateTime());
564 #endif
558 mSettings.setValue("installedVersion", QApplication::applicationVersion()); 565 mSettings.setValue("installedVersion", QApplication::applicationVersion());
559 mSettings.endGroup(); 566 mSettings.endGroup();
560 checkUpdates(); 567 checkUpdates();
561 } 568 }
562 569
563 void MainWindow::downloaderError(const QString &message, SSLConnection::ErrorCode error) 570 void MainWindow::downloaderError(const QString &message, SSLConnection::ErrorCode error)
564 { 571 {
565 /* TODO logging and handle error according to a plan */ 572 /* TODO logging and handle error according to a plan */
566 syslog_error_printf ("Failed to check for updates: %s", message.toUtf8().constData()); 573 syslog_error_printf ("Failed to check for updates: %s", message.toUtf8().constData());
574 #ifdef IS_TAG_BUILD
575 /* During tag build it should never happen that an url checked is not available
576 * during development this is normal as each revision produces a new url. */
577 setState(TransferError);
567 if (!isVisible()) { 578 if (!isVisible()) {
568 mCurMessage = message; 579 mCurMessage = message;
569 mTrayIcon->show(); 580 mTrayIcon->show();
570 showMessage(); 581 showMessage();
571 } else { 582 } else {
572 showErrorMessage(tr("Failed to check for updates:") + "\n" + message); 583 showErrorMessage(tr("Failed to check for updates:") + "\n" + message);
573 }
574 setState(TransferError);
575
576 #ifndef IS_TAG_BUILD
577 /* For development versions we default to datetime::now if
578 * we can not find our version. */
579 if (!mSettings.contains("Software/installedDate") ||
580 mSettings.value("Software/installedVersion").toString() != QApplication::applicationVersion()) {
581 setLastModifiedSWDate(QDateTime::currentDateTime());
582 } 584 }
583 #endif 585 #endif
584 } 586 }
585 587
586 void MainWindow::createActions() 588 void MainWindow::createActions()

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