1/*
2 This file is part of the KDE project
3
4 SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
5 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
6 SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org>
7
8 SPDX-License-Identifier: LGPL-2.0-or-later
9*/
10
11#ifndef KJOB_P_H
12#define KJOB_P_H
13
14#include "kjob.h"
15#include <QEventLoopLocker>
16#include <QMap>
17
18#include <array>
19
20class KJobUiDelegate;
21class QTimer;
22class QEventLoop;
23
24// This is a private class, but it's exported for
25// KIO::Job's usage. Other Job classes in kdelibs may
26// use it too.
27class KCOREADDONS_EXPORT KJobPrivate
28{
29public:
30 KJobPrivate();
31 virtual ~KJobPrivate();
32
33 void speedTimeout();
34
35 KJob *q_ptr = nullptr;
36
37 KJobUiDelegate *uiDelegate = nullptr;
38 QString errorText;
39 int error = KJob::NoError;
40 KJob::Unit progressUnit = KJob::Bytes;
41
42 struct Amounts {
43 qulonglong processedAmount = 0;
44 qulonglong totalAmount = 0;
45 };
46
47 std::array<Amounts, KJob::UnitsCount> m_jobAmounts;
48
49 unsigned long percentage = 0;
50 QTimer *speedTimer = nullptr;
51 QEventLoop *eventLoop = nullptr;
52 // eventLoopLocker prevents QCoreApplication from exiting when the last
53 // window is closed until the job has finished running
54 QEventLoopLocker eventLoopLocker;
55 KJob::Capabilities capabilities = KJob::NoCapabilities;
56 bool suspended = false;
57 bool isAutoDelete = true;
58 bool m_hideFinishedNotification = false;
59 bool isFinished = false;
60 bool m_startedWithExec = false;
61
62 Q_DECLARE_PUBLIC(KJob)
63};
64
65#endif
66

source code of kcoreaddons/src/lib/jobs/kjob_p.h