author | zautrix <zautrix> | 2005-08-17 14:48:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-17 14:48:16 (UTC) |
commit | 9e6d1f7f45ef1444dc6ee96347a2dbd67a0d79dd (patch) (unidiff) | |
tree | 4db3dfc9b67b56f415a9aab4306cc6375c6e7310 /kaddressbook/kabcore.cpp | |
parent | cb4e02944327194bc6066c4ec96826afc0ea178f (diff) | |
download | kdepimpi-9e6d1f7f45ef1444dc6ee96347a2dbd67a0d79dd.zip kdepimpi-9e6d1f7f45ef1444dc6ee96347a2dbd67a0d79dd.tar.gz kdepimpi-9e6d1f7f45ef1444dc6ee96347a2dbd67a0d79dd.tar.bz2 |
kapi dlete conf
-rw-r--r-- | kaddressbook/kabcore.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d5de9cb..b9830b1 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1019,25 +1019,41 @@ void KABCore::selectAllContacts() | |||
1019 | { | 1019 | { |
1020 | mViewManager->setSelected( QString::null, true ); | 1020 | mViewManager->setSelected( QString::null, true ); |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void KABCore::deleteContacts() | 1023 | void KABCore::deleteContacts() |
1024 | { | 1024 | { |
1025 | QStringList uidList = mViewManager->selectedUids(); | 1025 | QStringList uidList = mViewManager->selectedUids(); |
1026 | deleteContacts( uidList ); | 1026 | deleteContacts( uidList ); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | void KABCore::deleteContacts( const QStringList &uids ) | 1029 | void KABCore::deleteContacts( const QStringList &uids ) |
1030 | { | 1030 | { |
1031 | |||
1031 | if ( uids.count() > 0 ) { | 1032 | if ( uids.count() > 0 ) { |
1033 | |||
1034 | if ( KABPrefs::instance()->mAskForDelete ) { | ||
1035 | int count = uids.count(); | ||
1036 | if ( count > 5 ) count = 5; | ||
1037 | QString cNames; | ||
1038 | int i; | ||
1039 | for ( i = 0; i < count ; ++i ) { | ||
1040 | cNames += KGlobal::formatMessage( mAddressBook->findByUid( uids[i] ).realName() ,0) + "\n"; | ||
1041 | } | ||
1042 | if ( uids.count() > 5 ) | ||
1043 | cNames += i18n("...and %1 more\ncontact(s) selected").arg( uids.count() - 5 ); | ||
1044 | QString text = i18n( "Do you really\nwant to delete the\nsetected contact(s)?\n\n" ) + cNames ; | ||
1045 | if ( KMessageBox::questionYesNo( this, text ) != KMessageBox::Yes ) | ||
1046 | return; | ||
1047 | } | ||
1032 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 1048 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
1033 | UndoStack::instance()->push( command ); | 1049 | UndoStack::instance()->push( command ); |
1034 | RedoStack::instance()->clear(); | 1050 | RedoStack::instance()->clear(); |
1035 | 1051 | ||
1036 | // now if we deleted anything, refresh | 1052 | // now if we deleted anything, refresh |
1037 | setContactSelected( QString::null ); | 1053 | setContactSelected( QString::null ); |
1038 | setModified( true ); | 1054 | setModified( true ); |
1039 | } | 1055 | } |
1040 | } | 1056 | } |
1041 | 1057 | ||
1042 | void KABCore::copyContacts() | 1058 | void KABCore::copyContacts() |
1043 | { | 1059 | { |
@@ -1089,25 +1105,25 @@ void KABCore::pasteContacts( KABC::Addressee::List &list ) | |||
1089 | } | 1105 | } |
1090 | 1106 | ||
1091 | void KABCore::setWhoAmI() | 1107 | void KABCore::setWhoAmI() |
1092 | { | 1108 | { |
1093 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1109 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1094 | 1110 | ||
1095 | if ( addrList.count() > 1 ) { | 1111 | if ( addrList.count() > 1 ) { |
1096 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1112 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1097 | return; | 1113 | return; |
1098 | } | 1114 | } |
1099 | 1115 | ||
1100 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1116 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1101 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1117 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].realName() ) ) == KMessageBox::Yes ) |
1102 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1118 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1103 | } | 1119 | } |
1104 | void KABCore::editCategories() | 1120 | void KABCore::editCategories() |
1105 | { | 1121 | { |
1106 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1122 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1107 | dlg.exec(); | 1123 | dlg.exec(); |
1108 | } | 1124 | } |
1109 | void KABCore::setCategories() | 1125 | void KABCore::setCategories() |
1110 | { | 1126 | { |
1111 | 1127 | ||
1112 | QStringList uids; | 1128 | QStringList uids; |
1113 | XXPortSelectDialog dlgx( this, false, this ); | 1129 | XXPortSelectDialog dlgx( this, false, this ); |
@@ -2657,25 +2673,25 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString | |||
2657 | { | 2673 | { |
2658 | if (bday.isValid()) | 2674 | if (bday.isValid()) |
2659 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2675 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2660 | else | 2676 | else |
2661 | formattedbday = "NOTVALID"; | 2677 | formattedbday = "NOTVALID"; |
2662 | if (anni.isEmpty()) | 2678 | if (anni.isEmpty()) |
2663 | anni = "INVALID"; | 2679 | anni = "INVALID"; |
2664 | 2680 | ||
2665 | birthdayList.append(formattedbday); | 2681 | birthdayList.append(formattedbday); |
2666 | anniversaryList.append(anni); //should be ISODate | 2682 | anniversaryList.append(anni); //should be ISODate |
2667 | realNameList.append((*it).realName()); | 2683 | realNameList.append((*it).realName()); |
2668 | preferredEmailList.append((*it).preferredEmail()); | 2684 | preferredEmailList.append((*it).preferredEmail()); |
2669 | assembledNameList.append((*it).assembledName()); | 2685 | assembledNameList.append((*it).realName()); |
2670 | uidList.append((*it).uid()); | 2686 | uidList.append((*it).uid()); |
2671 | 2687 | ||
2672 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2688 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2673 | } | 2689 | } |
2674 | } | 2690 | } |
2675 | 2691 | ||
2676 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2692 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2677 | 2693 | ||
2678 | } | 2694 | } |
2679 | 2695 | ||
2680 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2696 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2681 | */ | 2697 | */ |