This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
fanny-app/headers/filehelper.h

52 lines
1.2 KiB
C
Raw Normal View History

#ifndef FILEHELPER_H
#define FILEHELPER_H
#include <QObject>
#include <QDebug>
#if defined(Q_OS_IOS)
#include "ios/iosshareutils.hpp"
#elif defined(Q_OS_ANDROID)
#include <QtAndroid>
#include <QAndroidActivityResultReceiver>
#else
#include <QDesktopServices>
#include <QUrl>
#endif
class FileHelper : public QObject
#if defined(Q_OS_ANDROID)
, public QAndroidActivityResultReceiver
#endif
{
Q_OBJECT
public:
explicit FileHelper(QObject *parent = nullptr);
void viewFile(const QString &filePath, const QString &title, const QString &mimeType, const int &requestId);
#if defined(Q_OS_ANDROID)
void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data);
void onActivityResult(int requestCode, int resultCode);
static FileHelper* getInstance();
#endif
private:
#if defined(Q_OS_IOS)
#elif defined(Q_OS_ANDROID)
void processActivityResult(int requestCode, int resultCode);
static FileHelper* mInstance;
#else
#endif
signals:
void shareEditDone(int requestCode);
void shareFinished(int requestCode);
void shareNoAppAvailable(int requestCode);
void shareError(int requestCode, QString message);
public slots:
};
#endif // FILEHELPER_H