-rw-r--r-- | kaddressbook/xxportmanager.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 4798ffe..2962951 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp | |||
@@ -126,24 +126,24 @@ void XXPortManager::slotImport( const QString &identifier, const QString &data ) | |||
126 | for ( it = list.begin(); it != list.end(); ++it ) { | 126 | for ( it = list.begin(); it != list.end(); ++it ) { |
127 | if ( mShowPreview ) { | 127 | if ( mShowPreview ) { |
128 | PreviewDialog dlg( *it, mCore ); | 128 | PreviewDialog dlg( *it, mCore ); |
129 | if ( !dlg.exec() ) | 129 | if ( !dlg.exec() ) |
130 | continue; | 130 | continue; |
131 | } | 131 | } |
132 | 132 | ||
133 | (*it).setResource( resource ); | 133 | (*it).setResource( resource ); |
134 | // We use a PwNewCommand so the user can undo it. | 134 | // We use a PwNewCommand so the user can undo it. |
135 | PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); | 135 | PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); |
136 | UndoStack::instance()->push( command ); | 136 | UndoStack::instance()->push( command ); |
137 | RedoStack::instance()->clear(); | 137 | RedoStack::instance()->clear(); |
138 | imported = true; | 138 | imported = true; |
139 | } | 139 | } |
140 | 140 | ||
141 | if ( imported ) { | 141 | if ( imported ) { |
142 | KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); | 142 | KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); |
143 | 143 | ||
144 | emit modified(); | 144 | emit modified(); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | void XXPortManager::slotExport( const QString &identifier, const QString &data ) | 148 | void XXPortManager::slotExport( const QString &identifier, const QString &data ) |
149 | { | 149 | { |
@@ -173,26 +173,26 @@ void XXPortManager::loadPlugins() | |||
173 | #ifndef KAB_EMBEDDED | 173 | #ifndef KAB_EMBEDDED |
174 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); | 174 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); |
175 | KTrader::OfferList::ConstIterator it; | 175 | KTrader::OfferList::ConstIterator it; |
176 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 176 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
177 | if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) | 177 | if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) |
178 | continue; | 178 | continue; |
179 | 179 | ||
180 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); | 180 | KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); |
181 | if ( !factory ) { | 181 | if ( !factory ) { |
182 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; | 182 | kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; |
183 | continue; | 183 | continue; |
184 | } | 184 | } |
185 | 185 | ||
186 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | 186 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); |
187 | 187 | ||
188 | if ( !xxportFactory ) { | 188 | if ( !xxportFactory ) { |
189 | kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; | 189 | kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; |
190 | continue; | 190 | continue; |
191 | } | 191 | } |
192 | 192 | ||
193 | #else //KAB_EMBEDDED | 193 | #else //KAB_EMBEDDED |
194 | QList<XXPortFactory> factorylist; | 194 | QList<XXPortFactory> factorylist; |
195 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport())); | 195 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport())); |
196 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport())); | 196 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport())); |
197 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport())); | 197 | factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport())); |
198 | 198 | ||
@@ -206,14 +206,21 @@ void XXPortManager::loadPlugins() | |||
206 | //add the qtopia import library dynamically | 206 | //add the qtopia import library dynamically |
207 | factory = KLibLoader::self()->factory( "microkaddrbk_qtopia_xxport" ); | 207 | factory = KLibLoader::self()->factory( "microkaddrbk_qtopia_xxport" ); |
208 | if ( factory ) { | 208 | if ( factory ) { |
209 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | 209 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); |
210 | factorylist.append(xxportFactory); | 210 | factorylist.append(xxportFactory); |
211 | } | 211 | } |
212 | 212 | ||
213 | QListIterator<XXPortFactory> it(factorylist); | 213 | //add the sharp import library dynamically |
214 | factory = KLibLoader::self()->factory( "microkaddrbk_sharpdtm_xxport" ); | ||
215 | if ( factory ) { | ||
216 | XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); | ||
217 | factorylist.append(xxportFactory); | ||
218 | } | ||
219 | |||
220 | QListIterator<XXPortFactory> it(factorylist); | ||
214 | for ( ; it.current(); ++it ) | 221 | for ( ; it.current(); ++it ) |
215 | { | 222 | { |
216 | XXPortFactory *xxportFactory = it.current(); | 223 | XXPortFactory *xxportFactory = it.current(); |
217 | #endif //KAB_EMBEDDED | 224 | #endif //KAB_EMBEDDED |
218 | 225 | ||
219 | XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); | 226 | XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); |
@@ -233,13 +240,13 @@ PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, | |||
233 | const char *name ) | 240 | const char *name ) |
234 | : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, | 241 | : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, |
235 | name, true, true ) | 242 | name, true, true ) |
236 | { | 243 | { |
237 | QWidget *page = plainPage(); | 244 | QWidget *page = plainPage(); |
238 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); | 245 | QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); |
239 | 246 | ||
240 | KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); | 247 | KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); |
241 | view->setAddressee( addr ); | 248 | view->setAddressee( addr ); |
242 | 249 | ||
243 | layout->addWidget( view ); | 250 | layout->addWidget( view ); |
244 | 251 | ||
245 | resize( 400, 300 ); | 252 | resize( 400, 300 ); |