File indexing completed on 2024-12-22 04:41:14

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2018 Anmol Gautam <tarptaeya@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #pragma once
0019 
0020 #include <QObject>
0021 
0022 /**
0023  * @brief The class to display notifications
0024  */
0025 class QmlNotifications : public QObject
0026 {
0027     Q_OBJECT
0028 public:
0029     explicit QmlNotifications(QObject *parent = nullptr);
0030     /**
0031      * @brief Create and display a notification
0032      * @param JavaScript object containing
0033      *        - icon:
0034      *          String representing the icon file url. The icon path will be
0035      *          search in the following order
0036      *          - Falkon resource: for the icons starting with ":", they are searched in
0037      *               falkon resource file
0038      *          - Files in plugin directory: All other paths will be resolved relative to
0039      *               the plugin directory. If the icon path is outside the
0040      *               plugin directory, then it will be resolved as empty path.
0041      *        - heading:
0042      *          String representing the heading of the notification
0043      *        - message:
0044      *          String representing the message of the notification
0045      */
0046     Q_INVOKABLE void create(const QVariantMap &map);
0047     void setPluginPath(const QString &path);
0048 private:
0049     QString m_pluginPath;
0050 };