author | ulf69 <ulf69> | 2004-08-05 22:50:37 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-05 22:50:37 (UTC) |
commit | c807547c32dd25e9d181d396590af9915b7a1166 (patch) (unidiff) | |
tree | 0950df8ef9653ab30e2faebf67bdd254e0ec1b8a /microkde | |
parent | bb1dd236b41cbd5cc4aed3b320801aa07974122d (diff) | |
download | kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.zip kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.tar.gz kdepimpi-c807547c32dd25e9d181d396590af9915b7a1166.tar.bz2 |
enabled the sending of emails to selected contacts, and mailing of vCards
-rw-r--r-- | microkde/kdialogbase.cpp | 25 | ||||
-rw-r--r-- | microkde/kutils/kcmultidialog.cpp | 23 |
2 files changed, 25 insertions, 23 deletions
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp index c953058..d1f7630 100644 --- a/microkde/kdialogbase.cpp +++ b/microkde/kdialogbase.cpp | |||
@@ -1,290 +1,289 @@ | |||
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 "); | ||
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 | } |
94 | 93 | ||
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; |
155 | QFrame *frame = new QFrame( tabWidget() ); | 154 | QFrame *frame = new QFrame( tabWidget() ); |
156 | tabWidget()->addTab( frame, name ); | 155 | tabWidget()->addTab( frame, name ); |
157 | return frame; | 156 | return frame; |
158 | } | 157 | } |
159 | 158 | ||
160 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) | 159 | QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & ) |
161 | { | 160 | { |
162 | return addPage( name ); | 161 | return addPage( name ); |
163 | } | 162 | } |
164 | 163 | ||
165 | 164 | ||
166 | void KDialogBase::setMainWidget( QWidget *widget ) | 165 | void KDialogBase::setMainWidget( QWidget *widget ) |
167 | { | 166 | { |
168 | kdDebug() << "KDialogBase::setMainWidget()" << endl; | 167 | kdDebug() << "KDialogBase::setMainWidget()" << endl; |
169 | 168 | ||
170 | mMainWidget = widget; | 169 | mMainWidget = widget; |
171 | initLayout(); | 170 | initLayout(); |
172 | } | 171 | } |
173 | 172 | ||
174 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) | 173 | void KDialogBase::setButtonText( ButtonCode id, const QString &text ) |
175 | { | 174 | { |
176 | QPushButton *button = findButton( id ); | 175 | QPushButton *button = findButton( id ); |
177 | if ( button ) { | 176 | if ( button ) { |
178 | button->setText( text ); | 177 | button->setText( text ); |
179 | } | 178 | } |
180 | } | 179 | } |
181 | 180 | ||
182 | void KDialogBase::enableButton( ButtonCode id, bool state ) | 181 | void KDialogBase::enableButton( ButtonCode id, bool state ) |
183 | { | 182 | { |
184 | QPushButton *button = findButton( id ); | 183 | QPushButton *button = findButton( id ); |
185 | if ( button ) { | 184 | if ( button ) { |
186 | button->setEnabled( state ); | 185 | button->setEnabled( state ); |
187 | } | 186 | } |
188 | } | 187 | } |
189 | 188 | ||
190 | QPushButton *KDialogBase::findButton( ButtonCode id ) | 189 | QPushButton *KDialogBase::findButton( ButtonCode id ) |
191 | { | 190 | { |
192 | QPushButton *button = 0; | 191 | QPushButton *button = 0; |
193 | switch ( id ) { | 192 | switch ( id ) { |
194 | case Ok: | 193 | case Ok: |
195 | button = mOkButton; | 194 | button = mOkButton; |
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 ); |
229 | } | 228 | } |
230 | 229 | ||
231 | void KDialogBase::showButton( ButtonCode id, bool show ) | 230 | void KDialogBase::showButton( ButtonCode id, bool show ) |
232 | { | 231 | { |
233 | QPushButton *button = findButton( id ); | 232 | QPushButton *button = findButton( id ); |
234 | if ( button ) { | 233 | if ( button ) { |
235 | if ( show ) button->show(); | 234 | if ( show ) button->show(); |
236 | else button->hide(); | 235 | else button->hide(); |
237 | } | 236 | } |
238 | } | 237 | } |
239 | 238 | ||
240 | int KDialogBase::pageIndex( QWidget *widget ) const | 239 | int KDialogBase::pageIndex( QWidget *widget ) const |
241 | { | 240 | { |
242 | return 0; | 241 | return 0; |
243 | } | 242 | } |
244 | 243 | ||
245 | 244 | ||
246 | bool KDialogBase::showPage( int index ) | 245 | bool KDialogBase::showPage( int index ) |
247 | { | 246 | { |
248 | tabWidget()->setCurrentPage( index );return false; | 247 | tabWidget()->setCurrentPage( index );return false; |
249 | } | 248 | } |
250 | 249 | ||
251 | QFrame *KDialogBase::plainPage() | 250 | QFrame *KDialogBase::plainPage() |
252 | { | 251 | { |
253 | if ( !mPlainPage ) { | 252 | if ( !mPlainPage ) { |
254 | mPlainPage = new QFrame( this ); | 253 | mPlainPage = new QFrame( this ); |
255 | setMainWidget( mPlainPage ); | 254 | setMainWidget( mPlainPage ); |
256 | } | 255 | } |
257 | return mPlainPage; | 256 | return mPlainPage; |
258 | } | 257 | } |
259 | 258 | ||
260 | void KDialogBase::slotOk() | 259 | void KDialogBase::slotOk() |
261 | { | 260 | { |
262 | emit okClicked(); | 261 | emit okClicked(); |
263 | accept(); | 262 | accept(); |
264 | } | 263 | } |
265 | 264 | ||
266 | void KDialogBase::slotApply() | 265 | void KDialogBase::slotApply() |
267 | { | 266 | { |
268 | emit applyClicked(); | 267 | emit applyClicked(); |
269 | } | 268 | } |
270 | 269 | ||
271 | void KDialogBase::slotCancel() | 270 | void KDialogBase::slotCancel() |
272 | { | 271 | { |
273 | emit cancelClicked(); | 272 | emit cancelClicked(); |
274 | reject(); | 273 | reject(); |
275 | } | 274 | } |
276 | 275 | ||
277 | void KDialogBase::slotClose() | 276 | void KDialogBase::slotClose() |
278 | { | 277 | { |
279 | emit closeClicked(); | 278 | emit closeClicked(); |
280 | reject(); | 279 | reject(); |
281 | } | 280 | } |
282 | 281 | ||
283 | void KDialogBase::slotUser1() | 282 | void KDialogBase::slotUser1() |
284 | { | 283 | { |
285 | emit user1Clicked(); | 284 | emit user1Clicked(); |
286 | } | 285 | } |
287 | void KDialogBase::slotUser2() | 286 | void KDialogBase::slotUser2() |
288 | { | 287 | { |
289 | emit user2Clicked(); | 288 | emit user2Clicked(); |
290 | } | 289 | } |
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp index 4136622..13be2ce 100644 --- a/microkde/kutils/kcmultidialog.cpp +++ b/microkde/kutils/kcmultidialog.cpp | |||
@@ -1,201 +1,204 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (c) 2000 Matthias Elter <elter@kde.org> | 2 | Copyright (c) 2000 Matthias Elter <elter@kde.org> |
3 | Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> | 3 | Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | 26 | ||
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kglobal.h> | 28 | #include <kglobal.h> |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kmessagebox.h> | 31 | #include <kmessagebox.h> |
32 | //US #include <klibloader.h> | 32 | //US #include <klibloader.h> |
33 | #include <krun.h> | 33 | #include <krun.h> |
34 | #include <kprocess.h> | 34 | #include <kprocess.h> |
35 | 35 | ||
36 | #include "kcmultidialog.h" | 36 | #include "kcmultidialog.h" |
37 | //US #include "kcmultidialog.moc" | 37 | //US #include "kcmultidialog.moc" |
38 | //US #include "kcmoduleloader.h" | 38 | //US #include "kcmoduleloader.h" |
39 | 39 | ||
40 | KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) | 40 | KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) |
41 | : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, | 41 | : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, |
42 | parent, name, modal, true), d(0L) | 42 | parent, name, modal, true), d(0L) |
43 | { | 43 | { |
44 | enableButton(Apply, false); | 44 | enableButton(Apply, false); |
45 | //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); | 45 | //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); |
46 | |||
47 | connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); | ||
48 | |||
46 | _baseGroup = baseGroup; | 49 | _baseGroup = baseGroup; |
47 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); | 50 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); |
48 | setMainWidget(mMainWidget ); | 51 | setMainWidget(mMainWidget ); |
49 | #ifdef DESKTOP_VERSION | 52 | #ifdef DESKTOP_VERSION |
50 | resize(640,480); | 53 | resize(640,480); |
51 | #else | 54 | #else |
52 | resize(640,480); | 55 | resize(640,480); |
53 | setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); | 56 | setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); |
54 | //showMaximized(); | 57 | //showMaximized(); |
55 | #endif | 58 | #endif |
56 | 59 | ||
57 | } | 60 | } |
58 | 61 | ||
59 | KCMultiDialog::~KCMultiDialog() | 62 | KCMultiDialog::~KCMultiDialog() |
60 | { | 63 | { |
61 | //US moduleDict.setAutoDelete(true); | 64 | //US moduleDict.setAutoDelete(true); |
62 | } | 65 | } |
63 | 66 | ||
64 | void KCMultiDialog::slotDefault() | 67 | void KCMultiDialog::slotDefault() |
65 | { | 68 | { |
66 | 69 | ||
67 | int curPageIndex = mMainWidget->activePageIndex(); | 70 | int curPageIndex = mMainWidget->activePageIndex(); |
68 | 71 | ||
69 | QPtrListIterator<KCModule> it(modules); | 72 | QPtrListIterator<KCModule> it(modules); |
70 | for (; it.current(); ++it) | 73 | for (; it.current(); ++it) |
71 | { | 74 | { |
72 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) | 75 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) |
73 | { | 76 | { |
74 | (*it)->defaults(); | 77 | (*it)->defaults(); |
75 | clientChanged(true); | 78 | clientChanged(true); |
76 | return; | 79 | return; |
77 | } | 80 | } |
78 | } | 81 | } |
79 | 82 | ||
80 | } | 83 | } |
81 | 84 | ||
82 | void KCMultiDialog::slotApply() | 85 | void KCMultiDialog::slotApply() |
83 | { | 86 | { |
84 | qDebug("KCMultiDialog::slotApply clicked"); | 87 | qDebug("KCMultiDialog::slotApply clicked"); |
85 | 88 | ||
86 | QPtrListIterator<KCModule> it(modules); | 89 | QPtrListIterator<KCModule> it(modules); |
87 | for (; it.current(); ++it) | 90 | for (; it.current(); ++it) |
88 | (*it)->save(); | 91 | (*it)->save(); |
89 | clientChanged(false); | 92 | clientChanged(false); |
90 | 93 | ||
91 | emit applyClicked(); | 94 | emit applyClicked(); |
92 | 95 | ||
93 | } | 96 | } |
94 | 97 | ||
95 | 98 | ||
96 | void KCMultiDialog::slotOk() | 99 | void KCMultiDialog::slotOk() |
97 | { | 100 | { |
98 | qDebug("KCMultiDialog::slotOk clicked"); | 101 | qDebug("KCMultiDialog::slotOk clicked"); |
99 | 102 | ||
100 | QPtrListIterator<KCModule> it(modules); | 103 | QPtrListIterator<KCModule> it(modules); |
101 | for (; it.current(); ++it) | 104 | for (; it.current(); ++it) |
102 | (*it)->save(); | 105 | (*it)->save(); |
103 | accept(); | 106 | accept(); |
104 | 107 | ||
105 | emit okClicked(); | 108 | emit okClicked(); |
106 | } | 109 | } |
107 | 110 | ||
108 | void KCMultiDialog::slotHelp() | 111 | void KCMultiDialog::slotHelp() |
109 | { | 112 | { |
110 | /*US | 113 | /*US |
111 | KURL url( KURL("help:/"), _docPath ); | 114 | KURL url( KURL("help:/"), _docPath ); |
112 | 115 | ||
113 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { | 116 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { |
114 | KProcess process; | 117 | KProcess process; |
115 | process << "khelpcenter" | 118 | process << "khelpcenter" |
116 | << url.url(); | 119 | << url.url(); |
117 | process.start(KProcess::DontCare); | 120 | process.start(KProcess::DontCare); |
118 | process.detach(); | 121 | process.detach(); |
119 | } else { | 122 | } else { |
120 | new KRun(url); | 123 | new KRun(url); |
121 | } | 124 | } |
122 | */ | 125 | */ |
123 | } | 126 | } |
124 | 127 | ||
125 | void KCMultiDialog::clientChanged(bool state) | 128 | void KCMultiDialog::clientChanged(bool state) |
126 | { | 129 | { |
127 | enableButton(Apply, state); | 130 | enableButton(Apply, state); |
128 | } | 131 | } |
129 | 132 | ||
130 | /*US | 133 | /*US |
131 | void KCMultiDialog::addModule(const QString& path, bool withfallback) | 134 | void KCMultiDialog::addModule(const QString& path, bool withfallback) |
132 | { | 135 | { |
133 | kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; | 136 | kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; |
134 | 137 | ||
135 | KCModuleInfo info(path, _baseGroup); | 138 | KCModuleInfo info(path, _baseGroup); |
136 | 139 | ||
137 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), | 140 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), |
138 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); | 141 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); |
139 | if(!page) { | 142 | if(!page) { |
140 | KCModuleLoader::unloadModule(info); | 143 | KCModuleLoader::unloadModule(info); |
141 | return; | 144 | return; |
142 | } | 145 | } |
143 | moduleDict.insert(page, new LoadInfo(path, withfallback)); | 146 | moduleDict.insert(page, new LoadInfo(path, withfallback)); |
144 | if (modules.isEmpty()) | 147 | if (modules.isEmpty()) |
145 | slotAboutToShow(page); | 148 | slotAboutToShow(page); |
146 | } | 149 | } |
147 | */ | 150 | */ |
148 | QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) | 151 | QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) |
149 | { | 152 | { |
150 | QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); | 153 | QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); |
151 | return page; | 154 | return page; |
152 | 155 | ||
153 | } | 156 | } |
154 | //US special method for microkde. We dop noty want to load everything dynamically. | 157 | //US special method for microkde. We dop noty want to load everything dynamically. |
155 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) | 158 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) |
156 | { | 159 | { |
157 | 160 | ||
158 | modules.append(module); | 161 | modules.append(module); |
159 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); | 162 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); |
160 | 163 | ||
161 | 164 | ||
162 | } | 165 | } |
163 | 166 | ||
164 | void KCMultiDialog::slotAboutToShow(QWidget *page) | 167 | void KCMultiDialog::slotAboutToShow(QWidget *page) |
165 | { | 168 | { |
166 | /*US | 169 | /*US |
167 | LoadInfo *loadInfo = moduleDict[page]; | 170 | LoadInfo *loadInfo = moduleDict[page]; |
168 | if (!loadInfo) | 171 | if (!loadInfo) |
169 | return; | 172 | return; |
170 | 173 | ||
171 | QApplication::setOverrideCursor(Qt::WaitCursor); | 174 | QApplication::setOverrideCursor(Qt::WaitCursor); |
172 | 175 | ||
173 | moduleDict.remove(page); | 176 | moduleDict.remove(page); |
174 | 177 | ||
175 | KCModuleInfo info(loadInfo->path, _baseGroup); | 178 | KCModuleInfo info(loadInfo->path, _baseGroup); |
176 | 179 | ||
177 | KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); | 180 | KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); |
178 | 181 | ||
179 | if (!module) | 182 | if (!module) |
180 | { | 183 | { |
181 | QApplication::restoreOverrideCursor(); | 184 | QApplication::restoreOverrideCursor(); |
182 | KCModuleLoader::showLastLoaderError(this); | 185 | KCModuleLoader::showLastLoaderError(this); |
183 | delete loadInfo; | 186 | delete loadInfo; |
184 | return; | 187 | return; |
185 | } | 188 | } |
186 | 189 | ||
187 | module->reparent(page,0,QPoint(0,0),true); | 190 | module->reparent(page,0,QPoint(0,0),true); |
188 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); | 191 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); |
189 | //setHelp( docpath, QString::null ); | 192 | //setHelp( docpath, QString::null ); |
190 | _docPath = info.docPath(); | 193 | _docPath = info.docPath(); |
191 | modules.append(module); | 194 | modules.append(module); |
192 | 195 | ||
193 | //KCGlobal::repairAccels( topLevelWidget() ); | 196 | //KCGlobal::repairAccels( topLevelWidget() ); |
194 | 197 | ||
195 | delete loadInfo; | 198 | delete loadInfo; |
196 | 199 | ||
197 | QApplication::restoreOverrideCursor(); | 200 | QApplication::restoreOverrideCursor(); |
198 | */ | 201 | */ |
199 | 202 | ||
200 | qDebug("KCMultiDialog::slotAboutToShow not implemented"); | 203 | qDebug("KCMultiDialog::slotAboutToShow not implemented"); |
201 | } | 204 | } |