File indexing completed on 2024-05-12 05:29:23

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 #pragma once
0008 
0009 // Qt
0010 #include <QString>
0011 
0012 // Utils
0013 #include <utils/d_ptr.h>
0014 
0015 // Local
0016 #include "Event.h"
0017 #include "Module.h"
0018 
0019 /**
0020  * Resources
0021  */
0022 class Resources : public Module
0023 {
0024     Q_OBJECT
0025     Q_CLASSINFO("D-Bus Interface", "org.kde.ActivityManager.Resources")
0026 
0027 public:
0028     explicit Resources(QObject *parent = nullptr);
0029     ~Resources() override;
0030 
0031 public Q_SLOTS:
0032     /**
0033      * Registers a new event
0034      * @param application the name of application that sent the event. Ignored
0035      *                    if the event is not of type Opened
0036      * @param windowId ID of the window that displays the resource. Ignored if
0037      *                 the event is of type Accessed
0038      * @param uri URI of the resource on which the event happened
0039      * @param event type of the event
0040      */
0041     void RegisterResourceEvent(const QString &application, uint windowId, const QString &uri, uint event);
0042 
0043     /**
0044      * Registers resource's mimetype.
0045      * Note that this will be forgotten when the resource in question is closed.
0046      * @param uri URI of the resource
0047      */
0048     void RegisterResourceMimetype(const QString &uri, const QString &mimetype);
0049 
0050     /**
0051      * Registers resource's title. If not manually specified, it will be a
0052      * shortened version of the uri
0053      *
0054      * Note that this will be forgotten when the resource in question is closed.
0055      * @param uri URI of the resource
0056      */
0057     void RegisterResourceTitle(const QString &uri, const QString &title);
0058 
0059 Q_SIGNALS:
0060     void RegisteredResourceEvent(const Event &event);
0061     void ProcessedResourceEvents(const EventList &events);
0062     void RegisteredResourceMimetype(const QString &uri, const QString &mimetype);
0063     void RegisteredResourceTitle(const QString &uri, const QString &title);
0064 
0065 private:
0066     D_PTR;
0067 };