diff --git a/src/contents/ui/main.qml b/src/contents/ui/main.qml index 82dbe8ebcde7e85d6e887523677daf0069b56d13..4b2a2aa5ea59ace51a861ff393d5819e57d81566 100644 --- a/src/contents/ui/main.qml +++ b/src/contents/ui/main.qml @@ -64,9 +64,13 @@ 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 { anchors.fill: parent id: vehicleView diff --git a/src/jsonio.cpp b/src/jsonio.cpp index 3512a26c0be5908393924a7de973599e91bd7045..4c8e8d71768e8c627b757d1623c5b0b61ededb85 100644 --- a/src/jsonio.cpp +++ b/src/jsonio.cpp @@ -72,3 +72,4 @@ bool JsonIO::importCarfaxJsonToDB(QString fileLocation) return false; } + diff --git a/src/main.cpp b/src/main.cpp index 4d35c918bf2696a5b18e493f8ea0cc199a7798f6..ada77d089dbd9377d8087f9d5f0c5530d84ec842 100644 --- a/src/main.cpp +++ b/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));