summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2dea619..5d377bf 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1843,193 +1843,193 @@ void KABCore::initGUI()
1843 settingsMenu = new QPopupMenu( this ); 1843 settingsMenu = new QPopupMenu( this );
1844 //filterMenu = new QPopupMenu( this ); 1844 //filterMenu = new QPopupMenu( this );
1845 ImportMenu = new QPopupMenu( this ); 1845 ImportMenu = new QPopupMenu( this );
1846 ExportMenu = new QPopupMenu( this ); 1846 ExportMenu = new QPopupMenu( this );
1847 syncMenu = new QPopupMenu( this ); 1847 syncMenu = new QPopupMenu( this );
1848 changeMenu= new QPopupMenu( this ); 1848 changeMenu= new QPopupMenu( this );
1849 beamMenu= new QPopupMenu( this ); 1849 beamMenu= new QPopupMenu( this );
1850 1850
1851//US since we have no splitter for the embedded system, setup 1851//US since we have no splitter for the embedded system, setup
1852// a layout with two frames. One left and one right. 1852// a layout with two frames. One left and one right.
1853 1853
1854 QBoxLayout *topLayout; 1854 QBoxLayout *topLayout;
1855 1855
1856 // = new QHBoxLayout( this ); 1856 // = new QHBoxLayout( this );
1857// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1857// QBoxLayout *topLayout = (QBoxLayout*)layout();
1858 1858
1859// QWidget *mainBox = new QWidget( this ); 1859// QWidget *mainBox = new QWidget( this );
1860// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1860// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1861 1861
1862#ifdef DESKTOP_VERSION 1862#ifdef DESKTOP_VERSION
1863 topLayout = new QHBoxLayout( this ); 1863 topLayout = new QHBoxLayout( this );
1864 1864
1865 1865
1866 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1866 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1867 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1867 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1868 1868
1869 topLayout->addWidget(mMiniSplitter ); 1869 topLayout->addWidget(mMiniSplitter );
1870 1870
1871 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1871 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1872 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1872 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1873 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1873 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1874 mDetails = new ViewContainer( mMiniSplitter ); 1874 mDetails = new ViewContainer( mMiniSplitter );
1875 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1875 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1876#else 1876#else
1877 if ( QApplication::desktop()->width() > 480 ) { 1877 if ( QApplication::desktop()->width() > 480 ) {
1878 topLayout = new QHBoxLayout( this ); 1878 topLayout = new QHBoxLayout( this );
1879 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1879 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1880 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1880 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1881 } else { 1881 } else {
1882 1882
1883 topLayout = new QHBoxLayout( this ); 1883 topLayout = new QHBoxLayout( this );
1884 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1884 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1885 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1885 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1886 } 1886 }
1887 1887
1888 topLayout->addWidget(mMiniSplitter ); 1888 topLayout->addWidget(mMiniSplitter );
1889 mViewManager = new ViewManager( this, mMiniSplitter ); 1889 mViewManager = new ViewManager( this, mMiniSplitter );
1890 mDetails = new ViewContainer( mMiniSplitter ); 1890 mDetails = new ViewContainer( mMiniSplitter );
1891 1891
1892 1892
1893 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1893 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1894#endif 1894#endif
1895 //eh->hide(); 1895 //eh->hide();
1896 // topLayout->addWidget(mExtensionManager ); 1896 // topLayout->addWidget(mExtensionManager );
1897 1897
1898 1898
1899/*US 1899/*US
1900#ifndef KAB_NOSPLITTER 1900#ifndef KAB_NOSPLITTER
1901 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1901 QHBoxLayout *topLayout = new QHBoxLayout( this );
1902//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1902//US topLayout->setSpacing( KDialogBase::spacingHint() );
1903 topLayout->setSpacing( 10 ); 1903 topLayout->setSpacing( 10 );
1904 1904
1905 mDetailsSplitter = new QSplitter( this ); 1905 mDetailsSplitter = new QSplitter( this );
1906 1906
1907 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1907 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1908 1908
1909 mViewManager = new ViewManager( this, viewSpace ); 1909 mViewManager = new ViewManager( this, viewSpace );
1910 viewSpace->setStretchFactor( mViewManager, 1 ); 1910 viewSpace->setStretchFactor( mViewManager, 1 );
1911 1911
1912 mDetails = new ViewContainer( mDetailsSplitter ); 1912 mDetails = new ViewContainer( mDetailsSplitter );
1913 1913
1914 topLayout->addWidget( mDetailsSplitter ); 1914 topLayout->addWidget( mDetailsSplitter );
1915 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1915 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1916#else //KAB_NOSPLITTER 1916#else //KAB_NOSPLITTER
1917 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1917 QHBoxLayout *topLayout = new QHBoxLayout( this );
1918//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1918//US topLayout->setSpacing( KDialogBase::spacingHint() );
1919 topLayout->setSpacing( 10 ); 1919 topLayout->setSpacing( 10 );
1920 1920
1921// mDetailsSplitter = new QSplitter( this ); 1921// mDetailsSplitter = new QSplitter( this );
1922 1922
1923 QVBox *viewSpace = new QVBox( this ); 1923 QVBox *viewSpace = new QVBox( this );
1924 1924
1925 mViewManager = new ViewManager( this, viewSpace ); 1925 mViewManager = new ViewManager( this, viewSpace );
1926 viewSpace->setStretchFactor( mViewManager, 1 ); 1926 viewSpace->setStretchFactor( mViewManager, 1 );
1927 1927
1928 mDetails = new ViewContainer( this ); 1928 mDetails = new ViewContainer( this );
1929 1929
1930 topLayout->addWidget( viewSpace ); 1930 topLayout->addWidget( viewSpace );
1931// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1931// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1932 topLayout->addWidget( mDetails ); 1932 topLayout->addWidget( mDetails );
1933#endif //KAB_NOSPLITTER 1933#endif //KAB_NOSPLITTER
1934*/ 1934*/
1935 1935
1936 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1936 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1937 syncManager->setBlockSave(false); 1937 syncManager->setBlockSave(false);
1938 1938
1939 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1939 connect(syncManager , SIGNAL( request_file(const QString &) ), this, SLOT( syncFileRequest(const QString &) ) );
1940 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1940 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1941 QString sync_file = sentSyncFile(); 1941 QString sync_file = sentSyncFile();
1942 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1942 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1943 syncManager->setDefaultFileName( sync_file ); 1943 syncManager->setDefaultFileName( sync_file );
1944 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1944 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1945 1945
1946#endif //KAB_EMBEDDED 1946#endif //KAB_EMBEDDED
1947 initActions(); 1947 initActions();
1948 1948
1949#ifdef KAB_EMBEDDED 1949#ifdef KAB_EMBEDDED
1950 addActionsManually(); 1950 addActionsManually();
1951 //US make sure the export and import menues are initialized before creating the xxPortManager. 1951 //US make sure the export and import menues are initialized before creating the xxPortManager.
1952 mXXPortManager = new XXPortManager( this, this ); 1952 mXXPortManager = new XXPortManager( this, this );
1953 1953
1954 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1954 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1955 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1955 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1956 // mActionQuit->plug ( mMainWindow->toolBar()); 1956 // mActionQuit->plug ( mMainWindow->toolBar());
1957 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1957 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1958 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1958 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1959 // mIncSearchWidget->hide(); 1959 // mIncSearchWidget->hide();
1960 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1960 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1961 SLOT( incrementalSearch( const QString& ) ) ); 1961 SLOT( incrementalSearch( const QString& ) ) );
1962 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1962 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1963 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1963 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1964 1964
1965 mJumpButtonBar = new JumpButtonBar( this, this ); 1965 mJumpButtonBar = new JumpButtonBar( this, this );
1966 1966
1967 topLayout->addWidget( mJumpButtonBar ); 1967 topLayout->addWidget( mJumpButtonBar );
1968//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1968//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1969 1969
1970// mMainWindow->getIconToolBar()->raise(); 1970// mMainWindow->getIconToolBar()->raise();
1971 1971
1972#endif //KAB_EMBEDDED 1972#endif //KAB_EMBEDDED
1973 1973
1974} 1974}
1975void KABCore::initActions() 1975void KABCore::initActions()
1976{ 1976{
1977//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1977//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1978 1978
1979#ifndef KAB_EMBEDDED 1979#ifndef KAB_EMBEDDED
1980 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1980 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1981 SLOT( clipboardDataChanged() ) ); 1981 SLOT( clipboardDataChanged() ) );
1982#endif //KAB_EMBEDDED 1982#endif //KAB_EMBEDDED
1983 1983
1984 // file menu 1984 // file menu
1985 1985
1986 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1986 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1987 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1987 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1988 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, 1988 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
1989 SLOT( printView() ), actionCollection(), "kaddressbook_print" ); 1989 SLOT( printView() ), actionCollection(), "kaddressbook_print" );
1990 1990
1991 1991
1992 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, 1992 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
1993 SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); 1993 SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
1994 1994
1995 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1995 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1996 SLOT( save() ), actionCollection(), "file_sync" ); 1996 SLOT( save() ), actionCollection(), "file_sync" );
1997 1997
1998 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1998 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1999 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1999 SLOT( newContact() ), actionCollection(), "file_new_contact" );
2000 2000
2001 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 2001 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
2002 this, SLOT( mailVCard() ), 2002 this, SLOT( mailVCard() ),
2003 actionCollection(), "file_mail_vcard"); 2003 actionCollection(), "file_mail_vcard");
2004 2004
2005 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 2005 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
2006 SLOT( export2phone() ), actionCollection(), 2006 SLOT( export2phone() ), actionCollection(),
2007 "kaddressbook_ex2phone" ); 2007 "kaddressbook_ex2phone" );
2008 2008
2009 mActionBeamVCard = 0; 2009 mActionBeamVCard = 0;
2010 mActionBeam = 0; 2010 mActionBeam = 0;
2011 2011
2012#ifndef DESKTOP_VERSION 2012#ifndef DESKTOP_VERSION
2013 if ( Ir::supported() ) { 2013 if ( Ir::supported() ) {
2014 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 2014 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
2015 SLOT( beamVCard() ), actionCollection(), 2015 SLOT( beamVCard() ), actionCollection(),
2016 "kaddressbook_beam_vcard" ); 2016 "kaddressbook_beam_vcard" );
2017 2017
2018 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 2018 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
2019 SLOT( beamMySelf() ), actionCollection(), 2019 SLOT( beamMySelf() ), actionCollection(),
2020 "kaddressbook_beam_myself" ); 2020 "kaddressbook_beam_myself" );
2021 } 2021 }
2022#endif 2022#endif
2023 2023
2024 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 2024 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
2025 this, SLOT( editContact2() ), 2025 this, SLOT( editContact2() ),
2026 actionCollection(), "file_properties" ); 2026 actionCollection(), "file_properties" );
2027 2027
2028#ifdef KAB_EMBEDDED 2028#ifdef KAB_EMBEDDED
2029 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 2029 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
2030 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 2030 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
2031 mMainWindow, SLOT( exit() ), 2031 mMainWindow, SLOT( exit() ),
2032 actionCollection(), "quit" ); 2032 actionCollection(), "quit" );
2033#endif //KAB_EMBEDDED 2033#endif //KAB_EMBEDDED
2034 2034
2035 // edit menu 2035 // edit menu
@@ -3379,117 +3379,122 @@ void KABCore::removeSyncInfo( QString syncProfile)
3379bool KABCore::syncExternal(KSyncManager* manager, QString resource) 3379bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3380{ 3380{
3381 if ( resource == "phone" ) 3381 if ( resource == "phone" )
3382 return syncPhone(); 3382 return syncPhone();
3383 disableBR( true ); 3383 disableBR( true );
3384 if ( manager != syncManager ) 3384 if ( manager != syncManager )
3385 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); 3385 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
3386 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3386 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3387 3387
3388 AddressBook abLocal( resource,"syncContact"); 3388 AddressBook abLocal( resource,"syncContact");
3389 bool syncOK = false; 3389 bool syncOK = false;
3390 message(i18n("Loading DTM address data..."), false); 3390 message(i18n("Loading DTM address data..."), false);
3391 if ( abLocal.load() ) { 3391 if ( abLocal.load() ) {
3392 qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3392 qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3393 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3393 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3394 message(i18n("Sync preprocessing..."),false); 3394 message(i18n("Sync preprocessing..."),false);
3395 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 3395 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
3396 message(i18n("Synchronizing..."),false); 3396 message(i18n("Synchronizing..."),false);
3397 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3397 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3398 syncManager->hideProgressBar(); 3398 syncManager->hideProgressBar();
3399 if ( syncOK ) { 3399 if ( syncOK ) {
3400 if ( syncManager->mWriteBackFile ) { 3400 if ( syncManager->mWriteBackFile ) {
3401 abLocal.removeSyncAddressees( false ); 3401 abLocal.removeSyncAddressees( false );
3402 message(i18n("Saving DTM address data..."),false); 3402 message(i18n("Saving DTM address data..."),false);
3403 abLocal.saveAB(); 3403 abLocal.saveAB();
3404 message(i18n("Sync postprocessing..."),false); 3404 message(i18n("Sync postprocessing..."),false);
3405 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3405 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3406 } 3406 }
3407 } else 3407 } else
3408 message( i18n("Sync cancelled or failed.") ); 3408 message( i18n("Sync cancelled or failed.") );
3409 setModified(); 3409 setModified();
3410 } 3410 }
3411 abLocal.removeResources(); 3411 abLocal.removeResources();
3412 if ( syncOK ) { 3412 if ( syncOK ) {
3413 mViewManager->refreshView(); 3413 mViewManager->refreshView();
3414 message(i18n("DTM syncing finished.")); 3414 message(i18n("DTM syncing finished."));
3415 } 3415 }
3416 disableBR( false ); 3416 disableBR( false );
3417 return syncOK; 3417 return syncOK;
3418 3418
3419} 3419}
3420void KABCore::message( QString m, bool startTimer) 3420void KABCore::message( QString m, bool startTimer)
3421{ 3421{
3422 topLevelWidget()->setCaption( m ); 3422 topLevelWidget()->setCaption( m );
3423 qApp->processEvents(); 3423 qApp->processEvents();
3424 if ( startTimer ) 3424 if ( startTimer )
3425 mMessageTimer->start( 15000, true ); 3425 mMessageTimer->start( 15000, true );
3426 else 3426 else
3427 mMessageTimer->stop(); 3427 mMessageTimer->stop();
3428} 3428}
3429bool KABCore::syncPhone() 3429bool KABCore::syncPhone()
3430{ 3430{
3431 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3431 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3432 QString fileName = getPhoneFile(); 3432 QString fileName = getPhoneFile();
3433 if ( !PhoneAccess::readFromPhone( fileName) ) { 3433 if ( !PhoneAccess::readFromPhone( fileName) ) {
3434 message(i18n("Phone access failed!")); 3434 message(i18n("Phone access failed!"));
3435 return false; 3435 return false;
3436 } 3436 }
3437 AddressBook abLocal( fileName,"syncContact"); 3437 AddressBook abLocal( fileName,"syncContact");
3438 bool syncOK = false; 3438 bool syncOK = false;
3439 { 3439 {
3440 abLocal.importFromFile( fileName ); 3440 abLocal.importFromFile( fileName );
3441 qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3441 qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
3442 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3442 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3443 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 3443 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
3444 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3444 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3445 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3445 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3446 syncManager->hideProgressBar(); 3446 syncManager->hideProgressBar();
3447 if ( syncOK ) { 3447 if ( syncOK ) {
3448 if ( syncManager->mWriteBackFile ) { 3448 if ( syncManager->mWriteBackFile ) {
3449 abLocal.removeSyncAddressees( true ); 3449 abLocal.removeSyncAddressees( true );
3450 abLocal.saveABphone( fileName ); 3450 abLocal.saveABphone( fileName );
3451 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 3451 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
3452 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 3452 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
3453 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3453 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3454 } 3454 }
3455 } 3455 }
3456 setModified(); 3456 setModified();
3457 } 3457 }
3458 abLocal.removeResources(); 3458 abLocal.removeResources();
3459 if ( syncOK ) 3459 if ( syncOK )
3460 mViewManager->refreshView(); 3460 mViewManager->refreshView();
3461 return syncOK; 3461 return syncOK;
3462} 3462}
3463void KABCore::getFile( bool success ) 3463void KABCore::getFile( bool success )
3464{ 3464{
3465 if ( ! success ) { 3465 if ( ! success ) {
3466 message( i18n("Error receiving file. Nothing changed!") ); 3466 message( i18n("Error receiving file. Nothing changed!") );
3467 return; 3467 return;
3468 } 3468 }
3469 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 3469 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
3470 if ( count ) 3470 if ( count )
3471 setModified( true ); 3471 setModified( true );
3472 message( i18n("Pi-Sync successful!") ); 3472 message( i18n("Pi-Sync successful!") );
3473 mViewManager->refreshView(); 3473 mViewManager->refreshView();
3474} 3474}
3475void KABCore::syncFileRequest() 3475void KABCore::syncFileRequest(const QString & resource)
3476{ 3476{
3477 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 3477 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
3478 syncManager->slotSyncMenu( 999 ); 3478 syncManager->slotSyncMenu( 999 );
3479 } 3479 }
3480 mAddressBook->export2File( sentSyncFile() ); 3480
3481 if ( resource == "ALL" ) {
3482 mAddressBook->export2File( sentSyncFile() );
3483 }
3484 else
3485 mAddressBook->export2File( sentSyncFile(), resource);
3481} 3486}
3482QString KABCore::sentSyncFile() 3487QString KABCore::sentSyncFile()
3483{ 3488{
3484#ifdef DESKTOP_VERSION 3489#ifdef DESKTOP_VERSION
3485 return locateLocal( "tmp", "copysyncab.vcf" ); 3490 return locateLocal( "tmp", "copysyncab.vcf" );
3486#else 3491#else
3487 return QString( "/tmp/copysyncab.vcf" ); 3492 return QString( "/tmp/copysyncab.vcf" );
3488#endif 3493#endif
3489} 3494}
3490 3495
3491void KABCore::setCaptionBack() 3496void KABCore::setCaptionBack()
3492{ 3497{
3493 mMessageTimer->stop(); 3498 mMessageTimer->stop();
3494 topLevelWidget()->setCaption( i18n("KA/Pi") ); 3499 topLevelWidget()->setCaption( i18n("KA/Pi") );
3495} 3500}