-rw-r--r-- | kaddressbook/xxportmanager.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 7cb67ed..405f7ec 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp @@ -56,12 +56,13 @@ extern "C" #include "kabcore.h" #include "undocmds.h" #include "xxportselectdialog.h" #include "xxportmanager.h" +#include "nameeditdialog.h" KURL XXPortManager::importURL = KURL(); QString XXPortManager::importData = QString::null; class PreviewDialog : public KDialogBase { @@ -129,38 +130,44 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) useUndo = true; #endif mShowPreview = true; 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 ); connect( &dlg, SIGNAL( closeClicked() ), this, SLOT ( noPreview()) ); if ( !dlg.exec() ) { if ( mShowPreview ) 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 ); RedoStack::instance()->clear(); } else { ++count; mCore->addressBook()->insertAddressee( (*it), true, true ); } imported = true; } - if ( imported ) { KMessageBox::information( mCore, i18n( "%1 contacts\nsuccessfully\nimported.").arg( count) ); - emit modified(); } } void XXPortManager::noPreview() { mShowPreview = false; |