author | zautrix <zautrix> | 2004-10-26 22:56:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-26 22:56:24 (UTC) |
commit | 00d623c9391a9bdaeb142f443f1dd09861317608 (patch) (side-by-side diff) | |
tree | 941b77a6da7a5db84ed9f4c00ab18918231cb643 | |
parent | 6385f303bef3cbcd19d097a7b05c30e144d5dd6e (diff) | |
download | kdepimpi-00d623c9391a9bdaeb142f443f1dd09861317608.zip kdepimpi-00d623c9391a9bdaeb142f443f1dd09861317608.tar.gz kdepimpi-00d623c9391a9bdaeb142f443f1dd09861317608.tar.bz2 |
added external time for pisync - kdesync
-rw-r--r-- | korganizer/calendarview.cpp | 11 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 16 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 1 |
3 files changed, 24 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a08f243..326db88 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -913,35 +913,42 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int int addedEventR = 0; int deletedEventR = 0; int deletedEventL = 0; int changedLocal = 0; int changedRemote = 0; //QPtrList<Event> el = local->rawEvents(); Event* eventR; QString uid; int take; Event* eventL; Event* eventRSync; Event* eventLSync; QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); bool fullDateRange = false; local->resetTempSyncStat(); - if ( mSyncKDE ) - remote->resetPilotStat(1); mLastCalendarSync = QDateTime::currentDateTime(); + if ( mSyncKDE ) { + remote->resetPilotStat(1); + if ( KSyncManager::mRequestedSyncEvent.isValid() ) { + mLastCalendarSync = KSyncManager::mRequestedSyncEvent; + qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); + } else { + qDebug("ERROR: KSyncManager::mRequestedSyncEvent has invalid datatime "); + } + } QDateTime modifiedCalendar = mLastCalendarSync;; eventLSync = getLastSyncEvent(); eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); if ( eventR ) { eventRSync = (Event*) eventR->clone(); remote->deleteEvent(eventR ); } else { if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncKDE) { eventRSync = (Event*)eventLSync->clone(); } else { fullDateRange = true; eventRSync = new Event(); eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); eventRSync->setDtStart( mLastCalendarSync ); diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index feb184b..e09050e 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -42,32 +42,35 @@ #include <qbuttongroup.h> #include <qtimer.h> #include <qmessagebox.h> #include <qapplication.h> #include <qlineedit.h> #include <qdialog.h> #include <qlayout.h> #include <qtextcodec.h> #include <qlabel.h> #include <qcheckbox.h> #include <klocale.h> #include <kglobal.h> #include <kconfig.h> #include <kfiledialog.h> +QDateTime KSyncManager::mRequestedSyncEvent; + + KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) { mServerSocket = 0; bar = new QProgressBar ( 1, 0 ); bar->setCaption (""); int w = 300; if ( QApplication::desktop()->width() < 320 ) w = 220; int h = bar->sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); if ( mPrefs->mPassiveSyncAutoStart ) enableQuick( false ); @@ -1098,35 +1101,42 @@ void KServerSocket::discardClient() //emit endConnect(); } void KServerSocket::readClient() { if ( blockRC ) return; if ( mSocket == 0 ) { qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); return; } //qDebug("KServerSocket::readClient()"); if ( mSocket->canReadLine() ) { QString line = mSocket->readLine(); //qDebug("KServerSocket readline: %s ", line.latin1()); QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); if ( tokens[0] == "GET" ) { - if ( tokens[1] == mPassWord ) + if ( tokens[1] == mPassWord ) { //emit sendFile( mSocket ); + bool ok = false; + QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); + if ( ok ) + KSyncManager::mRequestedSyncEvent = dt; + else + KSyncManager::mRequestedSyncEvent = QDateTime(); send_file(); + } else { KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); } } if ( tokens[0] == "PUT" ) { if ( tokens[1] == mPassWord ) { //emit getFile( mSocket ); blockRC = true; get_file(); } else { KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); } } @@ -1254,33 +1264,35 @@ KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, mTimerSocket = new QTimer ( this ); connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); } void KCommandSocket::readFile( QString fn ) { if ( !mSocket ) { mSocket = new QSocket( this ); connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); } mFileString = ""; mFileName = fn; mFirst = true; mSocket->connectToHost( mHost, mPort ); QTextStream os( mSocket ); os.setEncoding( QTextStream::Latin1 ); - os << "GET " << mPassWord << "\r\n"; + + QString curDt = KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); + os << "GET " << mPassWord << curDt <<"\r\n"; mTimerSocket->start( 20000 ); } void KCommandSocket::writeFile( QString fileName ) { if ( !mSocket ) { mSocket = new QSocket( this ); connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); } mFileName = fileName ; mSocket->connectToHost( mHost, mPort ); } void KCommandSocket::writeFileToSocket() { QFile file2( mFileName ); diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index aa32e28..2af891b 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -133,32 +133,33 @@ class KSyncManager : public QObject QString mLocalMachineName; QStringList mExternSyncProfiles; QStringList mSyncProfileNames; bool mAskForPreferences; bool mShowSyncSummary; bool mIsKapiFile; bool mWriteBackExistingOnly; int mSyncAlgoPrefs; bool mWriteBackFile; int mWriteBackInFuture; QString mPhoneDevice; QString mPhoneConnection; QString mPhoneModel; QString mPassWordPiSync; QString mActiveSyncPort; QString mActiveSyncIP ; + static QDateTime mRequestedSyncEvent; signals: void save(); void request_file(); void getFile( bool ); public slots: void slotSyncMenu( int ); void slotClearMenu( int action ); void deleteCommandSocket(KCommandSocket*s, int state); void readFileFromSocket(); void fillSyncMenu(); private: void syncPi(); KServerSocket * mServerSocket; |