Commit 689cae22 authored by Volker Krause's avatar Volker Krause

Don't depend on QtLocation on Android

Avoid requiring location permissions, and not needed as we use the system
map/navigation views there.
parent e5998f8e
......@@ -19,7 +19,7 @@ set(CMAKE_AUTORCC ON)
ecm_setup_version(PROJECT VARIABLE_PREFIX ITINERARY VERSION_HEADER itinerary_version.h)
# build-time dependencies
find_package(Qt5 REQUIRED COMPONENTS Test Quick Location)
find_package(Qt5 REQUIRED COMPONENTS Test Quick)
find_package(KF5 REQUIRED COMPONENTS I18n)
find_package(KPimPkPass REQUIRED)
find_package(KPimItinerary REQUIRED)
......@@ -38,6 +38,8 @@ if (ANDROID)
if (NOT DEFINED BREEZEICONS_DIR AND EXISTS ${CMAKE_SOURCE_DIR}/../breeze-icons)
set(BREEZEICONS_DIR ${CMAKE_SOURCE_DIR}/../breeze-icons)
endif()
else()
find_package(Qt5 REQUIRED COMPONENTS Location)
endif()
add_subdirectory(src)
......
......@@ -26,7 +26,6 @@ target_include_directories(itinerary-app PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(itinerary-app PRIVATE
itinerary
Qt5::Quick
Qt5::Location
)
if (ANDROID)
# explicitly add runtime dependencies and transitive link dependencies,
......@@ -48,6 +47,7 @@ if (ANDROID)
view-refresh
)
else ()
target_link_libraries(itinerary-app PRIVATE Qt5::Location)
set_target_properties(itinerary-app PROPERTIES OUTPUT_NAME "itinerary")
endif()
......
......@@ -22,14 +22,15 @@
#include <QDebug>
#include <QDesktopServices>
#include <QGeoPositionInfo>
#include <QGeoPositionInfoSource>
#include <QUrl>
#include <QUrlQuery>
#ifdef Q_OS_ANDROID
#include <QtAndroid>
#include <QAndroidJniObject>
#else
#include <QGeoPositionInfo>
#include <QGeoPositionInfoSource>
#endif
using namespace KItinerary;
......@@ -104,7 +105,7 @@ void ApplicationController::showOnMap(const QVariant &place)
void ApplicationController::navigateTo(const QVariant& place)
{
if (place.isNull() || m_pendingNavigation) {
if (place.isNull()) {
return;
}
......@@ -131,6 +132,9 @@ void ApplicationController::navigateTo(const QVariant& place)
}
#else
if (m_pendingNavigation) {
return;
}
if (!m_positionSource) {
m_positionSource = QGeoPositionInfoSource::createDefaultSource(this);
......@@ -152,6 +156,7 @@ void ApplicationController::navigateTo(const QVariant& place)
#endif
}
#ifndef Q_OS_ANDROID
void ApplicationController::navigateTo(const QGeoPositionInfo &from, const QVariant &to)
{
disconnect(m_pendingNavigation);
......@@ -174,3 +179,4 @@ void ApplicationController::navigateTo(const QGeoPositionInfo &from, const QVari
return;
}
}
#endif
......@@ -34,10 +34,12 @@ public:
Q_INVOKABLE void navigateTo(const QVariant &place);
private:
#ifndef Q_OS_ANDROID
void navigateTo(const QGeoPositionInfo &from, const QVariant &to);
QGeoPositionInfoSource *m_positionSource = nullptr;
QMetaObject::Connection m_pendingNavigation;
#endif
};
#endif // APPLICATIONCONTROLLER_H
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