author | zautrix <zautrix> | 2005-06-10 11:53:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-10 11:53:12 (UTC) |
commit | d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc (patch) (unidiff) | |
tree | 0764371abfdb5d663ffebf408d47d49f0ca919f3 /microkde | |
parent | e5ca8e0d8d6d08b597253f43de401aa1a99a6abe (diff) | |
download | kdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.zip kdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.tar.gz kdepimpi-d2f00fc2034450bc9a3cd1d2c3510bef1758d3bc.tar.bz2 |
config dialog changes
-rw-r--r-- | microkde/kdialogbase.cpp | 5 | ||||
-rw-r--r-- | microkde/kdialogbase.h | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 11635e1..d5c7e61 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -1,296 +1,301 @@ | |||
1 | #include <qtabwidget.h> | 1 | #include <qtabwidget.h> |
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qframe.h> | 4 | #include <qframe.h> |
5 | 5 | ||
6 | 6 | ||
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 | (findButton( defaultButton ) )->setDefault( true ); | 28 | (findButton( defaultButton ) )->setDefault( true ); |
29 | } | 29 | } |
30 | 30 | ||
31 | } | 31 | } |
32 | 32 | ||
33 | KDialogBase::KDialogBase( int dialogFace, const QString &caption, | 33 | KDialogBase::KDialogBase( int dialogFace, const QString &caption, |
34 | int buttonMask, ButtonCode defaultButton, | 34 | int buttonMask, ButtonCode defaultButton, |
35 | QWidget *parent, const char *name, bool modal, | 35 | QWidget *parent, const char *name, bool modal, |
36 | bool separator, | 36 | bool separator, |
37 | const QString &user1, | 37 | const QString &user1, |
38 | const QString &user2, | 38 | const QString &user2, |
39 | const QString &user3) : | 39 | const QString &user3) : |
40 | KDialog( parent, name, modal ) | 40 | KDialog( parent, name, modal ) |
41 | { | 41 | { |
42 | init( caption, buttonMask, user1, user2 ); | 42 | init( caption, buttonMask, user1, user2 ); |
43 | if (findButton( defaultButton ) ) { | 43 | if (findButton( defaultButton ) ) { |
44 | (findButton( defaultButton ) )->setFocus(); | 44 | (findButton( defaultButton ) )->setFocus(); |
45 | (findButton( defaultButton ) )->setDefault( true ); | 45 | (findButton( defaultButton ) )->setDefault( true ); |
46 | } | 46 | } |
47 | 47 | ||
48 | } | 48 | } |
49 | 49 | ||
50 | KDialogBase::~KDialogBase() | 50 | KDialogBase::~KDialogBase() |
51 | { | 51 | { |
52 | } | 52 | } |
53 | 53 | ||
54 | void KDialogBase::init( const QString &caption, int buttonMask, | 54 | void KDialogBase::init( const QString &caption, int buttonMask, |
55 | const QString &user1 ,const QString &user2 ) | 55 | const QString &user1 ,const QString &user2 ) |
56 | { | 56 | { |
57 | mMainWidget = 0; | 57 | mMainWidget = 0; |
58 | mTabWidget = 0; | 58 | mTabWidget = 0; |
59 | mPlainPage = 0; | 59 | mPlainPage = 0; |
60 | mTopLayout = 0; | 60 | mTopLayout = 0; |
61 | if ( !caption.isEmpty() ) { | 61 | if ( !caption.isEmpty() ) { |
62 | setCaption( caption ); | 62 | setCaption( caption ); |
63 | } | 63 | } |
64 | 64 | ||
65 | if ( buttonMask & User1 ) { | 65 | if ( buttonMask & User1 ) { |
66 | mUser1Button = new QPushButton( user1, this ); | 66 | mUser1Button = new QPushButton( user1, this ); |
67 | connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) ); | 67 | connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) ); |
68 | } else { | 68 | } else { |
69 | mUser1Button = 0; | 69 | mUser1Button = 0; |
70 | } | 70 | } |
71 | if ( buttonMask & User2 ) { | 71 | if ( buttonMask & User2 ) { |
72 | mUser2Button = new QPushButton( user2, this ); | 72 | mUser2Button = new QPushButton( user2, this ); |
73 | connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); | 73 | connect( mUser2Button, SIGNAL( clicked() ), SLOT( slotUser2() ) ); |
74 | } else { | 74 | } else { |
75 | mUser2Button = 0; | 75 | mUser2Button = 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | if ( buttonMask & Ok ) { | 78 | if ( buttonMask & Ok ) { |
79 | mOkButton = new QPushButton( i18n("Ok"), this ); | 79 | mOkButton = new QPushButton( i18n("Ok"), this ); |
80 | connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); | 80 | connect( mOkButton, SIGNAL( clicked() ), SLOT( slotOk() ) ); |
81 | //mOkButton->setDefault( true ); | 81 | //mOkButton->setDefault( true ); |
82 | } else { | 82 | } else { |
83 | mOkButton = 0; | 83 | mOkButton = 0; |
84 | } | 84 | } |
85 | if ( buttonMask & Default ) { | 85 | if ( buttonMask & Default ) { |
86 | mDefaultButton = new QPushButton( i18n("Default"), this ); | 86 | mDefaultButton = new QPushButton( i18n("Default"), this ); |
87 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); | 87 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); |
88 | } else { | 88 | } else { |
89 | mDefaultButton = 0; | 89 | mDefaultButton = 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | if ( buttonMask & Apply ) { | 92 | if ( buttonMask & Apply ) { |
93 | mApplyButton = new QPushButton( i18n("Apply"), this ); | 93 | mApplyButton = new QPushButton( i18n("Apply"), this ); |
94 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); | 94 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); |
95 | } else { | 95 | } else { |
96 | mApplyButton = 0; | 96 | mApplyButton = 0; |
97 | } | 97 | } |
98 | 98 | ||
99 | if ( buttonMask & Cancel ) { | 99 | if ( buttonMask & Cancel ) { |
100 | mCancelButton = new QPushButton( i18n("Cancel"), this ); | 100 | mCancelButton = new QPushButton( i18n("Cancel"), this ); |
101 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); | 101 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); |
102 | } else { | 102 | } else { |
103 | mCancelButton = 0; | 103 | mCancelButton = 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | if ( buttonMask & Close ) { | 106 | if ( buttonMask & Close ) { |
107 | mCloseButton = new QPushButton( i18n("Close"), this ); | 107 | mCloseButton = new QPushButton( i18n("Close"), this ); |
108 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); | 108 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); |
109 | } else { | 109 | } else { |
110 | mCloseButton = 0; | 110 | mCloseButton = 0; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | QTabWidget *KDialogBase::tabWidget() | 114 | QTabWidget *KDialogBase::tabWidget() |
115 | { | 115 | { |
116 | if ( !mTabWidget ) { | 116 | if ( !mTabWidget ) { |
117 | mTabWidget = new QTabWidget( this ); | 117 | mTabWidget = new QTabWidget( this ); |
118 | setMainWidget( mTabWidget ); | 118 | setMainWidget( mTabWidget ); |
119 | } | 119 | } |
120 | return mTabWidget; | 120 | return mTabWidget; |
121 | } | 121 | } |
122 | 122 | ||
123 | void KDialogBase::hideButtons() | 123 | void KDialogBase::hideButtons() |
124 | { | 124 | { |
125 | if ( mUser1Button ) mUser1Button->hide() ; | 125 | if ( mUser1Button ) mUser1Button->hide() ; |
126 | if ( mUser2Button ) mUser2Button->hide() ; | 126 | if ( mUser2Button ) mUser2Button->hide() ; |
127 | if ( mOkButton ) mOkButton->hide() ; | 127 | if ( mOkButton ) mOkButton->hide() ; |
128 | if ( mApplyButton ) mApplyButton->hide() ; | 128 | if ( mApplyButton ) mApplyButton->hide() ; |
129 | if ( mDefaultButton ) mDefaultButton->hide(); | 129 | if ( mDefaultButton ) mDefaultButton->hide(); |
130 | if ( mCancelButton ) mCancelButton->hide() ; | 130 | if ( mCancelButton ) mCancelButton->hide() ; |
131 | if ( mCloseButton ) mCloseButton->hide() ; | 131 | if ( mCloseButton ) mCloseButton->hide() ; |
132 | 132 | ||
133 | } | 133 | } |
134 | void KDialogBase::initLayout() | 134 | void KDialogBase::initLayout() |
135 | { | 135 | { |
136 | 136 | ||
137 | delete mTopLayout; | 137 | delete mTopLayout; |
138 | mTopLayout = new QVBoxLayout( this ); | 138 | mTopLayout = new QVBoxLayout( this ); |
139 | mTopLayout->setMargin( marginHintSmall() ); | 139 | mTopLayout->setMargin( marginHintSmall() ); |
140 | mTopLayout->setSpacing( spacingHintSmall() ); | 140 | mTopLayout->setSpacing( spacingHintSmall() ); |
141 | 141 | ||
142 | mTopLayout->addWidget( mMainWidget ); | 142 | mTopLayout->addWidget( mMainWidget ); |
143 | 143 | ||
144 | QBoxLayout *buttonLayout = new QHBoxLayout; | 144 | QBoxLayout *buttonLayout = new QHBoxLayout; |
145 | mTopLayout->addLayout( buttonLayout ); | 145 | mTopLayout->addLayout( buttonLayout ); |
146 | 146 | ||
147 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); | 147 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); |
148 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); | 148 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); |
149 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); | 149 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); |
150 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); | 150 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); |
151 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); | 151 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); |
152 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); | 152 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); |
153 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); | 153 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); |
154 | buttonLayout->setMargin( marginHintSmall() ); | 154 | buttonLayout->setMargin( marginHintSmall() ); |
155 | buttonLayout->setSpacing( spacingHintSmall() ); | 155 | buttonLayout->setSpacing( spacingHintSmall() ); |
156 | } | 156 | } |
157 | 157 | ||
158 | QFrame *KDialogBase::addPage( const QString &name ) | 158 | QFrame *KDialogBase::addPage( const QString &name ) |
159 | { | 159 | { |
160 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; | 160 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; |
161 | QFrame *frame = new QFrame( tabWidget() ); | 161 | QFrame *frame = new QFrame( tabWidget() ); |
162 | tabWidget()->addTab( frame, name ); | 162 | tabWidget()->addTab( frame, name ); |
163 | return frame; | 163 | return frame; |
164 | } | 164 | } |
165 | 165 | ||
166 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 166 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
167 | { | 167 | { |
168 | return addPage( name ); | 168 | return addPage( name ); |
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | void KDialogBase::setMainWidget( QWidget *widget ) | 172 | void KDialogBase::setMainWidget( QWidget *widget ) |
173 | { | 173 | { |
174 | kdDebug() << "KDialogBase::setMainWidget()" << endl; | 174 | kdDebug() << "KDialogBase::setMainWidget()" << endl; |
175 | 175 | ||
176 | mMainWidget = widget; | 176 | mMainWidget = widget; |
177 | initLayout(); | 177 | initLayout(); |
178 | } | 178 | } |
179 | 179 | ||
180 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) | 180 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) |
181 | { | 181 | { |
182 | QPushButton *button = findButton( id ); | 182 | QPushButton *button = findButton( id ); |
183 | if ( button ) { | 183 | if ( button ) { |
184 | button->setText( text ); | 184 | button->setText( text ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void KDialogBase::enableButton( ButtonCode id, bool state ) | 188 | void KDialogBase::enableButton( ButtonCode id, bool state ) |
189 | { | 189 | { |
190 | QPushButton *button = findButton( id ); | 190 | QPushButton *button = findButton( id ); |
191 | if ( button ) { | 191 | if ( button ) { |
192 | button->setEnabled( state ); | 192 | button->setEnabled( state ); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | QPushButton *KDialogBase::findButton( ButtonCode id ) | 196 | QPushButton *KDialogBase::findButton( ButtonCode id ) |
197 | { | 197 | { |
198 | QPushButton *button = 0; | 198 | QPushButton *button = 0; |
199 | switch ( id ) { | 199 | switch ( id ) { |
200 | case Ok: | 200 | case Ok: |
201 | button = mOkButton; | 201 | button = mOkButton; |
202 | break; | 202 | break; |
203 | case Apply: | 203 | case Apply: |
204 | button = mApplyButton; | 204 | button = mApplyButton; |
205 | break; | 205 | break; |
206 | case User1: | 206 | case User1: |
207 | button = mUser1Button; | 207 | button = mUser1Button; |
208 | break; | 208 | break; |
209 | case User2: | 209 | case User2: |
210 | button = mUser2Button; | 210 | button = mUser2Button; |
211 | break; | 211 | break; |
212 | case Cancel: | 212 | case Cancel: |
213 | button = mCancelButton; | 213 | button = mCancelButton; |
214 | break; | 214 | break; |
215 | case Default: | 215 | case Default: |
216 | button = mDefaultButton; | 216 | button = mDefaultButton; |
217 | break; | 217 | break; |
218 | case Close: | 218 | case Close: |
219 | button = mCloseButton; | 219 | button = mCloseButton; |
220 | break; | 220 | break; |
221 | default: | 221 | default: |
222 | break; | 222 | break; |
223 | } | 223 | } |
224 | return button; | 224 | return button; |
225 | } | 225 | } |
226 | 226 | ||
227 | void KDialogBase::enableButtonOK( bool state ) | 227 | void KDialogBase::enableButtonOK( bool state ) |
228 | { | 228 | { |
229 | enableButton( Ok, state ); | 229 | enableButton( Ok, state ); |
230 | } | 230 | } |
231 | 231 | ||
232 | void KDialogBase::enableButtonApply( bool state ) | 232 | void KDialogBase::enableButtonApply( bool state ) |
233 | { | 233 | { |
234 | enableButton( Apply, state ); | 234 | enableButton( Apply, state ); |
235 | } | 235 | } |
236 | 236 | ||
237 | void KDialogBase::showButton( ButtonCode id, bool show ) | 237 | void KDialogBase::showButton( ButtonCode id, bool show ) |
238 | { | 238 | { |
239 | QPushButton *button = findButton( id ); | 239 | QPushButton *button = findButton( id ); |
240 | if ( button ) { | 240 | if ( button ) { |
241 | if ( show ) button->show(); | 241 | if ( show ) button->show(); |
242 | else button->hide(); | 242 | else button->hide(); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | int KDialogBase::pageIndex( QWidget *widget ) const | 246 | int KDialogBase::pageIndex( QWidget *widget ) const |
247 | { | 247 | { |
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | 251 | ||
252 | bool KDialogBase::showPage( int index ) | 252 | bool KDialogBase::showPage( int index ) |
253 | { | 253 | { |
254 | tabWidget()->setCurrentPage( index );return false; | 254 | tabWidget()->setCurrentPage( index );return false; |
255 | } | 255 | } |
256 | 256 | ||
257 | QFrame *KDialogBase::plainPage() | 257 | QFrame *KDialogBase::plainPage() |
258 | { | 258 | { |
259 | if ( !mPlainPage ) { | 259 | if ( !mPlainPage ) { |
260 | mPlainPage = new QFrame( this ); | 260 | mPlainPage = new QFrame( this ); |
261 | setMainWidget( mPlainPage ); | 261 | setMainWidget( mPlainPage ); |
262 | } | 262 | } |
263 | return mPlainPage; | 263 | return mPlainPage; |
264 | } | 264 | } |
265 | 265 | ||
266 | void KDialogBase::slotOk() | 266 | void KDialogBase::slotOk() |
267 | { | 267 | { |
268 | emit okClicked(); | 268 | emit okClicked(); |
269 | accept(); | 269 | accept(); |
270 | } | 270 | } |
271 | 271 | ||
272 | void KDialogBase::slotApply() | 272 | void KDialogBase::slotApply() |
273 | { | 273 | { |
274 | emit applyClicked(); | 274 | emit applyClicked(); |
275 | } | 275 | } |
276 | 276 | ||
277 | void KDialogBase::slotCancel() | 277 | void KDialogBase::slotCancel() |
278 | { | 278 | { |
279 | emit cancelClicked(); | 279 | emit cancelClicked(); |
280 | reject(); | 280 | reject(); |
281 | } | 281 | } |
282 | 282 | ||
283 | void KDialogBase::slotClose() | 283 | void KDialogBase::slotClose() |
284 | { | 284 | { |
285 | emit closeClicked(); | 285 | emit closeClicked(); |
286 | reject(); | 286 | reject(); |
287 | } | 287 | } |
288 | 288 | ||
289 | void KDialogBase::accept () | ||
290 | { | ||
291 | emit acceptClicked(); | ||
292 | KDialog::accept(); | ||
293 | } | ||
289 | void KDialogBase::slotUser1() | 294 | void KDialogBase::slotUser1() |
290 | { | 295 | { |
291 | emit user1Clicked(); | 296 | emit user1Clicked(); |
292 | } | 297 | } |
293 | void KDialogBase::slotUser2() | 298 | void KDialogBase::slotUser2() |
294 | { | 299 | { |
295 | emit user2Clicked(); | 300 | emit user2Clicked(); |
296 | } | 301 | } |
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index a2fc2dc..17c186b 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h | |||
@@ -1,141 +1,143 @@ | |||
1 | #ifndef MINIKDE_KDIALOGBASE_H | 1 | #ifndef MINIKDE_KDIALOGBASE_H |
2 | #define MINIKDE_KDIALOGBASE_H | 2 | #define MINIKDE_KDIALOGBASE_H |
3 | 3 | ||
4 | #include <qframe.h> | 4 | #include <qframe.h> |
5 | 5 | ||
6 | #include "kdialog.h" | 6 | #include "kdialog.h" |
7 | 7 | ||
8 | class QPushButton; | 8 | class QPushButton; |
9 | class QLayout; | 9 | class QLayout; |
10 | class QTabWidget; | 10 | class QTabWidget; |
11 | class QBoxLayout; | 11 | class QBoxLayout; |
12 | 12 | ||
13 | class KDialogBase : public KDialog | 13 | class KDialogBase : public KDialog |
14 | { | 14 | { |
15 | Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | enum ButtonCode | 17 | enum ButtonCode |
18 | { | 18 | { |
19 | Help = 0x00000001, | 19 | Help = 0x00000001, |
20 | Default = 0x00000002, | 20 | Default = 0x00000002, |
21 | Ok = 0x00000004, | 21 | Ok = 0x00000004, |
22 | Apply = 0x00000008, | 22 | Apply = 0x00000008, |
23 | Try = 0x00000010, | 23 | Try = 0x00000010, |
24 | Cancel = 0x00000020, | 24 | Cancel = 0x00000020, |
25 | Close = 0x00000040, | 25 | Close = 0x00000040, |
26 | User1 = 0x00000080, | 26 | User1 = 0x00000080, |
27 | User2 = 0x00000100, | 27 | User2 = 0x00000100, |
28 | User3 = 0x00000200, | 28 | User3 = 0x00000200, |
29 | No = 0x00000080, | 29 | No = 0x00000080, |
30 | Yes = 0x00000100, | 30 | Yes = 0x00000100, |
31 | Details = 0x00000400, | 31 | Details = 0x00000400, |
32 | Filler = 0x40000000, | 32 | Filler = 0x40000000, |
33 | Stretch = 0x80000000 | 33 | Stretch = 0x80000000 |
34 | }; | 34 | }; |
35 | 35 | ||
36 | enum DialogType | 36 | enum DialogType |
37 | { | 37 | { |
38 | TreeList, | 38 | TreeList, |
39 | Tabbed, | 39 | Tabbed, |
40 | Plain, | 40 | Plain, |
41 | Swallow, | 41 | Swallow, |
42 | IconList | 42 | IconList |
43 | }; | 43 | }; |
44 | 44 | ||
45 | KDialogBase(); | 45 | KDialogBase(); |
46 | KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, | 46 | KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true, |
47 | const QString &caption=QString::null, | 47 | const QString &caption=QString::null, |
48 | int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, | 48 | int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, |
49 | bool separator=false, | 49 | bool separator=false, |
50 | const QString &user1=QString::null, | 50 | const QString &user1=QString::null, |
51 | const QString &user2=QString::null, | 51 | const QString &user2=QString::null, |
52 | const QString &user3=QString::null); | 52 | const QString &user3=QString::null); |
53 | KDialogBase( int dialogFace, const QString &caption, | 53 | KDialogBase( int dialogFace, const QString &caption, |
54 | int buttonMask, ButtonCode defaultButton, | 54 | int buttonMask, ButtonCode defaultButton, |
55 | QWidget *parent=0, const char *name=0, bool modal=true, | 55 | QWidget *parent=0, const char *name=0, bool modal=true, |
56 | bool separator=false, | 56 | bool separator=false, |
57 | const QString &user1=QString::null, | 57 | const QString &user1=QString::null, |
58 | const QString &user2=QString::null, | 58 | const QString &user2=QString::null, |
59 | const QString &user3=QString::null); | 59 | const QString &user3=QString::null); |
60 | virtual ~KDialogBase(); | 60 | virtual ~KDialogBase(); |
61 | 61 | ||
62 | QFrame *addPage( const QString & ); | 62 | QFrame *addPage( const QString & ); |
63 | QFrame *addPage( const QString &, int, const QPixmap & ); | 63 | QFrame *addPage( const QString &, int, const QPixmap & ); |
64 | 64 | ||
65 | void setMainWidget( QWidget *widget ); | 65 | void setMainWidget( QWidget *widget ); |
66 | 66 | ||
67 | void setButtonText( ButtonCode id, const QString &text ); | 67 | void setButtonText( ButtonCode id, const QString &text ); |
68 | 68 | ||
69 | void enableButton( ButtonCode id, bool state ); | 69 | void enableButton( ButtonCode id, bool state ); |
70 | void enableButtonOK( bool state ); | 70 | void enableButtonOK( bool state ); |
71 | void enableButtonApply( bool state ); | 71 | void enableButtonApply( bool state ); |
72 | 72 | ||
73 | void showButton( ButtonCode, bool show ); | 73 | void showButton( ButtonCode, bool show ); |
74 | 74 | ||
75 | int pageIndex( QWidget *widget ) const; | 75 | int pageIndex( QWidget *widget ) const; |
76 | 76 | ||
77 | bool showPage( int index ); | 77 | bool showPage( int index ); |
78 | void hideButtons(); | 78 | void hideButtons(); |
79 | 79 | ||
80 | QFrame *plainPage(); | 80 | QFrame *plainPage(); |
81 | 81 | ||
82 | signals: | 82 | signals: |
83 | void user1Clicked(); | 83 | void user1Clicked(); |
84 | void user2Clicked(); | 84 | void user2Clicked(); |
85 | /** | 85 | /** |
86 | * The Apply button was pressed. This signal is only emitted if | 86 | * The Apply button was pressed. This signal is only emitted if |
87 | * @ref slotApply() is not replaced. | 87 | * @ref slotApply() is not replaced. |
88 | */ | 88 | */ |
89 | void applyClicked(); | 89 | void applyClicked(); |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * The OK button was pressed. This signal is only emitted if | 92 | * The OK button was pressed. This signal is only emitted if |
93 | * @ref slotOk() is not replaced. | 93 | * @ref slotOk() is not replaced. |
94 | */ | 94 | */ |
95 | void okClicked(); | 95 | void okClicked(); |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * The Cancel button was pressed. This signal is only emitted if | 98 | * The Cancel button was pressed. This signal is only emitted if |
99 | * @ref slotCancel() is not replaced. | 99 | * @ref slotCancel() is not replaced. |
100 | */ | 100 | */ |
101 | void cancelClicked(); | 101 | void cancelClicked(); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * The Close button was pressed. This signal is only emitted if | 104 | * The Close button was pressed. This signal is only emitted if |
105 | * @ref slotClose() is not replaced. | 105 | * @ref slotClose() is not replaced. |
106 | */ | 106 | */ |
107 | void closeClicked(); | 107 | void closeClicked(); |
108 | void defaultClicked(); | 108 | void defaultClicked(); |
109 | 109 | ||
110 | void acceptClicked(); | ||
111 | |||
110 | protected slots: | 112 | protected slots: |
111 | virtual void slotOk(); | 113 | virtual void slotOk(); |
112 | virtual void slotApply(); | 114 | virtual void slotApply(); |
113 | virtual void slotCancel(); | 115 | virtual void slotCancel(); |
114 | virtual void slotClose(); | 116 | virtual void slotClose(); |
115 | virtual void slotUser1(); | 117 | virtual void slotUser1(); |
116 | virtual void slotUser2(); | 118 | virtual void slotUser2(); |
117 | 119 | virtual void accept (); | |
118 | protected: | 120 | protected: |
119 | QPushButton *findButton( ButtonCode ); | 121 | QPushButton *findButton( ButtonCode ); |
120 | QTabWidget *tabWidget(); | 122 | QTabWidget *tabWidget(); |
121 | 123 | ||
122 | private: | 124 | private: |
123 | void init( const QString &caption, int buttonMask, | 125 | void init( const QString &caption, int buttonMask, |
124 | const QString &user1=QString::null, const QString &user2=QString::null ); | 126 | const QString &user1=QString::null, const QString &user2=QString::null ); |
125 | void initLayout(); | 127 | void initLayout(); |
126 | 128 | ||
127 | QWidget *mMainWidget; | 129 | QWidget *mMainWidget; |
128 | QTabWidget *mTabWidget; | 130 | QTabWidget *mTabWidget; |
129 | QFrame *mPlainPage; | 131 | QFrame *mPlainPage; |
130 | QBoxLayout *mTopLayout; | 132 | QBoxLayout *mTopLayout; |
131 | 133 | ||
132 | QPushButton *mUser1Button; | 134 | QPushButton *mUser1Button; |
133 | QPushButton *mUser2Button; | 135 | QPushButton *mUser2Button; |
134 | QPushButton *mCloseButton; | 136 | QPushButton *mCloseButton; |
135 | QPushButton *mOkButton; | 137 | QPushButton *mOkButton; |
136 | QPushButton *mApplyButton; | 138 | QPushButton *mApplyButton; |
137 | QPushButton *mCancelButton; | 139 | QPushButton *mCancelButton; |
138 | QPushButton *mDefaultButton; | 140 | QPushButton *mDefaultButton; |
139 | }; | 141 | }; |
140 | 142 | ||
141 | #endif | 143 | #endif |