summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-17 15:26:56 (UTC)
committer zautrix <zautrix>2005-01-17 15:26:56 (UTC)
commit1525820e30e14de83a15533a3c67aa2756a544f4 (patch) (unidiff)
treecb8083c4675c874b5cac9355acc4d746077b6692
parent214b82c86bd5365d7a5fc786c8c9c7231ec6dc77 (diff)
downloadkdepimpi-1525820e30e14de83a15533a3c67aa2756a544f4.zip
kdepimpi-1525820e30e14de83a15533a3c67aa2756a544f4.tar.gz
kdepimpi-1525820e30e14de83a15533a3c67aa2756a544f4.tar.bz2
AB fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp4
-rw-r--r--kaddressbook/viewmanager.cpp9
-rw-r--r--kaddressbook/viewmanager.h1
-rw-r--r--microkde/kdeui/ktoolbar.cpp2
4 files changed, 10 insertions, 6 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a480baf..9526f23 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -344,129 +344,129 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
344 344
345 connect( mViewManager, SIGNAL( selected( const QString& ) ), 345 connect( mViewManager, SIGNAL( selected( const QString& ) ),
346 SLOT( setContactSelected( const QString& ) ) ); 346 SLOT( setContactSelected( const QString& ) ) );
347 connect( mViewManager, SIGNAL( executed( const QString& ) ), 347 connect( mViewManager, SIGNAL( executed( const QString& ) ),
348 SLOT( executeContact( const QString& ) ) ); 348 SLOT( executeContact( const QString& ) ) );
349 349
350 connect( mViewManager, SIGNAL( deleteRequest( ) ), 350 connect( mViewManager, SIGNAL( deleteRequest( ) ),
351 SLOT( deleteContacts( ) ) ); 351 SLOT( deleteContacts( ) ) );
352 connect( mViewManager, SIGNAL( modified() ), 352 connect( mViewManager, SIGNAL( modified() ),
353 SLOT( setModified() ) ); 353 SLOT( setModified() ) );
354 354
355 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 355 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
356 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 356 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
357 357
358 connect( mXXPortManager, SIGNAL( modified() ), 358 connect( mXXPortManager, SIGNAL( modified() ),
359 SLOT( setModified() ) ); 359 SLOT( setModified() ) );
360 360
361 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 361 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
362 SLOT( incrementalSearch( const QString& ) ) ); 362 SLOT( incrementalSearch( const QString& ) ) );
363 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 363 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
364 mJumpButtonBar, SLOT( recreateButtons() ) ); 364 mJumpButtonBar, SLOT( recreateButtons() ) );
365 365
366 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 366 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
367 SLOT( sendMail( const QString& ) ) ); 367 SLOT( sendMail( const QString& ) ) );
368 368
369 369
370 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 370 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
371 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&))); 371 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&)));
372 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 372 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
373 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 373 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
374 374
375 375
376#ifndef KAB_EMBEDDED 376#ifndef KAB_EMBEDDED
377 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 377 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
378 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 378 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
379 379
380 connect( mDetails, SIGNAL( browse( const QString& ) ), 380 connect( mDetails, SIGNAL( browse( const QString& ) ),
381 SLOT( browse( const QString& ) ) ); 381 SLOT( browse( const QString& ) ) );
382 382
383 383
384 mAddressBookService = new KAddressBookService( this ); 384 mAddressBookService = new KAddressBookService( this );
385 385
386#endif //KAB_EMBEDDED 386#endif //KAB_EMBEDDED
387 387
388 mMessageTimer = new QTimer( this ); 388 mMessageTimer = new QTimer( this );
389 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 389 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
390 mEditorDialog = 0; 390 mEditorDialog = 0;
391 createAddresseeEditorDialog( this ); 391 createAddresseeEditorDialog( this );
392 setModified( false ); 392 setModified( false );
393 mBRdisabled = false; 393 mBRdisabled = false;
394#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
395 infrared = 0; 395 infrared = 0;
396#endif 396#endif
397 //toggleBeamReceive( ); 397 //toggleBeamReceive( );
398 //mMainWindow->toolBar()->show(); 398 //mMainWindow->toolBar()->show();
399 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 399 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
400 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 400 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
401} 401}
402 402
403void KABCore::updateToolBar() 403void KABCore::updateToolBar()
404{ 404{
405 static int iii = 0; 405 static int iii = 0;
406 ++iii; 406 ++iii;
407 mMainWindow->toolBar()->repaintMe(); 407 mMainWindow->toolBar()->repaintMe();
408 if ( iii < 5 ) 408 if ( iii < 3 )
409 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 409 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
410} 410}
411KABCore::~KABCore() 411KABCore::~KABCore()
412{ 412{
413 // save(); 413 // save();
414 //saveSettings(); 414 //saveSettings();
415 //KABPrefs::instance()->writeConfig(); 415 //KABPrefs::instance()->writeConfig();
416 delete AddresseeConfig::instance(); 416 delete AddresseeConfig::instance();
417 mAddressBook = 0; 417 mAddressBook = 0;
418 KABC::StdAddressBook::close(); 418 KABC::StdAddressBook::close();
419 419
420 delete syncManager; 420 delete syncManager;
421#ifndef DESKTOP_VERSION 421#ifndef DESKTOP_VERSION
422 if ( infrared ) 422 if ( infrared )
423 delete infrared; 423 delete infrared;
424#endif 424#endif
425} 425}
426void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 426void KABCore::receive( const QCString& cmsg, const QByteArray& data )
427{ 427{
428 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 428 qDebug("KA: QCOP message received: %s ", cmsg.data() );
429 if ( cmsg == "setDocument(QString)" ) { 429 if ( cmsg == "setDocument(QString)" ) {
430 QDataStream stream( data, IO_ReadOnly ); 430 QDataStream stream( data, IO_ReadOnly );
431 QString fileName; 431 QString fileName;
432 stream >> fileName; 432 stream >> fileName;
433 recieve( fileName ); 433 recieve( fileName );
434 return; 434 return;
435 } 435 }
436} 436}
437void KABCore::toggleBeamReceive( ) 437void KABCore::toggleBeamReceive( )
438{ 438{
439 if ( mBRdisabled ) 439 if ( mBRdisabled )
440 return; 440 return;
441#ifndef DESKTOP_VERSION 441#ifndef DESKTOP_VERSION
442 if ( infrared ) { 442 if ( infrared ) {
443 qDebug("AB disable BeamReceive "); 443 qDebug("AB disable BeamReceive ");
444 delete infrared; 444 delete infrared;
445 infrared = 0; 445 infrared = 0;
446 mActionBR->setChecked(false); 446 mActionBR->setChecked(false);
447 return; 447 return;
448 } 448 }
449 qDebug("AB enable BeamReceive "); 449 qDebug("AB enable BeamReceive ");
450 mActionBR->setChecked(true); 450 mActionBR->setChecked(true);
451 451
452 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 452 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
453 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 453 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
454#endif 454#endif
455} 455}
456 456
457 457
458void KABCore::disableBR(bool b) 458void KABCore::disableBR(bool b)
459{ 459{
460#ifndef DESKTOP_VERSION 460#ifndef DESKTOP_VERSION
461 if ( b ) { 461 if ( b ) {
462 if ( infrared ) { 462 if ( infrared ) {
463 toggleBeamReceive( ); 463 toggleBeamReceive( );
464 } 464 }
465 mBRdisabled = true; 465 mBRdisabled = true;
466 } else { 466 } else {
467 if ( mBRdisabled ) { 467 if ( mBRdisabled ) {
468 mBRdisabled = false; 468 mBRdisabled = false;
469 //toggleBeamReceive( ); 469 //toggleBeamReceive( );
470 } 470 }
471 } 471 }
472#endif 472#endif
@@ -505,129 +505,129 @@ void KABCore::restoreSettings()
505 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 505 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
506 if ( splitterSize.count() == 0 ) { 506 if ( splitterSize.count() == 0 ) {
507 splitterSize.append( width() / 2 ); 507 splitterSize.append( width() / 2 );
508 splitterSize.append( width() / 2 ); 508 splitterSize.append( width() / 2 );
509 } 509 }
510 mMiniSplitter->setSizes( splitterSize ); 510 mMiniSplitter->setSizes( splitterSize );
511 if ( mExtensionBarSplitter ) { 511 if ( mExtensionBarSplitter ) {
512 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 512 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
513 if ( splitterSize.count() == 0 ) { 513 if ( splitterSize.count() == 0 ) {
514 splitterSize.append( width() / 2 ); 514 splitterSize.append( width() / 2 );
515 splitterSize.append( width() / 2 ); 515 splitterSize.append( width() / 2 );
516 } 516 }
517 mExtensionBarSplitter->setSizes( splitterSize ); 517 mExtensionBarSplitter->setSizes( splitterSize );
518 518
519 } 519 }
520*/ 520*/
521 mViewManager->restoreSettings(); 521 mViewManager->restoreSettings();
522 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 522 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
523 mExtensionManager->restoreSettings(); 523 mExtensionManager->restoreSettings();
524#ifdef DESKTOP_VERSION 524#ifdef DESKTOP_VERSION
525 int wid = width(); 525 int wid = width();
526 if ( wid < 10 ) 526 if ( wid < 10 )
527 wid = 400; 527 wid = 400;
528#else 528#else
529 int wid = QApplication::desktop()->width(); 529 int wid = QApplication::desktop()->width();
530 if ( wid < 640 ) 530 if ( wid < 640 )
531 wid = QApplication::desktop()->height(); 531 wid = QApplication::desktop()->height();
532#endif 532#endif
533 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 533 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
534 if ( true /*splitterSize.count() == 0*/ ) { 534 if ( true /*splitterSize.count() == 0*/ ) {
535 splitterSize.append( wid / 2 ); 535 splitterSize.append( wid / 2 );
536 splitterSize.append( wid / 2 ); 536 splitterSize.append( wid / 2 );
537 } 537 }
538 mMiniSplitter->setSizes( splitterSize ); 538 mMiniSplitter->setSizes( splitterSize );
539 if ( mExtensionBarSplitter ) { 539 if ( mExtensionBarSplitter ) {
540 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 540 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
541 if ( true /*splitterSize.count() == 0*/ ) { 541 if ( true /*splitterSize.count() == 0*/ ) {
542 splitterSize.append( wid / 2 ); 542 splitterSize.append( wid / 2 );
543 splitterSize.append( wid / 2 ); 543 splitterSize.append( wid / 2 );
544 } 544 }
545 mExtensionBarSplitter->setSizes( splitterSize ); 545 mExtensionBarSplitter->setSizes( splitterSize );
546 546
547 } 547 }
548 548
549 549
550} 550}
551 551
552void KABCore::saveSettings() 552void KABCore::saveSettings()
553{ 553{
554 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 554 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
555 if ( mExtensionBarSplitter ) 555 if ( mExtensionBarSplitter )
556 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 556 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
557 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 557 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
558 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 558 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
559#ifndef KAB_EMBEDDED 559#ifndef KAB_EMBEDDED
560 560
561 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 561 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
562 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 562 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
563#endif //KAB_EMBEDDED 563#endif //KAB_EMBEDDED
564 mExtensionManager->saveSettings(); 564 mExtensionManager->saveSettings();
565 mViewManager->saveSettings(); 565 mViewManager->saveSettings();
566 566
567 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 567 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
568 KABPrefs::instance()->writeConfig(); 568 KABPrefs::instance()->writeConfig();
569 qDebug("KABPrefs::instance()->writeConfig() "); 569 qDebug("KABCore::saveSettings() ");
570} 570}
571 571
572KABC::AddressBook *KABCore::addressBook() const 572KABC::AddressBook *KABCore::addressBook() const
573{ 573{
574 return mAddressBook; 574 return mAddressBook;
575} 575}
576 576
577KConfig *KABCore::config() 577KConfig *KABCore::config()
578{ 578{
579#ifndef KAB_EMBEDDED 579#ifndef KAB_EMBEDDED
580 return KABPrefs::instance()->config(); 580 return KABPrefs::instance()->config();
581#else //KAB_EMBEDDED 581#else //KAB_EMBEDDED
582 return KABPrefs::instance()->getConfig(); 582 return KABPrefs::instance()->getConfig();
583#endif //KAB_EMBEDDED 583#endif //KAB_EMBEDDED
584} 584}
585 585
586KActionCollection *KABCore::actionCollection() const 586KActionCollection *KABCore::actionCollection() const
587{ 587{
588 return mGUIClient->actionCollection(); 588 return mGUIClient->actionCollection();
589} 589}
590 590
591KABC::Field *KABCore::currentSearchField() const 591KABC::Field *KABCore::currentSearchField() const
592{ 592{
593 if (mIncSearchWidget) 593 if (mIncSearchWidget)
594 return mIncSearchWidget->currentField(); 594 return mIncSearchWidget->currentField();
595 else 595 else
596 return 0; 596 return 0;
597} 597}
598 598
599QStringList KABCore::selectedUIDs() const 599QStringList KABCore::selectedUIDs() const
600{ 600{
601 return mViewManager->selectedUids(); 601 return mViewManager->selectedUids();
602} 602}
603 603
604KABC::Resource *KABCore::requestResource( QWidget *parent ) 604KABC::Resource *KABCore::requestResource( QWidget *parent )
605{ 605{
606 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 606 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
607 607
608 QPtrList<KRES::Resource> kresResources; 608 QPtrList<KRES::Resource> kresResources;
609 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 609 QPtrListIterator<KABC::Resource> resIt( kabcResources );
610 KABC::Resource *resource; 610 KABC::Resource *resource;
611 while ( ( resource = resIt.current() ) != 0 ) { 611 while ( ( resource = resIt.current() ) != 0 ) {
612 ++resIt; 612 ++resIt;
613 if ( !resource->readOnly() ) { 613 if ( !resource->readOnly() ) {
614 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 614 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
615 if ( res ) 615 if ( res )
616 kresResources.append( res ); 616 kresResources.append( res );
617 } 617 }
618 } 618 }
619 619
620 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 620 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
621 return static_cast<KABC::Resource*>( res ); 621 return static_cast<KABC::Resource*>( res );
622} 622}
623 623
624#ifndef KAB_EMBEDDED 624#ifndef KAB_EMBEDDED
625KAboutData *KABCore::createAboutData() 625KAboutData *KABCore::createAboutData()
626#else //KAB_EMBEDDED 626#else //KAB_EMBEDDED
627void KABCore::createAboutData() 627void KABCore::createAboutData()
628#endif //KAB_EMBEDDED 628#endif //KAB_EMBEDDED
629{ 629{
630#ifndef KAB_EMBEDDED 630#ifndef KAB_EMBEDDED
631 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 631 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
632 "3.1", I18N_NOOP( "The KDE Address Book" ), 632 "3.1", I18N_NOOP( "The KDE Address Book" ),
633 KAboutData::License_GPL_V2, 633 KAboutData::License_GPL_V2,
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 4be860e..04759a7 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -143,208 +143,212 @@ void ViewManager::saveSettings()
143 KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); 143 KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
144 144
145 // write the view name list 145 // write the view name list
146 KABPrefs::instance()->mViewNames = mViewNameList; 146 KABPrefs::instance()->mViewNames = mViewNameList;
147 KABPrefs::instance()->mCurrentView = mActiveView->caption(); 147 KABPrefs::instance()->mCurrentView = mActiveView->caption();
148 148
149} 149}
150 150
151QStringList ViewManager::selectedUids() const 151QStringList ViewManager::selectedUids() const
152{ 152{
153 if ( mActiveView ) 153 if ( mActiveView )
154 return mActiveView->selectedUids(); 154 return mActiveView->selectedUids();
155 else 155 else
156 return QStringList(); 156 return QStringList();
157} 157}
158 158
159QStringList ViewManager::selectedEmails() const 159QStringList ViewManager::selectedEmails() const
160{ 160{
161 if ( mActiveView ) 161 if ( mActiveView )
162 return mActiveView->selectedEmails(); 162 return mActiveView->selectedEmails();
163 else 163 else
164 return QStringList(); 164 return QStringList();
165} 165}
166 166
167KABC::Addressee::List ViewManager::selectedAddressees() const 167KABC::Addressee::List ViewManager::selectedAddressees() const
168{ 168{
169 KABC::Addressee::List list; 169 KABC::Addressee::List list;
170 if ( mActiveView ) { 170 if ( mActiveView ) {
171 QStringList uids = mActiveView->selectedUids(); 171 QStringList uids = mActiveView->selectedUids();
172 QStringList::Iterator it; 172 QStringList::Iterator it;
173 for ( it = uids.begin(); it != uids.end(); ++it ) { 173 for ( it = uids.begin(); it != uids.end(); ++it ) {
174 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 174 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
175 if ( !addr.isEmpty() ) 175 if ( !addr.isEmpty() )
176 list.append( addr ); 176 list.append( addr );
177 } 177 }
178 } 178 }
179 179
180 return list; 180 return list;
181} 181}
182//US added another method with no parameter, since my moc compiler does not support default parameters. 182//US added another method with no parameter, since my moc compiler does not support default parameters.
183void ViewManager::setSelected() 183void ViewManager::setSelected()
184{ 184{
185 setSelected( QString::null, true ); 185 setSelected( QString::null, true );
186} 186}
187 187
188void ViewManager::setSelected( const QString &uid, bool selected ) 188void ViewManager::setSelected( const QString &uid, bool selected )
189{ 189{
190 if ( mActiveView ) 190 if ( mActiveView )
191 mActiveView->setSelected( uid, selected ); 191 mActiveView->setSelected( uid, selected );
192} 192}
193 193
194void ViewManager::setListSelected(QStringList list) 194void ViewManager::setListSelected(QStringList list)
195{ 195{
196 int i, count = list.count(); 196 int i, count = list.count();
197 for ( i = 0; i < count;++i ) 197 for ( i = 0; i < count;++i )
198 setSelected( list[i], true ); 198 setSelected( list[i], true );
199 199
200} 200}
201void ViewManager::unloadViews() 201void ViewManager::unloadViews()
202{ 202{
203 mViewDict.clear(); 203 mViewDict.clear();
204 mActiveView = 0; 204 mActiveView = 0;
205} 205}
206 206
207void ViewManager::selectView( const QString &name )
208{
209 setActiveView( name );
210 mCore->saveSettings();
211}
207void ViewManager::setActiveView( const QString &name ) 212void ViewManager::setActiveView( const QString &name )
208{ 213{
209 KAddressBookView *view = 0; 214 KAddressBookView *view = 0;
210 215
211 // Check that this isn't the same as the current active view 216 // Check that this isn't the same as the current active view
212 if ( mActiveView && ( mActiveView->caption() == name ) ) 217 if ( mActiveView && ( mActiveView->caption() == name ) )
213 return; 218 return;
214 219
215 // At this point we know the view that should be active is not 220 // At this point we know the view that should be active is not
216 // currently active. We will try to find the new on in the list. If 221 // currently active. We will try to find the new on in the list. If
217 // we can't find it, it means it hasn't been instantiated, so we will 222 // we can't find it, it means it hasn't been instantiated, so we will
218 // create it on demand. 223 // create it on demand.
219 224
220 view = mViewDict.find( name ); 225 view = mViewDict.find( name );
221 226
222 // Check if we found the view. If we didn't, then we need to create it 227 // Check if we found the view. If we didn't, then we need to create it
223 if ( view == 0 ) { 228 if ( view == 0 ) {
224 KConfig *config = mCore->config(); 229 KConfig *config = mCore->config();
225 230
226 KConfigGroupSaver saver( config, name ); 231 KConfigGroupSaver saver( config, name );
227 232
228 QString type = config->readEntry( "Type", "Table" ); 233 QString type = config->readEntry( "Type", "Table" );
229 234
230 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; 235 kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl;
231 236
232 ViewFactory *factory = mViewFactoryDict.find( type ); 237 ViewFactory *factory = mViewFactoryDict.find( type );
233 if ( factory ) 238 if ( factory )
234 view = factory->view( mCore->addressBook(), mViewWidgetStack ); 239 view = factory->view( mCore->addressBook(), mViewWidgetStack );
235 240
236 if ( view ) { 241 if ( view ) {
237 view->setCaption( name ); 242 view->setCaption( name );
238 mViewDict.insert( name, view ); 243 mViewDict.insert( name, view );
239//US my version needs an int as second parameter to addWidget 244//US my version needs an int as second parameter to addWidget
240 mViewWidgetStack->addWidget( view, -1 ); 245 mViewWidgetStack->addWidget( view, -1 );
241 view->readConfig( config ); 246 view->readConfig( config );
242 247
243 // The manager just relays the signals 248 // The manager just relays the signals
244 connect( view, SIGNAL( selected( const QString& ) ), 249 connect( view, SIGNAL( selected( const QString& ) ),
245 SIGNAL( selected( const QString & ) ) ); 250 SIGNAL( selected( const QString & ) ) );
246 connect( view, SIGNAL( executed( const QString& ) ), 251 connect( view, SIGNAL( executed( const QString& ) ),
247 SIGNAL( executed( const QString& ) ) ); 252 SIGNAL( executed( const QString& ) ) );
248 253
249 connect( view, SIGNAL( deleteRequest( ) ), 254 connect( view, SIGNAL( deleteRequest( ) ),
250 SIGNAL( deleteRequest( ) ) ); 255 SIGNAL( deleteRequest( ) ) );
251 256
252 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); 257 connect( view, SIGNAL( modified() ), SIGNAL( modified() ) );
253 connect( view, SIGNAL( dropped( QDropEvent* ) ), 258 connect( view, SIGNAL( dropped( QDropEvent* ) ),
254 SLOT( dropped( QDropEvent* ) ) ); 259 SLOT( dropped( QDropEvent* ) ) );
255 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); 260 connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) );
256 } 261 }
257 } 262 }
258 263
259 // If we found or created the view, raise it and refresh it 264 // If we found or created the view, raise it and refresh it
260 if ( view ) { 265 if ( view ) {
261 mActiveView = view; 266 mActiveView = view;
262 mViewWidgetStack->raiseWidget( view ); 267 mViewWidgetStack->raiseWidget( view );
263 // Set the proper filter in the view. By setting the combo 268 // Set the proper filter in the view. By setting the combo
264 // box, the activated slot will be called, which will push 269 // box, the activated slot will be called, which will push
265 // the filter to the view and refresh it. 270 // the filter to the view and refresh it.
266 271
267 if ( view->defaultFilterType() == KAddressBookView::None ) { 272 if ( view->defaultFilterType() == KAddressBookView::None ) {
268 273
269 mActionSelectFilter->setCurrentItem( 0 ); 274 mActionSelectFilter->setCurrentItem( 0 );
270 setActiveFilter( 0 ); 275 setActiveFilter( 0 );
271 } else if ( view->defaultFilterType() == KAddressBookView::Active ) { 276 } else if ( view->defaultFilterType() == KAddressBookView::Active ) {
272 setActiveFilter( mActionSelectFilter->currentItem() ); 277 setActiveFilter( mActionSelectFilter->currentItem() );
273 } else { 278 } else {
274 uint pos = filterPosition( view->defaultFilterName() ); 279 uint pos = filterPosition( view->defaultFilterName() );
275 mActionSelectFilter->setCurrentItem( pos ); 280 mActionSelectFilter->setCurrentItem( pos );
276 setActiveFilter( pos ); 281 setActiveFilter( pos );
277 } 282 }
278//US qDebug("ViewManager::setActiveView 6" ); 283//US qDebug("ViewManager::setActiveView 6" );
279 284
280 // Update the inc search widget to show the fields in the new active 285 // Update the inc search widget to show the fields in the new active
281 // view. 286 // view.
282 mCore->setSearchFields( mActiveView->fields() ); 287 mCore->setSearchFields( mActiveView->fields() );
283 288
284//US performance optimization. setActiveFilter calls also mActiveView->refresh() 289//US performance optimization. setActiveFilter calls also mActiveView->refresh()
285//US mActiveView->refresh(); 290//US mActiveView->refresh();
286 mCore->saveSettings();
287 } 291 }
288 else 292 else
289 { 293 {
290 qDebug("ViewManager::setActiveView: unable to find view" ); 294 qDebug("ViewManager::setActiveView: unable to find view" );
291 } 295 }
292} 296}
293 297
294//US added another method with no parameter, since my moc compiler does not support default parameters. 298//US added another method with no parameter, since my moc compiler does not support default parameters.
295void ViewManager::refreshView() 299void ViewManager::refreshView()
296{ 300{
297 refreshView( QString::null ); 301 refreshView( QString::null );
298} 302}
299 303
300void ViewManager::refreshView( const QString &uid ) 304void ViewManager::refreshView( const QString &uid )
301{ 305{
302 if ( mActiveView ) 306 if ( mActiveView )
303 mActiveView->refresh( uid ); 307 mActiveView->refresh( uid );
304} 308}
305 309
306void ViewManager::setFocusAV() 310void ViewManager::setFocusAV()
307{ 311{
308 if ( mActiveView ) 312 if ( mActiveView )
309 mActiveView->setFocusAV(); 313 mActiveView->setFocusAV();
310} 314}
311void ViewManager::editView() 315void ViewManager::editView()
312{ 316{
313 if ( !mActiveView ) 317 if ( !mActiveView )
314 return; 318 return;
315 319
316 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); 320 ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() );
317 ViewConfigureWidget *wdg = 0; 321 ViewConfigureWidget *wdg = 0;
318 ViewConfigureDialog* dlg = 0; 322 ViewConfigureDialog* dlg = 0;
319 if ( factory ) { 323 if ( factory ) {
320 // Save the filters so the dialog has the latest set 324 // Save the filters so the dialog has the latest set
321 Filter::save( mCore->config(), "Filter", mFilterList ); 325 Filter::save( mCore->config(), "Filter", mFilterList );
322 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); 326 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" );
323 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); 327 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" );
324 } else { 328 } else {
325 qDebug("ViewManager::editView()::cannot find viewfactory "); 329 qDebug("ViewManager::editView()::cannot find viewfactory ");
326 return; 330 return;
327 } 331 }
328 if ( wdg ) { 332 if ( wdg ) {
329 dlg->setWidget( wdg ); 333 dlg->setWidget( wdg );
330 334
331#ifndef DESKTOP_VERSION 335#ifndef DESKTOP_VERSION
332 //dlg.setMaximumSize( 640, 480 ); 336 //dlg.setMaximumSize( 640, 480 );
333 //dlg->setGeometry( 40,40, 400, 300); 337 //dlg->setGeometry( 40,40, 400, 300);
334 dlg->showMaximized(); 338 dlg->showMaximized();
335#endif 339#endif
336 340
337 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); 341 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() );
338 342
339 dlg->restoreSettings( mCore->config() ); 343 dlg->restoreSettings( mCore->config() );
340 344
341 if ( dlg->exec() ) { 345 if ( dlg->exec() ) {
342 dlg->saveSettings( mCore->config() ); 346 dlg->saveSettings( mCore->config() );
343 mActiveView->readConfig( mCore->config() ); 347 mActiveView->readConfig( mCore->config() );
344 348
345 // Set the proper filter in the view. By setting the combo 349 // Set the proper filter in the view. By setting the combo
346 // box, the activated slot will be called, which will push 350 // box, the activated slot will be called, which will push
347 // the filter to the view and refresh it. 351 // the filter to the view and refresh it.
348 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { 352 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) {
349 mActionSelectFilter->setCurrentItem( 0 ); 353 mActionSelectFilter->setCurrentItem( 0 );
350 setActiveFilter( 0 ); 354 setActiveFilter( 0 );
@@ -428,129 +432,128 @@ void ViewManager::addView()
428 KConfig *config = mCore->config(); 432 KConfig *config = mCore->config();
429 433
430 config->deleteGroup( newName ); 434 config->deleteGroup( newName );
431 435
432 KConfigGroupSaver saver( config, newName ); 436 KConfigGroupSaver saver( config, newName );
433 437
434 config->writeEntry( "Type", type ); 438 config->writeEntry( "Type", type );
435 439
436 // try to set the active view 440 // try to set the active view
437 mActionSelectView->setItems( mViewNameList ); 441 mActionSelectView->setItems( mViewNameList );
438 mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) ); 442 mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) );
439 setActiveView( newName ); 443 setActiveView( newName );
440 444
441 editView(); 445 editView();
442 446
443 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 447 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
444 } 448 }
445} 449}
446 450
447void ViewManager::createViewFactories() 451void ViewManager::createViewFactories()
448{ 452{
449#ifndef KAB_EMBEDDED 453#ifndef KAB_EMBEDDED
450 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" ); 454 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" );
451 KTrader::OfferList::ConstIterator it; 455 KTrader::OfferList::ConstIterator it;
452 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 456 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
453 if ( !(*it)->hasServiceType( "KAddressBook/View" ) ) 457 if ( !(*it)->hasServiceType( "KAddressBook/View" ) )
454 continue; 458 continue;
455 459
456 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); 460 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
457 461
458 if ( !factory ) { 462 if ( !factory ) {
459 kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl; 463 kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl;
460 continue; 464 continue;
461 } 465 }
462 466
463 ViewFactory *viewFactory = static_cast<ViewFactory*>( factory ); 467 ViewFactory *viewFactory = static_cast<ViewFactory*>( factory );
464 468
465 if ( !viewFactory ) { 469 if ( !viewFactory ) {
466 kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl; 470 kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl;
467 continue; 471 continue;
468 } 472 }
469 473
470 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 474 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
471 } 475 }
472 476
473#else //KAB_EMBEDDED 477#else //KAB_EMBEDDED
474 ViewFactory* viewFactory = new IconViewFactory(); 478 ViewFactory* viewFactory = new IconViewFactory();
475 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 479 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
476// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 480// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
477 481
478 viewFactory = new TableViewFactory(); 482 viewFactory = new TableViewFactory();
479 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 483 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
480// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 484// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
481 485
482 viewFactory = new CardViewFactory(); 486 viewFactory = new CardViewFactory();
483 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 487 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
484// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 488// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
485 489
486#endif //KAB_EMBEDDED 490#endif //KAB_EMBEDDED
487 491
488} 492}
489 493
490void ViewManager::dropped( QDropEvent *e ) 494void ViewManager::dropped( QDropEvent *e )
491{ 495{
492 kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl;
493 496
494#ifndef KAB_EMBEDDED 497#ifndef KAB_EMBEDDED
495 498
496 QString clipText, vcards; 499 QString clipText, vcards;
497 KURL::List urls; 500 KURL::List urls;
498 501
499 if ( KURLDrag::decode( e, urls) ) { 502 if ( KURLDrag::decode( e, urls) ) {
500 KURL::List::Iterator it = urls.begin(); 503 KURL::List::Iterator it = urls.begin();
501 int c = urls.count(); 504 int c = urls.count();
502 if ( c > 1 ) { 505 if ( c > 1 ) {
503 QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); 506 QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c );
504 if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { 507 if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) {
505 for ( ; it != urls.end(); ++it ) 508 for ( ; it != urls.end(); ++it )
506 emit urlDropped( *it ); 509 emit urlDropped( *it );
507 } 510 }
508 } else if ( c == 1 ) 511 } else if ( c == 1 )
509 emit urlDropped( *it ); 512 emit urlDropped( *it );
510 } else if ( KVCardDrag::decode( e, vcards ) ) { 513 } else if ( KVCardDrag::decode( e, vcards ) ) {
511 KABC::Addressee addr; 514 KABC::Addressee addr;
512 KABC::VCardConverter converter; 515 KABC::VCardConverter converter;
513 QStringList list = QStringList::split( "\r\n\r\n", vcards ); 516 QStringList list = QStringList::split( "\r\n\r\n", vcards );
514 QStringList::Iterator it; 517 QStringList::Iterator it;
515 for ( it = list.begin(); it != list.end(); ++it ) { 518 for ( it = list.begin(); it != list.end(); ++it ) {
516 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { 519 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) {
517 KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); 520 KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() );
518 if ( a.isEmpty() ) { 521 if ( a.isEmpty() ) {
519 mCore->addressBook()->insertAddressee( addr ); 522 mCore->addressBook()->insertAddressee( addr );
520 emit modified(); 523 emit modified();
521 } 524 }
522 } 525 }
523 } 526 }
524 527
525 mActiveView->refresh(); 528 mActiveView->refresh();
526 } 529 }
527#else //KAB_EMBEDDED 530#else //KAB_EMBEDDED
528qDebug("ViewManager::dropped() has to be changed!!" ); 531qDebug("ViewManager::dropped() has to be changed!!" );
529#endif //KAB_EMBEDDED 532#endif //KAB_EMBEDDED
530 533
531} 534}
532 535
533void ViewManager::startDrag() 536void ViewManager::startDrag()
534{ 537{
535 kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; 538 kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;
536 539
537#ifndef KAB_EMBEDDED 540#ifndef KAB_EMBEDDED
538 541
539 // Get the list of all the selected addressees 542 // Get the list of all the selected addressees
540 KABC::Addressee::List addrList; 543 KABC::Addressee::List addrList;
541 QStringList uidList = selectedUids(); 544 QStringList uidList = selectedUids();
542 QStringList::Iterator iter; 545 QStringList::Iterator iter;
543 for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) 546 for ( iter = uidList.begin(); iter != uidList.end(); ++iter )
544 addrList.append( mCore->addressBook()->findByUid( *iter ) ); 547 addrList.append( mCore->addressBook()->findByUid( *iter ) );
545 548
546 KMultipleDrag *drag = new KMultipleDrag( this ); 549 KMultipleDrag *drag = new KMultipleDrag( this );
547 drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); 550 drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) );
548 KABC::Addressee::List::Iterator it; 551 KABC::Addressee::List::Iterator it;
549 QStringList vcards; 552 QStringList vcards;
550 for ( it = addrList.begin(); it != addrList.end(); ++it ) { 553 for ( it = addrList.begin(); it != addrList.end(); ++it ) {
551 QString vcard = QString::null; 554 QString vcard = QString::null;
552 KABC::VCardConverter converter; 555 KABC::VCardConverter converter;
553 if ( converter.addresseeToVCard( *it, vcard ) ) 556 if ( converter.addresseeToVCard( *it, vcard ) )
554 vcards.append( vcard ); 557 vcards.append( vcard );
555 } 558 }
556 drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); 559 drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) );
@@ -594,129 +597,129 @@ void ViewManager::configureFilters()
594 dlg.setFilters( mFilterList ); 597 dlg.setFilters( mFilterList );
595 598
596 if ( dlg.exec() ) 599 if ( dlg.exec() )
597 mFilterList = dlg.filters(); 600 mFilterList = dlg.filters();
598 601
599 uint pos = mActionSelectFilter->currentItem(); 602 uint pos = mActionSelectFilter->currentItem();
600 mActionSelectFilter->setItems( filterNames() ); 603 mActionSelectFilter->setItems( filterNames() );
601 mActionSelectFilter->setCurrentItem( pos ); 604 mActionSelectFilter->setCurrentItem( pos );
602 setActiveFilter( pos ); 605 setActiveFilter( pos );
603 int cw = 150; 606 int cw = 150;
604 if (QApplication::desktop()->width() == 480 ) 607 if (QApplication::desktop()->width() == 480 )
605 cw = 0; 608 cw = 0;
606 mActionSelectFilter->setComboWidth( cw ); 609 mActionSelectFilter->setComboWidth( cw );
607 saveSettings(); 610 saveSettings();
608} 611}
609 612
610QStringList ViewManager::filterNames() const 613QStringList ViewManager::filterNames() const
611{ 614{
612 QStringList names( i18n( "No Filter" ) ); 615 QStringList names( i18n( "No Filter" ) );
613 616
614 Filter::List::ConstIterator it; 617 Filter::List::ConstIterator it;
615 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 618 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
616 names.append( (*it).name() ); 619 names.append( (*it).name() );
617 620
618 return names; 621 return names;
619} 622}
620Filter ViewManager::getFilterByName( const QString &name ) const 623Filter ViewManager::getFilterByName( const QString &name ) const
621{ 624{
622 Filter::List::ConstIterator it; 625 Filter::List::ConstIterator it;
623 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 626 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
624 if ( name == (*it).name() ) 627 if ( name == (*it).name() )
625 return (*it); 628 return (*it);
626 629
627 return Filter(); 630 return Filter();
628} 631}
629 632
630int ViewManager::filterPosition( const QString &name ) const 633int ViewManager::filterPosition( const QString &name ) const
631{ 634{
632 int pos = 0; 635 int pos = 0;
633 636
634 Filter::List::ConstIterator it; 637 Filter::List::ConstIterator it;
635 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) 638 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
636 if ( name == (*it).name() ) 639 if ( name == (*it).name() )
637 return pos + 1; 640 return pos + 1;
638 641
639 return 0; 642 return 0;
640} 643}
641 644
642void ViewManager::initActions() 645void ViewManager::initActions()
643{ 646{
644//US <ActionList name="view_loadedviews"/> 647//US <ActionList name="view_loadedviews"/>
645//US <Separator/> 648//US <Separator/>
646 649
647#ifdef KAB_EMBEDDED 650#ifdef KAB_EMBEDDED
648 QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); 651 QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
649 QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); 652 QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
650 QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); 653 QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
651#endif //KAB_EMBEDDED 654#endif //KAB_EMBEDDED
652 655
653 mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); 656 mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
654#if KDE_VERSION >= 309 657#if KDE_VERSION >= 309
655 mActionSelectView->setMenuAccelsEnabled( false ); 658 mActionSelectView->setMenuAccelsEnabled( false );
656#endif 659#endif
657 connect( mActionSelectView, SIGNAL( activated( const QString& ) ), 660 connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
658 SLOT( setActiveView( const QString& ) ) ); 661 SLOT( selectView( const QString& ) ) );
659 662
660 663
661#ifdef KAB_EMBEDDED 664#ifdef KAB_EMBEDDED
662 mActionSelectView->plug(viewmenu); 665 mActionSelectView->plug(viewmenu);
663 viewmenu->insertSeparator(); 666 viewmenu->insertSeparator();
664#endif //KAB_EMBEDDED 667#endif //KAB_EMBEDDED
665 668
666 KAction *action; 669 KAction *action;
667 670
668 action = new KAction( i18n( "Modify View..." ), "configure", 0, this, 671 action = new KAction( i18n( "Modify View..." ), "configure", 0, this,
669 SLOT( editView() ), mCore->actionCollection(), "view_modify" ); 672 SLOT( editView() ), mCore->actionCollection(), "view_modify" );
670#ifndef KAB_EMBEDDED 673#ifndef KAB_EMBEDDED
671 action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); 674 action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) );
672#else //KAB_EMBEDDED 675#else //KAB_EMBEDDED
673 action->plug(viewmenu); 676 action->plug(viewmenu);
674#endif //KAB_EMBEDDED 677#endif //KAB_EMBEDDED
675 678
676 action = new KAction( i18n( "Add View..." ), "window_new", 0, this, 679 action = new KAction( i18n( "Add View..." ), "window_new", 0, this,
677 SLOT( addView() ), mCore->actionCollection(), "view_add" ); 680 SLOT( addView() ), mCore->actionCollection(), "view_add" );
678#ifndef KAB_EMBEDDED 681#ifndef KAB_EMBEDDED
679 action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); 682 action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) );
680#else //KAB_EMBEDDED 683#else //KAB_EMBEDDED
681 action->plug(viewmenu); 684 action->plug(viewmenu);
682#endif //KAB_EMBEDDED 685#endif //KAB_EMBEDDED
683 686
684 mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, 687 mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0,
685 this, SLOT( deleteView() ), 688 this, SLOT( deleteView() ),
686 mCore->actionCollection(), "view_delete" ); 689 mCore->actionCollection(), "view_delete" );
687#ifndef KAB_EMBEDDED 690#ifndef KAB_EMBEDDED
688 mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); 691 mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) );
689#else //KAB_EMBEDDED 692#else //KAB_EMBEDDED
690 mActionDeleteView->plug(viewmenu); 693 mActionDeleteView->plug(viewmenu);
691 viewmenu->insertSeparator(); 694 viewmenu->insertSeparator();
692#endif //KAB_EMBEDDED 695#endif //KAB_EMBEDDED
693 696
694#ifndef KAB_EMBEDDED 697#ifndef KAB_EMBEDDED
695 action = new KAction( i18n( "Refresh View" ), "reload", 0, this, 698 action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
696 SLOT( refreshView(const QString &) ), mCore->actionCollection(), 699 SLOT( refreshView(const QString &) ), mCore->actionCollection(),
697 "view_refresh" ); 700 "view_refresh" );
698 action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); 701 action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) );
699#else //KAB_EMBEDDED 702#else //KAB_EMBEDDED
700 action = new KAction( i18n( "Refresh View" ), "reload", 0, this, 703 action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
701 SLOT( refreshView()), mCore->actionCollection(), 704 SLOT( refreshView()), mCore->actionCollection(),
702 "view_refresh" ); 705 "view_refresh" );
703 action->plug(viewmenu); 706 action->plug(viewmenu);
704 viewmenu->insertSeparator(); 707 viewmenu->insertSeparator();
705#endif //KAB_EMBEDDED 708#endif //KAB_EMBEDDED
706 709
707 action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, 710 action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this,
708 SLOT( configureFilters() ), mCore->actionCollection(), 711 SLOT( configureFilters() ), mCore->actionCollection(),
709 "options_edit_filters" ); 712 "options_edit_filters" );
710 713
711 mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); 714 mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" );
712#if KDE_VERSION >= 309 715#if KDE_VERSION >= 309
713 mActionSelectFilter->setMenuAccelsEnabled( false ); 716 mActionSelectFilter->setMenuAccelsEnabled( false );
714#endif 717#endif
715 connect( mActionSelectFilter, SIGNAL( activated( int ) ), 718 connect( mActionSelectFilter, SIGNAL( activated( int ) ),
716 SLOT( setActiveFilter( int ) ) ); 719 SLOT( setActiveFilter( int ) ) );
717 720
718#ifdef KAB_EMBEDDED 721#ifdef KAB_EMBEDDED
719 action->plug(settingsmenu); 722 action->plug(settingsmenu);
720 mActionSelectFilter->plug(viewmenu); 723 mActionSelectFilter->plug(viewmenu);
721#endif //KAB_EMBEDDED 724#endif //KAB_EMBEDDED
722 725
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h
index dff9998..ab5d372 100644
--- a/kaddressbook/viewmanager.h
+++ b/kaddressbook/viewmanager.h
@@ -65,96 +65,97 @@ class ViewManager : public QWidget
65 QStringList selectedUids() const; 65 QStringList selectedUids() const;
66 QStringList selectedEmails() const; 66 QStringList selectedEmails() const;
67 KABC::Addressee::List selectedAddressees() const; 67 KABC::Addressee::List selectedAddressees() const;
68 void setListSelected(QStringList); 68 void setListSelected(QStringList);
69 void setFocusAV(); 69 void setFocusAV();
70 70
71 public slots: 71 public slots:
72 void printView() { if (mActiveView) mActiveView->printMyView() ;} 72 void printView() { if (mActiveView) mActiveView->printMyView() ;}
73 void scrollUP(); 73 void scrollUP();
74 void scrollDOWN(); 74 void scrollDOWN();
75 75
76//US void setSelected( const QString &uid = QString::null, bool selected = true ); 76//US void setSelected( const QString &uid = QString::null, bool selected = true );
77 void setSelected( const QString &uid, bool); 77 void setSelected( const QString &uid, bool);
78//US added another method with no parameter, since my moc compiler does not support default parameters. 78//US added another method with no parameter, since my moc compiler does not support default parameters.
79 void setSelected(); 79 void setSelected();
80 80
81 81
82 82
83//US added another method with no parameter, since my moc compiler does not support default parameters. 83//US added another method with no parameter, since my moc compiler does not support default parameters.
84 void refreshView(); 84 void refreshView();
85 void refreshView( const QString &uid); 85 void refreshView( const QString &uid);
86 86
87 void editView(); 87 void editView();
88 void deleteView(); 88 void deleteView();
89 void addView(); 89 void addView();
90 90
91 protected slots: 91 protected slots:
92 /** 92 /**
93 Called whenever the user drops something in the active view. 93 Called whenever the user drops something in the active view.
94 This method will try to decode what was dropped, and if it was 94 This method will try to decode what was dropped, and if it was
95 a valid addressee, add it to the addressbook. 95 a valid addressee, add it to the addressbook.
96 */ 96 */
97 void dropped( QDropEvent* ); 97 void dropped( QDropEvent* );
98 98
99 /** 99 /**
100 Called whenever the user attempts to start a drag in the view. 100 Called whenever the user attempts to start a drag in the view.
101 This method will convert all the selected addressees into text (vcard) 101 This method will convert all the selected addressees into text (vcard)
102 and create a drag object. 102 and create a drag object.
103 */ 103 */
104 void startDrag(); 104 void startDrag();
105 105
106 signals: 106 signals:
107 /** 107 /**
108 Emitted whenever the user selects an entry in the view. 108 Emitted whenever the user selects an entry in the view.
109 */ 109 */
110 void selected( const QString &uid ); 110 void selected( const QString &uid );
111 void deleteRequest( ); 111 void deleteRequest( );
112 112
113 /** 113 /**
114 Emitted whenever the user activates an entry in the view. 114 Emitted whenever the user activates an entry in the view.
115 */ 115 */
116 void executed( const QString &uid ); 116 void executed( const QString &uid );
117 117
118 /** 118 /**
119 Emitted whenever the address book is modified in some way. 119 Emitted whenever the address book is modified in some way.
120 */ 120 */
121 void modified(); 121 void modified();
122 122
123 /** 123 /**
124 Emitted whenever a url is dragged on a view. 124 Emitted whenever a url is dragged on a view.
125 */ 125 */
126 void urlDropped( const KURL& ); 126 void urlDropped( const KURL& );
127 127
128 private slots: 128 private slots:
129 void selectView( const QString &name );
129 void setActiveView( const QString &name ); 130 void setActiveView( const QString &name );
130 void setActiveFilter( int index ); 131 void setActiveFilter( int index );
131 void configureFilters(); 132 void configureFilters();
132 133
133 private: 134 private:
134 void createViewFactories(); 135 void createViewFactories();
135 QStringList filterNames() const; 136 QStringList filterNames() const;
136 int filterPosition( const QString &name ) const; 137 int filterPosition( const QString &name ) const;
137 QStringList viewNames() const; 138 QStringList viewNames() const;
138 int viewPosition( const QString &name ) const; 139 int viewPosition( const QString &name ) const;
139 void initActions(); 140 void initActions();
140 void initGUI(); 141 void initGUI();
141 142
142 KABCore *mCore; 143 KABCore *mCore;
143 144
144 Filter mCurrentFilter; 145 Filter mCurrentFilter;
145 Filter::List mFilterList; 146 Filter::List mFilterList;
146 147
147 QDict<KAddressBookView> mViewDict; 148 QDict<KAddressBookView> mViewDict;
148 QDict<ViewFactory> mViewFactoryDict; 149 QDict<ViewFactory> mViewFactoryDict;
149 QStringList mViewNameList; 150 QStringList mViewNameList;
150 151
151 QWidgetStack *mViewWidgetStack; 152 QWidgetStack *mViewWidgetStack;
152 KAddressBookView *mActiveView; 153 KAddressBookView *mActiveView;
153 154
154 KAction *mActionDeleteView; 155 KAction *mActionDeleteView;
155 KSelectAction *mActionSelectFilter; 156 KSelectAction *mActionSelectFilter;
156 KSelectAction *mActionSelectView; 157 KSelectAction *mActionSelectView;
157 158
158}; 159};
159 160
160#endif 161#endif
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index e9226c0..1ad1728 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -1353,129 +1353,129 @@ void KToolBar::rebuildLayout()
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
1358void KToolBar::childEvent( QChildEvent *e ) 1358void 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
1395void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) 1395void 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}
1413void KToolBar::repaintMe() 1413void KToolBar::repaintMe()
1414{ 1414{
1415 setUpdatesEnabled( true ); 1415 setUpdatesEnabled( true );
1416 QToolBar::repaint( true ); 1416 QToolBar::repaint( true );
1417 qDebug(" KToolBar::repaintMe() "); 1417 //qDebug(" KToolBar::repaintMe() ");
1418} 1418}
1419 1419
1420void KToolBar::showEvent( QShowEvent *e ) 1420void KToolBar::showEvent( QShowEvent *e )
1421{ 1421{
1422 QToolBar::showEvent( e ); 1422 QToolBar::showEvent( e );
1423 rebuildLayout(); 1423 rebuildLayout();
1424} 1424}
1425 1425
1426void KToolBar::setStretchableWidget( QWidget *w ) 1426void KToolBar::setStretchableWidget( QWidget *w )
1427{ 1427{
1428 QToolBar::setStretchableWidget( w ); 1428 QToolBar::setStretchableWidget( w );
1429 stretchableWidget = w; 1429 stretchableWidget = w;
1430} 1430}
1431 1431
1432QSizePolicy KToolBar::sizePolicy() const 1432QSizePolicy KToolBar::sizePolicy() const
1433{ 1433{
1434 if ( orientation() == Horizontal ) 1434 if ( orientation() == Horizontal )
1435 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); 1435 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
1436 else 1436 else
1437 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); 1437 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
1438} 1438}
1439 1439
1440QSize KToolBar::sizeHint() const 1440QSize KToolBar::sizeHint() const
1441{ 1441{
1442 return QToolBar::sizeHint(); 1442 return QToolBar::sizeHint();
1443#if 0 1443#if 0
1444 QWidget::polish(); 1444 QWidget::polish();
1445 static int iii = 0; 1445 static int iii = 0;
1446 ++iii; 1446 ++iii;
1447 qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); 1447 qDebug("++++++++ KToolBar::sizeHint() %d ", iii );
1448 int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); 1448 int margin = static_cast<QWidget*>(ncThis)->layout()->margin();
1449 switch( barPos() ) 1449 switch( barPos() )
1450 { 1450 {
1451 case KToolBar::Top: 1451 case KToolBar::Top:
1452 case KToolBar::Bottom: 1452 case KToolBar::Bottom:
1453 for ( QWidget *w = widgets.first(); w; w =widgets.next() ) 1453 for ( QWidget *w = widgets.first(); w; w =widgets.next() )
1454 { 1454 {
1455 if ( w->inherits( "KToolBarSeparator" ) && 1455 if ( w->inherits( "KToolBarSeparator" ) &&
1456 !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) 1456 !( static_cast<KToolBarSeparator*>(w)->showLine() ) )
1457 { 1457 {
1458 minSize += QSize(6, 0); 1458 minSize += QSize(6, 0);
1459 } 1459 }
1460 else 1460 else
1461 { 1461 {
1462 QSize sh = w->sizeHint(); 1462 QSize sh = w->sizeHint();
1463 if (!sh.isValid()) 1463 if (!sh.isValid())
1464 sh = w->minimumSize(); 1464 sh = w->minimumSize();
1465 minSize = minSize.expandedTo(QSize(0, sh.height())); 1465 minSize = minSize.expandedTo(QSize(0, sh.height()));
1466 minSize += QSize(sh.width()+1, 0); 1466 minSize += QSize(sh.width()+1, 0);
1467 } 1467 }
1468 } 1468 }
1469/*US 1469/*US
1470 minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); 1470 minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0);
1471*/ 1471*/
1472 minSize += QSize(margin*2, margin*2); 1472 minSize += QSize(margin*2, margin*2);
1473 break; 1473 break;
1474 1474
1475 case KToolBar::Left: 1475 case KToolBar::Left:
1476 case KToolBar::Right: 1476 case KToolBar::Right:
1477 for ( QWidget *w = widgets.first(); w; w = widgets.next() ) 1477 for ( QWidget *w = widgets.first(); w; w = widgets.next() )
1478 { 1478 {
1479 if ( w->inherits( "KToolBarSeparator" ) && 1479 if ( w->inherits( "KToolBarSeparator" ) &&
1480 !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) 1480 !( static_cast<KToolBarSeparator*>(w)->showLine() ) )
1481 { 1481 {