summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-12-05 13:41:41 (UTC)
committer zautrix <zautrix>2004-12-05 13:41:41 (UTC)
commit06bebf5be01898145c4f721a8d002519141e7f3b (patch) (unidiff)
treebc44d996a58a63de8c43cb5ba54d55bf1494eb5c
parent5ab47964d8b52897bb0662ef4a5fcf9604acaf6c (diff)
downloadkdepimpi-06bebf5be01898145c4f721a8d002519141e7f3b.zip
kdepimpi-06bebf5be01898145c4f721a8d002519141e7f3b.tar.gz
kdepimpi-06bebf5be01898145c4f721a8d002519141e7f3b.tar.bz2
added better debug output to sync file problems
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp8
-rw-r--r--libkdepim/ksyncmanager.cpp4
2 files changed, 9 insertions, 3 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 15cab73..b7edccd 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1701,193 +1701,195 @@ void KABCore::initGUI()
1701 ImportMenu = new QPopupMenu( this ); 1701 ImportMenu = new QPopupMenu( this );
1702 ExportMenu = new QPopupMenu( this ); 1702 ExportMenu = new QPopupMenu( this );
1703 syncMenu = new QPopupMenu( this ); 1703 syncMenu = new QPopupMenu( this );
1704 changeMenu= new QPopupMenu( this ); 1704 changeMenu= new QPopupMenu( this );
1705 beamMenu= new QPopupMenu( this ); 1705 beamMenu= new QPopupMenu( this );
1706 1706
1707//US since we have no splitter for the embedded system, setup 1707//US since we have no splitter for the embedded system, setup
1708// a layout with two frames. One left and one right. 1708// a layout with two frames. One left and one right.
1709 1709
1710 QBoxLayout *topLayout; 1710 QBoxLayout *topLayout;
1711 1711
1712 // = new QHBoxLayout( this ); 1712 // = new QHBoxLayout( this );
1713// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1713// QBoxLayout *topLayout = (QBoxLayout*)layout();
1714 1714
1715// QWidget *mainBox = new QWidget( this ); 1715// QWidget *mainBox = new QWidget( this );
1716// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1716// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1717 1717
1718#ifdef DESKTOP_VERSION 1718#ifdef DESKTOP_VERSION
1719 topLayout = new QHBoxLayout( this ); 1719 topLayout = new QHBoxLayout( this );
1720 1720
1721 1721
1722 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1722 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1723 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1723 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1724 1724
1725 topLayout->addWidget(mMiniSplitter ); 1725 topLayout->addWidget(mMiniSplitter );
1726 1726
1727 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1727 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1728 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1728 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1729 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1729 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1730 mDetails = new ViewContainer( mMiniSplitter ); 1730 mDetails = new ViewContainer( mMiniSplitter );
1731 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1731 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1732#else 1732#else
1733 if ( QApplication::desktop()->width() > 480 ) { 1733 if ( QApplication::desktop()->width() > 480 ) {
1734 topLayout = new QHBoxLayout( this ); 1734 topLayout = new QHBoxLayout( this );
1735 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1735 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1736 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1736 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1737 } else { 1737 } else {
1738 1738
1739 topLayout = new QHBoxLayout( this ); 1739 topLayout = new QHBoxLayout( this );
1740 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1740 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1741 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1741 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1742 } 1742 }
1743 1743
1744 topLayout->addWidget(mMiniSplitter ); 1744 topLayout->addWidget(mMiniSplitter );
1745 mViewManager = new ViewManager( this, mMiniSplitter ); 1745 mViewManager = new ViewManager( this, mMiniSplitter );
1746 mDetails = new ViewContainer( mMiniSplitter ); 1746 mDetails = new ViewContainer( mMiniSplitter );
1747 1747
1748 1748
1749 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1749 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1750#endif 1750#endif
1751 //eh->hide(); 1751 //eh->hide();
1752 // topLayout->addWidget(mExtensionManager ); 1752 // topLayout->addWidget(mExtensionManager );
1753 1753
1754 1754
1755/*US 1755/*US
1756#ifndef KAB_NOSPLITTER 1756#ifndef KAB_NOSPLITTER
1757 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1757 QHBoxLayout *topLayout = new QHBoxLayout( this );
1758//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1758//US topLayout->setSpacing( KDialogBase::spacingHint() );
1759 topLayout->setSpacing( 10 ); 1759 topLayout->setSpacing( 10 );
1760 1760
1761 mDetailsSplitter = new QSplitter( this ); 1761 mDetailsSplitter = new QSplitter( this );
1762 1762
1763 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1763 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1764 1764
1765 mViewManager = new ViewManager( this, viewSpace ); 1765 mViewManager = new ViewManager( this, viewSpace );
1766 viewSpace->setStretchFactor( mViewManager, 1 ); 1766 viewSpace->setStretchFactor( mViewManager, 1 );
1767 1767
1768 mDetails = new ViewContainer( mDetailsSplitter ); 1768 mDetails = new ViewContainer( mDetailsSplitter );
1769 1769
1770 topLayout->addWidget( mDetailsSplitter ); 1770 topLayout->addWidget( mDetailsSplitter );
1771 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1771 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1772#else //KAB_NOSPLITTER 1772#else //KAB_NOSPLITTER
1773 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1773 QHBoxLayout *topLayout = new QHBoxLayout( this );
1774//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1774//US topLayout->setSpacing( KDialogBase::spacingHint() );
1775 topLayout->setSpacing( 10 ); 1775 topLayout->setSpacing( 10 );
1776 1776
1777// mDetailsSplitter = new QSplitter( this ); 1777// mDetailsSplitter = new QSplitter( this );
1778 1778
1779 QVBox *viewSpace = new QVBox( this ); 1779 QVBox *viewSpace = new QVBox( this );
1780 1780
1781 mViewManager = new ViewManager( this, viewSpace ); 1781 mViewManager = new ViewManager( this, viewSpace );
1782 viewSpace->setStretchFactor( mViewManager, 1 ); 1782 viewSpace->setStretchFactor( mViewManager, 1 );
1783 1783
1784 mDetails = new ViewContainer( this ); 1784 mDetails = new ViewContainer( this );
1785 1785
1786 topLayout->addWidget( viewSpace ); 1786 topLayout->addWidget( viewSpace );
1787// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1787// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1788 topLayout->addWidget( mDetails ); 1788 topLayout->addWidget( mDetails );
1789#endif //KAB_NOSPLITTER 1789#endif //KAB_NOSPLITTER
1790*/ 1790*/
1791 1791
1792 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1792 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1793 syncManager->setBlockSave(false); 1793 syncManager->setBlockSave(false);
1794 1794
1795 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1795 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1796 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1796 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1797 syncManager->setDefaultFileName( sentSyncFile()); 1797 QString sync_file = sentSyncFile();
1798 qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1799 syncManager->setDefaultFileName( sync_file );
1798 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1800 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1799 1801
1800#endif //KAB_EMBEDDED 1802#endif //KAB_EMBEDDED
1801 initActions(); 1803 initActions();
1802 1804
1803#ifdef KAB_EMBEDDED 1805#ifdef KAB_EMBEDDED
1804 addActionsManually(); 1806 addActionsManually();
1805 //US make sure the export and import menues are initialized before creating the xxPortManager. 1807 //US make sure the export and import menues are initialized before creating the xxPortManager.
1806 mXXPortManager = new XXPortManager( this, this ); 1808 mXXPortManager = new XXPortManager( this, this );
1807 1809
1808 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1810 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1809 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1811 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1810 // mActionQuit->plug ( mMainWindow->toolBar()); 1812 // mActionQuit->plug ( mMainWindow->toolBar());
1811 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1813 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1812 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1814 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1813 // mIncSearchWidget->hide(); 1815 // mIncSearchWidget->hide();
1814 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1816 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1815 SLOT( incrementalSearch( const QString& ) ) ); 1817 SLOT( incrementalSearch( const QString& ) ) );
1816 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1818 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1817 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1819 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1818 1820
1819 mJumpButtonBar = new JumpButtonBar( this, this ); 1821 mJumpButtonBar = new JumpButtonBar( this, this );
1820 1822
1821 topLayout->addWidget( mJumpButtonBar ); 1823 topLayout->addWidget( mJumpButtonBar );
1822//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1824//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1823 1825
1824// mMainWindow->getIconToolBar()->raise(); 1826// mMainWindow->getIconToolBar()->raise();
1825 1827
1826#endif //KAB_EMBEDDED 1828#endif //KAB_EMBEDDED
1827 1829
1828} 1830}
1829void KABCore::initActions() 1831void KABCore::initActions()
1830{ 1832{
1831//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1833//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1832 1834
1833#ifndef KAB_EMBEDDED 1835#ifndef KAB_EMBEDDED
1834 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1836 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1835 SLOT( clipboardDataChanged() ) ); 1837 SLOT( clipboardDataChanged() ) );
1836#endif //KAB_EMBEDDED 1838#endif //KAB_EMBEDDED
1837 1839
1838 // file menu 1840 // file menu
1839 if ( mIsPart ) { 1841 if ( mIsPart ) {
1840 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1842 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1841 SLOT( sendMail() ), actionCollection(), 1843 SLOT( sendMail() ), actionCollection(),
1842 "kaddressbook_mail" ); 1844 "kaddressbook_mail" );
1843 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1845 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1844 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1846 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1845 1847
1846 } else { 1848 } else {
1847 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1849 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1848 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1850 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1849 } 1851 }
1850 1852
1851 1853
1852 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1854 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1853 SLOT( save() ), actionCollection(), "file_sync" ); 1855 SLOT( save() ), actionCollection(), "file_sync" );
1854 1856
1855 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1857 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1856 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1858 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1857 1859
1858 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1860 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1859 this, SLOT( mailVCard() ), 1861 this, SLOT( mailVCard() ),
1860 actionCollection(), "file_mail_vcard"); 1862 actionCollection(), "file_mail_vcard");
1861 1863
1862 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1864 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1863 SLOT( export2phone() ), actionCollection(), 1865 SLOT( export2phone() ), actionCollection(),
1864 "kaddressbook_ex2phone" ); 1866 "kaddressbook_ex2phone" );
1865 1867
1866 mActionBeamVCard = 0; 1868 mActionBeamVCard = 0;
1867 mActionBeam = 0; 1869 mActionBeam = 0;
1868 1870
1869#ifndef DESKTOP_VERSION 1871#ifndef DESKTOP_VERSION
1870 if ( Ir::supported() ) { 1872 if ( Ir::supported() ) {
1871 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1873 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1872 SLOT( beamVCard() ), actionCollection(), 1874 SLOT( beamVCard() ), actionCollection(),
1873 "kaddressbook_beam_vcard" ); 1875 "kaddressbook_beam_vcard" );
1874 1876
1875 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1877 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1876 SLOT( beamMySelf() ), actionCollection(), 1878 SLOT( beamMySelf() ), actionCollection(),
1877 "kaddressbook_beam_myself" ); 1879 "kaddressbook_beam_myself" );
1878 } 1880 }
1879#endif 1881#endif
1880 1882
1881 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1883 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1882 this, SLOT( editContact2() ), 1884 this, SLOT( editContact2() ),
1883 actionCollection(), "file_properties" ); 1885 actionCollection(), "file_properties" );
1884 1886
1885#ifdef KAB_EMBEDDED 1887#ifdef KAB_EMBEDDED
1886 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1888 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1887 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1889 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1888 mMainWindow, SLOT( exit() ), 1890 mMainWindow, SLOT( exit() ),
1889 actionCollection(), "quit" ); 1891 actionCollection(), "quit" );
1890#endif //KAB_EMBEDDED 1892#endif //KAB_EMBEDDED
1891 1893
1892 // edit menu 1894 // edit menu
1893 if ( mIsPart ) { 1895 if ( mIsPart ) {
@@ -2913,259 +2915,263 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2913 qApp->processEvents(); 2915 qApp->processEvents();
2914 if (syncManager->isProgressBarCanceled()) 2916 if (syncManager->isProgressBarCanceled())
2915 return false; 2917 return false;
2916 if ( incCounter % modulo == 0 ) 2918 if ( incCounter % modulo == 0 )
2917 syncManager->showProgressBar(incCounter); 2919 syncManager->showProgressBar(incCounter);
2918 uid = el[ incCounter ]; 2920 uid = el[ incCounter ];
2919 bool skipIncidence = false; 2921 bool skipIncidence = false;
2920 if ( uid.left(19) == QString("last-syncAddressee-") ) 2922 if ( uid.left(19) == QString("last-syncAddressee-") )
2921 skipIncidence = true; 2923 skipIncidence = true;
2922 if ( !skipIncidence ) { 2924 if ( !skipIncidence ) {
2923 inL = local->findByUid( uid ); 2925 inL = local->findByUid( uid );
2924 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2926 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2925 inR = remote->findByUid( uid ); 2927 inR = remote->findByUid( uid );
2926 if ( inR.isEmpty() ) { // no conflict ********** add or delete local 2928 if ( inR.isEmpty() ) { // no conflict ********** add or delete local
2927 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2929 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2928 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2930 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2929 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2931 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2930 local->removeAddressee( inL ); 2932 local->removeAddressee( inL );
2931 ++deletedAddresseeL; 2933 ++deletedAddresseeL;
2932 } else { 2934 } else {
2933 if ( ! syncManager->mWriteBackExistingOnly ) { 2935 if ( ! syncManager->mWriteBackExistingOnly ) {
2934 inL.removeID(mCurrentSyncDevice ); 2936 inL.removeID(mCurrentSyncDevice );
2935 ++addedAddresseeR; 2937 ++addedAddresseeR;
2936 inL.setRevision( modifiedCalendar ); 2938 inL.setRevision( modifiedCalendar );
2937 local->insertAddressee( inL, false ); 2939 local->insertAddressee( inL, false );
2938 inR = inL; 2940 inR = inL;
2939 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2941 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2940 inR.setResource( 0 ); 2942 inR.setResource( 0 );
2941 remote->insertAddressee( inR, false ); 2943 remote->insertAddressee( inR, false );
2942 } 2944 }
2943 } 2945 }
2944 } else { 2946 } else {
2945 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2947 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2946 //qDebug("data %s ", inL.revision().toString().latin1()); 2948 //qDebug("data %s ", inL.revision().toString().latin1());
2947 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2949 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2948 local->removeAddressee( inL ); 2950 local->removeAddressee( inL );
2949 ++deletedAddresseeL; 2951 ++deletedAddresseeL;
2950 } else { 2952 } else {
2951 if ( ! syncManager->mWriteBackExistingOnly ) { 2953 if ( ! syncManager->mWriteBackExistingOnly ) {
2952 ++addedAddresseeR; 2954 ++addedAddresseeR;
2953 inL.setRevision( modifiedCalendar ); 2955 inL.setRevision( modifiedCalendar );
2954 local->insertAddressee( inL, false ); 2956 local->insertAddressee( inL, false );
2955 inR = inL; 2957 inR = inL;
2956 inR.setIDStr( ":" ); 2958 inR.setIDStr( ":" );
2957 inR.setResource( 0 ); 2959 inR.setResource( 0 );
2958 remote->insertAddressee( inR, false ); 2960 remote->insertAddressee( inR, false );
2959 } 2961 }
2960 } 2962 }
2961 } 2963 }
2962 } 2964 }
2963 } 2965 }
2964 } 2966 }
2965 ++incCounter; 2967 ++incCounter;
2966 } 2968 }
2967 el.clear(); 2969 el.clear();
2968 syncManager->hideProgressBar(); 2970 syncManager->hideProgressBar();
2969 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2971 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2970 // get rid of micro seconds 2972 // get rid of micro seconds
2971 QTime t = mLastAddressbookSync.time(); 2973 QTime t = mLastAddressbookSync.time();
2972 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2974 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2973 addresseeLSync.setRevision( mLastAddressbookSync ); 2975 addresseeLSync.setRevision( mLastAddressbookSync );
2974 addresseeRSync.setRevision( mLastAddressbookSync ); 2976 addresseeRSync.setRevision( mLastAddressbookSync );
2975 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2977 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2976 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2978 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2977 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2979 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2978 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2980 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2979 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2981 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2980 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2982 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2981 addresseeRSync.setNote( "" ) ; 2983 addresseeRSync.setNote( "" ) ;
2982 addresseeLSync.setNote( "" ); 2984 addresseeLSync.setNote( "" );
2983 2985
2984 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2986 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2985 remote->insertAddressee( addresseeRSync, false ); 2987 remote->insertAddressee( addresseeRSync, false );
2986 local->insertAddressee( addresseeLSync, false ); 2988 local->insertAddressee( addresseeLSync, false );
2987 QString mes; 2989 QString mes;
2988 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2990 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2989 qDebug( mes ); 2991 qDebug( mes );
2990 mes = i18n("Local addressbook changed!\n") +mes; 2992 mes = i18n("Local addressbook changed!\n") +mes;
2991 if ( syncManager->mShowSyncSummary ) { 2993 if ( syncManager->mShowSyncSummary ) {
2992 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 2994 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
2993 i18n("KA/Pi Synchronization"),i18n("Write back"))) { 2995 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
2994 qDebug("cancelled "); 2996 qDebug("cancelled ");
2995 return false; 2997 return false;
2996 } 2998 }
2997 } 2999 }
2998 return syncOK; 3000 return syncOK;
2999} 3001}
3000 3002
3001 3003
3002//this is a overwritten callbackmethods from the syncinterface 3004//this is a overwritten callbackmethods from the syncinterface
3003bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 3005bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
3004{ 3006{
3005 3007
3006 //pending prepare addresseeview for output 3008 //pending prepare addresseeview for output
3007 //pending detect, if remote file has REV field. if not switch to external sync 3009 //pending detect, if remote file has REV field. if not switch to external sync
3008 mGlobalSyncMode = SYNC_MODE_NORMAL; 3010 mGlobalSyncMode = SYNC_MODE_NORMAL;
3011 if ( manager != syncManager )
3012 qDebug("KABCore::sync:: ERROR! :: manager != syncManager ");
3009 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3013 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3010 3014
3011 AddressBook abLocal(filename,"syncContact"); 3015 AddressBook abLocal(filename,"syncContact");
3012 bool syncOK = false; 3016 bool syncOK = false;
3013 if ( abLocal.load() ) { 3017 if ( abLocal.load() ) {
3014 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 3018 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
3015 bool external = false; 3019 bool external = false;
3016 bool isXML = false; 3020 bool isXML = false;
3017 if ( filename.right(4) == ".xml") { 3021 if ( filename.right(4) == ".xml") {
3018 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3022 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3019 isXML = true; 3023 isXML = true;
3020 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3024 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3021 } else { 3025 } else {
3022 external = !manager->mIsKapiFile; 3026 external = !manager->mIsKapiFile;
3023 if ( external ) { 3027 if ( external ) {
3024 qDebug("Setting vcf mode to external "); 3028 qDebug("Setting vcf mode to external ");
3025 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3029 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3026 AddressBook::Iterator it; 3030 AddressBook::Iterator it;
3027 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3031 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3028 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 3032 (*it).setID( mCurrentSyncDevice, (*it).uid() );
3029 (*it).computeCsum( mCurrentSyncDevice ); 3033 (*it).computeCsum( mCurrentSyncDevice );
3030 } 3034 }
3031 } 3035 }
3032 } 3036 }
3033 //AddressBook::Iterator it; 3037 //AddressBook::Iterator it;
3034 //QStringList vcards; 3038 //QStringList vcards;
3035 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3039 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3036 // qDebug("Name %s ", (*it).familyName().latin1()); 3040 // qDebug("Name %s ", (*it).familyName().latin1());
3037 //} 3041 //}
3038 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 3042 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
3039 if ( syncOK ) { 3043 if ( syncOK ) {
3040 if ( syncManager->mWriteBackFile ) 3044 if ( syncManager->mWriteBackFile )
3041 { 3045 {
3042 if ( external ) 3046 if ( external )
3043 abLocal.removeSyncAddressees( !isXML); 3047 abLocal.removeSyncAddressees( !isXML);
3044 qDebug("Saving remote AB "); 3048 qDebug("Saving remote AB ");
3045 if ( ! abLocal.saveAB()) 3049 if ( ! abLocal.saveAB())
3046 qDebug("Error writing back AB to file "); 3050 qDebug("Error writing back AB to file ");
3047 if ( external ) { 3051 if ( external ) {
3048 // afterwrite processing 3052 // afterwrite processing
3049 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); 3053 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
3050 } 3054 }
3051 } 3055 }
3052 } 3056 }
3053 setModified(); 3057 setModified();
3054 3058
3055 } 3059 }
3056 abLocal.removeResources(); 3060 abLocal.removeResources();
3057 if ( syncOK ) 3061 if ( syncOK )
3058 mViewManager->refreshView(); 3062 mViewManager->refreshView();
3059 return syncOK; 3063 return syncOK;
3060 3064
3061} 3065}
3062void KABCore::removeSyncInfo( QString syncProfile) 3066void KABCore::removeSyncInfo( QString syncProfile)
3063{ 3067{
3064 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 3068 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
3065 mAddressBook->removeSyncInfo( syncProfile ); 3069 mAddressBook->removeSyncInfo( syncProfile );
3066 setModified(); 3070 setModified();
3067} 3071}
3068 3072
3069 3073
3070//this is a overwritten callbackmethods from the syncinterface 3074//this is a overwritten callbackmethods from the syncinterface
3071bool KABCore::syncExternal(KSyncManager* manager, QString resource) 3075bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3072{ 3076{
3073 if ( resource == "phone" ) 3077 if ( resource == "phone" )
3074 return syncPhone(); 3078 return syncPhone();
3075 disableBR( true ); 3079 disableBR( true );
3080 if ( manager != syncManager )
3081 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
3076 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3082 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3077 3083
3078 AddressBook abLocal( resource,"syncContact"); 3084 AddressBook abLocal( resource,"syncContact");
3079 bool syncOK = false; 3085 bool syncOK = false;
3080 if ( abLocal.load() ) { 3086 if ( abLocal.load() ) {
3081 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3087 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3082 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3088 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3083 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 3089 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
3084 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3090 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3085 if ( syncOK ) { 3091 if ( syncOK ) {
3086 if ( syncManager->mWriteBackFile ) { 3092 if ( syncManager->mWriteBackFile ) {
3087 abLocal.removeSyncAddressees( false ); 3093 abLocal.removeSyncAddressees( false );
3088 abLocal.saveAB(); 3094 abLocal.saveAB();
3089 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3095 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3090 } 3096 }
3091 } else 3097 } else
3092 message( i18n("Sync cancelled or failed.") ); 3098 message( i18n("Sync cancelled or failed.") );
3093 setModified(); 3099 setModified();
3094 } 3100 }
3095 abLocal.removeResources(); 3101 abLocal.removeResources();
3096 if ( syncOK ) 3102 if ( syncOK )
3097 mViewManager->refreshView(); 3103 mViewManager->refreshView();
3098 disableBR( false ); 3104 disableBR( false );
3099 return syncOK; 3105 return syncOK;
3100 3106
3101} 3107}
3102void KABCore::message( QString m ) 3108void KABCore::message( QString m )
3103{ 3109{
3104 topLevelWidget()->setCaption( m ); 3110 topLevelWidget()->setCaption( m );
3105 mMessageTimer->start( 15000, true ); 3111 mMessageTimer->start( 15000, true );
3106} 3112}
3107bool KABCore::syncPhone() 3113bool KABCore::syncPhone()
3108{ 3114{
3109 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3115 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3110 QString fileName = getPhoneFile(); 3116 QString fileName = getPhoneFile();
3111 if ( !PhoneAccess::readFromPhone( fileName) ) { 3117 if ( !PhoneAccess::readFromPhone( fileName) ) {
3112 message(i18n("Phone access failed!")); 3118 message(i18n("Phone access failed!"));
3113 return false; 3119 return false;
3114 } 3120 }
3115 AddressBook abLocal( fileName,"syncContact"); 3121 AddressBook abLocal( fileName,"syncContact");
3116 bool syncOK = false; 3122 bool syncOK = false;
3117 { 3123 {
3118 abLocal.importFromFile( fileName ); 3124 abLocal.importFromFile( fileName );
3119 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3125 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
3120 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3126 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3121 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 3127 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
3122 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3128 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3123 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3129 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3124 if ( syncOK ) { 3130 if ( syncOK ) {
3125 if ( syncManager->mWriteBackFile ) { 3131 if ( syncManager->mWriteBackFile ) {
3126 abLocal.removeSyncAddressees( true ); 3132 abLocal.removeSyncAddressees( true );
3127 abLocal.saveABphone( fileName ); 3133 abLocal.saveABphone( fileName );
3128 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 3134 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
3129 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 3135 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
3130 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3136 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3131 } 3137 }
3132 } 3138 }
3133 setModified(); 3139 setModified();
3134 } 3140 }
3135 abLocal.removeResources(); 3141 abLocal.removeResources();
3136 if ( syncOK ) 3142 if ( syncOK )
3137 mViewManager->refreshView(); 3143 mViewManager->refreshView();
3138 return syncOK; 3144 return syncOK;
3139} 3145}
3140void KABCore::getFile( bool success ) 3146void KABCore::getFile( bool success )
3141{ 3147{
3142 if ( ! success ) { 3148 if ( ! success ) {
3143 message( i18n("Error receiving file. Nothing changed!") ); 3149 message( i18n("Error receiving file. Nothing changed!") );
3144 return; 3150 return;
3145 } 3151 }
3146 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 3152 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
3147 if ( count ) 3153 if ( count )
3148 setModified( true ); 3154 setModified( true );
3149 message( i18n("Pi-Sync successful!") ); 3155 message( i18n("Pi-Sync successful!") );
3150 mViewManager->refreshView(); 3156 mViewManager->refreshView();
3151} 3157}
3152void KABCore::syncFileRequest() 3158void KABCore::syncFileRequest()
3153{ 3159{
3154 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 3160 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
3155 syncManager->slotSyncMenu( 999 ); 3161 syncManager->slotSyncMenu( 999 );
3156 } 3162 }
3157 mAddressBook->export2File( sentSyncFile() ); 3163 mAddressBook->export2File( sentSyncFile() );
3158} 3164}
3159QString KABCore::sentSyncFile() 3165QString KABCore::sentSyncFile()
3160{ 3166{
3161#ifdef DESKTOP_VERSION 3167#ifdef DESKTOP_VERSION
3162 return locateLocal( "tmp", "copysyncab.vcf" ); 3168 return locateLocal( "tmp", "copysyncab.vcf" );
3163#else 3169#else
3164 return QString( "/tmp/copysyncab.vcf" ); 3170 return QString( "/tmp/copysyncab.vcf" );
3165#endif 3171#endif
3166} 3172}
3167 3173
3168void KABCore::setCaptionBack() 3174void KABCore::setCaptionBack()
3169{ 3175{
3170 mMessageTimer->stop(); 3176 mMessageTimer->stop();
3171 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 3177 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index c12ba1c..7c53948 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -307,193 +307,193 @@ void KSyncManager::slotSyncMenu( int action )
307 mActiveSyncIP = temp->getRemoteIP(); 307 mActiveSyncIP = temp->getRemoteIP();
308 } else { 308 } else {
309 mPassWordPiSync = temp->getRemotePwPWM(); 309 mPassWordPiSync = temp->getRemotePwPWM();
310 mActiveSyncPort = temp->getRemotePortPWM(); 310 mActiveSyncPort = temp->getRemotePortPWM();
311 mActiveSyncIP = temp->getRemoteIPPWM(); 311 mActiveSyncIP = temp->getRemoteIPPWM();
312 } 312 }
313 syncPi(); 313 syncPi();
314 while ( !mPisyncFinished ) { 314 while ( !mPisyncFinished ) {
315 //qDebug("waiting "); 315 //qDebug("waiting ");
316 qApp->processEvents(); 316 qApp->processEvents();
317 } 317 }
318 } else 318 } else
319 syncRemote( temp ); 319 syncRemote( temp );
320 320
321 } 321 }
322 } 322 }
323 delete temp; 323 delete temp;
324 setBlockSave(false); 324 setBlockSave(false);
325} 325}
326 326
327void KSyncManager::enableQuick( bool ask ) 327void KSyncManager::enableQuick( bool ask )
328{ 328{
329 bool autoStart; 329 bool autoStart;
330 bool changed = false; 330 bool changed = false;
331 if ( ask ) { 331 if ( ask ) {
332 QDialog dia ( 0, "input-dialog", true ); 332 QDialog dia ( 0, "input-dialog", true );
333 QLineEdit lab ( &dia ); 333 QLineEdit lab ( &dia );
334 QVBoxLayout lay( &dia ); 334 QVBoxLayout lay( &dia );
335 lab.setText( mPrefs->mPassiveSyncPort ); 335 lab.setText( mPrefs->mPassiveSyncPort );
336 lay.setMargin(7); 336 lay.setMargin(7);
337 lay.setSpacing(7); 337 lay.setSpacing(7);
338 int po = 9197+mTargetApp; 338 int po = 9197+mTargetApp;
339 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); 339 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia );
340 lay.addWidget( &label); 340 lay.addWidget( &label);
341 lay.addWidget( &lab); 341 lay.addWidget( &lab);
342 342
343 QLineEdit lepw ( &dia ); 343 QLineEdit lepw ( &dia );
344 lepw.setText( mPrefs->mPassiveSyncPw ); 344 lepw.setText( mPrefs->mPassiveSyncPw );
345 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); 345 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
346 lay.addWidget( &label2); 346 lay.addWidget( &label2);
347 lay.addWidget( &lepw); 347 lay.addWidget( &lepw);
348 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); 348 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
349 lay.addWidget( &autostart); 349 lay.addWidget( &autostart);
350 autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); 350 autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
351#ifdef DESKTOP_VERSION 351#ifdef DESKTOP_VERSION
352#ifdef _WIN32_ 352#ifdef _WIN32_
353 QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); 353 QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia );
354 syncdesktop.hide();// not implemented! 354 syncdesktop.hide();// not implemented!
355#else 355#else
356 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); 356 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
357#endif 357#endif
358 lay.addWidget( &syncdesktop); 358 lay.addWidget( &syncdesktop);
359#else 359#else
360 mPrefs->mPassiveSyncWithDesktop = false; 360 mPrefs->mPassiveSyncWithDesktop = false;
361 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); 361 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
362 syncdesktop.hide(); 362 syncdesktop.hide();
363#endif 363#endif
364 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); 364 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop );
365 365
366 dia.setFixedSize( 230,120 ); 366 dia.setFixedSize( 230,120 );
367 dia.setCaption( i18n("Enter port for Pi-Sync") ); 367 dia.setCaption( i18n("Enter port for Pi-Sync") );
368 QPushButton pb ( "OK", &dia); 368 QPushButton pb ( "OK", &dia);
369 lay.addWidget( &pb ); 369 lay.addWidget( &pb );
370 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 370 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
371 dia.show(); 371 dia.show();
372 if ( ! dia.exec() ) 372 if ( ! dia.exec() )
373 return; 373 return;
374 dia.hide(); 374 dia.hide();
375 qApp->processEvents(); 375 qApp->processEvents();
376 if ( mPrefs->mPassiveSyncPw != lepw.text() ) { 376 if ( mPrefs->mPassiveSyncPw != lepw.text() ) {
377 changed = true; 377 changed = true;
378 mPrefs->mPassiveSyncPw = lepw.text(); 378 mPrefs->mPassiveSyncPw = lepw.text();
379 } 379 }
380 if ( mPrefs->mPassiveSyncPort != lab.text() ) { 380 if ( mPrefs->mPassiveSyncPort != lab.text() ) {
381 mPrefs->mPassiveSyncPort = lab.text(); 381 mPrefs->mPassiveSyncPort = lab.text();
382 changed = true; 382 changed = true;
383 } 383 }
384 autoStart = autostart.isChecked(); 384 autoStart = autostart.isChecked();
385 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { 385 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) {
386 changed = true; 386 changed = true;
387 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); 387 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
388 } 388 }
389 } 389 }
390 else 390 else
391 autoStart = mPrefs->mPassiveSyncAutoStart; 391 autoStart = mPrefs->mPassiveSyncAutoStart;
392 if ( autoStart != mPrefs->mPassiveSyncAutoStart ) 392 if ( autoStart != mPrefs->mPassiveSyncAutoStart )
393 changed = true; 393 changed = true;
394 bool ok; 394 bool ok;
395 mPrefs->mPassiveSyncAutoStart = false; 395 mPrefs->mPassiveSyncAutoStart = false;
396 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); 396 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok);
397 if ( ! ok ) { 397 if ( ! ok ) {
398 KMessageBox::information( 0, i18n("No valid port")); 398 KMessageBox::information( 0, i18n("No valid port"));
399 return; 399 return;
400 } 400 }
401 //qDebug("port %d ", port); 401 //qDebug("port %d ", port);
402 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); 402 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
403 mServerSocket->setFileName( defaultFileName() ); 403 mServerSocket->setFileName( defaultFileName() );//bbb
404 //qDebug("connected "); 404 //qDebug("connected ");
405 if ( !mServerSocket->ok() ) { 405 if ( !mServerSocket->ok() ) {
406 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); 406 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!"));
407 delete mServerSocket; 407 delete mServerSocket;
408 mServerSocket = 0; 408 mServerSocket = 0;
409 return; 409 return;
410 } 410 }
411 mPrefs->mPassiveSyncAutoStart = autoStart; 411 mPrefs->mPassiveSyncAutoStart = autoStart;
412 if ( changed ) { 412 if ( changed ) {
413 mPrefs->writeConfig(); 413 mPrefs->writeConfig();
414 } 414 }
415 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 415 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
416 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); 416 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
417} 417}
418 418
419void KSyncManager::syncLocalFile() 419void KSyncManager::syncLocalFile()
420{ 420{
421 421
422 QString fn =mPrefs->mLastSyncedLocalFile; 422 QString fn =mPrefs->mLastSyncedLocalFile;
423 QString ext; 423 QString ext;
424 424
425 switch(mTargetApp) 425 switch(mTargetApp)
426 { 426 {
427 case (KAPI): 427 case (KAPI):
428 ext = "(*.vcf)"; 428 ext = "(*.vcf)";
429 break; 429 break;
430 case (KOPI): 430 case (KOPI):
431 ext = "(*.ics/*.vcs)"; 431 ext = "(*.ics/*.vcs)";
432 break; 432 break;
433 case (PWMPI): 433 case (PWMPI):
434 ext = "(*.pwm)"; 434 ext = "(*.pwm)";
435 break; 435 break;
436 default: 436 default:
437 qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); 437 qDebug("KSyncManager::syncLocalFile: invalid apptype selected");
438 break; 438 break;
439 439
440 } 440 }
441 441
442 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); 442 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent );
443 if ( fn == "" ) 443 if ( fn == "" )
444 return; 444 return;
445 if ( syncWithFile( fn, false ) ) { 445 if ( syncWithFile( fn, false ) ) {
446 qDebug("syncLocalFile() successful "); 446 qDebug("syncLocalFile() successful ");
447 } 447 }
448 448
449} 449}
450 450
451bool KSyncManager::syncWithFile( QString fn , bool quick ) 451bool KSyncManager::syncWithFile( QString fn , bool quick )
452{ 452{
453 bool ret = false; 453 bool ret = false;
454 QFileInfo info; 454 QFileInfo info;
455 info.setFile( fn ); 455 info.setFile( fn );
456 QString mess; 456 QString mess;
457 bool loadbup = true; 457 bool loadbup = true;
458 if ( !info. exists() ) { 458 if ( !info. exists() ) {
459 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 459 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
460 int result = QMessageBox::warning( mParent, i18n("Warning!"), 460 int result = QMessageBox::warning( mParent, i18n("Warning!"),
461 mess ); 461 mess );
462 return ret; 462 return ret;
463 } 463 }
464 int result = 0; 464 int result = 0;
465 if ( !quick ) { 465 if ( !quick ) {
466 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 466 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
467 result = QMessageBox::warning( mParent, i18n("Warning!"), 467 result = QMessageBox::warning( mParent, i18n("Warning!"),
468 mess, 468 mess,
469 i18n("Sync"), i18n("Cancel"), 0, 469 i18n("Sync"), i18n("Cancel"), 0,
470 0, 1 ); 470 0, 1 );
471 if ( result ) 471 if ( result )
472 return false; 472 return false;
473 } 473 }
474 if ( mAskForPreferences ) 474 if ( mAskForPreferences )
475 if ( !edit_sync_options()) { 475 if ( !edit_sync_options()) {
476 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 476 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
477 return false; 477 return false;
478 } 478 }
479 if ( result == 0 ) { 479 if ( result == 0 ) {
480 //qDebug("Now sycing ... "); 480 //qDebug("Now sycing ... ");
481 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 481 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
482 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); 482 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
483 else 483 else
484 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 484 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
485 if ( ! quick ) 485 if ( ! quick )
486 mPrefs->mLastSyncedLocalFile = fn; 486 mPrefs->mLastSyncedLocalFile = fn;
487 } 487 }
488 return ret; 488 return ret;
489} 489}
490 490
491void KSyncManager::quickSyncLocalFile() 491void KSyncManager::quickSyncLocalFile()
492{ 492{
493 493
494 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { 494 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
495 qDebug("quick syncLocalFile() successful "); 495 qDebug("quick syncLocalFile() successful ");
496 496
497 } 497 }
498} 498}
499 499
@@ -1144,193 +1144,193 @@ void KServerSocket::readClient()
1144 //emit sendFile( mSocket ); 1144 //emit sendFile( mSocket );
1145 bool ok = false; 1145 bool ok = false;
1146 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); 1146 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok);
1147 if ( ok ) { 1147 if ( ok ) {
1148 KSyncManager::mRequestedSyncEvent = dt; 1148 KSyncManager::mRequestedSyncEvent = dt;
1149 } 1149 }
1150 else 1150 else
1151 KSyncManager::mRequestedSyncEvent = QDateTime(); 1151 KSyncManager::mRequestedSyncEvent = QDateTime();
1152 send_file(); 1152 send_file();
1153 } 1153 }
1154 else { 1154 else {
1155 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); 1155 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"));
1156 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1156 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1157 } 1157 }
1158 } 1158 }
1159 if ( tokens[0] == "PUT" ) { 1159 if ( tokens[0] == "PUT" ) {
1160 if ( tokens[1] == mPassWord ) { 1160 if ( tokens[1] == mPassWord ) {
1161 //emit getFile( mSocket ); 1161 //emit getFile( mSocket );
1162 blockRC = true; 1162 blockRC = true;
1163 get_file(); 1163 get_file();
1164 } 1164 }
1165 else { 1165 else {
1166 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); 1166 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"));
1167 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1167 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1168 } 1168 }
1169 } 1169 }
1170 if ( tokens[0] == "STOP" ) { 1170 if ( tokens[0] == "STOP" ) {
1171 //emit endConnect(); 1171 //emit endConnect();
1172 end_connect(); 1172 end_connect();
1173 } 1173 }
1174 } 1174 }
1175} 1175}
1176void KServerSocket::end_connect() 1176void KServerSocket::end_connect()
1177{ 1177{
1178 delete mSyncActionDialog; 1178 delete mSyncActionDialog;
1179 mSyncActionDialog = 0; 1179 mSyncActionDialog = 0;
1180} 1180}
1181void KServerSocket::send_file() 1181void KServerSocket::send_file()
1182{ 1182{
1183 //qDebug("MainWindow::sendFile(QSocket* s) "); 1183 //qDebug("MainWindow::sendFile(QSocket* s) ");
1184 if ( mSyncActionDialog ) 1184 if ( mSyncActionDialog )
1185 delete mSyncActionDialog; 1185 delete mSyncActionDialog;
1186 mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); 1186 mSyncActionDialog = new QDialog ( 0, "input-dialog", true );
1187 mSyncActionDialog->setCaption(i18n("Received sync request")); 1187 mSyncActionDialog->setCaption(i18n("Received sync request"));
1188 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); 1188 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
1189 label->setAlignment ( Qt::AlignHCenter ); 1189 label->setAlignment ( Qt::AlignHCenter );
1190 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); 1190 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
1191 lay->addWidget( label); 1191 lay->addWidget( label);
1192 lay->setMargin(7); 1192 lay->setMargin(7);
1193 lay->setSpacing(7); 1193 lay->setSpacing(7);
1194 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 1194 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
1195 int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); 1195 int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent );
1196 if ( secs < 0 ) 1196 if ( secs < 0 )
1197 secs = secs * (-1); 1197 secs = secs * (-1);
1198 if ( secs > 30 ) 1198 if ( secs > 30 )
1199 //if ( true ) 1199 //if ( true )
1200 { 1200 {
1201 QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); 1201 QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs );
1202 QLabel* label = new QLabel( warning, mSyncActionDialog ); 1202 QLabel* label = new QLabel( warning, mSyncActionDialog );
1203 label->setAlignment ( Qt::AlignHCenter ); 1203 label->setAlignment ( Qt::AlignHCenter );
1204 lay->addWidget( label); 1204 lay->addWidget( label);
1205 if ( secs > 180 ) 1205 if ( secs > 180 )
1206 { 1206 {
1207 if ( secs > 300 ) { 1207 if ( secs > 300 ) {
1208 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { 1208 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) {
1209 qDebug("cancelled "); 1209 qDebug("cancelled ");
1210 return ; 1210 return ;
1211 } 1211 }
1212 } 1212 }
1213 QFont f = label->font(); 1213 QFont f = label->font();
1214 f.setPointSize ( f.pointSize() *2 ); 1214 f.setPointSize ( f.pointSize() *2 );
1215 f. setBold (true ); 1215 f. setBold (true );
1216 QLabel* label = new QLabel( warning, mSyncActionDialog ); 1216 QLabel* label = new QLabel( warning, mSyncActionDialog );
1217 label->setFont( f ); 1217 label->setFont( f );
1218 warning = i18n("ADJUST\nYOUR\nCLOCKS!"); 1218 warning = i18n("ADJUST\nYOUR\nCLOCKS!");
1219 label->setText( warning ); 1219 label->setText( warning );
1220 label->setAlignment ( Qt::AlignHCenter ); 1220 label->setAlignment ( Qt::AlignHCenter );
1221 lay->addWidget( label); 1221 lay->addWidget( label);
1222 mSyncActionDialog->setFixedSize( 230, 300); 1222 mSyncActionDialog->setFixedSize( 230, 300);
1223 } else { 1223 } else {
1224 mSyncActionDialog->setFixedSize( 230, 200); 1224 mSyncActionDialog->setFixedSize( 230, 200);
1225 } 1225 }
1226 } else { 1226 } else {
1227 mSyncActionDialog->setFixedSize( 230, 120); 1227 mSyncActionDialog->setFixedSize( 230, 120);
1228 } 1228 }
1229 } else 1229 } else
1230 mSyncActionDialog->setFixedSize( 230, 120); 1230 mSyncActionDialog->setFixedSize( 230, 120);
1231 mSyncActionDialog->show(); 1231 mSyncActionDialog->show();
1232 mSyncActionDialog->raise(); 1232 mSyncActionDialog->raise();
1233 emit request_file(); 1233 emit request_file();
1234 qApp->processEvents(); 1234 qApp->processEvents();
1235 QString fileName = mFileName; 1235 QString fileName = mFileName;
1236 QFile file( fileName ); 1236 QFile file( fileName );
1237 if (!file.open( IO_ReadOnly ) ) { 1237 if (!file.open( IO_ReadOnly ) ) {
1238 delete mSyncActionDialog; 1238 delete mSyncActionDialog;
1239 mSyncActionDialog = 0; 1239 mSyncActionDialog = 0;
1240 qDebug("KSS::error open file "); 1240 qDebug("KSS::error open sync file: %s ", fileName.latin1());
1241 mSocket->close(); 1241 mSocket->close();
1242 if ( mSocket->state() == QSocket::Idle ) 1242 if ( mSocket->state() == QSocket::Idle )
1243 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1243 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1244 return ; 1244 return ;
1245 1245
1246 } 1246 }
1247 mSyncActionDialog->setCaption( i18n("Sending file...") ); 1247 mSyncActionDialog->setCaption( i18n("Sending file...") );
1248 QTextStream ts( &file ); 1248 QTextStream ts( &file );
1249 ts.setEncoding( QTextStream::Latin1 ); 1249 ts.setEncoding( QTextStream::Latin1 );
1250 1250
1251 QTextStream os( mSocket ); 1251 QTextStream os( mSocket );
1252 os.setEncoding( QTextStream::Latin1 ); 1252 os.setEncoding( QTextStream::Latin1 );
1253 while ( ! ts.atEnd() ) { 1253 while ( ! ts.atEnd() ) {
1254 os << ts.readLine() << "\r\n"; 1254 os << ts.readLine() << "\r\n";
1255 } 1255 }
1256 //os << ts.read(); 1256 //os << ts.read();
1257 file.close(); 1257 file.close();
1258 mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); 1258 mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
1259 mSocket->close(); 1259 mSocket->close();
1260 if ( mSocket->state() == QSocket::Idle ) 1260 if ( mSocket->state() == QSocket::Idle )
1261 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1261 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1262} 1262}
1263void KServerSocket::get_file() 1263void KServerSocket::get_file()
1264{ 1264{
1265 mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); 1265 mSyncActionDialog->setCaption( i18n("Receiving synced file...") );
1266 1266
1267 piTime.start(); 1267 piTime.start();
1268 piFileString = ""; 1268 piFileString = "";
1269 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); 1269 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) ));
1270} 1270}
1271 1271
1272 1272
1273void KServerSocket::readBackFileFromSocket() 1273void KServerSocket::readBackFileFromSocket()
1274{ 1274{
1275 //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); 1275 //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
1276 while ( mSocket->canReadLine () ) { 1276 while ( mSocket->canReadLine () ) {
1277 piTime.restart(); 1277 piTime.restart();
1278 QString line = mSocket->readLine (); 1278 QString line = mSocket->readLine ();
1279 piFileString += line; 1279 piFileString += line;
1280 //qDebug("readline: %s ", line.latin1()); 1280 //qDebug("readline: %s ", line.latin1());
1281 mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); 1281 mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) );
1282 1282
1283 } 1283 }
1284 if ( piTime.elapsed () < 3000 ) { 1284 if ( piTime.elapsed () < 3000 ) {
1285 // wait for more 1285 // wait for more
1286 //qDebug("waitformore "); 1286 //qDebug("waitformore ");
1287 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); 1287 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) ));
1288 return; 1288 return;
1289 } 1289 }
1290 QString fileName = mFileName; 1290 QString fileName = mFileName;
1291 QFile file ( fileName ); 1291 QFile file ( fileName );
1292 if (!file.open( IO_WriteOnly ) ) { 1292 if (!file.open( IO_WriteOnly ) ) {
1293 delete mSyncActionDialog; 1293 delete mSyncActionDialog;
1294 mSyncActionDialog = 0; 1294 mSyncActionDialog = 0;
1295 qDebug("KSS:Error open read back file "); 1295 qDebug("KSS:Error open read back file ");
1296 piFileString = ""; 1296 piFileString = "";
1297 emit file_received( false ); 1297 emit file_received( false );
1298 blockRC = false; 1298 blockRC = false;
1299 return ; 1299 return ;
1300 1300
1301 } 1301 }
1302 1302
1303 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1303 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1304 QTextStream ts ( &file ); 1304 QTextStream ts ( &file );
1305 ts.setEncoding( QTextStream::Latin1 ); 1305 ts.setEncoding( QTextStream::Latin1 );
1306 mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); 1306 mSyncActionDialog->setCaption( i18n("Writing file to disk...") );
1307 ts << piFileString; 1307 ts << piFileString;
1308 mSocket->close(); 1308 mSocket->close();
1309 if ( mSocket->state() == QSocket::Idle ) 1309 if ( mSocket->state() == QSocket::Idle )
1310 QTimer::singleShot( 10, this , SLOT ( discardClient())); 1310 QTimer::singleShot( 10, this , SLOT ( discardClient()));
1311 file.close(); 1311 file.close();
1312 piFileString = ""; 1312 piFileString = "";
1313 emit file_received( true ); 1313 emit file_received( true );
1314 delete mSyncActionDialog; 1314 delete mSyncActionDialog;
1315 mSyncActionDialog = 0; 1315 mSyncActionDialog = 0;
1316 blockRC = false; 1316 blockRC = false;
1317 1317
1318} 1318}
1319 1319
1320KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) 1320KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name )
1321{ 1321{
1322 mPassWord = password; 1322 mPassWord = password;
1323 mSocket = 0; 1323 mSocket = 0;
1324 mPort = port; 1324 mPort = port;
1325 mHost = host; 1325 mHost = host;
1326 1326
1327 mRetVal = quiet; 1327 mRetVal = quiet;
1328 mTimerSocket = new QTimer ( this ); 1328 mTimerSocket = new QTimer ( this );
1329 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); 1329 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) );
1330} 1330}
1331void KCommandSocket::readFile( QString fn ) 1331void KCommandSocket::readFile( QString fn )
1332{ 1332{
1333 if ( !mSocket ) { 1333 if ( !mSocket ) {
1334 mSocket = new QSocket( this ); 1334 mSocket = new QSocket( this );
1335 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); 1335 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
1336 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1336 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );