kdelibs/kdecore/jobs/kjobtrackerinterface.cpp
Ivailo Monev a2209be85f kdecore: return boolean from KJobTrackerInterface::registerJob()
so that classes that inherit from it and use D-Bus interfaces can return
true if the interface is not valid as may be the case for
KPlasmaJobTracker, that way KDynamicJobTracker will not have to create
QDBusInterface object to decide which tracker to use

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2024-05-22 17:48:49 +03:00

156 lines
3.9 KiB
C++

/* This file is part of the KDE project
Copyright (C) 2007 Kevin Ottens <ervin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kjobtrackerinterface.h"
#include "kjob.h"
KJobTrackerInterface::KJobTrackerInterface(QObject *parent)
: QObject(parent)
{
}
KJobTrackerInterface::~KJobTrackerInterface()
{
}
bool KJobTrackerInterface::registerJob(KJob *job)
{
connect(
job, SIGNAL(finished(KJob*)),
this, SLOT(unregisterJob(KJob*))
);
connect(
job, SIGNAL(finished(KJob*)),
this, SLOT(finished(KJob*))
);
connect(
job, SIGNAL(suspended(KJob*)),
this, SLOT(suspended(KJob*))
);
connect(
job, SIGNAL(resumed(KJob*)),
this, SLOT(resumed(KJob*))
);
connect(
job, SIGNAL(description(KJob*, const QString&, const QPair<QString, QString>&, const QPair<QString, QString>&)),
this, SLOT(description(KJob*, const QString&, const QPair<QString, QString>&, const QPair<QString, QString>&))
);
connect(
job, SIGNAL(infoMessage(KJob*,QString,QString)),
this, SLOT(infoMessage(KJob*,QString,QString))
);
connect(
job, SIGNAL(warning(KJob*,QString,QString)),
this, SLOT(warning(KJob*,QString,QString))
);
connect(
job, SIGNAL(totalAmount(KJob*,KJob::Unit,qulonglong)),
this, SLOT(totalAmount(KJob*,KJob::Unit,qulonglong))
);
connect(
job, SIGNAL(processedAmount(KJob*,KJob::Unit,qulonglong)),
this, SLOT(processedAmount(KJob*,KJob::Unit,qulonglong))
);
connect(
job, SIGNAL(percent(KJob*,ulong)),
this, SLOT(percent(KJob*,ulong))
);
connect(
job, SIGNAL(speed(KJob*,ulong)),
this, SLOT(speed(KJob*,ulong))
);
return true;
}
void KJobTrackerInterface::unregisterJob(KJob *job)
{
job->disconnect(this);
}
void KJobTrackerInterface::finished(KJob *job)
{
Q_UNUSED(job)
}
void KJobTrackerInterface::suspended(KJob *job)
{
Q_UNUSED(job)
}
void KJobTrackerInterface::resumed(KJob *job)
{
Q_UNUSED(job)
}
void KJobTrackerInterface::description(KJob *job, const QString &title,
const QPair<QString, QString> &field1,
const QPair<QString, QString> &field2)
{
Q_UNUSED(job)
Q_UNUSED(title)
Q_UNUSED(field1)
Q_UNUSED(field2)
}
void KJobTrackerInterface::infoMessage(KJob *job, const QString &plain, const QString &rich)
{
Q_UNUSED(job)
Q_UNUSED(plain)
Q_UNUSED(rich)
}
void KJobTrackerInterface::warning(KJob *job, const QString &plain, const QString &rich)
{
Q_UNUSED(job)
Q_UNUSED(plain)
Q_UNUSED(rich)
}
void KJobTrackerInterface::totalAmount(KJob *job, KJob::Unit unit, qulonglong amount)
{
Q_UNUSED(job)
Q_UNUSED(unit)
Q_UNUSED(amount)
}
void KJobTrackerInterface::processedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
{
Q_UNUSED(job)
Q_UNUSED(unit)
Q_UNUSED(amount)
}
void KJobTrackerInterface::percent(KJob *job, unsigned long percent)
{
Q_UNUSED(job)
Q_UNUSED(percent)
}
void KJobTrackerInterface::speed(KJob *job, unsigned long value)
{
Q_UNUSED(job)
Q_UNUSED(value)
}
#include "moc_kjobtrackerinterface.cpp"