summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/netsystemtime/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index ba96f33..385d355 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -146,99 +146,99 @@ void MainWindow::accept()
// Exit app
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 %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 )
{
ntpProcess = new OProcess();
connect( ntpProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
- this, SLOT(slotNtpOutput(OProcess*,char*,int)) );
+ this, SLOT(slotNtpOutput(Opie::Core::OProcess*,char*,int)) );
connect( ntpProcess, SIGNAL(processExited(Opie::Core::OProcess*)),
- this, SLOT(slotNtpFinished(OProcess*)) );
+ this, SLOT(slotNtpFinished(Opie::Core::OProcess*)) );
}
else
ntpProcess->clearArguments();
*ntpProcess << "ntpdate" << srv;
bool ret = ntpProcess->start( OProcess::NotifyOnExit, OProcess::AllOutput );
if ( !ret )
{
QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) );
if ( ntpTabEnabled )
ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) );
}
}
bool MainWindow::ntpDelayElapsed()
{
// Determine if time elapsed is greater than time delay
Config config( "ntp" );
config.setGroup( "lookups" );
_lookupDiff = TimeConversion::toUTC( QDateTime::currentDateTime() ) - config.readNumEntry( "time", 0 );
if ( _lookupDiff < 0 )
return true;
return ( _lookupDiff - ( ntpDelay * 60) ) > 0;
}
void MainWindow::slotSetTime( const QDateTime &dt )
{
timeTab->setDateTime( dt );
}
void MainWindow::slotQCopReceive( const QCString &msg, const QByteArray & )
{
if ( msg == "ntpLookup(QString)" )
{
ntpInteractive = false;
runNTP();
}
if ( msg == "setPredictedTime(QString)" )
{
//setPredictTime();
}
}
void MainWindow::slotDisplayNTPTab( bool display )
{
ntpTabEnabled = display;