summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/kaddressbook/germantranslation.txt20
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt22
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--libkdepim/ksyncmanager.cpp97
-rw-r--r--libkdepim/ksyncmanager.h6
5 files changed, 125 insertions, 22 deletions
diff --git a/bin/kdepim/kaddressbook/germantranslation.txt b/bin/kdepim/kaddressbook/germantranslation.txt
index f64bfda..4a5122f 100644
--- a/bin/kdepim/kaddressbook/germantranslation.txt
+++ b/bin/kdepim/kaddressbook/germantranslation.txt
@@ -777,17 +777,37 @@
777{ "Spouse","Ehegatte" }, 777{ "Spouse","Ehegatte" },
778{ "Notes","Notizen" }, 778{ "Notes","Notizen" },
779{ "Messanger","Messanger" }, 779{ "Messanger","Messanger" },
780{ "Assistant","Assistent" }, 780{ "Assistant","Assistent" },
781{ "Manager","Manager" }, 781{ "Manager","Manager" },
782{ "Secrecy","Sichtbar" }, 782{ "Secrecy","Sichtbar" },
783{ "male","männlich" }, 783{ "male","männlich" },
784{ "female","weiblich" }, 784{ "female","weiblich" },
785{ "Hide!","Verbergen!" }, 785{ "Hide!","Verbergen!" },
786{ "Show!","Anzeigen!" }, 786{ "Show!","Anzeigen!" },
787{ "Details","Details" }, 787{ "Details","Details" },
788{ "Search:","Suche:" }, 788{ "Search:","Suche:" },
789{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" },
790{ "Pi-Sync Port Error","Pi-Sync Port Fehler" },
791{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" },
792{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" },
793{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" },
794{ "Pi-Sync Error","Pi-Sync Fehler" },
795{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" },
796{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" },
797{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." },
798{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" },
799{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" },
800{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" },
801{ "Receiving file from remote...","Empfange entfernte Datei..." },
802{ "Sending back synced file...","Sende synchronisierte Datei zurück..." },
803{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" },
804{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" },
805{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." },
806{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" },
807{ "Writing back file ...","Schreibe Datei zurück..." },
808{ "Sending back file ...","Sende Datei zurück..." },
789{ "","" }, 809{ "","" },
790{ "","" }, 810{ "","" },
791{ "","" }, 811{ "","" },
792{ "","" }, 812{ "","" },
793{ "","" }, \ No newline at end of file 813{ "","" }, \ No newline at end of file
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 34e9b7f..ff5e095 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -948,25 +948,24 @@
948{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" }, 948{ "Addressbook file is used by KA/Pi","Adressbuch Datei wird von KA/Pi genutzt" },
949{ "ssh/scp","ssh/scp" }, 949{ "ssh/scp","ssh/scp" },
950{ "ftp","ftp" }, 950{ "ftp","ftp" },
951{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" }, 951{ "Password for remote access: (could be the same for each)","Passwort für entfernten Zugriff: (kann dasselbe sein für alle)" },
952{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" }, 952{ "Remote IP address: (could be the same for each)","Entfernte IP Adresse: (kann dasselbe sein für alle)" },
953{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" }, 953{ "Remote port number: (should be different for each)","Entfernte Port Nummer: (Sollte für alle unterschiedlich sein)" },
954{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" }, 954{ "command for downloading remote file to local device","Kommando zum Download der entfernten Datei zum lokalen Gerät" },
955{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" }, 955{ "command for uploading local temp file to remote device","Kommando zum Upload der lokalen temp. Datei zum entfernten Gerät" },
956{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" }, 956{ "Insert device where\nphone is connected. E.g.:\n","Füge Device ein, an dem\ndas Handy angeschlossen ist. Z.B.:\n" },
957{ "KDE-Pim sync config","KDE-Pim sync Konfig" }, 957{ "KDE-Pim sync config","KDE-Pim sync Konfig" },
958{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" }, 958{ "Insert kind of connection,e.g.:\n","Füge Art der Verbindung ein,z.B.:\n" },
959{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Model\nautomatisch erkannt\nwerden kann)\nOder füge Model Name ein:\n" }, 959{ "Recommended: Leave empty!\n(Such that model can\nbe auto detected)\nOr insert name of model:\n","Empfohlen: Leer lassen!\n(So dass das Model\nautomatisch erkannt\nwerden kann)\nOder füge Model Name ein:\n" },
960{ "Port number (Default: %1)","Port Nummer (Default: %1)" },
961{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" }, 960{ "Password to enable\naccess from remote:","Passwort um entfernten\nZugriff zuzulassen:" },
962{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" }, 961{ "Automatically start\nat application startup","Starte automatisch\nbeim Programmstart" },
963{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" }, 962{ "Automatically sync\nwith KDE-Desktop","Automatischer Sync\nmit dem KDE-Desktop" },
964{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" }, 963{ "Enter port for Pi-Sync","Port Nummer für Pi-Sync" },
965{ "Disable Pi-Sync","Schalte Pi-Sync aus" }, 964{ "Disable Pi-Sync","Schalte Pi-Sync aus" },
966{ "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen "Multi-Syncen"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" }, 965{ "Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!","Wollen Sie wirklich\nmit allen selektierten\nProfilen "Multi-Syncen"?\nDas Syncen dauert einige Zeit -\nalle Profile werden zweimal gesynct!" },
967{ "KDE-Pim Sync","KDE-Pim Sync" }, 966{ "KDE-Pim Sync","KDE-Pim Sync" },
968{ "Multiple profiles","Multi-Sync Profile" }, 967{ "Multiple profiles","Multi-Sync Profile" },
969{ "Device: ","Gerät: " }, 968{ "Device: ","Gerät: " },
970{ "Multiple sync started.","Multi-Sync gestartet." }, 969{ "Multiple sync started.","Multi-Sync gestartet." },
971{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" }, 970{ "Nothing synced! No profiles defined for multisync!","Nichts gesynct! Keine Profile\nselektiert für Multi-Sync" },
972{ "Turn filter on","Schalte Filter an" }, 971{ "Turn filter on","Schalte Filter an" },
@@ -1497,21 +1496,40 @@
1497{ "Show next conflict for","Zeige nächsten Konflikt für" }, 1496{ "Show next conflict for","Zeige nächsten Konflikt für" },
1498{ "All events","Alle Termine" }, 1497{ "All events","Alle Termine" },
1499{ "Allday events","Ganztagestermine" }, 1498{ "Allday events","Ganztagestermine" },
1500{ "Events with time","Termine mit Zeit" }, 1499{ "Events with time","Termine mit Zeit" },
1501{ "No conflict found","Kein Konflikt gefunden" }, 1500{ "No conflict found","Kein Konflikt gefunden" },
1502{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" }, 1501{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" },
1503{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, 1502{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " },
1504{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" }, 1503{ "Week view mode uses row layout","Wochenansicht Modus nutzt Reihenlayout" },
1505{ "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" }, 1504{ "The event\n%1\nconflicts with event\n%2\nat date\n%3.\n","Der Termin\n%1\nist im Konflikt mit Termin\n%2\nam Datum\n%3.\n" },
1506{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" }, 1505{ "KO/Pi Conflict delected","KO/Pi Konflikt erkannt" },
1507{ "Show date","Zeige Datum" }, 1506{ "Show date","Zeige Datum" },
1508{ "No problem!","Null Problemo!" }, 1507{ "No problem!","Null Problemo!" },
1509{ "","" }, 1508{ "Automatically sync with KDE-Desktop\nwhen receiving sync request","Synce automatisch mit KDE-Desktop\nwenn eine Sync-Anforderung kommt" },
1509{ "Pi-Sync Port Error","Pi-Sync Port Fehler" },
1510{ "<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?","<b>Anschalten von Pi-Sync fehlgeschlagen!</b> Fehler beim Ansprechen des Ports %1! Ist bereits eine andere Anwendung dabei diesen Port zu nutzen?" },
1511{ "No valid port number:\n%1","Keine gültige Port Nummer:\n%1" },
1512{ "Port number (Default: %1)\nValid range from 1 to 65535","Port Nummer (Standard: %1)\nGültiger Bereich von 1 bis 65535" },
1513{ "Pi-Sync Error","Pi-Sync Fehler" },
1514{ "Got send file request\nwith invalid password","Erhielt "sende Datei" Anfrage\nmit ungültigem Passwort" },
1515{ "Got receive file request\nwith invalid password","Erhielt "empfange Datei" Anfrage\nmit ungültigem Passwort" },
1516{ "Wrong password: Receiving remote file failed.","Falsches Passwort: Empfangen von entfernter Datei fehlgeschlagen." },
1517{ "Please close error dialog on remote.","Bitte schließe Fehler-Dialog am entfernten Rechner" },
1518{ "Unknown error on remote.","Unbekannter Fehler am entfernten Rechner" },
1519{ "Pi-Sync: Connected!","Pi-Sync: Verbunden!" },
1520{ "Receiving file from remote...","Empfange entfernte Datei..." },
1521{ "Sending back synced file...","Sende synchronisierte Datei zurück..." },
1522{ "Do you want to\nclear all sync info\nof all profiles?","Möchten Sie wirklich\ndie Sync-Info\nfür alle Profile\nlöschen?" },
1523{ "Do you want to\nclear the sync\ninfo of profile\n%1?\n","Möchten Sie wirklich\ndie Sync-Info für Profil\n%1?\nlöschen" },
1524{ "Sorry, no valid port.Syncing cancelled.","Sorry, kein gültiger Port. Syncing abgebrochen." },
1525{ "Remote port number:\n(May be: 1 - 65535)","Ferne Port Nummer:\n(Darf sein: 1 - 65535)" },
1526{ "Writing back file ...","Schreibe Datei zurück..." },
1527{ "Sending back file ...","Sende Datei zurück..." },
1510{ "","" }, 1528{ "","" },
1511{ "","" }, 1529{ "","" },
1512{ "","" }, 1530{ "","" },
1513{ "","" }, 1531{ "","" },
1514{ "","" }, 1532{ "","" },
1515{ "","" }, 1533{ "","" },
1516{ "","" }, 1534{ "","" },
1517{ "","" }, 1535{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 68d1bc6..940ea91 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -439,25 +439,25 @@ void CalendarView::init()
439 } else { 439 } else {
440 //mainBoxLayout = new QHBoxLayout(mainBox); 440 //mainBoxLayout = new QHBoxLayout(mainBox);
441 //leftFrameLayout = new QVBoxLayout(leftFrame ); 441 //leftFrameLayout = new QVBoxLayout(leftFrame );
442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
446 } 446 }
447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
448 //QBoxLayout * leftFrameLayout; 448 //QBoxLayout * leftFrameLayout;
449 topLayout->addWidget( mMainFrame ); 449 topLayout->addWidget( mMainFrame );
450#ifdef DESKTOP_VERSION 450#ifdef DESKTOP_VERSION
451 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); 451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this );
452 topLayout->addWidget( mDateScrollBar ); 452 topLayout->addWidget( mDateScrollBar );
453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
454 if ( QApplication::desktop()->width() < 800 ) 454 if ( QApplication::desktop()->width() < 800 )
455 mDateScrollBar->hide(); 455 mDateScrollBar->hide();
456#endif 456#endif
457 //mainBoxLayout->addWidget (mLeftFrame); 457 //mainBoxLayout->addWidget (mLeftFrame);
458 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 458 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
459 "CalendarView::DateNavigator" ); 459 "CalendarView::DateNavigator" );
460#if 0 460#if 0
461 // FIXME 461 // FIXME
462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
463 "CalendarView::DateNavigator", QDate::currentDate()); 463 "CalendarView::DateNavigator", QDate::currentDate());
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index fc0ac6b..f2ee0ab 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -344,25 +344,25 @@ void KSyncManager::slotSyncMenu( int action )
344void KSyncManager::enableQuick( bool ask ) 344void KSyncManager::enableQuick( bool ask )
345{ 345{
346 bool autoStart; 346 bool autoStart;
347 bool changed = false; 347 bool changed = false;
348 if ( ask ) { 348 if ( ask ) {
349 QDialog dia ( 0, "input-dialog", true ); 349 QDialog dia ( 0, "input-dialog", true );
350 QLineEdit lab ( &dia ); 350 QLineEdit lab ( &dia );
351 QVBoxLayout lay( &dia ); 351 QVBoxLayout lay( &dia );
352 lab.setText( mPrefs->mPassiveSyncPort ); 352 lab.setText( mPrefs->mPassiveSyncPort );
353 lay.setMargin(7); 353 lay.setMargin(7);
354 lay.setSpacing(7); 354 lay.setSpacing(7);
355 int po = 9197+mTargetApp; 355 int po = 9197+mTargetApp;
356 QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); 356 QLabel label ( i18n("Port number (Default: %1)\nValid range from 1 to 65535").arg(po), &dia );
357 lay.addWidget( &label); 357 lay.addWidget( &label);
358 lay.addWidget( &lab); 358 lay.addWidget( &lab);
359 359
360 QLineEdit lepw ( &dia ); 360 QLineEdit lepw ( &dia );
361 lepw.setText( mPrefs->mPassiveSyncPw ); 361 lepw.setText( mPrefs->mPassiveSyncPw );
362 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); 362 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
363 lay.addWidget( &label2); 363 lay.addWidget( &label2);
364 lay.addWidget( &lepw); 364 lay.addWidget( &lepw);
365 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); 365 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
366 lay.addWidget( &autostart); 366 lay.addWidget( &autostart);
367 autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); 367 autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
368#ifdef DESKTOP_VERSION 368#ifdef DESKTOP_VERSION
@@ -406,46 +406,51 @@ void KSyncManager::enableQuick( bool ask )
406 autoStart = autostart.isChecked(); 406 autoStart = autostart.isChecked();
407 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { 407 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) {
408 changed = true; 408 changed = true;
409 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); 409 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
410 } 410 }
411 } 411 }
412 else 412 else
413 autoStart = mPrefs->mPassiveSyncAutoStart; 413 autoStart = mPrefs->mPassiveSyncAutoStart;
414 if ( autoStart != mPrefs->mPassiveSyncAutoStart ) 414 if ( autoStart != mPrefs->mPassiveSyncAutoStart )
415 changed = true; 415 changed = true;
416 bool ok; 416 bool ok;
417 mPrefs->mPassiveSyncAutoStart = false; 417 mPrefs->mPassiveSyncAutoStart = false;
418 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); 418 Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok);
419 if ( ! ok ) { 419 qDebug("%d ", port_t);
420 KMessageBox::information( 0, i18n("No valid port")); 420 if ( ! ok || port_t > 65535 ) {
421 KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error"));
421 return; 422 return;
422 } 423 }
424 Q_UINT16 port = port_t;
423 //qDebug("port %d ", port); 425 //qDebug("port %d ", port);
424 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); 426 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
425 mServerSocket->setFileName( defaultFileName() );//bbb 427 mServerSocket->setFileName( defaultFileName() );//bbb
426 if ( !mServerSocket->ok() ) { 428 if ( !mServerSocket->ok() ) {
427 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); 429 QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) );
428 delete mServerSocket; 430 delete mServerSocket;
429 mServerSocket = 0; 431 mServerSocket = 0;
430 return; 432 return;
431 } 433 }
432 mPrefs->mPassiveSyncAutoStart = autoStart; 434 mPrefs->mPassiveSyncAutoStart = autoStart;
433 if ( changed ) { 435 if ( changed ) {
434 mPrefs->writeConfig(); 436 mPrefs->writeConfig();
435 } 437 }
436 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 438 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
437 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); 439 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
438} 440}
439 441void KSyncManager::displayErrorPort()
442{
443 KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error"));
444}
440void KSyncManager::syncLocalFile() 445void KSyncManager::syncLocalFile()
441{ 446{
442 447
443 QString fn =mPrefs->mLastSyncedLocalFile; 448 QString fn =mPrefs->mLastSyncedLocalFile;
444 QString ext; 449 QString ext;
445 450
446 switch(mTargetApp) 451 switch(mTargetApp)
447 { 452 {
448 case (KAPI): 453 case (KAPI):
449 ext = "(*.vcf)"; 454 ext = "(*.vcf)";
450 break; 455 break;
451 case (KOPI): 456 case (KOPI):
@@ -787,25 +792,25 @@ bool KSyncManager::edit_pisync_options()
787 dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); 792 dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice );
788 QVBoxLayout lay ( &dia ); 793 QVBoxLayout lay ( &dia );
789 lay.setSpacing( 5 ); 794 lay.setSpacing( 5 );
790 lay.setMargin( 3 ); 795 lay.setMargin( 3 );
791 QLabel lab1 ( i18n("Password for remote access:"), &dia); 796 QLabel lab1 ( i18n("Password for remote access:"), &dia);
792 lay.addWidget( &lab1 ); 797 lay.addWidget( &lab1 );
793 QLineEdit le1 (&dia ); 798 QLineEdit le1 (&dia );
794 lay.addWidget( &le1 ); 799 lay.addWidget( &le1 );
795 QLabel lab2 ( i18n("Remote IP address:"), &dia); 800 QLabel lab2 ( i18n("Remote IP address:"), &dia);
796 lay.addWidget( &lab2 ); 801 lay.addWidget( &lab2 );
797 QLineEdit le2 (&dia ); 802 QLineEdit le2 (&dia );
798 lay.addWidget( &le2 ); 803 lay.addWidget( &le2 );
799 QLabel lab3 ( i18n("Remote port number:"), &dia); 804 QLabel lab3 ( i18n("Remote port number:\n(May be: 1 - 65535)"), &dia);
800 lay.addWidget( &lab3 ); 805 lay.addWidget( &lab3 );
801 QLineEdit le3 (&dia ); 806 QLineEdit le3 (&dia );
802 lay.addWidget( &le3 ); 807 lay.addWidget( &le3 );
803 QPushButton pb ( "OK", &dia); 808 QPushButton pb ( "OK", &dia);
804 lay.addWidget( &pb ); 809 lay.addWidget( &pb );
805 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 810 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
806 le1.setText( mPassWordPiSync ); 811 le1.setText( mPassWordPiSync );
807 le2.setText( mActiveSyncIP ); 812 le2.setText( mActiveSyncIP );
808 le3.setText( mActiveSyncPort ); 813 le3.setText( mActiveSyncPort );
809 if ( dia.exec() ) { 814 if ( dia.exec() ) {
810 mPassWordPiSync = le1.text(); 815 mPassWordPiSync = le1.text();
811 mActiveSyncPort = le3.text(); 816 mActiveSyncPort = le3.text();
@@ -1179,26 +1184,28 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
1179 1184
1180void KSyncManager::readFileFromSocket() 1185void KSyncManager::readFileFromSocket()
1181{ 1186{
1182 QString fileName = syncFileName(); 1187 QString fileName = syncFileName();
1183 bool syncOK = true; 1188 bool syncOK = true;
1184 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); 1189 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
1185 if ( ! syncWithFile( fileName , true ) ) { 1190 if ( ! syncWithFile( fileName , true ) ) {
1186 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); 1191 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") );
1187 syncOK = false; 1192 syncOK = false;
1188 } 1193 }
1189 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); 1194 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() );
1190 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1195 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1191 if ( mWriteBackFile && syncOK ) 1196 if ( mWriteBackFile && syncOK ) {
1197 mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") );
1192 commandSocket->writeFile( fileName ); 1198 commandSocket->writeFile( fileName );
1199 }
1193 else { 1200 else {
1194 commandSocket->sendStop(); 1201 commandSocket->sendStop();
1195 if ( syncOK ) 1202 if ( syncOK )
1196 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 1203 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
1197 mPisyncFinished = true; 1204 mPisyncFinished = true;
1198 } 1205 }
1199} 1206}
1200 1207
1201KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) 1208KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
1202{ 1209{
1203 mPassWord = pw; 1210 mPassWord = pw;
1204 mSocket = 0; 1211 mSocket = 0;
@@ -1283,29 +1290,29 @@ void KServerSocket::readClient()
1283 end_connect(); 1290 end_connect();
1284 } 1291 }
1285 } 1292 }
1286 if ( tokens[0] == "STOP" ) { 1293 if ( tokens[0] == "STOP" ) {
1287 //emit endConnect(); 1294 //emit endConnect();
1288 end_connect(); 1295 end_connect();
1289 } 1296 }
1290 } 1297 }
1291} 1298}
1292void KServerSocket::displayErrorMessage() 1299void KServerSocket::displayErrorMessage()
1293{ 1300{
1294 if ( mErrorMessage == 1 ) { 1301 if ( mErrorMessage == 1 ) {
1295 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); 1302 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"), i18n("Pi-Sync Error"));
1296 mErrorMessage = 0; 1303 mErrorMessage = 0;
1297 } 1304 }
1298 else if ( mErrorMessage == 2 ) { 1305 else if ( mErrorMessage == 2 ) {
1299 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); 1306 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"), i18n("Pi-Sync Error"));
1300 mErrorMessage = 0; 1307 mErrorMessage = 0;
1301 } 1308 }
1302} 1309}
1303void KServerSocket::error_connect( QString errmess ) 1310void KServerSocket::error_connect( QString errmess )
1304{ 1311{
1305 QTextStream os( mSocket ); 1312 QTextStream os( mSocket );
1306 os.setEncoding( QTextStream::Latin1 ); 1313 os.setEncoding( QTextStream::Latin1 );
1307 os << errmess ; 1314 os << errmess ;
1308 mSocket->close(); 1315 mSocket->close();
1309 if ( mSocket->state() == QSocket::Idle ) { 1316 if ( mSocket->state() == QSocket::Idle ) {
1310 QTimer::singleShot( 0, this , SLOT ( discardClient())); 1317 QTimer::singleShot( 0, this , SLOT ( discardClient()));
1311 } 1318 }
@@ -1457,129 +1464,172 @@ void KServerSocket::readBackFileFromSocket()
1457 1464
1458KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) 1465KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name )
1459{ 1466{
1460 mPassWord = password; 1467 mPassWord = password;
1461 mSocket = 0; 1468 mSocket = 0;
1462 mFirst = false; 1469 mFirst = false;
1463 mFirstLine = true; 1470 mFirstLine = true;
1464 mPort = port; 1471 mPort = port;
1465 mHost = host; 1472 mHost = host;
1466 tlw = cap; 1473 tlw = cap;
1467 mRetVal = quiet; 1474 mRetVal = quiet;
1468 mTimerSocket = new QTimer ( this ); 1475 mTimerSocket = new QTimer ( this );
1469 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); 1476 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) );
1477 mConnectProgress.setCaption( i18n("Pi-Sync") );
1478 connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) );
1479 mConnectCount = -1;
1470} 1480}
1471void KCommandSocket::sendFileRequest() 1481void KCommandSocket::sendFileRequest()
1472{ 1482{
1473 if ( tlw ) 1483 if ( tlw )
1474 tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); 1484 tlw->setCaption( i18n("Connected! Sending request for remote file ...") );
1475 mTimerSocket->start( 300000 ); 1485 mConnectProgress.hide();
1486 mConnectCount = 300;mConnectMax = 300;
1487 mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") );
1488 mTimerSocket->start( 100, true );
1476 QTextStream os( mSocket ); 1489 QTextStream os( mSocket );
1477 os.setEncoding( QTextStream::Latin1 ); 1490 os.setEncoding( QTextStream::Latin1 );
1478 1491
1479 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); 1492 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
1480 os << "GET " << mPassWord << curDt <<"\r\n\r\n"; 1493 os << "GET " << mPassWord << curDt <<"\r\n\r\n";
1481} 1494}
1482 1495
1483void KCommandSocket::readFile( QString fn ) 1496void KCommandSocket::readFile( QString fn )
1484{ 1497{
1485 if ( !mSocket ) { 1498 if ( !mSocket ) {
1486 mSocket = new QSocket( this ); 1499 mSocket = new QSocket( this );
1487 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); 1500 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
1488 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1501 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1489 connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() )); 1502 connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() ));
1490 } 1503 }
1491 mFileString = ""; 1504 mFileString = "";
1492 mFileName = fn; 1505 mFileName = fn;
1493 mFirst = true; 1506 mFirst = true;
1494 if ( tlw ) 1507 if ( tlw )
1495 tlw->setCaption( i18n("Trying to connect to remote...") ); 1508 tlw->setCaption( i18n("Trying to connect to remote...") );
1496 mTimerSocket->start( 20000 ); 1509 mConnectCount = 30;mConnectMax = 30;
1510 mTimerSocket->start( 1000, true );
1497 mSocket->connectToHost( mHost, mPort ); 1511 mSocket->connectToHost( mHost, mPort );
1498 qDebug("KSS: Waiting for connection"); 1512 qDebug("KSS: Waiting for connection");
1499} 1513}
1500 1514void KCommandSocket::updateConnectDialog()
1515{
1516
1517 if ( mConnectCount == mConnectMax ) {
1518 //qDebug("MAXX %d", mConnectMax);
1519 mConnectProgress.setTotalSteps ( 30 );
1520 mConnectProgress.show();
1521 mConnectProgress.setLabelText( i18n("Trying to connect to remote...") );
1522 }
1523 //qDebug("updateConnectDialog() %d", mConnectCount);
1524 mConnectProgress.raise();
1525 mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 );
1526 --mConnectCount;
1527 if ( mConnectCount > 0 )
1528 mTimerSocket->start( 1000, true );
1529 else
1530 deleteSocket();
1531
1532}
1501void KCommandSocket::writeFile( QString fileName ) 1533void KCommandSocket::writeFile( QString fileName )
1502{ 1534{
1503 if ( !mSocket ) { 1535 if ( !mSocket ) {
1504 mSocket = new QSocket( this ); 1536 mSocket = new QSocket( this );
1505 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1537 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1506 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); 1538 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
1507 } 1539 }
1508 mFileName = fileName ; 1540 mFileName = fileName ;
1509 mTimerSocket->start( 20000 ); 1541 mConnectCount = 30;mConnectMax = 30;
1542 mTimerSocket->start( 1000, true );
1510 mSocket->connectToHost( mHost, mPort ); 1543 mSocket->connectToHost( mHost, mPort );
1511} 1544}
1512void KCommandSocket::writeFileToSocket() 1545void KCommandSocket::writeFileToSocket()
1513{ 1546{
1514 mTimerSocket->stop(); 1547 mTimerSocket->stop();
1515 QFile file2( mFileName ); 1548 QFile file2( mFileName );
1516 if (!file2.open( IO_ReadOnly ) ) { 1549 if (!file2.open( IO_ReadOnly ) ) {
1550 mConnectProgress.hide();
1551 mConnectCount = -1;
1517 mRetVal= errorW; 1552 mRetVal= errorW;
1518 mSocket->close(); 1553 mSocket->close();
1519 if ( mSocket->state() == QSocket::Idle ) 1554 if ( mSocket->state() == QSocket::Idle )
1520 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1555 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1521 return ; 1556 return ;
1522 } 1557 }
1558 mConnectProgress.setTotalSteps ( file2.size() );
1559 mConnectProgress.show();
1560 int count = 0;
1561 mConnectProgress.setLabelText( i18n("Sending back synced file...") );
1562 mConnectProgress.setProgress( count );
1563 mConnectProgress.blockSignals( true );
1523 QTextStream ts2( &file2 ); 1564 QTextStream ts2( &file2 );
1524 ts2.setEncoding( QTextStream::Latin1 ); 1565 ts2.setEncoding( QTextStream::Latin1 );
1525 QTextStream os2( mSocket ); 1566 QTextStream os2( mSocket );
1526 os2.setEncoding( QTextStream::Latin1 ); 1567 os2.setEncoding( QTextStream::Latin1 );
1527 os2 << "PUT " << mPassWord << "\r\n\r\n";; 1568 os2 << "PUT " << mPassWord << "\r\n\r\n";;
1528 while ( ! ts2.atEnd() ) { 1569 while ( ! ts2.atEnd() ) {
1529 os2 << ts2.readLine() << "\r\n"; 1570 qApp->processEvents();
1571 mConnectProgress.setProgress( count );
1572 QString temp = ts2.readLine();
1573 count += temp.length();
1574 os2 << temp << "\r\n";
1530 } 1575 }
1576 file2.close();
1577 mConnectProgress.hide();
1578 mConnectCount = -1;
1531 os2 << "\r\n"; 1579 os2 << "\r\n";
1532 mRetVal= successW; 1580 mRetVal= successW;
1533 file2.close();
1534 mSocket->close(); 1581 mSocket->close();
1535 if ( mSocket->state() == QSocket::Idle ) 1582 if ( mSocket->state() == QSocket::Idle )
1536 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1583 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1584 mConnectProgress.blockSignals( false );
1537} 1585}
1538void KCommandSocket::sendStop() 1586void KCommandSocket::sendStop()
1539{ 1587{
1540 if ( !mSocket ) { 1588 if ( !mSocket ) {
1541 mSocket = new QSocket( this ); 1589 mSocket = new QSocket( this );
1542 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1590 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1543 } 1591 }
1544 mSocket->connectToHost( mHost, mPort ); 1592 mSocket->connectToHost( mHost, mPort );
1545 QTextStream os2( mSocket ); 1593 QTextStream os2( mSocket );
1546 os2.setEncoding( QTextStream::Latin1 ); 1594 os2.setEncoding( QTextStream::Latin1 );
1547 os2 << "STOP\r\n\r\n"; 1595 os2 << "STOP\r\n\r\n";
1548 mSocket->close(); 1596 mSocket->close();
1549 if ( mSocket->state() == QSocket::Idle ) 1597 if ( mSocket->state() == QSocket::Idle )
1550 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1598 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1551} 1599}
1552 1600
1553void KCommandSocket::startReadFileFromSocket() 1601void KCommandSocket::startReadFileFromSocket()
1554{ 1602{
1555 if ( ! mFirst ) 1603 if ( ! mFirst )
1556 return; 1604 return;
1605 mConnectProgress.setLabelText( i18n("Receiving file from remote...") );
1557 mFirst = false; 1606 mFirst = false;
1558 mTimerSocket->stop();
1559 mFileString = ""; 1607 mFileString = "";
1560 mTime.start(); 1608 mTime.start();
1561 mFirstLine = true; 1609 mFirstLine = true;
1562 QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); 1610 QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) ));
1563 1611
1564} 1612}
1565void KCommandSocket::readFileFromSocket() 1613void KCommandSocket::readFileFromSocket()
1566{ 1614{
1567 //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); 1615 //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
1568 while ( mSocket->canReadLine () ) { 1616 while ( mSocket->canReadLine () ) {
1569 mTime.restart(); 1617 mTime.restart();
1570 QString line = mSocket->readLine (); 1618 QString line = mSocket->readLine ();
1571 if ( mFirstLine ) { 1619 if ( mFirstLine ) {
1572 mFirstLine = false; 1620 mFirstLine = false;
1573 if ( line.left( 6 ) == "ERROR_" ) { 1621 if ( line.left( 6 ) == "ERROR_" ) {
1622 mTimerSocket->stop();
1623 mConnectCount = -1;
1574 if ( line.left( 8 ) == "ERROR_PW" ) { 1624 if ( line.left( 8 ) == "ERROR_PW" ) {
1575 mRetVal = errorPW; 1625 mRetVal = errorPW;
1576 deleteSocket(); 1626 deleteSocket();
1577 return ; 1627 return ;
1578 } 1628 }
1579 if ( line.left( 8 ) == "ERROR_CA" ) { 1629 if ( line.left( 8 ) == "ERROR_CA" ) {
1580 mRetVal = errorCA; 1630 mRetVal = errorCA;
1581 deleteSocket(); 1631 deleteSocket();
1582 return ; 1632 return ;
1583 } 1633 }
1584 if ( line.left( 8 ) == "ERROR_FI" ) { 1634 if ( line.left( 8 ) == "ERROR_FI" ) {
1585 mRetVal = errorFI; 1635 mRetVal = errorFI;
@@ -1596,24 +1646,27 @@ void KCommandSocket::readFileFromSocket()
1596 return ; 1646 return ;
1597 } 1647 }
1598 } 1648 }
1599 mFileString += line; 1649 mFileString += line;
1600 //qDebug("readline: %s ", line.latin1()); 1650 //qDebug("readline: %s ", line.latin1());
1601 } 1651 }
1602 if ( mTime.elapsed () < 3000 ) { 1652 if ( mTime.elapsed () < 3000 ) {
1603 // wait for more 1653 // wait for more
1604 //qDebug("waitformore "); 1654 //qDebug("waitformore ");
1605 QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); 1655 QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) ));
1606 return; 1656 return;
1607 } 1657 }
1658 mTimerSocket->stop();
1659 mConnectCount = -1;
1660 mConnectProgress.hide();
1608 QString fileName = mFileName; 1661 QString fileName = mFileName;
1609 QFile file ( fileName ); 1662 QFile file ( fileName );
1610 if (!file.open( IO_WriteOnly ) ) { 1663 if (!file.open( IO_WriteOnly ) ) {
1611 mFileString = ""; 1664 mFileString = "";
1612 mRetVal = errorR; 1665 mRetVal = errorR;
1613 qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() ); 1666 qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() );
1614 deleteSocket(); 1667 deleteSocket();
1615 return ; 1668 return ;
1616 1669
1617 } 1670 }
1618 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 1671 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1619 QTextStream ts ( &file ); 1672 QTextStream ts ( &file );
@@ -1623,33 +1676,39 @@ void KCommandSocket::readFileFromSocket()
1623 mFileString = ""; 1676 mFileString = "";
1624 mRetVal = successR; 1677 mRetVal = successR;
1625 mSocket->close(); 1678 mSocket->close();
1626 // if state is not idle, deleteSocket(); is called via 1679 // if state is not idle, deleteSocket(); is called via
1627 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1680 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1628 if ( mSocket->state() == QSocket::Idle ) 1681 if ( mSocket->state() == QSocket::Idle )
1629 deleteSocket(); 1682 deleteSocket();
1630} 1683}
1631 1684
1632void KCommandSocket::deleteSocket() 1685void KCommandSocket::deleteSocket()
1633{ 1686{
1634 //qDebug("KCommandSocket::deleteSocket() "); 1687 //qDebug("KCommandSocket::deleteSocket() ");
1635 if ( mTimerSocket->isActive () ) { 1688 mConnectProgress.hide();
1689
1690 if ( mConnectCount >= 0 ) {
1636 mTimerSocket->stop(); 1691 mTimerSocket->stop();
1637 mRetVal = errorTO; 1692 mRetVal = errorTO;
1638 qDebug("KCS::Connection to remote host timed out"); 1693 qDebug("KCS::Connection to remote host timed out");
1639 if ( mSocket ) { 1694 if ( mSocket ) {
1640 mSocket->close(); 1695 mSocket->close();
1641 //if ( mSocket->state() == QSocket::Idle ) 1696 //if ( mSocket->state() == QSocket::Idle )
1642 // deleteSocket(); 1697 // deleteSocket();
1643 delete mSocket; 1698 delete mSocket;
1644 mSocket = 0; 1699 mSocket = 0;
1645 } 1700 }
1701 if ( mConnectCount == 0 )
1646 KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?")); 1702 KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?"));
1703 else if ( tlw )
1704 tlw->setCaption( i18n("Connection to remote host cancelled!") );
1647 emit commandFinished( this, mRetVal ); 1705 emit commandFinished( this, mRetVal );
1648 return; 1706 return;
1649 } 1707 }
1650 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); 1708 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
1651 if ( mSocket) 1709 if ( mSocket)
1652 delete mSocket; 1710 delete mSocket;
1653 mSocket = 0; 1711 mSocket = 0;
1712 qDebug("commandFinished ");
1654 emit commandFinished( this, mRetVal ); 1713 emit commandFinished( this, mRetVal );
1655} 1714}
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 30ec1e6..e6738b6 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -20,24 +20,25 @@
20 $Id$ 20 $Id$
21*/ 21*/
22#ifndef _KSYNCMANAGER_H 22#ifndef _KSYNCMANAGER_H
23#define _KSYNCMANAGER_H 23#define _KSYNCMANAGER_H
24 24
25#include <qobject.h> 25#include <qobject.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qsocket.h> 27#include <qsocket.h>
28#include <qdatetime.h> 28#include <qdatetime.h>
29#include <qserversocket.h> 29#include <qserversocket.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qprogressdialog.h>
32 33
33class QPopupMenu; 34class QPopupMenu;
34class KSyncProfile; 35class KSyncProfile;
35class KPimPrefs; 36class KPimPrefs;
36class QWidget; 37class QWidget;
37class KSyncManager; 38class KSyncManager;
38class KSyncInterface; 39class KSyncInterface;
39class QProgressBar; 40class QProgressBar;
40 41
41 42
42class KServerSocket : public QServerSocket 43class KServerSocket : public QServerSocket
43{ 44{
@@ -77,33 +78,37 @@ class KServerSocket : public QServerSocket
77class KCommandSocket : public QObject 78class KCommandSocket : public QObject
78{ 79{
79 Q_OBJECT 80 Q_OBJECT
80 public: 81 public:
81 enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; 82 enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet };
82 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); 83 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 );
83 void readFile( QString ); 84 void readFile( QString );
84 void writeFile( QString ); 85 void writeFile( QString );
85 void sendStop(); 86 void sendStop();
86 87
87 private slots : 88 private slots :
88 void sendFileRequest(); 89 void sendFileRequest();
90 void updateConnectDialog();
89 91
90 signals: 92 signals:
91 void commandFinished( KCommandSocket*, int ); 93 void commandFinished( KCommandSocket*, int );
92 private slots: 94 private slots:
93 void startReadFileFromSocket(); 95 void startReadFileFromSocket();
94 void readFileFromSocket(); 96 void readFileFromSocket();
95 void deleteSocket(); 97 void deleteSocket();
96 void writeFileToSocket(); 98 void writeFileToSocket();
97 private : 99 private :
100 int mConnectCount;
101 int mConnectMax;
102 QProgressDialog mConnectProgress;
98 QWidget* tlw; 103 QWidget* tlw;
99 QSocket* mSocket; 104 QSocket* mSocket;
100 QString mPassWord; 105 QString mPassWord;
101 Q_UINT16 mPort; 106 Q_UINT16 mPort;
102 QString mHost; 107 QString mHost;
103 QString mFileName; 108 QString mFileName;
104 QTimer* mTimerSocket; 109 QTimer* mTimerSocket;
105 int mRetVal; 110 int mRetVal;
106 QTime mTime; 111 QTime mTime;
107 QString mFileString; 112 QString mFileString;
108 bool mFirst; 113 bool mFirst;
109 bool mFirstLine; 114 bool mFirstLine;
@@ -196,24 +201,25 @@ class KSyncManager : public QObject
196 int ringSync(); 201 int ringSync();
197 QString getPassword( ); 202 QString getPassword( );
198 bool mPisyncFinished; 203 bool mPisyncFinished;
199 bool mBlockSaveFlag; 204 bool mBlockSaveFlag;
200 QWidget* mParent; 205 QWidget* mParent;
201 KSyncInterface* mImplementation; 206 KSyncInterface* mImplementation;
202 TargetApp mTargetApp; 207 TargetApp mTargetApp;
203 QPopupMenu* mSyncMenu; 208 QPopupMenu* mSyncMenu;
204 QProgressBar* bar; 209 QProgressBar* bar;
205 bool mSyncWithDesktop; 210 bool mSyncWithDesktop;
206 211
207private slots: 212private slots:
213 void displayErrorPort();
208 void confSync(); 214 void confSync();
209 215
210 216
211}; 217};
212 218
213 219
214class KSyncInterface 220class KSyncInterface
215{ 221{
216 public : 222 public :
217 virtual void removeSyncInfo( QString syncProfile) = 0; 223 virtual void removeSyncInfo( QString syncProfile) = 0;
218 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; 224 virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0;
219 virtual bool syncExternal(KSyncManager* manager, QString resource) 225 virtual bool syncExternal(KSyncManager* manager, QString resource)