forward port SVN commit 541603 by wstephens:

Fix Novell bug:159533
Save the address book after adding things to it, and fix bug where the
addressee's name was used in place of their email address.

svn path=/trunk/KDE/kdepim/; revision=541705
wilder-work
Allen Winter 20 years ago
parent f22e2653a3
commit 08d9e5880c
  1. 18
      distributionlistdialog.cpp

@ -24,6 +24,7 @@
#include "distributionlistdialog.h"
#include <libemailfunctions/email.h>
#include <kabc/resource.h>
#include <kabc/stdaddressbook.h>
#include <kabc/distributionlist.h>
@ -134,7 +135,7 @@ void DistributionListDialog::setRecipients( const Recipient::List &recipients )
if ( addressees.isEmpty() ) {
KABC::Addressee a;
a.setNameFromString( name );
a.insertEmail( name );
a.insertEmail( email );
item->setTransientAddressee( a, email );
item->setOn( true );
} else {
@ -153,7 +154,7 @@ void DistributionListDialog::slotUser1()
{
bool isEmpty = true;
KABC::StdAddressBook *ab = KABC::StdAddressBook::self( true );
KABC::AddressBook *ab = KABC::StdAddressBook::self( true );
Q3ListViewItem *i = mRecipientsList->firstChild();
while( i ) {
@ -200,7 +201,6 @@ void DistributionListDialog::slotUser1()
if ( item->isOn() ) {
kDebug() << " " << item->addressee().fullEmail() << endl;
if ( item->isTransient() ) {
// FIXME: Adding to the address book doesn't seem to work.
ab->insertAddressee( item->addressee() );
}
if ( item->email() == item->addressee().preferredEmail() ) {
@ -212,6 +212,18 @@ void DistributionListDialog::slotUser1()
i = i->nextSibling();
}
// FIXME: Ask the user which resource to save to instead of the default
bool saveError = true;
KABC::Ticket *ticket = ab->requestSaveTicket( 0 /*default resource */ );
if ( ticket )
if ( ab->save( ticket ) )
saveError = false;
else
ab->releaseSaveTicket( ticket );
if ( saveError )
kWarning(5006) << k_funcinfo << " Couldn't save new addresses in the distribution list just created to the address book" << endl;
manager.save();
close();

Loading…
Cancel
Save