File indexing completed on 2024-05-12 16:06:53
0001 /* 0002 SPDX-FileCopyrightText: 2018 Aleix Pol <aleixpol@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef ANDROID_H 0008 #define ANDROID_H 0009 0010 #include <QObject> 0011 #include <QUrl> 0012 #include <jni.h> 0013 0014 class URIHandler 0015 { 0016 public: 0017 void openUri(const QString &uri) 0018 { 0019 m_lastUrl = uri; 0020 } 0021 0022 QString m_lastUrl; 0023 static URIHandler handler; 0024 }; 0025 0026 class AndroidInstance : public QObject 0027 { 0028 Q_OBJECT 0029 public: 0030 Q_SCRIPTABLE void openFile(const QString &title, const QStringList &mimes); 0031 0032 static void handleViewIntent(); 0033 0034 Q_SIGNALS: 0035 void openUri(const QUrl &uri); 0036 }; 0037 0038 extern "C" { 0039 0040 JNIEXPORT void JNICALL Java_org_kde_something_FileClass_openUri(JNIEnv *env, jobject /*obj*/, jstring uri); 0041 } 0042 0043 #endif