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
|
@ -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<KJob*> &KCompositeJob::subjobs() const
|
||||
const QList<KJob*>& 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"
|
||||
|
|
|
@ -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.
|
||||
|
@ -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<KJob*> &subjobs() const;
|
||||
const QList<KJob*>& 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
|
||||
|
|
|
@ -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