-rw-r--r-- | noncore/settings/netsystemtime/mainwindow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp index ab71463..85a46b7 100644 --- a/noncore/settings/netsystemtime/mainwindow.cpp +++ b/noncore/settings/netsystemtime/mainwindow.cpp @@ -148,48 +148,50 @@ void MainWindow::accept() qApp->quit(); } void MainWindow::reject() { // Reset time settings timeTab->saveSettings( FALSE ); // Send notifications but do not save settings formatTab->saveSettings( FALSE ); // Exit app qApp->quit(); } void MainWindow::runNTP() { if ( !ntpDelayElapsed() && ntpInteractive ) { QString msg = tr( "You asked for a delay of " ); msg.append( QString::number( ntpDelay ) ); msg.append( tr( " minutes, but only " ) ); msg.append( QString::number( _lookupDiff / 60 ) ); msg.append( tr(" minutes elapsed since last lookup.<br>Continue?") ); + + QString msg = tr( "You asked for a delay of %1 minutes, but only %2 minutes elapsed since last lookup.<br>Continue?" ).arg( QString::number( ntpDelay ) ).arg( QString::number( _lookupDiff / 60 ) ); switch ( QMessageBox::warning( this, tr( "Continue?" ), msg, QMessageBox::Yes, QMessageBox::No ) ) { case QMessageBox::Yes: break; case QMessageBox::No: return; default: return; } } QString srv = settingsTab->ntpServer(); // Send information to time server tab if enabled if ( ntpTabEnabled ) { ntpTab->setStartTime( QDateTime::currentDateTime().toString() ); QString output = tr( "Running:\nntpdate " ); output.append( srv ); ntpTab->addNtpOutput( output ); } if ( !ntpProcess ) { @@ -320,50 +322,49 @@ void MainWindow::slotNtpFinished( OProcess *p ) // Write out lookup information Config config( "ntp" ); config.setGroup( "lookups" ); int lastLookup = config.readNumEntry( "time", 0 ); int lookupCount = config.readNumEntry( "count", 0 ); bool lastNtp = config.readBoolEntry( "lastNtp", FALSE ); int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); config.writeEntry( "time", time ); // Calculate new time/time shift QString _offset = "offset"; QString _sec = "sec"; QRegExp _reOffset = QRegExp( _offset ); QRegExp _reEndOffset = QRegExp( _sec ); int posOffset = _reOffset.match( ntpOutput ); int posEndOffset = _reEndOffset.match( ntpOutput, posOffset ); posOffset += _offset.length() + 1; QString diff = ntpOutput.mid( posOffset, posEndOffset - posOffset - 1 ); float timeShift = diff.toFloat(); if ( timeShift == 0.0 ) return; int secsSinceLast = time - lastLookup; - output = QString::number( timeShift ); - output.append( tr( " seconds" ) ); + output = tr( "%1 seconds").arg(QString::number( timeShift )); // Display information on time server tab if ( ntpTabEnabled ) { ntpTab->setTimeShift( output ); ntpTab->setNewTime( dt.toString() ); } if ( lastNtp && lastLookup > 0 && secsSinceLast > 60 * ntpDelay ) { QString grpname = QString( "lookup_" ).append( QString::number( lookupCount ) ); config.setGroup( grpname ); lookupCount++; predictTab->setShiftPerSec( timeShift / secsSinceLast ); config.writeEntry( "secsSinceLast", secsSinceLast ); config.writeEntry( "timeShift", QString::number( timeShift ) ); config.setGroup( "lookups" ); config.writeEntry( "count", lookupCount ); config.writeEntry( "lastNtp", TRUE ); } } void MainWindow::slotNTPDelayChanged( int delay ) { |