diff --git a/kdecore/jobs/kcompositejob.cpp b/kdecore/jobs/kcompositejob.cpp index b5f4ff0b..53811136 100644 --- a/kdecore/jobs/kcompositejob.cpp +++ b/kdecore/jobs/kcompositejob.cpp @@ -28,13 +28,13 @@ KCompositeJobPrivate::~KCompositeJobPrivate() { } -KCompositeJob::KCompositeJob( QObject *parent ) - : KJob( *new KCompositeJobPrivate, parent ) +KCompositeJob::KCompositeJob(QObject *parent) + : KJob(*new KCompositeJobPrivate, parent) { } -KCompositeJob::KCompositeJob( KCompositeJobPrivate &dd, QObject *parent ) - : KJob( dd, parent) +KCompositeJob::KCompositeJob(KCompositeJobPrivate &dd, QObject *parent) + : KJob(dd, parent) { } @@ -42,37 +42,36 @@ KCompositeJob::~KCompositeJob() { } -bool KCompositeJob::addSubjob( KJob *job ) +bool KCompositeJob::addSubjob(KJob *job) { Q_D(KCompositeJob); - if ( job == 0 || d->subjobs.contains( job ) ) - { + if (!job || d->subjobs.contains(job)) { return false; } - job->setParent(this); d->subjobs.append(job); - connect( job, SIGNAL(result(KJob*)), - SLOT(slotResult(KJob*)) ); - // Forward information from that subjob. - connect( job, SIGNAL(infoMessage(KJob*,QString,QString)), - SLOT(slotInfoMessage(KJob*,QString,QString)) ); + // Forward signals from that subjob. + connect( + job, SIGNAL(result(KJob*)), + this, SLOT(slotResult(KJob*)) + ); + connect( + job, SIGNAL(infoMessage(KJob*,QString,QString)), + this, SIGNAL(infoMessage(KJob*,QString,QString)) + ); return true; } -bool KCompositeJob::removeSubjob( KJob *job ) +bool KCompositeJob::removeSubjob(KJob *job) { Q_D(KCompositeJob); - if ( job == 0 ) - { + if (!job) { return false; } - - job->setParent(0); - d->subjobs.removeAll( job ); - + job->setParent(nullptr); + d->subjobs.removeAll(job); return true; } @@ -81,7 +80,7 @@ bool KCompositeJob::hasSubjobs() const return !d_func()->subjobs.isEmpty(); } -const QList &KCompositeJob::subjobs() const +const QList& KCompositeJob::subjobs() const { return d_func()->subjobs; } @@ -90,28 +89,21 @@ void KCompositeJob::clearSubjobs() { Q_D(KCompositeJob); Q_FOREACH(KJob *job, d->subjobs) { - job->setParent(0); + job->setParent(nullptr); } d->subjobs.clear(); } -void KCompositeJob::slotResult( KJob *job ) +void KCompositeJob::slotResult(KJob *job) { // Did job have an error ? - if ( job->error() && !error() ) - { + if (job->error() && !error()) { // Store it in the parent only if first error - setError( job->error() ); - setErrorText( job->errorText() ); + setError(job->error()); + setErrorText(job->errorText()); emitResult(); } - removeSubjob(job); } -void KCompositeJob::slotInfoMessage( KJob *job, const QString &plain, const QString &rich ) -{ - emit infoMessage( job, plain, rich ); -} - #include "moc_kcompositejob.cpp" diff --git a/kdecore/jobs/kcompositejob.h b/kdecore/jobs/kcompositejob.h index 4b01e39d..64eeab0e 100644 --- a/kdecore/jobs/kcompositejob.h +++ b/kdecore/jobs/kcompositejob.h @@ -23,6 +23,7 @@ #include class KCompositeJobPrivate; + /** * The base class for all jobs able to be composed of one * or more subjobs. @@ -30,14 +31,13 @@ class KCompositeJobPrivate; class KDECORE_EXPORT KCompositeJob : public KJob { Q_OBJECT - public: /** * Creates a new KCompositeJob object. * * @param parent the parent QObject */ - explicit KCompositeJob( QObject *parent = 0 ); + explicit KCompositeJob(QObject *parent = nullptr); /** * Destroys a KCompositeJob object. @@ -55,7 +55,7 @@ protected: * @param job the subjob to add * @return true if the job has been added correctly, false otherwise */ - virtual bool addSubjob( KJob *job ); + virtual bool addSubjob(KJob *job); /** * Mark a sub job as being done. @@ -65,7 +65,7 @@ protected: * @param job the subjob to remove * @return true if the job has been removed correctly, false otherwise */ - virtual bool removeSubjob( KJob *job ); + virtual bool removeSubjob(KJob *job); /** * Checks if this job has subjobs running. @@ -79,7 +79,7 @@ protected: * * @return the full list of sub jobs */ - const QList &subjobs() const; + const QList& subjobs() const; /** * Clears the list of subjobs. @@ -96,18 +96,9 @@ protected Q_SLOTS: * to parent job, and in all cases it calls removeSubjob. * * @param job the subjob + * @todo make it private */ - virtual void slotResult( KJob *job ); - - /** - * Forward signal from subjob. - * - * @param job the subjob - * @param plain the info message in plain text version - * @param rich the info message in rich text version - * @see infoMessage() - */ - virtual void slotInfoMessage( KJob *job, const QString &plain, const QString &rich ); + virtual void slotResult(KJob *job); protected: KCompositeJob(KCompositeJobPrivate &dd, QObject *parent); @@ -115,4 +106,4 @@ private: Q_DECLARE_PRIVATE(KCompositeJob) }; -#endif +#endif // KCOMPOSITEJOB_H diff --git a/kdecore/jobs/kcompositejob_p.h b/kdecore/jobs/kcompositejob_p.h index bef06e9b..7b4c73bc 100644 --- a/kdecore/jobs/kcompositejob_p.h +++ b/kdecore/jobs/kcompositejob_p.h @@ -38,4 +38,4 @@ public: Q_DECLARE_PUBLIC(KCompositeJob) }; -#endif +#endif // KCOMPOSITEJOB_P_H diff --git a/kdecore/jobs/kjobtrackerinterface.h b/kdecore/jobs/kjobtrackerinterface.h index eaca81c3..1a6ba7f4 100644 --- a/kdecore/jobs/kjobtrackerinterface.h +++ b/kdecore/jobs/kjobtrackerinterface.h @@ -35,7 +35,7 @@ public: * * @param parent the parent object */ - KJobTrackerInterface(QObject *parent=0); + KJobTrackerInterface(QObject *parent = nullptr); /** * Destroys a KJobTrackerInterface