Changeset View
Changeset View
Standalone View
Standalone View
src/core/job_p.h
Show All 28 Lines | |||||
29 | #include "commands_p.h" | 29 | #include "commands_p.h" | ||
30 | #include "kjobtrackerinterface.h" | 30 | #include "kjobtrackerinterface.h" | ||
31 | #include <kio/jobuidelegateextension.h> | 31 | #include <kio/jobuidelegateextension.h> | ||
32 | #include <kio/jobuidelegatefactory.h> | 32 | #include <kio/jobuidelegatefactory.h> | ||
33 | #include <QUrl> | 33 | #include <QUrl> | ||
34 | #include <QPointer> | 34 | #include <QPointer> | ||
35 | #include <QDataStream> | 35 | #include <QDataStream> | ||
36 | #include "kiocoredebug.h" | 36 | #include "kiocoredebug.h" | ||
37 | #include "global.h" | ||||
37 | 38 | | |||
38 | #define KIO_ARGS QByteArray packedArgs; QDataStream stream( &packedArgs, QIODevice::WriteOnly ); stream | 39 | #define KIO_ARGS QByteArray packedArgs; QDataStream stream( &packedArgs, QIODevice::WriteOnly ); stream | ||
39 | 40 | | |||
40 | namespace KIO | 41 | namespace KIO | ||
41 | { | 42 | { | ||
42 | class Slave; | 43 | class Slave; | ||
43 | 44 | | |||
44 | // Exported for KIOWidgets jobs | 45 | // Exported for KIOWidgets jobs | ||
45 | class KIOCORE_EXPORT JobPrivate | 46 | class KIOCORE_EXPORT JobPrivate | ||
46 | { | 47 | { | ||
47 | public: | 48 | public: | ||
48 | JobPrivate() | 49 | JobPrivate() | ||
49 | : m_parentJob(nullptr), m_extraFlags(0), | 50 | : m_parentJob(nullptr), m_extraFlags(0), | ||
50 | m_uiDelegateExtension(KIO::defaultJobUiDelegateExtension()) | 51 | m_uiDelegateExtension(KIO::defaultJobUiDelegateExtension()), | ||
52 | m_privilegeExecutionEnabled(false), m_confirmationAsked(false) | ||||
51 | { | 53 | { | ||
52 | } | 54 | } | ||
53 | 55 | | |||
54 | virtual ~JobPrivate(); | 56 | virtual ~JobPrivate(); | ||
55 | 57 | | |||
56 | /** | 58 | /** | ||
57 | * Some extra storage space for jobs that don't have their own | 59 | * Some extra storage space for jobs that don't have their own | ||
58 | * private d pointer. | 60 | * private d pointer. | ||
59 | */ | 61 | */ | ||
60 | enum { EF_TransferJobAsync = (1 << 0), | 62 | enum { EF_TransferJobAsync = (1 << 0), | ||
61 | EF_TransferJobNeedData = (1 << 1), | 63 | EF_TransferJobNeedData = (1 << 1), | ||
62 | EF_TransferJobDataSent = (1 << 2), | 64 | EF_TransferJobDataSent = (1 << 2), | ||
63 | EF_ListJobUnrestricted = (1 << 3), | 65 | EF_ListJobUnrestricted = (1 << 3), | ||
64 | EF_KillCalled = (1 << 4) | 66 | EF_KillCalled = (1 << 4) | ||
65 | }; | 67 | }; | ||
66 | 68 | | |||
69 | enum FileOperationType { | ||||
70 | ChangeAttr, // chmod(), chown(), setModificationTime() | ||||
71 | Copy, | ||||
72 | Delete, | ||||
73 | MkDir, | ||||
74 | Move, | ||||
75 | Rename, | ||||
76 | Symlink, | ||||
77 | Transfer, // put() and get() | ||||
78 | Other // if other file operation set message, caption inside the job. | ||||
79 | }; | ||||
80 | | ||||
67 | // Maybe we could use the QObject parent/child mechanism instead | 81 | // Maybe we could use the QObject parent/child mechanism instead | ||
68 | // (requires a new ctor, and moving the ctor code to some init()). | 82 | // (requires a new ctor, and moving the ctor code to some init()). | ||
69 | Job *m_parentJob; | 83 | Job *m_parentJob; | ||
70 | int m_extraFlags; | 84 | int m_extraFlags; | ||
71 | MetaData m_incomingMetaData; | 85 | MetaData m_incomingMetaData; | ||
72 | MetaData m_internalMetaData; | 86 | MetaData m_internalMetaData; | ||
73 | MetaData m_outgoingMetaData; | 87 | MetaData m_outgoingMetaData; | ||
74 | JobUiDelegateExtension *m_uiDelegateExtension; | 88 | JobUiDelegateExtension *m_uiDelegateExtension; | ||
75 | Job *q_ptr; | 89 | Job *q_ptr; | ||
90 | // For privilege operation | ||||
91 | bool m_privilegeExecutionEnabled; | ||||
92 | bool m_confirmationAsked; | ||||
93 | QString m_caption, m_message; | ||||
94 | FileOperationType m_operationType; | ||||
dfaure: Please keep all the member variables together. In the orig code it's already ugly that there… | |||||
76 | 95 | | |||
96 | PrivilegeOperationStatus tryAskPrivilegeOpConfirmation(); | ||||
77 | void slotSpeed(KJob *job, unsigned long speed); | 97 | void slotSpeed(KJob *job, unsigned long speed); | ||
78 | 98 | | |||
79 | static void emitMoving(KIO::Job *, const QUrl &src, const QUrl &dest); | 99 | static void emitMoving(KIO::Job *, const QUrl &src, const QUrl &dest); | ||
80 | static void emitCopying(KIO::Job *, const QUrl &src, const QUrl &dest); | 100 | static void emitCopying(KIO::Job *, const QUrl &src, const QUrl &dest); | ||
81 | static void emitCreatingDir(KIO::Job *, const QUrl &dir); | 101 | static void emitCreatingDir(KIO::Job *, const QUrl &dir); | ||
82 | static void emitDeleting(KIO::Job *, const QUrl &url); | 102 | static void emitDeleting(KIO::Job *, const QUrl &url); | ||
83 | static void emitStating(KIO::Job *, const QUrl &url); | 103 | static void emitStating(KIO::Job *, const QUrl &url); | ||
84 | static void emitTransferring(KIO::Job *, const QUrl &url); | 104 | static void emitTransferring(KIO::Job *, const QUrl &url); | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 132 | #endif | |||
167 | 187 | | |||
168 | /** | 188 | /** | ||
169 | * Called on a slave's info message. | 189 | * Called on a slave's info message. | ||
170 | * @param s the info message | 190 | * @param s the info message | ||
171 | * @see infoMessage() | 191 | * @see infoMessage() | ||
172 | */ | 192 | */ | ||
173 | void _k_slotSlaveInfoMessage(const QString &s); | 193 | void _k_slotSlaveInfoMessage(const QString &s); | ||
174 | 194 | | |||
175 | /** | 195 | /** | ||
dfaure: typo: emitted | |||||
196 | * Called when privilegeOperationRequested() is emitted by slave. | ||||
197 | */ | ||||
198 | void slotPrivilegeOperationRequested(); | ||||
dfaure: Private header -> no need for @since doc, it's not part of the API. | |||||
199 | | ||||
200 | /** | ||||
176 | * @internal | 201 | * @internal | ||
177 | * Called by the scheduler when a slave gets to | 202 | * Called by the scheduler when a slave gets to | ||
178 | * work on this job. | 203 | * work on this job. | ||
179 | **/ | 204 | **/ | ||
180 | virtual void start(KIO::Slave *slave); | 205 | virtual void start(KIO::Slave *slave); | ||
181 | 206 | | |||
182 | /** | 207 | /** | ||
183 | * @internal | 208 | * @internal | ||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |
Please keep all the member variables together. In the orig code it's already ugly that there are methods after the variables, but this makes it slightly worse with the enum in the middle and no empty line between vars and methods.
Ideally this should be
[...] private enum, private methods, all private member vars, end of class