33 #include "progressdialog.h"
35 #include "progressbar.h"
40 #include <tdelocale.h>
46 Kleo::ProgressDialog::ProgressDialog( Job * job, const TQString & baseText,
47 TQWidget * creator, const char * name, WFlags f )
48 : TQProgressDialog( creator, name, false, f ), mBaseText( baseText )
51 setBar( new ProgressBar( this, "replacement progressbar in Kleo::ProgressDialog" ) );
53 setMinimumDuration( 2000 );
54 setAutoReset( false );
55 setAutoClose( false );
56 setLabelText( baseText );
59 connect( job, TQ_SIGNAL(progress( const TQString&, int, int)),
60 TQ_SLOT(slotProgress( const TQString&, int, int)) );
61 connect( job, TQ_SIGNAL(done()), TQ_SLOT(slotDone()) );
62 connect( this, TQ_SIGNAL(canceled()),
63 job, TQ_SLOT(slotCancel()) );
65 TQTimer::singleShot( minimumDuration(), this, TQ_SLOT(forceShow()) );
68 Kleo::ProgressDialog::~ProgressDialog() {
73 if ( 0 < ms && ms < minimumDuration() )
74 TQTimer::singleShot( ms, this, TQ_SLOT(forceShow()) );
75 TQProgressDialog::setMinimumDuration( ms );
78 void Kleo::ProgressDialog::slotProgress( const TQString & what, int current, int total ) {
79 kdDebug(5150) << "Kleo::ProgressDialog::slotProgress( \"" << what << "\", "
80 << current << ", " << total << " )" << endl;
81 if ( mBaseText.isEmpty() )
83 else if ( what.isEmpty() )
84 setLabelText( mBaseText );
86 setLabelText( i18n( "%1: %2" ).arg( mBaseText, what ) );
87 setProgress( current, total );
90 void Kleo::ProgressDialog::slotDone() {
91 kdDebug(5150) << "Kleo::ProgressDialog::slotDone()" << endl;
97 #include "progressdialog.moc"
void setMinimumDuration(int ms)
|