summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp58
1 files changed, 46 insertions, 12 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index b3e266a..0faa24d 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -609,11 +609,41 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
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);
@@ -785,10 +815,11 @@ QString KSyncManager::syncFileName()
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 ) {
@@ -897,7 +928,7 @@ void KServerSocket::readClient()
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 }
@@ -908,7 +939,7 @@ void KServerSocket::readClient()
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 }
@@ -1155,22 +1186,25 @@ void KCommandSocket::readFileFromSocket()
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}