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.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index c995d6e..ba96f33 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -27,48 +27,50 @@
*/
#include "mainwindow.h"
#include "timetabwidget.h"
#include "formattabwidget.h"
#include "settingstabwidget.h"
#include "ntptabwidget.h"
#include "predicttabwidget.h"
#include <qpe/config.h>
#include <qpe/datebookdb.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qlayout.h>
#include <qmessagebox.h>
#include <qsocket.h>
#include <qstring.h>
#include <qtimer.h>
+using namespace Opie::Ui;
+using namespace Opie::Core;
MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f )
: QDialog( 0x0, 0x0, TRUE, 0 )
{
setCaption( tr( "SystemTime" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
layout->setSpacing( 4 );
// Create main tabbed control
mainWidget = new OTabWidget( this );
// Default object pointers to null
ntpProcess = 0x0;
ntpTab = 0x0;
// Add tab widgets
mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) );
mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) );
mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) );
mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) );
Config config( "ntp" );
config.setGroup( "settings" );
slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) );
@@ -167,51 +169,51 @@ void MainWindow::runNTP()
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(OProcess*,char*,int)),
+ connect( ntpProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
this, SLOT(slotNtpOutput(OProcess*,char*,int)) );
- connect( ntpProcess, SIGNAL(processExited(OProcess*)),
+ connect( ntpProcess, SIGNAL(processExited(Opie::Core::OProcess*)),
this, SLOT(slotNtpFinished(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;