-rw-r--r-- | microkde/kdialogbase.cpp | 12 | ||||
-rw-r--r-- | microkde/kdialogbase.h | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 2ea2053..c953058 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -1,278 +1,290 @@ | |||
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 | 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 | ||
46 | KDialogBase::~KDialogBase() | 46 | KDialogBase::~KDialogBase() |
47 | { | 47 | { |
48 | } | 48 | } |
49 | 49 | ||
50 | void KDialogBase::init( const QString &caption, int buttonMask, | 50 | void KDialogBase::init( const QString &caption, int buttonMask, |
51 | const QString &user1 ,const QString &user2 ) | 51 | const QString &user1 ,const QString &user2 ) |
52 | { | 52 | { |
53 | mMainWidget = 0; | 53 | mMainWidget = 0; |
54 | mTabWidget = 0; | 54 | mTabWidget = 0; |
55 | mPlainPage = 0; | 55 | mPlainPage = 0; |
56 | mTopLayout = 0; | 56 | mTopLayout = 0; |
57 | if ( !caption.isEmpty() ) { | 57 | if ( !caption.isEmpty() ) { |
58 | setCaption( caption ); | 58 | setCaption( caption ); |
59 | } | 59 | } |
60 | 60 | ||
61 | if ( buttonMask & User1 ) { | 61 | if ( buttonMask & User1 ) { |
62 | mUser1Button = new QPushButton( user1, this ); | 62 | mUser1Button = new QPushButton( user1, this ); |
63 | connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) ); | 63 | connect( mUser1Button, SIGNAL( clicked() ), SLOT( slotUser1() ) ); |
64 | } else { | 64 | } else { |
65 | mUser1Button = 0; | 65 | mUser1Button = 0; |
66 | } | 66 | } |
67 | if ( buttonMask & User2 ) { | 67 | if ( buttonMask & User2 ) { |
68 | mUser2Button = new QPushButton( user2, this ); | 68 | mUser2Button = new QPushButton( user2, this ); |
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 ) { | ||
81 | qDebug("buttonMask & Default "); | ||
82 | mDefaultButton = new QPushButton( i18n("Default"), this ); | ||
83 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); | ||
84 | } else { | ||
85 | mDefaultButton = 0; | ||
86 | } | ||
80 | 87 | ||
81 | if ( buttonMask & Apply ) { | 88 | if ( buttonMask & Apply ) { |
82 | mApplyButton = new QPushButton( i18n("Apply"), this ); | 89 | mApplyButton = new QPushButton( i18n("Apply"), this ); |
83 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); | 90 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); |
84 | } else { | 91 | } else { |
85 | mApplyButton = 0; | 92 | mApplyButton = 0; |
86 | } | 93 | } |
87 | 94 | ||
88 | if ( buttonMask & Cancel ) { | 95 | if ( buttonMask & Cancel ) { |
89 | mCancelButton = new QPushButton( i18n("Cancel"), this ); | 96 | mCancelButton = new QPushButton( i18n("Cancel"), this ); |
90 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); | 97 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); |
91 | } else { | 98 | } else { |
92 | mCancelButton = 0; | 99 | mCancelButton = 0; |
93 | } | 100 | } |
94 | 101 | ||
95 | if ( buttonMask & Close ) { | 102 | if ( buttonMask & Close ) { |
96 | mCloseButton = new QPushButton( i18n("Close"), this ); | 103 | mCloseButton = new QPushButton( i18n("Close"), this ); |
97 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); | 104 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); |
98 | } else { | 105 | } else { |
99 | mCloseButton = 0; | 106 | mCloseButton = 0; |
100 | } | 107 | } |
101 | } | 108 | } |
102 | 109 | ||
103 | QTabWidget *KDialogBase::tabWidget() | 110 | QTabWidget *KDialogBase::tabWidget() |
104 | { | 111 | { |
105 | if ( !mTabWidget ) { | 112 | if ( !mTabWidget ) { |
106 | mTabWidget = new QTabWidget( this ); | 113 | mTabWidget = new QTabWidget( this ); |
107 | setMainWidget( mTabWidget ); | 114 | setMainWidget( mTabWidget ); |
108 | } | 115 | } |
109 | return mTabWidget; | 116 | return mTabWidget; |
110 | } | 117 | } |
111 | 118 | ||
112 | void KDialogBase::hideButtons() | 119 | void KDialogBase::hideButtons() |
113 | { | 120 | { |
114 | if ( mUser1Button ) mUser1Button->hide() ; | 121 | if ( mUser1Button ) mUser1Button->hide() ; |
115 | if ( mUser2Button ) mUser2Button->hide() ; | 122 | if ( mUser2Button ) mUser2Button->hide() ; |
116 | if ( mOkButton ) mOkButton->hide() ; | 123 | if ( mOkButton ) mOkButton->hide() ; |
117 | if ( mApplyButton ) mApplyButton->hide() ; | 124 | if ( mApplyButton ) mApplyButton->hide() ; |
125 | if ( mDefaultButton ) mDefaultButton->hide(); | ||
118 | if ( mCancelButton ) mCancelButton->hide() ; | 126 | if ( mCancelButton ) mCancelButton->hide() ; |
119 | if ( mCloseButton ) mCloseButton->hide() ; | 127 | if ( mCloseButton ) mCloseButton->hide() ; |
120 | 128 | ||
121 | } | 129 | } |
122 | void KDialogBase::initLayout() | 130 | void KDialogBase::initLayout() |
123 | { | 131 | { |
124 | 132 | ||
125 | delete mTopLayout; | 133 | delete mTopLayout; |
126 | mTopLayout = new QVBoxLayout( this ); | 134 | mTopLayout = new QVBoxLayout( this ); |
127 | mTopLayout->setMargin( marginHint() ); | 135 | mTopLayout->setMargin( marginHint() ); |
128 | mTopLayout->setSpacing( spacingHint() ); | 136 | mTopLayout->setSpacing( spacingHint() ); |
129 | 137 | ||
130 | mTopLayout->addWidget( mMainWidget ); | 138 | mTopLayout->addWidget( mMainWidget ); |
131 | 139 | ||
132 | QBoxLayout *buttonLayout = new QHBoxLayout; | 140 | QBoxLayout *buttonLayout = new QHBoxLayout; |
133 | mTopLayout->addLayout( buttonLayout ); | 141 | mTopLayout->addLayout( buttonLayout ); |
134 | 142 | ||
135 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); | 143 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); |
136 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); | 144 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); |
137 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); | 145 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); |
138 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); | 146 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); |
147 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); | ||
139 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); | 148 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); |
140 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); | 149 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); |
141 | } | 150 | } |
142 | 151 | ||
143 | QFrame *KDialogBase::addPage( const QString &name ) | 152 | QFrame *KDialogBase::addPage( const QString &name ) |
144 | { | 153 | { |
145 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; | 154 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; |
146 | QFrame *frame = new QFrame( tabWidget() ); | 155 | QFrame *frame = new QFrame( tabWidget() ); |
147 | tabWidget()->addTab( frame, name ); | 156 | tabWidget()->addTab( frame, name ); |
148 | return frame; | 157 | return frame; |
149 | } | 158 | } |
150 | 159 | ||
151 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 160 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
152 | { | 161 | { |
153 | return addPage( name ); | 162 | return addPage( name ); |
154 | } | 163 | } |
155 | 164 | ||
156 | 165 | ||
157 | void KDialogBase::setMainWidget( QWidget *widget ) | 166 | void KDialogBase::setMainWidget( QWidget *widget ) |
158 | { | 167 | { |
159 | kdDebug() << "KDialogBase::setMainWidget()" << endl; | 168 | kdDebug() << "KDialogBase::setMainWidget()" << endl; |
160 | 169 | ||
161 | mMainWidget = widget; | 170 | mMainWidget = widget; |
162 | initLayout(); | 171 | initLayout(); |
163 | } | 172 | } |
164 | 173 | ||
165 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) | 174 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) |
166 | { | 175 | { |
167 | QPushButton *button = findButton( id ); | 176 | QPushButton *button = findButton( id ); |
168 | if ( button ) { | 177 | if ( button ) { |
169 | button->setText( text ); | 178 | button->setText( text ); |
170 | } | 179 | } |
171 | } | 180 | } |
172 | 181 | ||
173 | void KDialogBase::enableButton( ButtonCode id, bool state ) | 182 | void KDialogBase::enableButton( ButtonCode id, bool state ) |
174 | { | 183 | { |
175 | QPushButton *button = findButton( id ); | 184 | QPushButton *button = findButton( id ); |
176 | if ( button ) { | 185 | if ( button ) { |
177 | button->setEnabled( state ); | 186 | button->setEnabled( state ); |
178 | } | 187 | } |
179 | } | 188 | } |
180 | 189 | ||
181 | QPushButton *KDialogBase::findButton( ButtonCode id ) | 190 | QPushButton *KDialogBase::findButton( ButtonCode id ) |
182 | { | 191 | { |
183 | QPushButton *button = 0; | 192 | QPushButton *button = 0; |
184 | switch ( id ) { | 193 | switch ( id ) { |
185 | case Ok: | 194 | case Ok: |
186 | button = mOkButton; | 195 | button = mOkButton; |
187 | break; | 196 | break; |
188 | case Apply: | 197 | case Apply: |
189 | button = mApplyButton; | 198 | button = mApplyButton; |
190 | break; | 199 | break; |
191 | case User1: | 200 | case User1: |
192 | button = mUser1Button; | 201 | button = mUser1Button; |
193 | break; | 202 | break; |
194 | case User2: | 203 | case User2: |
195 | button = mUser2Button; | 204 | button = mUser2Button; |
196 | break; | 205 | break; |
197 | case Cancel: | 206 | case Cancel: |
198 | button = mCancelButton; | 207 | button = mCancelButton; |
208 | break; | ||
209 | case Default: | ||
210 | button = mDefaultButton; | ||
199 | break; | 211 | break; |
200 | case Close: | 212 | case Close: |
201 | button = mCloseButton; | 213 | button = mCloseButton; |
202 | break; | 214 | break; |
203 | default: | 215 | default: |
204 | break; | 216 | break; |
205 | } | 217 | } |
206 | return button; | 218 | return button; |
207 | } | 219 | } |
208 | 220 | ||
209 | void KDialogBase::enableButtonOK( bool state ) | 221 | void KDialogBase::enableButtonOK( bool state ) |
210 | { | 222 | { |
211 | enableButton( Ok, state ); | 223 | enableButton( Ok, state ); |
212 | } | 224 | } |
213 | 225 | ||
214 | void KDialogBase::enableButtonApply( bool state ) | 226 | void KDialogBase::enableButtonApply( bool state ) |
215 | { | 227 | { |
216 | enableButton( Apply, state ); | 228 | enableButton( Apply, state ); |
217 | } | 229 | } |
218 | 230 | ||
219 | void KDialogBase::showButton( ButtonCode id, bool show ) | 231 | void KDialogBase::showButton( ButtonCode id, bool show ) |
220 | { | 232 | { |
221 | QPushButton *button = findButton( id ); | 233 | QPushButton *button = findButton( id ); |
222 | if ( button ) { | 234 | if ( button ) { |
223 | if ( show ) button->show(); | 235 | if ( show ) button->show(); |
224 | else button->hide(); | 236 | else button->hide(); |
225 | } | 237 | } |
226 | } | 238 | } |
227 | 239 | ||
228 | int KDialogBase::pageIndex( QWidget *widget ) const | 240 | int KDialogBase::pageIndex( QWidget *widget ) const |
229 | { | 241 | { |
230 | return 0; | 242 | return 0; |
231 | } | 243 | } |
232 | 244 | ||
233 | 245 | ||
234 | bool KDialogBase::showPage( int index ) | 246 | bool KDialogBase::showPage( int index ) |
235 | { | 247 | { |
236 | tabWidget()->setCurrentPage( index );return false; | 248 | tabWidget()->setCurrentPage( index );return false; |
237 | } | 249 | } |
238 | 250 | ||
239 | QFrame *KDialogBase::plainPage() | 251 | QFrame *KDialogBase::plainPage() |
240 | { | 252 | { |
241 | if ( !mPlainPage ) { | 253 | if ( !mPlainPage ) { |
242 | mPlainPage = new QFrame( this ); | 254 | mPlainPage = new QFrame( this ); |
243 | setMainWidget( mPlainPage ); | 255 | setMainWidget( mPlainPage ); |
244 | } | 256 | } |
245 | return mPlainPage; | 257 | return mPlainPage; |
246 | } | 258 | } |
247 | 259 | ||
248 | void KDialogBase::slotOk() | 260 | void KDialogBase::slotOk() |
249 | { | 261 | { |
250 | emit okClicked(); | 262 | emit okClicked(); |
251 | accept(); | 263 | accept(); |
252 | } | 264 | } |
253 | 265 | ||
254 | void KDialogBase::slotApply() | 266 | void KDialogBase::slotApply() |
255 | { | 267 | { |
256 | emit applyClicked(); | 268 | emit applyClicked(); |
257 | } | 269 | } |
258 | 270 | ||
259 | void KDialogBase::slotCancel() | 271 | void KDialogBase::slotCancel() |
260 | { | 272 | { |
261 | emit cancelClicked(); | 273 | emit cancelClicked(); |
262 | reject(); | 274 | reject(); |
263 | } | 275 | } |
264 | 276 | ||
265 | void KDialogBase::slotClose() | 277 | void KDialogBase::slotClose() |
266 | { | 278 | { |
267 | emit closeClicked(); | 279 | emit closeClicked(); |
268 | reject(); | 280 | reject(); |
269 | } | 281 | } |
270 | 282 | ||
271 | void KDialogBase::slotUser1() | 283 | void KDialogBase::slotUser1() |
272 | { | 284 | { |
273 | emit user1Clicked(); | 285 | emit user1Clicked(); |
274 | } | 286 | } |
275 | void KDialogBase::slotUser2() | 287 | void KDialogBase::slotUser2() |
276 | { | 288 | { |
277 | emit user2Clicked(); | 289 | emit user2Clicked(); |
278 | } | 290 | } |
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h index 199d2fa..7b44bfb 100644 --- a/microkde/kdialogbase.h +++ b/microkde/kdialogbase.h | |||
@@ -12,128 +12,130 @@ 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 | 109 | ||
109 | protected slots: | 110 | protected slots: |
110 | virtual void slotOk(); | 111 | virtual void slotOk(); |
111 | virtual void slotApply(); | 112 | virtual void slotApply(); |
112 | virtual void slotCancel(); | 113 | virtual void slotCancel(); |
113 | virtual void slotClose(); | 114 | virtual void slotClose(); |
114 | virtual void slotUser1(); | 115 | virtual void slotUser1(); |
115 | virtual void slotUser2(); | 116 | virtual void slotUser2(); |
116 | 117 | ||
117 | protected: | 118 | protected: |
118 | QPushButton *findButton( ButtonCode ); | 119 | QPushButton *findButton( ButtonCode ); |
119 | 120 | ||
120 | private: | 121 | private: |
121 | QTabWidget *tabWidget(); | 122 | QTabWidget *tabWidget(); |
122 | void init( const QString &caption, int buttonMask, | 123 | void init( const QString &caption, int buttonMask, |
123 | const QString &user1=QString::null, const QString &user2=QString::null ); | 124 | const QString &user1=QString::null, const QString &user2=QString::null ); |
124 | void initLayout(); | 125 | void initLayout(); |
125 | 126 | ||
126 | QWidget *mMainWidget; | 127 | QWidget *mMainWidget; |
127 | QTabWidget *mTabWidget; | 128 | QTabWidget *mTabWidget; |
128 | QFrame *mPlainPage; | 129 | QFrame *mPlainPage; |
129 | QBoxLayout *mTopLayout; | 130 | QBoxLayout *mTopLayout; |
130 | 131 | ||
131 | QPushButton *mUser1Button; | 132 | QPushButton *mUser1Button; |
132 | QPushButton *mUser2Button; | 133 | QPushButton *mUser2Button; |
133 | QPushButton *mCloseButton; | 134 | QPushButton *mCloseButton; |
134 | QPushButton *mOkButton; | 135 | QPushButton *mOkButton; |
135 | QPushButton *mApplyButton; | 136 | QPushButton *mApplyButton; |
136 | QPushButton *mCancelButton; | 137 | QPushButton *mCancelButton; |
138 | QPushButton *mDefaultButton; | ||
137 | }; | 139 | }; |
138 | 140 | ||
139 | #endif | 141 | #endif |