Commit 389725b6 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Nate Graham
Browse files

Make sure the Job notification goes as we restore the view

Otherwise we get multiple of them.

BUG: 457208
parent 6212642b
Pipeline #210322 passed with stage
in 2 minutes and 3 seconds
......@@ -380,6 +380,12 @@ public:
auto firstTransaction = TransactionModel::global()->transactions().constFirst();
Q_EMIT description(this, firstTransaction->name());
}
void cancel()
{
setError(KJob::KilledJobError /*KIO::ERR_USER_CANCELED*/);
deleteLater();
}
};
bool DiscoverObject::quitWhenIdle()
......@@ -390,9 +396,6 @@ bool DiscoverObject::quitWhenIdle()
if (!m_sni) {
auto tracker = new KUiServerV2JobTracker(m_sni);
auto job = new TransactionsJob;
tracker->registerJob(job);
job->start();
m_sni = new KStatusNotifierItem(this);
m_sni->setStatus(KStatusNotifierItem::Active);
......@@ -404,6 +407,12 @@ bool DiscoverObject::quitWhenIdle()
connect(TransactionModel::global(), &TransactionModel::countChanged, this, &DiscoverObject::reconsiderQuit);
connect(m_sni, &KStatusNotifierItem::activateRequested, this, &DiscoverObject::restore);
auto job = new TransactionsJob;
job->setParent(this);
tracker->registerJob(job);
job->start();
connect(m_sni, &KStatusNotifierItem::activateRequested, job, &TransactionsJob::cancel);
rootObject()->hide();
}
return false;
......
......@@ -17,6 +17,7 @@ class KStatusNotifierItem;
class QWindow;
class QQmlApplicationEngine;
class CachedNetworkAccessManagerFactory;
class TransactionsJob;
class DiscoverObject : public QObject
{
......
......@@ -34,7 +34,7 @@ void DummyTransaction::iterateTransaction()
return;
if (progress() < 100) {
setProgress(qBound(0, progress() + (KRandom::random() % 30), 100));
setProgress(qBound(0, progress() + (KRandom::random() % 5), 100));
QTimer::singleShot(/*KRandom::random()%*/ 100, this, &DummyTransaction::iterateTransaction);
} else if (status() == DownloadingStatus) {
setStatus(CommittingStatus);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment