summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp19
-rw-r--r--kaddressbook/xxportselectdialog.cpp16
2 files changed, 25 insertions, 10 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d99a9cd..7be5db8 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -491,731 +491,742 @@ void KABCore::restoreSettings()
491#endif 491#endif
492 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 492 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
493 if ( true /*splitterSize.count() == 0*/ ) { 493 if ( true /*splitterSize.count() == 0*/ ) {
494 splitterSize.append( wid / 2 ); 494 splitterSize.append( wid / 2 );
495 splitterSize.append( wid / 2 ); 495 splitterSize.append( wid / 2 );
496 } 496 }
497 mMiniSplitter->setSizes( splitterSize ); 497 mMiniSplitter->setSizes( splitterSize );
498 if ( mExtensionBarSplitter ) { 498 if ( mExtensionBarSplitter ) {
499 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 499 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
500 if ( true /*splitterSize.count() == 0*/ ) { 500 if ( true /*splitterSize.count() == 0*/ ) {
501 splitterSize.append( wid / 2 ); 501 splitterSize.append( wid / 2 );
502 splitterSize.append( wid / 2 ); 502 splitterSize.append( wid / 2 );
503 } 503 }
504 mExtensionBarSplitter->setSizes( splitterSize ); 504 mExtensionBarSplitter->setSizes( splitterSize );
505 505
506 } 506 }
507 507
508 508
509} 509}
510 510
511void KABCore::saveSettings() 511void KABCore::saveSettings()
512{ 512{
513 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 513 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
514 if ( mExtensionBarSplitter ) 514 if ( mExtensionBarSplitter )
515 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 515 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
516 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 516 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
517 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 517 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
518#ifndef KAB_EMBEDDED 518#ifndef KAB_EMBEDDED
519 519
520 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 520 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
521 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 521 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
522#endif //KAB_EMBEDDED 522#endif //KAB_EMBEDDED
523 mExtensionManager->saveSettings(); 523 mExtensionManager->saveSettings();
524 mViewManager->saveSettings(); 524 mViewManager->saveSettings();
525 525
526 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 526 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
527} 527}
528 528
529KABC::AddressBook *KABCore::addressBook() const 529KABC::AddressBook *KABCore::addressBook() const
530{ 530{
531 return mAddressBook; 531 return mAddressBook;
532} 532}
533 533
534KConfig *KABCore::config() 534KConfig *KABCore::config()
535{ 535{
536#ifndef KAB_EMBEDDED 536#ifndef KAB_EMBEDDED
537 return KABPrefs::instance()->config(); 537 return KABPrefs::instance()->config();
538#else //KAB_EMBEDDED 538#else //KAB_EMBEDDED
539 return KABPrefs::instance()->getConfig(); 539 return KABPrefs::instance()->getConfig();
540#endif //KAB_EMBEDDED 540#endif //KAB_EMBEDDED
541} 541}
542 542
543KActionCollection *KABCore::actionCollection() const 543KActionCollection *KABCore::actionCollection() const
544{ 544{
545 return mGUIClient->actionCollection(); 545 return mGUIClient->actionCollection();
546} 546}
547 547
548KABC::Field *KABCore::currentSearchField() const 548KABC::Field *KABCore::currentSearchField() const
549{ 549{
550 if (mIncSearchWidget) 550 if (mIncSearchWidget)
551 return mIncSearchWidget->currentField(); 551 return mIncSearchWidget->currentField();
552 else 552 else
553 return 0; 553 return 0;
554} 554}
555 555
556QStringList KABCore::selectedUIDs() const 556QStringList KABCore::selectedUIDs() const
557{ 557{
558 return mViewManager->selectedUids(); 558 return mViewManager->selectedUids();
559} 559}
560 560
561KABC::Resource *KABCore::requestResource( QWidget *parent ) 561KABC::Resource *KABCore::requestResource( QWidget *parent )
562{ 562{
563 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 563 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
564 564
565 QPtrList<KRES::Resource> kresResources; 565 QPtrList<KRES::Resource> kresResources;
566 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 566 QPtrListIterator<KABC::Resource> resIt( kabcResources );
567 KABC::Resource *resource; 567 KABC::Resource *resource;
568 while ( ( resource = resIt.current() ) != 0 ) { 568 while ( ( resource = resIt.current() ) != 0 ) {
569 ++resIt; 569 ++resIt;
570 if ( !resource->readOnly() ) { 570 if ( !resource->readOnly() ) {
571 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 571 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
572 if ( res ) 572 if ( res )
573 kresResources.append( res ); 573 kresResources.append( res );
574 } 574 }
575 } 575 }
576 576
577 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 577 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
578 return static_cast<KABC::Resource*>( res ); 578 return static_cast<KABC::Resource*>( res );
579} 579}
580 580
581#ifndef KAB_EMBEDDED 581#ifndef KAB_EMBEDDED
582KAboutData *KABCore::createAboutData() 582KAboutData *KABCore::createAboutData()
583#else //KAB_EMBEDDED 583#else //KAB_EMBEDDED
584void KABCore::createAboutData() 584void KABCore::createAboutData()
585#endif //KAB_EMBEDDED 585#endif //KAB_EMBEDDED
586{ 586{
587#ifndef KAB_EMBEDDED 587#ifndef KAB_EMBEDDED
588 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 588 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
589 "3.1", I18N_NOOP( "The KDE Address Book" ), 589 "3.1", I18N_NOOP( "The KDE Address Book" ),
590 KAboutData::License_GPL_V2, 590 KAboutData::License_GPL_V2,
591 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 591 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
592 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 592 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
593 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 593 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
594 about->addAuthor( "Cornelius Schumacher", 594 about->addAuthor( "Cornelius Schumacher",
595 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 595 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
596 "schumacher@kde.org" ); 596 "schumacher@kde.org" );
597 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 597 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
598 "mpilone@slac.com" ); 598 "mpilone@slac.com" );
599 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 599 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
600 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 600 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
601 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 601 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
602 "michel@klaralvdalens-datakonsult.se" ); 602 "michel@klaralvdalens-datakonsult.se" );
603 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 603 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
604 "hansen@kde.org" ); 604 "hansen@kde.org" );
605 605
606 return about; 606 return about;
607#endif //KAB_EMBEDDED 607#endif //KAB_EMBEDDED
608 608
609 QString version; 609 QString version;
610#include <../version> 610#include <../version>
611 QMessageBox::about( this, "About KAddressbook/Pi", 611 QMessageBox::about( this, "About KAddressbook/Pi",
612 "KAddressbook/Platform-independent\n" 612 "KAddressbook/Platform-independent\n"
613 "(KA/Pi) " +version + " - " + 613 "(KA/Pi) " +version + " - " +
614#ifdef DESKTOP_VERSION 614#ifdef DESKTOP_VERSION
615 "Desktop Edition\n" 615 "Desktop Edition\n"
616#else 616#else
617 "PDA-Edition\n" 617 "PDA-Edition\n"
618 "for: Zaurus 5500 / 7x0 / 8x0\n" 618 "for: Zaurus 5500 / 7x0 / 8x0\n"
619#endif 619#endif
620 620
621 "(c) 2004 Ulf Schenk\n" 621 "(c) 2004 Ulf Schenk\n"
622 "(c) 2004 Lutz Rogowski\n" 622 "(c) 2004 Lutz Rogowski\n"
623 "(c) 1997-2003, The KDE PIM Team\n" 623 "(c) 1997-2003, The KDE PIM Team\n"
624 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 624 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
625 "Don Sanders Original author\n" 625 "Don Sanders Original author\n"
626 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 626 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
627 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 627 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
628 "Greg Stern DCOP interface\n" 628 "Greg Stern DCOP interface\n"
629 "Mark Westcot Contact pinning\n" 629 "Mark Westcot Contact pinning\n"
630 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 630 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
631 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 631 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
632#ifdef _WIN32_ 632#ifdef _WIN32_
633 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 633 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
634#endif 634#endif
635 ); 635 );
636} 636}
637 637
638void KABCore::setContactSelected( const QString &uid ) 638void KABCore::setContactSelected( const QString &uid )
639{ 639{
640 KABC::Addressee addr = mAddressBook->findByUid( uid ); 640 KABC::Addressee addr = mAddressBook->findByUid( uid );
641 if ( !mDetails->isHidden() ) 641 if ( !mDetails->isHidden() )
642 mDetails->setAddressee( addr ); 642 mDetails->setAddressee( addr );
643 643
644 if ( !addr.isEmpty() ) { 644 if ( !addr.isEmpty() ) {
645 emit contactSelected( addr.formattedName() ); 645 emit contactSelected( addr.formattedName() );
646 KABC::Picture pic = addr.photo(); 646 KABC::Picture pic = addr.photo();
647 if ( pic.isIntern() ) { 647 if ( pic.isIntern() ) {
648//US emit contactSelected( pic.data() ); 648//US emit contactSelected( pic.data() );
649//US instead use: 649//US instead use:
650 QPixmap px; 650 QPixmap px;
651 if (pic.data().isNull() != true) 651 if (pic.data().isNull() != true)
652 { 652 {
653 px.convertFromImage(pic.data()); 653 px.convertFromImage(pic.data());
654 } 654 }
655 655
656 emit contactSelected( px ); 656 emit contactSelected( px );
657 } 657 }
658 } 658 }
659 659
660 660
661 mExtensionManager->setSelectionChanged(); 661 mExtensionManager->setSelectionChanged();
662 662
663 // update the actions 663 // update the actions
664 bool selected = !uid.isEmpty(); 664 bool selected = !uid.isEmpty();
665 665
666 if ( mReadWrite ) { 666 if ( mReadWrite ) {
667 mActionCut->setEnabled( selected ); 667 mActionCut->setEnabled( selected );
668 mActionPaste->setEnabled( selected ); 668 mActionPaste->setEnabled( selected );
669 } 669 }
670 670
671 mActionCopy->setEnabled( selected ); 671 mActionCopy->setEnabled( selected );
672 mActionDelete->setEnabled( selected ); 672 mActionDelete->setEnabled( selected );
673 mActionEditAddressee->setEnabled( selected ); 673 mActionEditAddressee->setEnabled( selected );
674 mActionMail->setEnabled( selected ); 674 mActionMail->setEnabled( selected );
675 mActionMailVCard->setEnabled( selected ); 675 mActionMailVCard->setEnabled( selected );
676 //if (mActionBeam) 676 //if (mActionBeam)
677 //mActionBeam->setEnabled( selected ); 677 //mActionBeam->setEnabled( selected );
678 678
679 if (mActionBeamVCard) 679 if (mActionBeamVCard)
680 mActionBeamVCard->setEnabled( selected ); 680 mActionBeamVCard->setEnabled( selected );
681 681
682 mActionWhoAmI->setEnabled( selected ); 682 mActionWhoAmI->setEnabled( selected );
683 mActionCategories->setEnabled( selected );
684} 683}
685 684
686void KABCore::sendMail() 685void KABCore::sendMail()
687{ 686{
688 sendMail( mViewManager->selectedEmails().join( ", " ) ); 687 sendMail( mViewManager->selectedEmails().join( ", " ) );
689} 688}
690 689
691void KABCore::sendMail( const QString& emaillist ) 690void KABCore::sendMail( const QString& emaillist )
692{ 691{
693 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 692 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
694 if (emaillist.contains(",") > 0) 693 if (emaillist.contains(",") > 0)
695 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 694 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
696 else 695 else
697 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 696 ExternalAppHandler::instance()->mailToOneContact( emaillist );
698} 697}
699 698
700 699
701 700
702void KABCore::mailVCard() 701void KABCore::mailVCard()
703{ 702{
704 QStringList uids = mViewManager->selectedUids(); 703 QStringList uids = mViewManager->selectedUids();
705 if ( !uids.isEmpty() ) 704 if ( !uids.isEmpty() )
706 mailVCard( uids ); 705 mailVCard( uids );
707} 706}
708 707
709void KABCore::mailVCard( const QStringList& uids ) 708void KABCore::mailVCard( const QStringList& uids )
710{ 709{
711 QStringList urls; 710 QStringList urls;
712 711
713// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 712// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
714 713
715 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 714 QString dirName = "/tmp/" + KApplication::randomString( 8 );
716 715
717 716
718 717
719 QDir().mkdir( dirName, true ); 718 QDir().mkdir( dirName, true );
720 719
721 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 720 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
722 KABC::Addressee a = mAddressBook->findByUid( *it ); 721 KABC::Addressee a = mAddressBook->findByUid( *it );
723 722
724 if ( a.isEmpty() ) 723 if ( a.isEmpty() )
725 continue; 724 continue;
726 725
727 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 726 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
728 727
729 QString fileName = dirName + "/" + name; 728 QString fileName = dirName + "/" + name;
730 729
731 QFile outFile(fileName); 730 QFile outFile(fileName);
732 731
733 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 732 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
734 KABC::VCardConverter converter; 733 KABC::VCardConverter converter;
735 QString vcard; 734 QString vcard;
736 735
737 converter.addresseeToVCard( a, vcard ); 736 converter.addresseeToVCard( a, vcard );
738 737
739 QTextStream t( &outFile ); // use a text stream 738 QTextStream t( &outFile ); // use a text stream
740 t.setEncoding( QTextStream::UnicodeUTF8 ); 739 t.setEncoding( QTextStream::UnicodeUTF8 );
741 t << vcard; 740 t << vcard;
742 741
743 outFile.close(); 742 outFile.close();
744 743
745 urls.append( fileName ); 744 urls.append( fileName );
746 } 745 }
747 } 746 }
748 747
749 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 748 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
750 749
751 750
752/*US 751/*US
753 kapp->invokeMailer( QString::null, QString::null, QString::null, 752 kapp->invokeMailer( QString::null, QString::null, QString::null,
754 QString::null, // subject 753 QString::null, // subject
755 QString::null, // body 754 QString::null, // body
756 QString::null, 755 QString::null,
757 urls ); // attachments 756 urls ); // attachments
758*/ 757*/
759 758
760} 759}
761 760
762/** 761/**
763 Beams the "WhoAmI contact. 762 Beams the "WhoAmI contact.
764*/ 763*/
765void KABCore::beamMySelf() 764void KABCore::beamMySelf()
766{ 765{
767 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 766 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
768 if (!a.isEmpty()) 767 if (!a.isEmpty())
769 { 768 {
770 QStringList uids; 769 QStringList uids;
771 uids << a.uid(); 770 uids << a.uid();
772 771
773 beamVCard(uids); 772 beamVCard(uids);
774 } else { 773 } else {
775 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 774 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
776 775
777 776
778 } 777 }
779} 778}
780 779
781void KABCore::export2phone() 780void KABCore::export2phone()
782{ 781{
783 QStringList uids; 782 QStringList uids;
784 XXPortSelectDialog dlg( this, false, this ); 783 XXPortSelectDialog dlg( this, false, this );
785 if ( dlg.exec() ) 784 if ( dlg.exec() )
786 uids = dlg.uids(); 785 uids = dlg.uids();
787 else 786 else
788 return; 787 return;
789 if ( uids.isEmpty() ) 788 if ( uids.isEmpty() )
790 return; 789 return;
791 // qDebug("count %d ", uids.count()); 790 // qDebug("count %d ", uids.count());
792 791
793 KAex2phonePrefs ex2phone; 792 KAex2phonePrefs ex2phone;
794 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 793 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
795 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 794 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
796 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 795 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
797 796
798 if ( !ex2phone.exec() ) { 797 if ( !ex2phone.exec() ) {
799 return; 798 return;
800 } 799 }
801 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 800 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
802 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 801 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
803 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 802 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
804 803
805 804
806 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 805 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
807 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 806 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
808 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 807 KPimGlobalPrefs::instance()->mEx2PhoneModel );
809 808
810 QString fileName = getPhoneFile(); 809 QString fileName = getPhoneFile();
811 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 810 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
812 return; 811 return;
813 812
814 message(i18n("Exporting to phone...")); 813 message(i18n("Exporting to phone..."));
815 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 814 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
816 815
817} 816}
818QString KABCore::getPhoneFile() 817QString KABCore::getPhoneFile()
819{ 818{
820#ifdef DESKTOP_VERSION 819#ifdef DESKTOP_VERSION
821 return locateLocal("tmp", "phonefile.vcf"); 820 return locateLocal("tmp", "phonefile.vcf");
822#else 821#else
823 return "/tmp/phonefile.vcf"; 822 return "/tmp/phonefile.vcf";
824#endif 823#endif
825 824
826} 825}
827void KABCore::writeToPhone( ) 826void KABCore::writeToPhone( )
828{ 827{
829 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 828 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
830 message(i18n("Export to phone finished!")); 829 message(i18n("Export to phone finished!"));
831 else 830 else
832 qDebug(i18n("Error exporting to phone")); 831 qDebug(i18n("Error exporting to phone"));
833} 832}
834void KABCore::beamVCard() 833void KABCore::beamVCard()
835{ 834{
836 QStringList uids = mViewManager->selectedUids(); 835 QStringList uids = mViewManager->selectedUids();
837 if ( !uids.isEmpty() ) 836 if ( !uids.isEmpty() )
838 beamVCard( uids ); 837 beamVCard( uids );
839} 838}
840 839
841 840
842void KABCore::beamVCard(const QStringList& uids) 841void KABCore::beamVCard(const QStringList& uids)
843{ 842{
844 843
845 // LR: we should use the /tmp dir on the Zaurus, 844 // LR: we should use the /tmp dir on the Zaurus,
846 // because: /tmp = RAM, (HOME)/kdepim = flash memory 845 // because: /tmp = RAM, (HOME)/kdepim = flash memory
847 846
848#ifdef DESKTOP_VERSION 847#ifdef DESKTOP_VERSION
849 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 848 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
850#else 849#else
851 QString fileName = "/tmp/kapibeamfile.vcf"; 850 QString fileName = "/tmp/kapibeamfile.vcf";
852#endif 851#endif
853 852
854 KABC::VCardConverter converter; 853 KABC::VCardConverter converter;
855 QString description; 854 QString description;
856 QString datastream; 855 QString datastream;
857 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 856 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
858 KABC::Addressee a = mAddressBook->findByUid( *it ); 857 KABC::Addressee a = mAddressBook->findByUid( *it );
859 858
860 if ( a.isEmpty() ) 859 if ( a.isEmpty() )
861 continue; 860 continue;
862 861
863 if (description.isEmpty()) 862 if (description.isEmpty())
864 description = a.formattedName(); 863 description = a.formattedName();
865 864
866 QString vcard; 865 QString vcard;
867 converter.addresseeToVCard( a, vcard ); 866 converter.addresseeToVCard( a, vcard );
868 int start = 0; 867 int start = 0;
869 int next; 868 int next;
870 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 869 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
871 int semi = vcard.find(";", next); 870 int semi = vcard.find(";", next);
872 int dopp = vcard.find(":", next); 871 int dopp = vcard.find(":", next);
873 int sep; 872 int sep;
874 if ( semi < dopp && semi >= 0 ) 873 if ( semi < dopp && semi >= 0 )
875 sep = semi ; 874 sep = semi ;
876 else 875 else
877 sep = dopp; 876 sep = dopp;
878 datastream +=vcard.mid( start, next - start); 877 datastream +=vcard.mid( start, next - start);
879 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 878 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
880 start = sep; 879 start = sep;
881 } 880 }
882 datastream += vcard.mid( start,vcard.length() ); 881 datastream += vcard.mid( start,vcard.length() );
883 } 882 }
884#ifndef DESKTOP_VERSION 883#ifndef DESKTOP_VERSION
885 QFile outFile(fileName); 884 QFile outFile(fileName);
886 if ( outFile.open(IO_WriteOnly) ) { 885 if ( outFile.open(IO_WriteOnly) ) {
887 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 886 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
888 QTextStream t( &outFile ); // use a text stream 887 QTextStream t( &outFile ); // use a text stream
889 //t.setEncoding( QTextStream::UnicodeUTF8 ); 888 //t.setEncoding( QTextStream::UnicodeUTF8 );
890 t.setEncoding( QTextStream::Latin1 ); 889 t.setEncoding( QTextStream::Latin1 );
891 t <<datastream.latin1(); 890 t <<datastream.latin1();
892 outFile.close(); 891 outFile.close();
893 Ir *ir = new Ir( this ); 892 Ir *ir = new Ir( this );
894 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 893 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
895 ir->send( fileName, description, "text/x-vCard" ); 894 ir->send( fileName, description, "text/x-vCard" );
896 } else { 895 } else {
897 qDebug("Error open temp beam file "); 896 qDebug("Error open temp beam file ");
898 return; 897 return;
899 } 898 }
900#endif 899#endif
901 900
902} 901}
903 902
904void KABCore::beamDone( Ir *ir ) 903void KABCore::beamDone( Ir *ir )
905{ 904{
906#ifndef DESKTOP_VERSION 905#ifndef DESKTOP_VERSION
907 delete ir; 906 delete ir;
908#endif 907#endif
909 topLevelWidget()->raise(); 908 topLevelWidget()->raise();
910 message( i18n("Beaming finished!") ); 909 message( i18n("Beaming finished!") );
911} 910}
912 911
913 912
914void KABCore::browse( const QString& url ) 913void KABCore::browse( const QString& url )
915{ 914{
916#ifndef KAB_EMBEDDED 915#ifndef KAB_EMBEDDED
917 kapp->invokeBrowser( url ); 916 kapp->invokeBrowser( url );
918#else //KAB_EMBEDDED 917#else //KAB_EMBEDDED
919 qDebug("KABCore::browse must be fixed"); 918 qDebug("KABCore::browse must be fixed");
920#endif //KAB_EMBEDDED 919#endif //KAB_EMBEDDED
921} 920}
922 921
923void KABCore::selectAllContacts() 922void KABCore::selectAllContacts()
924{ 923{
925 mViewManager->setSelected( QString::null, true ); 924 mViewManager->setSelected( QString::null, true );
926} 925}
927 926
928void KABCore::deleteContacts() 927void KABCore::deleteContacts()
929{ 928{
930 QStringList uidList = mViewManager->selectedUids(); 929 QStringList uidList = mViewManager->selectedUids();
931 deleteContacts( uidList ); 930 deleteContacts( uidList );
932} 931}
933 932
934void KABCore::deleteContacts( const QStringList &uids ) 933void KABCore::deleteContacts( const QStringList &uids )
935{ 934{
936 if ( uids.count() > 0 ) { 935 if ( uids.count() > 0 ) {
937 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 936 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
938 UndoStack::instance()->push( command ); 937 UndoStack::instance()->push( command );
939 RedoStack::instance()->clear(); 938 RedoStack::instance()->clear();
940 939
941 // now if we deleted anything, refresh 940 // now if we deleted anything, refresh
942 setContactSelected( QString::null ); 941 setContactSelected( QString::null );
943 setModified( true ); 942 setModified( true );
944 } 943 }
945} 944}
946 945
947void KABCore::copyContacts() 946void KABCore::copyContacts()
948{ 947{
949 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 948 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
950 949
951 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 950 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
952 951
953 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 952 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
954 953
955 QClipboard *cb = QApplication::clipboard(); 954 QClipboard *cb = QApplication::clipboard();
956 cb->setText( clipText ); 955 cb->setText( clipText );
957} 956}
958 957
959void KABCore::cutContacts() 958void KABCore::cutContacts()
960{ 959{
961 QStringList uidList = mViewManager->selectedUids(); 960 QStringList uidList = mViewManager->selectedUids();
962 961
963//US if ( uidList.size() > 0 ) { 962//US if ( uidList.size() > 0 ) {
964 if ( uidList.count() > 0 ) { 963 if ( uidList.count() > 0 ) {
965 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 964 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
966 UndoStack::instance()->push( command ); 965 UndoStack::instance()->push( command );
967 RedoStack::instance()->clear(); 966 RedoStack::instance()->clear();
968 967
969 setModified( true ); 968 setModified( true );
970 } 969 }
971} 970}
972 971
973void KABCore::pasteContacts() 972void KABCore::pasteContacts()
974{ 973{
975 QClipboard *cb = QApplication::clipboard(); 974 QClipboard *cb = QApplication::clipboard();
976 975
977 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 976 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
978 977
979 pasteContacts( list ); 978 pasteContacts( list );
980} 979}
981 980
982void KABCore::pasteContacts( KABC::Addressee::List &list ) 981void KABCore::pasteContacts( KABC::Addressee::List &list )
983{ 982{
984 KABC::Resource *resource = requestResource( this ); 983 KABC::Resource *resource = requestResource( this );
985 KABC::Addressee::List::Iterator it; 984 KABC::Addressee::List::Iterator it;
986 for ( it = list.begin(); it != list.end(); ++it ) 985 for ( it = list.begin(); it != list.end(); ++it )
987 (*it).setResource( resource ); 986 (*it).setResource( resource );
988 987
989 PwPasteCommand *command = new PwPasteCommand( this, list ); 988 PwPasteCommand *command = new PwPasteCommand( this, list );
990 UndoStack::instance()->push( command ); 989 UndoStack::instance()->push( command );
991 RedoStack::instance()->clear(); 990 RedoStack::instance()->clear();
992 991
993 setModified( true ); 992 setModified( true );
994} 993}
995 994
996void KABCore::setWhoAmI() 995void KABCore::setWhoAmI()
997{ 996{
998 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 997 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
999 998
1000 if ( addrList.count() > 1 ) { 999 if ( addrList.count() > 1 ) {
1001 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1000 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1002 return; 1001 return;
1003 } 1002 }
1004 1003
1005 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1004 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1006 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1005 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1007 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1006 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1008} 1007}
1009void KABCore::editCategories() 1008void KABCore::editCategories()
1010{ 1009{
1011 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1010 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1012 dlg.exec(); 1011 dlg.exec();
1013} 1012}
1014void KABCore::setCategories() 1013void KABCore::setCategories()
1015{ 1014{
1015
1016 QStringList uids;
1017 XXPortSelectDialog dlgx( this, false, this );
1018 if ( dlgx.exec() )
1019 uids = dlgx.uids();
1020 else
1021 return;
1022 if ( uids.isEmpty() )
1023 return;
1024 // qDebug("count %d ", uids.count());
1025
1026
1016 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1027 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1017 if ( !dlg.exec() ) { 1028 if ( !dlg.exec() ) {
1018 message( i18n("Setting categories cancelled") ); 1029 message( i18n("Setting categories cancelled") );
1019 return; 1030 return;
1020 } 1031 }
1021 bool merge = false; 1032 bool merge = false;
1022 QString msg = i18n( "Merge with existing categories?" ); 1033 QString msg = i18n( "Merge with existing categories?" );
1023 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1034 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1024 merge = true; 1035 merge = true;
1025 1036
1026 message( i18n("Setting categories ... please wait!") ); 1037 message( i18n("Setting categories ... please wait!") );
1027 QStringList categories = dlg.selectedCategories(); 1038 QStringList categories = dlg.selectedCategories();
1028 1039
1029 QStringList uids = mViewManager->selectedUids(); 1040 //QStringList uids = mViewManager->selectedUids();
1030 QStringList::Iterator it; 1041 QStringList::Iterator it;
1031 for ( it = uids.begin(); it != uids.end(); ++it ) { 1042 for ( it = uids.begin(); it != uids.end(); ++it ) {
1032 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1043 KABC::Addressee addr = mAddressBook->findByUid( *it );
1033 if ( !addr.isEmpty() ) { 1044 if ( !addr.isEmpty() ) {
1034 if ( !merge ) 1045 if ( !merge )
1035 addr.setCategories( categories ); 1046 addr.setCategories( categories );
1036 else { 1047 else {
1037 QStringList addrCategories = addr.categories(); 1048 QStringList addrCategories = addr.categories();
1038 QStringList::Iterator catIt; 1049 QStringList::Iterator catIt;
1039 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1050 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1040 if ( !addrCategories.contains( *catIt ) ) 1051 if ( !addrCategories.contains( *catIt ) )
1041 addrCategories.append( *catIt ); 1052 addrCategories.append( *catIt );
1042 } 1053 }
1043 addr.setCategories( addrCategories ); 1054 addr.setCategories( addrCategories );
1044 } 1055 }
1045 mAddressBook->insertAddressee( addr ); 1056 mAddressBook->insertAddressee( addr );
1046 } 1057 }
1047 } 1058 }
1048 1059
1049 if ( uids.count() > 0 ) 1060 if ( uids.count() > 0 )
1050 setModified( true ); 1061 setModified( true );
1051 message( i18n("Setting categories completed!") ); 1062 message( i18n("Setting categories completed!") );
1052} 1063}
1053 1064
1054void KABCore::setSearchFields( const KABC::Field::List &fields ) 1065void KABCore::setSearchFields( const KABC::Field::List &fields )
1055{ 1066{
1056 mIncSearchWidget->setFields( fields ); 1067 mIncSearchWidget->setFields( fields );
1057} 1068}
1058 1069
1059void KABCore::incrementalSearch( const QString& text ) 1070void KABCore::incrementalSearch( const QString& text )
1060{ 1071{
1061 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1072 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1062} 1073}
1063 1074
1064void KABCore::setModified() 1075void KABCore::setModified()
1065{ 1076{
1066 setModified( true ); 1077 setModified( true );
1067} 1078}
1068 1079
1069void KABCore::setModifiedWOrefresh() 1080void KABCore::setModifiedWOrefresh()
1070{ 1081{
1071 // qDebug("KABCore::setModifiedWOrefresh() "); 1082 // qDebug("KABCore::setModifiedWOrefresh() ");
1072 mModified = true; 1083 mModified = true;
1073 mActionSave->setEnabled( mModified ); 1084 mActionSave->setEnabled( mModified );
1074#ifdef DESKTOP_VERSION 1085#ifdef DESKTOP_VERSION
1075 mDetails->refreshView(); 1086 mDetails->refreshView();
1076#endif 1087#endif
1077 1088
1078} 1089}
1079void KABCore::setModified( bool modified ) 1090void KABCore::setModified( bool modified )
1080{ 1091{
1081 mModified = modified; 1092 mModified = modified;
1082 mActionSave->setEnabled( mModified ); 1093 mActionSave->setEnabled( mModified );
1083 1094
1084 if ( modified ) 1095 if ( modified )
1085 mJumpButtonBar->recreateButtons(); 1096 mJumpButtonBar->recreateButtons();
1086 1097
1087 mViewManager->refreshView(); 1098 mViewManager->refreshView();
1088 mDetails->refreshView(); 1099 mDetails->refreshView();
1089 1100
1090} 1101}
1091 1102
1092bool KABCore::modified() const 1103bool KABCore::modified() const
1093{ 1104{
1094 return mModified; 1105 return mModified;
1095} 1106}
1096 1107
1097void KABCore::contactModified( const KABC::Addressee &addr ) 1108void KABCore::contactModified( const KABC::Addressee &addr )
1098{ 1109{
1099 1110
1100 Command *command = 0; 1111 Command *command = 0;
1101 QString uid; 1112 QString uid;
1102 1113
1103 // check if it exists already 1114 // check if it exists already
1104 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1115 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1105 if ( origAddr.isEmpty() ) 1116 if ( origAddr.isEmpty() )
1106 command = new PwNewCommand( mAddressBook, addr ); 1117 command = new PwNewCommand( mAddressBook, addr );
1107 else { 1118 else {
1108 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1119 command = new PwEditCommand( mAddressBook, origAddr, addr );
1109 uid = addr.uid(); 1120 uid = addr.uid();
1110 } 1121 }
1111 1122
1112 UndoStack::instance()->push( command ); 1123 UndoStack::instance()->push( command );
1113 RedoStack::instance()->clear(); 1124 RedoStack::instance()->clear();
1114 1125
1115 setModified( true ); 1126 setModified( true );
1116} 1127}
1117 1128
1118void KABCore::newContact() 1129void KABCore::newContact()
1119{ 1130{
1120 1131
1121 1132
1122 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1133 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1123 1134
1124 QPtrList<KRES::Resource> kresResources; 1135 QPtrList<KRES::Resource> kresResources;
1125 QPtrListIterator<KABC::Resource> it( kabcResources ); 1136 QPtrListIterator<KABC::Resource> it( kabcResources );
1126 KABC::Resource *resource; 1137 KABC::Resource *resource;
1127 while ( ( resource = it.current() ) != 0 ) { 1138 while ( ( resource = it.current() ) != 0 ) {
1128 ++it; 1139 ++it;
1129 if ( !resource->readOnly() ) { 1140 if ( !resource->readOnly() ) {
1130 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1141 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1131 if ( res ) 1142 if ( res )
1132 kresResources.append( res ); 1143 kresResources.append( res );
1133 } 1144 }
1134 } 1145 }
1135 1146
1136 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1147 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1137 resource = static_cast<KABC::Resource*>( res ); 1148 resource = static_cast<KABC::Resource*>( res );
1138 1149
1139 if ( resource ) { 1150 if ( resource ) {
1140 KABC::Addressee addr; 1151 KABC::Addressee addr;
1141 addr.setResource( resource ); 1152 addr.setResource( resource );
1142 mEditorDialog->setAddressee( addr ); 1153 mEditorDialog->setAddressee( addr );
1143 KApplication::execDialog ( mEditorDialog ); 1154 KApplication::execDialog ( mEditorDialog );
1144 1155
1145 } else 1156 } else
1146 return; 1157 return;
1147 1158
1148 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1159 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1149 1160
1150 1161
1151} 1162}
1152 1163
1153void KABCore::addEmail( QString aStr ) 1164void KABCore::addEmail( QString aStr )
1154{ 1165{
1155#ifndef KAB_EMBEDDED 1166#ifndef KAB_EMBEDDED
1156 QString fullName, email; 1167 QString fullName, email;
1157 1168
1158 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1169 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1159 1170
1160 // Try to lookup the addressee matching the email address 1171 // Try to lookup the addressee matching the email address
1161 bool found = false; 1172 bool found = false;
1162 QStringList emailList; 1173 QStringList emailList;
1163 KABC::AddressBook::Iterator it; 1174 KABC::AddressBook::Iterator it;
1164 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1175 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1165 emailList = (*it).emails(); 1176 emailList = (*it).emails();
1166 if ( emailList.contains( email ) > 0 ) { 1177 if ( emailList.contains( email ) > 0 ) {
1167 found = true; 1178 found = true;
1168 (*it).setNameFromString( fullName ); 1179 (*it).setNameFromString( fullName );
1169 editContact( (*it).uid() ); 1180 editContact( (*it).uid() );
1170 } 1181 }
1171 } 1182 }
1172 1183
1173 if ( !found ) { 1184 if ( !found ) {
1174 KABC::Addressee addr; 1185 KABC::Addressee addr;
1175 addr.setNameFromString( fullName ); 1186 addr.setNameFromString( fullName );
1176 addr.insertEmail( email, true ); 1187 addr.insertEmail( email, true );
1177 1188
1178 mAddressBook->insertAddressee( addr ); 1189 mAddressBook->insertAddressee( addr );
1179 mViewManager->refreshView( addr.uid() ); 1190 mViewManager->refreshView( addr.uid() );
1180 editContact( addr.uid() ); 1191 editContact( addr.uid() );
1181 } 1192 }
1182#else //KAB_EMBEDDED 1193#else //KAB_EMBEDDED
1183 qDebug("KABCore::addEmail finsih method"); 1194 qDebug("KABCore::addEmail finsih method");
1184#endif //KAB_EMBEDDED 1195#endif //KAB_EMBEDDED
1185} 1196}
1186 1197
1187void KABCore::importVCard( const KURL &url, bool showPreview ) 1198void KABCore::importVCard( const KURL &url, bool showPreview )
1188{ 1199{
1189 mXXPortManager->importVCard( url, showPreview ); 1200 mXXPortManager->importVCard( url, showPreview );
1190} 1201}
1191void KABCore::importFromOL() 1202void KABCore::importFromOL()
1192{ 1203{
1193#ifdef _WIN32_ 1204#ifdef _WIN32_
1194 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1205 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1195 idgl->exec(); 1206 idgl->exec();
1196 KABC::Addressee::List list = idgl->getAddressList(); 1207 KABC::Addressee::List list = idgl->getAddressList();
1197 if ( list.count() > 0 ) { 1208 if ( list.count() > 0 ) {
1198 KABC::Addressee::List listNew; 1209 KABC::Addressee::List listNew;
1199 KABC::Addressee::List listExisting; 1210 KABC::Addressee::List listExisting;
1200 KABC::Addressee::List::Iterator it; 1211 KABC::Addressee::List::Iterator it;
1201 KABC::AddressBook::Iterator iter; 1212 KABC::AddressBook::Iterator iter;
1202 for ( it = list.begin(); it != list.end(); ++it ) { 1213 for ( it = list.begin(); it != list.end(); ++it ) {
1203 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1214 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1204 listNew.append( (*it) ); 1215 listNew.append( (*it) );
1205 else 1216 else
1206 listExisting.append( (*it) ); 1217 listExisting.append( (*it) );
1207 } 1218 }
1208 if ( listExisting.count() > 0 ) 1219 if ( listExisting.count() > 0 )
1209 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1220 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1210 if ( listNew.count() > 0 ) { 1221 if ( listNew.count() > 0 ) {
1211 pasteWithNewUid = false; 1222 pasteWithNewUid = false;
1212 pasteContacts( listNew ); 1223 pasteContacts( listNew );
1213 pasteWithNewUid = true; 1224 pasteWithNewUid = true;
1214 } 1225 }
1215 } 1226 }
1216 delete idgl; 1227 delete idgl;
1217#endif 1228#endif
1218} 1229}
1219 1230
1220void KABCore::importVCard( const QString &vCard, bool showPreview ) 1231void KABCore::importVCard( const QString &vCard, bool showPreview )
1221{ 1232{
@@ -1919,384 +1930,388 @@ void KABCore::initActions()
1919#ifndef KAB_EMBEDDED 1930#ifndef KAB_EMBEDDED
1920 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1931 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1921 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1932 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1922 this, SLOT( openLDAPDialog() ), actionCollection(), 1933 this, SLOT( openLDAPDialog() ), actionCollection(),
1923 "ldap_lookup" ); 1934 "ldap_lookup" );
1924 } 1935 }
1925#else //KAB_EMBEDDED 1936#else //KAB_EMBEDDED
1926 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1937 //qDebug("KABCore::initActions() LDAP has to be implemented");
1927#endif //KAB_EMBEDDED 1938#endif //KAB_EMBEDDED
1928 1939
1929 1940
1930 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1941 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1931 SLOT( setWhoAmI() ), actionCollection(), 1942 SLOT( setWhoAmI() ), actionCollection(),
1932 "set_personal" ); 1943 "set_personal" );
1933 1944
1934 1945
1935 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1946 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1936 SLOT( setCategories() ), actionCollection(), 1947 SLOT( setCategories() ), actionCollection(),
1937 "edit_set_categories" ); 1948 "edit_set_categories" );
1938 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, 1949 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
1939 SLOT( editCategories() ), actionCollection(), 1950 SLOT( editCategories() ), actionCollection(),
1940 "edit__categories" ); 1951 "edit__categories" );
1941 1952
1942 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1953 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1943 SLOT( removeVoice() ), actionCollection(), 1954 SLOT( removeVoice() ), actionCollection(),
1944 "remove_voice" ); 1955 "remove_voice" );
1945 1956
1946 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 1957 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
1947 SLOT( manageCategories() ), actionCollection(), 1958 SLOT( manageCategories() ), actionCollection(),
1948 "remove_voice" ); 1959 "remove_voice" );
1949 1960
1950 1961
1951 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1962 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1952 SLOT( importFromOL() ), actionCollection(), 1963 SLOT( importFromOL() ), actionCollection(),
1953 "import_OL" ); 1964 "import_OL" );
1954#ifdef KAB_EMBEDDED 1965#ifdef KAB_EMBEDDED
1955 mActionLicence = new KAction( i18n( "Licence" ), 0, 1966 mActionLicence = new KAction( i18n( "Licence" ), 0,
1956 this, SLOT( showLicence() ), actionCollection(), 1967 this, SLOT( showLicence() ), actionCollection(),
1957 "licence_about_data" ); 1968 "licence_about_data" );
1958 mActionFaq = new KAction( i18n( "Faq" ), 0, 1969 mActionFaq = new KAction( i18n( "Faq" ), 0,
1959 this, SLOT( faq() ), actionCollection(), 1970 this, SLOT( faq() ), actionCollection(),
1960 "faq_about_data" ); 1971 "faq_about_data" );
1961 mActionWN = new KAction( i18n( "What's New?" ), 0, 1972 mActionWN = new KAction( i18n( "What's New?" ), 0,
1962 this, SLOT( whatsnew() ), actionCollection(), 1973 this, SLOT( whatsnew() ), actionCollection(),
1963 "wn" ); 1974 "wn" );
1964 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1975 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1965 this, SLOT( synchowto() ), actionCollection(), 1976 this, SLOT( synchowto() ), actionCollection(),
1966 "sync" ); 1977 "sync" );
1967 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 1978 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
1968 this, SLOT( kdesynchowto() ), actionCollection(), 1979 this, SLOT( kdesynchowto() ), actionCollection(),
1969 "kdesync" ); 1980 "kdesync" );
1970 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 1981 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
1971 this, SLOT( multisynchowto() ), actionCollection(), 1982 this, SLOT( multisynchowto() ), actionCollection(),
1972 "multisync" ); 1983 "multisync" );
1973 1984
1974 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1985 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1975 this, SLOT( createAboutData() ), actionCollection(), 1986 this, SLOT( createAboutData() ), actionCollection(),
1976 "kaddressbook_about_data" ); 1987 "kaddressbook_about_data" );
1977#endif //KAB_EMBEDDED 1988#endif //KAB_EMBEDDED
1978 1989
1979 clipboardDataChanged(); 1990 clipboardDataChanged();
1980 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1991 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1981 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1992 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1982} 1993}
1983 1994
1984//US we need this function, to plug all actions into the correct menues. 1995//US we need this function, to plug all actions into the correct menues.
1985// KDE uses a XML format to plug the actions, but we work her without this overhead. 1996// KDE uses a XML format to plug the actions, but we work her without this overhead.
1986void KABCore::addActionsManually() 1997void KABCore::addActionsManually()
1987{ 1998{
1988//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1999//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1989 2000
1990#ifdef KAB_EMBEDDED 2001#ifdef KAB_EMBEDDED
1991 QPopupMenu *fileMenu = new QPopupMenu( this ); 2002 QPopupMenu *fileMenu = new QPopupMenu( this );
1992 QPopupMenu *editMenu = new QPopupMenu( this ); 2003 QPopupMenu *editMenu = new QPopupMenu( this );
1993 QPopupMenu *helpMenu = new QPopupMenu( this ); 2004 QPopupMenu *helpMenu = new QPopupMenu( this );
1994 2005
1995 KToolBar* tb = mMainWindow->toolBar(); 2006 KToolBar* tb = mMainWindow->toolBar();
1996 2007
1997#ifndef DESKTOP_VERSION 2008#ifndef DESKTOP_VERSION
1998 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2009 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
1999#endif 2010#endif
2000 QMenuBar* mb = mMainWindow->menuBar(); 2011 QMenuBar* mb = mMainWindow->menuBar();
2001 2012
2002 //US setup menubar. 2013 //US setup menubar.
2003 //Disable the following block if you do not want to have a menubar. 2014 //Disable the following block if you do not want to have a menubar.
2004 mb->insertItem( i18n("&File"), fileMenu ); 2015 mb->insertItem( i18n("&File"), fileMenu );
2005 mb->insertItem( i18n("&Edit"), editMenu ); 2016 mb->insertItem( i18n("&Edit"), editMenu );
2006 mb->insertItem( i18n("&View"), viewMenu ); 2017 mb->insertItem( i18n("&View"), viewMenu );
2007 mb->insertItem( i18n("&Settings"), settingsMenu ); 2018 mb->insertItem( i18n("&Settings"), settingsMenu );
2008 mb->insertItem( i18n("Synchronize"), syncMenu ); 2019 mb->insertItem( i18n("Synchronize"), syncMenu );
2009 //mb->insertItem( i18n("&Change"), changeMenu ); 2020 //mb->insertItem( i18n("&Change"), changeMenu );
2010 mb->insertItem( i18n("&Help"), helpMenu ); 2021 mb->insertItem( i18n("&Help"), helpMenu );
2011 mIncSearchWidget = new IncSearchWidget( tb ); 2022 mIncSearchWidget = new IncSearchWidget( tb );
2012 // tb->insertWidget(-1, 0, mIncSearchWidget); 2023 // tb->insertWidget(-1, 0, mIncSearchWidget);
2013#ifndef DESKTOP_VERSION 2024#ifndef DESKTOP_VERSION
2014 } else { 2025 } else {
2015 //US setup toolbar 2026 //US setup toolbar
2016 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2027 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2017 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2028 QPopupMenu *popupBarTB = new QPopupMenu( this );
2018 menuBarTB->insertItem( "ME", popupBarTB); 2029 menuBarTB->insertItem( "ME", popupBarTB);
2019 tb->insertWidget(-1, 0, menuBarTB); 2030 tb->insertWidget(-1, 0, menuBarTB);
2020 mIncSearchWidget = new IncSearchWidget( tb ); 2031 mIncSearchWidget = new IncSearchWidget( tb );
2021 2032
2022 tb->enableMoving(false); 2033 tb->enableMoving(false);
2023 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2034 popupBarTB->insertItem( i18n("&File"), fileMenu );
2024 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2035 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2025 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2036 popupBarTB->insertItem( i18n("&View"), viewMenu );
2026 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2037 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2027 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2038 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2028 mViewManager->getFilterAction()->plug ( popupBarTB); 2039 mViewManager->getFilterAction()->plug ( popupBarTB);
2029 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2040 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2030 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2041 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2031 if (QApplication::desktop()->width() > 320 ) { 2042 if (QApplication::desktop()->width() > 320 ) {
2032 // mViewManager->getFilterAction()->plug ( tb); 2043 // mViewManager->getFilterAction()->plug ( tb);
2033 } 2044 }
2034 } 2045 }
2035#endif 2046#endif
2036 // mActionQuit->plug ( mMainWindow->toolBar()); 2047 // mActionQuit->plug ( mMainWindow->toolBar());
2037 2048
2038 2049
2039 2050
2040 //US Now connect the actions with the menue entries. 2051 //US Now connect the actions with the menue entries.
2041 mActionPrint->plug( fileMenu ); 2052 mActionPrint->plug( fileMenu );
2042 mActionMail->plug( fileMenu ); 2053 mActionMail->plug( fileMenu );
2043 fileMenu->insertSeparator(); 2054 fileMenu->insertSeparator();
2044 2055
2045 mActionNewContact->plug( fileMenu ); 2056 mActionNewContact->plug( fileMenu );
2046 mActionNewContact->plug( tb ); 2057 mActionNewContact->plug( tb );
2047 2058
2048 mActionEditAddressee->plug( fileMenu ); 2059 mActionEditAddressee->plug( fileMenu );
2049 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2060 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2050 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2061 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2051 mActionEditAddressee->plug( tb ); 2062 mActionEditAddressee->plug( tb );
2052 2063
2053 fileMenu->insertSeparator(); 2064 fileMenu->insertSeparator();
2054 mActionSave->plug( fileMenu ); 2065 mActionSave->plug( fileMenu );
2055 fileMenu->insertItem( "&Import", ImportMenu ); 2066 fileMenu->insertItem( "&Import", ImportMenu );
2056 fileMenu->insertItem( "&Export", ExportMenu ); 2067 fileMenu->insertItem( "&Export", ExportMenu );
2057 fileMenu->insertItem( i18n("&Change"), changeMenu ); 2068 fileMenu->insertItem( i18n("&Change"), changeMenu );
2058 fileMenu->insertSeparator(); 2069 fileMenu->insertSeparator();
2059 mActionMailVCard->plug( fileMenu ); 2070 mActionMailVCard->plug( fileMenu );
2060#ifndef DESKTOP_VERSION 2071#ifndef DESKTOP_VERSION
2061 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 2072 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
2062 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 2073 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
2063#endif 2074#endif
2064 fileMenu->insertSeparator(); 2075 fileMenu->insertSeparator();
2065 mActionQuit->plug( fileMenu ); 2076 mActionQuit->plug( fileMenu );
2066#ifdef _WIN32_ 2077#ifdef _WIN32_
2067 mActionImportOL->plug( ImportMenu ); 2078 mActionImportOL->plug( ImportMenu );
2068#endif 2079#endif
2069 // edit menu 2080 // edit menu
2070 mActionUndo->plug( editMenu ); 2081 mActionUndo->plug( editMenu );
2071 mActionRedo->plug( editMenu ); 2082 mActionRedo->plug( editMenu );
2072 editMenu->insertSeparator(); 2083 editMenu->insertSeparator();
2073 mActionCut->plug( editMenu ); 2084 mActionCut->plug( editMenu );
2074 mActionCopy->plug( editMenu ); 2085 mActionCopy->plug( editMenu );
2075 mActionPaste->plug( editMenu ); 2086 mActionPaste->plug( editMenu );
2076 mActionDelete->plug( editMenu ); 2087 mActionDelete->plug( editMenu );
2077 editMenu->insertSeparator(); 2088 editMenu->insertSeparator();
2078 mActionSelectAll->plug( editMenu ); 2089 mActionSelectAll->plug( editMenu );
2079 2090
2080 mActionRemoveVoice->plug( changeMenu ); 2091 mActionRemoveVoice->plug( changeMenu );
2081 // settings menu 2092 // settings menu
2082//US special menuentry to configure the addressbook resources. On KDE 2093//US special menuentry to configure the addressbook resources. On KDE
2083// you do that through the control center !!! 2094// you do that through the control center !!!
2084 mActionConfigResources->plug( settingsMenu ); 2095 mActionConfigResources->plug( settingsMenu );
2085 settingsMenu->insertSeparator(); 2096 settingsMenu->insertSeparator();
2086 2097
2087 mActionConfigKAddressbook->plug( settingsMenu ); 2098 mActionConfigKAddressbook->plug( settingsMenu );
2088 2099
2089 if ( mIsPart ) { 2100 if ( mIsPart ) {
2090 //US not implemented yet 2101 //US not implemented yet
2091 //mActionConfigShortcuts->plug( settingsMenu ); 2102 //mActionConfigShortcuts->plug( settingsMenu );
2092 //mActionConfigureToolbars->plug( settingsMenu ); 2103 //mActionConfigureToolbars->plug( settingsMenu );
2093 2104
2094 } else { 2105 } else {
2095 //US not implemented yet 2106 //US not implemented yet
2096 //mActionKeyBindings->plug( settingsMenu ); 2107 //mActionKeyBindings->plug( settingsMenu );
2097 } 2108 }
2098 2109
2099 settingsMenu->insertSeparator(); 2110 settingsMenu->insertSeparator();
2100 2111
2101 mActionJumpBar->plug( settingsMenu ); 2112 mActionJumpBar->plug( settingsMenu );
2102 mActionDetails->plug( settingsMenu ); 2113 mActionDetails->plug( settingsMenu );
2103 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2114 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2104 mActionDetails->plug( tb ); 2115 mActionDetails->plug( tb );
2105 settingsMenu->insertSeparator(); 2116 settingsMenu->insertSeparator();
2106 mActionBR->plug(settingsMenu ); 2117 mActionBR->plug(settingsMenu );
2107 settingsMenu->insertSeparator(); 2118 settingsMenu->insertSeparator();
2108 2119
2109 mActionWhoAmI->plug( settingsMenu ); 2120 mActionWhoAmI->plug( settingsMenu );
2110 mActionEditCategories->plug( settingsMenu ); 2121 mActionEditCategories->plug( settingsMenu );
2122 mActionEditCategories->plug( changeMenu );
2123 mActionCategories->plug( changeMenu );
2124 mActionManageCategories->plug( changeMenu );
2125
2111 mActionCategories->plug( settingsMenu ); 2126 mActionCategories->plug( settingsMenu );
2112 mActionManageCategories->plug( settingsMenu ); 2127 mActionManageCategories->plug( settingsMenu );
2113 2128
2114 2129
2115 mActionWN->plug( helpMenu ); 2130 mActionWN->plug( helpMenu );
2116 mActionSyncHowto->plug( helpMenu ); 2131 mActionSyncHowto->plug( helpMenu );
2117 mActionKdeSyncHowto->plug( helpMenu ); 2132 mActionKdeSyncHowto->plug( helpMenu );
2118 mActionMultiSyncHowto->plug( helpMenu ); 2133 mActionMultiSyncHowto->plug( helpMenu );
2119 mActionFaq->plug( helpMenu ); 2134 mActionFaq->plug( helpMenu );
2120 mActionLicence->plug( helpMenu ); 2135 mActionLicence->plug( helpMenu );
2121 mActionAboutKAddressbook->plug( helpMenu ); 2136 mActionAboutKAddressbook->plug( helpMenu );
2122 2137
2123 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2138 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2124 2139
2125 mActionSave->plug( tb ); 2140 mActionSave->plug( tb );
2126 mViewManager->getFilterAction()->plug ( tb); 2141 mViewManager->getFilterAction()->plug ( tb);
2127 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2142 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2128 mActionUndo->plug( tb ); 2143 mActionUndo->plug( tb );
2129 mActionDelete->plug( tb ); 2144 mActionDelete->plug( tb );
2130 mActionRedo->plug( tb ); 2145 mActionRedo->plug( tb );
2131 } 2146 }
2132 } else { 2147 } else {
2133 mActionSave->plug( tb ); 2148 mActionSave->plug( tb );
2134 tb->enableMoving(false); 2149 tb->enableMoving(false);
2135 } 2150 }
2136 //mActionQuit->plug ( tb ); 2151 //mActionQuit->plug ( tb );
2137 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2152 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2138 2153
2139 //US link the searchwidget first to this. 2154 //US link the searchwidget first to this.
2140 // The real linkage to the toolbar happens later. 2155 // The real linkage to the toolbar happens later.
2141//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2156//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2142//US tb->insertItem( mIncSearchWidget ); 2157//US tb->insertItem( mIncSearchWidget );
2143/*US 2158/*US
2144 mIncSearchWidget = new IncSearchWidget( tb ); 2159 mIncSearchWidget = new IncSearchWidget( tb );
2145 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2160 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2146 SLOT( incrementalSearch( const QString& ) ) ); 2161 SLOT( incrementalSearch( const QString& ) ) );
2147 2162
2148 mJumpButtonBar = new JumpButtonBar( this, this ); 2163 mJumpButtonBar = new JumpButtonBar( this, this );
2149 2164
2150//US topLayout->addWidget( mJumpButtonBar ); 2165//US topLayout->addWidget( mJumpButtonBar );
2151 this->layout()->add( mJumpButtonBar ); 2166 this->layout()->add( mJumpButtonBar );
2152*/ 2167*/
2153 2168
2154#endif //KAB_EMBEDDED 2169#endif //KAB_EMBEDDED
2155 2170
2156 mActionExport2phone->plug( ExportMenu ); 2171 mActionExport2phone->plug( ExportMenu );
2157 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2172 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2158 syncManager->fillSyncMenu(); 2173 syncManager->fillSyncMenu();
2159 2174
2160} 2175}
2161void KABCore::showLicence() 2176void KABCore::showLicence()
2162{ 2177{
2163 KApplication::showLicence(); 2178 KApplication::showLicence();
2164} 2179}
2165 2180
2166void KABCore::manageCategories( ) 2181void KABCore::manageCategories( )
2167{ 2182{
2168 KABCatPrefs* cp = new KABCatPrefs(); 2183 KABCatPrefs* cp = new KABCatPrefs();
2169 cp->show(); 2184 cp->show();
2170 int w =cp->sizeHint().width() ; 2185 int w =cp->sizeHint().width() ;
2171 int h = cp->sizeHint().height() ; 2186 int h = cp->sizeHint().height() ;
2172 int dw = QApplication::desktop()->width(); 2187 int dw = QApplication::desktop()->width();
2173 int dh = QApplication::desktop()->height(); 2188 int dh = QApplication::desktop()->height();
2174 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2189 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2175 if ( !cp->exec() ) { 2190 if ( !cp->exec() ) {
2176 delete cp; 2191 delete cp;
2177 return; 2192 return;
2178 } 2193 }
2179 int count = 0; 2194 int count = 0;
2180 message( i18n("Please wait, processing categories...")); 2195 message( i18n("Please wait, processing categories..."));
2181 if ( cp->addCat() ) { 2196 if ( cp->addCat() ) {
2182 KABC::AddressBook::Iterator it; 2197 KABC::AddressBook::Iterator it;
2183 QStringList catList = KABPrefs::instance()->mCustomCategories; 2198 QStringList catList = KABPrefs::instance()->mCustomCategories;
2184 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2199 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2185 QStringList catIncList = (*it).categories(); 2200 QStringList catIncList = (*it).categories();
2186 int i; 2201 int i;
2187 for( i = 0; i< catIncList.count(); ++i ) { 2202 for( i = 0; i< catIncList.count(); ++i ) {
2188 if ( !catList.contains (catIncList[i])) { 2203 if ( !catList.contains (catIncList[i])) {
2189 catList.append( catIncList[i] ); 2204 catList.append( catIncList[i] );
2190 //qDebug("add cat %s ", catIncList[i].latin1()); 2205 //qDebug("add cat %s ", catIncList[i].latin1());
2191 ++count; 2206 ++count;
2192 } 2207 }
2193 } 2208 }
2194 } 2209 }
2195 catList.sort(); 2210 catList.sort();
2196 KABPrefs::instance()->mCustomCategories = catList; 2211 KABPrefs::instance()->mCustomCategories = catList;
2197 KABPrefs::instance()->writeConfig(); 2212 KABPrefs::instance()->writeConfig();
2198 message(QString::number( count )+ i18n(" categories added to list! ")); 2213 message(QString::number( count )+ i18n(" categories added to list! "));
2199 } else { 2214 } else {
2200 QStringList catList = KABPrefs::instance()->mCustomCategories; 2215 QStringList catList = KABPrefs::instance()->mCustomCategories;
2201 QStringList catIncList; 2216 QStringList catIncList;
2202 QStringList newCatList; 2217 QStringList newCatList;
2203 KABC::AddressBook::Iterator it; 2218 KABC::AddressBook::Iterator it;
2204 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2219 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2205 QStringList catIncList = (*it).categories(); 2220 QStringList catIncList = (*it).categories();
2206 int i; 2221 int i;
2207 if ( catIncList.count() ) { 2222 if ( catIncList.count() ) {
2208 newCatList.clear(); 2223 newCatList.clear();
2209 for( i = 0; i< catIncList.count(); ++i ) { 2224 for( i = 0; i< catIncList.count(); ++i ) {
2210 if ( catList.contains (catIncList[i])) { 2225 if ( catList.contains (catIncList[i])) {
2211 newCatList.append( catIncList[i] ); 2226 newCatList.append( catIncList[i] );
2212 } 2227 }
2213 } 2228 }
2214 newCatList.sort(); 2229 newCatList.sort();
2215 (*it).setCategories( newCatList ); 2230 (*it).setCategories( newCatList );
2216 mAddressBook->insertAddressee( (*it) ); 2231 mAddressBook->insertAddressee( (*it) );
2217 } 2232 }
2218 } 2233 }
2219 setModified( true ); 2234 setModified( true );
2220 mViewManager->refreshView(); 2235 mViewManager->refreshView();
2221 mDetails->refreshView(); 2236 mDetails->refreshView();
2222 message( i18n("Removing categories done!")); 2237 message( i18n("Removing categories done!"));
2223 } 2238 }
2224 delete cp; 2239 delete cp;
2225} 2240}
2226void KABCore::removeVoice() 2241void KABCore::removeVoice()
2227{ 2242{
2228 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2243 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2229 return; 2244 return;
2230 KABC::Addressee::List list; 2245 KABC::Addressee::List list;
2231 XXPortSelectDialog dlg( this, false, this ); 2246 XXPortSelectDialog dlg( this, false, this );
2232 if ( dlg.exec() ) 2247 if ( dlg.exec() )
2233 list = dlg.contacts(); 2248 list = dlg.contacts();
2234 else 2249 else
2235 return; 2250 return;
2236 KABC::Addressee::List::Iterator it; 2251 KABC::Addressee::List::Iterator it;
2237 for ( it = list.begin(); it != list.end(); ++it ) { 2252 for ( it = list.begin(); it != list.end(); ++it ) {
2238 if ( (*it).removeVoice() ) 2253 if ( (*it).removeVoice() )
2239 contactModified((*it) ); 2254 contactModified((*it) );
2240 } 2255 }
2241} 2256}
2242 2257
2243 2258
2244 2259
2245void KABCore::clipboardDataChanged() 2260void KABCore::clipboardDataChanged()
2246{ 2261{
2247 2262
2248 if ( mReadWrite ) 2263 if ( mReadWrite )
2249 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2264 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2250 2265
2251} 2266}
2252 2267
2253void KABCore::updateActionMenu() 2268void KABCore::updateActionMenu()
2254{ 2269{
2255 UndoStack *undo = UndoStack::instance(); 2270 UndoStack *undo = UndoStack::instance();
2256 RedoStack *redo = RedoStack::instance(); 2271 RedoStack *redo = RedoStack::instance();
2257 2272
2258 if ( undo->isEmpty() ) 2273 if ( undo->isEmpty() )
2259 mActionUndo->setText( i18n( "Undo" ) ); 2274 mActionUndo->setText( i18n( "Undo" ) );
2260 else 2275 else
2261 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2276 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2262 2277
2263 mActionUndo->setEnabled( !undo->isEmpty() ); 2278 mActionUndo->setEnabled( !undo->isEmpty() );
2264 2279
2265 if ( !redo->top() ) 2280 if ( !redo->top() )
2266 mActionRedo->setText( i18n( "Redo" ) ); 2281 mActionRedo->setText( i18n( "Redo" ) );
2267 else 2282 else
2268 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2283 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2269 2284
2270 mActionRedo->setEnabled( !redo->isEmpty() ); 2285 mActionRedo->setEnabled( !redo->isEmpty() );
2271} 2286}
2272 2287
2273void KABCore::configureKeyBindings() 2288void KABCore::configureKeyBindings()
2274{ 2289{
2275#ifndef KAB_EMBEDDED 2290#ifndef KAB_EMBEDDED
2276 KKeyDialog::configure( actionCollection(), true ); 2291 KKeyDialog::configure( actionCollection(), true );
2277#else //KAB_EMBEDDED 2292#else //KAB_EMBEDDED
2278 qDebug("KABCore::configureKeyBindings() not implemented"); 2293 qDebug("KABCore::configureKeyBindings() not implemented");
2279#endif //KAB_EMBEDDED 2294#endif //KAB_EMBEDDED
2280} 2295}
2281 2296
2282#ifdef KAB_EMBEDDED 2297#ifdef KAB_EMBEDDED
2283void KABCore::configureResources() 2298void KABCore::configureResources()
2284{ 2299{
2285 KRES::KCMKResources dlg( this, "" , 0 ); 2300 KRES::KCMKResources dlg( this, "" , 0 );
2286 2301
2287 if ( !dlg.exec() ) 2302 if ( !dlg.exec() )
2288 return; 2303 return;
2289 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2304 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2290} 2305}
2291#endif //KAB_EMBEDDED 2306#endif //KAB_EMBEDDED
2292 2307
2293 2308
2294/* this method will be called through the QCop interface from Ko/Pi to select addresses 2309/* this method will be called through the QCop interface from Ko/Pi to select addresses
2295 * for the attendees list of an event. 2310 * for the attendees list of an event.
2296 */ 2311 */
2297void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2312void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2298{ 2313{
2299 QStringList nameList; 2314 QStringList nameList;
2300 QStringList emailList; 2315 QStringList emailList;
2301 QStringList uidList; 2316 QStringList uidList;
2302 2317
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index be254c0..ab95d5f 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -1,288 +1,288 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> 3 Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
4 Tobias Koenig <tokoe@kde.org> 4 Tobias Koenig <tokoe@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25/* 25/*
26Enhanced Version of the file for platform independent KDE tools. 26Enhanced Version of the file for platform independent KDE tools.
27Copyright (c) 2004 Ulf Schenk 27Copyright (c) 2004 Ulf Schenk
28 28
29$Id$ 29$Id$
30*/ 30*/
31 31
32#include <kabc/addressbook.h> 32#include <kabc/addressbook.h>
33#include <kapplication.h> 33#include <kapplication.h>
34#include <kcombobox.h> 34#include <kcombobox.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kglobal.h> 36#include <kglobal.h>
37 37
38#include <qbuttongroup.h> 38#include <qbuttongroup.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qheader.h> 40#include <qheader.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qlayout.h> 42#include <qlayout.h>
43#include <qlistview.h> 43#include <qlistview.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qradiobutton.h> 45#include <qradiobutton.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qwhatsthis.h> 47#include <qwhatsthis.h>
48 48
49#include "kabcore.h" 49#include "kabcore.h"
50#include "kabprefs.h" 50#include "kabprefs.h"
51 51
52#include "xxportselectdialog.h" 52#include "xxportselectdialog.h"
53 53
54XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, 54XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
55 QWidget* parent, const char* name ) 55 QWidget* parent, const char* name )
56 : KDialogBase( Plain, i18n( "Choose which contacts to export" ), Help | Ok | Cancel, 56 : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel,
57 Ok, parent, name, true, true ), mCore( core ), 57 Ok, parent, name, true, true ), mCore( core ),
58 mUseSorting( sort ) 58 mUseSorting( sort )
59{ 59{
60 initGUI(); 60 initGUI();
61 61
62 connect( mFiltersCombo, SIGNAL( activated( int ) ), 62 connect( mFiltersCombo, SIGNAL( activated( int ) ),
63 SLOT( filterChanged( int ) ) ); 63 SLOT( filterChanged( int ) ) );
64 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), 64 connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ),
65 SLOT( categoryClicked( QListViewItem* ) ) ); 65 SLOT( categoryClicked( QListViewItem* ) ) );
66 66
67 // setup filters 67 // setup filters
68#ifndef KAB_EMBEDDED 68#ifndef KAB_EMBEDDED
69 mFilters = Filter::restore( kapp->config(), "Filter" ); 69 mFilters = Filter::restore( kapp->config(), "Filter" );
70 Filter::List::iterator filterIt; 70 Filter::List::iterator filterIt;
71#else //KAB_EMBEDDED 71#else //KAB_EMBEDDED
72 mFilters = Filter::restore( KGlobal::config(), "Filter" ); 72 mFilters = Filter::restore( KGlobal::config(), "Filter" );
73 Filter::List::Iterator filterIt; 73 Filter::List::Iterator filterIt;
74#endif //KAB_EMBEDDED 74#endif //KAB_EMBEDDED
75 QStringList filters; 75 QStringList filters;
76 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 76 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
77 filters.append( (*filterIt).name() ); 77 filters.append( (*filterIt).name() );
78 78
79 mFiltersCombo->insertStringList( filters ); 79 mFiltersCombo->insertStringList( filters );
80 mUseFilters->setEnabled( filters.count() > 0 ); 80 mUseFilters->setEnabled( filters.count() > 0 );
81 81
82 // setup categories 82 // setup categories
83 QStringList categories = KABPrefs::instance()->mCustomCategories; 83 QStringList categories = KABPrefs::instance()->mCustomCategories;
84 QStringList::Iterator it; 84 QStringList::Iterator it;
85 for ( it = categories.begin(); it != categories.end(); ++it ) 85 for ( it = categories.begin(); it != categories.end(); ++it )
86 new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); 86 new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox );
87 mUseCategories->setEnabled( categories.count() > 0 ); 87 mUseCategories->setEnabled( categories.count() > 0 );
88 88
89 int count = mCore->selectedUIDs().count(); 89 int count = mCore->selectedUIDs().count();
90 mUseSelection->setEnabled( count != 0 ); 90 mUseSelection->setEnabled( count != 0 );
91 mUseSelection->setChecked( count > 1 ); 91 mUseSelection->setChecked( count > 1 );
92 92
93 mSortTypeCombo->insertItem( i18n( "Ascending" ) ); 93 mSortTypeCombo->insertItem( i18n( "Ascending" ) );
94 mSortTypeCombo->insertItem( i18n( "Descending" ) ); 94 mSortTypeCombo->insertItem( i18n( "Descending" ) );
95 95
96 mFields = mCore->addressBook()->fields( KABC::Field::All ); 96 mFields = mCore->addressBook()->fields( KABC::Field::All );
97 KABC::Field::List::Iterator fieldIt; 97 KABC::Field::List::Iterator fieldIt;
98 for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) 98 for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt )
99 mFieldCombo->insertItem( (*fieldIt)->label() ); 99 mFieldCombo->insertItem( (*fieldIt)->label() );
100} 100}
101 101
102QStringList XXPortSelectDialog::uids() 102QStringList XXPortSelectDialog::uids()
103{ 103{
104 QStringList uidlist; 104 QStringList uidlist;
105 KABC::AddresseeList list = contacts(); 105 KABC::AddresseeList list = contacts();
106 KABC::Addressee::List::Iterator it; 106 KABC::Addressee::List::Iterator it;
107 for ( it = list.begin(); it != list.end(); ++it ) 107 for ( it = list.begin(); it != list.end(); ++it )
108 uidlist.append((*it).uid()); 108 uidlist.append((*it).uid());
109 return uidlist; 109 return uidlist;
110} 110}
111KABC::AddresseeList XXPortSelectDialog::contacts() 111KABC::AddresseeList XXPortSelectDialog::contacts()
112{ 112{
113 QStringList selection = mCore->selectedUIDs(); 113 QStringList selection = mCore->selectedUIDs();
114 114
115 KABC::AddresseeList list; 115 KABC::AddresseeList list;
116 if ( mUseSelection->isChecked() ) { 116 if ( mUseSelection->isChecked() ) {
117 QStringList::Iterator it; 117 QStringList::Iterator it;
118 for ( it = selection.begin(); it != selection.end(); ++it ) { 118 for ( it = selection.begin(); it != selection.end(); ++it ) {
119 KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); 119 KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
120 if ( !addr.isEmpty() ) 120 if ( !addr.isEmpty() )
121 list.append( addr ); 121 list.append( addr );
122 } 122 }
123 } else if ( mUseFilters->isChecked() ) { 123 } else if ( mUseFilters->isChecked() ) {
124 // find contacts that can pass selected filter 124 // find contacts that can pass selected filter
125 Filter::List::Iterator filterIt; 125 Filter::List::Iterator filterIt;
126 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) 126 for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
127 if ( (*filterIt).name() == mFiltersCombo->currentText() ) 127 if ( (*filterIt).name() == mFiltersCombo->currentText() )
128 break; 128 break;
129 129
130 KABC::AddressBook::Iterator it; 130 KABC::AddressBook::Iterator it;
131 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { 131 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
132 if ( (*filterIt).filterAddressee( *it ) ) 132 if ( (*filterIt).filterAddressee( *it ) )
133 list.append( *it ); 133 list.append( *it );
134 } 134 }
135 } else if ( mUseCategories->isChecked() ) { 135 } else if ( mUseCategories->isChecked() ) {
136 QStringList categorieList = categories(); 136 QStringList categorieList = categories();
137 KABC::AddressBook::Iterator it; 137 KABC::AddressBook::Iterator it;
138 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { 138 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
139 QStringList tmp( (*it).categories() ); 139 QStringList tmp( (*it).categories() );
140 QStringList::Iterator tmpIt; 140 QStringList::Iterator tmpIt;
141 for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) 141 for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt )
142 if ( categorieList.contains( *tmpIt ) ) { 142 if ( categorieList.contains( *tmpIt ) ) {
143 list.append( *it ); 143 list.append( *it );
144 break; 144 break;
145 } 145 }
146 } 146 }
147 } else { 147 } else {
148 // create a string list of all entries: 148 // create a string list of all entries:
149 KABC::AddressBook::Iterator it; 149 KABC::AddressBook::Iterator it;
150 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) 150 for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it )
151 list.append( *it ); 151 list.append( *it );
152 } 152 }
153 153
154 if ( mUseSorting ) { 154 if ( mUseSorting ) {
155 list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); 155 list.setReverseSorting( mSortTypeCombo->currentItem() == 1 );
156 uint pos = mFieldCombo->currentItem(); 156 uint pos = mFieldCombo->currentItem();
157 if ( pos < mFields.count() ) 157 if ( pos < mFields.count() )
158 list.sortByField( mFields[ pos ] ); 158 list.sortByField( mFields[ pos ] );
159 } 159 }
160 160
161 return list; 161 return list;
162} 162}
163 163
164QStringList XXPortSelectDialog::categories() const 164QStringList XXPortSelectDialog::categories() const
165{ 165{
166 QStringList list; 166 QStringList list;
167 167
168 QListViewItemIterator it( mCategoriesView ); 168 QListViewItemIterator it( mCategoriesView );
169 for ( ; it.current(); ++it ) { 169 for ( ; it.current(); ++it ) {
170 QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); 170 QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current());
171 if ( qcli->isOn() ) 171 if ( qcli->isOn() )
172 list.append( it.current()->text( 0 ) ); 172 list.append( it.current()->text( 0 ) );
173 } 173 }
174 174
175 return list; 175 return list;
176} 176}
177 177
178void XXPortSelectDialog::filterChanged( int ) 178void XXPortSelectDialog::filterChanged( int )
179{ 179{
180 mUseFilters->setChecked( true ); 180 mUseFilters->setChecked( true );
181} 181}
182 182
183void XXPortSelectDialog::categoryClicked( QListViewItem *i ) 183void XXPortSelectDialog::categoryClicked( QListViewItem *i )
184{ 184{
185 QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); 185 QCheckListItem *qcli = static_cast<QCheckListItem*>( i );
186 if ( qcli->isOn() ) 186 if ( qcli->isOn() )
187 mUseCategories->setChecked( true ); 187 mUseCategories->setChecked( true );
188} 188}
189 189
190void XXPortSelectDialog::slotHelp() 190void XXPortSelectDialog::slotHelp()
191{ 191{
192#ifndef KAB_EMBEDDED 192#ifndef KAB_EMBEDDED
193 kapp->invokeHelp( "import-and-export" ); 193 kapp->invokeHelp( "import-and-export" );
194#else //KAB_EMBEDDED 194#else //KAB_EMBEDDED
195 qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); 195 qDebug("XXPortSelectDialog::slotHelp is not implemented yet");
196#endif //KAB_EMBEDDED 196#endif //KAB_EMBEDDED
197 197
198} 198}
199 199
200void XXPortSelectDialog::initGUI() 200void XXPortSelectDialog::initGUI()
201{ 201{
202 QFrame *page = plainPage(); 202 QFrame *page = plainPage();
203 203
204 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), 204 QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(),
205 KDialog::spacingHint() ); 205 KDialog::spacingHint() );
206 206
207 QLabel *label = new QLabel( i18n( "Which contacts do you want to export?" ), page ); 207 QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page );
208 topLayout->addWidget( label ); 208 topLayout->addWidget( label );
209 209
210 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); 210 mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page );
211 mButtonGroup->setColumnLayout( 0, Qt::Vertical ); 211 mButtonGroup->setColumnLayout( 0, Qt::Vertical );
212 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); 212 mButtonGroup->layout()->setSpacing( KDialog::spacingHint() );
213 mButtonGroup->layout()->setMargin( KDialog::marginHint() ); 213 mButtonGroup->layout()->setMargin( KDialog::marginHint() );
214 214
215 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); 215 QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() );
216 groupLayout->setAlignment( Qt::AlignTop ); 216 groupLayout->setAlignment( Qt::AlignTop );
217 217
218 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); 218 mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup );
219 mUseWholeBook->setChecked( true ); 219 mUseWholeBook->setChecked( true );
220 QWhatsThis::add( mUseWholeBook, i18n( "Export the entire address book" ) ); 220 QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) );
221 groupLayout->addWidget( mUseWholeBook, 0, 0 ); 221 groupLayout->addWidget( mUseWholeBook, 0, 0 );
222 222
223 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); 223 mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup );
224 QWhatsThis::add( mUseSelection, i18n( "Only export contacts selected in KAddressBook.\n" 224 QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n"
225 "This option is disabled if no contacts are selected." ) ); 225 "This option is disabled if no contacts are selected." ) );
226 groupLayout->addWidget( mUseSelection, 1, 0 ); 226 groupLayout->addWidget( mUseSelection, 1, 0 );
227 227
228 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); 228 mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup );
229 QWhatsThis::add( mUseFilters, i18n( "Only export contacts matching the selected filter.\n" 229 QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n"
230 "This option is disabled if you haven't defined any filters" ) ); 230 "This option is disabled if you haven't defined any filters" ) );
231 groupLayout->addWidget( mUseFilters, 2, 0 ); 231 groupLayout->addWidget( mUseFilters, 2, 0 );
232 232
233 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); 233 mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup );
234 QWhatsThis::add( mUseCategories, i18n( "Only export contacts who are members of a category that is checked on the list to the left.\n" 234 QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n"
235 "This option is disabled if you have no categories." ) ); 235 "This option is disabled if you have no categories." ) );
236 groupLayout->addWidget( mUseCategories, 3, 0 ); 236 groupLayout->addWidget( mUseCategories, 3, 0 );
237 237
238 mFiltersCombo = new QComboBox( false, mButtonGroup ); 238 mFiltersCombo = new QComboBox( false, mButtonGroup );
239 QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to export." ) ); 239 QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) );
240 groupLayout->addWidget( mFiltersCombo, 2, 1 ); 240 groupLayout->addWidget( mFiltersCombo, 2, 1 );
241 241
242 mCategoriesView = new QListView( mButtonGroup ); 242 mCategoriesView = new QListView( mButtonGroup );
243 mCategoriesView->addColumn( "" ); 243 mCategoriesView->addColumn( "" );
244 mCategoriesView->header()->hide(); 244 mCategoriesView->header()->hide();
245 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to export." ) ); 245 QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) );
246 groupLayout->addWidget( mCategoriesView, 3, 1 ); 246 groupLayout->addWidget( mCategoriesView, 3, 1 );
247 247
248 topLayout->addWidget( mButtonGroup ); 248 topLayout->addWidget( mButtonGroup );
249 249
250 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); 250 QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page );
251 sortingGroup->setColumnLayout( 0, Qt::Vertical ); 251 sortingGroup->setColumnLayout( 0, Qt::Vertical );
252 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, 252 QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2,
253 KDialog::spacingHint() ); 253 KDialog::spacingHint() );
254 sortLayout->setAlignment( Qt::AlignTop ); 254 sortLayout->setAlignment( Qt::AlignTop );
255 255
256 label = new QLabel( i18n( "Criterion:" ), sortingGroup ); 256 label = new QLabel( i18n( "Criterion:" ), sortingGroup );
257 sortLayout->addWidget( label, 0, 0 ); 257 sortLayout->addWidget( label, 0, 0 );
258 258
259#ifndef KAB_EMBEDDED 259#ifndef KAB_EMBEDDED
260 mFieldCombo = new KComboBox( false, sortingGroup ); 260 mFieldCombo = new KComboBox( false, sortingGroup );
261#else //KAB_EMBEDDED 261#else //KAB_EMBEDDED
262 //US Combobox is not editable anyway 262 //US Combobox is not editable anyway
263 mFieldCombo = new KComboBox( sortingGroup ); 263 mFieldCombo = new KComboBox( sortingGroup );
264#endif //KAB_EMBEDDED 264#endif //KAB_EMBEDDED
265 sortLayout->addWidget( mFieldCombo, 0, 1 ); 265 sortLayout->addWidget( mFieldCombo, 0, 1 );
266 266
267 label = new QLabel( i18n( "Order:" ), sortingGroup ); 267 label = new QLabel( i18n( "Order:" ), sortingGroup );
268 sortLayout->addWidget( label, 1, 0 ); 268 sortLayout->addWidget( label, 1, 0 );
269 269
270#ifndef KAB_EMBEDDED 270#ifndef KAB_EMBEDDED
271 mSortTypeCombo = new KComboBox( false, sortingGroup ); 271 mSortTypeCombo = new KComboBox( false, sortingGroup );
272#else //KAB_EMBEDDED 272#else //KAB_EMBEDDED
273 //US Combobox is not editable anyway 273 //US Combobox is not editable anyway
274 mSortTypeCombo = new KComboBox( sortingGroup ); 274 mSortTypeCombo = new KComboBox( sortingGroup );
275#endif //KAB_EMBEDDED 275#endif //KAB_EMBEDDED
276 sortLayout->addWidget( mSortTypeCombo, 1, 1 ); 276 sortLayout->addWidget( mSortTypeCombo, 1, 1 );
277 277
278 topLayout->addWidget( sortingGroup ); 278 topLayout->addWidget( sortingGroup );
279 279
280 if ( !mUseSorting ) 280 if ( !mUseSorting )
281 sortingGroup->hide(); 281 sortingGroup->hide();
282} 282}
283 283
284#ifndef KAB_EMBEDDED 284#ifndef KAB_EMBEDDED
285#include "xxportselectdialog.moc" 285#include "xxportselectdialog.moc"
286#endif //KAB_EMBEDDED 286#endif //KAB_EMBEDDED
287 287
288 288