-rw-r--r-- | libkdepim/ksyncmanager.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 9857e3e..9a1f2a9 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -346,16 +346,17 @@ void KSyncManager::enableQuick( bool ask ) lay.addWidget( &label2); lay.addWidget( &lepw); QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); lay.addWidget( &autostart); autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); #ifdef DESKTOP_VERSION #ifdef _WIN32_ QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); + syncdesktop.hide();// not implemented! #else QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); #endif lay.addWidget( &syncdesktop); #else mPrefs->mPassiveSyncWithDesktop = false; QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); syncdesktop.hide(); @@ -568,23 +569,25 @@ int KSyncManager::ringSync() if ( includeInRingSync && ( i < 1 || i > 2 )) { mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); ++syncedProfiles; // mAskForPreferences = temp->getAskForPreferences(); mWriteBackFile = temp->getWriteBackFile(); mWriteBackExistingOnly = temp->getWriteBackExisting(); + mIsKapiFile = temp->getIsKapiFile(); mWriteBackInFuture = 0; if ( temp->getWriteBackFuture() ) mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); mShowSyncSummary = false; mCurrentSyncDevice = syncProfileNames[i] ; mCurrentSyncName = mLocalMachineName; if ( i == 0 ) { + mIsKapiFile = false; #ifdef DESKTOP_VERSION syncKDE(); #else syncSharp(); #endif } else { if ( temp->getIsLocalFileSync() ) { switch(mTargetApp) @@ -1016,16 +1019,17 @@ QString KSyncManager::syncFileName() return locateLocal( "tmp", fn ); #else return (QString( "/tmp/" )+ fn ); #endif } void KSyncManager::syncPi() { + mIsKapiFile = true; mPisyncFinished = false; qApp->processEvents(); if ( mAskForPreferences ) if ( !edit_pisync_options()) { mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); return; } bool ok; @@ -1133,18 +1137,19 @@ 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 ) { //emit sendFile( mSocket ); bool ok = false; QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); - if ( 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() ); } @@ -1178,16 +1183,36 @@ void KServerSocket::send_file() delete mSyncActionDialog; mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); mSyncActionDialog->setCaption(i18n("Received sync request")); QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); lay->addWidget( label); lay->setMargin(7); lay->setSpacing(7); + if ( KSyncManager::mRequestedSyncEvent.isValid() ) { + int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); + //if ( secs > 30 ) + if ( true ) + { + QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); + QLabel* label = new QLabel( warning, mSyncActionDialog ); + if ( secs > 600 ) + { + QFont f = label->font(); + f. setBold (true ); + f.setPointSize ( f.pointSize() + 10); + label->setFont( f ); + } + lay->addWidget( label); + mSyncActionDialog->setFixedSize( 230, 200); + } else { + mSyncActionDialog->setFixedSize( 230, 120); + } + } else mSyncActionDialog->setFixedSize( 230, 120); mSyncActionDialog->show(); mSyncActionDialog->raise(); emit request_file(); qApp->processEvents(); QString fileName = mFileName; QFile file( fileName ); if (!file.open( IO_ReadOnly ) ) { @@ -1293,17 +1318,17 @@ void KCommandSocket::readFile( QString fn ) } mFileString = ""; mFileName = fn; mFirst = true; mSocket->connectToHost( mHost, mPort ); QTextStream os( mSocket ); os.setEncoding( QTextStream::Latin1 ); - QString curDt = KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); + 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 ); |