summaryrefslogtreecommitdiffabout
path: root/kaddressbook/viewmanager.cpp
Unidiff
Diffstat (limited to 'kaddressbook/viewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/viewmanager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index 86f0f3d..0614d06 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -323,415 +323,415 @@ void ViewManager::editView()
323 if ( factory ) { 323 if ( factory ) {
324 // Save the filters so the dialog has the latest set 324 // Save the filters so the dialog has the latest set
325 Filter::save( mCore->config(), "Filter", mFilterList ); 325 Filter::save( mCore->config(), "Filter", mFilterList );
326 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); 326 dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" );
327 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); 327 wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" );
328 } else { 328 } else {
329 qDebug("ViewManager::editView()::cannot find viewfactory "); 329 qDebug("ViewManager::editView()::cannot find viewfactory ");
330 return; 330 return;
331 } 331 }
332 if ( wdg ) { 332 if ( wdg ) {
333 dlg->setWidget( wdg ); 333 dlg->setWidget( wdg );
334 334
335#ifndef DESKTOP_VERSION 335#ifndef DESKTOP_VERSION
336 //dlg.setMaximumSize( 640, 480 ); 336 //dlg.setMaximumSize( 640, 480 );
337 //dlg->setGeometry( 40,40, 400, 300); 337 //dlg->setGeometry( 40,40, 400, 300);
338 dlg->showMaximized(); 338 dlg->showMaximized();
339#endif 339#endif
340 340
341 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); 341 KConfigGroupSaver saver( mCore->config(), mActiveView->caption() );
342 342
343 dlg->restoreSettings( mCore->config() ); 343 dlg->restoreSettings( mCore->config() );
344 344
345 if ( dlg->exec() ) { 345 if ( dlg->exec() ) {
346 dlg->saveSettings( mCore->config() ); 346 dlg->saveSettings( mCore->config() );
347 mActiveView->readConfig( mCore->config() ); 347 mActiveView->readConfig( mCore->config() );
348 348
349 // Set the proper filter in the view. By setting the combo 349 // Set the proper filter in the view. By setting the combo
350 // box, the activated slot will be called, which will push 350 // box, the activated slot will be called, which will push
351 // the filter to the view and refresh it. 351 // the filter to the view and refresh it.
352 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { 352 if ( mActiveView->defaultFilterType() == KAddressBookView::None ) {
353 mActionSelectFilter->setCurrentItem( 0 ); 353 mActionSelectFilter->setCurrentItem( 0 );
354 setActiveFilter( 0 ); 354 setActiveFilter( 0 );
355 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { 355 } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) {
356 setActiveFilter( mActionSelectFilter->currentItem() ); 356 setActiveFilter( mActionSelectFilter->currentItem() );
357 } else { 357 } else {
358 uint pos = filterPosition( mActiveView->defaultFilterName() ); 358 uint pos = filterPosition( mActiveView->defaultFilterName() );
359 mActionSelectFilter->setCurrentItem( pos ); 359 mActionSelectFilter->setCurrentItem( pos );
360 setActiveFilter( pos ); 360 setActiveFilter( pos );
361 } 361 }
362 mCore->setSearchFields( mActiveView->fields() ); 362 mCore->setSearchFields( mActiveView->fields() );
363//US performance optimization. setActiveFilter calls also mActiveView->refresh() 363//US performance optimization. setActiveFilter calls also mActiveView->refresh()
364//US mActiveView->refresh(); 364//US mActiveView->refresh();
365 365
366 366
367 //US this is a bugfix, that we get notified if we change a views configuration 367 //US this is a bugfix, that we get notified if we change a views configuration
368 emit modified(); 368 emit modified();
369 369
370 } 370 }
371 371
372 } 372 }
373 delete dlg; 373 delete dlg;
374} 374}
375 375
376void ViewManager::deleteView() 376void ViewManager::deleteView()
377{ 377{
378 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) 378 QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" )
379 .arg( mActiveView->caption() ); 379 .arg( mActiveView->caption() );
380 QString caption = i18n( "Confirm Delete" ); 380 QString caption = i18n( "Confirm Delete" );
381 381
382 382
383 if (QMessageBox::information( this, caption, 383 if (QMessageBox::information( this, caption,
384 text, 384 text,
385 i18n("Yes!"), i18n("No"), 0, 0 ) == 0) 385 i18n("Yes!"), i18n("No"), 0, 0 ) == 0)
386 { 386 {
387 mViewNameList.remove( mActiveView->caption() ); 387 mViewNameList.remove( mActiveView->caption() );
388 388
389 // remove the view from the config file 389 // remove the view from the config file
390 KConfig *config = mCore->config(); 390 KConfig *config = mCore->config();
391 config->deleteGroup( mActiveView->caption() ); 391 config->deleteGroup( mActiveView->caption() );
392 392
393 mViewDict.remove( mActiveView->caption() ); 393 mViewDict.remove( mActiveView->caption() );
394 mActiveView = 0; 394 mActiveView = 0;
395 395
396 // we are in an invalid state now, but that should be fixed after 396 // we are in an invalid state now, but that should be fixed after
397 // we emit the signal 397 // we emit the signal
398 mActionSelectView->setItems( mViewNameList ); 398 mActionSelectView->setItems( mViewNameList );
399 if ( mViewNameList.count() > 0 ) { 399 if ( mViewNameList.count() > 0 ) {
400 mActionSelectView->setCurrentItem( 0 ); 400 mActionSelectView->setCurrentItem( 0 );
401 setActiveView( mViewNameList[ 0 ] ); 401 setActiveView( mViewNameList[ 0 ] );
402 } 402 }
403 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 403 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
404 } 404 }
405} 405}
406 406
407void ViewManager::addView() 407void ViewManager::addView()
408{ 408{
409 AddViewDialog dialog( &mViewFactoryDict, this ); 409 AddViewDialog dialog( &mViewFactoryDict, this );
410 410
411 if ( dialog.exec() ) { 411 if ( dialog.exec() ) {
412 QString newName = dialog.viewName(); 412 QString newName = dialog.viewName();
413 QString type = dialog.viewType(); 413 QString type = dialog.viewType();
414 414
415 // Check for name conflicts 415 // Check for name conflicts
416 bool firstConflict = true; 416 bool firstConflict = true;
417 int numTries = 1; 417 int numTries = 1;
418 while ( mViewNameList.contains( newName ) > 0 ) { 418 while ( mViewNameList.contains( newName ) > 0 ) {
419 if ( !firstConflict ) { 419 if ( !firstConflict ) {
420 newName = newName.left( newName.length() - 4 ); 420 newName = newName.left( newName.length() - 4 );
421 firstConflict = false; 421 firstConflict = false;
422 } 422 }
423 423
424 newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries ); 424 newName = QString( "%1 <%2>" ).arg( newName ).arg( numTries );
425 numTries++; 425 numTries++;
426 } 426 }
427 427
428 // Add the new one to the list 428 // Add the new one to the list
429 mViewNameList.append( newName ); 429 mViewNameList.append( newName );
430 430
431 // write the view to the config file, 431 // write the view to the config file,
432 KConfig *config = mCore->config(); 432 KConfig *config = mCore->config();
433 433
434 config->deleteGroup( newName ); 434 config->deleteGroup( newName );
435 435
436 KConfigGroupSaver saver( config, newName ); 436 KConfigGroupSaver saver( config, newName );
437 437
438 config->writeEntry( "Type", type ); 438 config->writeEntry( "Type", type );
439 439
440 // try to set the active view 440 // try to set the active view
441 mActionSelectView->setItems( mViewNameList ); 441 mActionSelectView->setItems( mViewNameList );
442 mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) ); 442 mActionSelectView->setCurrentItem( mViewNameList.findIndex( newName ) );
443 setActiveView( newName ); 443 setActiveView( newName );
444 444
445 editView(); 445 editView();
446 446
447 mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); 447 mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
448 } 448 }
449} 449}
450 450
451void ViewManager::createViewFactories() 451void ViewManager::createViewFactories()
452{ 452{
453#ifndef KAB_EMBEDDED 453#ifndef KAB_EMBEDDED
454 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" ); 454 KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/View" );
455 KTrader::OfferList::ConstIterator it; 455 KTrader::OfferList::ConstIterator it;
456 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 456 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
457 if ( !(*it)->hasServiceType( "KAddressBook/View" ) ) 457 if ( !(*it)->hasServiceType( "KAddressBook/View" ) )
458 continue; 458 continue;
459 459
460 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); 460 KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
461 461
462 if ( !factory ) { 462 if ( !factory ) {
463 kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl; 463 kdDebug(5720) << "ViewManager::createViewFactories(): Factory creation failed" << endl;
464 continue; 464 continue;
465 } 465 }
466 466
467 ViewFactory *viewFactory = static_cast<ViewFactory*>( factory ); 467 ViewFactory *viewFactory = static_cast<ViewFactory*>( factory );
468 468
469 if ( !viewFactory ) { 469 if ( !viewFactory ) {
470 kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl; 470 kdDebug(5720) << "ViewManager::createViewFactories(): Cast failed" << endl;
471 continue; 471 continue;
472 } 472 }
473 473
474 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 474 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
475 } 475 }
476 476
477#else //KAB_EMBEDDED 477#else //KAB_EMBEDDED
478 ViewFactory* viewFactory = new IconViewFactory(); 478 ViewFactory* viewFactory = new IconViewFactory();
479 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 479 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
480// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 480// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
481 481
482 viewFactory = new TableViewFactory(); 482 viewFactory = new TableViewFactory();
483 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 483 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
484// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 484// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
485 485
486 viewFactory = new CardViewFactory(); 486 viewFactory = new CardViewFactory();
487 mViewFactoryDict.insert( viewFactory->type(), viewFactory ); 487 mViewFactoryDict.insert( viewFactory->type(), viewFactory );
488// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); 488// qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1());
489 489
490#endif //KAB_EMBEDDED 490#endif //KAB_EMBEDDED
491 491
492} 492}
493 493
494void ViewManager::dropped( QDropEvent *e ) 494void ViewManager::dropped( QDropEvent *e )
495{ 495{
496 496
497#ifndef KAB_EMBEDDED 497#ifndef KAB_EMBEDDED
498 498
499 QString clipText, vcards; 499 QString clipText, vcards;
500 KURL::List urls; 500 KURL::List urls;
501 501
502 if ( KURLDrag::decode( e, urls) ) { 502 if ( KURLDrag::decode( e, urls) ) {
503 KURL::List::Iterator it = urls.begin(); 503 KURL::List::Iterator it = urls.begin();
504 int c = urls.count(); 504 int c = urls.count();
505 if ( c > 1 ) { 505 if ( c > 1 ) {
506 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 );
507 if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { 507 if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) {
508 for ( ; it != urls.end(); ++it ) 508 for ( ; it != urls.end(); ++it )
509 emit urlDropped( *it ); 509 emit urlDropped( *it );
510 } 510 }
511 } else if ( c == 1 ) 511 } else if ( c == 1 )
512 emit urlDropped( *it ); 512 emit urlDropped( *it );
513 } else if ( KVCardDrag::decode( e, vcards ) ) { 513 } else if ( KVCardDrag::decode( e, vcards ) ) {
514 KABC::Addressee addr; 514 KABC::Addressee addr;
515 KABC::VCardConverter converter; 515 KABC::VCardConverter converter;
516 QStringList list = QStringList::split( "\r\n\r\n", vcards ); 516 QStringList list = QStringList::split( "\r\n\r\n", vcards );
517 QStringList::Iterator it; 517 QStringList::Iterator it;
518 for ( it = list.begin(); it != list.end(); ++it ) { 518 for ( it = list.begin(); it != list.end(); ++it ) {
519 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { 519 if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) {
520 KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); 520 KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() );
521 if ( a.isEmpty() ) { 521 if ( a.isEmpty() ) {
522 mCore->addressBook()->insertAddressee( addr ); 522 mCore->addressBook()->insertAddressee( addr );
523 emit modified(); 523 emit modified();
524 } 524 }
525 } 525 }
526 } 526 }
527 527
528 mActiveView->refresh(); 528 mActiveView->refresh();
529 } 529 }
530#else //KAB_EMBEDDED 530#else //KAB_EMBEDDED
531qDebug("ViewManager::dropped() has to be changed!!" ); 531qDebug("ViewManager::dropped() has to be changed!!" );
532#endif //KAB_EMBEDDED 532#endif //KAB_EMBEDDED
533 533
534} 534}
535 535
536void ViewManager::startDrag() 536void ViewManager::startDrag()
537{ 537{
538 kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; 538 kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;
539 539
540#ifndef KAB_EMBEDDED 540#ifndef KAB_EMBEDDED
541 541
542 // Get the list of all the selected addressees 542 // Get the list of all the selected addressees
543 KABC::Addressee::List addrList; 543 KABC::Addressee::List addrList;
544 QStringList uidList = selectedUids(); 544 QStringList uidList = selectedUids();
545 QStringList::Iterator iter; 545 QStringList::Iterator iter;
546 for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) 546 for ( iter = uidList.begin(); iter != uidList.end(); ++iter )
547 addrList.append( mCore->addressBook()->findByUid( *iter ) ); 547 addrList.append( mCore->addressBook()->findByUid( *iter ) );
548 548
549 KMultipleDrag *drag = new KMultipleDrag( this ); 549 KMultipleDrag *drag = new KMultipleDrag( this );
550 drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); 550 drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) );
551 KABC::Addressee::List::Iterator it; 551 KABC::Addressee::List::Iterator it;
552 QStringList vcards; 552 QStringList vcards;
553 for ( it = addrList.begin(); it != addrList.end(); ++it ) { 553 for ( it = addrList.begin(); it != addrList.end(); ++it ) {
554 QString vcard = QString::null; 554 QString vcard = QString::null;
555 KABC::VCardConverter converter; 555 KABC::VCardConverter converter;
556 if ( converter.addresseeToVCard( *it, vcard ) ) 556 if ( converter.addresseeToVCard( *it, vcard ) )
557 vcards.append( vcard ); 557 vcards.append( vcard );
558 } 558 }
559 drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); 559 drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) );
560 560
561 drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); 561 drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
562 drag->dragCopy(); 562 drag->dragCopy();
563 563
564#else //KAB_EMBEDDED 564#else //KAB_EMBEDDED
565qDebug("ViewManager::startDrag() has to be changed!!" ); 565qDebug("ViewManager::startDrag() has to be changed!!" );
566#endif //KAB_EMBEDDED 566#endif //KAB_EMBEDDED
567 567
568} 568}
569void ViewManager::doSearch( const QString& s,KABC::Field *field ) 569void ViewManager::doSearch( const QString& s,KABC::Field *field )
570{ 570{
571 if ( mActiveView ) 571 if ( mActiveView )
572 mActiveView->doSearch( s, field ); 572 mActiveView->doSearch( s, field );
573 573
574} 574}
575void ViewManager::setActiveFilter( int index ) 575void ViewManager::setActiveFilter( int index )
576{ 576{
577 Filter currentFilter; 577 Filter currentFilter;
578 578
579 if ( ( index - 1 ) < 0 ) 579 if ( ( index - 1 ) < 0 )
580 currentFilter = Filter(); 580 currentFilter = Filter();
581 else 581 else
582 currentFilter = mFilterList[ index - 1 ]; 582 currentFilter = mFilterList[ index - 1 ];
583 583
584 // Check if we have a view. Since the filter combo is created before 584 // Check if we have a view. Since the filter combo is created before
585 // the view, this slot could be called before there is a valid view. 585 // the view, this slot could be called before there is a valid view.
586 if ( mActiveView ) { 586 if ( mActiveView ) {
587 mActiveView->setFilter( currentFilter ); 587 mActiveView->setFilter( currentFilter );
588 mActiveView->refresh(); 588 mActiveView->refresh();
589 emit selected( QString::null ); 589 emit selected( QString::null );
590 } 590 }
591} 591}
592 592
593void ViewManager::configureFilters() 593void ViewManager::configureFilters()
594{ 594{
595 FilterDialog dlg( this ); 595 FilterDialog dlg( this );
596 596
597 dlg.setFilters( mFilterList ); 597 dlg.setFilters( mFilterList );
598 598
599 if ( dlg.exec() ) 599 if ( dlg.exec() )
600 mFilterList = dlg.filters(); 600 mFilterList = dlg.filters();
601 601
602 uint pos = mActionSelectFilter->currentItem(); 602 uint pos = mActionSelectFilter->currentItem();
603 mActionSelectFilter->setItems( filterNames() ); 603 mActionSelectFilter->setItems( filterNames() );
604 mActionSelectFilter->setCurrentItem( pos ); 604 mActionSelectFilter->setCurrentItem( pos );
605 setActiveFilter( pos ); 605 setActiveFilter( pos );
606 int cw = 150; 606 int cw = 150;
607 if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) 607 if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch)
608 cw = 0; 608 cw = 0;
609 mActionSelectFilter->setComboWidth( cw ); 609 mActionSelectFilter->setComboWidth( cw );
610 saveSettings(); 610 saveSettings();
611} 611}
612 612
613QStringList ViewManager::filterNames() const 613QStringList ViewManager::filterNames() const
614{ 614{
615 QStringList names( i18n( "No Filter" ) ); 615 QStringList names( i18n( "No Filter" ) );
616 616
617 Filter::List::ConstIterator it; 617 Filter::List::ConstIterator it;
618 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 618 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
619 names.append( (*it).name() ); 619 names.append( (*it).name() );
620 620
621 return names; 621 return names;
622} 622}
623Filter ViewManager::getFilterByName( const QString &name ) const 623Filter ViewManager::getFilterByName( const QString &name ) const
624{ 624{
625 Filter::List::ConstIterator it; 625 Filter::List::ConstIterator it;
626 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) 626 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
627 if ( name == (*it).name() ) 627 if ( name == (*it).name() )
628 return (*it); 628 return (*it);
629 629
630 return Filter(); 630 return Filter();
631} 631}
632 632
633int ViewManager::filterPosition( const QString &name ) const 633int ViewManager::filterPosition( const QString &name ) const
634{ 634{
635 int pos = 0; 635 int pos = 0;
636 636
637 Filter::List::ConstIterator it; 637 Filter::List::ConstIterator it;
638 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) 638 for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
639 if ( name == (*it).name() ) 639 if ( name == (*it).name() )
640 return pos + 1; 640 return pos + 1;
641 641
642 return 0; 642 return 0;
643} 643}
644 644
645void ViewManager::initActions() 645void ViewManager::initActions()
646{ 646{
647//US <ActionList name="view_loadedviews"/> 647//US <ActionList name="view_loadedviews"/>
648//US <Separator/> 648//US <Separator/>
649 649
650#ifdef KAB_EMBEDDED 650#ifdef KAB_EMBEDDED
651 QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); 651 QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
652 QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); 652 QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
653 QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); 653 QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
654#endif //KAB_EMBEDDED 654#endif //KAB_EMBEDDED
655 655
656 mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); 656 mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
657#if KDE_VERSION >= 309 657#if KDE_VERSION >= 309
658 mActionSelectView->setMenuAccelsEnabled( false ); 658 mActionSelectView->setMenuAccelsEnabled( false );
659#endif 659#endif
660 connect( mActionSelectView, SIGNAL( activated( const QString& ) ), 660 connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
661 SLOT( selectView( const QString& ) ) ); 661 SLOT( selectView( const QString& ) ) );
662 662
663 663
664#ifdef KAB_EMBEDDED 664#ifdef KAB_EMBEDDED
665 mActionSelectView->plug(viewmenu); 665 mActionSelectView->plug(viewmenu);
666 viewmenu->insertSeparator(); 666 viewmenu->insertSeparator();
667#endif //KAB_EMBEDDED 667#endif //KAB_EMBEDDED
668 668
669 KAction *action; 669 KAction *action;
670 670
671 action = new KAction( i18n( "Modify View..." ), "configure", 0, this, 671 action = new KAction( i18n( "Modify View..." ), "configure", 0, this,
672 SLOT( editView() ), mCore->actionCollection(), "view_modify" ); 672 SLOT( editView() ), mCore->actionCollection(), "view_modify" );
673#ifndef KAB_EMBEDDED 673#ifndef KAB_EMBEDDED
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." ) ); 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." ) );
675#else //KAB_EMBEDDED 675#else //KAB_EMBEDDED
676 action->plug(viewmenu); 676 action->plug(viewmenu);
677#endif //KAB_EMBEDDED 677#endif //KAB_EMBEDDED
678 678
679 action = new KAction( i18n( "Add View..." ), "window_new", 0, this, 679 action = new KAction( i18n( "Add View..." ), "window_new", 0, this,
680 SLOT( addView() ), mCore->actionCollection(), "view_add" ); 680 SLOT( addView() ), mCore->actionCollection(), "view_add" );
681#ifndef KAB_EMBEDDED 681#ifndef KAB_EMBEDDED
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." ) ); 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." ) );
683#else //KAB_EMBEDDED 683#else //KAB_EMBEDDED
684 action->plug(viewmenu); 684 action->plug(viewmenu);
685#endif //KAB_EMBEDDED 685#endif //KAB_EMBEDDED
686 686
687 mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, 687 mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0,
688 this, SLOT( deleteView() ), 688 this, SLOT( deleteView() ),
689 mCore->actionCollection(), "view_delete" ); 689 mCore->actionCollection(), "view_delete" );
690#ifndef KAB_EMBEDDED 690#ifndef KAB_EMBEDDED
691 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." ) );
692#else //KAB_EMBEDDED 692#else //KAB_EMBEDDED
693 mActionDeleteView->plug(viewmenu); 693 mActionDeleteView->plug(viewmenu);
694 viewmenu->insertSeparator(); 694 viewmenu->insertSeparator();
695#endif //KAB_EMBEDDED 695#endif //KAB_EMBEDDED
696 696
697#ifndef KAB_EMBEDDED 697#ifndef KAB_EMBEDDED
698 action = new KAction( i18n( "Refresh View" ), "reload", 0, this, 698 action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
699 SLOT( refreshView(const QString &) ), mCore->actionCollection(), 699 SLOT( refreshView(const QString &) ), mCore->actionCollection(),
700 "view_refresh" ); 700 "view_refresh" );
701 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." ) );
702#else //KAB_EMBEDDED 702#else //KAB_EMBEDDED
703 action = new KAction( i18n( "Refresh View" ), "reload", 0, this, 703 action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
704 SLOT( refreshView()), mCore->actionCollection(), 704 SLOT( refreshView()), mCore->actionCollection(),
705 "view_refresh" ); 705 "view_refresh" );
706 action->plug(viewmenu); 706 action->plug(viewmenu);
707 viewmenu->insertSeparator(); 707 //viewmenu->insertSeparator();
708#endif //KAB_EMBEDDED 708#endif //KAB_EMBEDDED
709 709
710 action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, 710 action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this,
711 SLOT( configureFilters() ), mCore->actionCollection(), 711 SLOT( configureFilters() ), mCore->actionCollection(),
712 "options_edit_filters" ); 712 "options_edit_filters" );
713 713
714 mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); 714 mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" );
715#if KDE_VERSION >= 309 715#if KDE_VERSION >= 309
716 mActionSelectFilter->setMenuAccelsEnabled( false ); 716 mActionSelectFilter->setMenuAccelsEnabled( false );
717#endif 717#endif
718 connect( mActionSelectFilter, SIGNAL( activated( int ) ), 718 connect( mActionSelectFilter, SIGNAL( activated( int ) ),
719 SLOT( setActiveFilter( int ) ) ); 719 SLOT( setActiveFilter( int ) ) );
720 720
721#ifdef KAB_EMBEDDED 721#ifdef KAB_EMBEDDED
722 action->plug(settingsmenu); 722 action->plug(settingsmenu);
723 mActionSelectFilter->plug(viewmenu,0); 723 mActionSelectFilter->plug(viewmenu,0);
724#endif //KAB_EMBEDDED 724#endif //KAB_EMBEDDED
725 725
726} 726}
727 727
728void ViewManager::initGUI() 728void ViewManager::initGUI()
729{ 729{
730 QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); 730 QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 );
731 mViewWidgetStack = new QWidgetStack( this ); 731 mViewWidgetStack = new QWidgetStack( this );
732 layout->addWidget( mViewWidgetStack ); 732 layout->addWidget( mViewWidgetStack );
733} 733}
734 734
735#ifndef KAB_EMBEDDED 735#ifndef KAB_EMBEDDED
736#include "viewmanager.moc" 736#include "viewmanager.moc"
737#endif //KAB_EMBEDDED 737#endif //KAB_EMBEDDED