mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kdeui: remove unused KAbstractWidgetJobTracker methods
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f3a9b3c0c2
commit
e8b3684d5f
8 changed files with 16 additions and 124 deletions
|
@ -52,18 +52,6 @@ bool KAbstractWidgetJobTracker::stopOnClose(KJob *job) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KAbstractWidgetJobTracker::setAutoDelete(KJob *job, bool autoDelete)
|
|
||||||
{
|
|
||||||
Q_UNUSED(job);
|
|
||||||
Q_UNUSED(autoDelete);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KAbstractWidgetJobTracker::autoDelete(KJob *job) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(job);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KAbstractWidgetJobTracker::finished(KJob *job)
|
void KAbstractWidgetJobTracker::finished(KJob *job)
|
||||||
{
|
{
|
||||||
Q_UNUSED(job);
|
Q_UNUSED(job);
|
||||||
|
@ -93,9 +81,4 @@ void KAbstractWidgetJobTracker::slotResume(KJob *job)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KAbstractWidgetJobTracker::slotClean(KJob *job)
|
|
||||||
{
|
|
||||||
Q_UNUSED(job);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_kabstractwidgetjobtracker.cpp"
|
#include "moc_kabstractwidgetjobtracker.cpp"
|
||||||
|
|
|
@ -95,30 +95,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool stopOnClose(KJob *job) const;
|
virtual bool stopOnClose(KJob *job) const;
|
||||||
|
|
||||||
/**
|
|
||||||
* This controls whether the dialog should be deleted or only cleaned when
|
|
||||||
* the KJob is finished (or canceled).
|
|
||||||
*
|
|
||||||
* If your dialog is an embedded widget and not a separate window, you should
|
|
||||||
* setAutoDelete(false) in the constructor of your custom dialog.
|
|
||||||
*
|
|
||||||
* @param job the job's widget that is going to be auto-deleted
|
|
||||||
* @param autoDelete If false the dialog will only call method slotClean.
|
|
||||||
* If true the dialog will be deleted.
|
|
||||||
* @see autoDelete()
|
|
||||||
*/
|
|
||||||
virtual void setAutoDelete(KJob *job, bool autoDelete);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the dialog should be deleted or cleaned.
|
|
||||||
*
|
|
||||||
* @param job the job's widget that will be auto-deleted
|
|
||||||
* @return false if the dialog only calls slotClean, true if it will be
|
|
||||||
* deleted
|
|
||||||
* @see setAutoDelete()
|
|
||||||
*/
|
|
||||||
virtual bool autoDelete(KJob *job) const;
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
* Called when a job is finished, in any case. It is used to notify
|
* Called when a job is finished, in any case. It is used to notify
|
||||||
|
@ -152,14 +128,6 @@ protected Q_SLOTS:
|
||||||
*/
|
*/
|
||||||
virtual void slotResume(KJob *job);
|
virtual void slotResume(KJob *job);
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is called when the widget should be cleaned (after job is finished).
|
|
||||||
* redefine this for custom behavior.
|
|
||||||
*
|
|
||||||
* @param job The job that is being cleaned
|
|
||||||
*/
|
|
||||||
virtual void slotClean(KJob *job);
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* Emitted when the user aborted the operation
|
* Emitted when the user aborted the operation
|
||||||
|
|
|
@ -132,15 +132,6 @@ void KStatusBarJobTracker::speed(KJob *job, unsigned long value)
|
||||||
d->progressWidget[job]->speed(value);
|
d->progressWidget[job]->speed(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KStatusBarJobTracker::slotClean(KJob *job)
|
|
||||||
{
|
|
||||||
if (!d->progressWidget.contains(job)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->progressWidget[job]->slotClean();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KStatusBarJobTracker::Private::ProgressWidget::killJob()
|
void KStatusBarJobTracker::Private::ProgressWidget::killJob()
|
||||||
{
|
{
|
||||||
job->kill(KJob::EmitResult); // notify that the job has been killed
|
job->kill(KJob::EmitResult); // notify that the job has been killed
|
||||||
|
@ -182,8 +173,6 @@ void KStatusBarJobTracker::Private::ProgressWidget::init(KJob *job, QWidget *par
|
||||||
|
|
||||||
setMode(KStatusBarJobTracker::LabelOnly);
|
setMode(KStatusBarJobTracker::LabelOnly);
|
||||||
|
|
||||||
q->setAutoDelete(job, true);
|
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
layout->addWidget(widget);
|
layout->addWidget(widget);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
@ -247,15 +236,6 @@ void KStatusBarJobTracker::Private::ProgressWidget::speed(unsigned long value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KStatusBarJobTracker::Private::ProgressWidget::slotClean()
|
|
||||||
{
|
|
||||||
// we don't want to delete this widget, only clean
|
|
||||||
progressBar->setValue(0);
|
|
||||||
label->clear();
|
|
||||||
|
|
||||||
setMode(KStatusBarJobTracker::NoInformation);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KStatusBarJobTracker::Private::ProgressWidget::eventFilter(QObject *obj, QEvent *event)
|
bool KStatusBarJobTracker::Private::ProgressWidget::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
if (obj == progressBar || obj == label) {
|
if (obj == progressBar || obj == label) {
|
||||||
|
|
|
@ -93,7 +93,6 @@ public Q_SLOTS:
|
||||||
virtual void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount);
|
virtual void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount);
|
||||||
virtual void percent(KJob *job, unsigned long percent);
|
virtual void percent(KJob *job, unsigned long percent);
|
||||||
virtual void speed(KJob *job, unsigned long value);
|
virtual void speed(KJob *job, unsigned long value);
|
||||||
virtual void slotClean(KJob *job);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
class Private;
|
||||||
|
|
|
@ -106,7 +106,6 @@ public Q_SLOTS:
|
||||||
virtual void totalAmount(KJob::Unit unit, qulonglong amount);
|
virtual void totalAmount(KJob::Unit unit, qulonglong amount);
|
||||||
virtual void percent(unsigned long percent);
|
virtual void percent(unsigned long percent);
|
||||||
virtual void speed(unsigned long value);
|
virtual void speed(unsigned long value);
|
||||||
virtual void slotClean();
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void killJob();
|
void killJob();
|
||||||
|
|
|
@ -132,24 +132,6 @@ bool KWidgetJobTracker::stopOnClose(KJob *job) const
|
||||||
return d->progressWidget[job]->stopOnClose;
|
return d->progressWidget[job]->stopOnClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWidgetJobTracker::setAutoDelete(KJob *job, bool autoDelete)
|
|
||||||
{
|
|
||||||
if (!d->progressWidget.contains(job)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
d->progressWidget[job]->setAttribute(Qt::WA_DeleteOnClose, autoDelete);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KWidgetJobTracker::autoDelete(KJob *job) const
|
|
||||||
{
|
|
||||||
if (!d->progressWidget.contains(job)) {
|
|
||||||
kWarning() << "not found widget for job " << job << ". This method will return a "
|
|
||||||
"hardcoded value";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return d->progressWidget[job]->testAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KWidgetJobTracker::infoMessage(KJob *job, const QString &plain, const QString &rich)
|
void KWidgetJobTracker::infoMessage(KJob *job, const QString &plain, const QString &rich)
|
||||||
{
|
{
|
||||||
KWidgetJobTracker::Private::ProgressWidget *pWidget = d->progressWidget.value(job, 0);
|
KWidgetJobTracker::Private::ProgressWidget *pWidget = d->progressWidget.value(job, 0);
|
||||||
|
@ -212,16 +194,6 @@ void KWidgetJobTracker::speed(KJob *job, unsigned long value)
|
||||||
pWidget->speed(value);
|
pWidget->speed(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWidgetJobTracker::slotClean(KJob *job)
|
|
||||||
{
|
|
||||||
KWidgetJobTracker::Private::ProgressWidget *pWidget = d->progressWidget.value(job, 0);
|
|
||||||
if (!pWidget) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pWidget->slotClean();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KWidgetJobTracker::suspended(KJob *job)
|
void KWidgetJobTracker::suspended(KJob *job)
|
||||||
{
|
{
|
||||||
KWidgetJobTracker::Private::ProgressWidget *pWidget = d->progressWidget.value(job, 0);
|
KWidgetJobTracker::Private::ProgressWidget *pWidget = d->progressWidget.value(job, 0);
|
||||||
|
@ -257,7 +229,22 @@ void KWidgetJobTracker::Private::ProgressWidget::deref()
|
||||||
if (!keepOpenCheck->isChecked()) {
|
if (!keepOpenCheck->isChecked()) {
|
||||||
closeNow();
|
closeNow();
|
||||||
} else {
|
} else {
|
||||||
slotClean();
|
percent(100);
|
||||||
|
cancelClose->setGuiItem(KStandardGuiItem::close());
|
||||||
|
openFile->setEnabled(true);
|
||||||
|
if (!totalSizeKnown || totalSize < processedSize)
|
||||||
|
totalSize = processedSize;
|
||||||
|
processedAmount(KJob::Bytes, totalSize);
|
||||||
|
keepOpenCheck->setEnabled(false);
|
||||||
|
pauseButton->setEnabled(false);
|
||||||
|
if (startTime.isValid()) {
|
||||||
|
qint64 s = startTime.elapsed();
|
||||||
|
if (!s) {
|
||||||
|
s = 1;
|
||||||
|
}
|
||||||
|
speedLabel->setText(i18n("%1/s (done)",
|
||||||
|
KGlobal::locale()->formatByteSize(1000 * totalSize / s)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -441,26 +428,6 @@ void KWidgetJobTracker::Private::ProgressWidget::speed(unsigned long value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWidgetJobTracker::Private::ProgressWidget::slotClean()
|
|
||||||
{
|
|
||||||
percent(100);
|
|
||||||
cancelClose->setGuiItem(KStandardGuiItem::close());
|
|
||||||
openFile->setEnabled(true);
|
|
||||||
if (!totalSizeKnown || totalSize < processedSize)
|
|
||||||
totalSize = processedSize;
|
|
||||||
processedAmount(KJob::Bytes, totalSize);
|
|
||||||
keepOpenCheck->setEnabled(false);
|
|
||||||
pauseButton->setEnabled(false);
|
|
||||||
if (startTime.isValid()) {
|
|
||||||
qint64 s = startTime.elapsed();
|
|
||||||
if (!s) {
|
|
||||||
s = 1;
|
|
||||||
}
|
|
||||||
speedLabel->setText(i18n("%1/s (done)",
|
|
||||||
KGlobal::locale()->formatByteSize(1000 * totalSize / s)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void KWidgetJobTracker::Private::ProgressWidget::suspended()
|
void KWidgetJobTracker::Private::ProgressWidget::suspended()
|
||||||
{
|
{
|
||||||
pauseButton->setText(i18n("&Resume"));
|
pauseButton->setText(i18n("&Resume"));
|
||||||
|
|
|
@ -74,8 +74,6 @@ public:
|
||||||
|
|
||||||
virtual void setStopOnClose(KJob *job, bool stopOnClose);
|
virtual void setStopOnClose(KJob *job, bool stopOnClose);
|
||||||
virtual bool stopOnClose(KJob *job) const;
|
virtual bool stopOnClose(KJob *job) const;
|
||||||
virtual void setAutoDelete(KJob *job, bool autoDelete);
|
|
||||||
virtual bool autoDelete(KJob *job) const;
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
|
@ -89,7 +87,6 @@ protected Q_SLOTS:
|
||||||
virtual void processedAmount(KJob *job, KJob::Unit unit, qulonglong amount);
|
virtual void processedAmount(KJob *job, KJob::Unit unit, qulonglong amount);
|
||||||
virtual void percent(KJob *job, unsigned long percent);
|
virtual void percent(KJob *job, unsigned long percent);
|
||||||
virtual void speed(KJob *job, unsigned long value);
|
virtual void speed(KJob *job, unsigned long value);
|
||||||
virtual void slotClean(KJob *job);
|
|
||||||
virtual void suspended(KJob *job);
|
virtual void suspended(KJob *job);
|
||||||
virtual void resumed(KJob *job);
|
virtual void resumed(KJob *job);
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,6 @@ public Q_SLOTS:
|
||||||
virtual void processedAmount(KJob::Unit unit, qulonglong amount);
|
virtual void processedAmount(KJob::Unit unit, qulonglong amount);
|
||||||
virtual void percent(unsigned long percent);
|
virtual void percent(unsigned long percent);
|
||||||
virtual void speed(unsigned long value);
|
virtual void speed(unsigned long value);
|
||||||
virtual void slotClean();
|
|
||||||
virtual void suspended();
|
virtual void suspended();
|
||||||
virtual void resumed();
|
virtual void resumed();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue