diff --git a/oscar/SleepLib/profiles.cpp b/oscar/SleepLib/profiles.cpp index fd2e52c6..e0d855fd 100644 --- a/oscar/SleepLib/profiles.cpp +++ b/oscar/SleepLib/profiles.cpp @@ -566,11 +566,12 @@ void Profile::DataFormatError(Machine *m) // Note: I deliberately haven't added a Profile help for this if (backups) { MachineLoader * loader = lookupLoader(m); - /* int c = */ - mainwin->importCPAP(ImportPath(m->getBackupPath(), loader), - QObject::tr("Rebuilding from %1 Backup").arg(m->brand())); -// if ( c > 0 ) -// m->info.version = loader->Version(); + int c = mainwin->importCPAP(ImportPath(m->getBackupPath(), loader), + QObject::tr("Rebuilding from %1 Backup").arg(m->brand())); + if (c >= 0) { + // Make sure the updated version gets saved, even if there were no sessions to import. + mainwin->finishCPAPImport(); + } } else { if (!p_profile->session->backupCardData()) { // Automatic backups not available for Intellipap users yet, so don't taunt them.. diff --git a/oscar/logger.cpp b/oscar/logger.cpp index b57152ce..986b5c40 100644 --- a/oscar/logger.cpp +++ b/oscar/logger.cpp @@ -72,7 +72,7 @@ void initializeLogger() s_LoggerRunning.lock(); // wait until the thread begins running s_LoggerRunning.unlock(); // we no longer need the lock } - qInstallMessageHandler(MyOutputHandler); + qInstallMessageHandler(MyOutputHandler); // NOTE: comment this line out when debugging a crash, otherwise the deferred output will mislead you. if (b) { qDebug() << "Started logging thread"; } else { diff --git a/oscar/mainwindow.cpp b/oscar/mainwindow.cpp index d0ec5e89..82030cfa 100644 --- a/oscar/mainwindow.cpp +++ b/oscar/mainwindow.cpp @@ -743,7 +743,8 @@ void MainWindow::finishCPAPImport() GenerateStatistics(); profileSelector->updateProfileList(); - welcome->refreshPage(); + if (welcome) + welcome->refreshPage(); if (overview) { overview->ReloadGraphs(); } if (daily) { diff --git a/oscar/mainwindow.h b/oscar/mainwindow.h index 37592e17..ee2444ba 100644 --- a/oscar/mainwindow.h +++ b/oscar/mainwindow.h @@ -164,6 +164,7 @@ class MainWindow : public QMainWindow void setStatsHTML(QString html); int importCPAP(ImportPath import, const QString &message); + void finishCPAPImport(); void startImportDialog() { on_action_Import_Data_triggered(); } @@ -365,7 +366,6 @@ class MainWindow : public QMainWindow private: QString getMainWindowTitle(); void importCPAPBackups(); - void finishCPAPImport(); QList detectCPAPCards(); QList selectCPAPDataCards(const QString & prompt); void importCPAPDataCards(const QList & datacards);