Plasma-workspace

jobsmodel.h
1/*
2 SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@privat.broulik.de>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#pragma once
8
9#include <QAbstractListModel>
10#include <memory>
11
12#include "notificationmanager_export.h"
13#include "notifications.h"
14
15namespace NotificationManager
16{
17class JobsModelPrivate;
18
19/**
20 * A model used for listing Job.
21 */
22class NOTIFICATIONMANAGER_EXPORT JobsModel : public QAbstractListModel
23{
24 Q_OBJECT
25
26public:
27 ~JobsModel() override;
28
29 using Ptr = std::shared_ptr<JobsModel>;
30 static Ptr createJobsModel();
31
32 /**
33 * Registers the JobView service on DBus.
34 *
35 * @return true if succeeded, false otherwise.
36 */
37 bool init();
38
39 /**
40 * Whether the notification service could be registered
41 */
42 bool isValid() const;
43
44 QVariant data(const QModelIndex &index, int role) const override;
45 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
46 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
47 QHash<int, QByteArray> roleNames() const override;
48
49 /**
50 * @brief Close a job
51 *
52 * This removes the job from the model. This will not cancel the job!
53 * Use @c kill if you want to cancel a job.
54 */
55 void close(const QModelIndex &idx);
56 void expire(const QModelIndex &idx);
57
58 /**
59 * @brief Suspend a job
60 */
61 void suspend(const QModelIndex &idx);
62 /**
63 * @brief Resume a job
64 */
65 void resume(const QModelIndex &idx);
66 /**
67 * @brief Kill a job
68 *
69 * This cancels the job.
70 */
71 void kill(const QModelIndex &idx);
72
73 void clear(Notifications::ClearFlags flags);
74
75Q_SIGNALS:
76 void serviceOwnershipLost();
77
78private:
79 JobsModel();
80 Q_DISABLE_COPY(JobsModel)
81
82 JobsModelPrivate *const d;
83};
84
85} // namespace NotificationManager
A model used for listing Job.
Definition jobsmodel.h:23
void suspend()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 12:00:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.