Commit bc565b3b authored by Volker Krause's avatar Volker Krause

Use native file dialogs on non-Android too

parent 709ff51e
......@@ -32,6 +32,7 @@ set_package_properties("ZLIB" PROPERTIES PURPOSE "Needed for retrieving weather
include(ECMQMLModules)
ecm_find_qmlmodule(org.kde.prison 1.0)
ecm_find_qmlmodule(Qt.labs.platform 1.0)
# runtime dependencies are build-time dependencies on Android
if (ANDROID)
......@@ -42,7 +43,7 @@ if (ANDROID)
endif()
find_package(OpenSSL REQUIRED)
else()
find_package(Qt5 REQUIRED COMPONENTS Positioning)
find_package(Qt5 REQUIRED COMPONENTS Widgets Positioning)
endif()
add_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING)
......
......@@ -78,7 +78,7 @@ if (ANDROID)
weather-storm
)
else ()
target_link_libraries(itinerary-app PRIVATE Qt5::Positioning)
target_link_libraries(itinerary-app PRIVATE Qt5::Positioning Qt5::Widgets)
set_target_properties(itinerary-app PROPERTIES OUTPUT_NAME "itinerary")
endif()
......
......@@ -16,7 +16,7 @@
*/
import QtQuick 2.0
import QtQuick.Dialogs 1.0
import Qt.labs.platform 1.0 as Platform
Item {
function importReservation()
......@@ -31,11 +31,12 @@ Item {
fileDialog.visible = true;
}
FileDialog {
Platform.FileDialog {
property bool loadPass: false
id: fileDialog
title: i18n("Please choose a file")
folder: shortcuts.home
title: loadPass ? i18n("Import PkPass File") : i18n("Import Itinerary File")
nameFilters: loadPass ? [i18n("PkPass files (*.pkpass)")] : [i18n("JSON files (*.json)")]
folder: Platform.StandardPaths.writableLocation(Platform.StandardPaths.DocumentsLocation)
onAccepted: {
console.log(fileDialog.fileUrls);
if (loadPass)
......
......@@ -45,6 +45,8 @@
#ifdef Q_OS_ANDROID
#include <QtAndroid>
#include <QAndroidJniObject>
#else
#include <QApplication>
#endif
#include <QCommandLineParser>
......@@ -81,7 +83,11 @@ int main(int argc, char **argv)
QGuiApplication::setApplicationDisplayName(i18n("KDE Itinerary"));
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#ifdef Q_OS_ANDROID
QGuiApplication app(argc, argv);
#else
QApplication app(argc, argv); // for native file dialogs
#endif
QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("map-globe")));
QCommandLineParser parser;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment