Show message if failed to import json. Have android builds use different pathing if possible.
This commit is contained in:
@@ -64,7 +64,11 @@ Kirigami.ApplicationWindow {
|
||||
title: qsTr("Select Carfax Json file to import...")
|
||||
nameFilters: ["Carfax Vehicle Json (*.json)"]
|
||||
onAccepted: {
|
||||
jsonConverter.importCarfaxJsonToDB(importDialog.fileUrl);
|
||||
if(jsonConverter.importCarfaxJsonToDB(importDialog.fileUrl)) {
|
||||
//
|
||||
} else {
|
||||
root.showPassiveNotification(qsTr("Failed to parse file."),"short");
|
||||
}
|
||||
}
|
||||
}
|
||||
Kirigami.CardsListView {
|
||||
|
||||
@@ -72,3 +72,4 @@ bool JsonIO::importCarfaxJsonToDB(QString fileLocation)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
12
src/main.cpp
12
src/main.cpp
@@ -56,7 +56,19 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
app.setWindowIcon(QIcon::fromTheme("org.eyecreate.vehiclevoyage"));
|
||||
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
#ifdef Q_OS_ANDROID
|
||||
if(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).length > 1)
|
||||
{
|
||||
db.setDatabaseName(QDir(QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)[1]).filePath("servicerecords.sqlite")); //Use second appdata path on
|
||||
android for shared storage.
|
||||
}
|
||||
else
|
||||
{
|
||||
db.setDatabaseName(QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("servicerecords.sqlite"));
|
||||
}
|
||||
#else
|
||||
db.setDatabaseName(QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("servicerecords.sqlite"));
|
||||
#endif
|
||||
if(!QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).exists())
|
||||
{
|
||||
QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
|
||||
Reference in New Issue
Block a user