2 // Copyright (C) 2004-2005 Stephan Binner <binner@kde.org>
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the7 implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "progressdialog.h"
22 #include <kprogressdialog.h>
23 #include "progressdialogadaptor.h"
25 ProgressDialog::ProgressDialog(QWidget
* parent
, const QString
& caption
, const QString
& text
, int totalSteps
)
26 : KProgressDialog(parent
, caption
, text
, false)
28 (void)new ProgressDialogAdaptor( this );
29 QDBusConnection::sessionBus().registerObject( QLatin1String("/ProgressDialog"), this );
30 setAutoClose( false );
31 progressBar()->setMaximum( totalSteps
);
32 showCancelButton( false );
33 Widgets::handleXGeometry(this);
36 void ProgressDialog::setMaximum( int totalSteps
)
38 progressBar()->setMaximum( totalSteps
);
39 if ( progressBar()->value()>=totalSteps
)
40 showCancelButton( false );
43 int ProgressDialog::maximum() const
45 return progressBar()->maximum();
48 void ProgressDialog::setValue( int progress
)
50 progressBar()->setValue( progress
);
51 if (progress
>=maximum() )
52 showCancelButton( false );
55 int ProgressDialog::value() const
57 return progressBar()->value();
60 void ProgressDialog::setLabelText(const QString
& label
)
62 KProgressDialog::setLabelText( label
);
65 void ProgressDialog::showCancelButton( bool show
)
67 setAllowCancel( false );
68 KProgressDialog::showCancelButton( show
);
71 bool ProgressDialog::wasCancelled() const
73 return KProgressDialog::wasCancelled();
76 void ProgressDialog::ignoreCancel()
78 KProgressDialog::ignoreCancel();
81 void ProgressDialog::setAutoClose( bool close
)
83 KProgressDialog::setAutoClose( close
);
86 bool ProgressDialog::autoClose() const
88 return KProgressDialog::autoClose();
91 void ProgressDialog::close()
93 slotButtonClicked(KDialog::Close
);
96 #include "progressdialog.moc"