author | zautrix <zautrix> | 2005-07-09 01:22:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 01:22:50 (UTC) |
commit | 3c756588a4f650fc6f2e5971d56d56b74d67bfda (patch) (side-by-side diff) | |
tree | 8c62bc77c8248520ff3f0ecf508ab47550a1de74 /microkde | |
parent | 1e11d41ecb6a912c4c0a2747eb1fa26626fdcca2 (diff) | |
download | kdepimpi-3c756588a4f650fc6f2e5971d56d56b74d67bfda.zip kdepimpi-3c756588a4f650fc6f2e5971d56d56b74d67bfda.tar.gz kdepimpi-3c756588a4f650fc6f2e5971d56d56b74d67bfda.tar.bz2 |
comp fixes
-rw-r--r-- | microkde/kdialog.cpp | 48 | ||||
-rw-r--r-- | microkde/kdialog.h | 20 |
2 files changed, 67 insertions, 1 deletions
diff --git a/microkde/kdialog.cpp b/microkde/kdialog.cpp index 961631e..f9e0126 100644 --- a/microkde/kdialog.cpp +++ b/microkde/kdialog.cpp @@ -1,25 +1,71 @@ #include <kdialog.h> #include <qapp.h> - +#include <qlabel.h> +#include <qpushbutton.h> +#include <qlayout.h> +#include <qprogressbar.h> +#include <klocale.h> KDialog::KDialog( QWidget *parent, const char *name, bool modal ) : QDialog( parent, name, modal ) { ; } #ifdef DESKTOP_VERSION int KDialog::spacingHint() { return 7; } int KDialog::marginHint() { return 7; } int KDialog::spacingHintSmall() { return 4; } int KDialog::marginHintSmall() { return 4; } #else int KDialog::spacingHint() { return 3; } int KDialog::marginHint() { return 3; } int KDialog::spacingHintSmall() { return 1; } int KDialog::marginHintSmall() { return 1; } #endif +KProgressDialog::KProgressDialog( QWidget *parent, const char *name, bool modal ) : + QDialog( parent, name, modal ) +{ + QVBoxLayout* lay= new QVBoxLayout ( this ); + mLabel = new QLabel ( "abc",this ); + mBar = new QProgressBar ( this ); + mButton = new QPushButton ( i18n("Cancel"),this ); + lay->addWidget ( mLabel ); + lay->addWidget ( mBar ); + lay->addWidget ( mButton ); + connect ( mButton , SIGNAL ( clicked () ), this, SIGNAL ( cancelled () )); + resize ( 220, sizeHint().height() +mLabel->sizeHint().height()); + +} + +void KProgressDialog::setLabelText ( const QString & t) +{ + mLabel->setText( t ); +} + +void KProgressDialog::setTotalSteps ( int totalSteps ) +{ + setActiveWindow(); + setFocus(); + mBar->setTotalSteps ( totalSteps ); +} +void KProgressDialog::setProgress ( int progress ) +{ + setActiveWindow(); + setFocus(); + mBar->setProgress ( progress ); +} +void KProgressDialog::accept() +{ + + // QDialog::accept(); +} +void KProgressDialog::reject() +{ + emit cancelled (); + //QDialog::reject(); +} diff --git a/microkde/kdialog.h b/microkde/kdialog.h index 703d268..bc80689 100644 --- a/microkde/kdialog.h +++ b/microkde/kdialog.h @@ -1,18 +1,38 @@ #ifndef MINIKDE_KDIALOG_H #define MINIKDE_KDIALOG_H #include <qdialog.h> +class QLabel; +class QProgressBar; +class QPushButton ; class KDialog : public QDialog { Q_OBJECT public: KDialog( QWidget *parent=0, const char *name=0, bool modal=true ); static int spacingHint(); static int marginHint(); static int spacingHintSmall(); static int marginHintSmall(); }; +class KProgressDialog : public QDialog +{ + Q_OBJECT + public: + KProgressDialog( QWidget *parent=0, const char *name=0, bool modal=false ); + void setLabelText ( const QString & ); + void setTotalSteps ( int totalSteps ); + void setProgress ( int progress ); + void accept(); + void reject(); + private: + QLabel * mLabel; + QProgressBar *mBar; + QPushButton *mButton; + signals: + void cancelled (); +}; #endif |