summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime/mainwindow.cpp
authormickeyl <mickeyl>2003-10-29 17:22:08 (UTC)
committer mickeyl <mickeyl>2003-10-29 17:22:08 (UTC)
commit35615947e11575a61456c8483e7f6d67fe59d5ed (patch) (unidiff)
tree89f834a50b5070767ca0f9c8a90d044f075a9131 /noncore/settings/netsystemtime/mainwindow.cpp
parent80fc44ae81d88c4cee5ea160818881acb2422a62 (diff)
downloadopie-35615947e11575a61456c8483e7f6d67fe59d5ed.zip
opie-35615947e11575a61456c8483e7f6d67fe59d5ed.tar.gz
opie-35615947e11575a61456c8483e7f6d67fe59d5ed.tar.bz2
merge noncore/settings/* except networksettings for which tille volunteered (thanks)
Diffstat (limited to 'noncore/settings/netsystemtime/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index 2d240ba..66e1ca3 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -39,6 +39,7 @@
39#include <qpe/config.h> 39#include <qpe/config.h>
40#include <qpe/datebookdb.h> 40#include <qpe/datebookdb.h>
41#include <qpe/qpeapplication.h> 41#include <qpe/qpeapplication.h>
42#include <qpe/qpedialog.h>
42 43
43#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 44#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
44#include <qpe/qcopenvelope_qws.h> 45#include <qpe/qcopenvelope_qws.h>
@@ -50,7 +51,7 @@
50#include <qstring.h> 51#include <qstring.h>
51#include <qtimer.h> 52#include <qtimer.h>
52 53
53MainWindow::MainWindow() 54MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f )
54 : QDialog( 0x0, 0x0, TRUE, 0 ) 55 : QDialog( 0x0, 0x0, TRUE, 0 )
55{ 56{
56 setCaption( tr( "SystemTime" ) ); 57 setCaption( tr( "SystemTime" ) );
@@ -66,7 +67,7 @@ MainWindow::MainWindow()
66 ntpProcess = 0x0; 67 ntpProcess = 0x0;
67 ntpTab = 0x0; 68 ntpTab = 0x0;
68 69
69 // Add tab widgets 70 // Add tab widgets
70 mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) ); 71 mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) );
71 mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) ); 72 mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) );
72 mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) ); 73 mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) );
@@ -79,10 +80,9 @@ MainWindow::MainWindow()
79 mainWidget->setCurrentTab( tr( "Time" ) ); 80 mainWidget->setCurrentTab( tr( "Time" ) );
80 layout->addWidget( mainWidget ); 81 layout->addWidget( mainWidget );
81 82
82 // Create QCOP channel 83 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
83 QCopChannel *channel = new QCopChannel( "QPE/Application/netsystemtime", this ); 84 this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) );
84 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 85
85 this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) );
86 86
87 // Create NTP socket 87 // Create NTP socket
88 ntpSock = new QSocket( this ); 88 ntpSock = new QSocket( this );
@@ -110,7 +110,8 @@ MainWindow::MainWindow()
110 slotCheckNtp( -1 ); 110 slotCheckNtp( -1 );
111 111
112 // Display app 112 // Display app
113 showMaximized(); 113 //showMaximized();
114 (void)new QPEDialogListener(this);
114} 115}
115 116
116MainWindow::~MainWindow() 117MainWindow::~MainWindow()
@@ -165,7 +166,7 @@ void MainWindow::runNTP()
165 if ( !ntpDelayElapsed() && ntpInteractive ) 166 if ( !ntpDelayElapsed() && ntpInteractive )
166 { 167 {
167 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 ) ); 168 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 ) );
168 169
169 switch ( 170 switch (
170 QMessageBox::warning( this, tr( "Continue?" ), msg, QMessageBox::Yes, QMessageBox::No ) 171 QMessageBox::warning( this, tr( "Continue?" ), msg, QMessageBox::Yes, QMessageBox::No )
171 ) 172 )
@@ -198,8 +199,8 @@ void MainWindow::runNTP()
198 199
199 else 200 else
200 ntpProcess->clearArguments(); 201 ntpProcess->clearArguments();
201 202
202 *ntpProcess << "ntpdate" << srv; 203 *ntpProcess << "ntpdate" << srv;
203 bool ret = ntpProcess->start( OProcess::NotifyOnExit, OProcess::AllOutput ); 204 bool ret = ntpProcess->start( OProcess::NotifyOnExit, OProcess::AllOutput );
204 if ( !ret ) 205 if ( !ret )
205 { 206 {
@@ -297,7 +298,7 @@ void MainWindow::slotNtpFinished( OProcess *p )
297{ 298{
298 QString output; 299 QString output;
299 QDateTime dt = QDateTime::currentDateTime(); 300 QDateTime dt = QDateTime::currentDateTime();
300 301
301 // Verify run was successful 302 // Verify run was successful
302 if ( p->exitStatus() != 0 || !p->normalExit() ) 303 if ( p->exitStatus() != 0 || !p->normalExit() )
303 { 304 {
@@ -338,7 +339,7 @@ void MainWindow::slotNtpFinished( OProcess *p )
338 return; 339 return;
339 int secsSinceLast = time - lastLookup; 340 int secsSinceLast = time - lastLookup;
340 output = tr( "%1 seconds").arg(QString::number( timeShift )); 341 output = tr( "%1 seconds").arg(QString::number( timeShift ));
341 342
342 // Display information on time server tab 343 // Display information on time server tab
343 if ( ntpTabEnabled ) 344 if ( ntpTabEnabled )
344 { 345 {