-rw-r--r-- | microkde/kdialogbase.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index c953058..d1f7630 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -7,39 +7,39 @@ | |||
7 | #include "klocale.h" | 7 | #include "klocale.h" |
8 | #include "kdebug.h" | 8 | #include "kdebug.h" |
9 | 9 | ||
10 | #include "kdialogbase.h" | 10 | #include "kdialogbase.h" |
11 | 11 | ||
12 | KDialogBase::KDialogBase() | 12 | KDialogBase::KDialogBase() |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, | 16 | KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal, |
17 | const QString &caption, | 17 | const QString &caption, |
18 | int buttonMask, ButtonCode defaultButton, | 18 | int buttonMask, ButtonCode defaultButton, |
19 | bool separator, | 19 | bool separator, |
20 | const QString &user1, | 20 | const QString &user1, |
21 | const QString &user2, | 21 | const QString &user2, |
22 | const QString &user3) : | 22 | const QString &user3) : |
23 | KDialog( parent, name, modal ) | 23 | KDialog( parent, name, modal ) |
24 | { | 24 | { |
25 | init( caption, buttonMask, user1, user2 ); | 25 | init( caption, buttonMask, user1, user2 ); |
26 | if (findButton( defaultButton ) ) | 26 | if (findButton( defaultButton ) ) |
27 | (findButton( defaultButton ) )->setFocus(); | 27 | (findButton( defaultButton ) )->setFocus(); |
28 | 28 | ||
29 | } | 29 | } |
30 | 30 | ||
31 | KDialogBase::KDialogBase( int dialogFace, const QString &caption, | 31 | KDialogBase::KDialogBase( int dialogFace, const QString &caption, |
32 | int buttonMask, ButtonCode defaultButton, | 32 | int buttonMask, ButtonCode defaultButton, |
33 | QWidget *parent, const char *name, bool modal, | 33 | QWidget *parent, const char *name, bool modal, |
34 | bool separator, | 34 | bool separator, |
35 | const QString &user1, | 35 | const QString &user1, |
36 | const QString &user2, | 36 | const QString &user2, |
37 | const QString &user3) : | 37 | const QString &user3) : |
38 | KDialog( parent, name, modal ) | 38 | KDialog( parent, name, modal ) |
39 | { | 39 | { |
40 | init( caption, buttonMask, user1, user2 ); | 40 | init( caption, buttonMask, user1, user2 ); |
41 | if (findButton( defaultButton ) ) | 41 | if (findButton( defaultButton ) ) |
42 | (findButton( defaultButton ) )->setFocus(); | 42 | (findButton( defaultButton ) )->setFocus(); |
43 | 43 | ||
44 | } | 44 | } |
45 | 45 | ||
@@ -69,25 +69,24 @@ void KDialogBase::init( const QString &caption, int buttonMask, | |||
69 | connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); | 69 | connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); |
70 | } else { | 70 | } else { |
71 | mUser2Button = 0; | 71 | mUser2Button = 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | if ( buttonMask & Ok ) { | 74 | if ( buttonMask & Ok ) { |
75 | mOkButton = new QPushButton( i18n("Ok"), this ); | 75 | mOkButton = new QPushButton( i18n("Ok"), this ); |
76 | connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); | 76 | connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); |
77 | } else { | 77 | } else { |
78 | mOkButton = 0; | 78 | mOkButton = 0; |
79 | } | 79 | } |
80 | if ( buttonMask & Default ) { | 80 | if ( buttonMask & Default ) { |
81 | qDebug("buttonMask & Default "); | ||
82 | mDefaultButton = new QPushButton( i18n("Default"), this ); | 81 | mDefaultButton = new QPushButton( i18n("Default"), this ); |
83 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); | 82 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); |
84 | } else { | 83 | } else { |
85 | mDefaultButton = 0; | 84 | mDefaultButton = 0; |
86 | } | 85 | } |
87 | 86 | ||
88 | if ( buttonMask & Apply ) { | 87 | if ( buttonMask & Apply ) { |
89 | mApplyButton = new QPushButton( i18n("Apply"), this ); | 88 | mApplyButton = new QPushButton( i18n("Apply"), this ); |
90 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); | 89 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); |
91 | } else { | 90 | } else { |
92 | mApplyButton = 0; | 91 | mApplyButton = 0; |
93 | } | 92 | } |
@@ -95,60 +94,60 @@ void KDialogBase::init( const QString &caption, int buttonMask, | |||
95 | if ( buttonMask & Cancel ) { | 94 | if ( buttonMask & Cancel ) { |
96 | mCancelButton = new QPushButton( i18n("Cancel"), this ); | 95 | mCancelButton = new QPushButton( i18n("Cancel"), this ); |
97 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); | 96 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); |
98 | } else { | 97 | } else { |
99 | mCancelButton = 0; | 98 | mCancelButton = 0; |
100 | } | 99 | } |
101 | 100 | ||
102 | if ( buttonMask & Close ) { | 101 | if ( buttonMask & Close ) { |
103 | mCloseButton = new QPushButton( i18n("Close"), this ); | 102 | mCloseButton = new QPushButton( i18n("Close"), this ); |
104 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); | 103 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); |
105 | } else { | 104 | } else { |
106 | mCloseButton = 0; | 105 | mCloseButton = 0; |
107 | } | 106 | } |
108 | } | 107 | } |
109 | 108 | ||
110 | QTabWidget *KDialogBase::tabWidget() | 109 | QTabWidget *KDialogBase::tabWidget() |
111 | { | 110 | { |
112 | if ( !mTabWidget ) { | 111 | if ( !mTabWidget ) { |
113 | mTabWidget = new QTabWidget( this ); | 112 | mTabWidget = new QTabWidget( this ); |
114 | setMainWidget( mTabWidget ); | 113 | setMainWidget( mTabWidget ); |
115 | } | 114 | } |
116 | return mTabWidget; | 115 | return mTabWidget; |
117 | } | 116 | } |
118 | 117 | ||
119 | void KDialogBase::hideButtons() | 118 | void KDialogBase::hideButtons() |
120 | { | 119 | { |
121 | if ( mUser1Button ) mUser1Button->hide() ; | 120 | if ( mUser1Button ) mUser1Button->hide() ; |
122 | if ( mUser2Button ) mUser2Button->hide() ; | 121 | if ( mUser2Button ) mUser2Button->hide() ; |
123 | if ( mOkButton ) mOkButton->hide() ; | 122 | if ( mOkButton ) mOkButton->hide() ; |
124 | if ( mApplyButton ) mApplyButton->hide() ; | 123 | if ( mApplyButton ) mApplyButton->hide() ; |
125 | if ( mDefaultButton ) mDefaultButton->hide(); | 124 | if ( mDefaultButton ) mDefaultButton->hide(); |
126 | if ( mCancelButton ) mCancelButton->hide() ; | 125 | if ( mCancelButton ) mCancelButton->hide() ; |
127 | if ( mCloseButton ) mCloseButton->hide() ; | 126 | if ( mCloseButton ) mCloseButton->hide() ; |
128 | 127 | ||
129 | } | 128 | } |
130 | void KDialogBase::initLayout() | 129 | void KDialogBase::initLayout() |
131 | { | 130 | { |
132 | 131 | ||
133 | delete mTopLayout; | 132 | delete mTopLayout; |
134 | mTopLayout = new QVBoxLayout( this ); | 133 | mTopLayout = new QVBoxLayout( this ); |
135 | mTopLayout->setMargin( marginHint() ); | 134 | mTopLayout->setMargin( marginHint() ); |
136 | mTopLayout->setSpacing( spacingHint() ); | 135 | mTopLayout->setSpacing( spacingHint() ); |
137 | 136 | ||
138 | mTopLayout->addWidget( mMainWidget ); | 137 | mTopLayout->addWidget( mMainWidget ); |
139 | 138 | ||
140 | QBoxLayout *buttonLayout = new QHBoxLayout; | 139 | QBoxLayout *buttonLayout = new QHBoxLayout; |
141 | mTopLayout->addLayout( buttonLayout ); | 140 | mTopLayout->addLayout( buttonLayout ); |
142 | 141 | ||
143 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); | 142 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); |
144 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); | 143 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); |
145 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); | 144 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); |
146 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); | 145 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); |
147 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); | 146 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); |
148 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); | 147 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); |
149 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); | 148 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); |
150 | } | 149 | } |
151 | 150 | ||
152 | QFrame *KDialogBase::addPage( const QString &name ) | 151 | QFrame *KDialogBase::addPage( const QString &name ) |
153 | { | 152 | { |
154 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; | 153 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; |
@@ -196,33 +195,33 @@ QPushButton *KDialogBase::findButton( ButtonCode id ) | |||
196 | break; | 195 | break; |
197 | case Apply: | 196 | case Apply: |
198 | button = mApplyButton; | 197 | button = mApplyButton; |
199 | break; | 198 | break; |
200 | case User1: | 199 | case User1: |
201 | button = mUser1Button; | 200 | button = mUser1Button; |
202 | break; | 201 | break; |
203 | case User2: | 202 | case User2: |
204 | button = mUser2Button; | 203 | button = mUser2Button; |
205 | break; | 204 | break; |
206 | case Cancel: | 205 | case Cancel: |
207 | button = mCancelButton; | 206 | button = mCancelButton; |
208 | break; | 207 | break; |
209 | case Default: | 208 | case Default: |
210 | button = mDefaultButton; | 209 | button = mDefaultButton; |
211 | break; | 210 | break; |
212 | case Close: | 211 | case Close: |
213 | button = mCloseButton; | 212 | button = mCloseButton; |
214 | break; | 213 | break; |
215 | default: | 214 | default: |
216 | break; | 215 | break; |
217 | } | 216 | } |
218 | return button; | 217 | return button; |
219 | } | 218 | } |
220 | 219 | ||
221 | void KDialogBase::enableButtonOK( bool state ) | 220 | void KDialogBase::enableButtonOK( bool state ) |
222 | { | 221 | { |
223 | enableButton( Ok, state ); | 222 | enableButton( Ok, state ); |
224 | } | 223 | } |
225 | 224 | ||
226 | void KDialogBase::enableButtonApply( bool state ) | 225 | void KDialogBase::enableButtonApply( bool state ) |
227 | { | 226 | { |
228 | enableButton( Apply, state ); | 227 | enableButton( Apply, state ); |