2021-06-19 09:06:52 +02:00
|
|
|
// (c) 2017 Ekkehard Gentz (ekke)
|
|
|
|
// this project is based on ideas from
|
|
|
|
// http://blog.lasconic.com/share-on-ios-and-android-using-qml/
|
|
|
|
// see github project https://github.com/lasconic/ShareUtils-QML
|
|
|
|
// also inspired by:
|
|
|
|
// https://www.androidcode.ninja/android-share-intent-example/
|
|
|
|
// https://www.calligra.org/blogs/sharing-with-qt-on-android/
|
|
|
|
// https://stackoverflow.com/questions/7156932/open-file-in-another-app
|
|
|
|
// http://www.qtcentre.org/threads/58668-How-to-use-QAndroidJniObject-for-intent-setData
|
|
|
|
// see also /COPYRIGHT and /LICENSE
|
|
|
|
|
|
|
|
// (c) 2017 Ekkehard Gentz (ekke) @ekkescorner
|
|
|
|
// my blog about Qt for mobile: http://j.mp/qt-x
|
|
|
|
// see also /COPYRIGHT and /LICENSE
|
|
|
|
|
|
|
|
#ifndef PLATFORMSHAREUTILS_H
|
|
|
|
#define PLATFORMSHAREUTILS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QDebug>
|
2021-06-20 16:51:31 +02:00
|
|
|
#include <QStandardPaths>
|
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QUrl>
|
2021-06-19 09:06:52 +02:00
|
|
|
|
|
|
|
class PlatformShareUtils : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
signals:
|
|
|
|
void shareEditDone(int requestCode);
|
|
|
|
void shareFinished(int requestCode);
|
|
|
|
void shareNoAppAvailable(int requestCode);
|
|
|
|
void shareError(int requestCode, QString message);
|
|
|
|
void fileUrlReceived(QString url);
|
2021-06-20 19:04:36 +02:00
|
|
|
void otherUrlReceived(QString url, QString scheme);
|
2021-06-19 09:06:52 +02:00
|
|
|
void fileReceivedAndSaved(QString url);
|
|
|
|
|
|
|
|
public:
|
|
|
|
PlatformShareUtils(QObject *parent = 0);
|
|
|
|
virtual ~PlatformShareUtils();
|
|
|
|
virtual bool checkMimeTypeView(const QString &mimeType);
|
|
|
|
virtual bool checkMimeTypeEdit(const QString &mimeType);
|
2021-06-20 16:51:31 +02:00
|
|
|
virtual QString getTemporaryFileLocationPath();
|
2021-06-19 09:06:52 +02:00
|
|
|
virtual void shareText(const QString &text);
|
|
|
|
virtual void sendFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId);
|
|
|
|
virtual void viewFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId);
|
|
|
|
virtual void editFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId);
|
|
|
|
|
|
|
|
virtual void checkPendingIntents(const QString workingDirPath);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLATFORMSHAREUTILS_H
|