summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp20
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--kaddressbook/xxport/vcard_xxport.cpp1
3 files changed, 18 insertions, 5 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 83fede4..6404410 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1638,99 +1638,99 @@ void KABCore::initGUI()
1638 1638
1639 1639
1640 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1640 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1641#endif 1641#endif
1642 //eh->hide(); 1642 //eh->hide();
1643 // topLayout->addWidget(mExtensionManager ); 1643 // topLayout->addWidget(mExtensionManager );
1644 1644
1645 1645
1646/*US 1646/*US
1647#ifndef KAB_NOSPLITTER 1647#ifndef KAB_NOSPLITTER
1648 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1648 QHBoxLayout *topLayout = new QHBoxLayout( this );
1649//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1649//US topLayout->setSpacing( KDialogBase::spacingHint() );
1650 topLayout->setSpacing( 10 ); 1650 topLayout->setSpacing( 10 );
1651 1651
1652 mDetailsSplitter = new QSplitter( this ); 1652 mDetailsSplitter = new QSplitter( this );
1653 1653
1654 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1654 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1655 1655
1656 mViewManager = new ViewManager( this, viewSpace ); 1656 mViewManager = new ViewManager( this, viewSpace );
1657 viewSpace->setStretchFactor( mViewManager, 1 ); 1657 viewSpace->setStretchFactor( mViewManager, 1 );
1658 1658
1659 mDetails = new ViewContainer( mDetailsSplitter ); 1659 mDetails = new ViewContainer( mDetailsSplitter );
1660 1660
1661 topLayout->addWidget( mDetailsSplitter ); 1661 topLayout->addWidget( mDetailsSplitter );
1662 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1662 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1663#else //KAB_NOSPLITTER 1663#else //KAB_NOSPLITTER
1664 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1664 QHBoxLayout *topLayout = new QHBoxLayout( this );
1665//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1665//US topLayout->setSpacing( KDialogBase::spacingHint() );
1666 topLayout->setSpacing( 10 ); 1666 topLayout->setSpacing( 10 );
1667 1667
1668// mDetailsSplitter = new QSplitter( this ); 1668// mDetailsSplitter = new QSplitter( this );
1669 1669
1670 QVBox *viewSpace = new QVBox( this ); 1670 QVBox *viewSpace = new QVBox( this );
1671 1671
1672 mViewManager = new ViewManager( this, viewSpace ); 1672 mViewManager = new ViewManager( this, viewSpace );
1673 viewSpace->setStretchFactor( mViewManager, 1 ); 1673 viewSpace->setStretchFactor( mViewManager, 1 );
1674 1674
1675 mDetails = new ViewContainer( this ); 1675 mDetails = new ViewContainer( this );
1676 1676
1677 topLayout->addWidget( viewSpace ); 1677 topLayout->addWidget( viewSpace );
1678// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1678// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1679 topLayout->addWidget( mDetails ); 1679 topLayout->addWidget( mDetails );
1680#endif //KAB_NOSPLITTER 1680#endif //KAB_NOSPLITTER
1681*/ 1681*/
1682 1682
1683 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1683 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1684 syncManager->setBlockSave(false); 1684 syncManager->setBlockSave(false);
1685 1685
1686 connect(syncManager , SIGNAL( save() ), this, SLOT( save() ) ); 1686 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1687 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1687 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1688 syncManager->setDefaultFileName(locateLocal( "apps","kabc/std.vcf") ); 1688 syncManager->setDefaultFileName( sentSyncFile());
1689 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1689 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1690 1690
1691#endif //KAB_EMBEDDED 1691#endif //KAB_EMBEDDED
1692 initActions(); 1692 initActions();
1693 1693
1694#ifdef KAB_EMBEDDED 1694#ifdef KAB_EMBEDDED
1695 addActionsManually(); 1695 addActionsManually();
1696 //US make sure the export and import menues are initialized before creating the xxPortManager. 1696 //US make sure the export and import menues are initialized before creating the xxPortManager.
1697 mXXPortManager = new XXPortManager( this, this ); 1697 mXXPortManager = new XXPortManager( this, this );
1698 1698
1699 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1699 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1700 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1700 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1701 // mActionQuit->plug ( mMainWindow->toolBar()); 1701 // mActionQuit->plug ( mMainWindow->toolBar());
1702 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1702 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1703 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1703 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1704 // mIncSearchWidget->hide(); 1704 // mIncSearchWidget->hide();
1705 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1705 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1706 SLOT( incrementalSearch( const QString& ) ) ); 1706 SLOT( incrementalSearch( const QString& ) ) );
1707 1707
1708 1708
1709 mJumpButtonBar = new JumpButtonBar( this, this ); 1709 mJumpButtonBar = new JumpButtonBar( this, this );
1710 1710
1711 topLayout->addWidget( mJumpButtonBar ); 1711 topLayout->addWidget( mJumpButtonBar );
1712//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1712//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1713 1713
1714// mMainWindow->getIconToolBar()->raise(); 1714// mMainWindow->getIconToolBar()->raise();
1715 1715
1716#endif //KAB_EMBEDDED 1716#endif //KAB_EMBEDDED
1717 1717
1718} 1718}
1719void KABCore::initActions() 1719void KABCore::initActions()
1720{ 1720{
1721//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1721//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1722 1722
1723#ifndef KAB_EMBEDDED 1723#ifndef KAB_EMBEDDED
1724 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1724 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1725 SLOT( clipboardDataChanged() ) ); 1725 SLOT( clipboardDataChanged() ) );
1726#endif //KAB_EMBEDDED 1726#endif //KAB_EMBEDDED
1727 1727
1728 // file menu 1728 // file menu
1729 if ( mIsPart ) { 1729 if ( mIsPart ) {
1730 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1730 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1731 SLOT( sendMail() ), actionCollection(), 1731 SLOT( sendMail() ), actionCollection(),
1732 "kaddressbook_mail" ); 1732 "kaddressbook_mail" );
1733 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1733 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1734 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1734 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1735 1735
1736 } else { 1736 } else {
@@ -2817,55 +2817,65 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2817 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 2817 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
2818 getEventViewerDialog()->setSyncMode( false ); 2818 getEventViewerDialog()->setSyncMode( false );
2819 if ( syncOK ) { 2819 if ( syncOK ) {
2820 if ( KOPrefs::instance()->mWriteBackFile ) 2820 if ( KOPrefs::instance()->mWriteBackFile )
2821 { 2821 {
2822 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 2822 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
2823 storage->save(); 2823 storage->save();
2824 } 2824 }
2825 } 2825 }
2826 setModified(); 2826 setModified();
2827 } 2827 }
2828 2828
2829#endif 2829#endif
2830} 2830}
2831 2831
2832 2832
2833//this is a overwritten callbackmethods from the syncinterface 2833//this is a overwritten callbackmethods from the syncinterface
2834bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2834bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2835{ 2835{
2836 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2836 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2837 2837
2838 AddressBook abLocal( resource,"syncContact"); 2838 AddressBook abLocal( resource,"syncContact");
2839 bool syncOK = false; 2839 bool syncOK = false;
2840 if ( abLocal.load() ) { 2840 if ( abLocal.load() ) {
2841 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2841 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2842 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2842 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2843 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2843 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2844 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2844 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2845 if ( syncOK ) { 2845 if ( syncOK ) {
2846 if ( syncManager->mWriteBackFile ) { 2846 if ( syncManager->mWriteBackFile ) {
2847 abLocal.saveAB(); 2847 abLocal.saveAB();
2848 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2848 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2849 } 2849 }
2850 } 2850 }
2851 setModified(); 2851 setModified();
2852 } 2852 }
2853 if ( syncOK ) 2853 if ( syncOK )
2854 mViewManager->refreshView(); 2854 mViewManager->refreshView();
2855 return syncOK; 2855 return syncOK;
2856 2856
2857} 2857}
2858 2858
2859void KABCore::getFile( bool success ) 2859void KABCore::getFile( bool success )
2860{ 2860{
2861 if ( ! success ) { 2861 if ( ! success ) {
2862 setCaption( i18n("Error receiving file. Nothing changed!") ); 2862 setCaption( i18n("Error receiving file. Nothing changed!") );
2863 return; 2863 return;
2864 } 2864 }
2865 //mView->watchSavedFile(); 2865 mAddressBook->importFromFile( sentSyncFile() );
2866 //mView->openCalendar( defaultFileName() );
2867 // pending: reload received file!
2868 setCaption( i18n("Pi-Sync successful!") ); 2866 setCaption( i18n("Pi-Sync successful!") );
2869} 2867}
2868void KABCore::syncFileRequest()
2869{
2870 mAddressBook->export2File( sentSyncFile() );
2871}
2872QString KABCore::sentSyncFile()
2873{
2874#ifdef _WIN32_
2875 return locateLocal( "tmp", "syncab.ics" );
2876#else
2877 return QString( "/tmp/kapitempfile.vcf" );
2878#endif
2879}
2870 2880
2871 2881
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 355e828..987369d 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -298,96 +298,97 @@ class KABCore : public QWidget, public KSyncInterface
298 */ 298 */
299 void redo(); 299 void redo();
300 300
301 /** 301 /**
302 Shows the edit dialog for the given uid. If the uid is QString::null, 302 Shows the edit dialog for the given uid. If the uid is QString::null,
303 the method will try to find a selected addressee in the view. 303 the method will try to find a selected addressee in the view.
304 */ 304 */
305 void editContact( const QString &uid /*US = QString::null*/ ); 305 void editContact( const QString &uid /*US = QString::null*/ );
306//US added a second method without defaultparameter 306//US added a second method without defaultparameter
307 void editContact2(); 307 void editContact2();
308 308
309 /** 309 /**
310 Shows or edits the detail view for the given uid. If the uid is QString::null, 310 Shows or edits the detail view for the given uid. If the uid is QString::null,
311 the method will try to find a selected addressee in the view. 311 the method will try to find a selected addressee in the view.
312 */ 312 */
313 void executeContact( const QString &uid /*US = QString::null*/ ); 313 void executeContact( const QString &uid /*US = QString::null*/ );
314 314
315 /** 315 /**
316 Launches the configuration dialog. 316 Launches the configuration dialog.
317 */ 317 */
318 void openConfigDialog(); 318 void openConfigDialog();
319 319
320 /** 320 /**
321 Launches the ldap search dialog. 321 Launches the ldap search dialog.
322 */ 322 */
323 void openLDAPDialog(); 323 void openLDAPDialog();
324 324
325 /** 325 /**
326 Creates a KAddressBookPrinter, which will display the print 326 Creates a KAddressBookPrinter, which will display the print
327 dialog and do the printing. 327 dialog and do the printing.
328 */ 328 */
329 void print(); 329 void print();
330 330
331 /** 331 /**
332 Registers a new GUI client, so plugins can register its actions. 332 Registers a new GUI client, so plugins can register its actions.
333 */ 333 */
334 void addGUIClient( KXMLGUIClient *client ); 334 void addGUIClient( KXMLGUIClient *client );
335 335
336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
339 339
340 340
341 signals: 341 signals:
342 void contactSelected( const QString &name ); 342 void contactSelected( const QString &name );
343 void contactSelected( const QPixmap &pixmap ); 343 void contactSelected( const QPixmap &pixmap );
344 public slots: 344 public slots:
345 void getFile( bool success ); 345 void getFile( bool success );
346 void syncFileRequest();
346 void setDetailsVisible( bool visible ); 347 void setDetailsVisible( bool visible );
347 void setDetailsToState(); 348 void setDetailsToState();
348 // void slotSyncMenu( int ); 349 // void slotSyncMenu( int );
349 private slots: 350 private slots:
350 void setJumpButtonBarVisible( bool visible ); 351 void setJumpButtonBarVisible( bool visible );
351 void importFromOL(); 352 void importFromOL();
352 void extensionModified( const KABC::Addressee::List &list ); 353 void extensionModified( const KABC::Addressee::List &list );
353 void extensionChanged( int id ); 354 void extensionChanged( int id );
354 void clipboardDataChanged(); 355 void clipboardDataChanged();
355 void updateActionMenu(); 356 void updateActionMenu();
356 void configureKeyBindings(); 357 void configureKeyBindings();
357 void removeVoice(); 358 void removeVoice();
358#ifdef KAB_EMBEDDED 359#ifdef KAB_EMBEDDED
359 void configureResources(); 360 void configureResources();
360#endif //KAB_EMBEDDED 361#endif //KAB_EMBEDDED
361 362
362 void slotEditorDestroyed( const QString &uid ); 363 void slotEditorDestroyed( const QString &uid );
363 void configurationChanged(); 364 void configurationChanged();
364 void addressBookChanged(); 365 void addressBookChanged();
365 366
366 private: 367 private:
367 void initGUI(); 368 void initGUI();
368 void initActions(); 369 void initActions();
369 370
370 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 371 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
371 const char *name = 0 ); 372 const char *name = 0 );
372 373
373 KXMLGUIClient *mGUIClient; 374 KXMLGUIClient *mGUIClient;
374 375
375 KABC::AddressBook *mAddressBook; 376 KABC::AddressBook *mAddressBook;
376 377
377 ViewManager *mViewManager; 378 ViewManager *mViewManager;
378 // QSplitter *mDetailsSplitter; 379 // QSplitter *mDetailsSplitter;
379 KDGanttMinimizeSplitter *mExtensionBarSplitter; 380 KDGanttMinimizeSplitter *mExtensionBarSplitter;
380 ViewContainer *mDetails; 381 ViewContainer *mDetails;
381 KDGanttMinimizeSplitter* mMiniSplitter; 382 KDGanttMinimizeSplitter* mMiniSplitter;
382 XXPortManager *mXXPortManager; 383 XXPortManager *mXXPortManager;
383 JumpButtonBar *mJumpButtonBar; 384 JumpButtonBar *mJumpButtonBar;
384 IncSearchWidget *mIncSearchWidget; 385 IncSearchWidget *mIncSearchWidget;
385 ExtensionManager *mExtensionManager; 386 ExtensionManager *mExtensionManager;
386 387
387 KCMultiDialog *mConfigureDialog; 388 KCMultiDialog *mConfigureDialog;
388 389
389#ifndef KAB_EMBEDDED 390#ifndef KAB_EMBEDDED
390 LDAPSearchDialog *mLdapSearchDialog; 391 LDAPSearchDialog *mLdapSearchDialog;
391#endif //KAB_EMBEDDED 392#endif //KAB_EMBEDDED
392 // QDict<AddresseeEditorDialog> mEditorDict; 393 // QDict<AddresseeEditorDialog> mEditorDict;
393 AddresseeEditorDialog *mEditorDialog; 394 AddresseeEditorDialog *mEditorDialog;
@@ -420,60 +421,61 @@ class KABCore : public QWidget, public KSyncInterface
420 KAction *mActionDelete; 421 KAction *mActionDelete;
421 422
422 //US settings menu 423 //US settings menu
423 KAction *mActionConfigResources; 424 KAction *mActionConfigResources;
424 KAction *mActionConfigKAddressbook; 425 KAction *mActionConfigKAddressbook;
425 KAction *mActionConfigShortcuts; 426 KAction *mActionConfigShortcuts;
426 KAction *mActionConfigureToolbars; 427 KAction *mActionConfigureToolbars;
427 KAction *mActionKeyBindings; 428 KAction *mActionKeyBindings;
428 KToggleAction *mActionJumpBar; 429 KToggleAction *mActionJumpBar;
429 KToggleAction *mActionDetails; 430 KToggleAction *mActionDetails;
430 KAction *mActionWhoAmI; 431 KAction *mActionWhoAmI;
431 KAction *mActionCategories; 432 KAction *mActionCategories;
432 KAction *mActionAboutKAddressbook; 433 KAction *mActionAboutKAddressbook;
433 KAction *mActionLicence; 434 KAction *mActionLicence;
434 KAction *mActionFaq; 435 KAction *mActionFaq;
435 436
436 KAction *mActionDeleteView; 437 KAction *mActionDeleteView;
437 438
438 QPopupMenu *viewMenu; 439 QPopupMenu *viewMenu;
439 QPopupMenu *filterMenu; 440 QPopupMenu *filterMenu;
440 QPopupMenu *settingsMenu; 441 QPopupMenu *settingsMenu;
441 QPopupMenu *changeMenu; 442 QPopupMenu *changeMenu;
442//US QAction *mActionSave; 443//US QAction *mActionSave;
443 QPopupMenu *ImportMenu; 444 QPopupMenu *ImportMenu;
444 QPopupMenu *ExportMenu; 445 QPopupMenu *ExportMenu;
445 //LR additional methods 446 //LR additional methods
446 KAction *mActionRemoveVoice; 447 KAction *mActionRemoveVoice;
447 KAction * mActionImportOL; 448 KAction * mActionImportOL;
448 449
449#ifndef KAB_EMBEDDED 450#ifndef KAB_EMBEDDED
450 KAddressBookService *mAddressBookService; 451 KAddressBookService *mAddressBookService;
451#endif //KAB_EMBEDDED 452#endif //KAB_EMBEDDED
452 453
453 class KABCorePrivate; 454 class KABCorePrivate;
454 KABCorePrivate *d; 455 KABCorePrivate *d;
455 //US bool mBlockSaveFlag; 456 //US bool mBlockSaveFlag;
456 457
457#ifdef KAB_EMBEDDED 458#ifdef KAB_EMBEDDED
458 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 459 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
459#endif //KAB_EMBEDDED 460#endif //KAB_EMBEDDED
460 461
461 //this are the overwritten callbackmethods from the syncinterface 462 //this are the overwritten callbackmethods from the syncinterface
462 virtual bool sync(KSyncManager* manager, QString filename, int mode); 463 virtual bool sync(KSyncManager* manager, QString filename, int mode);
463 virtual bool syncExternal(KSyncManager* manager, QString resource); 464 virtual bool syncExternal(KSyncManager* manager, QString resource);
464 465
465 466
466 // LR ******************************* 467 // LR *******************************
467 // sync stuff! 468 // sync stuff!
469 QString sentSyncFile();
468 QPopupMenu *syncMenu; 470 QPopupMenu *syncMenu;
469 KSyncManager* syncManager; 471 KSyncManager* syncManager;
470 int mGlobalSyncMode; 472 int mGlobalSyncMode;
471 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 473 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
472 KABC::Addressee getLastSyncAddressee(); 474 KABC::Addressee getLastSyncAddressee();
473 QDateTime mLastAddressbookSync; 475 QDateTime mLastAddressbookSync;
474 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 476 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
475 // ********************* 477 // *********************
476 478
477}; 479};
478 480
479#endif 481#endif
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp
index acf6419..3079d42 100644
--- a/kaddressbook/xxport/vcard_xxport.cpp
+++ b/kaddressbook/xxport/vcard_xxport.cpp
@@ -76,96 +76,97 @@ extern "C"
76VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name ) 76VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
77 : XXPortObject( ab, parent, name ) 77 : XXPortObject( ab, parent, name )
78{ 78{
79 createImportAction( i18n( "Import vCard..." ) ); 79 createImportAction( i18n( "Import vCard..." ) );
80//US KABC::VCardConverter does not support the export of 2.1 addressbooks. 80//US KABC::VCardConverter does not support the export of 2.1 addressbooks.
81//US createExportAction( i18n( "Export vCard 2.1..." ), "v21" ); 81//US createExportAction( i18n( "Export vCard 2.1..." ), "v21" );
82 createExportAction( i18n( "Export vCard 3.0..." ), "v30" ); 82 createExportAction( i18n( "Export vCard 3.0..." ), "v30" );
83} 83}
84 84
85bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data ) 85bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data )
86{ 86{
87 QString name; 87 QString name;
88 88
89 if ( list.count() == 1 ) 89 if ( list.count() == 1 )
90 name = list[ 0 ].givenName() + "_" + list[ 0 ].familyName() + ".vcf"; 90 name = list[ 0 ].givenName() + "_" + list[ 0 ].familyName() + ".vcf";
91 else 91 else
92 name = "addressbook.vcf"; 92 name = "addressbook.vcf";
93 93
94#ifndef KAB_EMBEDDED 94#ifndef KAB_EMBEDDED
95 QString fileName = KFileDialog::getSaveFileName( name ); 95 QString fileName = KFileDialog::getSaveFileName( name );
96#else //KAB_EMBEDDED 96#else //KAB_EMBEDDED
97 QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() ); 97 QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() );
98#endif //KAB_EMBEDDED 98#endif //KAB_EMBEDDED
99 99
100 if ( fileName.isEmpty() ) 100 if ( fileName.isEmpty() )
101 return false; 101 return false;
102 102
103 QFile outFile( fileName ); 103 QFile outFile( fileName );
104 if ( !outFile.open( IO_WriteOnly ) ) { 104 if ( !outFile.open( IO_WriteOnly ) ) {
105 QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); 105 QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
106 KMessageBox::error( parentWidget(), text.arg( fileName ) ); 106 KMessageBox::error( parentWidget(), text.arg( fileName ) );
107 return false; 107 return false;
108 } 108 }
109 109
110 QTextStream t( &outFile ); 110 QTextStream t( &outFile );
111 t.setEncoding( QTextStream::UnicodeUTF8 ); 111 t.setEncoding( QTextStream::UnicodeUTF8 );
112 112
113 KABC::Addressee::List::ConstIterator it; 113 KABC::Addressee::List::ConstIterator it;
114 for ( it = list.begin(); it != list.end(); ++it ) { 114 for ( it = list.begin(); it != list.end(); ++it ) {
115 KABC::VCardConverter converter; 115 KABC::VCardConverter converter;
116 QString vcard; 116 QString vcard;
117 117
118 KABC::VCardConverter::Version version; 118 KABC::VCardConverter::Version version;
119 if ( data == "v21" ) 119 if ( data == "v21" )
120 version = KABC::VCardConverter::v2_1; 120 version = KABC::VCardConverter::v2_1;
121 else 121 else
122 version = KABC::VCardConverter::v3_0; 122 version = KABC::VCardConverter::v3_0;
123 123
124 version = KABC::VCardConverter::v2_1;
124 converter.addresseeToVCard( *it, vcard, version ); 125 converter.addresseeToVCard( *it, vcard, version );
125 t << vcard << "\r\n\r\n"; 126 t << vcard << "\r\n\r\n";
126 } 127 }
127 128
128 outFile.close(); 129 outFile.close();
129 130
130 return true; 131 return true;
131} 132}
132 133
133KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const 134KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const
134{ 135{
135 QString fileName; 136 QString fileName;
136 KABC::AddresseeList addrList; 137 KABC::AddresseeList addrList;
137 KURL url; 138 KURL url;
138 139
139#ifndef KAB_EMBEDDED 140#ifndef KAB_EMBEDDED
140 if ( !XXPortManager::importData.isEmpty() ) 141 if ( !XXPortManager::importData.isEmpty() )
141 addrList = parseVCard( XXPortManager::importData ); 142 addrList = parseVCard( XXPortManager::importData );
142 else { 143 else {
143 if ( XXPortManager::importURL.isEmpty() ) 144 if ( XXPortManager::importURL.isEmpty() )
144 { 145 {
145 url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() ); 146 url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() );
146 } 147 }
147 else 148 else
148 url = XXPortManager::importURL; 149 url = XXPortManager::importURL;
149 150
150 if ( url.isEmpty() ) 151 if ( url.isEmpty() )
151 return addrList; 152 return addrList;
152 153
153 QString caption( i18n( "vCard Import Failed" ) ); 154 QString caption( i18n( "vCard Import Failed" ) );
154 if ( KIO::NetAccess::download( url, fileName ) ) { 155 if ( KIO::NetAccess::download( url, fileName ) ) {
155 QFile file( fileName ); 156 QFile file( fileName );
156 157
157 file.open( IO_ReadOnly ); 158 file.open( IO_ReadOnly );
158 QByteArray rawData = file.readAll(); 159 QByteArray rawData = file.readAll();
159 file.close(); 160 file.close();
160 161
161 QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); 162 QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
162 addrList = parseVCard( data ); 163 addrList = parseVCard( data );
163 164
164 if ( !url.isLocalFile() ) 165 if ( !url.isLocalFile() )
165 KIO::NetAccess::removeTempFile( fileName ); 166 KIO::NetAccess::removeTempFile( fileName );
166 167
167 } else { 168 } else {
168 QString text = i18n( "<qt>Unable to access <b>%1</b>.</qt>" ); 169 QString text = i18n( "<qt>Unable to access <b>%1</b>.</qt>" );
169 KMessageBox::error( parentWidget(), text.arg( url.url() ), caption ); 170 KMessageBox::error( parentWidget(), text.arg( url.url() ), caption );
170 } 171 }
171 172