Diffstat (limited to 'noncore/settings/netsystemtime/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/mainwindow.cpp | 25 |
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 @@ -38,8 +38,9 @@ #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 @@ -49,9 +50,9 @@ #include <qsocket.h> #include <qstring.h> #include <qtimer.h> -MainWindow::MainWindow() +MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f ) : QDialog( 0x0, 0x0, TRUE, 0 ) { setCaption( tr( "SystemTime" ) ); @@ -65,9 +66,9 @@ MainWindow::MainWindow() // Default object pointers to null ntpProcess = 0x0; ntpTab = 0x0; - // Add tab widgets + // 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" ) ); @@ -78,12 +79,11 @@ MainWindow::MainWindow() mainWidget->setCurrentTab( tr( "Time" ) ); layout->addWidget( mainWidget ); - // Create QCOP channel - QCopChannel *channel = new QCopChannel( "QPE/Application/netsystemtime", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) ); + connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), + this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) ); + // Create NTP socket ntpSock = new QSocket( this ); connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) ); @@ -109,9 +109,10 @@ MainWindow::MainWindow() slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); slotCheckNtp( -1 ); // Display app - showMaximized(); + //showMaximized(); + (void)new QPEDialogListener(this); } MainWindow::~MainWindow() { @@ -164,9 +165,9 @@ 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 ) ) { @@ -197,10 +198,10 @@ void MainWindow::runNTP() } else ntpProcess->clearArguments(); - - *ntpProcess << "ntpdate" << srv; + + *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." ) ); @@ -296,9 +297,9 @@ void MainWindow::slotNtpOutput( OProcess *, char *buffer, int buflen ) void MainWindow::slotNtpFinished( OProcess *p ) { QString output; QDateTime dt = QDateTime::currentDateTime(); - + // Verify run was successful if ( p->exitStatus() != 0 || !p->normalExit() ) { if ( isVisible() && ntpInteractive ) @@ -337,9 +338,9 @@ void MainWindow::slotNtpFinished( OProcess *p ) if ( timeShift == 0.0 ) return; int secsSinceLast = time - lastLookup; output = tr( "%1 seconds").arg(QString::number( timeShift )); - + // Display information on time server tab if ( ntpTabEnabled ) { ntpTab->setTimeShift( output ); |