-rw-r--r-- | bin/kdepim/WhatsNew.txt | 1 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 15caf9e..fd5e4f9 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -10,4 +10,5 @@ KA/Pi: Added a config option to turn on asking before a contact is deleted. Fixed a problem with the default view and view selection at startup. +Formatted name is now set on import, if formatted name is empty. ********** VERSION 2.2.0 ************ diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 7cb67ed..405f7ec 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp @@ -60,4 +60,5 @@ extern "C" #include "xxportmanager.h" +#include "nameeditdialog.h" KURL XXPortManager::importURL = KURL(); @@ -133,4 +134,10 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) bool imported = false; int count = 0; + + KConfig config( locateLocal("config", "kabcrc") ); + config.setGroup( "General" ); + int FormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); + + for ( it = list.begin(); it != list.end(); ++it ) { if ( mShowPreview ) { @@ -142,7 +149,9 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) } } - (*it).setResource( resource ); + if ( (*it).formattedName().isEmpty() ) + (*it).setFormattedName( NameEditDialog::formattedName( (*it), FormattedNameType ) ); if ( useUndo ) { + ++count; // We use a PwNewCommand so the user can undo it. PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); @@ -155,8 +164,6 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) imported = true; } - if ( imported ) { KMessageBox::information( mCore, i18n( "%1 contacts\nsuccessfully\nimported.").arg( count) ); - emit modified(); } |