author | zautrix <zautrix> | 2004-10-28 17:07:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-28 17:07:24 (UTC) |
commit | 709e2793be2dd47dc0a15488f43fd2f058db2036 (patch) (unidiff) | |
tree | f2f90d42bd0125d73bb57f5e3d1c3e1bd9d05196 /libkdepim | |
parent | 4254a88dbb00ebf5f5b323e1ddddf3491e3fdb24 (diff) | |
download | kdepimpi-709e2793be2dd47dc0a15488f43fd2f058db2036.zip kdepimpi-709e2793be2dd47dc0a15488f43fd2f058db2036.tar.gz kdepimpi-709e2793be2dd47dc0a15488f43fd2f058db2036.tar.bz2 |
showing clcok skew in pisync
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 9857e3e..9a1f2a9 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -348,12 +348,13 @@ void KSyncManager::enableQuick( bool ask ) | |||
348 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); | 348 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); |
349 | lay.addWidget( &autostart); | 349 | lay.addWidget( &autostart); |
350 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); | 350 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); |
351 | #ifdef DESKTOP_VERSION | 351 | #ifdef DESKTOP_VERSION |
352 | #ifdef _WIN32_ | 352 | #ifdef _WIN32_ |
353 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); | 353 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); |
354 | syncdesktop.hide();// not implemented! | ||
354 | #else | 355 | #else |
355 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); | 356 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); |
356 | #endif | 357 | #endif |
357 | lay.addWidget( &syncdesktop); | 358 | lay.addWidget( &syncdesktop); |
358 | #else | 359 | #else |
359 | mPrefs->mPassiveSyncWithDesktop = false; | 360 | mPrefs->mPassiveSyncWithDesktop = false; |
@@ -570,19 +571,21 @@ int KSyncManager::ringSync() | |||
570 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 571 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
571 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 572 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
572 | ++syncedProfiles; | 573 | ++syncedProfiles; |
573 | // mAskForPreferences = temp->getAskForPreferences(); | 574 | // mAskForPreferences = temp->getAskForPreferences(); |
574 | mWriteBackFile = temp->getWriteBackFile(); | 575 | mWriteBackFile = temp->getWriteBackFile(); |
575 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 576 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
577 | mIsKapiFile = temp->getIsKapiFile(); | ||
576 | mWriteBackInFuture = 0; | 578 | mWriteBackInFuture = 0; |
577 | if ( temp->getWriteBackFuture() ) | 579 | if ( temp->getWriteBackFuture() ) |
578 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 580 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
579 | mShowSyncSummary = false; | 581 | mShowSyncSummary = false; |
580 | mCurrentSyncDevice = syncProfileNames[i] ; | 582 | mCurrentSyncDevice = syncProfileNames[i] ; |
581 | mCurrentSyncName = mLocalMachineName; | 583 | mCurrentSyncName = mLocalMachineName; |
582 | if ( i == 0 ) { | 584 | if ( i == 0 ) { |
585 | mIsKapiFile = false; | ||
583 | #ifdef DESKTOP_VERSION | 586 | #ifdef DESKTOP_VERSION |
584 | syncKDE(); | 587 | syncKDE(); |
585 | #else | 588 | #else |
586 | syncSharp(); | 589 | syncSharp(); |
587 | #endif | 590 | #endif |
588 | } else { | 591 | } else { |
@@ -1018,12 +1021,13 @@ QString KSyncManager::syncFileName() | |||
1018 | return (QString( "/tmp/" )+ fn ); | 1021 | return (QString( "/tmp/" )+ fn ); |
1019 | #endif | 1022 | #endif |
1020 | } | 1023 | } |
1021 | 1024 | ||
1022 | void KSyncManager::syncPi() | 1025 | void KSyncManager::syncPi() |
1023 | { | 1026 | { |
1027 | mIsKapiFile = true; | ||
1024 | mPisyncFinished = false; | 1028 | mPisyncFinished = false; |
1025 | qApp->processEvents(); | 1029 | qApp->processEvents(); |
1026 | if ( mAskForPreferences ) | 1030 | if ( mAskForPreferences ) |
1027 | if ( !edit_pisync_options()) { | 1031 | if ( !edit_pisync_options()) { |
1028 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1032 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
1029 | return; | 1033 | return; |
@@ -1135,14 +1139,15 @@ void KServerSocket::readClient() | |||
1135 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | 1139 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); |
1136 | if ( tokens[0] == "GET" ) { | 1140 | if ( tokens[0] == "GET" ) { |
1137 | if ( tokens[1] == mPassWord ) { | 1141 | if ( tokens[1] == mPassWord ) { |
1138 | //emit sendFile( mSocket ); | 1142 | //emit sendFile( mSocket ); |
1139 | bool ok = false; | 1143 | bool ok = false; |
1140 | QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); | 1144 | QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); |
1141 | if ( ok ) | 1145 | if ( ok ) { |
1142 | KSyncManager::mRequestedSyncEvent = dt; | 1146 | KSyncManager::mRequestedSyncEvent = dt; |
1147 | } | ||
1143 | else | 1148 | else |
1144 | KSyncManager::mRequestedSyncEvent = QDateTime(); | 1149 | KSyncManager::mRequestedSyncEvent = QDateTime(); |
1145 | send_file(); | 1150 | send_file(); |
1146 | } | 1151 | } |
1147 | else { | 1152 | else { |
1148 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); | 1153 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); |
@@ -1180,13 +1185,33 @@ void KServerSocket::send_file() | |||
1180 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 1185 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
1181 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); | 1186 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
1182 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 1187 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); |
1183 | lay->addWidget( label); | 1188 | lay->addWidget( label); |
1184 | lay->setMargin(7); | 1189 | lay->setMargin(7); |
1185 | lay->setSpacing(7); | 1190 | lay->setSpacing(7); |
1186 | mSyncActionDialog->setFixedSize( 230, 120); | 1191 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1192 | int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); | ||
1193 | //if ( secs > 30 ) | ||
1194 | if ( true ) | ||
1195 | { | ||
1196 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); | ||
1197 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | ||
1198 | if ( secs > 600 ) | ||
1199 | { | ||
1200 | QFont f = label->font(); | ||
1201 | f. setBold (true ); | ||
1202 | f.setPointSize ( f.pointSize() + 10); | ||
1203 | label->setFont( f ); | ||
1204 | } | ||
1205 | lay->addWidget( label); | ||
1206 | mSyncActionDialog->setFixedSize( 230, 200); | ||
1207 | } else { | ||
1208 | mSyncActionDialog->setFixedSize( 230, 120); | ||
1209 | } | ||
1210 | } else | ||
1211 | mSyncActionDialog->setFixedSize( 230, 120); | ||
1187 | mSyncActionDialog->show(); | 1212 | mSyncActionDialog->show(); |
1188 | mSyncActionDialog->raise(); | 1213 | mSyncActionDialog->raise(); |
1189 | emit request_file(); | 1214 | emit request_file(); |
1190 | qApp->processEvents(); | 1215 | qApp->processEvents(); |
1191 | QString fileName = mFileName; | 1216 | QString fileName = mFileName; |
1192 | QFile file( fileName ); | 1217 | QFile file( fileName ); |
@@ -1295,13 +1320,13 @@ void KCommandSocket::readFile( QString fn ) | |||
1295 | mFileName = fn; | 1320 | mFileName = fn; |
1296 | mFirst = true; | 1321 | mFirst = true; |
1297 | mSocket->connectToHost( mHost, mPort ); | 1322 | mSocket->connectToHost( mHost, mPort ); |
1298 | QTextStream os( mSocket ); | 1323 | QTextStream os( mSocket ); |
1299 | os.setEncoding( QTextStream::Latin1 ); | 1324 | os.setEncoding( QTextStream::Latin1 ); |
1300 | 1325 | ||
1301 | QString curDt = KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | 1326 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); |
1302 | os << "GET " << mPassWord << curDt <<"\r\n"; | 1327 | os << "GET " << mPassWord << curDt <<"\r\n"; |
1303 | mTimerSocket->start( 20000 ); | 1328 | mTimerSocket->start( 20000 ); |
1304 | } | 1329 | } |
1305 | 1330 | ||
1306 | void KCommandSocket::writeFile( QString fileName ) | 1331 | void KCommandSocket::writeFile( QString fileName ) |
1307 | { | 1332 | { |