File indexing completed on 2024-05-12 16:59:21
0001 /* 0002 * SPDX-FileCopyrightText: 2012-2016 Ivan Cukic <ivan.cukic@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef RESOURCES_H 0008 #define RESOURCES_H 0009 0010 // Qt 0011 #include <QString> 0012 0013 // Utils 0014 #include <utils/d_ptr.h> 0015 0016 // Local 0017 #include "Event.h" 0018 #include "Module.h" 0019 0020 /** 0021 * Resources 0022 */ 0023 class Resources : public Module 0024 { 0025 Q_OBJECT 0026 Q_CLASSINFO("D-Bus Interface", "org.kde.ActivityManager.Resources") 0027 0028 public: 0029 explicit Resources(QObject *parent = nullptr); 0030 ~Resources() override; 0031 0032 public Q_SLOTS: 0033 /** 0034 * Registers a new event 0035 * @param application the name of application that sent the event. Ignored 0036 * if the event is not of type Opened 0037 * @param windowId ID of the window that displays the resource. Ignored if 0038 * the event is of type Accessed 0039 * @param uri URI of the resource on which the event happened 0040 * @param event type of the event 0041 */ 0042 void RegisterResourceEvent(const QString &application, uint windowId, const QString &uri, uint event); 0043 0044 /** 0045 * Registers resource's mimetype. 0046 * Note that this will be forgotten when the resource in question is closed. 0047 * @param uri URI of the resource 0048 */ 0049 void RegisterResourceMimetype(const QString &uri, const QString &mimetype); 0050 0051 /** 0052 * Registers resource's title. If not manually specified, it will be a 0053 * shortened version of the uri 0054 * 0055 * Note that this will be forgotten when the resource in question is closed. 0056 * @param uri URI of the resource 0057 */ 0058 void RegisterResourceTitle(const QString &uri, const QString &title); 0059 0060 Q_SIGNALS: 0061 void RegisteredResourceEvent(const Event &event); 0062 void ProcessedResourceEvents(const EventList &events); 0063 void RegisteredResourceMimetype(const QString &uri, const QString &mimetype); 0064 void RegisteredResourceTitle(const QString &uri, const QString &title); 0065 0066 private: 0067 D_PTR; 0068 }; 0069 0070 #endif // RESOURCES_H