KActivities 5.109.0
resourceinstance.h
1/*
2 SPDX-FileCopyrightText: 2011-2016 Ivan Cukic <ivan.cukic(at)kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef ACTIVITIES_RESOURCEINSTANCE_H
8#define ACTIVITIES_RESOURCEINSTANCE_H
9
10#include <QObject>
11#include <QUrl>
12
13#include "kactivities_export.h"
14
15namespace KActivities
16{
17class ResourceInstancePrivate;
18
39class KACTIVITIES_EXPORT ResourceInstance : public QObject
40{
41 Q_OBJECT
42
43 Q_PROPERTY(QUrl uri READ uri WRITE setUri)
44 Q_PROPERTY(QString mimetype READ mimetype WRITE setMimetype)
45 Q_PROPERTY(QString title READ title WRITE setTitle)
46 Q_PROPERTY(quintptr winId READ winId)
47
48public:
55 explicit ResourceInstance(quintptr wid, QObject *parent = nullptr);
56
64 explicit ResourceInstance(quintptr wid, const QString &application, QObject *parent = nullptr);
65
88 ResourceInstance(quintptr wid,
89 QUrl resourceUri,
90 const QString &mimetype = QString(),
91 const QString &title = QString(),
92 const QString &application = QString(),
93 QObject *parent = nullptr);
94
100
101public Q_SLOTS:
107
114
121
127 void setUri(const QUrl &newUri);
128
132 void setMimetype(const QString &mimetype);
133
137 void setTitle(const QString &title);
138
139Q_SIGNALS:
149
150public:
158 virtual QUrl uri() const;
159
163 QString mimetype() const;
164
168 QString title() const;
169
173 quintptr winId() const;
174
185 static void notifyAccessed(const QUrl &uri, const QString &application = QString());
186
187private:
188 const QScopedPointer<ResourceInstancePrivate> d;
189};
190}
191
192#endif // ACTIVITIES_RESOURCEINSTANCE_H
This class is used to notify the system that a file, web page or some other resource has been accesse...
Definition resourceinstance.h:40
ResourceInstance(quintptr wid, const QString &application, QObject *parent=nullptr)
Creates a new resource instance.
void notifyFocusedIn()
Call this method to notify the system that the resource has the focus in your application.
void setUri(const QUrl &newUri)
This is a convenience method that sets the new URI.
~ResourceInstance() override
Destroys the ResourceInstance and notifies the system that the resource has been closed.
void setTitle(const QString &title)
Sets the title for this resource.
static void notifyAccessed(const QUrl &uri, const QString &application=QString())
If there's no way to tell for how long an application is keeping the resource open,...
ResourceInstance(quintptr wid, QObject *parent=nullptr)
Creates a new resource instance.
ResourceInstance(quintptr wid, QUrl resourceUri, const QString &mimetype=QString(), const QString &title=QString(), const QString &application=QString(), QObject *parent=nullptr)
Creates a new resource instance and automatically notifies the system that it was opened.
void notifyFocusedOut()
Call this method to notify the system that the resource lost the focus in your application.
void requestsFocus()
Emitted when the system wants to show the resource represented by this ResourceInstance.
void notifyModified()
Call this method to notify the system that you modified (the contents of) the resource.
void setMimetype(const QString &mimetype)
Sets the mimetype for this resource.
virtual QUrl uri() const
Namespace for everything in libkactivities.
Definition consumer.h:20