File indexing completed on 2024-07-14 14:34:02

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2015 Olivier Goffart <ogoffart@woboq.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #ifndef KOVERLAYICONPLUGIN_H
0009 #define KOVERLAYICONPLUGIN_H
0010 
0011 #include "kiowidgets_export.h"
0012 #include <QObject>
0013 
0014 class QUrl;
0015 
0016 /**
0017  * @class KOverlayIconPlugin koverlayiconplugin.h <KOverlayIconPlugin>
0018  *
0019  * @brief Base class for overlay icon plugins.
0020  *
0021  * Enables the file manager to show custom overlay icons on files.
0022  *
0023  * To write a custom plugin you need to create a .desktop file for your plugin with
0024  * X-KDE-ServiceTypes=KOverlayIconPlugin
0025  *
0026  * @since 5.16
0027  */
0028 class KIOWIDGETS_EXPORT KOverlayIconPlugin : public QObject
0029 {
0030     Q_OBJECT
0031 public:
0032     explicit KOverlayIconPlugin(QObject *parent = nullptr);
0033     ~KOverlayIconPlugin() override;
0034 
0035     /**
0036      * Returns a list of overlay icons to add to a file
0037      * This can be a path to an icon, or the icon name
0038      *
0039      * This function is called from the main thread and must not block.
0040      * It is recommended to have a cache. And if the item is not in cache
0041      * just return an empty list and call the overlaysChanged when the
0042      * information is available.
0043      */
0044     virtual QStringList getOverlays(const QUrl &item) = 0;
0045 Q_SIGNALS:
0046     /**
0047      * Emit this signal when the list of overlay icons changed for a given URL
0048      */
0049     void overlaysChanged(const QUrl &url, const QStringList &overlays);
0050 };
0051 
0052 #endif