-rw-r--r-- | kaddressbook/kabcore.cpp | 10 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 6 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.h | 3 |
3 files changed, 15 insertions, 4 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 76f9ab6..15cab73 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -170,392 +170,396 @@ class KABCatPrefs : public QDialog | |||
170 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 170 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
171 | QDialog( parent, name, true ) | 171 | QDialog( parent, name, true ) |
172 | { | 172 | { |
173 | setCaption( i18n("Manage new Categories") ); | 173 | setCaption( i18n("Manage new Categories") ); |
174 | QVBoxLayout* lay = new QVBoxLayout( this ); | 174 | QVBoxLayout* lay = new QVBoxLayout( this ); |
175 | lay->setSpacing( 3 ); | 175 | lay->setSpacing( 3 ); |
176 | lay->setMargin( 3 ); | 176 | lay->setMargin( 3 ); |
177 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 177 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
178 | lay->addWidget( lab ); | 178 | lay->addWidget( lab ); |
179 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 179 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
180 | lay->addWidget( format ); | 180 | lay->addWidget( format ); |
181 | format->setExclusive ( true ) ; | 181 | format->setExclusive ( true ) ; |
182 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 182 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
183 | new QRadioButton(i18n("Remove from addressees"), format ); | 183 | new QRadioButton(i18n("Remove from addressees"), format ); |
184 | addCatBut->setChecked( true ); | 184 | addCatBut->setChecked( true ); |
185 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 185 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
186 | lay->addWidget( ok ); | 186 | lay->addWidget( ok ); |
187 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 187 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
188 | lay->addWidget( cancel ); | 188 | lay->addWidget( cancel ); |
189 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 189 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
190 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 190 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
191 | resize( 200, 200 ); | 191 | resize( 200, 200 ); |
192 | } | 192 | } |
193 | 193 | ||
194 | bool addCat() { return addCatBut->isChecked(); } | 194 | bool addCat() { return addCatBut->isChecked(); } |
195 | private: | 195 | private: |
196 | QRadioButton* addCatBut; | 196 | QRadioButton* addCatBut; |
197 | }; | 197 | }; |
198 | 198 | ||
199 | 199 | ||
200 | 200 | ||
201 | class KAex2phonePrefs : public QDialog | 201 | class KAex2phonePrefs : public QDialog |
202 | { | 202 | { |
203 | public: | 203 | public: |
204 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 204 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 205 | QDialog( parent, name, true ) |
206 | { | 206 | { |
207 | setCaption( i18n("Export to phone options") ); | 207 | setCaption( i18n("Export to phone options") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 208 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 209 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 210 | lay->setMargin( 3 ); |
211 | QLabel *lab; | 211 | QLabel *lab; |
212 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 212 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
213 | lab->setAlignment (AlignHCenter ); | 213 | lab->setAlignment (AlignHCenter ); |
214 | QHBox* temphb; | 214 | QHBox* temphb; |
215 | temphb = new QHBox( this ); | 215 | temphb = new QHBox( this ); |
216 | new QLabel( i18n("I/O device: "), temphb ); | 216 | new QLabel( i18n("I/O device: "), temphb ); |
217 | mPhoneDevice = new QLineEdit( temphb); | 217 | mPhoneDevice = new QLineEdit( temphb); |
218 | lay->addWidget( temphb ); | 218 | lay->addWidget( temphb ); |
219 | temphb = new QHBox( this ); | 219 | temphb = new QHBox( this ); |
220 | new QLabel( i18n("Connection: "), temphb ); | 220 | new QLabel( i18n("Connection: "), temphb ); |
221 | mPhoneConnection = new QLineEdit( temphb); | 221 | mPhoneConnection = new QLineEdit( temphb); |
222 | lay->addWidget( temphb ); | 222 | lay->addWidget( temphb ); |
223 | temphb = new QHBox( this ); | 223 | temphb = new QHBox( this ); |
224 | new QLabel( i18n("Model(opt.): "), temphb ); | 224 | new QLabel( i18n("Model(opt.): "), temphb ); |
225 | mPhoneModel = new QLineEdit( temphb); | 225 | mPhoneModel = new QLineEdit( temphb); |
226 | lay->addWidget( temphb ); | 226 | lay->addWidget( temphb ); |
227 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 227 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
228 | // lay->addWidget( mWriteToSim ); | 228 | // lay->addWidget( mWriteToSim ); |
229 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 229 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
230 | lab->setAlignment (AlignHCenter ); | 230 | lab->setAlignment (AlignHCenter ); |
231 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 231 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
232 | lay->addWidget( ok ); | 232 | lay->addWidget( ok ); |
233 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 233 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
234 | lay->addWidget( cancel ); | 234 | lay->addWidget( cancel ); |
235 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 235 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
237 | resize( 220, 240 ); | 237 | resize( 220, 240 ); |
238 | 238 | ||
239 | } | 239 | } |
240 | 240 | ||
241 | public: | 241 | public: |
242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
243 | QCheckBox* mWriteToSim; | 243 | QCheckBox* mWriteToSim; |
244 | }; | 244 | }; |
245 | 245 | ||
246 | 246 | ||
247 | bool pasteWithNewUid = true; | 247 | bool pasteWithNewUid = true; |
248 | 248 | ||
249 | #ifdef KAB_EMBEDDED | 249 | #ifdef KAB_EMBEDDED |
250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
254 | #else //KAB_EMBEDDED | 254 | #else //KAB_EMBEDDED |
255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
258 | mReadWrite( readWrite ), mModified( false ) | 258 | mReadWrite( readWrite ), mModified( false ) |
259 | #endif //KAB_EMBEDDED | 259 | #endif //KAB_EMBEDDED |
260 | { | 260 | { |
261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
262 | // syncManager->setBlockSave(false); | 262 | // syncManager->setBlockSave(false); |
263 | mMiniSplitter = 0; | 263 | mMiniSplitter = 0; |
264 | mExtensionBarSplitter = 0; | 264 | mExtensionBarSplitter = 0; |
265 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 265 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
266 | mAddressBook = KABC::StdAddressBook::self(); | 266 | mAddressBook = KABC::StdAddressBook::self(); |
267 | KABC::StdAddressBook::setAutomaticSave( false ); | 267 | KABC::StdAddressBook::setAutomaticSave( false ); |
268 | 268 | ||
269 | #ifndef KAB_EMBEDDED | 269 | #ifndef KAB_EMBEDDED |
270 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 270 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
271 | #endif //KAB_EMBEDDED | 271 | #endif //KAB_EMBEDDED |
272 | 272 | ||
273 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 273 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
274 | SLOT( addressBookChanged() ) ); | 274 | SLOT( addressBookChanged() ) ); |
275 | 275 | ||
276 | #if 0 | 276 | #if 0 |
277 | // LP moved to addressbook init method | 277 | // LP moved to addressbook init method |
278 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 278 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
279 | "X-Department", "KADDRESSBOOK" ); | 279 | "X-Department", "KADDRESSBOOK" ); |
280 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 280 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
281 | "X-Profession", "KADDRESSBOOK" ); | 281 | "X-Profession", "KADDRESSBOOK" ); |
282 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 282 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
283 | "X-AssistantsName", "KADDRESSBOOK" ); | 283 | "X-AssistantsName", "KADDRESSBOOK" ); |
284 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 284 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
285 | "X-ManagersName", "KADDRESSBOOK" ); | 285 | "X-ManagersName", "KADDRESSBOOK" ); |
286 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 286 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
287 | "X-SpousesName", "KADDRESSBOOK" ); | 287 | "X-SpousesName", "KADDRESSBOOK" ); |
288 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 288 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
289 | "X-Office", "KADDRESSBOOK" ); | 289 | "X-Office", "KADDRESSBOOK" ); |
290 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 290 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
291 | "X-IMAddress", "KADDRESSBOOK" ); | 291 | "X-IMAddress", "KADDRESSBOOK" ); |
292 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 292 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
293 | "X-Anniversary", "KADDRESSBOOK" ); | 293 | "X-Anniversary", "KADDRESSBOOK" ); |
294 | 294 | ||
295 | //US added this field to become compatible with Opie/qtopia addressbook | 295 | //US added this field to become compatible with Opie/qtopia addressbook |
296 | // values can be "female" or "male" or "". An empty field represents undefined. | 296 | // values can be "female" or "male" or "". An empty field represents undefined. |
297 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 297 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
298 | "X-Gender", "KADDRESSBOOK" ); | 298 | "X-Gender", "KADDRESSBOOK" ); |
299 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 299 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
300 | "X-Children", "KADDRESSBOOK" ); | 300 | "X-Children", "KADDRESSBOOK" ); |
301 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 301 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
302 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 302 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
303 | #endif | 303 | #endif |
304 | initGUI(); | 304 | initGUI(); |
305 | 305 | ||
306 | mIncSearchWidget->setFocus(); | 306 | mIncSearchWidget->setFocus(); |
307 | 307 | ||
308 | 308 | ||
309 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 309 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
310 | SLOT( setContactSelected( const QString& ) ) ); | 310 | SLOT( setContactSelected( const QString& ) ) ); |
311 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 311 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
312 | SLOT( executeContact( const QString& ) ) ); | 312 | SLOT( executeContact( const QString& ) ) ); |
313 | 313 | ||
314 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 314 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
315 | SLOT( deleteContacts( ) ) ); | 315 | SLOT( deleteContacts( ) ) ); |
316 | connect( mViewManager, SIGNAL( modified() ), | 316 | connect( mViewManager, SIGNAL( modified() ), |
317 | SLOT( setModified() ) ); | 317 | SLOT( setModified() ) ); |
318 | 318 | ||
319 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 319 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
320 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 320 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
321 | 321 | ||
322 | connect( mXXPortManager, SIGNAL( modified() ), | 322 | connect( mXXPortManager, SIGNAL( modified() ), |
323 | SLOT( setModified() ) ); | 323 | SLOT( setModified() ) ); |
324 | 324 | ||
325 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 325 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
326 | SLOT( incrementalSearch( const QString& ) ) ); | 326 | SLOT( incrementalSearch( const QString& ) ) ); |
327 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 327 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
328 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 328 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
329 | 329 | ||
330 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 330 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
331 | SLOT( sendMail( const QString& ) ) ); | 331 | SLOT( sendMail( const QString& ) ) ); |
332 | 332 | ||
333 | 333 | ||
334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
335 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 335 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
336 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 336 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
337 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 337 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
338 | 338 | ||
339 | 339 | ||
340 | #ifndef KAB_EMBEDDED | 340 | #ifndef KAB_EMBEDDED |
341 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 341 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
342 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 342 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
343 | 343 | ||
344 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 344 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
345 | SLOT( browse( const QString& ) ) ); | 345 | SLOT( browse( const QString& ) ) ); |
346 | 346 | ||
347 | 347 | ||
348 | mAddressBookService = new KAddressBookService( this ); | 348 | mAddressBookService = new KAddressBookService( this ); |
349 | 349 | ||
350 | #endif //KAB_EMBEDDED | 350 | #endif //KAB_EMBEDDED |
351 | 351 | ||
352 | mMessageTimer = new QTimer( this ); | 352 | mMessageTimer = new QTimer( this ); |
353 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 353 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
354 | mEditorDialog = 0; | 354 | mEditorDialog = 0; |
355 | createAddresseeEditorDialog( this ); | 355 | createAddresseeEditorDialog( this ); |
356 | setModified( false ); | 356 | setModified( false ); |
357 | mBRdisabled = false; | 357 | mBRdisabled = false; |
358 | #ifndef DESKTOP_VERSION | 358 | #ifndef DESKTOP_VERSION |
359 | infrared = 0; | 359 | infrared = 0; |
360 | #endif | 360 | #endif |
361 | //toggleBeamReceive( ); | 361 | //toggleBeamReceive( ); |
362 | 362 | //mMainWindow->toolBar()->show(); | |
363 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 363 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
364 | QTimer::singleShot( 10000, this , SLOT ( updateToolBar())); | 364 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
365 | } | 365 | } |
366 | 366 | ||
367 | void KABCore::updateToolBar() | 367 | void KABCore::updateToolBar() |
368 | { | 368 | { |
369 | mMainWindow->toolBar()->update(); | 369 | static int iii = 0; |
370 | ++iii; | ||
371 | mMainWindow->toolBar()->repaintMe(); | ||
372 | if ( iii < 5 ) | ||
373 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | ||
370 | } | 374 | } |
371 | KABCore::~KABCore() | 375 | KABCore::~KABCore() |
372 | { | 376 | { |
373 | // save(); | 377 | // save(); |
374 | //saveSettings(); | 378 | //saveSettings(); |
375 | //KABPrefs::instance()->writeConfig(); | 379 | //KABPrefs::instance()->writeConfig(); |
376 | delete AddresseeConfig::instance(); | 380 | delete AddresseeConfig::instance(); |
377 | mAddressBook = 0; | 381 | mAddressBook = 0; |
378 | KABC::StdAddressBook::close(); | 382 | KABC::StdAddressBook::close(); |
379 | 383 | ||
380 | delete syncManager; | 384 | delete syncManager; |
381 | #ifndef DESKTOP_VERSION | 385 | #ifndef DESKTOP_VERSION |
382 | if ( infrared ) | 386 | if ( infrared ) |
383 | delete infrared; | 387 | delete infrared; |
384 | #endif | 388 | #endif |
385 | } | 389 | } |
386 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 390 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
387 | { | 391 | { |
388 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 392 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
389 | if ( cmsg == "setDocument(QString)" ) { | 393 | if ( cmsg == "setDocument(QString)" ) { |
390 | QDataStream stream( data, IO_ReadOnly ); | 394 | QDataStream stream( data, IO_ReadOnly ); |
391 | QString fileName; | 395 | QString fileName; |
392 | stream >> fileName; | 396 | stream >> fileName; |
393 | recieve( fileName ); | 397 | recieve( fileName ); |
394 | return; | 398 | return; |
395 | } | 399 | } |
396 | } | 400 | } |
397 | void KABCore::toggleBeamReceive( ) | 401 | void KABCore::toggleBeamReceive( ) |
398 | { | 402 | { |
399 | if ( mBRdisabled ) | 403 | if ( mBRdisabled ) |
400 | return; | 404 | return; |
401 | #ifndef DESKTOP_VERSION | 405 | #ifndef DESKTOP_VERSION |
402 | if ( infrared ) { | 406 | if ( infrared ) { |
403 | qDebug("AB disable BeamReceive "); | 407 | qDebug("AB disable BeamReceive "); |
404 | delete infrared; | 408 | delete infrared; |
405 | infrared = 0; | 409 | infrared = 0; |
406 | mActionBR->setChecked(false); | 410 | mActionBR->setChecked(false); |
407 | return; | 411 | return; |
408 | } | 412 | } |
409 | qDebug("AB enable BeamReceive "); | 413 | qDebug("AB enable BeamReceive "); |
410 | mActionBR->setChecked(true); | 414 | mActionBR->setChecked(true); |
411 | 415 | ||
412 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 416 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
413 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 417 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
414 | #endif | 418 | #endif |
415 | } | 419 | } |
416 | 420 | ||
417 | 421 | ||
418 | void KABCore::disableBR(bool b) | 422 | void KABCore::disableBR(bool b) |
419 | { | 423 | { |
420 | #ifndef DESKTOP_VERSION | 424 | #ifndef DESKTOP_VERSION |
421 | if ( b ) { | 425 | if ( b ) { |
422 | if ( infrared ) { | 426 | if ( infrared ) { |
423 | toggleBeamReceive( ); | 427 | toggleBeamReceive( ); |
424 | } | 428 | } |
425 | mBRdisabled = true; | 429 | mBRdisabled = true; |
426 | } else { | 430 | } else { |
427 | if ( mBRdisabled ) { | 431 | if ( mBRdisabled ) { |
428 | mBRdisabled = false; | 432 | mBRdisabled = false; |
429 | //toggleBeamReceive( ); | 433 | //toggleBeamReceive( ); |
430 | } | 434 | } |
431 | } | 435 | } |
432 | #endif | 436 | #endif |
433 | 437 | ||
434 | } | 438 | } |
435 | void KABCore::recieve( QString fn ) | 439 | void KABCore::recieve( QString fn ) |
436 | { | 440 | { |
437 | //qDebug("KABCore::recieve "); | 441 | //qDebug("KABCore::recieve "); |
438 | int count = mAddressBook->importFromFile( fn, true ); | 442 | int count = mAddressBook->importFromFile( fn, true ); |
439 | if ( count ) | 443 | if ( count ) |
440 | setModified( true ); | 444 | setModified( true ); |
441 | mViewManager->refreshView(); | 445 | mViewManager->refreshView(); |
442 | message(i18n("%1 contact(s) received!").arg( count )); | 446 | message(i18n("%1 contact(s) received!").arg( count )); |
443 | topLevelWidget()->showMaximized(); | 447 | topLevelWidget()->showMaximized(); |
444 | topLevelWidget()->raise(); | 448 | topLevelWidget()->raise(); |
445 | } | 449 | } |
446 | void KABCore::restoreSettings() | 450 | void KABCore::restoreSettings() |
447 | { | 451 | { |
448 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 452 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
449 | 453 | ||
450 | bool state; | 454 | bool state; |
451 | 455 | ||
452 | if (mMultipleViewsAtOnce) | 456 | if (mMultipleViewsAtOnce) |
453 | state = KABPrefs::instance()->mDetailsPageVisible; | 457 | state = KABPrefs::instance()->mDetailsPageVisible; |
454 | else | 458 | else |
455 | state = false; | 459 | state = false; |
456 | 460 | ||
457 | mActionDetails->setChecked( state ); | 461 | mActionDetails->setChecked( state ); |
458 | setDetailsVisible( state ); | 462 | setDetailsVisible( state ); |
459 | 463 | ||
460 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 464 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
461 | 465 | ||
462 | mActionJumpBar->setChecked( state ); | 466 | mActionJumpBar->setChecked( state ); |
463 | setJumpButtonBarVisible( state ); | 467 | setJumpButtonBarVisible( state ); |
464 | /*US | 468 | /*US |
465 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 469 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
466 | if ( splitterSize.count() == 0 ) { | 470 | if ( splitterSize.count() == 0 ) { |
467 | splitterSize.append( width() / 2 ); | 471 | splitterSize.append( width() / 2 ); |
468 | splitterSize.append( width() / 2 ); | 472 | splitterSize.append( width() / 2 ); |
469 | } | 473 | } |
470 | mMiniSplitter->setSizes( splitterSize ); | 474 | mMiniSplitter->setSizes( splitterSize ); |
471 | if ( mExtensionBarSplitter ) { | 475 | if ( mExtensionBarSplitter ) { |
472 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 476 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
473 | if ( splitterSize.count() == 0 ) { | 477 | if ( splitterSize.count() == 0 ) { |
474 | splitterSize.append( width() / 2 ); | 478 | splitterSize.append( width() / 2 ); |
475 | splitterSize.append( width() / 2 ); | 479 | splitterSize.append( width() / 2 ); |
476 | } | 480 | } |
477 | mExtensionBarSplitter->setSizes( splitterSize ); | 481 | mExtensionBarSplitter->setSizes( splitterSize ); |
478 | 482 | ||
479 | } | 483 | } |
480 | */ | 484 | */ |
481 | mViewManager->restoreSettings(); | 485 | mViewManager->restoreSettings(); |
482 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 486 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
483 | mExtensionManager->restoreSettings(); | 487 | mExtensionManager->restoreSettings(); |
484 | #ifdef DESKTOP_VERSION | 488 | #ifdef DESKTOP_VERSION |
485 | int wid = width(); | 489 | int wid = width(); |
486 | if ( wid < 10 ) | 490 | if ( wid < 10 ) |
487 | wid = 400; | 491 | wid = 400; |
488 | #else | 492 | #else |
489 | int wid = QApplication::desktop()->width(); | 493 | int wid = QApplication::desktop()->width(); |
490 | if ( wid < 640 ) | 494 | if ( wid < 640 ) |
491 | wid = QApplication::desktop()->height(); | 495 | wid = QApplication::desktop()->height(); |
492 | #endif | 496 | #endif |
493 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 497 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
494 | if ( true /*splitterSize.count() == 0*/ ) { | 498 | if ( true /*splitterSize.count() == 0*/ ) { |
495 | splitterSize.append( wid / 2 ); | 499 | splitterSize.append( wid / 2 ); |
496 | splitterSize.append( wid / 2 ); | 500 | splitterSize.append( wid / 2 ); |
497 | } | 501 | } |
498 | mMiniSplitter->setSizes( splitterSize ); | 502 | mMiniSplitter->setSizes( splitterSize ); |
499 | if ( mExtensionBarSplitter ) { | 503 | if ( mExtensionBarSplitter ) { |
500 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 504 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
501 | if ( true /*splitterSize.count() == 0*/ ) { | 505 | if ( true /*splitterSize.count() == 0*/ ) { |
502 | splitterSize.append( wid / 2 ); | 506 | splitterSize.append( wid / 2 ); |
503 | splitterSize.append( wid / 2 ); | 507 | splitterSize.append( wid / 2 ); |
504 | } | 508 | } |
505 | mExtensionBarSplitter->setSizes( splitterSize ); | 509 | mExtensionBarSplitter->setSizes( splitterSize ); |
506 | 510 | ||
507 | } | 511 | } |
508 | 512 | ||
509 | 513 | ||
510 | } | 514 | } |
511 | 515 | ||
512 | void KABCore::saveSettings() | 516 | void KABCore::saveSettings() |
513 | { | 517 | { |
514 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 518 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
515 | if ( mExtensionBarSplitter ) | 519 | if ( mExtensionBarSplitter ) |
516 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 520 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
517 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 521 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
518 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 522 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
519 | #ifndef KAB_EMBEDDED | 523 | #ifndef KAB_EMBEDDED |
520 | 524 | ||
521 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 525 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
522 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 526 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
523 | #endif //KAB_EMBEDDED | 527 | #endif //KAB_EMBEDDED |
524 | mExtensionManager->saveSettings(); | 528 | mExtensionManager->saveSettings(); |
525 | mViewManager->saveSettings(); | 529 | mViewManager->saveSettings(); |
526 | 530 | ||
527 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 531 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
528 | } | 532 | } |
529 | 533 | ||
530 | KABC::AddressBook *KABCore::addressBook() const | 534 | KABC::AddressBook *KABCore::addressBook() const |
531 | { | 535 | { |
532 | return mAddressBook; | 536 | return mAddressBook; |
533 | } | 537 | } |
534 | 538 | ||
535 | KConfig *KABCore::config() | 539 | KConfig *KABCore::config() |
536 | { | 540 | { |
537 | #ifndef KAB_EMBEDDED | 541 | #ifndef KAB_EMBEDDED |
538 | return KABPrefs::instance()->config(); | 542 | return KABPrefs::instance()->config(); |
539 | #else //KAB_EMBEDDED | 543 | #else //KAB_EMBEDDED |
540 | return KABPrefs::instance()->getConfig(); | 544 | return KABPrefs::instance()->getConfig(); |
541 | #endif //KAB_EMBEDDED | 545 | #endif //KAB_EMBEDDED |
542 | } | 546 | } |
543 | 547 | ||
544 | KActionCollection *KABCore::actionCollection() const | 548 | KActionCollection *KABCore::actionCollection() const |
545 | { | 549 | { |
546 | return mGUIClient->actionCollection(); | 550 | return mGUIClient->actionCollection(); |
547 | } | 551 | } |
548 | 552 | ||
549 | KABC::Field *KABCore::currentSearchField() const | 553 | KABC::Field *KABCore::currentSearchField() const |
550 | { | 554 | { |
551 | if (mIncSearchWidget) | 555 | if (mIncSearchWidget) |
552 | return mIncSearchWidget->currentField(); | 556 | return mIncSearchWidget->currentField(); |
553 | else | 557 | else |
554 | return 0; | 558 | return 0; |
555 | } | 559 | } |
556 | 560 | ||
557 | QStringList KABCore::selectedUIDs() const | 561 | QStringList KABCore::selectedUIDs() const |
558 | { | 562 | { |
559 | return mViewManager->selectedUids(); | 563 | return mViewManager->selectedUids(); |
560 | } | 564 | } |
561 | 565 | ||
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 79b0f9d..e9226c0 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp | |||
@@ -1221,384 +1221,390 @@ void KToolBar::setXMLGUIClient( KXMLGUIClient *client ) | |||
1221 | 1221 | ||
1222 | void KToolBar::setText( const QString & txt ) | 1222 | void KToolBar::setText( const QString & txt ) |
1223 | { | 1223 | { |
1224 | //US setLabel( txt + " ( " + kapp->caption() + " ) " ); | 1224 | //US setLabel( txt + " ( " + kapp->caption() + " ) " ); |
1225 | setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); | 1225 | setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | 1228 | ||
1229 | QString KToolBar::text() const | 1229 | QString KToolBar::text() const |
1230 | { | 1230 | { |
1231 | return label(); | 1231 | return label(); |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | 1234 | ||
1235 | void KToolBar::doConnections( KToolBarButton *button ) | 1235 | void KToolBar::doConnections( KToolBarButton *button ) |
1236 | { | 1236 | { |
1237 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); | 1237 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); |
1238 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); | 1238 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); |
1239 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); | 1239 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); |
1240 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); | 1240 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); |
1241 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); | 1241 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); |
1242 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); | 1242 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | void KToolBar::mousePressEvent ( QMouseEvent *m ) | 1245 | void KToolBar::mousePressEvent ( QMouseEvent *m ) |
1246 | { | 1246 | { |
1247 | if ( !mainWindow() ) | 1247 | if ( !mainWindow() ) |
1248 | return; | 1248 | return; |
1249 | QMainWindow *mw = mainWindow(); | 1249 | QMainWindow *mw = mainWindow(); |
1250 | if ( mw->toolBarsMovable() && d->m_enableContext ) { | 1250 | if ( mw->toolBarsMovable() && d->m_enableContext ) { |
1251 | if ( m->button() == RightButton ) { | 1251 | if ( m->button() == RightButton ) { |
1252 | int i = contextMenu()->exec( m->globalPos(), 0 ); | 1252 | int i = contextMenu()->exec( m->globalPos(), 0 ); |
1253 | switch ( i ) { | 1253 | switch ( i ) { |
1254 | case -1: | 1254 | case -1: |
1255 | return; // popup cancelled | 1255 | return; // popup cancelled |
1256 | case CONTEXT_LEFT: | 1256 | case CONTEXT_LEFT: |
1257 | //US mw->moveDockWindow( this, DockLeft ); | 1257 | //US mw->moveDockWindow( this, DockLeft ); |
1258 | mw->moveToolBar( this, QMainWindow::Left ); | 1258 | mw->moveToolBar( this, QMainWindow::Left ); |
1259 | break; | 1259 | break; |
1260 | case CONTEXT_RIGHT: | 1260 | case CONTEXT_RIGHT: |
1261 | //US mw->moveDockWindow( this, DockRight ); | 1261 | //US mw->moveDockWindow( this, DockRight ); |
1262 | mw->moveToolBar( this, QMainWindow::Right ); | 1262 | mw->moveToolBar( this, QMainWindow::Right ); |
1263 | break; | 1263 | break; |
1264 | case CONTEXT_TOP: | 1264 | case CONTEXT_TOP: |
1265 | //US mw->moveDockWindow( this, DockTop ); | 1265 | //US mw->moveDockWindow( this, DockTop ); |
1266 | mw->moveToolBar( this, QMainWindow::Top ); | 1266 | mw->moveToolBar( this, QMainWindow::Top ); |
1267 | break; | 1267 | break; |
1268 | case CONTEXT_BOTTOM: | 1268 | case CONTEXT_BOTTOM: |
1269 | //US mw->moveDockWindow( this, DockBottom ); | 1269 | //US mw->moveDockWindow( this, DockBottom ); |
1270 | mw->moveToolBar( this, QMainWindow::Bottom ); | 1270 | mw->moveToolBar( this, QMainWindow::Bottom ); |
1271 | break; | 1271 | break; |
1272 | case CONTEXT_FLOAT: | 1272 | case CONTEXT_FLOAT: |
1273 | break; | 1273 | break; |
1274 | case CONTEXT_FLAT: | 1274 | case CONTEXT_FLAT: |
1275 | //US mw->moveDockWindow( this, DockMinimized ); | 1275 | //US mw->moveDockWindow( this, DockMinimized ); |
1276 | mw->moveToolBar( this, QMainWindow::Minimized ); | 1276 | mw->moveToolBar( this, QMainWindow::Minimized ); |
1277 | break; | 1277 | break; |
1278 | case CONTEXT_ICONS: | 1278 | case CONTEXT_ICONS: |
1279 | setIconText( IconOnly ); | 1279 | setIconText( IconOnly ); |
1280 | break; | 1280 | break; |
1281 | case CONTEXT_TEXTRIGHT: | 1281 | case CONTEXT_TEXTRIGHT: |
1282 | setIconText( IconTextRight ); | 1282 | setIconText( IconTextRight ); |
1283 | break; | 1283 | break; |
1284 | case CONTEXT_TEXT: | 1284 | case CONTEXT_TEXT: |
1285 | setIconText( TextOnly ); | 1285 | setIconText( TextOnly ); |
1286 | break; | 1286 | break; |
1287 | case CONTEXT_TEXTUNDER: | 1287 | case CONTEXT_TEXTUNDER: |
1288 | setIconText( IconTextBottom ); | 1288 | setIconText( IconTextBottom ); |
1289 | break; | 1289 | break; |
1290 | default: | 1290 | default: |
1291 | if ( i >= CONTEXT_ICONSIZES ) | 1291 | if ( i >= CONTEXT_ICONSIZES ) |
1292 | setIconSize( i - CONTEXT_ICONSIZES ); | 1292 | setIconSize( i - CONTEXT_ICONSIZES ); |
1293 | else | 1293 | else |
1294 | return; // assume this was an action handled elsewhere, no need for setSettingsDirty() | 1294 | return; // assume this was an action handled elsewhere, no need for setSettingsDirty() |
1295 | } | 1295 | } |
1296 | /*US | 1296 | /*US |
1297 | if ( mw->inherits("KMainWindow") ) | 1297 | if ( mw->inherits("KMainWindow") ) |
1298 | static_cast<KMainWindow *>(mw)->setSettingsDirty(); | 1298 | static_cast<KMainWindow *>(mw)->setSettingsDirty(); |
1299 | */ | 1299 | */ |
1300 | } | 1300 | } |
1301 | } | 1301 | } |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | 1304 | ||
1305 | void KToolBar::rebuildLayout() | 1305 | void KToolBar::rebuildLayout() |
1306 | { | 1306 | { |
1307 | 1307 | ||
1308 | for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next()) | 1308 | for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next()) |
1309 | w->blockSignals(false); | 1309 | w->blockSignals(false); |
1310 | d->idleButtons.clear(); | 1310 | d->idleButtons.clear(); |
1311 | 1311 | ||
1312 | layoutTimer->stop(); | 1312 | layoutTimer->stop(); |
1313 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); | 1313 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); |
1314 | QBoxLayout *l = boxLayout(); | 1314 | QBoxLayout *l = boxLayout(); |
1315 | l->setMargin( 1 ); | 1315 | l->setMargin( 1 ); |
1316 | // clear the old layout | 1316 | // clear the old layout |
1317 | QLayoutIterator it = l->iterator(); | 1317 | QLayoutIterator it = l->iterator(); |
1318 | 1318 | ||
1319 | while ( it.current() ) { | 1319 | while ( it.current() ) { |
1320 | it.deleteCurrent(); | 1320 | it.deleteCurrent(); |
1321 | } | 1321 | } |
1322 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { | 1322 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { |
1323 | if ( w == rightAligned ) { | 1323 | if ( w == rightAligned ) { |
1324 | continue; | 1324 | continue; |
1325 | } | 1325 | } |
1326 | if ( w->inherits( "KToolBarSeparator" ) && | 1326 | if ( w->inherits( "KToolBarSeparator" ) && |
1327 | !( (KToolBarSeparator*)w )->showLine() ) { | 1327 | !( (KToolBarSeparator*)w )->showLine() ) { |
1328 | l->addSpacing( 6 ); | 1328 | l->addSpacing( 6 ); |
1329 | w->hide(); | 1329 | w->hide(); |
1330 | continue; | 1330 | continue; |
1331 | } | 1331 | } |
1332 | if ( w->inherits( "QPopupMenu" ) ) | 1332 | if ( w->inherits( "QPopupMenu" ) ) |
1333 | continue; | 1333 | continue; |
1334 | l->addWidget( w ); | 1334 | l->addWidget( w ); |
1335 | w->show(); | 1335 | w->show(); |
1336 | } | 1336 | } |
1337 | if ( rightAligned ) { | 1337 | if ( rightAligned ) { |
1338 | l->addStretch(); | 1338 | l->addStretch(); |
1339 | l->addWidget( rightAligned ); | 1339 | l->addWidget( rightAligned ); |
1340 | rightAligned->show(); | 1340 | rightAligned->show(); |
1341 | } | 1341 | } |
1342 | 1342 | ||
1343 | if ( fullSize() ) { | 1343 | if ( fullSize() ) { |
1344 | // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). | 1344 | // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). |
1345 | //if ( !stretchableWidget && widgets.last() && | 1345 | //if ( !stretchableWidget && widgets.last() && |
1346 | // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) | 1346 | // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) |
1347 | // setStretchableWidget( widgets.last() ); | 1347 | // setStretchableWidget( widgets.last() ); |
1348 | if ( !rightAligned ) | 1348 | if ( !rightAligned ) |
1349 | l->addStretch(); | 1349 | l->addStretch(); |
1350 | if ( stretchableWidget ) | 1350 | if ( stretchableWidget ) |
1351 | l->setStretchFactor( stretchableWidget, 10 ); | 1351 | l->setStretchFactor( stretchableWidget, 10 ); |
1352 | } | 1352 | } |
1353 | l->invalidate(); | 1353 | l->invalidate(); |
1354 | QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); | 1354 | QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); |
1355 | //#endif //DESKTOP_VERSION | 1355 | //#endif //DESKTOP_VERSION |
1356 | } | 1356 | } |
1357 | 1357 | ||
1358 | void KToolBar::childEvent( QChildEvent *e ) | 1358 | void KToolBar::childEvent( QChildEvent *e ) |
1359 | { | 1359 | { |
1360 | 1360 | ||
1361 | if ( e->child()->isWidgetType() ) { | 1361 | if ( e->child()->isWidgetType() ) { |
1362 | QWidget * w = (QWidget*)e->child(); | 1362 | QWidget * w = (QWidget*)e->child(); |
1363 | if ( e->type() == QEvent::ChildInserted ) { | 1363 | if ( e->type() == QEvent::ChildInserted ) { |
1364 | if ( !e->child()->inherits( "QPopupMenu" ) && | 1364 | if ( !e->child()->inherits( "QPopupMenu" ) && |
1365 | ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { | 1365 | ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { |
1366 | 1366 | ||
1367 | // prevent items that have been explicitly inserted by insert*() from | 1367 | // prevent items that have been explicitly inserted by insert*() from |
1368 | // being inserted again | 1368 | // being inserted again |
1369 | if ( !widget2id.contains( w ) ) | 1369 | if ( !widget2id.contains( w ) ) |
1370 | { | 1370 | { |
1371 | int dummy = -1; | 1371 | int dummy = -1; |
1372 | insertWidgetInternal( w, dummy, -1 ); | 1372 | insertWidgetInternal( w, dummy, -1 ); |
1373 | } | 1373 | } |
1374 | } | 1374 | } |
1375 | } else { | 1375 | } else { |
1376 | removeWidgetInternal( w ); | 1376 | removeWidgetInternal( w ); |
1377 | } | 1377 | } |
1378 | if ( isVisibleTo( 0 ) ) | 1378 | if ( isVisibleTo( 0 ) ) |
1379 | { | 1379 | { |
1380 | QBoxLayout *l = boxLayout(); | 1380 | QBoxLayout *l = boxLayout(); |
1381 | // QLayout *l = layout(); | 1381 | // QLayout *l = layout(); |
1382 | 1382 | ||
1383 | // clear the old layout so that we don't get unnecassery layout | 1383 | // clear the old layout so that we don't get unnecassery layout |
1384 | // changes till we have rebuild the thing | 1384 | // changes till we have rebuild the thing |
1385 | QLayoutIterator it = l->iterator(); | 1385 | QLayoutIterator it = l->iterator(); |
1386 | while ( it.current() ) { | 1386 | while ( it.current() ) { |
1387 | it.deleteCurrent(); | 1387 | it.deleteCurrent(); |
1388 | } | 1388 | } |
1389 | layoutTimer->start( 50, TRUE ); | 1389 | layoutTimer->start( 50, TRUE ); |
1390 | } | 1390 | } |
1391 | } | 1391 | } |
1392 | QToolBar::childEvent( e ); | 1392 | QToolBar::childEvent( e ); |
1393 | } | 1393 | } |
1394 | 1394 | ||
1395 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) | 1395 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) |
1396 | { | 1396 | { |
1397 | // we can't have it in widgets, or something is really wrong | 1397 | // we can't have it in widgets, or something is really wrong |
1398 | //widgets.removeRef( w ); | 1398 | //widgets.removeRef( w ); |
1399 | 1399 | ||
1400 | connect( w, SIGNAL( destroyed() ), | 1400 | connect( w, SIGNAL( destroyed() ), |
1401 | this, SLOT( widgetDestroyed() ) ); | 1401 | this, SLOT( widgetDestroyed() ) ); |
1402 | if ( index == -1 || index > (int)widgets.count() ) { | 1402 | if ( index == -1 || index > (int)widgets.count() ) { |
1403 | widgets.append( w ); | 1403 | widgets.append( w ); |
1404 | index = (int)widgets.count(); | 1404 | index = (int)widgets.count(); |
1405 | } | 1405 | } |
1406 | else | 1406 | else |
1407 | widgets.insert( index, w ); | 1407 | widgets.insert( index, w ); |
1408 | if ( id == -1 ) | 1408 | if ( id == -1 ) |
1409 | id = id2widget.count(); | 1409 | id = id2widget.count(); |
1410 | id2widget.insert( id, w ); | 1410 | id2widget.insert( id, w ); |
1411 | widget2id.insert( w, id ); | 1411 | widget2id.insert( w, id ); |
1412 | } | 1412 | } |
1413 | void KToolBar::repaintMe() | ||
1414 | { | ||
1415 | setUpdatesEnabled( true ); | ||
1416 | QToolBar::repaint( true ); | ||
1417 | qDebug(" KToolBar::repaintMe() "); | ||
1418 | } | ||
1413 | 1419 | ||
1414 | void KToolBar::showEvent( QShowEvent *e ) | 1420 | void KToolBar::showEvent( QShowEvent *e ) |
1415 | { | 1421 | { |
1416 | QToolBar::showEvent( e ); | 1422 | QToolBar::showEvent( e ); |
1417 | rebuildLayout(); | 1423 | rebuildLayout(); |
1418 | } | 1424 | } |
1419 | 1425 | ||
1420 | void KToolBar::setStretchableWidget( QWidget *w ) | 1426 | void KToolBar::setStretchableWidget( QWidget *w ) |
1421 | { | 1427 | { |
1422 | QToolBar::setStretchableWidget( w ); | 1428 | QToolBar::setStretchableWidget( w ); |
1423 | stretchableWidget = w; | 1429 | stretchableWidget = w; |
1424 | } | 1430 | } |
1425 | 1431 | ||
1426 | QSizePolicy KToolBar::sizePolicy() const | 1432 | QSizePolicy KToolBar::sizePolicy() const |
1427 | { | 1433 | { |
1428 | if ( orientation() == Horizontal ) | 1434 | if ( orientation() == Horizontal ) |
1429 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); | 1435 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); |
1430 | else | 1436 | else |
1431 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); | 1437 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); |
1432 | } | 1438 | } |
1433 | 1439 | ||
1434 | QSize KToolBar::sizeHint() const | 1440 | QSize KToolBar::sizeHint() const |
1435 | { | 1441 | { |
1436 | return QToolBar::sizeHint(); | 1442 | return QToolBar::sizeHint(); |
1437 | #if 0 | 1443 | #if 0 |
1438 | QWidget::polish(); | 1444 | QWidget::polish(); |
1439 | static int iii = 0; | 1445 | static int iii = 0; |
1440 | ++iii; | 1446 | ++iii; |
1441 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); | 1447 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); |
1442 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); | 1448 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); |
1443 | switch( barPos() ) | 1449 | switch( barPos() ) |
1444 | { | 1450 | { |
1445 | case KToolBar::Top: | 1451 | case KToolBar::Top: |
1446 | case KToolBar::Bottom: | 1452 | case KToolBar::Bottom: |
1447 | for ( QWidget *w = widgets.first(); w; w =widgets.next() ) | 1453 | for ( QWidget *w = widgets.first(); w; w =widgets.next() ) |
1448 | { | 1454 | { |
1449 | if ( w->inherits( "KToolBarSeparator" ) && | 1455 | if ( w->inherits( "KToolBarSeparator" ) && |
1450 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) | 1456 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) |
1451 | { | 1457 | { |
1452 | minSize += QSize(6, 0); | 1458 | minSize += QSize(6, 0); |
1453 | } | 1459 | } |
1454 | else | 1460 | else |
1455 | { | 1461 | { |
1456 | QSize sh = w->sizeHint(); | 1462 | QSize sh = w->sizeHint(); |
1457 | if (!sh.isValid()) | 1463 | if (!sh.isValid()) |
1458 | sh = w->minimumSize(); | 1464 | sh = w->minimumSize(); |
1459 | minSize = minSize.expandedTo(QSize(0, sh.height())); | 1465 | minSize = minSize.expandedTo(QSize(0, sh.height())); |
1460 | minSize += QSize(sh.width()+1, 0); | 1466 | minSize += QSize(sh.width()+1, 0); |
1461 | } | 1467 | } |
1462 | } | 1468 | } |
1463 | /*US | 1469 | /*US |
1464 | minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); | 1470 | minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); |
1465 | */ | 1471 | */ |
1466 | minSize += QSize(margin*2, margin*2); | 1472 | minSize += QSize(margin*2, margin*2); |
1467 | break; | 1473 | break; |
1468 | 1474 | ||
1469 | case KToolBar::Left: | 1475 | case KToolBar::Left: |
1470 | case KToolBar::Right: | 1476 | case KToolBar::Right: |
1471 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) | 1477 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) |
1472 | { | 1478 | { |
1473 | if ( w->inherits( "KToolBarSeparator" ) && | 1479 | if ( w->inherits( "KToolBarSeparator" ) && |
1474 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) | 1480 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) |
1475 | { | 1481 | { |
1476 | minSize += QSize(0, 6); | 1482 | minSize += QSize(0, 6); |
1477 | } | 1483 | } |
1478 | else | 1484 | else |
1479 | { | 1485 | { |
1480 | QSize sh = w->sizeHint(); | 1486 | QSize sh = w->sizeHint(); |
1481 | if (!sh.isValid()) | 1487 | if (!sh.isValid()) |
1482 | sh = w->minimumSize(); | 1488 | sh = w->minimumSize(); |
1483 | minSize = minSize.expandedTo(QSize(sh.width(), 0)); | 1489 | minSize = minSize.expandedTo(QSize(sh.width(), 0)); |
1484 | minSize += QSize(0, sh.height()+1); | 1490 | minSize += QSize(0, sh.height()+1); |
1485 | } | 1491 | } |
1486 | } | 1492 | } |
1487 | /*US | 1493 | /*US |
1488 | minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); | 1494 | minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); |
1489 | */ | 1495 | */ |
1490 | minSize += QSize(margin*2, margin*2); | 1496 | minSize += QSize(margin*2, margin*2); |
1491 | break; | 1497 | break; |
1492 | 1498 | ||
1493 | default: | 1499 | default: |
1494 | minSize = QToolBar::sizeHint(); | 1500 | minSize = QToolBar::sizeHint(); |
1495 | break; | 1501 | break; |
1496 | } | 1502 | } |
1497 | return minSize; | 1503 | return minSize; |
1498 | #endif | 1504 | #endif |
1499 | } | 1505 | } |
1500 | 1506 | ||
1501 | QSize KToolBar::minimumSize() const | 1507 | QSize KToolBar::minimumSize() const |
1502 | { | 1508 | { |
1503 | return minimumSizeHint(); | 1509 | return minimumSizeHint(); |
1504 | } | 1510 | } |
1505 | 1511 | ||
1506 | QSize KToolBar::minimumSizeHint() const | 1512 | QSize KToolBar::minimumSizeHint() const |
1507 | { | 1513 | { |
1508 | return sizeHint(); | 1514 | return sizeHint(); |
1509 | } | 1515 | } |
1510 | 1516 | ||
1511 | bool KToolBar::highlight() const | 1517 | bool KToolBar::highlight() const |
1512 | { | 1518 | { |
1513 | return d->m_highlight; | 1519 | return d->m_highlight; |
1514 | } | 1520 | } |
1515 | 1521 | ||
1516 | void KToolBar::hide() | 1522 | void KToolBar::hide() |
1517 | { | 1523 | { |
1518 | QToolBar::hide(); | 1524 | QToolBar::hide(); |
1519 | } | 1525 | } |
1520 | 1526 | ||
1521 | void KToolBar::show() | 1527 | void KToolBar::show() |
1522 | { | 1528 | { |
1523 | QToolBar::show(); | 1529 | QToolBar::show(); |
1524 | } | 1530 | } |
1525 | 1531 | ||
1526 | void KToolBar::resizeEvent( QResizeEvent *e ) | 1532 | void KToolBar::resizeEvent( QResizeEvent *e ) |
1527 | { | 1533 | { |
1528 | bool b = isUpdatesEnabled(); | 1534 | bool b = isUpdatesEnabled(); |
1529 | setUpdatesEnabled( FALSE ); | 1535 | setUpdatesEnabled( FALSE ); |
1530 | QToolBar::resizeEvent( e ); | 1536 | QToolBar::resizeEvent( e ); |
1531 | if (b) | 1537 | if (b) |
1532 | d->repaintTimer.start( 100, true ); | 1538 | d->repaintTimer.start( 100, true ); |
1533 | } | 1539 | } |
1534 | 1540 | ||
1535 | void KToolBar::slotIconChanged(int group) | 1541 | void KToolBar::slotIconChanged(int group) |
1536 | { | 1542 | { |
1537 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) | 1543 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) |
1538 | return; | 1544 | return; |
1539 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) | 1545 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) |
1540 | return; | 1546 | return; |
1541 | 1547 | ||
1542 | emit modechange(); | 1548 | emit modechange(); |
1543 | if (isVisible()) | 1549 | if (isVisible()) |
1544 | updateGeometry(); | 1550 | updateGeometry(); |
1545 | } | 1551 | } |
1546 | 1552 | ||
1547 | void KToolBar::slotReadConfig() | 1553 | void KToolBar::slotReadConfig() |
1548 | { | 1554 | { |
1549 | //kdDebug(220) << "KToolBar::slotReadConfig" << endl; | 1555 | //kdDebug(220) << "KToolBar::slotReadConfig" << endl; |
1550 | // Read appearance settings (hmm, we used to do both here, | 1556 | // Read appearance settings (hmm, we used to do both here, |
1551 | // but a well behaved application will call applyMainWindowSettings | 1557 | // but a well behaved application will call applyMainWindowSettings |
1552 | // anyway, right ?) | 1558 | // anyway, right ?) |
1553 | applyAppearanceSettings(KGlobal::config(), QString::null ); | 1559 | applyAppearanceSettings(KGlobal::config(), QString::null ); |
1554 | } | 1560 | } |
1555 | 1561 | ||
1556 | void KToolBar::slotAppearanceChanged() | 1562 | void KToolBar::slotAppearanceChanged() |
1557 | { | 1563 | { |
1558 | // Read appearance settings from global file. | 1564 | // Read appearance settings from global file. |
1559 | applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); | 1565 | applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); |
1560 | // And remember to save the new look later | 1566 | // And remember to save the new look later |
1561 | /*US | 1567 | /*US |
1562 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) | 1568 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) |
1563 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1569 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1564 | */ | 1570 | */ |
1565 | } | 1571 | } |
1566 | 1572 | ||
1567 | //static | 1573 | //static |
1568 | bool KToolBar::highlightSetting() | 1574 | bool KToolBar::highlightSetting() |
1569 | { | 1575 | { |
1570 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1576 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1571 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1577 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1572 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); | 1578 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); |
1573 | } | 1579 | } |
1574 | 1580 | ||
1575 | //static | 1581 | //static |
1576 | bool KToolBar::transparentSetting() | 1582 | bool KToolBar::transparentSetting() |
1577 | { | 1583 | { |
1578 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1584 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1579 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1585 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1580 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); | 1586 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); |
1581 | } | 1587 | } |
1582 | 1588 | ||
1583 | //static | 1589 | //static |
1584 | KToolBar::IconText KToolBar::iconTextSetting() | 1590 | KToolBar::IconText KToolBar::iconTextSetting() |
1585 | { | 1591 | { |
1586 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1592 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1587 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1593 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1588 | QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); | 1594 | QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); |
1589 | if ( icontext == "IconTextRight" ) | 1595 | if ( icontext == "IconTextRight" ) |
1590 | return IconTextRight; | 1596 | return IconTextRight; |
1591 | else if ( icontext == "IconTextBottom" ) | 1597 | else if ( icontext == "IconTextBottom" ) |
1592 | return IconTextBottom; | 1598 | return IconTextBottom; |
1593 | else if ( icontext == "TextOnly" ) | 1599 | else if ( icontext == "TextOnly" ) |
1594 | return TextOnly; | 1600 | return TextOnly; |
1595 | else | 1601 | else |
1596 | return IconOnly; | 1602 | return IconOnly; |
1597 | } | 1603 | } |
1598 | 1604 | ||
1599 | void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) | 1605 | void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) |
1600 | { | 1606 | { |
1601 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; | 1607 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; |
1602 | //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; | 1608 | //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; |
1603 | // We have application-specific settings in the XML file, | 1609 | // We have application-specific settings in the XML file, |
1604 | // and nothing in the application's config file | 1610 | // and nothing in the application's config file |
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h index 2c061b5..61b5ea3 100644 --- a/microkde/kdeui/ktoolbar.h +++ b/microkde/kdeui/ktoolbar.h | |||
@@ -856,252 +856,253 @@ public: | |||
856 | 856 | ||
857 | /** | 857 | /** |
858 | * This allows you to enable or disable the context menu. | 858 | * This allows you to enable or disable the context menu. |
859 | * | 859 | * |
860 | * @param enable If false, then the context menu will be disabled | 860 | * @param enable If false, then the context menu will be disabled |
861 | */ | 861 | */ |
862 | void setEnableContextMenu(bool enable = true); | 862 | void setEnableContextMenu(bool enable = true); |
863 | 863 | ||
864 | /** | 864 | /** |
865 | * Returns whether or not the context menu is disabled | 865 | * Returns whether or not the context menu is disabled |
866 | * | 866 | * |
867 | * @return The context menu state | 867 | * @return The context menu state |
868 | */ | 868 | */ |
869 | bool contextMenuEnabled() const; | 869 | bool contextMenuEnabled() const; |
870 | 870 | ||
871 | /** | 871 | /** |
872 | * This will inform a toolbar button to ignore certain style | 872 | * This will inform a toolbar button to ignore certain style |
873 | * changes. Specifically, it will ignore IconText (always IconOnly) | 873 | * changes. Specifically, it will ignore IconText (always IconOnly) |
874 | * and will not allow image effects to apply. | 874 | * and will not allow image effects to apply. |
875 | * | 875 | * |
876 | * @param id The button to exclude from styles | 876 | * @param id The button to exclude from styles |
877 | * @param no_style If true, then it is excluded (default: true). | 877 | * @param no_style If true, then it is excluded (default: true). |
878 | */ | 878 | */ |
879 | void setItemNoStyle(int id, bool no_style = true); | 879 | void setItemNoStyle(int id, bool no_style = true); |
880 | 880 | ||
881 | void setFlat (bool flag); | 881 | void setFlat (bool flag); |
882 | 882 | ||
883 | /** | 883 | /** |
884 | * @return the number of items in the toolbar | 884 | * @return the number of items in the toolbar |
885 | */ | 885 | */ |
886 | int count() const; | 886 | int count() const; |
887 | 887 | ||
888 | /** | 888 | /** |
889 | * Instruct the toolbar to save it's current state to either the app | 889 | * Instruct the toolbar to save it's current state to either the app |
890 | * config file or to the XML-GUI resource file (whichever has | 890 | * config file or to the XML-GUI resource file (whichever has |
891 | * precedence). | 891 | * precedence). |
892 | */ | 892 | */ |
893 | void saveState(); | 893 | void saveState(); |
894 | 894 | ||
895 | /** | 895 | /** |
896 | * Save the toolbar settings to group @p configGroup in @p config. | 896 | * Save the toolbar settings to group @p configGroup in @p config. |
897 | */ | 897 | */ |
898 | void saveSettings(KConfig *config, const QString &configGroup); | 898 | void saveSettings(KConfig *config, const QString &configGroup); |
899 | 899 | ||
900 | /** | 900 | /** |
901 | * Read the toolbar settings from group @p configGroup in @p config | 901 | * Read the toolbar settings from group @p configGroup in @p config |
902 | * and apply them. | 902 | * and apply them. |
903 | */ | 903 | */ |
904 | void applySettings(KConfig *config, const QString &configGroup); | 904 | void applySettings(KConfig *config, const QString &configGroup); |
905 | 905 | ||
906 | /** | 906 | /** |
907 | * Tell the toolbar what XML-GUI resource file it should use to save | 907 | * Tell the toolbar what XML-GUI resource file it should use to save |
908 | * it's state. The state of the toolbar (position, size, etc) is | 908 | * it's state. The state of the toolbar (position, size, etc) is |
909 | * saved in KConfig files if the application does not use XML-GUI.. | 909 | * saved in KConfig files if the application does not use XML-GUI.. |
910 | * but if the app does, then it's saved the XML file. This function | 910 | * but if the app does, then it's saved the XML file. This function |
911 | * allows this to happen. | 911 | * allows this to happen. |
912 | * | 912 | * |
913 | * @param xmlfile The XML-GUI resource file to write to | 913 | * @param xmlfile The XML-GUI resource file to write to |
914 | * @param xml The DOM document for the XML-GUI building | 914 | * @param xml The DOM document for the XML-GUI building |
915 | */ | 915 | */ |
916 | // void setXML(const QString& xmlfile, const QDomDocument& xml); | 916 | // void setXML(const QString& xmlfile, const QDomDocument& xml); |
917 | /* @internal */ | 917 | /* @internal */ |
918 | void setXMLGUIClient( KXMLGUIClient *client ); | 918 | void setXMLGUIClient( KXMLGUIClient *client ); |
919 | 919 | ||
920 | /** | 920 | /** |
921 | * Assign a (translated) text to this toolbar. This is used | 921 | * Assign a (translated) text to this toolbar. This is used |
922 | * for the tooltip on the handle, and when listing the toolbars. | 922 | * for the tooltip on the handle, and when listing the toolbars. |
923 | */ | 923 | */ |
924 | void setText( const QString & txt ); | 924 | void setText( const QString & txt ); |
925 | 925 | ||
926 | /** | 926 | /** |
927 | * @return the toolbar's text. | 927 | * @return the toolbar's text. |
928 | */ | 928 | */ |
929 | QString text() const; | 929 | QString text() const; |
930 | 930 | ||
931 | void setStretchableWidget( QWidget *w ); | 931 | void setStretchableWidget( QWidget *w ); |
932 | QSizePolicy sizePolicy() const; | 932 | QSizePolicy sizePolicy() const; |
933 | bool highlight() const; | 933 | bool highlight() const; |
934 | QSize sizeHint() const; | 934 | QSize sizeHint() const; |
935 | QSize minimumSizeHint() const; | 935 | QSize minimumSizeHint() const; |
936 | QSize minimumSize() const; | 936 | QSize minimumSize() const; |
937 | 937 | ||
938 | void hide(); | 938 | void hide(); |
939 | void show(); | 939 | void show(); |
940 | 940 | ||
941 | void updateRects( bool = FALSE ) {} | 941 | void updateRects( bool = FALSE ) {} |
942 | 942 | ||
943 | //US void loadState( const QDomElement &e ); | 943 | //US void loadState( const QDomElement &e ); |
944 | //US void saveState( QDomElement &e ); | 944 | //US void saveState( QDomElement &e ); |
945 | 945 | ||
946 | /** | 946 | /** |
947 | * @internal | 947 | * @internal |
948 | */ | 948 | */ |
949 | void positionYourself( bool force = false); | 949 | void positionYourself( bool force = false); |
950 | 950 | ||
951 | signals: | 951 | signals: |
952 | /** | 952 | /** |
953 | * Emitted when button @p id is clicked. | 953 | * Emitted when button @p id is clicked. |
954 | */ | 954 | */ |
955 | void clicked(int id); | 955 | void clicked(int id); |
956 | 956 | ||
957 | /** | 957 | /** |
958 | * Emitted when button @p id is double-clicked. | 958 | * Emitted when button @p id is double-clicked. |
959 | * | 959 | * |
960 | * Note: you will always | 960 | * Note: you will always |
961 | * recive two @ref clicked() , @ref pressed() and @ref released() signals. | 961 | * recive two @ref clicked() , @ref pressed() and @ref released() signals. |
962 | * There is no way to avoid it - at least no easy way. | 962 | * There is no way to avoid it - at least no easy way. |
963 | * If you need to resolve this all you can do is set up timers | 963 | * If you need to resolve this all you can do is set up timers |
964 | * which wait for @ref QApplication::doubleClickInterval() to expire. | 964 | * which wait for @ref QApplication::doubleClickInterval() to expire. |
965 | * If in that time you don't get this signal, you may belive that | 965 | * If in that time you don't get this signal, you may belive that |
966 | * button was only clicked and not double-clicked. | 966 | * button was only clicked and not double-clicked. |
967 | * And please note that butons with popup menus do not emit this signal, | 967 | * And please note that butons with popup menus do not emit this signal, |
968 | * but those with delayed popup do. | 968 | * but those with delayed popup do. |
969 | */ | 969 | */ |
970 | void doubleClicked (int id); | 970 | void doubleClicked (int id); |
971 | 971 | ||
972 | /** | 972 | /** |
973 | * Emitted when button @p id is pressed. | 973 | * Emitted when button @p id is pressed. |
974 | */ | 974 | */ |
975 | void pressed(int); | 975 | void pressed(int); |
976 | 976 | ||
977 | /** | 977 | /** |
978 | * Emits when button @p id is released. | 978 | * Emits when button @p id is released. |
979 | */ | 979 | */ |
980 | void released(int); | 980 | void released(int); |
981 | 981 | ||
982 | /** | 982 | /** |
983 | * Emitted when a toggle button changes state. | 983 | * Emitted when a toggle button changes state. |
984 | * | 984 | * |
985 | * Emitted also if you change state | 985 | * Emitted also if you change state |
986 | * with @ref setButton() or @ref toggleButton() | 986 | * with @ref setButton() or @ref toggleButton() |
987 | * If you make a button normal again, with | 987 | * If you make a button normal again, with |
988 | * setToggle(false), this signal won't | 988 | * setToggle(false), this signal won't |
989 | * be emitted. | 989 | * be emitted. |
990 | */ | 990 | */ |
991 | void toggled(int); | 991 | void toggled(int); |
992 | 992 | ||
993 | /** | 993 | /** |
994 | * This signal is emitted when item id gets highlighted/unhighlighted | 994 | * This signal is emitted when item id gets highlighted/unhighlighted |
995 | * (i.e when mouse enters/exits). | 995 | * (i.e when mouse enters/exits). |
996 | * | 996 | * |
997 | * Note that this signal is emitted from | 997 | * Note that this signal is emitted from |
998 | * all buttons (normal, disabled and toggle) even when there is no visible | 998 | * all buttons (normal, disabled and toggle) even when there is no visible |
999 | * change in buttons (i.e., buttons do not raise when mouse enters). | 999 | * change in buttons (i.e., buttons do not raise when mouse enters). |
1000 | * The parameter @p isHighlighted is @p true when mouse enters and @p false when | 1000 | * The parameter @p isHighlighted is @p true when mouse enters and @p false when |
1001 | * mouse exits. | 1001 | * mouse exits. |
1002 | */ | 1002 | */ |
1003 | void highlighted(int id, bool isHighlighted); | 1003 | void highlighted(int id, bool isHighlighted); |
1004 | 1004 | ||
1005 | /** | 1005 | /** |
1006 | * This signal is emitted when item id gets highlighted/unhighlighted | 1006 | * This signal is emitted when item id gets highlighted/unhighlighted |
1007 | * (i.e when mouse enters/exits). | 1007 | * (i.e when mouse enters/exits). |
1008 | * | 1008 | * |
1009 | * Note that this signal is emitted from | 1009 | * Note that this signal is emitted from |
1010 | * all buttons (normal, disabled and toggle) even when there is no visible | 1010 | * all buttons (normal, disabled and toggle) even when there is no visible |
1011 | * change in buttons (i.e., buttons do not raise when mouse enters). | 1011 | * change in buttons (i.e., buttons do not raise when mouse enters). |
1012 | */ | 1012 | */ |
1013 | void highlighted(int id ); | 1013 | void highlighted(int id ); |
1014 | 1014 | ||
1015 | /** | 1015 | /** |
1016 | * Emitted when toolbar changes position, or when | 1016 | * Emitted when toolbar changes position, or when |
1017 | * an item is removed from toolbar. | 1017 | * an item is removed from toolbar. |
1018 | * | 1018 | * |
1019 | * If you subclass @ref KMainWindow and reimplement | 1019 | * If you subclass @ref KMainWindow and reimplement |
1020 | * @ref KMainWindow::resizeEvent() be sure to connect to | 1020 | * @ref KMainWindow::resizeEvent() be sure to connect to |
1021 | * this signal. Note: You can connect this signal to a slot that | 1021 | * this signal. Note: You can connect this signal to a slot that |
1022 | * doesn't take parameter. | 1022 | * doesn't take parameter. |
1023 | */ | 1023 | */ |
1024 | void moved( BarPosition ); | 1024 | void moved( BarPosition ); |
1025 | 1025 | ||
1026 | /** | 1026 | /** |
1027 | * @internal | 1027 | * @internal |
1028 | * This signal is emitted when toolbar detects changing of | 1028 | * This signal is emitted when toolbar detects changing of |
1029 | * following parameters: | 1029 | * following parameters: |
1030 | * highlighting, button-size, button-mode. This signal is | 1030 | * highlighting, button-size, button-mode. This signal is |
1031 | * internal, aimed to buttons. | 1031 | * internal, aimed to buttons. |
1032 | */ | 1032 | */ |
1033 | void modechange (); | 1033 | void modechange (); |
1034 | 1034 | ||
1035 | /** | 1035 | /** |
1036 | * This signal is emitted when the toolbar is getting deleted, | 1036 | * This signal is emitted when the toolbar is getting deleted, |
1037 | * and before ~KToolbar finishes (so it's still time to remove | 1037 | * and before ~KToolbar finishes (so it's still time to remove |
1038 | * widgets from the toolbar). | 1038 | * widgets from the toolbar). |
1039 | * Used by KWidgetAction. | 1039 | * Used by KWidgetAction. |
1040 | * @since 3.2 | 1040 | * @since 3.2 |
1041 | */ | 1041 | */ |
1042 | void toolbarDestroyed(); | 1042 | void toolbarDestroyed(); |
1043 | 1043 | ||
1044 | public: | 1044 | public: |
1045 | /** | 1045 | /** |
1046 | * @return global setting for "Highlight buttons under mouse" | 1046 | * @return global setting for "Highlight buttons under mouse" |
1047 | */ | 1047 | */ |
1048 | void repaintMe(); | ||
1048 | static bool highlightSetting(); | 1049 | static bool highlightSetting(); |
1049 | 1050 | ||
1050 | /** | 1051 | /** |
1051 | * @return global setting for "Toolbars transparent when moving" | 1052 | * @return global setting for "Toolbars transparent when moving" |
1052 | */ | 1053 | */ |
1053 | static bool transparentSetting(); | 1054 | static bool transparentSetting(); |
1054 | 1055 | ||
1055 | /** | 1056 | /** |
1056 | * @return global setting for "Icon Text" | 1057 | * @return global setting for "Icon Text" |
1057 | */ | 1058 | */ |
1058 | static IconText iconTextSetting(); | 1059 | static IconText iconTextSetting(); |
1059 | 1060 | ||
1060 | public slots: | 1061 | public slots: |
1061 | virtual void setIconText( const QString &txt ) | 1062 | virtual void setIconText( const QString &txt ) |
1062 | { QToolBar::setIconText( txt ); } | 1063 | { QToolBar::setIconText( txt ); } |
1064 | void slotRepaint(); | ||
1063 | 1065 | ||
1064 | protected: | 1066 | protected: |
1065 | void mousePressEvent( QMouseEvent * ); | 1067 | void mousePressEvent( QMouseEvent * ); |
1066 | void childEvent( QChildEvent *e ); | 1068 | void childEvent( QChildEvent *e ); |
1067 | void showEvent( QShowEvent *e ); | 1069 | void showEvent( QShowEvent *e ); |
1068 | void resizeEvent( QResizeEvent *e ); | 1070 | void resizeEvent( QResizeEvent *e ); |
1069 | bool event( QEvent *e ); | 1071 | bool event( QEvent *e ); |
1070 | void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); | 1072 | void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); |
1071 | QString settingsGroup(); | 1073 | QString settingsGroup(); |
1072 | 1074 | ||
1073 | private slots: | 1075 | private slots: |
1074 | void rebuildLayout(); | 1076 | void rebuildLayout(); |
1075 | void slotReadConfig (); | 1077 | void slotReadConfig (); |
1076 | void slotAppearanceChanged(); | 1078 | void slotAppearanceChanged(); |
1077 | void slotIconChanged(int); | 1079 | void slotIconChanged(int); |
1078 | void slotRepaint(); | ||
1079 | void toolBarPosChanged( QToolBar *tb ); | 1080 | void toolBarPosChanged( QToolBar *tb ); |
1080 | void slotContextAboutToShow(); | 1081 | void slotContextAboutToShow(); |
1081 | void widgetDestroyed(); | 1082 | void widgetDestroyed(); |
1082 | 1083 | ||
1083 | private: | 1084 | private: |
1084 | void init( bool readConfig = true, bool honorStyle = false ); | 1085 | void init( bool readConfig = true, bool honorStyle = false ); |
1085 | void doConnections( KToolBarButton *button ); | 1086 | void doConnections( KToolBarButton *button ); |
1086 | void insertWidgetInternal( QWidget *w, int &index, int id ); | 1087 | void insertWidgetInternal( QWidget *w, int &index, int id ); |
1087 | void removeWidgetInternal( QWidget *w ); | 1088 | void removeWidgetInternal( QWidget *w ); |
1088 | void getAttributes( QString &position, QString &icontext, int &index ); | 1089 | void getAttributes( QString &position, QString &icontext, int &index ); |
1089 | //US KPopupMenu *contextMenu(); | 1090 | //US KPopupMenu *contextMenu(); |
1090 | QPopupMenu *contextMenu(); | 1091 | QPopupMenu *contextMenu(); |
1091 | 1092 | ||
1092 | QMap<QWidget*, int > widget2id; | 1093 | QMap<QWidget*, int > widget2id; |
1093 | typedef QMap<int, QWidget* > Id2WidgetMap; | 1094 | typedef QMap<int, QWidget* > Id2WidgetMap; |
1094 | Id2WidgetMap id2widget; | 1095 | Id2WidgetMap id2widget; |
1095 | //US KPopupMenu *context; | 1096 | //US KPopupMenu *context; |
1096 | QPopupMenu *context; | 1097 | QPopupMenu *context; |
1097 | QPtrList<QWidget> widgets; | 1098 | QPtrList<QWidget> widgets; |
1098 | QTimer *layoutTimer; | 1099 | QTimer *layoutTimer; |
1099 | QGuardedPtr<QWidget> stretchableWidget, rightAligned; | 1100 | QGuardedPtr<QWidget> stretchableWidget, rightAligned; |
1100 | protected: | 1101 | protected: |
1101 | virtual void virtual_hook( int id, void* data ); | 1102 | virtual void virtual_hook( int id, void* data ); |
1102 | private: | 1103 | private: |
1103 | KToolBarPrivate *d; | 1104 | KToolBarPrivate *d; |
1104 | bool inshutdownprocess; | 1105 | bool inshutdownprocess; |
1105 | }; | 1106 | }; |
1106 | 1107 | ||
1107 | #endif | 1108 | #endif |