Commit 9bb2ba79 authored by Volker Krause's avatar Volker Krause

Bump minimum Qt version to 5.13 on Android

This allows us to drop our copy of the content: file engine.
parent 2d4545fd
......@@ -19,15 +19,20 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
ecm_setup_version(PROJECT VARIABLE_PREFIX ITINERARY VERSION_HEADER itinerary_version.h)
set(QT_MIN_VERSION 5.11)
if (ANDROID)
set(QT_MIN_VERSION 5.13) # for content: support and lambda activity result receiver support
endif()
# build-time dependencies
find_package(Qt5 5.10 REQUIRED COMPONENTS Test Quick)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Test Quick)
find_package(Qt5 CONFIG QUIET OPTIONAL_COMPONENTS QuickCompiler)
find_package(KF5 REQUIRED COMPONENTS I18n CoreAddons)
find_package(KF5Holidays 5.49.0 CONFIG QUIET)
find_package(KF5Notifications 5.49.0 CONFIG QUIET)
find_package(KF5Contacts CONFIG REQUIRED)
find_package(KPimPkPass CONFIG REQUIRED)
find_package(KPimItinerary 5.9.40 CONFIG REQUIRED)
find_package(KPimItinerary 5.12.0 CONFIG REQUIRED)
find_package(KPublicTransport CONFIG REQUIRED)
find_package(SharedMimeInfo 1.0 REQUIRED)
find_package(ZLIB REQUIRED)
......
......@@ -62,7 +62,6 @@ set(itinerary_app_srcs
if (ANDROID)
list(APPEND itinerary_app_srcs
androidbrightnessbackend.cpp
androidcontentfileengine.cpp
androidlockbackend.cpp
)
else()
......
/****************************************************************************
**
** Copyright (C) 2019 Volker Krause <vkrause@kde.org>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "androidcontentfileengine.h"
#include <private/qjni_p.h>
#include <private/qjnihelpers_p.h>
#include <QDebug>
AndroidContentFileEngine::AndroidContentFileEngine(const QString &fileName)
: QFSFileEngine(fileName)
{
}
bool AndroidContentFileEngine::open(QIODevice::OpenMode openMode)
{
QString openModeStr;
if (openMode & QFileDevice::ReadOnly) {
openModeStr += QLatin1Char('r');
}
if (openMode & QFileDevice::WriteOnly) {
openModeStr += QLatin1Char('w');
}
if (openMode & QFileDevice::Truncate) {
openModeStr += QLatin1Char('t');
} else if (openMode & QFileDevice::Append) {
openModeStr += QLatin1Char('a');
}
const auto fd = QJNIObjectPrivate::callStaticMethod<jint>("org/kde/itinerary/ContentFileEngine",
"openFdForContentUri",
"(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)I",
QtAndroidPrivate::context(),
QJNIObjectPrivate::fromString(fileName(DefaultName)).object(),
QJNIObjectPrivate::fromString(openModeStr).object());
if (fd < 0) {
return false;
}
return QFSFileEngine::open(openMode, fd, QFile::AutoCloseHandle);
}
AndroidContentFileEngineHandler::AndroidContentFileEngineHandler() = default;
AndroidContentFileEngineHandler::~AndroidContentFileEngineHandler() = default;
QAbstractFileEngine* AndroidContentFileEngineHandler::create(const QString &fileName) const
{
if (!fileName.startsWith(QLatin1String("content"))) {
return nullptr;
}
return new AndroidContentFileEngine(fileName);
}
/****************************************************************************
**
** Copyright (C) 2019 Volker Krause <vkrause@kde.org>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef ANDROIDCONTENTFILEENGINE_H
#define ANDROIDCONTENTFILEENGINE_H
#include <private/qfsfileengine_p.h>
class AndroidContentFileEngine : public QFSFileEngine
{
public:
AndroidContentFileEngine(const QString &fileName);
bool open(QIODevice::OpenMode openMode) override;
};
class AndroidContentFileEngineHandler : public QAbstractFileEngineHandler
{
public:
AndroidContentFileEngineHandler();
~AndroidContentFileEngineHandler();
QAbstractFileEngine *create(const QString &fileName) const override;
};
#endif // ANDROIDCONTENTFILEENGINE_H
......@@ -67,7 +67,6 @@
#include <kandroidextras/activity.h>
#include <kandroidextras/intent.h>
#include "androidcontentfileengine.h"
#include <QtAndroid>
#include <QAndroidJniObject>
#else
......@@ -117,7 +116,6 @@ int main(int argc, char **argv)
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#ifdef Q_OS_ANDROID
AndroidContentFileEngineHandler fsEngineHandler;
QGuiApplication app(argc, argv);
#else
QApplication app(argc, argv); // for native file dialogs
......
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