author | zautrix <zautrix> | 2004-10-28 17:59:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-28 17:59:33 (UTC) |
commit | a9ca33a6c78026396ff081572e96f0d1e3eb63fa (patch) (side-by-side diff) | |
tree | 559ce203ce5adb871f8636a8f2213cf4a472d576 | |
parent | 5c64eb04c048d7e51f1c71621e1d37c5c0c580a0 (diff) | |
download | kdepimpi-a9ca33a6c78026396ff081572e96f0d1e3eb63fa.zip kdepimpi-a9ca33a6c78026396ff081572e96f0d1e3eb63fa.tar.gz kdepimpi-a9ca33a6c78026396ff081572e96f0d1e3eb63fa.tar.bz2 |
showing clcok skew in pisync with warning
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 9a1f2a9..21af295 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -1174,45 +1174,62 @@ void KServerSocket::readClient() void KServerSocket::end_connect() { delete mSyncActionDialog; mSyncActionDialog = 0; } void KServerSocket::send_file() { //qDebug("MainWindow::sendFile(QSocket* s) "); if ( mSyncActionDialog ) 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 ); + QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); + label->setAlignment ( Qt::AlignHCenter ); 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 ) + if ( secs < 0 ) + secs = secs * (-1); + 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 ) + QLabel* label = new QLabel( warning, mSyncActionDialog ); + label->setAlignment ( Qt::AlignHCenter ); + lay->addWidget( label); + if ( secs > 180 ) { + if ( secs > 300 ) { + if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\n of more than 5 minutes.\nPlease adjust your clocks.\n<b>You may get wrong syncing results!<\b>\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { + qDebug("cancelled "); + return ; + } + } QFont f = label->font(); + f.setPointSize ( f.pointSize() *2 ); f. setBold (true ); - f.setPointSize ( f.pointSize() + 10); - label->setFont( f ); - } - lay->addWidget( label); - mSyncActionDialog->setFixedSize( 230, 200); + QLabel* label = new QLabel( warning, mSyncActionDialog ); + label->setFont( f ); + warning = i18n("ADJUST\nYOUR\nCLOCKS!"); + label->setText( warning ); + label->setAlignment ( Qt::AlignHCenter ); + lay->addWidget( label); + mSyncActionDialog->setFixedSize( 230, 300); + } else { + 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 ) ) { |