ios_helper.h 2.82 KB
Newer Older
1
/*
2
 * Copyright (C) 2014-2019 CZ.NIC
3 4 5 6 7 8 9 10
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Martin Straka's avatar
Martin Straka committed
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 13 14
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
Martin Straka's avatar
Martin Straka committed
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 17 18 19 20 21 22 23 24 25 26 27 28
 *
 * In addition, as a special exception, the copyright holders give
 * permission to link the code of portions of this program with the
 * OpenSSL library under certain conditions as described in each
 * individual source file, and distribute linked combinations including
 * the two.
 */

#pragma once

#include <QObject>
#include <QString>
#include <QStringList>
29
#include <QUrl>
30 31

/*!
Martin Straka's avatar
Martin Straka committed
32
 * @brief Provides QT interface for some iOS objective-C based methods.
33
 */
Martin Straka's avatar
Martin Straka committed
34
class IosHelper : public QObject {
35 36 37 38 39 40 41 42 43
	Q_OBJECT

public:

	/*!
	 * @brief Constructor.
	 *
	 * @param[in] parent Parent object.
	 */
Martin Straka's avatar
Martin Straka committed
44
	IosHelper(QObject *parent = Q_NULLPTR);
45 46 47 48 49 50 51 52 53 54

	/*!
	 * @brief Store files to iCloud.
	 *
	 * @param[in] srcFilePaths List of file paths to be saved into iCloud.
	 * @param[in] targetPath Target iCloud path where files will store.
	 */
	void storeFilesToCloud(const QStringList &srcFilePaths,
	    const QString &targetPath);

55 56 57 58 59 60 61
	/*!
	 * @brief Store files to device local storage.
	 *
	 * @param[in] srcFilePaths List of file paths to be saved into storage.
	 */
	void storeFilesToDeviceStorage(const QStringList &srcFilePaths);

62
	/*!
63
	 * @brief Clear send and tmp folder.
64
	 */
65
	Q_INVOKABLE
66
	void clearSendAndTmpDirs(void);
67

68 69 70 71 72 73
	/*!
	 * @brief Create and open document picker controller.
	 */
	Q_INVOKABLE
	void openDocumentPickerController(void);

74
	/*!
Martin Straka's avatar
Martin Straka committed
75
	 * @brief Retrun short local send file path (without full sandbox path).
76 77 78 79 80 81 82
	 *
	 * @param[in] sandBoxFilePath Send file path.
	 * @return Short path to app sandbox where send file was stored.
	 */
	Q_INVOKABLE
	QString getShortSendFilePath(const QString &sandBoxFilePath);

83
	/*!
Martin Straka's avatar
Martin Straka committed
84
	 * @brief Is activated when files have been selected with iOS file picker.
85
	 *
Martin Straka's avatar
Martin Straka committed
86
	 * @param[in] selectedFileUrls Path file list for QML.
87 88 89
	 */
	void importFilesToAppInbox(QList<QUrl> selectedFileUrls);

90 91
signals:

92 93 94 95 96 97 98
	/*!
	 * @brief Is activated when a file has been chosen with document picker.
	 *
	 * @param[in] filePath Path file for QML.
	 */
	void fileSelectedSig(QString filePath);

99 100
private:

101 102 103
	/*!
	 * @brief Move file from app temporary inbox to send path.
	 *
104
	 * @param[in] sourceFileUrl Source file url from inbox.
105
	 */
106
	void moveFileToSendDir(const QUrl &sourceFileUrl);
107
};