12using namespace NotificationManager;
14Job::Job(uint
id,
QObject *parent)
16 , d(new JobPrivate(id, this))
21 connect(d, &JobPrivate::infoMessageChanged,
this, &Job::textChanged);
22 connect(
this, &Job::processedFilesChanged,
this, &Job::textChanged);
23 connect(
this, &Job::processedItemsChanged,
this, &Job::textChanged);
24 connect(
this, &Job::totalFilesChanged,
this, &Job::textChanged);
25 connect(
this, &Job::totalItemsChanged,
this, &Job::textChanged);
26 connect(
this, &Job::descriptionValue1Changed,
this, &Job::textChanged);
27 connect(
this, &Job::descriptionValue2Changed,
this, &Job::textChanged);
28 connect(
this, &Job::destUrlChanged,
this, &Job::textChanged);
29 connect(
this, &Job::errorTextChanged,
this, &Job::textChanged);
30 connect(
this, &Job::destUrlChanged,
this, &Job::effectiveDestUrlChanged);
31 connect(
this, &Job::descriptionUrlChanged,
this, &Job::effectiveDestUrlChanged);
32 connect(
this, &Job::stateChanged,
this, &Job::effectiveDestUrlChanged);
52void Job::resetUpdated()
70 return d->m_desktopEntry;
73void Job::setDesktopEntry(
const QString &desktopEntry)
75 Q_ASSERT(d->m_desktopEntry.isNull());
81 return d->m_applicationName;
84void Job::setApplicationName(
const QString &applicationName)
86 Q_ASSERT(d->m_applicationName.isNull());
92 return d->m_applicationIconName;
95void Job::setApplicationIconName(
const QString &applicationIconName)
97 Q_ASSERT(d->m_applicationIconName.isNull());
108 if (d->m_state !=
state) {
116 return d->m_percentage;
124void Job::setError(
int error)
126 if (d->m_error !=
error) {
134 return d->m_errorText;
137void Job::setErrorText(
const QString &errorText)
139 if (d->m_errorText != errorText) {
140 d->m_errorText = errorText;
141 Q_EMIT errorTextChanged(errorText);
147 return d->m_suspendable;
150void Job::setSuspendable(
bool suspendable)
158 return d->m_killable;
161void Job::setKillable(
bool killable)
167bool Job::transient()
const
169 return d->m_transient;
172void Job::setTransient(
bool transient)
191 if (d->m_totalFiles == 1) {
192 url = d->descriptionUrl();
198 if (url.
scheme() == QStringLiteral(
"trash")) {
210qulonglong Job::processedBytes()
const
212 return d->m_processedBytes;
215qulonglong Job::processedFiles()
const
217 return d->m_processedFiles;
220qulonglong Job::processedDirectories()
const
222 return d->m_processedDirectories;
225qulonglong Job::processedItems()
const
227 return d->m_processedItems;
230qulonglong Job::totalBytes()
const
232 return d->m_totalBytes;
235qulonglong Job::totalFiles()
const
237 return d->m_totalFiles;
240qulonglong Job::totalDirectories()
const
242 return d->m_totalDirectories;
245qulonglong Job::totalItems()
const
247 return d->m_totalItems;
250QString Job::descriptionLabel1()
const
252 return d->m_descriptionLabel1;
255QString Job::descriptionValue1()
const
257 return d->m_descriptionValue1;
260QString Job::descriptionLabel2()
const
262 return d->m_descriptionLabel2;
265QString Job::descriptionValue2()
const
267 return d->m_descriptionValue2;
272 return d->m_hasDetails;
277 return d->descriptionUrl();
280bool Job::expired()
const
285void Job::setExpired(
bool expired)
287 if (d->m_expired != expired) {
288 d->m_expired = expired;
293bool Job::dismissed()
const
295 return d->m_dismissed;
298void Job::setDismissed(
bool dismissed)
300 if (d->m_dismissed != dismissed) {
301 d->m_dismissed = dismissed;
302 Q_EMIT dismissedChanged();
308 Q_EMIT d->suspendRequested();
313 Q_EMIT d->resumeRequested();
321#include "moc_job.cpp"
bool hasDetails
Whether there are any details available for this job.
qulonglong speed
Current transfer rate in Byte/s.
QString text
User-friendly compact description text of the job, for example "42 of 1337 files to "~/some/folder",...
bool suspendable
Whether the job can be suspended.
QUrl descriptionUrl
This tries to generate a valid URL for a file that's being processed by converting descriptionValue2 ...
int error
The error code of the job failure.
QString desktopEntry
The desktop entry of the application owning the job, e.g.
QString applicationIconName
The icon name of the application owning the job, e.g.
QML_ELEMENTQString summary
The job infoMessage, e.g.
QUrl effectiveDestUrl
The final destination url: it's the final copied file if is single, the destination folder url if mor...
QUrl destUrl
The destination URL of a job.
bool killable
Whether the job can be aborted.
Notifications::JobState state
The state the job is currently in.
QString applicationName
The user-visible name of the application owning the job, e.g.
int percentage
The total percentage (0-100) of job completion.
JobState
The state an application job is in.
@ JobStateStopped
The job is stopped. It has either finished (error is 0) or failed (error is not 0)
void transient(const QString &message, const QString &title)
QDateTime currentDateTimeUtc()
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
QString scheme() const const