summaryrefslogtreecommitdiffabout
path: root/microkde/kdialog.cpp
blob: 57e7ea62f16da069ba6001cb48f730d89ab4a0c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

#include <kdialog.h>
#include <qapplication.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <q3progressbar.h>
//Added by qt3to4:
#include <Q3VBoxLayout>
#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 ) 
{
    Q3VBoxLayout* lay= new Q3VBoxLayout ( this ); 
    mLabel = new QLabel ( "abc",this );
    mBar = new Q3ProgressBar ( 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()
{
    mLabel->setText( i18n("Eeek, there I am ticklish!") );
    move ( geometry().x()-20,geometry().y()+20);
    // QDialog::accept();
}
void KProgressDialog::reject()
{
    emit cancelled ();
    //QDialog::reject();
}