Diffstat (limited to 'noncore/settings/netsystemtime/timetabwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/timetabwidget.cpp | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/noncore/settings/netsystemtime/timetabwidget.cpp b/noncore/settings/netsystemtime/timetabwidget.cpp index 3cc127d..905461f 100644 --- a/noncore/settings/netsystemtime/timetabwidget.cpp +++ b/noncore/settings/netsystemtime/timetabwidget.cpp @@ -1,35 +1,35 @@ /* - This file is part of the OPIE Project + 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., + .=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 "timetabwidget.h" #include <qpe/config.h> #include <qpe/datebookmonth.h> #include <qpe/global.h> #include <qpe/resource.h> #include <qpe/tzselect.h> @@ -100,31 +100,31 @@ TimeTabWidget::TimeTabWidget( QWidget *parent ) layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 ); // Timezone layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 ); selTimeZone = new TimeZoneSelector( container ); connect( selTimeZone, SIGNAL(signalNewTz(const QString&)), this, SLOT(slotTZChanged(const QString&)) ); layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 ); // Space filler layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); // Set NTP time button - QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ), - tr( "Get time from the network" ), container ); - connect( pb, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) ); - layout->addMultiCellWidget( pb, 8, 8, 0, 5 ); + m_ntpBtn = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ), + tr( "Get time from the network" ), container ); + connect( m_ntpBtn, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) ); + layout->addMultiCellWidget( m_ntpBtn, 8, 8, 0, 5 ); // Set predicted time button - pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ), + QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ), container ); connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) ); layout->addMultiCellWidget( pb, 9, 9, 0, 5 ); // Space filler at bottom of widget layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 ); // Initialize values Config config( "locale" ); config.setGroup( "Location" ); selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) ); use12HourTime = FALSE; @@ -183,24 +183,29 @@ void TimeTabWidget::setDateTime( const QDateTime &dt ) sbHour->setValue( show_hour ); } else { sbHour->setValue( t.hour() ); } sbMin->setValue( t.minute() ); // Set date btnDate->setDate( dt.date() ); } +void TimeTabWidget::setNTPBtnEnabled( bool enabled ) +{ + m_ntpBtn->setEnabled( enabled ); +} + void TimeTabWidget::setSystemTime( const QDateTime &dt ) { // Set system clock if ( dt.isValid() ) { struct timeval myTv; int t = TimeConversion::toUTC( dt ); myTv.tv_sec = t; myTv.tv_usec = 0; if ( myTv.tv_sec != -1 ) ::settimeofday( &myTv, 0 ); |