-rw-r--r-- | kaddressbook/kabcore.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d99a9cd..7be5db8 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -659,49 +659,48 @@ void KABCore::setContactSelected( const QString &uid ) | |||
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 | ||
686 | void KABCore::sendMail() | 685 | void KABCore::sendMail() |
687 | { | 686 | { |
688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 687 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
689 | } | 688 | } |
690 | 689 | ||
691 | void KABCore::sendMail( const QString& emaillist ) | 690 | void 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 | ||
702 | void KABCore::mailVCard() | 701 | void 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 | } |
@@ -992,62 +991,74 @@ void KABCore::pasteContacts( KABC::Addressee::List &list ) | |||
992 | 991 | ||
993 | setModified( true ); | 992 | setModified( true ); |
994 | } | 993 | } |
995 | 994 | ||
996 | void KABCore::setWhoAmI() | 995 | void 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 | } |
1009 | void KABCore::editCategories() | 1008 | void 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 | } |
1014 | void KABCore::setCategories() | 1013 | void 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 | ||
@@ -2087,48 +2098,52 @@ void KABCore::addActionsManually() | |||
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); |