# HG changeset patch # User Matti Hamalainen # Date 1505818035 -10800 # Node ID 7edbfb2c0089e9e9a6b627982778d4805842d23c # Parent d9b9be9c4788d0e707f76e44d12f48cf6fb30657 Add error message dialogs for cases when SQL tables could not be created, instead of just logging the errors. diff -r d9b9be9c4788 -r 7edbfb2c0089 src/main.cpp --- a/src/main.cpp Tue Sep 19 13:42:44 2017 +0300 +++ b/src/main.cpp Tue Sep 19 13:47:15 2017 +0300 @@ -280,7 +280,7 @@ } // - // Create logfile and data directory + // Create logfile and data directory if they do not already exist // settings.dataPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); QDir path(settings.dataPath); @@ -317,7 +317,15 @@ arg(SQL_LEN_LAST_NAME). arg(SQL_LEN_EXTRA_INFO)); - slCheckAndReportSQLError("CREATE TABLE people", query.lastError(), true); + if (!slCheckAndReportSQLError("CREATE TABLE people", query.lastError(), true)) + { + slErrorMsg( + QObject::tr("Tietokantataulua ei voitu luoda"), + QObject::tr("Virhe: %1

"). + arg(db.lastError().text()) + ); + return 1; + } } if (!db.tables().contains("transactions")) @@ -329,7 +337,15 @@ "value REAL, " "added DATETIME NOT NULL)")); - slCheckAndReportSQLError("CREATE TABLE transactions", query.lastError(), true); + if (!slCheckAndReportSQLError("CREATE TABLE transactions", query.lastError(), true)) + { + slErrorMsg( + QObject::tr("Tietokantataulua ei voitu luoda"), + QObject::tr("Virhe: %1

"). + arg(db.lastError().text()) + ); + return 1; + } } query.finish();