summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt1
-rw-r--r--kaddressbook/xxportmanager.cpp13
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
@@ -8,8 +8,9 @@ Fixed a problem with the default settings for new todos.
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 ************
New stable release!
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 7cb67ed..405f7ec 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -58,8 +58,9 @@ extern "C"
#include "undocmds.h"
#include "xxportselectdialog.h"
#include "xxportmanager.h"
+#include "nameeditdialog.h"
KURL XXPortManager::importURL = KURL();
QString XXPortManager::importData = QString::null;
@@ -131,8 +132,14 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data )
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()) );
@@ -140,11 +147,13 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data )
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();
@@ -153,12 +162,10 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data )
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()