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

0001 /*
0002  *   SPDX-FileCopyrightText: 2011-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 #include "kactivitymanagerd_plugin_export.h"
0010 
0011 // Qt
0012 #include <QDateTime>
0013 #include <QMetaType>
0014 #include <QString>
0015 
0016 /**
0017  *
0018  */
0019 class KACTIVITYMANAGERD_PLUGIN_EXPORT Event
0020 {
0021 public:
0022     enum Type {
0023         Accessed = 0, ///< resource was accessed, but we don't know for how long it will be open/used
0024 
0025         Opened = 1, ///< resource was opened
0026         Modified = 2, ///< previously opened resource was modified
0027         Closed = 3, ///< previously opened resource was closed
0028 
0029         FocussedIn = 4, ///< resource get the keyboard focus
0030         FocussedOut = 5, ///< resource lost the focus
0031 
0032         LastEventType = 5,
0033         UserEventType = 32,
0034     };
0035 
0036     // These events can't come outside of the activity manager daemon,
0037     // they are intended to provide some additional functionality
0038     // to the daemon plugins
0039     enum UserType {
0040         UpdateScore = UserEventType + 1,
0041     };
0042 
0043     Event();
0044 
0045     explicit Event(const QString &application, quintptr wid, const QString &uri, int type = Accessed);
0046 
0047     Event deriveWithType(Type type) const;
0048 
0049     bool operator==(const Event &other) const;
0050 
0051 public:
0052     QString application;
0053     quintptr wid;
0054     QString uri;
0055     int type;
0056     QDateTime timestamp;
0057 
0058     QString typeName() const;
0059 };
0060 
0061 typedef QList<Event> EventList;
0062 
0063 Q_DECLARE_METATYPE(Event)
0064 Q_DECLARE_METATYPE(EventList)