Diffstat (limited to 'kaddressbook/viewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/viewmanager.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 33bef5a..59bddd9 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -544,128 +544,129 @@ void ViewManager::startDrag() | |||
544 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) | 544 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) |
545 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); | 545 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); |
546 | 546 | ||
547 | KMultipleDrag *drag = new KMultipleDrag( this ); | 547 | KMultipleDrag *drag = new KMultipleDrag( this ); |
548 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); | 548 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); |
549 | KABC::Addressee::List::Iterator it; | 549 | KABC::Addressee::List::Iterator it; |
550 | QStringList vcards; | 550 | QStringList vcards; |
551 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { | 551 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { |
552 | QString vcard = QString::null; | 552 | QString vcard = QString::null; |
553 | KABC::VCardConverter converter; | 553 | KABC::VCardConverter converter; |
554 | if ( converter.addresseeToVCard( *it, vcard ) ) | 554 | if ( converter.addresseeToVCard( *it, vcard ) ) |
555 | vcards.append( vcard ); | 555 | vcards.append( vcard ); |
556 | } | 556 | } |
557 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); | 557 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); |
558 | 558 | ||
559 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); | 559 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); |
560 | drag->dragCopy(); | 560 | drag->dragCopy(); |
561 | 561 | ||
562 | #else //KAB_EMBEDDED | 562 | #else //KAB_EMBEDDED |
563 | qDebug("ViewManager::startDrag() has to be changed!!" ); | 563 | qDebug("ViewManager::startDrag() has to be changed!!" ); |
564 | #endif //KAB_EMBEDDED | 564 | #endif //KAB_EMBEDDED |
565 | 565 | ||
566 | } | 566 | } |
567 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) | 567 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) |
568 | { | 568 | { |
569 | if ( mActiveView ) | 569 | if ( mActiveView ) |
570 | mActiveView->doSearch( s, field ); | 570 | mActiveView->doSearch( s, field ); |
571 | 571 | ||
572 | } | 572 | } |
573 | void ViewManager::setActiveFilter( int index ) | 573 | void ViewManager::setActiveFilter( int index ) |
574 | { | 574 | { |
575 | Filter currentFilter; | 575 | Filter currentFilter; |
576 | 576 | ||
577 | if ( ( index - 1 ) < 0 ) | 577 | if ( ( index - 1 ) < 0 ) |
578 | currentFilter = Filter(); | 578 | currentFilter = Filter(); |
579 | else | 579 | else |
580 | currentFilter = mFilterList[ index - 1 ]; | 580 | currentFilter = mFilterList[ index - 1 ]; |
581 | 581 | ||
582 | // Check if we have a view. Since the filter combo is created before | 582 | // Check if we have a view. Since the filter combo is created before |
583 | // the view, this slot could be called before there is a valid view. | 583 | // the view, this slot could be called before there is a valid view. |
584 | if ( mActiveView ) { | 584 | if ( mActiveView ) { |
585 | mActiveView->setFilter( currentFilter ); | 585 | mActiveView->setFilter( currentFilter ); |
586 | mActiveView->refresh(); | 586 | mActiveView->refresh(); |
587 | emit selected( QString::null ); | 587 | emit selected( QString::null ); |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | void ViewManager::configureFilters() | 591 | void ViewManager::configureFilters() |
592 | { | 592 | { |
593 | FilterDialog dlg( this ); | 593 | FilterDialog dlg( this ); |
594 | 594 | ||
595 | dlg.setFilters( mFilterList ); | 595 | dlg.setFilters( mFilterList ); |
596 | 596 | ||
597 | if ( dlg.exec() ) | 597 | if ( dlg.exec() ) |
598 | mFilterList = dlg.filters(); | 598 | mFilterList = dlg.filters(); |
599 | 599 | ||
600 | uint pos = mActionSelectFilter->currentItem(); | 600 | uint pos = mActionSelectFilter->currentItem(); |
601 | mActionSelectFilter->setItems( filterNames() ); | 601 | mActionSelectFilter->setItems( filterNames() ); |
602 | mActionSelectFilter->setCurrentItem( pos ); | 602 | mActionSelectFilter->setCurrentItem( pos ); |
603 | setActiveFilter( pos ); | 603 | setActiveFilter( pos ); |
604 | int cw = 150; | 604 | int cw = 150; |
605 | if (QApplication::desktop()->width() == 480 ) | 605 | if (QApplication::desktop()->width() == 480 ) |
606 | cw = 0; | 606 | cw = 0; |
607 | mActionSelectFilter->setComboWidth( cw ); | 607 | mActionSelectFilter->setComboWidth( cw ); |
608 | saveSettings(); | ||
608 | } | 609 | } |
609 | 610 | ||
610 | QStringList ViewManager::filterNames() const | 611 | QStringList ViewManager::filterNames() const |
611 | { | 612 | { |
612 | QStringList names( i18n( "No Filter" ) ); | 613 | QStringList names( i18n( "No Filter" ) ); |
613 | 614 | ||
614 | Filter::List::ConstIterator it; | 615 | Filter::List::ConstIterator it; |
615 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | 616 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) |
616 | names.append( (*it).name() ); | 617 | names.append( (*it).name() ); |
617 | 618 | ||
618 | return names; | 619 | return names; |
619 | } | 620 | } |
620 | 621 | ||
621 | int ViewManager::filterPosition( const QString &name ) const | 622 | int ViewManager::filterPosition( const QString &name ) const |
622 | { | 623 | { |
623 | int pos = 0; | 624 | int pos = 0; |
624 | 625 | ||
625 | Filter::List::ConstIterator it; | 626 | Filter::List::ConstIterator it; |
626 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) | 627 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) |
627 | if ( name == (*it).name() ) | 628 | if ( name == (*it).name() ) |
628 | return pos + 1; | 629 | return pos + 1; |
629 | 630 | ||
630 | return 0; | 631 | return 0; |
631 | } | 632 | } |
632 | 633 | ||
633 | void ViewManager::initActions() | 634 | void ViewManager::initActions() |
634 | { | 635 | { |
635 | //US <ActionList name="view_loadedviews"/> | 636 | //US <ActionList name="view_loadedviews"/> |
636 | //US <Separator/> | 637 | //US <Separator/> |
637 | 638 | ||
638 | #ifdef KAB_EMBEDDED | 639 | #ifdef KAB_EMBEDDED |
639 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 640 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); |
640 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 641 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
641 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 642 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); |
642 | #endif //KAB_EMBEDDED | 643 | #endif //KAB_EMBEDDED |
643 | 644 | ||
644 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 645 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
645 | #if KDE_VERSION >= 309 | 646 | #if KDE_VERSION >= 309 |
646 | mActionSelectView->setMenuAccelsEnabled( false ); | 647 | mActionSelectView->setMenuAccelsEnabled( false ); |
647 | #endif | 648 | #endif |
648 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 649 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
649 | SLOT( setActiveView( const QString& ) ) ); | 650 | SLOT( setActiveView( const QString& ) ) ); |
650 | 651 | ||
651 | 652 | ||
652 | #ifdef KAB_EMBEDDED | 653 | #ifdef KAB_EMBEDDED |
653 | mActionSelectView->plug(viewmenu); | 654 | mActionSelectView->plug(viewmenu); |
654 | viewmenu->insertSeparator(); | 655 | viewmenu->insertSeparator(); |
655 | #endif //KAB_EMBEDDED | 656 | #endif //KAB_EMBEDDED |
656 | 657 | ||
657 | KAction *action; | 658 | KAction *action; |
658 | 659 | ||
659 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, | 660 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, |
660 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); | 661 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); |
661 | #ifndef KAB_EMBEDDED | 662 | #ifndef KAB_EMBEDDED |
662 | 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." ) ); | 663 | 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." ) ); |
663 | #else //KAB_EMBEDDED | 664 | #else //KAB_EMBEDDED |
664 | action->plug(viewmenu); | 665 | action->plug(viewmenu); |
665 | #endif //KAB_EMBEDDED | 666 | #endif //KAB_EMBEDDED |
666 | 667 | ||
667 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, | 668 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, |
668 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); | 669 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); |
669 | #ifndef KAB_EMBEDDED | 670 | #ifndef KAB_EMBEDDED |
670 | 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." ) ); | 671 | 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." ) ); |
671 | #else //KAB_EMBEDDED | 672 | #else //KAB_EMBEDDED |