summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt7
-rw-r--r--kaddressbook/xxportmanager.cpp37
-rw-r--r--kaddressbook/xxportmanager.h1
3 files changed, 33 insertions, 12 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
@@ -586,3 +586,2 @@
{ "Information","Information" },
-{ "contacts successfully imported.","Kontakte erfolgreich importiert." },
{ "Import xml file","Importiere xml Datei" },
@@ -812,5 +811,5 @@
{ "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
@@ -126,4 +126,10 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data )
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 ) {
@@ -131,7 +137,11 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data )
PreviewDialog dlg( *it, mCore );
- if ( !dlg.exec() )
+ connect( &dlg, SIGNAL( closeClicked() ), this, SLOT ( noPreview()) );
+ if ( !dlg.exec() ) {
+ if ( mShowPreview )
continue;
}
+ }
(*it).setResource( resource );
+ if ( useUndo ) {
// We use a PwNewCommand so the user can undo it.
@@ -140,2 +150,6 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data )
RedoStack::instance()->clear();
+ } else {
+ ++count;
+ mCore->addressBook()->insertAddressee( (*it), true, true );
+ }
imported = true;
@@ -144,3 +158,3 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data )
if ( imported ) {
- KMessageBox::information( mCore, i18n( "contacts successfully imported." ) );
+ KMessageBox::information( mCore, i18n( "%1 contacts\nsuccessfully\nimported.").arg( count) );
@@ -149,3 +163,6 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data )
}
-
+void XXPortManager::noPreview()
+{
+ mShowPreview = false;
+}
void XXPortManager::slotExport( const QString &identifier, const QString &data )
@@ -224,4 +241,4 @@ 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" ) )
{
@@ -229,2 +246,4 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
+ connect( this, SIGNAL( user1Clicked() ), this, SLOT ( slotClose() ) );
+ connect( this, SIGNAL( user2Clicked() ), this, SLOT ( slotCancel() ) );
@@ -232,6 +251,8 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
view->setAddressee( addr );
-
layout->addWidget( view );
-
- resize( 400, 300 );
+#ifdef DESKTOP_VERSION
+ resize( 640, 480 );
+#else
+ showMaximized();
+#endif
}
diff --git a/kaddressbook/xxportmanager.h b/kaddressbook/xxportmanager.h
index f8436ed..e801d9b 100644
--- a/kaddressbook/xxportmanager.h
+++ b/kaddressbook/xxportmanager.h
@@ -66,2 +66,3 @@ class XXPortManager : public QObject
protected slots:
+ void noPreview();
void slotImport( const QString&, const QString& );