summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp20
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
@@ -1007,49 +1007,65 @@ void KABCore::beamDone( Ir *ir )
void KABCore::browse( const QString& url )
{
#ifndef KAB_EMBEDDED
kapp->invokeBrowser( url );
#else //KAB_EMBEDDED
qDebug("KABCore::browse must be fixed");
#endif //KAB_EMBEDDED
}
void KABCore::selectAllContacts()
{
mViewManager->setSelected( QString::null, true );
}
void KABCore::deleteContacts()
{
QStringList uidList = mViewManager->selectedUids();
deleteContacts( uidList );
}
void KABCore::deleteContacts( const QStringList &uids )
{
+
if ( uids.count() > 0 ) {
+
+ if ( KABPrefs::instance()->mAskForDelete ) {
+ int count = uids.count();
+ if ( count > 5 ) count = 5;
+ QString cNames;
+ int i;
+ for ( i = 0; i < count ; ++i ) {
+ cNames += KGlobal::formatMessage( mAddressBook->findByUid( uids[i] ).realName() ,0) + "\n";
+ }
+ if ( uids.count() > 5 )
+ cNames += i18n("...and %1 more\ncontact(s) selected").arg( uids.count() - 5 );
+ QString text = i18n( "Do you really\nwant to delete the\nsetected contact(s)?\n\n" ) + cNames ;
+ if ( KMessageBox::questionYesNo( this, text ) != KMessageBox::Yes )
+ return;
+ }
PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
// now if we deleted anything, refresh
setContactSelected( QString::null );
setModified( true );
}
}
void KABCore::copyContacts()
{
KABC::Addressee::List addrList = mViewManager->selectedAddressees();
QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
QClipboard *cb = QApplication::clipboard();
cb->setText( clipText );
}
void KABCore::cutContacts()
{
@@ -1077,49 +1093,49 @@ void KABCore::pasteContacts()
void KABCore::pasteContacts( KABC::Addressee::List &list )
{
KABC::Resource *resource = requestResource( this );
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it )
(*it).setResource( resource );
PwPasteCommand *command = new PwPasteCommand( this, list );
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
setModified( true );
}
void KABCore::setWhoAmI()
{
KABC::Addressee::List addrList = mViewManager->selectedAddressees();
if ( addrList.count() > 1 ) {
KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
return;
}
QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
- if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
+ if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].realName() ) ) == KMessageBox::Yes )
static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
}
void KABCore::editCategories()
{
KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
dlg.exec();
}
void KABCore::setCategories()
{
QStringList uids;
XXPortSelectDialog dlgx( this, false, this );
if ( dlgx.exec() )
uids = dlgx.uids();
else
return;
if ( uids.isEmpty() )
return;
// qDebug("count %d ", uids.count());
KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
if ( !dlg.exec() ) {
message( i18n("Setting categories cancelled") );
@@ -2645,49 +2661,49 @@ void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString
QString formattedbday;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
{
if ( ! bar.isVisible() )
return;
bar.setProgress( count++ );
qApp->processEvents();
bday = (*it).birthday().date();
anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
if ( bday.isValid() || !anni.isEmpty())
{
if (bday.isValid())
formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
else
formattedbday = "NOTVALID";
if (anni.isEmpty())
anni = "INVALID";
birthdayList.append(formattedbday);
anniversaryList.append(anni); //should be ISODate
realNameList.append((*it).realName());
preferredEmailList.append((*it).preferredEmail());
- assembledNameList.append((*it).assembledName());
+ assembledNameList.append((*it).realName());
uidList.append((*it).uid());
//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() );
}
}
bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
}
/* this method will be called through the QCop interface from other apps to show details of a contact.
*/
void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
{
//qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
QString foundUid = QString::null;
if ( ! uid.isEmpty() ) {
Addressee adrr = mAddressBook->findByUid( uid );
if ( !adrr.isEmpty() ) {
foundUid = uid;
}
if ( email == "sendbacklist" ) {
//qDebug("ssssssssssssssssssssssend ");