summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp16
-rw-r--r--libkdepim/ksyncmanager.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index feb184b..e09050e 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -46,24 +46,27 @@
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;
59
60
58KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
59 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) 62 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu)
60{ 63{
61 mServerSocket = 0; 64 mServerSocket = 0;
62 bar = new QProgressBar ( 1, 0 ); 65 bar = new QProgressBar ( 1, 0 );
63 bar->setCaption (""); 66 bar->setCaption ("");
64 67
65 int w = 300; 68 int w = 300;
66 if ( QApplication::desktop()->width() < 320 ) 69 if ( QApplication::desktop()->width() < 320 )
67 w = 220; 70 w = 220;
68 int h = bar->sizeHint().height() ; 71 int h = bar->sizeHint().height() ;
69 int dw = QApplication::desktop()->width(); 72 int dw = QApplication::desktop()->width();
@@ -1102,27 +1105,34 @@ void KServerSocket::readClient()
1102 if ( blockRC ) 1105 if ( blockRC )
1103 return; 1106 return;
1104 if ( mSocket == 0 ) { 1107 if ( mSocket == 0 ) {
1105 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); 1108 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 ");
1106 return; 1109 return;
1107 } 1110 }
1108 //qDebug("KServerSocket::readClient()"); 1111 //qDebug("KServerSocket::readClient()");
1109 if ( mSocket->canReadLine() ) { 1112 if ( mSocket->canReadLine() ) {
1110 QString line = mSocket->readLine(); 1113 QString line = mSocket->readLine();
1111 //qDebug("KServerSocket readline: %s ", line.latin1()); 1114 //qDebug("KServerSocket readline: %s ", line.latin1());
1112 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); 1115 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
1113 if ( tokens[0] == "GET" ) { 1116 if ( tokens[0] == "GET" ) {
1114 if ( tokens[1] == mPassWord ) 1117 if ( tokens[1] == mPassWord ) {
1115 //emit sendFile( mSocket ); 1118 //emit sendFile( mSocket );
1119 bool ok = false;
1120 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok);
1121 if ( ok )
1122 KSyncManager::mRequestedSyncEvent = dt;
1123 else
1124 KSyncManager::mRequestedSyncEvent = QDateTime();
1116 send_file(); 1125 send_file();
1126 }
1117 else { 1127 else {
1118 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); 1128 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"));
1119 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1129 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1120 } 1130 }
1121 } 1131 }
1122 if ( tokens[0] == "PUT" ) { 1132 if ( tokens[0] == "PUT" ) {
1123 if ( tokens[1] == mPassWord ) { 1133 if ( tokens[1] == mPassWord ) {
1124 //emit getFile( mSocket ); 1134 //emit getFile( mSocket );
1125 blockRC = true; 1135 blockRC = true;
1126 get_file(); 1136 get_file();
1127 } 1137 }
1128 else { 1138 else {
@@ -1258,25 +1268,27 @@ void KCommandSocket::readFile( QString fn )
1258{ 1268{
1259 if ( !mSocket ) { 1269 if ( !mSocket ) {
1260 mSocket = new QSocket( this ); 1270 mSocket = new QSocket( this );
1261 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); 1271 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
1262 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1272 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1263 } 1273 }
1264 mFileString = ""; 1274 mFileString = "";
1265 mFileName = fn; 1275 mFileName = fn;
1266 mFirst = true; 1276 mFirst = true;
1267 mSocket->connectToHost( mHost, mPort ); 1277 mSocket->connectToHost( mHost, mPort );
1268 QTextStream os( mSocket ); 1278 QTextStream os( mSocket );
1269 os.setEncoding( QTextStream::Latin1 ); 1279 os.setEncoding( QTextStream::Latin1 );
1270 os << "GET " << mPassWord << "\r\n"; 1280
1281 QString curDt = KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
1282 os << "GET " << mPassWord << curDt <<"\r\n";
1271 mTimerSocket->start( 20000 ); 1283 mTimerSocket->start( 20000 );
1272} 1284}
1273 1285
1274void KCommandSocket::writeFile( QString fileName ) 1286void KCommandSocket::writeFile( QString fileName )
1275{ 1287{
1276 if ( !mSocket ) { 1288 if ( !mSocket ) {
1277 mSocket = new QSocket( this ); 1289 mSocket = new QSocket( this );
1278 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1290 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1279 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); 1291 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
1280 } 1292 }
1281 mFileName = fileName ; 1293 mFileName = fileName ;
1282 mSocket->connectToHost( mHost, mPort ); 1294 mSocket->connectToHost( mHost, mPort );
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index aa32e28..2af891b 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -137,24 +137,25 @@ class KSyncManager : public QObject
137 bool mShowSyncSummary; 137 bool mShowSyncSummary;
138 bool mIsKapiFile; 138 bool mIsKapiFile;
139 bool mWriteBackExistingOnly; 139 bool mWriteBackExistingOnly;
140 int mSyncAlgoPrefs; 140 int mSyncAlgoPrefs;
141 bool mWriteBackFile; 141 bool mWriteBackFile;
142 int mWriteBackInFuture; 142 int mWriteBackInFuture;
143 QString mPhoneDevice; 143 QString mPhoneDevice;
144 QString mPhoneConnection; 144 QString mPhoneConnection;
145 QString mPhoneModel; 145 QString mPhoneModel;
146 QString mPassWordPiSync; 146 QString mPassWordPiSync;
147 QString mActiveSyncPort; 147 QString mActiveSyncPort;
148 QString mActiveSyncIP ; 148 QString mActiveSyncIP ;
149 static QDateTime mRequestedSyncEvent;
149 150
150 signals: 151 signals:
151 void save(); 152 void save();
152 void request_file(); 153 void request_file();
153 void getFile( bool ); 154 void getFile( bool );
154 155
155 public slots: 156 public slots:
156 void slotSyncMenu( int ); 157 void slotSyncMenu( int );
157 void slotClearMenu( int action ); 158 void slotClearMenu( int action );
158 void deleteCommandSocket(KCommandSocket*s, int state); 159 void deleteCommandSocket(KCommandSocket*s, int state);
159 void readFileFromSocket(); 160 void readFileFromSocket();
160 void fillSyncMenu(); 161 void fillSyncMenu();