summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp34
1 files changed, 7 insertions, 27 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index fa9f130..9c40142 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -538,237 +538,217 @@ void KABCore::restoreSettings()
538 if ( true /*splitterSize.count() == 0*/ ) { 538 if ( true /*splitterSize.count() == 0*/ ) {
539 splitterSize.append( wid / 2 ); 539 splitterSize.append( wid / 2 );
540 splitterSize.append( wid / 2 ); 540 splitterSize.append( wid / 2 );
541 } 541 }
542 mMiniSplitter->setSizes( splitterSize ); 542 mMiniSplitter->setSizes( splitterSize );
543 if ( mExtensionBarSplitter ) { 543 if ( mExtensionBarSplitter ) {
544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
545 if ( true /*splitterSize.count() == 0*/ ) { 545 if ( true /*splitterSize.count() == 0*/ ) {
546 splitterSize.append( wid / 2 ); 546 splitterSize.append( wid / 2 );
547 splitterSize.append( wid / 2 ); 547 splitterSize.append( wid / 2 );
548 } 548 }
549 mExtensionBarSplitter->setSizes( splitterSize ); 549 mExtensionBarSplitter->setSizes( splitterSize );
550 550
551 } 551 }
552 552
553 553
554} 554}
555 555
556void KABCore::saveSettings() 556void KABCore::saveSettings()
557{ 557{
558 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 558 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
559 if ( mExtensionBarSplitter ) 559 if ( mExtensionBarSplitter )
560 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 560 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
561 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 561 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
562 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 562 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
563#ifndef KAB_EMBEDDED 563#ifndef KAB_EMBEDDED
564 564
565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
567#endif //KAB_EMBEDDED 567#endif //KAB_EMBEDDED
568 mExtensionManager->saveSettings(); 568 mExtensionManager->saveSettings();
569 mViewManager->saveSettings(); 569 mViewManager->saveSettings();
570 570
571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
572 KABPrefs::instance()->writeConfig(); 572 KABPrefs::instance()->writeConfig();
573 qDebug("KA: KABCore::saveSettings() "); 573 qDebug("KA: KABCore::saveSettings() ");
574} 574}
575 575
576KABC::AddressBook *KABCore::addressBook() const 576KABC::AddressBook *KABCore::addressBook() const
577{ 577{
578 return mAddressBook; 578 return mAddressBook;
579} 579}
580 580
581KConfig *KABCore::config() 581KConfig *KABCore::config()
582{ 582{
583#ifndef KAB_EMBEDDED 583#ifndef KAB_EMBEDDED
584 return KABPrefs::instance()->config(); 584 return KABPrefs::instance()->config();
585#else //KAB_EMBEDDED 585#else //KAB_EMBEDDED
586 return KABPrefs::instance()->getConfig(); 586 return KABPrefs::instance()->getConfig();
587#endif //KAB_EMBEDDED 587#endif //KAB_EMBEDDED
588} 588}
589 589
590KActionCollection *KABCore::actionCollection() const 590KActionCollection *KABCore::actionCollection() const
591{ 591{
592 return mGUIClient->actionCollection(); 592 return mGUIClient->actionCollection();
593} 593}
594 594
595KABC::Field *KABCore::currentSearchField() const 595KABC::Field *KABCore::currentSearchField() const
596{ 596{
597 if (mIncSearchWidget) 597 if (mIncSearchWidget)
598 return mIncSearchWidget->currentField(); 598 return mIncSearchWidget->currentField();
599 else 599 else
600 return 0; 600 return 0;
601} 601}
602 602
603QStringList KABCore::selectedUIDs() const 603QStringList KABCore::selectedUIDs() const
604{ 604{
605 return mViewManager->selectedUids(); 605 return mViewManager->selectedUids();
606} 606}
607 607
608KABC::Resource *KABCore::requestResource( QWidget *parent ) 608KABC::Resource *KABCore::requestResource( QWidget *parent )
609{ 609{
610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
611 611
612 QPtrList<KRES::Resource> kresResources; 612 QPtrList<KRES::Resource> kresResources;
613 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 613 QPtrListIterator<KABC::Resource> resIt( kabcResources );
614 KABC::Resource *resource; 614 KABC::Resource *resource;
615 while ( ( resource = resIt.current() ) != 0 ) { 615 while ( ( resource = resIt.current() ) != 0 ) {
616 ++resIt; 616 ++resIt;
617 if ( !resource->readOnly() ) { 617 if ( !resource->readOnly() ) {
618 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 618 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
619 if ( res ) 619 if ( res )
620 kresResources.append( res ); 620 kresResources.append( res );
621 } 621 }
622 } 622 }
623 623
624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
625 return static_cast<KABC::Resource*>( res ); 625 return static_cast<KABC::Resource*>( res );
626} 626}
627 627
628#ifndef KAB_EMBEDDED 628#ifndef KAB_EMBEDDED
629KAboutData *KABCore::createAboutData() 629KAboutData *KABCore::createAboutData()
630#else //KAB_EMBEDDED 630#else //KAB_EMBEDDED
631void KABCore::createAboutData() 631void KABCore::createAboutData()
632#endif //KAB_EMBEDDED 632#endif //KAB_EMBEDDED
633{ 633{
634#ifndef KAB_EMBEDDED 634
635 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
636 "3.1", I18N_NOOP( "The KDE Address Book" ),
637 KAboutData::License_GPL_V2,
638 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
639 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
640 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
641 about->addAuthor( "Cornelius Schumacher",
642 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
643 "schumacher@kde.org" );
644 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
645 "mpilone@slac.com" );
646 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
647 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
648 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
649 "michel@klaralvdalens-datakonsult.se" );
650 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
651 "hansen@kde.org" );
652
653 return about;
654#endif //KAB_EMBEDDED
655 635
656 QString version; 636 QString version;
657#include <../version> 637#include <../version>
658 QMessageBox::about( this, "About KAddressbook/Pi", 638 QMessageBox::about( this, "About KAddressbook/Pi",
659 "KAddressbook/Platform-independent\n" 639 "KAddressbook/Platform-independent\n"
660 "(KA/Pi) " +version + " - " + 640 "(KA/Pi) " +version + " - " +
661#ifdef DESKTOP_VERSION 641#ifdef DESKTOP_VERSION
662 "Desktop Edition\n" 642 "Desktop Edition\n"
663#else 643#else
664 "PDA-Edition\n" 644 "PDA-Edition\n"
665 "for: Zaurus 5500 / 7x0 / 8x0\n" 645 "for: Zaurus 5500 / 7x0 / 8x0\n"
666#endif 646#endif
667 647
668 "(c) 2004 Ulf Schenk\n" 648 "(c) 2004 Ulf Schenk\n"
669 "(c) 2004 Lutz Rogowski\n" 649 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n"
670 "(c) 1997-2003, The KDE PIM Team\n" 650 "(c) 1997-2003, The KDE PIM Team\n"
671 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 651 "Tobias Koenig Maintainer\n"
672 "Don Sanders Original author\n" 652 "Don Sanders Original author\n"
673 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 653 "Cornelius Schumacher Co-maintainer\n"
674 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 654 "Mike Pilone GUI and framework redesign\n"
675 "Greg Stern DCOP interface\n" 655 "Greg Stern DCOP interface\n"
676 "Mark Westcot Contact pinning\n" 656 "Mark Westcot Contact pinning\n"
677 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 657 "Michel Boyer de la Giroday LDAP Lookup\n"
678 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 658 "Steffen Hansen LDAP Lookup"
679#ifdef _WIN32_ 659#ifdef _WIN32_
680 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 660 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
681#endif 661#endif
682 ); 662 );
683} 663}
684 664
685void KABCore::setContactSelected( const QString &uid ) 665void KABCore::setContactSelected( const QString &uid )
686{ 666{
687 KABC::Addressee addr = mAddressBook->findByUid( uid ); 667 KABC::Addressee addr = mAddressBook->findByUid( uid );
688 if ( !mDetails->isHidden() ) 668 if ( !mDetails->isHidden() )
689 mDetails->setAddressee( addr ); 669 mDetails->setAddressee( addr );
690 670
691 if ( !addr.isEmpty() ) { 671 if ( !addr.isEmpty() ) {
692 emit contactSelected( addr.formattedName() ); 672 emit contactSelected( addr.formattedName() );
693 KABC::Picture pic = addr.photo(); 673 KABC::Picture pic = addr.photo();
694 if ( pic.isIntern() ) { 674 if ( pic.isIntern() ) {
695//US emit contactSelected( pic.data() ); 675//US emit contactSelected( pic.data() );
696//US instead use: 676//US instead use:
697 QPixmap px; 677 QPixmap px;
698 if (pic.data().isNull() != true) 678 if (pic.data().isNull() != true)
699 { 679 {
700 px.convertFromImage(pic.data()); 680 px.convertFromImage(pic.data());
701 } 681 }
702 682
703 emit contactSelected( px ); 683 emit contactSelected( px );
704 } 684 }
705 } 685 }
706 686
707 687
708 mExtensionManager->setSelectionChanged(); 688 mExtensionManager->setSelectionChanged();
709 689
710 // update the actions 690 // update the actions
711 bool selected = !uid.isEmpty(); 691 bool selected = !uid.isEmpty();
712 692
713 if ( mReadWrite ) { 693 if ( mReadWrite ) {
714 mActionCut->setEnabled( selected ); 694 mActionCut->setEnabled( selected );
715 mActionPaste->setEnabled( selected ); 695 mActionPaste->setEnabled( selected );
716 } 696 }
717 697
718 mActionCopy->setEnabled( selected ); 698 mActionCopy->setEnabled( selected );
719 mActionDelete->setEnabled( selected ); 699 mActionDelete->setEnabled( selected );
720 mActionEditAddressee->setEnabled( selected ); 700 mActionEditAddressee->setEnabled( selected );
721 mActionMail->setEnabled( selected ); 701 mActionMail->setEnabled( selected );
722 mActionMailVCard->setEnabled( selected ); 702 mActionMailVCard->setEnabled( selected );
723 //if (mActionBeam) 703 //if (mActionBeam)
724 //mActionBeam->setEnabled( selected ); 704 //mActionBeam->setEnabled( selected );
725 mActionWhoAmI->setEnabled( selected ); 705 mActionWhoAmI->setEnabled( selected );
726} 706}
727 707
728void KABCore::sendMail() 708void KABCore::sendMail()
729{ 709{
730 sendMail( mViewManager->selectedEmails().join( ", " ) ); 710 sendMail( mViewManager->selectedEmails().join( ", " ) );
731} 711}
732 712
733void KABCore::sendMail( const QString& emaillist ) 713void KABCore::sendMail( const QString& emaillist )
734{ 714{
735 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 715 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
736 if (emaillist.contains(",") > 0) 716 if (emaillist.contains(",") > 0)
737 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 717 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
738 else 718 else
739 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 719 ExternalAppHandler::instance()->mailToOneContact( emaillist );
740} 720}
741 721
742 722
743 723
744void KABCore::mailVCard() 724void KABCore::mailVCard()
745{ 725{
746 QStringList uids = mViewManager->selectedUids(); 726 QStringList uids = mViewManager->selectedUids();
747 if ( !uids.isEmpty() ) 727 if ( !uids.isEmpty() )
748 mailVCard( uids ); 728 mailVCard( uids );
749} 729}
750 730
751void KABCore::mailVCard( const QStringList& uids ) 731void KABCore::mailVCard( const QStringList& uids )
752{ 732{
753 QStringList urls; 733 QStringList urls;
754 734
755// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 735// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
756 736
757 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 737 QString dirName = "/tmp/" + KApplication::randomString( 8 );
758 738
759 739
760 740
761 QDir().mkdir( dirName, true ); 741 QDir().mkdir( dirName, true );
762 742
763 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 743 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
764 KABC::Addressee a = mAddressBook->findByUid( *it ); 744 KABC::Addressee a = mAddressBook->findByUid( *it );
765 745
766 if ( a.isEmpty() ) 746 if ( a.isEmpty() )
767 continue; 747 continue;
768 748
769 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 749 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
770 750
771 QString fileName = dirName + "/" + name; 751 QString fileName = dirName + "/" + name;
772 752
773 QFile outFile(fileName); 753 QFile outFile(fileName);
774 754