-rw-r--r-- | noncore/settings/netsystemtime/mainwindow.cpp | 61 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntptabwidget.cpp | 61 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntptabwidget.h | 46 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/timetabwidget.cpp | 57 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/timetabwidget.h | 47 |
5 files changed, 152 insertions, 120 deletions
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp index 385d355..486257f 100644 --- a/noncore/settings/netsystemtime/mainwindow.cpp +++ b/noncore/settings/netsystemtime/mainwindow.cpp @@ -1,25 +1,25 @@ /* - 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. @@ -52,5 +52,5 @@ using namespace Opie::Ui; using namespace Opie::Core; MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f ) - : QDialog( 0x0, 0x0, TRUE, 0 ) + : QDialog( parent, name, modal, f ) { setCaption( tr( "SystemTime" ) ); @@ -188,4 +188,9 @@ void MainWindow::runNTP() } + // Disable set time buttons & change app caption to indicate time update is happening + ntpTab->setNTPBtnEnabled( false ); + timeTab->setNTPBtnEnabled( false ); + setCaption( tr( "Retrieving time from network..." ) ); + if ( !ntpProcess ) { @@ -207,4 +212,9 @@ void MainWindow::runNTP() if ( ntpTabEnabled ) ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) ); + + // Re-enable set time buttons & change app caption to indicate time update is happening + ntpTab->setNTPBtnEnabled( true ); + timeTab->setNTPBtnEnabled( true ); + setCaption( tr( "SystemTime" ) ); } } @@ -299,4 +309,9 @@ void MainWindow::slotNtpFinished( OProcess *p ) QDateTime dt = QDateTime::currentDateTime(); + // Re-enable set time buttons & change app caption to indicate time update is happening + ntpTab->setNTPBtnEnabled( true ); + timeTab->setNTPBtnEnabled( true ); + setCaption( tr( "SystemTime" ) ); + // Verify run was successful if ( p->exitStatus() != 0 || !p->normalExit() ) @@ -352,5 +367,5 @@ void MainWindow::slotNtpFinished( OProcess *p ) config.setGroup( grpname ); lookupCount++; - predictTab->setShiftPerSec( timeShift / secsSinceLast ); + predictTab->setShiftPerSec( (int)(timeShift / secsSinceLast) ); config.writeEntry( "secsSinceLast", secsSinceLast ); config.writeEntry( "timeShift", QString::number( timeShift ) ); diff --git a/noncore/settings/netsystemtime/ntptabwidget.cpp b/noncore/settings/netsystemtime/ntptabwidget.cpp index d71c230..616bc22 100644 --- a/noncore/settings/netsystemtime/ntptabwidget.cpp +++ b/noncore/settings/netsystemtime/ntptabwidget.cpp @@ -1,25 +1,25 @@ /* - 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. @@ -47,5 +47,5 @@ NTPTabWidget::NTPTabWidget( QWidget *parent ) QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); - + QGridLayout *layout = new QGridLayout( container ); layout->setMargin( 2 ); @@ -71,13 +71,13 @@ NTPTabWidget::NTPTabWidget( QWidget *parent ) QFont font( mleNtpOutput->font() ); font.setPointSize( 7 ); - mleNtpOutput->setFont( font ); + mleNtpOutput->setFont( font ); mleNtpOutput->setWordWrap( QMultiLineEdit::WidgetWidth ); layout->addMultiCellWidget( mleNtpOutput, 3, 3, 0, 1 ); - + // 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, 4, 4, 0, 1 ); + 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, 4, 4, 0, 1 ); } @@ -106,2 +106,7 @@ void NTPTabWidget::addNtpOutput( const QString &str ) mleNtpOutput->setCursorPosition( mleNtpOutput->numLines() + 1, 0, FALSE ); } + +void NTPTabWidget::setNTPBtnEnabled( bool enabled ) +{ + m_ntpBtn->setEnabled( enabled ); +} diff --git a/noncore/settings/netsystemtime/ntptabwidget.h b/noncore/settings/netsystemtime/ntptabwidget.h index 811c57e..f05482e 100644 --- a/noncore/settings/netsystemtime/ntptabwidget.h +++ b/noncore/settings/netsystemtime/ntptabwidget.h @@ -1,25 +1,25 @@ /* - 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. @@ -34,4 +34,5 @@ class QLabel; class QMultiLineEdit; +class QPushButton; class NTPTabWidget : public QWidget @@ -47,4 +48,5 @@ public: void setNewTime( const QString & ); void addNtpOutput( const QString & ); + void setNTPBtnEnabled( bool enabled ); private: @@ -53,4 +55,6 @@ private: QLabel *lblNewTime; QMultiLineEdit *mleNtpOutput; + QPushButton *m_ntpBtn; + signals: 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,25 +1,25 @@ /* - 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. @@ -110,11 +110,11 @@ TimeTabWidget::TimeTabWidget( QWidget *parent ) // 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()) ); @@ -193,4 +193,9 @@ void TimeTabWidget::setDateTime( const QDateTime &dt ) } +void TimeTabWidget::setNTPBtnEnabled( bool enabled ) +{ + m_ntpBtn->setEnabled( enabled ); +} + void TimeTabWidget::setSystemTime( const QDateTime &dt ) { diff --git a/noncore/settings/netsystemtime/timetabwidget.h b/noncore/settings/netsystemtime/timetabwidget.h index f44a1da..949535d 100644 --- a/noncore/settings/netsystemtime/timetabwidget.h +++ b/noncore/settings/netsystemtime/timetabwidget.h @@ -1,25 +1,25 @@ /* - 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. @@ -36,4 +36,5 @@ class DateFormat; class QComboBox; class QDateTime; +class QPushButton; class QSpinBox; class TimeZoneSelector; @@ -44,9 +45,10 @@ class TimeTabWidget : public QWidget public: - TimeTabWidget( QWidget * = 0x0 ); + TimeTabWidget( QWidget * = 0l ); ~TimeTabWidget(); void saveSettings( bool ); void setDateTime( const QDateTime & ); + void setNTPBtnEnabled( bool enabled ); private: @@ -56,4 +58,5 @@ private: DateButton *btnDate; TimeZoneSelector *selTimeZone; + QPushButton *m_ntpBtn; bool use12HourTime; |