-rw-r--r-- | kaddressbook/addresseeeditordialog.cpp | 5 | ||||
-rw-r--r-- | microkde/kdialogbase.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp index 6bc4129..d8c1aca 100644 --- a/kaddressbook/addresseeeditordialog.cpp +++ b/kaddressbook/addresseeeditordialog.cpp | |||
@@ -1,121 +1,122 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | 26 | ||
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | 30 | ||
31 | #include "addresseeeditorwidget.h" | 31 | #include "addresseeeditorwidget.h" |
32 | #include "kabcore.h" | 32 | #include "kabcore.h" |
33 | 33 | ||
34 | #include "addresseeeditordialog.h" | 34 | #include "addresseeeditordialog.h" |
35 | 35 | ||
36 | AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, | 36 | AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent, |
37 | const char *name ) | 37 | const char *name ) |
38 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), | 38 | : KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ), |
39 | KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, | 39 | KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply, |
40 | KDialogBase::Ok, parent, name, true ) | 40 | KDialogBase::Ok, parent, name, true ) |
41 | { | 41 | { |
42 | 42 | ||
43 | 43 | ||
44 | QWidget *page = plainPage(); | 44 | QWidget *page = plainPage(); |
45 | 45 | ||
46 | QVBoxLayout *layout = new QVBoxLayout( page ); | 46 | QVBoxLayout *layout = new QVBoxLayout( page ); |
47 | 47 | ||
48 | mEditorWidget = new AddresseeEditorWidget( core, false, page ); | 48 | mEditorWidget = new AddresseeEditorWidget( core, false, page ); |
49 | connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), | 49 | connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ), |
50 | SLOT( widgetModified() ) ); | 50 | SLOT( widgetModified() ) ); |
51 | layout->addWidget( mEditorWidget ); | 51 | layout->addWidget( mEditorWidget ); |
52 | 52 | ||
53 | enableButton( KDialogBase::Apply, false ); | 53 | enableButton( KDialogBase::Apply, false ); |
54 | if ( QApplication::desktop()->width() < 480 ) { | 54 | if ( QApplication::desktop()->width() < 480 ) { |
55 | hideButtons(); | 55 | hideButtons(); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | AddresseeEditorDialog::~AddresseeEditorDialog() | 59 | AddresseeEditorDialog::~AddresseeEditorDialog() |
60 | { | 60 | { |
61 | qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()"); | 61 | qDebug("AddresseeEditorDialog::~AddresseeEditorDialog()"); |
62 | //emit editorDestroyed( mEditorWidget->addressee().uid() ); | 62 | //emit editorDestroyed( mEditorWidget->addressee().uid() ); |
63 | } | 63 | } |
64 | 64 | ||
65 | void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) | 65 | void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr ) |
66 | { | 66 | { |
67 | enableButton( KDialogBase::Apply, false ); | 67 | enableButton( KDialogBase::Apply, false ); |
68 | 68 | ||
69 | mEditorWidget->setAddressee( addr ); | 69 | mEditorWidget->setAddressee( addr ); |
70 | } | 70 | } |
71 | 71 | ||
72 | KABC::Addressee AddresseeEditorDialog::addressee() | 72 | KABC::Addressee AddresseeEditorDialog::addressee() |
73 | { | 73 | { |
74 | return mEditorWidget->addressee(); | 74 | return mEditorWidget->addressee(); |
75 | } | 75 | } |
76 | 76 | ||
77 | bool AddresseeEditorDialog::dirty() | 77 | bool AddresseeEditorDialog::dirty() |
78 | { | 78 | { |
79 | return mEditorWidget->dirty(); | 79 | return mEditorWidget->dirty(); |
80 | } | 80 | } |
81 | 81 | ||
82 | void AddresseeEditorDialog::slotApply() | 82 | void AddresseeEditorDialog::slotApply() |
83 | { | 83 | { |
84 | if ( mEditorWidget->dirty() ) { | 84 | if ( mEditorWidget->dirty() ) { |
85 | mEditorWidget->save(); | 85 | mEditorWidget->save(); |
86 | emit contactModified( mEditorWidget->addressee() ); | 86 | emit contactModified( mEditorWidget->addressee() ); |
87 | } | 87 | } |
88 | 88 | ||
89 | enableButton( KDialogBase::Apply, false ); | 89 | enableButton( KDialogBase::Apply, false ); |
90 | 90 | ||
91 | KDialogBase::slotApply(); | 91 | KDialogBase::slotApply(); |
92 | } | 92 | } |
93 | 93 | ||
94 | void AddresseeEditorDialog:: accept () | 94 | void AddresseeEditorDialog:: accept () |
95 | { | 95 | { |
96 | slotOk(); | 96 | slotOk(); |
97 | 97 | ||
98 | } | 98 | } |
99 | void AddresseeEditorDialog::slotOk() | 99 | void AddresseeEditorDialog::slotOk() |
100 | { | 100 | { |
101 | slotApply(); | 101 | slotApply(); |
102 | 102 | ||
103 | KDialogBase::slotOk(); | 103 | //KDialogBase::slotOk(); |
104 | 104 | emit okClicked(); | |
105 | QDialog::accept(); | ||
105 | } | 106 | } |
106 | 107 | ||
107 | void AddresseeEditorDialog::widgetModified() | 108 | void AddresseeEditorDialog::widgetModified() |
108 | { | 109 | { |
109 | enableButton( KDialogBase::Apply, true ); | 110 | enableButton( KDialogBase::Apply, true ); |
110 | } | 111 | } |
111 | 112 | ||
112 | void AddresseeEditorDialog::slotCancel() | 113 | void AddresseeEditorDialog::slotCancel() |
113 | { | 114 | { |
114 | KDialogBase::slotCancel(); | 115 | KDialogBase::slotCancel(); |
115 | 116 | ||
116 | 117 | ||
117 | } | 118 | } |
118 | 119 | ||
119 | #ifndef KAB_EMBEDDED | 120 | #ifndef KAB_EMBEDDED |
120 | #include "addresseeeditordialog.moc" | 121 | #include "addresseeeditordialog.moc" |
121 | #endif //KAB_EMBEDDED | 122 | #endif //KAB_EMBEDDED |
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index 2251207..c953058 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -1,290 +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 ) { | 80 | if ( buttonMask & Default ) { |
81 | qDebug("buttonMask & Default "); | 81 | qDebug("buttonMask & Default "); |
82 | mDefaultButton = new QPushButton( i18n("Default"), this ); | 82 | mDefaultButton = new QPushButton( i18n("Default"), this ); |
83 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); | 83 | connect( mDefaultButton, SIGNAL( clicked() ), SIGNAL( defaultClicked() ) ); |
84 | } else { | 84 | } else { |
85 | mDefaultButton = 0; | 85 | mDefaultButton = 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | if ( buttonMask & Apply ) { | 88 | if ( buttonMask & Apply ) { |
89 | mApplyButton = new QPushButton( i18n("Apply"), this ); | 89 | mApplyButton = new QPushButton( i18n("Apply"), this ); |
90 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); | 90 | connect( mApplyButton, SIGNAL( clicked() ), SLOT( slotApply() ) ); |
91 | } else { | 91 | } else { |
92 | mApplyButton = 0; | 92 | mApplyButton = 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | if ( buttonMask & Cancel ) { | 95 | if ( buttonMask & Cancel ) { |
96 | mCancelButton = new QPushButton( i18n("Cancel"), this ); | 96 | mCancelButton = new QPushButton( i18n("Cancel"), this ); |
97 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); | 97 | connect( mCancelButton, SIGNAL( clicked() ), SLOT( slotCancel() ) ); |
98 | } else { | 98 | } else { |
99 | mCancelButton = 0; | 99 | mCancelButton = 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | if ( buttonMask & Close ) { | 102 | if ( buttonMask & Close ) { |
103 | mCloseButton = new QPushButton( i18n("Close"), this ); | 103 | mCloseButton = new QPushButton( i18n("Close"), this ); |
104 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); | 104 | connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) ); |
105 | } else { | 105 | } else { |
106 | mCloseButton = 0; | 106 | mCloseButton = 0; |
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | QTabWidget *KDialogBase::tabWidget() | 110 | QTabWidget *KDialogBase::tabWidget() |
111 | { | 111 | { |
112 | if ( !mTabWidget ) { | 112 | if ( !mTabWidget ) { |
113 | mTabWidget = new QTabWidget( this ); | 113 | mTabWidget = new QTabWidget( this ); |
114 | setMainWidget( mTabWidget ); | 114 | setMainWidget( mTabWidget ); |
115 | } | 115 | } |
116 | return mTabWidget; | 116 | return mTabWidget; |
117 | } | 117 | } |
118 | 118 | ||
119 | void KDialogBase::hideButtons() | 119 | void KDialogBase::hideButtons() |
120 | { | 120 | { |
121 | if ( mUser1Button ) mUser1Button->hide() ; | 121 | if ( mUser1Button ) mUser1Button->hide() ; |
122 | if ( mUser2Button ) mUser2Button->hide() ; | 122 | if ( mUser2Button ) mUser2Button->hide() ; |
123 | if ( mOkButton ) mOkButton->hide() ; | 123 | if ( mOkButton ) mOkButton->hide() ; |
124 | if ( mApplyButton ) mApplyButton->hide() ; | 124 | if ( mApplyButton ) mApplyButton->hide() ; |
125 | if ( mDefaultButton ) mDefaultButton->hide(); | 125 | if ( mDefaultButton ) mDefaultButton->hide(); |
126 | if ( mCancelButton ) mCancelButton->hide() ; | 126 | if ( mCancelButton ) mCancelButton->hide() ; |
127 | if ( mCloseButton ) mCloseButton->hide() ; | 127 | if ( mCloseButton ) mCloseButton->hide() ; |
128 | 128 | ||
129 | } | 129 | } |
130 | void KDialogBase::initLayout() | 130 | void KDialogBase::initLayout() |
131 | { | 131 | { |
132 | 132 | ||
133 | delete mTopLayout; | 133 | delete mTopLayout; |
134 | mTopLayout = new QVBoxLayout( this ); | 134 | mTopLayout = new QVBoxLayout( this ); |
135 | mTopLayout->setMargin( marginHint() ); | 135 | mTopLayout->setMargin( marginHint() ); |
136 | mTopLayout->setSpacing( spacingHint() ); | 136 | mTopLayout->setSpacing( spacingHint() ); |
137 | 137 | ||
138 | mTopLayout->addWidget( mMainWidget ); | 138 | mTopLayout->addWidget( mMainWidget ); |
139 | 139 | ||
140 | QBoxLayout *buttonLayout = new QHBoxLayout; | 140 | QBoxLayout *buttonLayout = new QHBoxLayout; |
141 | mTopLayout->addLayout( buttonLayout ); | 141 | mTopLayout->addLayout( buttonLayout ); |
142 | 142 | ||
143 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); | 143 | if ( mUser1Button ) buttonLayout->addWidget( mUser1Button ); |
144 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); | 144 | if ( mUser2Button ) buttonLayout->addWidget( mUser2Button ); |
145 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); | 145 | if ( mOkButton ) buttonLayout->addWidget( mOkButton ); |
146 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); | 146 | if ( mApplyButton ) buttonLayout->addWidget( mApplyButton ); |
147 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); | 147 | if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton ); |
148 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); | 148 | if ( mCancelButton ) buttonLayout->addWidget( mCancelButton ); |
149 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); | 149 | if ( mCloseButton ) buttonLayout->addWidget( mCloseButton ); |
150 | } | 150 | } |
151 | 151 | ||
152 | QFrame *KDialogBase::addPage( const QString &name ) | 152 | QFrame *KDialogBase::addPage( const QString &name ) |
153 | { | 153 | { |
154 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; | 154 | // kdDebug() << "KDialogBase::addPage(): " << name << endl; |
155 | QFrame *frame = new QFrame( tabWidget() ); | 155 | QFrame *frame = new QFrame( tabWidget() ); |
156 | tabWidget()->addTab( frame, name ); | 156 | tabWidget()->addTab( frame, name ); |
157 | return frame; | 157 | return frame; |
158 | } | 158 | } |
159 | 159 | ||
160 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 160 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
161 | { | 161 | { |
162 | return addPage( name ); | 162 | return addPage( name ); |
163 | } | 163 | } |
164 | 164 | ||
165 | 165 | ||
166 | void KDialogBase::setMainWidget( QWidget *widget ) | 166 | void KDialogBase::setMainWidget( QWidget *widget ) |
167 | { | 167 | { |
168 | kdDebug() << "KDialogBase::setMainWidget()" << endl; | 168 | kdDebug() << "KDialogBase::setMainWidget()" << endl; |
169 | 169 | ||
170 | mMainWidget = widget; | 170 | mMainWidget = widget; |
171 | initLayout(); | 171 | initLayout(); |
172 | } | 172 | } |
173 | 173 | ||
174 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) | 174 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) |
175 | { | 175 | { |
176 | QPushButton *button = findButton( id ); | 176 | QPushButton *button = findButton( id ); |
177 | if ( button ) { | 177 | if ( button ) { |
178 | button->setText( text ); | 178 | button->setText( text ); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | void KDialogBase::enableButton( ButtonCode id, bool state ) | 182 | void KDialogBase::enableButton( ButtonCode id, bool state ) |
183 | { | 183 | { |
184 | QPushButton *button = findButton( id ); | 184 | QPushButton *button = findButton( id ); |
185 | if ( button ) { | 185 | if ( button ) { |
186 | button->setEnabled( state ); | 186 | button->setEnabled( state ); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | QPushButton *KDialogBase::findButton( ButtonCode id ) | 190 | QPushButton *KDialogBase::findButton( ButtonCode id ) |
191 | { | 191 | { |
192 | QPushButton *button = 0; | 192 | QPushButton *button = 0; |
193 | switch ( id ) { | 193 | switch ( id ) { |
194 | case Ok: | 194 | case Ok: |
195 | button = mOkButton; | 195 | button = mOkButton; |
196 | break; | 196 | break; |
197 | case Apply: | 197 | case Apply: |
198 | button = mApplyButton; | 198 | button = mApplyButton; |
199 | break; | 199 | break; |
200 | case User1: | 200 | case User1: |
201 | button = mUser1Button; | 201 | button = mUser1Button; |
202 | break; | 202 | break; |
203 | case User2: | 203 | case User2: |
204 | button = mUser2Button; | 204 | button = mUser2Button; |
205 | break; | 205 | break; |
206 | case Cancel: | 206 | case Cancel: |
207 | button = mCancelButton; | 207 | button = mCancelButton; |
208 | break; | 208 | break; |
209 | case Default: | 209 | case Default: |
210 | button = mDefaultButton; | 210 | button = mDefaultButton; |
211 | break; | 211 | break; |
212 | case Close: | 212 | case Close: |
213 | button = mCloseButton; | 213 | button = mCloseButton; |
214 | break; | 214 | break; |
215 | default: | 215 | default: |
216 | break; | 216 | break; |
217 | } | 217 | } |
218 | return button; | 218 | return button; |
219 | } | 219 | } |
220 | 220 | ||
221 | void KDialogBase::enableButtonOK( bool state ) | 221 | void KDialogBase::enableButtonOK( bool state ) |
222 | { | 222 | { |
223 | enableButton( Ok, state ); | 223 | enableButton( Ok, state ); |
224 | } | 224 | } |
225 | 225 | ||
226 | void KDialogBase::enableButtonApply( bool state ) | 226 | void KDialogBase::enableButtonApply( bool state ) |
227 | { | 227 | { |
228 | enableButton( Apply, state ); | 228 | enableButton( Apply, state ); |
229 | } | 229 | } |
230 | 230 | ||
231 | void KDialogBase::showButton( ButtonCode id, bool show ) | 231 | void KDialogBase::showButton( ButtonCode id, bool show ) |
232 | { | 232 | { |
233 | QPushButton *button = findButton( id ); | 233 | QPushButton *button = findButton( id ); |
234 | if ( button ) { | 234 | if ( button ) { |
235 | if ( show ) button->show(); | 235 | if ( show ) button->show(); |
236 | else button->hide(); | 236 | else button->hide(); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | int KDialogBase::pageIndex( QWidget *widget ) const | 240 | int KDialogBase::pageIndex( QWidget *widget ) const |
241 | { | 241 | { |
242 | return 0; | 242 | return 0; |
243 | } | 243 | } |
244 | 244 | ||
245 | 245 | ||
246 | bool KDialogBase::showPage( int index ) | 246 | bool KDialogBase::showPage( int index ) |
247 | { | 247 | { |
248 | tabWidget()->setCurrentPage( index );return false; | 248 | tabWidget()->setCurrentPage( index );return false; |
249 | } | 249 | } |
250 | 250 | ||
251 | QFrame *KDialogBase::plainPage() | 251 | QFrame *KDialogBase::plainPage() |
252 | { | 252 | { |
253 | if ( !mPlainPage ) { | 253 | if ( !mPlainPage ) { |
254 | mPlainPage = new QFrame( this ); | 254 | mPlainPage = new QFrame( this ); |
255 | setMainWidget( mPlainPage ); | 255 | setMainWidget( mPlainPage ); |
256 | } | 256 | } |
257 | return mPlainPage; | 257 | return mPlainPage; |
258 | } | 258 | } |
259 | 259 | ||
260 | void KDialogBase::slotOk() | 260 | void KDialogBase::slotOk() |
261 | { | 261 | { |
262 | emit okClicked(); | 262 | emit okClicked(); |
263 | QDialog::accept(); | 263 | accept(); |
264 | } | 264 | } |
265 | 265 | ||
266 | void KDialogBase::slotApply() | 266 | void KDialogBase::slotApply() |
267 | { | 267 | { |
268 | emit applyClicked(); | 268 | emit applyClicked(); |
269 | } | 269 | } |
270 | 270 | ||
271 | void KDialogBase::slotCancel() | 271 | void KDialogBase::slotCancel() |
272 | { | 272 | { |
273 | emit cancelClicked(); | 273 | emit cancelClicked(); |
274 | reject(); | 274 | reject(); |
275 | } | 275 | } |
276 | 276 | ||
277 | void KDialogBase::slotClose() | 277 | void KDialogBase::slotClose() |
278 | { | 278 | { |
279 | emit closeClicked(); | 279 | emit closeClicked(); |
280 | reject(); | 280 | reject(); |
281 | } | 281 | } |
282 | 282 | ||
283 | void KDialogBase::slotUser1() | 283 | void KDialogBase::slotUser1() |
284 | { | 284 | { |
285 | emit user1Clicked(); | 285 | emit user1Clicked(); |
286 | } | 286 | } |
287 | void KDialogBase::slotUser2() | 287 | void KDialogBase::slotUser2() |
288 | { | 288 | { |
289 | emit user2Clicked(); | 289 | emit user2Clicked(); |
290 | } | 290 | } |