mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdecore: remove redundant KCompositeJob::slotInfoMessage() proxy slot
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
2f1255c32b
commit
e6aeab27f8
4 changed files with 35 additions and 52 deletions
|
@ -45,19 +45,21 @@ KCompositeJob::~KCompositeJob()
|
|||
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;
|
||||
}
|
||||
|
@ -65,14 +67,11 @@ bool KCompositeJob::addSubjob( KJob *job )
|
|||
bool KCompositeJob::removeSubjob(KJob *job)
|
||||
{
|
||||
Q_D(KCompositeJob);
|
||||
if ( job == 0 )
|
||||
{
|
||||
if (!job) {
|
||||
return false;
|
||||
}
|
||||
|
||||
job->setParent(0);
|
||||
job->setParent(nullptr);
|
||||
d->subjobs.removeAll(job);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -90,7 +89,7 @@ void KCompositeJob::clearSubjobs()
|
|||
{
|
||||
Q_D(KCompositeJob);
|
||||
Q_FOREACH(KJob *job, d->subjobs) {
|
||||
job->setParent(0);
|
||||
job->setParent(nullptr);
|
||||
}
|
||||
d->subjobs.clear();
|
||||
}
|
||||
|
@ -98,20 +97,13 @@ void KCompositeJob::clearSubjobs()
|
|||
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());
|
||||
emitResult();
|
||||
}
|
||||
|
||||
removeSubjob(job);
|
||||
}
|
||||
|
||||
void KCompositeJob::slotInfoMessage( KJob *job, const QString &plain, const QString &rich )
|
||||
{
|
||||
emit infoMessage( job, plain, rich );
|
||||
}
|
||||
|
||||
#include "moc_kcompositejob.cpp"
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <kjob.h>
|
||||
|
||||
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.
|
||||
|
@ -96,23 +96,14 @@ 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 );
|
||||
|
||||
protected:
|
||||
KCompositeJob(KCompositeJobPrivate &dd, QObject *parent);
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(KCompositeJob)
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // KCOMPOSITEJOB_H
|
||||
|
|
|
@ -38,4 +38,4 @@ public:
|
|||
Q_DECLARE_PUBLIC(KCompositeJob)
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // KCOMPOSITEJOB_P_H
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
*
|
||||
* @param parent the parent object
|
||||
*/
|
||||
KJobTrackerInterface(QObject *parent=0);
|
||||
KJobTrackerInterface(QObject *parent = nullptr);
|
||||
|
||||
/**
|
||||
* Destroys a KJobTrackerInterface
|
||||
|
|
Loading…
Add table
Reference in a new issue