aboutsummaryrefslogtreecommitdiff
path: root/jobs/basejob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'jobs/basejob.cpp')
-rw-r--r--jobs/basejob.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp
index 0a81ad5c..720ac560 100644
--- a/jobs/basejob.cpp
+++ b/jobs/basejob.cpp
@@ -217,15 +217,21 @@ void BaseJob::Private::sendRequest()
}
}
-void BaseJob::beforeStart(const ConnectionData* connData)
-{
-}
+void BaseJob::beforeStart(const ConnectionData*)
+{ }
+
+void BaseJob::afterStart(const ConnectionData*, QNetworkReply*)
+{ }
+
+void BaseJob::beforeAbandon(QNetworkReply*)
+{ }
void BaseJob::start(const ConnectionData* connData)
{
d->connection = connData;
beforeStart(connData);
sendRequest();
+ afterStart(connData, d->reply.data());
}
void BaseJob::sendRequest()
@@ -239,6 +245,10 @@ void BaseJob::sendRequest()
connect( d->reply.data(), &QNetworkReply::finished, this, &BaseJob::gotReply );
if (d->reply->isRunning())
{
+ connect( d->reply.data(), &QNetworkReply::uploadProgress,
+ this, &BaseJob::uploadProgress);
+ connect( d->reply.data(), &QNetworkReply::downloadProgress,
+ this, &BaseJob::downloadProgress);
d->timer.start(getCurrentTimeout());
qCDebug(d->logCat) << this << "request has been sent";
emit started();
@@ -431,6 +441,7 @@ void BaseJob::setStatus(int code, QString message)
void BaseJob::abandon()
{
+ beforeAbandon(d->reply.data());
this->disconnect();
if (d->reply)
d->reply->disconnect(this);