26 #include <tqpainter.h>
30 #include <tqpushbutton.h>
36 #include "kprogress.h"
37 #include "ktextedit.h"
38 #include "kprogressbox.h"
40 #include <tdeapplication.h>
44 struct KProgressBoxDialog::KProgressBoxDialogPrivate
46 KProgressBoxDialogPrivate() : cancelButtonShown(true)
50 bool cancelButtonShown;
57 const TQString& caption,
const TQString& text,
65 mAllowTextEdit(false),
68 d(new KProgressBoxDialogPrivate)
73 mShowTimer =
new TQTimer(
this);
79 TQVBoxLayout* layout =
new TQVBoxLayout(mainWidget, 10);
81 mLabel =
new TQLabel(text, mainWidget);
82 layout->addWidget(mLabel);
85 layout->addWidget(mProgressBar);
87 layout->addWidget(mTextBox);
89 connect(mProgressBar, TQT_SIGNAL(percentageChanged(
int)),
90 this, TQT_SLOT(slotAutoActions(
int)));
91 connect(mShowTimer, TQT_SIGNAL(timeout()),
this, TQT_SLOT(slotAutoShow()));
92 mShowTimer->start(mMinDuration,
true);
100 void KProgressBoxDialog::slotAutoShow()
102 if (mShown || mCancelled)
108 kapp->processEvents();
111 void KProgressBoxDialog::slotCancel()
142 mShowTimer->start(mMinDuration,
true);
164 mAllowTextEdit = allowTextEdit;
201 mLabel->setText(text);
207 return mLabel->text();
212 return mLabel->text();
269 void KProgressBoxDialog::slotAutoActions(
int percentage)
271 if (percentage < 100)
273 if (!d->cancelButtonShown)
276 d->cancelButtonShown =
true;
291 d->cancelButtonShown =
false;
313 void KProgressBoxDialog::virtual_hook(
int id,
void* data )
314 { KDialogBase::virtual_hook(
id, data ); }
316 #include "kprogressbox.moc"