-rw-r--r-- | bin/kdepim/kaddressbook/germantranslation.txt | 7 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 47 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.h | 3 |
3 files changed, 39 insertions, 18 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt index f369169..293aaea 100644 --- a/bin/kdepim/kaddressbook/germantranslation.txt +++ b/bin/kdepim/kaddressbook/germantranslation.txt @@ -584,7 +584,6 @@ { "Override previously imported entries?","Überschreibe bereits importierte Einträge?" },
{ "Select vCard to Import","Selektiere zu importierende vCard" },
{ "Information","Information" },
-{ "contacts successfully imported.","Kontakte erfolgreich importiert." },
{ "Import xml file","Importiere xml Datei" },
{ "Choose contact selection","Wähle Kontakt Auswahl" },
{ "Select the entire address book","Wähle das ganze Adressbuch" },
@@ -810,9 +809,9 @@ { "Save using LOCAL storage","Speichere nutze LOCAL Pfad" },
{ "...and %1 more\ncontact(s) selected","...und noch %1 Kontakte\n mehr ausgewählt" },
{ "Do you really\nwant to delete the\nsetected contact(s)?\n\n","Möchten Sie wirklich\ndie ausgewählten\nKontakte löschen?\n\n" },
-{ "","" },
-{ "","" },
-{ "","" },
+{ "%1 contacts\nsuccessfully\nimported.","%1 Kontakte\nerfolgreich\nimportiert." },
+{ "Import this contact?","Importiere diesen Kontakt?" },
+{ "Import all!","Importiere alle!" },
{ "","" },
{ "","" },
{ "","" },
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 89a2626..7cb67ed 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp @@ -124,30 +124,47 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) return; KABC::AddresseeList list = obj->importContacts( data ); + bool useUndo = ( list.count() < 25 ); +#ifdef DESKTOP_VERSION + useUndo = true; +#endif + mShowPreview = true; KABC::AddresseeList::Iterator it; bool imported = false; + int count = 0; for ( it = list.begin(); it != list.end(); ++it ) { if ( mShowPreview ) { PreviewDialog dlg( *it, mCore ); - if ( !dlg.exec() ) - continue; + connect( &dlg, SIGNAL( closeClicked() ), this, SLOT ( noPreview()) ); + if ( !dlg.exec() ) { + if ( mShowPreview ) + continue; + } } (*it).setResource( resource ); - // We use a PwNewCommand so the user can undo it. - PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); - UndoStack::instance()->push( command ); - RedoStack::instance()->clear(); + if ( useUndo ) { + // 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( "contacts successfully imported." ) ); + KMessageBox::information( mCore, i18n( "%1 contacts\nsuccessfully\nimported.").arg( count) ); emit modified(); } } - +void XXPortManager::noPreview() +{ + mShowPreview = false; +} void XXPortManager::slotExport( const QString &identifier, const QString &data ) { XXPortObject *obj = mXXPortObjects[ identifier ]; @@ -222,18 +239,22 @@ void XXPortManager::loadPlugins() PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, const char *name ) - : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, - name, true, true ) + : KDialogBase( Plain, i18n( "Import this contact?" ), Ok | User1| User2, Ok, parent, + name, true, true ,i18n( "Import all!" ),i18n( "No" ) ) { QWidget *page = plainPage(); QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); + connect( this, SIGNAL( user1Clicked() ), this, SLOT ( slotClose() ) ); + connect( this, SIGNAL( user2Clicked() ), this, SLOT ( slotCancel() ) ); KABC::AddresseeView *view = new KABC::AddresseeView( page ); view->setAddressee( addr ); - layout->addWidget( view ); - - resize( 400, 300 ); +#ifdef DESKTOP_VERSION + resize( 640, 480 ); +#else + showMaximized(); +#endif } #ifndef KAB_EMBEDDED diff --git a/kaddressbook/xxportmanager.h b/kaddressbook/xxportmanager.h index f8436ed..e801d9b 100644 --- a/kaddressbook/xxportmanager.h +++ b/kaddressbook/xxportmanager.h @@ -63,7 +63,8 @@ class XXPortManager : public QObject signals: void modified(); - protected slots: + protected slots: + void noPreview(); void slotImport( const QString&, const QString& ); void slotExport( const QString&, const QString& ); |