Show message if failed to import json. Have android builds use different pathing if possible.
This commit is contained in:
@@ -64,9 +64,13 @@ Kirigami.ApplicationWindow {
|
|||||||
title: qsTr("Select Carfax Json file to import...")
|
title: qsTr("Select Carfax Json file to import...")
|
||||||
nameFilters: ["Carfax Vehicle Json (*.json)"]
|
nameFilters: ["Carfax Vehicle Json (*.json)"]
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
jsonConverter.importCarfaxJsonToDB(importDialog.fileUrl);
|
if(jsonConverter.importCarfaxJsonToDB(importDialog.fileUrl)) {
|
||||||
|
//
|
||||||
|
} else {
|
||||||
|
root.showPassiveNotification(qsTr("Failed to parse file."),"short");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.CardsListView {
|
Kirigami.CardsListView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
id: vehicleView
|
id: vehicleView
|
||||||
|
|||||||
@@ -72,3 +72,4 @@ bool JsonIO::importCarfaxJsonToDB(QString fileLocation)
|
|||||||
return false;
|
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"));
|
app.setWindowIcon(QIcon::fromTheme("org.eyecreate.vehiclevoyage"));
|
||||||
|
|
||||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
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"));
|
db.setDatabaseName(QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("servicerecords.sqlite"));
|
||||||
|
#endif
|
||||||
if(!QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).exists())
|
if(!QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).exists())
|
||||||
{
|
{
|
||||||
QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||||
|
|||||||
Reference in New Issue
Block a user