1/*
2 This file is part of the KDE project
3
4 SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "kjobtrackerinterface.h"
10
11#include "kjob.h"
12
13class KJobTrackerInterfacePrivate
14{
15public:
16 KJobTrackerInterfacePrivate(KJobTrackerInterface *interface)
17 : q(interface)
18 {
19 }
20
21 KJobTrackerInterface *const q;
22};
23
24KJobTrackerInterface::KJobTrackerInterface(QObject *parent)
25 : QObject(parent)
26 , d(new KJobTrackerInterfacePrivate(this))
27{
28 qRegisterMetaType<KJob::Unit>();
29 qRegisterMetaType<QPair<QString, QString>>();
30}
31
32KJobTrackerInterface::~KJobTrackerInterface() = default;
33
34void KJobTrackerInterface::registerJob(KJob *job)
35{
36 connect(sender: job, signal: &KJob::finished, context: this, slot: &KJobTrackerInterface::unregisterJob);
37 connect(sender: job, signal: &KJob::finished, context: this, slot: &KJobTrackerInterface::finished);
38 connect(sender: job, signal: &KJob::suspended, context: this, slot: &KJobTrackerInterface::suspended);
39 connect(sender: job, signal: &KJob::resumed, context: this, slot: &KJobTrackerInterface::resumed);
40
41 connect(sender: job, signal: &KJob::description, context: this, slot: &KJobTrackerInterface::description);
42 connect(sender: job, signal: &KJob::infoMessage, context: this, slot: &KJobTrackerInterface::infoMessage);
43 connect(sender: job, signal: &KJob::warning, context: this, slot: &KJobTrackerInterface::warning);
44 connect(sender: job, signal: &KJob::totalAmountChanged, context: this, slot: &KJobTrackerInterface::totalAmount);
45 connect(sender: job, signal: &KJob::processedAmountChanged, context: this, slot: &KJobTrackerInterface::processedAmount);
46 connect(sender: job, signal: &KJob::percentChanged, context: this, slot: &KJobTrackerInterface::percent);
47 connect(sender: job, signal: &KJob::speed, context: this, slot: &KJobTrackerInterface::speed);
48}
49
50void KJobTrackerInterface::unregisterJob(KJob *job)
51{
52 job->disconnect(receiver: this);
53}
54
55void KJobTrackerInterface::finished(KJob *job)
56{
57 Q_UNUSED(job)
58}
59
60void KJobTrackerInterface::suspended(KJob *job)
61{
62 Q_UNUSED(job)
63}
64
65void KJobTrackerInterface::resumed(KJob *job)
66{
67 Q_UNUSED(job)
68}
69
70void KJobTrackerInterface::description(KJob *job, const QString &title, const QPair<QString, QString> &field1, const QPair<QString, QString> &field2)
71{
72 Q_UNUSED(job)
73 Q_UNUSED(title)
74 Q_UNUSED(field1)
75 Q_UNUSED(field2)
76}
77
78void KJobTrackerInterface::infoMessage(KJob *job, const QString &text)
79{
80 Q_UNUSED(job)
81 Q_UNUSED(text)
82}
83
84void KJobTrackerInterface::warning(KJob *job, const QString &message)
85{
86 Q_UNUSED(job)
87 Q_UNUSED(message)
88}
89
90void KJobTrackerInterface::totalAmount(KJob *job, KJob::Unit unit, qulonglong amount)
91{
92 Q_UNUSED(job)
93 Q_UNUSED(unit)
94 Q_UNUSED(amount)
95}
96
97void KJobTrackerInterface::processedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
98{
99 Q_UNUSED(job)
100 Q_UNUSED(unit)
101 Q_UNUSED(amount)
102}
103
104void KJobTrackerInterface::percent(KJob *job, unsigned long percent)
105{
106 Q_UNUSED(job)
107 Q_UNUSED(percent)
108}
109
110void KJobTrackerInterface::speed(KJob *job, unsigned long value)
111{
112 Q_UNUSED(job)
113 Q_UNUSED(value)
114}
115
116#include "moc_kjobtrackerinterface.cpp"
117

source code of kcoreaddons/src/lib/jobs/kjobtrackerinterface.cpp