summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/howtoSYNC.txt19
-rw-r--r--libkdepim/ksyncmanager.cpp58
-rw-r--r--libkdepim/ksyncmanager.h1
3 files changed, 64 insertions, 14 deletions
diff --git a/bin/kdepim/korganizer/howtoSYNC.txt b/bin/kdepim/korganizer/howtoSYNC.txt
index d3046de..c4e80f5 100644
--- a/bin/kdepim/korganizer/howtoSYNC.txt
+++ b/bin/kdepim/korganizer/howtoSYNC.txt
@@ -102,33 +102,38 @@ YOU MAY NOT DELETE OR CHANGE THESE EVENTS.
102 102
103************************************************************************* 103*************************************************************************
1042) Sync settings in sync dialog 1042) Sync settings in sync dialog
105************************************************************************* 105*************************************************************************
106 106
107a) Local device name: 107a) Local device name:
108 -> 1) b) 108 -> 1) b)
109b) Profile: 109b) Profile:
110 -> 1) c) 110 -> 1) c)
111c) Include in multiple sync: 111c) Include in multiple sync:
112 In the Synchronize menu, there is a multiple sync menu entry. 112 In the Synchronize menu, there is a multiple sync menu entry.
113 If you choose this menu entry, all user defined profiles with this 113 If you choose this menu entry, all user defined profiles with this
114 'Include in multiple sync' option enabled will be synced 114 'Include in multiple sync' option enabled will be synced
115 one after another. And this twice. This will take some time. 115 one after another. And this twice. This will take some time.
116 After that sync, on all devices should be the same data. 116 After that sync, on all devices should be the same data.
117d) Ask for preferences before sync: 117d) Ask for preferences before sync:
118 Check this to be asked for sync settings before each sync. 118 Check this to be asked for sync preferences settings before each sync.
119 If the profile kind is "Pi-Sync" you will be asked to confirm
120 the "Pi-Sync" specific settings (Password,IP address, port number)
121 as well. That makes it possible to use that profile for a
122 device that is connected via DHCP to the network and gets different
123 IP addresses when connection to the network.
119e) Sync preferences: 124e) Sync preferences:
120 Choose here your sync preferences. 125 Choose here your sync preferences.
121 Details -> 4) 126 Details -> 4)
122f) Show summary after sync: 127f) Show summary after sync:
123 Check this to get a small summary dialog after sync 128 Check this to get a small summary dialog after sync
124 about number of added/changed/deleted events on local/remote. 129 about number of added/changed/deleted events on local/remote.
125g) Write back synced data: 130g) Write back synced data:
126 Uncheck this to update the local calendar only. 131 Uncheck this to update the local calendar only.
127 I.e. your local calendar is synced with the remote calendar 132 I.e. your local calendar is synced with the remote calendar
128 but nothing on the remote calendar is changed. 133 but nothing on the remote calendar is changed.
129 If you uncheck "Write back synced data", the settings 134 If you uncheck "Write back synced data", the settings
130 under h) and i) are ignored, of course. 135 under h) and i) are ignored, of course.
131h) --Write back (on remote) existing entries only: 136h) --Write back (on remote) existing entries only:
132 Check this to update the remote data only. 137 Check this to update the remote data only.
133 I.e. no data from yor local calendar/addressbook is added to the 138 I.e. no data from yor local calendar/addressbook is added to the
134 remote device. You may use this option to 139 remote device. You may use this option to
@@ -253,33 +258,43 @@ b) Pi-Sync (direct Kx/Pi to Kx/Pi sync)
253 file sending requests. Valid port numbers are numbers 258 file sending requests. Valid port numbers are numbers
254 between 1 and 65565. Do not specify port numbers, that are 259 between 1 and 65565. Do not specify port numbers, that are
255 used by other applications. A port number between 9000 and 9999 260 used by other applications. A port number between 9000 and 9999
256 is most likely not used by another application. 261 is most likely not used by another application.
257 The default port number is 9197 for KO/Pi. 262 The default port number is 9197 for KO/Pi.
258 If you specify a port number, which is already in use, 263 If you specify a port number, which is already in use,
259 you will get an error message when closing this dialog. 264 you will get an error message when closing this dialog.
260 - Choose a password. 265 - Choose a password.
261 - Click OK. 266 - Click OK.
262 Now KO/Pi will send the calendar data via the network, 267 Now KO/Pi will send the calendar data via the network,
263 if some other device is sending a "please send calendar" 268 if some other device is sending a "please send calendar"
264 request on the given port using the given password. 269 request on the given port using the given password.
265 If you want to be sure, nobody can access your calendar 270 If you want to be sure, nobody can access your calendar
266 data, simply disable the file transfer feature on the 271 data, simply disable the file transfer feature on the
267 remote device after the syncing is done by choosing: 272 remote device after the syncing is done by choosing:
268 Menu Synchronize-Disable Pi-Sync. 273 Menu Synchronize-Disable Pi-Sync.
269 274
275 Note: If you want to sync with a remote device that gets different
276 IPaddresses each time connected to the network
277 (this may be the case, if you use DHCP for connection
278 of the remote device to the network) simply enable
279 "Ask for preferences before sync".
280 Then you will be asked to confirm the
281 "Pi-Sync" specific settings
282 (Password,IP address, port number)
283 and you can easily change the IP address before each sync.
284
270 On your local device, create a new profile and choose 285 On your local device, create a new profile and choose
271 profile kind "Pi-Sync". 286 profile kind "Pi-Sync".
272 Fill in the needed values: 287 Fill in the needed values:
273 - Password for remote access: 288 - Password for remote access:
274 The password you specified on the remote device. 289 The password you specified on the remote device.
275 - Remote IP address: 290 - Remote IP address:
276 The IP address of the remote device. 291 The IP address of the remote device.
277 - Remote port number: 292 - Remote port number:
278 The port number you specified on the remote device. 293 The port number you specified on the remote device.
279 294
280 Now you can syncronize your local device easily with your 295 Now you can syncronize your local device easily with your
281 remote device. This works well for all platforms KO/Pi is 296 remote device. This works well for all platforms KO/Pi is
282 running on, e.g. syncing a KO/Pi on Zaurus with KO/Pi on Windows 297 running on, e.g. syncing a KO/Pi on Zaurus with KO/Pi on Windows
283 is now very easy. 298 is now very easy.
284 299
285c) Remote file 300c) Remote file
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index b3e266a..0faa24d 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -596,37 +596,67 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
596 postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); 596 postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 );
597 597
598 } 598 }
599 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); 599 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) );
600 result = system ( postCommand ); 600 result = system ( postCommand );
601 qDebug("Writing back file result: %d ", result); 601 qDebug("Writing back file result: %d ", result);
602 if ( result != 0 ) { 602 if ( result != 0 ) {
603 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 603 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
604 return; 604 return;
605 } else { 605 } else {
606 mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); 606 mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) );
607 } 607 }
608 } 608 }
609 } 609 }
610 return; 610 return;
611} 611}
612 612void KSyncManager::edit_pisync_options()
613{
614 QDialog dia( mParent, "dia", true );
615 dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice );
616 QVBoxLayout lay ( &dia );
617 lay.setSpacing( 5 );
618 lay.setMargin( 3 );
619 QLabel lab1 ( i18n("Password for remote access:"), &dia);
620 lay.addWidget( &lab1 );
621 QLineEdit le1 (&dia );
622 lay.addWidget( &le1 );
623 QLabel lab2 ( i18n("Remote IP address:"), &dia);
624 lay.addWidget( &lab2 );
625 QLineEdit le2 (&dia );
626 lay.addWidget( &le2 );
627 QLabel lab3 ( i18n("Remote port number:"), &dia);
628 lay.addWidget( &lab3 );
629 QLineEdit le3 (&dia );
630 lay.addWidget( &le3 );
631 QPushButton pb ( "OK", &dia);
632 lay.addWidget( &pb );
633 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
634 le1.setText( mPassWordPiSync );
635 le2.setText( mActiveSyncIP );
636 le3.setText( mActiveSyncPort );
637 if ( dia.exec() ) {
638 mPassWordPiSync = le1.text();
639 mActiveSyncPort = le3.text();
640 mActiveSyncIP = le2.text();
641 }
642
643}
613void KSyncManager::edit_sync_options() 644void KSyncManager::edit_sync_options()
614{ 645{
615 //mDialogManager->showSyncOptions(); 646
616 //mSyncAlgoPrefs
617 QDialog dia( mParent, "dia", true ); 647 QDialog dia( mParent, "dia", true );
618 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); 648 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
619 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); 649 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
620 QVBoxLayout lay ( &dia ); 650 QVBoxLayout lay ( &dia );
621 lay.setSpacing( 2 ); 651 lay.setSpacing( 2 );
622 lay.setMargin( 3 ); 652 lay.setMargin( 3 );
623 lay.addWidget(&gr); 653 lay.addWidget(&gr);
624 QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); 654 QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
625 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); 655 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
626 QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); 656 QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
627 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); 657 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
628 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); 658 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
629 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); 659 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
630 //QRadioButton both( i18n("Take both on conflict"), &gr ); 660 //QRadioButton both( i18n("Take both on conflict"), &gr );
631 QPushButton pb ( "OK", &dia); 661 QPushButton pb ( "OK", &dia);
632 lay.addWidget( &pb ); 662 lay.addWidget( &pb );
@@ -772,36 +802,37 @@ QString KSyncManager::syncFileName()
772 case (KOPI): 802 case (KOPI):
773 fn = "tempsynccal.ics"; 803 fn = "tempsynccal.ics";
774 break; 804 break;
775 case (PWMPI): 805 case (PWMPI):
776 fn = "tempsyncpw.pwm"; 806 fn = "tempsyncpw.pwm";
777 break; 807 break;
778 default: 808 default:
779 break; 809 break;
780 } 810 }
781#ifdef _WIN32_ 811#ifdef _WIN32_
782 return locateLocal( "tmp", fn ); 812 return locateLocal( "tmp", fn );
783#else 813#else
784 return (QString( "/tmp/" )+ fn ); 814 return (QString( "/tmp/" )+ fn );
785#endif 815#endif
786} 816}
787 817
788
789void KSyncManager::syncPi() 818void KSyncManager::syncPi()
790{ 819{
791 qApp->processEvents(); 820 qApp->processEvents();
821 if ( mAskForPreferences )
822 edit_pisync_options();
792 bool ok; 823 bool ok;
793 Q_UINT16 port = mActiveSyncPort.toUInt(&ok); 824 Q_UINT16 port = mActiveSyncPort.toUInt(&ok);
794 if ( ! ok ) { 825 if ( ! ok ) {
795 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); 826 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
796 return; 827 return;
797 } 828 }
798 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); 829 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this );
799 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 830 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
800 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); 831 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") );
801 commandSocket->readFile( syncFileName() ); 832 commandSocket->readFile( syncFileName() );
802} 833}
803 834
804void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) 835void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
805{ 836{
806 qDebug("MainWindow::deleteCommandSocket %d", state); 837 qDebug("MainWindow::deleteCommandSocket %d", state);
807 838
@@ -884,44 +915,44 @@ void KServerSocket::readClient()
884 if ( blockRC ) 915 if ( blockRC )
885 return; 916 return;
886 if ( mSocket == 0 ) { 917 if ( mSocket == 0 ) {
887 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); 918 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 ");
888 return; 919 return;
889 } 920 }
890 qDebug("KServerSocket readClient()"); 921 qDebug("KServerSocket readClient()");
891 if ( mSocket->canReadLine() ) { 922 if ( mSocket->canReadLine() ) {
892 QString line = mSocket->readLine(); 923 QString line = mSocket->readLine();
893 qDebug("KServerSocket readline: %s ", line.latin1()); 924 qDebug("KServerSocket readline: %s ", line.latin1());
894 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); 925 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
895 if ( tokens[0] == "GET" ) { 926 if ( tokens[0] == "GET" ) {
896 if ( tokens[1] == mPassWord ) 927 if ( tokens[1] == mPassWord )
897 //emit sendFile( mSocket ); 928 //emit sendFile( mSocket );
898 send_file(); 929 send_file();
899 else { 930 else {
900 KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); 931 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"));
901 qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 932 qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
902 } 933 }
903 } 934 }
904 if ( tokens[0] == "PUT" ) { 935 if ( tokens[0] == "PUT" ) {
905 if ( tokens[1] == mPassWord ) { 936 if ( tokens[1] == mPassWord ) {
906 //emit getFile( mSocket ); 937 //emit getFile( mSocket );
907 blockRC = true; 938 blockRC = true;
908 get_file(); 939 get_file();
909 } 940 }
910 else { 941 else {
911 KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); 942 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"));
912 qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 943 qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
913 } 944 }
914 } 945 }
915 if ( tokens[0] == "STOP" ) { 946 if ( tokens[0] == "STOP" ) {
916 //emit endConnect(); 947 //emit endConnect();
917 end_connect(); 948 end_connect();
918 } 949 }
919 } 950 }
920} 951}
921void KServerSocket::end_connect() 952void KServerSocket::end_connect()
922{ 953{
923 delete mSyncActionDialog; 954 delete mSyncActionDialog;
924 mSyncActionDialog = 0; 955 mSyncActionDialog = 0;
925} 956}
926void KServerSocket::send_file() 957void KServerSocket::send_file()
927{ 958{
@@ -1142,35 +1173,38 @@ void KCommandSocket::readFileFromSocket()
1142 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1173 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1143 QTextStream ts ( &file ); 1174 QTextStream ts ( &file );
1144 ts.setEncoding( QTextStream::Latin1 ); 1175 ts.setEncoding( QTextStream::Latin1 );
1145 ts << mFileString; 1176 ts << mFileString;
1146 file.close(); 1177 file.close();
1147 mFileString = ""; 1178 mFileString = "";
1148 mRetVal = successR; 1179 mRetVal = successR;
1149 mSocket->close(); 1180 mSocket->close();
1150 // if state is not idle, deleteSocket(); is called via 1181 // if state is not idle, deleteSocket(); is called via
1151 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1182 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1152 if ( mSocket->state() == QSocket::Idle ) 1183 if ( mSocket->state() == QSocket::Idle )
1153 deleteSocket(); 1184 deleteSocket();
1154} 1185}
1155 1186
1156void KCommandSocket::deleteSocket() 1187void KCommandSocket::deleteSocket()
1157{ 1188{
1189 //qDebug("KCommandSocket::deleteSocket() ");
1158 if ( mTimerSocket->isActive () ) { 1190 if ( mTimerSocket->isActive () ) {
1159 mTimerSocket->stop(); 1191 mTimerSocket->stop();
1160 mRetVal = errorTO; 1192 mRetVal = errorTO;
1193 qDebug("Connection to remote host timed out");
1161 if ( mSocket ) { 1194 if ( mSocket ) {
1162 mSocket->close(); 1195 mSocket->close();
1163 if ( mSocket->state() == QSocket::Idle ) 1196 //if ( mSocket->state() == QSocket::Idle )
1164 deleteSocket(); 1197 // deleteSocket();
1165 return; 1198 delete mSocket;
1199 mSocket = 0;
1166 } 1200 }
1201 KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? "));
1202 emit commandFinished( this, mRetVal );
1203 return;
1167 } 1204 }
1168 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); 1205 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
1169 if ( mSocket) 1206 if ( mSocket)
1170 delete mSocket; 1207 delete mSocket;
1171 mSocket = 0; 1208 mSocket = 0;
1172 if ( mRetVal == errorTO)
1173 KMessageBox::information( 0, i18n("ERROR:\nConnection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? "));
1174
1175 emit commandFinished( this, mRetVal ); 1209 emit commandFinished( this, mRetVal );
1176} 1210}
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 1f7c7e7..5b05383 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -160,32 +160,33 @@ class KSyncManager : public QObject
160 void syncPi(); 160 void syncPi();
161 KServerSocket * mServerSocket; 161 KServerSocket * mServerSocket;
162 void enableQuick(); 162 void enableQuick();
163 KPimPrefs* mPrefs; 163 KPimPrefs* mPrefs;
164 QString mDefFileName; 164 QString mDefFileName;
165 QString mCurrentSyncDevice; 165 QString mCurrentSyncDevice;
166 QString mCurrentSyncName; 166 QString mCurrentSyncName;
167 void quickSyncLocalFile(); 167 void quickSyncLocalFile();
168 bool syncWithFile( QString fn , bool quick ); 168 bool syncWithFile( QString fn , bool quick );
169 void syncLocalFile(); 169 void syncLocalFile();
170 void syncPhone(); 170 void syncPhone();
171 void syncSharp(); 171 void syncSharp();
172 bool syncExternalApplication(QString); 172 bool syncExternalApplication(QString);
173 int mCurrentSyncProfile ; 173 int mCurrentSyncProfile ;
174 void syncRemote( KSyncProfile* prof, bool ask = true); 174 void syncRemote( KSyncProfile* prof, bool ask = true);
175 void edit_sync_options(); 175 void edit_sync_options();
176 void edit_pisync_options();
176 int ringSync(); 177 int ringSync();
177 QString getPassword( ); 178 QString getPassword( );
178 179
179 private slots: 180 private slots:
180 void confSync(); 181 void confSync();
181 private: 182 private:
182 bool mBlockSaveFlag; 183 bool mBlockSaveFlag;
183 QWidget* mParent; 184 QWidget* mParent;
184 KSyncInterface* mImplementation; 185 KSyncInterface* mImplementation;
185 TargetApp mTargetApp; 186 TargetApp mTargetApp;
186 QPopupMenu* mSyncMenu; 187 QPopupMenu* mSyncMenu;
187 QProgressBar* bar; 188 QProgressBar* bar;
188 189
189}; 190};
190 191
191 192