summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp13
-rw-r--r--libkdepim/ksyncmanager.h2
2 files changed, 9 insertions, 6 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 9177f63..c8d0e0d 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -27,106 +27,110 @@
27#ifndef _WIN32_ 27#ifndef _WIN32_
28#include <unistd.h> 28#include <unistd.h>
29#endif 29#endif
30 30
31 31
32#include "ksyncprofile.h" 32#include "ksyncprofile.h"
33#include "ksyncprefsdialog.h" 33#include "ksyncprefsdialog.h"
34#include "kpimprefs.h" 34#include "kpimprefs.h"
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qprogressbar.h> 38#include <qprogressbar.h>
39#include <qpopupmenu.h> 39#include <qpopupmenu.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qradiobutton.h> 41#include <qradiobutton.h>
42#include <qbuttongroup.h> 42#include <qbuttongroup.h>
43#include <qtimer.h> 43#include <qtimer.h>
44#include <qmessagebox.h> 44#include <qmessagebox.h>
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qtextcodec.h> 49#include <qtextcodec.h>
50#include <qlabel.h> 50#include <qlabel.h>
51#include <qcheckbox.h> 51#include <qcheckbox.h>
52 52
53#include <klocale.h> 53#include <klocale.h>
54#include <kglobal.h> 54#include <kglobal.h>
55#include <kconfig.h> 55#include <kconfig.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57 57
58QDateTime KSyncManager::mRequestedSyncEvent; 58QDateTime KSyncManager::mRequestedSyncEvent;
59 59
60 60
61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
62 : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) 62 : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu)
63{ 63{
64 mServerSocket = 0; 64 mServerSocket = 0;
65 bar = new QProgressBar ( 1, 0 ); 65 bar = new QProgressBar ( 1, 0 );
66 bar->setCaption (""); 66 bar->setCaption ("");
67 mWriteBackInPast = 2; 67 mWriteBackInPast = 2;
68 int w = 300; 68 int w = 300;
69 if ( QApplication::desktop()->width() < 320 ) 69 if ( QApplication::desktop()->width() < 320 )
70 w = 220; 70 w = 220;
71 int h = bar->sizeHint().height() ; 71 int h = bar->sizeHint().height() ;
72 int dw = QApplication::desktop()->width(); 72 int dw = QApplication::desktop()->width();
73 int dh = QApplication::desktop()->height(); 73 int dh = QApplication::desktop()->height();
74 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 74 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
75 if ( mPrefs->mPassiveSyncAutoStart )
76 enableQuick( false );
77 75
78} 76}
79 77
80KSyncManager::~KSyncManager() 78KSyncManager::~KSyncManager()
81{ 79{
82 delete bar; 80 delete bar;
83} 81}
84 82
83void KSyncManager::setDefaultFileName( QString s)
84{
85 mDefFileName = s ;
86 if ( mPrefs->mPassiveSyncAutoStart )
87 enableQuick( false );
88}
85 89
86void KSyncManager::fillSyncMenu() 90void KSyncManager::fillSyncMenu()
87{ 91{
88 if ( mSyncMenu->count() ) 92 if ( mSyncMenu->count() )
89 mSyncMenu->clear(); 93 mSyncMenu->clear();
90 94
91 mSyncMenu->insertItem( i18n("Configure..."), 0 ); 95 mSyncMenu->insertItem( i18n("Configure..."), 0 );
92 mSyncMenu->insertSeparator(); 96 mSyncMenu->insertSeparator();
93 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); 97 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
94 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); 98 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
95 clearMenu->insertItem( i18n("For all profiles"), 1 ); 99 clearMenu->insertItem( i18n("For all profiles"), 1 );
96 clearMenu->insertSeparator(); 100 clearMenu->insertSeparator();
97 connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); 101 connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) );
98 mSyncMenu->insertSeparator(); 102 mSyncMenu->insertSeparator();
99 if ( mServerSocket == 0 ) { 103 if ( mServerSocket == 0 ) {
100 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); 104 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
101 } else { 105 } else {
102 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 106 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
103 } 107 }
104 mSyncMenu->insertSeparator(); 108 mSyncMenu->insertSeparator();
105 mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); 109 mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
106 mSyncMenu->insertSeparator(); 110 mSyncMenu->insertSeparator();
107 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 111 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
108 config.setGroup("General"); 112 config.setGroup("General");
109 QStringList prof = config.readListEntry("SyncProfileNames"); 113 QStringList prof = config.readListEntry("SyncProfileNames");
110 mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 114 mLocalMachineName = config.readEntry("LocalMachineName","undefined");
111 if ( prof.count() < 2 ) { 115 if ( prof.count() < 2 ) {
112 prof.clear(); 116 prof.clear();
113 QString externalName; 117 QString externalName;
114#ifdef DESKTOP_VERSION 118#ifdef DESKTOP_VERSION
115#ifdef _WIN32_ 119#ifdef _WIN32_
116 externalName = "OutLook(not_implemented)"; 120 externalName = "OutLook(not_implemented)";
117#else 121#else
118 externalName = "KDE_Desktop"; 122 externalName = "KDE_Desktop";
119#endif 123#endif
120#else 124#else
121 externalName = "Sharp_DTM"; 125 externalName = "Sharp_DTM";
122#endif 126#endif
123 prof << externalName; 127 prof << externalName;
124 prof << i18n("Local_file"); 128 prof << i18n("Local_file");
125 prof << i18n("Last_file"); 129 prof << i18n("Last_file");
126 KSyncProfile* temp = new KSyncProfile (); 130 KSyncProfile* temp = new KSyncProfile ();
127 temp->setName( prof[0] ); 131 temp->setName( prof[0] );
128 temp->writeConfig(&config); 132 temp->writeConfig(&config);
129 temp->setName( prof[1] ); 133 temp->setName( prof[1] );
130 temp->writeConfig(&config); 134 temp->writeConfig(&config);
131 temp->setName( prof[2] ); 135 temp->setName( prof[2] );
132 temp->writeConfig(&config); 136 temp->writeConfig(&config);
@@ -367,97 +371,96 @@ void KSyncManager::enableQuick( bool ask )
367 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); 371 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
368 syncdesktop.hide(); 372 syncdesktop.hide();
369#endif 373#endif
370 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); 374 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop );
371 375
372 QPushButton pb ( "OK", &dia); 376 QPushButton pb ( "OK", &dia);
373 lay.addWidget( &pb ); 377 lay.addWidget( &pb );
374 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 378 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
375 dia.resize( 230,120 ); 379 dia.resize( 230,120 );
376 dia.setCaption( i18n("Enter port for Pi-Sync") ); 380 dia.setCaption( i18n("Enter port for Pi-Sync") );
377 dia.show(); 381 dia.show();
378#ifndef DESKTOP_VERSION 382#ifndef DESKTOP_VERSION
379 int dw = QApplication::desktop()->width(); 383 int dw = QApplication::desktop()->width();
380 int dh = QApplication::desktop()->height(); 384 int dh = QApplication::desktop()->height();
381 dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); 385 dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 );
382#endif 386#endif
383 if ( ! dia.exec() ) 387 if ( ! dia.exec() )
384 return; 388 return;
385 dia.hide(); 389 dia.hide();
386 qApp->processEvents(); 390 qApp->processEvents();
387 if ( mPrefs->mPassiveSyncPw != lepw.text() ) { 391 if ( mPrefs->mPassiveSyncPw != lepw.text() ) {
388 changed = true; 392 changed = true;
389 mPrefs->mPassiveSyncPw = lepw.text(); 393 mPrefs->mPassiveSyncPw = lepw.text();
390 } 394 }
391 if ( mPrefs->mPassiveSyncPort != lab.text() ) { 395 if ( mPrefs->mPassiveSyncPort != lab.text() ) {
392 mPrefs->mPassiveSyncPort = lab.text(); 396 mPrefs->mPassiveSyncPort = lab.text();
393 changed = true; 397 changed = true;
394 } 398 }
395 autoStart = autostart.isChecked(); 399 autoStart = autostart.isChecked();
396 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { 400 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) {
397 changed = true; 401 changed = true;
398 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); 402 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
399 } 403 }
400 } 404 }
401 else 405 else
402 autoStart = mPrefs->mPassiveSyncAutoStart; 406 autoStart = mPrefs->mPassiveSyncAutoStart;
403 if ( autoStart != mPrefs->mPassiveSyncAutoStart ) 407 if ( autoStart != mPrefs->mPassiveSyncAutoStart )
404 changed = true; 408 changed = true;
405 bool ok; 409 bool ok;
406 mPrefs->mPassiveSyncAutoStart = false; 410 mPrefs->mPassiveSyncAutoStart = false;
407 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); 411 Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok);
408 if ( ! ok ) { 412 if ( ! ok ) {
409 KMessageBox::information( 0, i18n("No valid port")); 413 KMessageBox::information( 0, i18n("No valid port"));
410 return; 414 return;
411 } 415 }
412 //qDebug("port %d ", port); 416 //qDebug("port %d ", port);
413 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); 417 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
414 mServerSocket->setFileName( defaultFileName() );//bbb 418 mServerSocket->setFileName( defaultFileName() );//bbb
415 //qDebug("connected ");
416 if ( !mServerSocket->ok() ) { 419 if ( !mServerSocket->ok() ) {
417 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); 420 KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!"));
418 delete mServerSocket; 421 delete mServerSocket;
419 mServerSocket = 0; 422 mServerSocket = 0;
420 return; 423 return;
421 } 424 }
422 mPrefs->mPassiveSyncAutoStart = autoStart; 425 mPrefs->mPassiveSyncAutoStart = autoStart;
423 if ( changed ) { 426 if ( changed ) {
424 mPrefs->writeConfig(); 427 mPrefs->writeConfig();
425 } 428 }
426 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 429 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
427 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); 430 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
428} 431}
429 432
430void KSyncManager::syncLocalFile() 433void KSyncManager::syncLocalFile()
431{ 434{
432 435
433 QString fn =mPrefs->mLastSyncedLocalFile; 436 QString fn =mPrefs->mLastSyncedLocalFile;
434 QString ext; 437 QString ext;
435 438
436 switch(mTargetApp) 439 switch(mTargetApp)
437 { 440 {
438 case (KAPI): 441 case (KAPI):
439 ext = "(*.vcf)"; 442 ext = "(*.vcf)";
440 break; 443 break;
441 case (KOPI): 444 case (KOPI):
442 ext = "(*.ics/*.vcs)"; 445 ext = "(*.ics/*.vcs)";
443 break; 446 break;
444 case (PWMPI): 447 case (PWMPI):
445 ext = "(*.pwm)"; 448 ext = "(*.pwm)";
446 break; 449 break;
447 default: 450 default:
448 qDebug("KSM::syncLocalFile: invalid apptype selected"); 451 qDebug("KSM::syncLocalFile: invalid apptype selected");
449 break; 452 break;
450 453
451 } 454 }
452 455
453 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); 456 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent );
454 if ( fn == "" ) 457 if ( fn == "" )
455 return; 458 return;
456 if ( syncWithFile( fn, false ) ) { 459 if ( syncWithFile( fn, false ) ) {
457 qDebug("KSM::syncLocalFile() successful "); 460 qDebug("KSM::syncLocalFile() successful ");
458 } 461 }
459 462
460} 463}
461 464
462bool KSyncManager::syncWithFile( QString fn , bool quick ) 465bool KSyncManager::syncWithFile( QString fn , bool quick )
463{ 466{
@@ -1072,97 +1075,97 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
1072 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); 1075 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget());
1073 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1076 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1074 commandSocket->sendStop(); 1077 commandSocket->sendStop();
1075 } 1078 }
1076 mPisyncFinished = true; 1079 mPisyncFinished = true;
1077 return; 1080 return;
1078 1081
1079 } else if ( state == KCommandSocket::errorW ) { 1082 } else if ( state == KCommandSocket::errorW ) {
1080 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); 1083 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") );
1081 mPisyncFinished = true; 1084 mPisyncFinished = true;
1082 1085
1083 } else if ( state == KCommandSocket::successR ) { 1086 } else if ( state == KCommandSocket::successR ) {
1084 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); 1087 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
1085 1088
1086 } else if ( state == KCommandSocket::successW ) { 1089 } else if ( state == KCommandSocket::successW ) {
1087 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 1090 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
1088 mPisyncFinished = true; 1091 mPisyncFinished = true;
1089 } 1092 }
1090 1093
1091 delete s; 1094 delete s;
1092} 1095}
1093 1096
1094void KSyncManager::readFileFromSocket() 1097void KSyncManager::readFileFromSocket()
1095{ 1098{
1096 QString fileName = syncFileName(); 1099 QString fileName = syncFileName();
1097 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); 1100 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
1098 if ( ! syncWithFile( fileName , true ) ) { 1101 if ( ! syncWithFile( fileName , true ) ) {
1099 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); 1102 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") );
1100 mPisyncFinished = true; 1103 mPisyncFinished = true;
1101 return; 1104 return;
1102 } 1105 }
1103 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); 1106 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() );
1104 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 1107 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
1105 if ( mWriteBackFile ) 1108 if ( mWriteBackFile )
1106 commandSocket->writeFile( fileName ); 1109 commandSocket->writeFile( fileName );
1107 else { 1110 else {
1108 commandSocket->sendStop(); 1111 commandSocket->sendStop();
1109 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 1112 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
1110 mPisyncFinished = true; 1113 mPisyncFinished = true;
1111 } 1114 }
1112} 1115}
1113 1116
1114KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) 1117KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
1115{ 1118{
1116 mPassWord = pw; 1119 mPassWord = pw;
1117 mSocket = 0; 1120 mSocket = 0;
1118 mSyncActionDialog = 0; 1121 mSyncActionDialog = 0;
1119 blockRC = false; 1122 blockRC = false;
1120}; 1123}
1121 1124
1122void KServerSocket::newConnection ( int socket ) 1125void KServerSocket::newConnection ( int socket )
1123{ 1126{
1124 // qDebug("KServerSocket:New connection %d ", socket); 1127 // qDebug("KServerSocket:New connection %d ", socket);
1125 if ( mSocket ) { 1128 if ( mSocket ) {
1126 qDebug("KSS::newConnection Socket deleted! "); 1129 qDebug("KSS::newConnection Socket deleted! ");
1127 delete mSocket; 1130 delete mSocket;
1128 mSocket = 0; 1131 mSocket = 0;
1129 } 1132 }
1130 mSocket = new QSocket( this ); 1133 mSocket = new QSocket( this );
1131 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); 1134 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
1132 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 1135 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
1133 mSocket->setSocket( socket ); 1136 mSocket->setSocket( socket );
1134} 1137}
1135 1138
1136void KServerSocket::discardClient() 1139void KServerSocket::discardClient()
1137{ 1140{
1138 //qDebug(" KServerSocket::discardClient()"); 1141 //qDebug(" KServerSocket::discardClient()");
1139 if ( mSocket ) { 1142 if ( mSocket ) {
1140 delete mSocket; 1143 delete mSocket;
1141 mSocket = 0; 1144 mSocket = 0;
1142 } 1145 }
1143 //emit endConnect(); 1146 //emit endConnect();
1144} 1147}
1145void KServerSocket::readClient() 1148void KServerSocket::readClient()
1146{ 1149{
1147 if ( blockRC ) 1150 if ( blockRC )
1148 return; 1151 return;
1149 if ( mSocket == 0 ) { 1152 if ( mSocket == 0 ) {
1150 qDebug("ERROR::KSS::readClient(): mSocket == 0 "); 1153 qDebug("ERROR::KSS::readClient(): mSocket == 0 ");
1151 return; 1154 return;
1152 } 1155 }
1153 //qDebug("KServerSocket::readClient()"); 1156 //qDebug("KServerSocket::readClient()");
1154 if ( mSocket->canReadLine() ) { 1157 if ( mSocket->canReadLine() ) {
1155 QString line = mSocket->readLine(); 1158 QString line = mSocket->readLine();
1156 //qDebug("KServerSocket readline: %s ", line.latin1()); 1159 //qDebug("KServerSocket readline: %s ", line.latin1());
1157 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); 1160 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
1158 if ( tokens[0] == "GET" ) { 1161 if ( tokens[0] == "GET" ) {
1159 if ( tokens[1] == mPassWord ) { 1162 if ( tokens[1] == mPassWord ) {
1160 //emit sendFile( mSocket ); 1163 //emit sendFile( mSocket );
1161 bool ok = false; 1164 bool ok = false;
1162 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); 1165 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok);
1163 if ( ok ) { 1166 if ( ok ) {
1164 KSyncManager::mRequestedSyncEvent = dt; 1167 KSyncManager::mRequestedSyncEvent = dt;
1165 } 1168 }
1166 else 1169 else
1167 KSyncManager::mRequestedSyncEvent = QDateTime(); 1170 KSyncManager::mRequestedSyncEvent = QDateTime();
1168 send_file(); 1171 send_file();
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 9a3066e..09bd1c1 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -76,97 +76,97 @@ class KCommandSocket : public QObject
76 public: 76 public:
77 enum state { successR, errorR, successW, errorW, errorTO, quiet }; 77 enum state { successR, errorR, successW, errorW, errorTO, quiet };
78 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); 78 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 );
79 void readFile( QString ); 79 void readFile( QString );
80 void writeFile( QString ); 80 void writeFile( QString );
81 void sendStop(); 81 void sendStop();
82 82
83 private slots : 83 private slots :
84 void sendFileRequest(); 84 void sendFileRequest();
85 85
86 signals: 86 signals:
87 void commandFinished( KCommandSocket*, int ); 87 void commandFinished( KCommandSocket*, int );
88 private slots: 88 private slots:
89 void startReadFileFromSocket(); 89 void startReadFileFromSocket();
90 void readFileFromSocket(); 90 void readFileFromSocket();
91 void deleteSocket(); 91 void deleteSocket();
92 void writeFileToSocket(); 92 void writeFileToSocket();
93 private : 93 private :
94 QWidget* tlw; 94 QWidget* tlw;
95 QSocket* mSocket; 95 QSocket* mSocket;
96 QString mPassWord; 96 QString mPassWord;
97 Q_UINT16 mPort; 97 Q_UINT16 mPort;
98 QString mHost; 98 QString mHost;
99 QString mFileName; 99 QString mFileName;
100 QTimer* mTimerSocket; 100 QTimer* mTimerSocket;
101 int mRetVal; 101 int mRetVal;
102 QTime mTime; 102 QTime mTime;
103 QString mFileString; 103 QString mFileString;
104 bool mFirst; 104 bool mFirst;
105}; 105};
106 106
107 107
108class KSyncManager : public QObject 108class KSyncManager : public QObject
109{ 109{
110 Q_OBJECT 110 Q_OBJECT
111 111
112 public: 112 public:
113 enum TargetApp { 113 enum TargetApp {
114 KOPI = 0, 114 KOPI = 0,
115 KAPI = 1, 115 KAPI = 1,
116 PWMPI = 2 }; 116 PWMPI = 2 };
117 117
118 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); 118 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
119 ~KSyncManager() ; 119 ~KSyncManager() ;
120 120
121 void multiSync( bool askforPrefs ); 121 void multiSync( bool askforPrefs );
122 bool blockSave() { return mBlockSaveFlag; } 122 bool blockSave() { return mBlockSaveFlag; }
123 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 123 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
124 void setDefaultFileName( QString s) { mDefFileName = s ;} 124 void setDefaultFileName( QString s) ;
125 QString defaultFileName() { return mDefFileName ;} 125 QString defaultFileName() { return mDefFileName ;}
126 QString syncFileName(); 126 QString syncFileName();
127 void enableQuick( bool ask = true); 127 void enableQuick( bool ask = true);
128 128
129 bool syncWithDesktop () { return mSyncWithDesktop;} 129 bool syncWithDesktop () { return mSyncWithDesktop;}
130 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 130 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
131 QString getCurrentSyncName() { return mCurrentSyncName; } 131 QString getCurrentSyncName() { return mCurrentSyncName; }
132 132
133 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 133 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
134 void hideProgressBar(); 134 void hideProgressBar();
135 bool isProgressBarCanceled(); 135 bool isProgressBarCanceled();
136 136
137 // sync stuff 137 // sync stuff
138 QString mLocalMachineName; 138 QString mLocalMachineName;
139 QStringList mExternSyncProfiles; 139 QStringList mExternSyncProfiles;
140 QStringList mSyncProfileNames; 140 QStringList mSyncProfileNames;
141 bool mAskForPreferences; 141 bool mAskForPreferences;
142 bool mShowSyncSummary; 142 bool mShowSyncSummary;
143 bool mIsKapiFile; 143 bool mIsKapiFile;
144 bool mWriteBackExistingOnly; 144 bool mWriteBackExistingOnly;
145 int mSyncAlgoPrefs; 145 int mSyncAlgoPrefs;
146 bool mWriteBackFile; 146 bool mWriteBackFile;
147 int mWriteBackInFuture; 147 int mWriteBackInFuture;
148 int mWriteBackInPast; 148 int mWriteBackInPast;
149 QString mPhoneDevice; 149 QString mPhoneDevice;
150 QString mPhoneConnection; 150 QString mPhoneConnection;
151 QString mPhoneModel; 151 QString mPhoneModel;
152 QString mPassWordPiSync; 152 QString mPassWordPiSync;
153 QString mActiveSyncPort; 153 QString mActiveSyncPort;
154 QString mActiveSyncIP ; 154 QString mActiveSyncIP ;
155 QString mFilterInCal; 155 QString mFilterInCal;
156 QString mFilterOutCal; 156 QString mFilterOutCal;
157 QString mFilterInAB; 157 QString mFilterInAB;
158 QString mFilterOutAB; 158 QString mFilterOutAB;
159 static QDateTime mRequestedSyncEvent; 159 static QDateTime mRequestedSyncEvent;
160 160
161 signals: 161 signals:
162 void save(); 162 void save();
163 void request_file(); 163 void request_file();
164 void getFile( bool ); 164 void getFile( bool );
165 165
166 public slots: 166 public slots:
167 void slotSyncMenu( int ); 167 void slotSyncMenu( int );
168 void slotClearMenu( int action ); 168 void slotClearMenu( int action );
169 void deleteCommandSocket(KCommandSocket*s, int state); 169 void deleteCommandSocket(KCommandSocket*s, int state);
170 void readFileFromSocket(); 170 void readFileFromSocket();
171 void fillSyncMenu(); 171 void fillSyncMenu();
172 172