Mercurial > hg > syntilista
changeset 170:7edbfb2c0089
Add error message dialogs for cases when SQL tables could not be created,
instead of just logging the errors.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 19 Sep 2017 13:47:15 +0300 |
parents | d9b9be9c4788 |
children | 06306bb0ed45 |
files | src/main.cpp |
diffstat | 1 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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<br><br>"). + 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<br><br>"). + arg(db.lastError().text()) + ); + return 1; + } } query.finish();