mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
gwenview: do not assume that document jobs are not automatically started
fixes runtime warning and busyChanged() signal not being emitted in that case Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
9e3d5a4136
commit
e02661135c
1 changed files with 13 additions and 9 deletions
|
@ -66,10 +66,6 @@ static void logQueue(DocumentPrivate* d)
|
|||
#undef PREFIX
|
||||
}
|
||||
|
||||
#define LOG_QUEUE(msg, d) \
|
||||
kDebug() << msg; \
|
||||
logQueue(d)
|
||||
|
||||
//- DocumentPrivate ---------------------------------------
|
||||
void DocumentPrivate::scheduleImageLoading(int invertedZoom)
|
||||
{
|
||||
|
@ -502,24 +498,32 @@ void Document::enqueueJob(DocumentJob* job)
|
|||
connect(job, SIGNAL(finished(KJob*)),
|
||||
SLOT(slotJobFinished(KJob*)));
|
||||
if (d->mCurrentJob) {
|
||||
kDebug() << "Enqueued job";
|
||||
d->mJobQueue.enqueue(job);
|
||||
} else {
|
||||
d->mCurrentJob = job;
|
||||
kDebug() << "Starting first job";
|
||||
d->mCurrentJob = job;
|
||||
job->start();
|
||||
busyChanged(d->mUrl, true);
|
||||
}
|
||||
LOG_QUEUE("Job added", d);
|
||||
logQueue(d);
|
||||
}
|
||||
|
||||
void Document::slotJobFinished(KJob* job)
|
||||
{
|
||||
kDebug() << "job=" << job;
|
||||
GV_RETURN_IF_FAIL(job == d->mCurrentJob.data());
|
||||
DocumentJob* documentJob = qobject_cast<DocumentJob*>(job);
|
||||
GV_RETURN_IF_FAIL(documentJob != nullptr);
|
||||
if (documentJob == d->mCurrentJob.data()) {
|
||||
kDebug() << "Current job done";
|
||||
d->mCurrentJob.clear();
|
||||
} else {
|
||||
kDebug() << "Queued job done";
|
||||
d->mJobQueue.removeAll(documentJob);
|
||||
}
|
||||
|
||||
if (d->mJobQueue.isEmpty()) {
|
||||
kDebug() << "All done";
|
||||
d->mCurrentJob.clear();
|
||||
busyChanged(d->mUrl, false);
|
||||
allTasksDone();
|
||||
} else {
|
||||
|
@ -528,7 +532,7 @@ void Document::slotJobFinished(KJob* job)
|
|||
GV_RETURN_IF_FAIL(d->mCurrentJob);
|
||||
d->mCurrentJob.data()->start();
|
||||
}
|
||||
LOG_QUEUE("Removed done job", d);
|
||||
logQueue(d);
|
||||
}
|
||||
|
||||
bool Document::isBusy() const
|
||||
|
|
Loading…
Add table
Reference in a new issue