-rw-r--r-- | noncore/settings/netsystemtime/mainwindow.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp index 306117a..ab71463 100644 --- a/noncore/settings/netsystemtime/mainwindow.cpp +++ b/noncore/settings/netsystemtime/mainwindow.cpp @@ -1,131 +1,130 @@ /* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "mainwindow.h" #include "timetabwidget.h" #include "formattabwidget.h" #include "settingstabwidget.h" #include "ntptabwidget.h" #include "predicttabwidget.h" -#include "systemtimeconfig.h" #include <opie/oprocess.h> #include <opie/otabwidget.h> #include <qpe/config.h> #include <qpe/datebookdb.h> #include <qpe/qpeapplication.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> MainWindow::MainWindow() : 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 ) ); slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) ); 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&)) ); // Create NTP socket ntpSock = new QSocket( this ); connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) ); slotProbeNTPServer(); // Create timer for automatic time lookups ntpTimer = new QTimer( this ); // Connect everything together connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); connect( timeTab, SIGNAL(tzChanged(const QString &)), predictTab, SLOT(slotTZChanged(const QString &)) ); connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) ); connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime( int )) ); connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat &)), timeTab, SLOT(slotDateFormatChanged(const DateFormat &)) ); connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) ); connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) ); connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) ); connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) ); connect( predictTab, SIGNAL(setTime(const QDateTime &)), this, SLOT(slotSetTime(const QDateTime &)) ); // Do initial time server check slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); slotCheckNtp( -1 ); // Display app showMaximized(); } MainWindow::~MainWindow() { if ( ntpProcess ) delete ntpProcess; } void MainWindow::accept() { // Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends) { QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); disableScreenSaver << 0 << 0 << 0; } // Update the systemtime |