File indexing completed on 2024-09-15 04:28:35
0001 // SPDX-FileCopyrightText: 2022 Nicolas Fella <nicolas.fella@gmx.de> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 #pragma once 0005 0006 #include <QObject> 0007 #include <QQmlEngine> 0008 #include <QUrl> 0009 0010 /** 0011 * @class UrlHelper 0012 * 0013 * A class to help manage URLs. 0014 */ 0015 class UrlHelper : public QObject 0016 { 0017 Q_OBJECT 0018 QML_ELEMENT 0019 QML_SINGLETON 0020 0021 public: 0022 /** 0023 * @brief Open the given URL in an appropriate app. 0024 */ 0025 Q_INVOKABLE void openUrl(const QUrl &url); 0026 0027 /** 0028 * @brief Copy the given URL to the given location. 0029 */ 0030 Q_INVOKABLE void copyTo(const QUrl &origin, const QUrl &destination); 0031 };