-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 @@ -925,11 +925,18 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int 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 ) { diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index feb184b..e09050e 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -54,8 +54,11 @@ #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; @@ -1110,11 +1113,18 @@ void KServerSocket::readClient() 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() ); } @@ -1266,9 +1276,11 @@ void KCommandSocket::readFile( QString 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 ) diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index aa32e28..2af891b 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -145,8 +145,9 @@ class KSyncManager : public QObject QString mPhoneModel; QString mPassWordPiSync; QString mActiveSyncPort; QString mActiveSyncIP ; + static QDateTime mRequestedSyncEvent; signals: void save(); void request_file(); |