From dfb9cdc7d39b988e23e5491e1c8f0e8c5713dae5 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 17 Aug 2005 19:23:08 +0000 Subject: import fix --- (limited to 'kaddressbook') diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 7cb67ed..405f7ec 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp @@ -59,6 +59,7 @@ extern "C" #include "xxportselectdialog.h" #include "xxportmanager.h" +#include "nameeditdialog.h" KURL XXPortManager::importURL = KURL(); QString XXPortManager::importData = QString::null; @@ -132,6 +133,12 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) KABC::AddresseeList::Iterator it; 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 ) { PreviewDialog dlg( *it, mCore ); @@ -141,9 +148,11 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) continue; } } - (*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 ); UndoStack::instance()->push( command ); @@ -154,10 +163,8 @@ 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(); } } -- cgit v0.9.0.2