url_opener.h 1.86 KB
Newer Older
1
/*
2
 * Copyright (C) 2014-2019 CZ.NIC
3 4 5 6 7 8 9 10 11 12 13 14
 *
 * 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
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 17 18 19 20 21 22 23
 *
 * 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.
 */

24
#pragma once
25 26 27 28 29 30 31 32 33 34

#include <QObject>
#include <QString>

/*
 * We cannot use conditional declaration by Q_OS_IOS because that would cause
 * the moc_ file not to be generated.
 */

/*!
35
 * @brief Used for opening URLs and create email with attachments on iOS.
36 37 38 39
 */
class UrlOpener : public QObject {
	Q_OBJECT

Karel Slaný's avatar
Karel Slaný committed
40
private:
41 42 43 44 45
	/*!
	 * @brief Constructor.
	 *
	 * @param[in] parent Parent object.
	 */
Karel Slaný's avatar
Karel Slaný committed
46
	explicit UrlOpener(QObject *parent = Q_NULLPTR);
47

Karel Slaný's avatar
Karel Slaný committed
48
public:
49 50 51 52 53
	/*!
	 * @brief Open file on iOS.
	 *
	 * @param[in] filePath Path to file.
	 */
Karel Slaný's avatar
Karel Slaný committed
54
	static
55 56
	void openFile(const QString &filePath);

57 58 59 60
	/*!
	 * @brief Create email on iOS.
	 *
	 * @param[in] bodyText Email text.
61
	 * @param[in] to Recipient mail address.
62 63 64
	 * @param[in] subject Email subject.
	 * @param[in] filePaths Paths to attachment files.
	 */
Karel Slaný's avatar
Karel Slaný committed
65
	static
66 67
	void createEmail(const QString &bodyText, const QString &to,
	    const QString &subject, const QStringList &filePaths);
68
};