mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +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)
|
bool KCompositeJob::addSubjob(KJob *job)
|
||||||
{
|
{
|
||||||
Q_D(KCompositeJob);
|
Q_D(KCompositeJob);
|
||||||
if ( job == 0 || d->subjobs.contains( job ) )
|
if (!job || d->subjobs.contains(job)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
job->setParent(this);
|
job->setParent(this);
|
||||||
d->subjobs.append(job);
|
d->subjobs.append(job);
|
||||||
connect( job, SIGNAL(result(KJob*)),
|
|
||||||
SLOT(slotResult(KJob*)) );
|
|
||||||
|
|
||||||
// Forward information from that subjob.
|
// Forward signals from that subjob.
|
||||||
connect( job, SIGNAL(infoMessage(KJob*,QString,QString)),
|
connect(
|
||||||
SLOT(slotInfoMessage(KJob*,QString,QString)) );
|
job, SIGNAL(result(KJob*)),
|
||||||
|
this, SLOT(slotResult(KJob*))
|
||||||
|
);
|
||||||
|
connect(
|
||||||
|
job, SIGNAL(infoMessage(KJob*,QString,QString)),
|
||||||
|
this, SIGNAL(infoMessage(KJob*,QString,QString))
|
||||||
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -65,14 +67,11 @@ bool KCompositeJob::addSubjob( KJob *job )
|
||||||
bool KCompositeJob::removeSubjob(KJob *job)
|
bool KCompositeJob::removeSubjob(KJob *job)
|
||||||
{
|
{
|
||||||
Q_D(KCompositeJob);
|
Q_D(KCompositeJob);
|
||||||
if ( job == 0 )
|
if (!job) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
job->setParent(nullptr);
|
||||||
job->setParent(0);
|
|
||||||
d->subjobs.removeAll(job);
|
d->subjobs.removeAll(job);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ void KCompositeJob::clearSubjobs()
|
||||||
{
|
{
|
||||||
Q_D(KCompositeJob);
|
Q_D(KCompositeJob);
|
||||||
Q_FOREACH(KJob *job, d->subjobs) {
|
Q_FOREACH(KJob *job, d->subjobs) {
|
||||||
job->setParent(0);
|
job->setParent(nullptr);
|
||||||
}
|
}
|
||||||
d->subjobs.clear();
|
d->subjobs.clear();
|
||||||
}
|
}
|
||||||
|
@ -98,20 +97,13 @@ void KCompositeJob::clearSubjobs()
|
||||||
void KCompositeJob::slotResult(KJob *job)
|
void KCompositeJob::slotResult(KJob *job)
|
||||||
{
|
{
|
||||||
// Did job have an error ?
|
// Did job have an error ?
|
||||||
if ( job->error() && !error() )
|
if (job->error() && !error()) {
|
||||||
{
|
|
||||||
// Store it in the parent only if first error
|
// Store it in the parent only if first error
|
||||||
setError(job->error());
|
setError(job->error());
|
||||||
setErrorText(job->errorText());
|
setErrorText(job->errorText());
|
||||||
emitResult();
|
emitResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
removeSubjob(job);
|
removeSubjob(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KCompositeJob::slotInfoMessage( KJob *job, const QString &plain, const QString &rich )
|
|
||||||
{
|
|
||||||
emit infoMessage( job, plain, rich );
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_kcompositejob.cpp"
|
#include "moc_kcompositejob.cpp"
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <kjob.h>
|
#include <kjob.h>
|
||||||
|
|
||||||
class KCompositeJobPrivate;
|
class KCompositeJobPrivate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base class for all jobs able to be composed of one
|
* The base class for all jobs able to be composed of one
|
||||||
* or more subjobs.
|
* or more subjobs.
|
||||||
|
@ -30,14 +31,13 @@ class KCompositeJobPrivate;
|
||||||
class KDECORE_EXPORT KCompositeJob : public KJob
|
class KDECORE_EXPORT KCompositeJob : public KJob
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Creates a new KCompositeJob object.
|
* Creates a new KCompositeJob object.
|
||||||
*
|
*
|
||||||
* @param parent the parent QObject
|
* @param parent the parent QObject
|
||||||
*/
|
*/
|
||||||
explicit KCompositeJob( QObject *parent = 0 );
|
explicit KCompositeJob(QObject *parent = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a KCompositeJob object.
|
* Destroys a KCompositeJob object.
|
||||||
|
@ -96,23 +96,14 @@ protected Q_SLOTS:
|
||||||
* to parent job, and in all cases it calls removeSubjob.
|
* to parent job, and in all cases it calls removeSubjob.
|
||||||
*
|
*
|
||||||
* @param job the subjob
|
* @param job the subjob
|
||||||
|
* @todo make it private
|
||||||
*/
|
*/
|
||||||
virtual void slotResult(KJob *job);
|
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:
|
protected:
|
||||||
KCompositeJob(KCompositeJobPrivate &dd, QObject *parent);
|
KCompositeJob(KCompositeJobPrivate &dd, QObject *parent);
|
||||||
private:
|
private:
|
||||||
Q_DECLARE_PRIVATE(KCompositeJob)
|
Q_DECLARE_PRIVATE(KCompositeJob)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // KCOMPOSITEJOB_H
|
||||||
|
|
|
@ -38,4 +38,4 @@ public:
|
||||||
Q_DECLARE_PUBLIC(KCompositeJob)
|
Q_DECLARE_PUBLIC(KCompositeJob)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // KCOMPOSITEJOB_P_H
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param parent the parent object
|
* @param parent the parent object
|
||||||
*/
|
*/
|
||||||
KJobTrackerInterface(QObject *parent=0);
|
KJobTrackerInterface(QObject *parent = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a KJobTrackerInterface
|
* Destroys a KJobTrackerInterface
|
||||||
|
|
Loading…
Add table
Reference in a new issue