summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp61
-rw-r--r--noncore/settings/netsystemtime/ntptabwidget.cpp61
-rw-r--r--noncore/settings/netsystemtime/ntptabwidget.h46
-rw-r--r--noncore/settings/netsystemtime/timetabwidget.cpp57
-rw-r--r--noncore/settings/netsystemtime/timetabwidget.h47
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,27 +1,27 @@
/*
-                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.
*/
@@ -50,9 +50,9 @@
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" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
@@ -186,8 +186,13 @@ void MainWindow::runNTP()
output.append( srv );
ntpTab->addNtpOutput( output );
}
+ // 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 )
{
ntpProcess = new OProcess();
connect( ntpProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
@@ -205,8 +210,13 @@ void MainWindow::runNTP()
{
QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) );
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" ) );
}
}
bool MainWindow::ntpDelayElapsed()
@@ -297,8 +307,13 @@ void MainWindow::slotNtpFinished( OProcess *p )
{
QString output;
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() )
{
if ( isVisible() && ntpInteractive )
@@ -350,9 +365,9 @@ void MainWindow::slotNtpFinished( OProcess *p )
{
QString grpname = QString( "lookup_" ).append( QString::number( lookupCount ) );
config.setGroup( grpname );
lookupCount++;
- predictTab->setShiftPerSec( timeShift / secsSinceLast );
+ predictTab->setShiftPerSec( (int)(timeShift / secsSinceLast) );
config.writeEntry( "secsSinceLast", secsSinceLast );
config.writeEntry( "timeShift", QString::number( timeShift ) );
config.setGroup( "lookups" );
config.writeEntry( "count", lookupCount );
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,27 +1,27 @@
/*
-                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.
*/
@@ -45,9 +45,9 @@ NTPTabWidget::NTPTabWidget( QWidget *parent )
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
-
+
QGridLayout *layout = new QGridLayout( container );
layout->setMargin( 2 );
layout->setSpacing( 4 );
@@ -69,17 +69,17 @@ NTPTabWidget::NTPTabWidget( QWidget *parent )
// NTP output display
mleNtpOutput = new QMultiLineEdit( container );
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 );
}
NTPTabWidget::~NTPTabWidget()
{
@@ -104,4 +104,9 @@ void NTPTabWidget::addNtpOutput( const QString &str )
{
mleNtpOutput->append( 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,27 +1,27 @@
/*
-                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.
*/
@@ -32,8 +32,9 @@
#include <qwidget.h>
class QLabel;
class QMultiLineEdit;
+class QPushButton;
class NTPTabWidget : public QWidget
{
Q_OBJECT
@@ -45,14 +46,17 @@ public:
void setStartTime( const QString & );
void setTimeShift( const QString & );
void setNewTime( const QString & );
void addNtpOutput( const QString & );
+ void setNTPBtnEnabled( bool enabled );
private:
QLabel *lblStartTime;
QLabel *lblTimeShift;
QLabel *lblNewTime;
QMultiLineEdit *mleNtpOutput;
+ QPushButton *m_ntpBtn;
+
signals:
void getNTPTime();
};
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,27 +1,27 @@
/*
-                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.
*/
@@ -108,15 +108,15 @@ TimeTabWidget::TimeTabWidget( QWidget *parent )
// 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 );
@@ -191,8 +191,13 @@ void TimeTabWidget::setDateTime( const QDateTime &dt )
// 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() )
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,27 +1,27 @@
/*
-                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,28 +34,31 @@
class DateButton;
class DateFormat;
class QComboBox;
class QDateTime;
+class QPushButton;
class QSpinBox;
class TimeZoneSelector;
class TimeTabWidget : public QWidget
{
Q_OBJECT
public:
- TimeTabWidget( QWidget * = 0x0 );
+ TimeTabWidget( QWidget * = 0l );
~TimeTabWidget();
void saveSettings( bool );
void setDateTime( const QDateTime & );
+ void setNTPBtnEnabled( bool enabled );
private:
QSpinBox *sbHour;
QSpinBox *sbMin;
QComboBox *cbAmpm;
DateButton *btnDate;
TimeZoneSelector *selTimeZone;
+ QPushButton *m_ntpBtn;
bool use12HourTime;
void setSystemTime( const QDateTime & );