Changeset View
Changeset View
Standalone View
Standalone View
src/bugzillaintegration/libbugzilla/apijob.cpp
Show All 15 Lines | 1 | /* | |||
---|---|---|---|---|---|
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "apijob.h" | 21 | #include "apijob.h" | ||
22 | 22 | | |||
23 | #include <QMetaMethod> | 23 | #include <QMetaMethod> | ||
24 | #include <QTimer> | ||||
24 | 25 | | |||
25 | #include <KIOCore/KIO/TransferJob> | 26 | #include <KIOCore/KIO/TransferJob> | ||
26 | 27 | | |||
27 | #include "bugzilla_debug.h" | 28 | #include "bugzilla_debug.h" | ||
28 | #include "exceptions.h" | 29 | #include "exceptions.h" | ||
29 | 30 | | |||
30 | namespace Bugzilla { | 31 | namespace Bugzilla { | ||
31 | 32 | | |||
Show All 16 Lines | 36 | { | |||
48 | connect(m_transferJob, &KIO::TransferJob::finished, | 49 | connect(m_transferJob, &KIO::TransferJob::finished, | ||
49 | this, [this](KJob *job) { | 50 | this, [this](KJob *job) { | ||
50 | // Set errors, they are read by document() when the consumer reads | 51 | // Set errors, they are read by document() when the consumer reads | ||
51 | // the data and possibly raised as exception. | 52 | // the data and possibly raised as exception. | ||
52 | setError(job->error()); | 53 | setError(job->error()); | ||
53 | setErrorText(job->errorText()); | 54 | setErrorText(job->errorText()); | ||
54 | 55 | | |||
55 | Q_ASSERT(!((KIO::TransferJob*)job)->isErrorPage()); | 56 | Q_ASSERT(!((KIO::TransferJob*)job)->isErrorPage()); | ||
57 | | ||||
58 | // Force a delay on all API actions if configured. This allows | ||||
59 | // simulation of slow connections. | ||||
60 | static int delay = qEnvironmentVariableIntValue("DRKONQI_HTTP_DELAY_MS"); | ||||
61 | if (delay > 0) { | ||||
62 | QTimer::singleShot(delay, [this] { emitResult(); }); | ||||
63 | return; | ||||
64 | } | ||||
65 | | ||||
56 | emitResult(); | 66 | emitResult(); | ||
57 | }); | 67 | }); | ||
58 | } | 68 | } | ||
59 | 69 | | |||
60 | void TransferAPIJob::addMetaData(const QString &key, const QString &value) | 70 | void TransferAPIJob::addMetaData(const QString &key, const QString &value) | ||
61 | { | 71 | { | ||
62 | m_transferJob->addMetaData(key, value); | 72 | m_transferJob->addMetaData(key, value); | ||
63 | } | 73 | } | ||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |