author | zautrix <zautrix> | 2005-08-17 19:09:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-17 19:09:13 (UTC) |
commit | fefa169958abb9c487205d92b54c79532b6f924a (patch) (unidiff) | |
tree | 9de8347c47fb0b0fb4b39c78730352eb16d619c7 /kaddressbook | |
parent | 14f656fff72f1e7c2fedbb196fb97bbdd4fb1aac (diff) | |
download | kdepimpi-fefa169958abb9c487205d92b54c79532b6f924a.zip kdepimpi-fefa169958abb9c487205d92b54c79532b6f924a.tar.gz kdepimpi-fefa169958abb9c487205d92b54c79532b6f924a.tar.bz2 |
import fix
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 47 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.h | 3 |
2 files changed, 36 insertions, 14 deletions
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 ) | |||
126 | KABC::AddresseeList list = obj->importContacts( data ); | 126 | KABC::AddresseeList list = obj->importContacts( data ); |
127 | bool useUndo = ( list.count() < 25 ); | ||
128 | #ifdef DESKTOP_VERSION | ||
129 | useUndo = true; | ||
130 | #endif | ||
131 | mShowPreview = true; | ||
127 | KABC::AddresseeList::Iterator it; | 132 | KABC::AddresseeList::Iterator it; |
128 | bool imported = false; | 133 | bool imported = false; |
134 | int count = 0; | ||
129 | for ( it = list.begin(); it != list.end(); ++it ) { | 135 | for ( it = list.begin(); it != list.end(); ++it ) { |
@@ -131,4 +137,7 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) | |||
131 | PreviewDialog dlg( *it, mCore ); | 137 | PreviewDialog dlg( *it, mCore ); |
132 | if ( !dlg.exec() ) | 138 | connect( &dlg, SIGNAL( closeClicked() ), this, SLOT ( noPreview()) ); |
133 | continue; | 139 | if ( !dlg.exec() ) { |
140 | if ( mShowPreview ) | ||
141 | continue; | ||
142 | } | ||
134 | } | 143 | } |
@@ -136,6 +145,11 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) | |||
136 | (*it).setResource( resource ); | 145 | (*it).setResource( resource ); |
137 | // We use a PwNewCommand so the user can undo it. | 146 | if ( useUndo ) { |
138 | PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); | 147 | // We use a PwNewCommand so the user can undo it. |
139 | UndoStack::instance()->push( command ); | 148 | PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); |
140 | RedoStack::instance()->clear(); | 149 | UndoStack::instance()->push( command ); |
150 | RedoStack::instance()->clear(); | ||
151 | } else { | ||
152 | ++count; | ||
153 | mCore->addressBook()->insertAddressee( (*it), true, true ); | ||
154 | } | ||
141 | imported = true; | 155 | imported = true; |
@@ -144,3 +158,3 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) | |||
144 | if ( imported ) { | 158 | if ( imported ) { |
145 | KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); | 159 | KMessageBox::information( mCore, i18n( "%1 contacts\nsuccessfully\nimported.").arg( count) ); |
146 | 160 | ||
@@ -149,3 +163,6 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) | |||
149 | } | 163 | } |
150 | 164 | void XXPortManager::noPreview() | |
165 | { | ||
166 | mShowPreview = false; | ||
167 | } | ||
151 | void XXPortManager::slotExport( const QString &identifier, const QString &data ) | 168 | void XXPortManager::slotExport( const QString &identifier, const QString &data ) |
@@ -224,4 +241,4 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, | |||
224 | const char *name ) | 241 | const char *name ) |
225 | : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, | 242 | : KDialogBase( Plain, i18n( "Import this contact?" ), Ok | User1| User2, Ok, parent, |
226 | name, true, true ) | 243 | name, true, true ,i18n( "Import all!" ),i18n( "No" ) ) |
227 | { | 244 | { |
@@ -229,2 +246,4 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, | |||
229 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); | 246 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); |
247 | connect( this, SIGNAL( user1Clicked() ), this, SLOT ( slotClose() ) ); | ||
248 | connect( this, SIGNAL( user2Clicked() ), this, SLOT ( slotCancel() ) ); | ||
230 | 249 | ||
@@ -232,6 +251,8 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, | |||
232 | view->setAddressee( addr ); | 251 | view->setAddressee( addr ); |
233 | |||
234 | layout->addWidget( view ); | 252 | layout->addWidget( view ); |
235 | 253 | #ifdef DESKTOP_VERSION | |
236 | resize( 400, 300 ); | 254 | resize( 640, 480 ); |
255 | #else | ||
256 | showMaximized(); | ||
257 | #endif | ||
237 | } | 258 | } |
diff --git a/kaddressbook/xxportmanager.h b/kaddressbook/xxportmanager.h index f8436ed..e801d9b 100644 --- a/kaddressbook/xxportmanager.h +++ b/kaddressbook/xxportmanager.h | |||
@@ -65,3 +65,4 @@ class XXPortManager : public QObject | |||
65 | 65 | ||
66 | protected slots: | 66 | protected slots: |
67 | void noPreview(); | ||
67 | void slotImport( const QString&, const QString& ); | 68 | void slotImport( const QString&, const QString& ); |