summaryrefslogtreecommitdiff
authordrw <drw>2005-06-15 18:52:47 (UTC)
committer drw <drw>2005-06-15 18:52:47 (UTC)
commitc93c8f75bb082c0257ce80f9e8a1eb470bdce397 (patch) (side-by-side diff)
tree2a83c0cbe4398daf0a141a62b80bd1b926353ce2
parent1c8aab0c489b9d469646a0e0ab08f500f1bbb507 (diff)
downloadopie-c93c8f75bb082c0257ce80f9e8a1eb470bdce397.zip
opie-c93c8f75bb082c0257ce80f9e8a1eb470bdce397.tar.gz
opie-c93c8f75bb082c0257ce80f9e8a1eb470bdce397.tar.bz2
Resource -> OResource and fix doc headers
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/formattabwidget.cpp50
-rw-r--r--noncore/settings/netsystemtime/formattabwidget.h50
-rw-r--r--noncore/settings/netsystemtime/main.cpp50
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp50
-rw-r--r--noncore/settings/netsystemtime/mainwindow.h50
-rw-r--r--noncore/settings/netsystemtime/ntptabwidget.cpp57
-rw-r--r--noncore/settings/netsystemtime/ntptabwidget.h50
-rw-r--r--noncore/settings/netsystemtime/predicttabwidget.cpp50
-rw-r--r--noncore/settings/netsystemtime/predicttabwidget.h50
-rw-r--r--noncore/settings/netsystemtime/settingstabwidget.cpp50
-rw-r--r--noncore/settings/netsystemtime/settingstabwidget.h50
-rw-r--r--noncore/settings/netsystemtime/timetabwidget.cpp62
-rw-r--r--noncore/settings/netsystemtime/timetabwidget.h50
13 files changed, 351 insertions, 318 deletions
diff --git a/noncore/settings/netsystemtime/formattabwidget.cpp b/noncore/settings/netsystemtime/formattabwidget.cpp
index 982305b..7d01bff 100644
--- a/noncore/settings/netsystemtime/formattabwidget.cpp
+++ b/noncore/settings/netsystemtime/formattabwidget.cpp
@@ -1,122 +1,124 @@
/*
-                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,
+                 This file is part of the Opie Project
+
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-
*/
#include "formattabwidget.h"
#include <qpe/config.h>
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qscrollview.h>
#include <qtimer.h>
FormatTabWidget::FormatTabWidget( QWidget *parent )
: QWidget( parent, 0x0, 0 )
{
QVBoxLayout *tmpvb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
tmpvb->addWidget( sv, 0, 0 );
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 );
// Time format selector
layout->addWidget( new QLabel( tr( "Time format" ), container ), 0, 0 );
cbAppletFormat = new QComboBox( container );
cbAppletFormat->insertItem( tr( "hh:mm" ), 0 );
cbAppletFormat->insertItem( tr( "D/M hh:mm" ), 1 );
cbAppletFormat->insertItem( tr( "M/D hh:mm" ), 2 );
layout->addWidget( cbAppletFormat, 0, 1 );
// 12/24 hour selector
layout->addWidget( new QLabel( tr( "12/24 hour" ), container ), 1, 0 );
cbAmpm = new QComboBox( container );
cbAmpm->insertItem( tr( "24 hour" ), 0 );
cbAmpm->insertItem( tr( "12 hour" ), 1 );
connect( cbAmpm, SIGNAL(activated(int)), this, SIGNAL(show12HourTime(int)) );
layout->addWidget( cbAmpm, 1, 1 );
// Date format selector
layout->addWidget( new QLabel( tr( "Date format" ), container ), 2, 0 );
cbDateFormat = new QComboBox( container );
connect( cbDateFormat, SIGNAL(activated(int)), this, SLOT(slotDateFormatChanged(int)) );
layout->addWidget( cbDateFormat, 2, 1 );
// Week starts on selector
layout->addWidget( new QLabel( tr( "Weeks start on" ), container ), 3, 0 );
cbWeekStart = new QComboBox( container );
cbWeekStart->insertItem( tr( "Sunday" ), 0 );
cbWeekStart->insertItem( tr( "Monday" ), 1 );
connect( cbWeekStart, SIGNAL(activated(int)), this, SIGNAL(weekStartChanged(int)) );
layout->addWidget( cbWeekStart, 3, 1 );
// Initialize values
Config config( "qpe" );
config.setGroup( "Date" );
cbAppletFormat->setCurrentItem( config.readNumEntry( "ClockApplet", 0 ) );
DateFormat df(QChar(config.readEntry("Separator", "/")[0]),
(DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear),
(DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear));
int currentdf = 0;
date_formats[0] = DateFormat( '/', DateFormat::MonthDayYear );
cbDateFormat->insertItem( tr( date_formats[0].toNumberString() ) );
date_formats[1] = DateFormat( '.', DateFormat::DayMonthYear );
if ( df == date_formats[1] )
currentdf = 1;
cbDateFormat->insertItem( tr( date_formats[1].toNumberString() ) );
date_formats[2] = DateFormat( '-', DateFormat::YearMonthDay, DateFormat::DayMonthYear );
if ( df == date_formats[2] )
currentdf = 2;
cbDateFormat->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601
date_formats[3] = DateFormat( '/', DateFormat::DayMonthYear );
if ( df == date_formats[3] )
currentdf = 3;
cbDateFormat->insertItem( tr( date_formats[3].toNumberString() ) );
cbDateFormat->setCurrentItem( currentdf );
//dateButton->setDateFormat( df );
config.setGroup( "Time" );
cbAmpm->setCurrentItem( config.readBoolEntry( "AMPM", FALSE ) ? 1 : 0 );
cbWeekStart->setCurrentItem( config.readBoolEntry( "MONDAY", TRUE ) ? 1 : 0 );
// Send initial configuration options
QTimer::singleShot( 1200, this, SLOT(sendOptions()) );
}
diff --git a/noncore/settings/netsystemtime/formattabwidget.h b/noncore/settings/netsystemtime/formattabwidget.h
index e4073e7..171cd5f 100644
--- a/noncore/settings/netsystemtime/formattabwidget.h
+++ b/noncore/settings/netsystemtime/formattabwidget.h
@@ -1,65 +1,67 @@
/*
-                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.
+                 This file is part of the Opie Project
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
*/
#ifndef FORMATTABWIDGET_H
#define FORMATTABWIDGET_H
#include <qpe/timestring.h>
#include <qwidget.h>
class QComboBox;
class FormatTabWidget : public QWidget
{
Q_OBJECT
public:
FormatTabWidget( QWidget * = 0x0 );
~FormatTabWidget();
void saveSettings( bool );
private:
QComboBox *cbAmpm;
QComboBox *cbWeekStart;
QComboBox *cbDateFormat;
QComboBox *cbAppletFormat;
DateFormat date_formats[4];
signals:
void show12HourTime( int );
void dateFormatChanged( const DateFormat & );
void weekStartChanged( int );
private slots:
void slotDateFormatChanged( int );
void sendOptions();
};
#endif
diff --git a/noncore/settings/netsystemtime/main.cpp b/noncore/settings/netsystemtime/main.cpp
index dbcdc17..ef1bc8e 100644
--- a/noncore/settings/netsystemtime/main.cpp
+++ b/noncore/settings/netsystemtime/main.cpp
@@ -1,34 +1,36 @@
/*
-                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.
+                 This file is part of the Opie Project
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
*/
#include "mainwindow.h"
#include <opie2/oapplicationfactory.h>
using namespace Opie::Core;
OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index 1f9f8c3..35d4105 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -1,122 +1,124 @@
/*
- 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,
+                 This file is part of the Opie Project
+
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ 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 <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
#include <qlayout.h>
#include <qmessagebox.h>
#include <qsocket.h>
#include <qstring.h>
#include <qtimer.h>
using namespace Opie::Ui;
using namespace Opie::Core;
MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f )
: QDialog( parent, name, modal, f )
{
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 );
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)) );
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();
(void)new QPEDialogListener(this);
}
MainWindow::~MainWindow()
{
if ( ntpProcess )
delete ntpProcess;
}
void MainWindow::accept()
diff --git a/noncore/settings/netsystemtime/mainwindow.h b/noncore/settings/netsystemtime/mainwindow.h
index 8701803..0ef24e0 100644
--- a/noncore/settings/netsystemtime/mainwindow.h
+++ b/noncore/settings/netsystemtime/mainwindow.h
@@ -1,98 +1,100 @@
/*
-                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,
+                 This file is part of the Opie Project
+
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qdialog.h>
#include <opie2/oprocess.h>
#include <opie2/otabwidget.h>
class TimeTabWidget;
class FormatTabWidget;
class SettingsTabWidget;
class NTPTabWidget;
class PredictTabWidget;
class QDateTime;
class QSocket;
class QTimer;
class MainWindow : public QDialog
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, bool modal = FALSE,WFlags f = 0);
~MainWindow();
static QString appName() { return QString::fromLatin1("systemtime"); }
protected:
void accept();
void reject();
private:
Opie::Ui::OTabWidget *mainWidget;
TimeTabWidget *timeTab;
FormatTabWidget *formatTab;
SettingsTabWidget *settingsTab;
NTPTabWidget *ntpTab;
PredictTabWidget *predictTab;
bool ntpTabEnabled;
bool predictTabEnabled;
Opie::Core::OProcess *ntpProcess;
QTimer *ntpTimer;
QSocket *ntpSock;
int ntpDelay;
bool ntpInteractive;
QString ntpOutput;
int _lookupDiff;
void runNTP();
bool ntpDelayElapsed();
private slots:
void slotSetTime( const QDateTime & );
void slotQCopReceive( const QCString &, const QByteArray & );
void slotDisplayNTPTab( bool );
void slotDisplayPredictTab( bool );
void slotGetNTPTime();
void slotTimerGetNTPTime();
void slotProbeNTPServer();
void slotNtpOutput( Opie::Core::OProcess *, char *, int );
void slotNtpFinished( Opie::Core::OProcess* );
void slotNTPDelayChanged( int );
void slotCheckNtp( int );
};
#endif
diff --git a/noncore/settings/netsystemtime/ntptabwidget.cpp b/noncore/settings/netsystemtime/ntptabwidget.cpp
index 616bc22..16d21cc 100644
--- a/noncore/settings/netsystemtime/ntptabwidget.cpp
+++ b/noncore/settings/netsystemtime/ntptabwidget.cpp
@@ -1,112 +1,117 @@
/*
- 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,
+                 This file is part of the Opie Project
+
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-
*/
#include "ntptabwidget.h"
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
+
+#include <qpe/applnk.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qscrollview.h>
NTPTabWidget::NTPTabWidget( QWidget *parent )
: QWidget( parent, 0x0, 0 )
{
QVBoxLayout *tmpvb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
tmpvb->addWidget( sv, 0, 0 );
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 );
// Start time
layout->addWidget( new QLabel( tr( "Start time" ), container ), 0, 0 );
lblStartTime = new QLabel( tr( "n/a" ), container );
layout->addWidget( lblStartTime, 0, 1 );
// Time shift
layout->addWidget( new QLabel( tr( "Time shift" ), container ), 1, 0 );
lblTimeShift = new QLabel( tr( "n/a" ), container );
layout->addWidget( lblTimeShift, 1, 1 );
// New time
layout->addWidget( new QLabel( tr( "New time" ), container ), 2, 0 );
lblNewTime = new QLabel( tr( "n/a" ), container );
layout->addWidget( lblNewTime, 2, 1 );
// NTP output display
mleNtpOutput = new QMultiLineEdit( container );
QFont font( mleNtpOutput->font() );
font.setPointSize( 7 );
mleNtpOutput->setFont( font );
mleNtpOutput->setWordWrap( QMultiLineEdit::WidgetWidth );
layout->addMultiCellWidget( mleNtpOutput, 3, 3, 0, 1 );
// Set NTP time button
- m_ntpBtn = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ),
+ m_ntpBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "netsystemtime/ntptab", Opie::Core::OResource::SmallIcon ),
tr( "Get time from the network" ), container );
+ m_ntpBtn->setMinimumHeight( AppLnk::smallIconSize()+4 );
connect( m_ntpBtn, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) );
layout->addMultiCellWidget( m_ntpBtn, 4, 4, 0, 1 );
}
NTPTabWidget::~NTPTabWidget()
{
}
void NTPTabWidget::setStartTime( const QString &str )
{
lblStartTime->setText( str );
}
void NTPTabWidget::setTimeShift( const QString &str )
{
lblTimeShift->setText( str );
}
void NTPTabWidget::setNewTime( const QString &str )
{
lblNewTime->setText( str );
}
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 f05482e..a7dd02e 100644
--- a/noncore/settings/netsystemtime/ntptabwidget.h
+++ b/noncore/settings/netsystemtime/ntptabwidget.h
@@ -1,64 +1,66 @@
/*
- 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.
+                 This file is part of the Opie Project
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
*/
#ifndef NTPTABWIDGET_H
#define NTPTABWIDGET_H
#include <qwidget.h>
class QLabel;
class QMultiLineEdit;
class QPushButton;
class NTPTabWidget : public QWidget
{
Q_OBJECT
public:
NTPTabWidget( QWidget * = 0x0 );
~NTPTabWidget();
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();
};
#endif
diff --git a/noncore/settings/netsystemtime/predicttabwidget.cpp b/noncore/settings/netsystemtime/predicttabwidget.cpp
index c706add..98e0afd 100644
--- a/noncore/settings/netsystemtime/predicttabwidget.cpp
+++ b/noncore/settings/netsystemtime/predicttabwidget.cpp
@@ -1,122 +1,124 @@
/*
-                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,
+                 This file is part of the Opie Project
+
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-
*/
#include "predicttabwidget.h"
#include <qpe/config.h>
#include <qpe/timeconversion.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qscrollview.h>
#include <qtable.h>
#include <stdlib.h>
PredictTabWidget::PredictTabWidget( QWidget *parent )
: QWidget( parent, 0x0, 0 )
{
/*
QVBoxLayout *tmpvb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
tmpvb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
*/
QGridLayout *layout = new QGridLayout( this );
layout->setMargin( 2 );
layout->setSpacing( 4 );
// Predicted time drift
layout->addWidget( new QLabel( tr( "Predicted time drift" ), this ), 0, 0 );
lblDrift = new QLabel( tr( "n/a" ), this );
layout->addWidget( lblDrift, 0, 1 );
// Estimated time difference
layout->addWidget( new QLabel( tr( "Estimated shift" ), this ), 1, 0 );
lblDiff = new QLabel( tr( "n/a" ), this );
layout->addWidget( lblDiff, 1, 1 );
// Predicted time
layout->addWidget( new QLabel( tr( "Predicted time" ), this ), 2, 0 );
lblPredicted = new QLabel( tr( "n/a" ), this );
layout->addWidget( lblPredicted, 2, 1 );
// Prediction table
tblLookups = new QTable( 2, 3, this );
QFont font( tblLookups->font() );
font.setPointSize( 7 );
tblLookups->setFont( font );
tblLookups->horizontalHeader()->setLabel( 0, tr( "Shift [s/h]" ) );
tblLookups->horizontalHeader()->setLabel( 1, tr( "Last [h]" ) );
tblLookups->horizontalHeader()->setLabel( 2, tr( "Offset [s]" ) );
tblLookups->setMinimumHeight( 50 );
tblLookups->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
layout->addMultiCellWidget( tblLookups, 3, 3, 0, 1 );
// Predict time button
QPushButton *pb = new QPushButton( tr( "Predict time" ), this );
connect( pb, SIGNAL(clicked()), this, SLOT(slotPredictTime()) );
layout->addWidget( pb, 4, 0 );
// Set predicted time button
pb = new QPushButton( tr( "Set predicted time" ), this );
connect( pb, SIGNAL(clicked()), this, SLOT(slotSetPredictedTime()) );
layout->addWidget( pb, 4, 1 );
// Initialize values
Config config( "ntp" );
config.setGroup( "lookups" );
int lookupCount = config.readNumEntry( "count", 0 );
float last, shift, shiftPerSec;
tblLookups->setNumRows( lookupCount );
int cw = tblLookups->width() / 4;
cw = 50;
tblLookups->sortColumn( 0, FALSE, TRUE );
_shiftPerSec = 0;
QString grpname;
for ( int i=0; i < lookupCount; i++ )
{
grpname = "lookup_";
grpname.append( QString::number( i ) );
config.setGroup( grpname );
last = config.readEntry( "secsSinceLast", 0 ).toFloat();
shift = QString( config.readEntry( "timeShift", 0 ) ).toFloat();
shiftPerSec = shift / last;
_shiftPerSec += shiftPerSec;
tblLookups->setText( i, 0, QString::number( shiftPerSec * 60 * 60 ) );
tblLookups->setText( i, 2, QString::number( shift ) );
tblLookups->setText( i, 1, QString::number( last / ( 60 * 60 ) ) );
}
if(lookupCount)
_shiftPerSec /= lookupCount;
diff --git a/noncore/settings/netsystemtime/predicttabwidget.h b/noncore/settings/netsystemtime/predicttabwidget.h
index da1d8ed..a0f1073 100644
--- a/noncore/settings/netsystemtime/predicttabwidget.h
+++ b/noncore/settings/netsystemtime/predicttabwidget.h
@@ -1,68 +1,70 @@
/*
-                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.
+                 This file is part of the Opie Project
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
*/
#ifndef PREDICTTABWIDGET_H
#define PREDICTTABWIDGET_H
#include <qdatetime.h>
#include <qstring.h>
#include <qwidget.h>
class QLabel;
class QTable;
class PredictTabWidget : public QWidget
{
Q_OBJECT
public:
PredictTabWidget( QWidget * = 0x0 );
~PredictTabWidget();
void setShiftPerSec( int );
private:
QTable *tblLookups;
QLabel *lblDrift;
QLabel *lblDiff;
QLabel *lblPredicted;
float _shiftPerSec;
QString tz;
QDateTime predictedTime;
signals:
void setTime( const QDateTime & );
public slots:
void slotTZChanged( const QString & );
void slotPredictTime();
void slotSetPredictedTime();
};
#endif
diff --git a/noncore/settings/netsystemtime/settingstabwidget.cpp b/noncore/settings/netsystemtime/settingstabwidget.cpp
index 9315d2e..3bb0ec3 100644
--- a/noncore/settings/netsystemtime/settingstabwidget.cpp
+++ b/noncore/settings/netsystemtime/settingstabwidget.cpp
@@ -1,122 +1,124 @@
/*
-                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,
+                 This file is part of the Opie Project
+
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-
*/
#include "settingstabwidget.h"
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qscrollview.h>
#include <qspinbox.h>
SettingsTabWidget::SettingsTabWidget( QWidget *parent )
: QWidget( parent, 0x0, 0 )
{
QVBoxLayout *tmpvb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
tmpvb->addWidget( sv, 0, 0 );
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 );
// Time server selector
layout->addWidget( new QLabel( tr( "Time server" ), container ), 0, 0 );
cbTimeServer = new QComboBox( TRUE, container );
layout->addMultiCellWidget( cbTimeServer, 1, 1, 0, 1 );
// Lookup delay selector
layout->addWidget( new QLabel( tr( "minutes between time updates" ), container ), 2, 1 );
sbNtpDelay = new QSpinBox( 1, 9999999, 1, container );
sbNtpDelay->setWrapping( TRUE );
sbNtpDelay->setMaximumWidth( 50 );
connect( sbNtpDelay, SIGNAL(valueChanged(int)), this, SIGNAL(ntpDelayChanged(int)) );
layout->addWidget( sbNtpDelay, 2, 0 );
// Prediction delay selector
layout->addWidget( new QLabel( tr( "minutes between prediction updates" ), container ), 3, 1 );
sbPredictDelay = new QSpinBox( 42, 9999999, 1, container );
sbPredictDelay->setWrapping( TRUE );
sbPredictDelay->setMaximumWidth( 50 );
layout->addWidget( sbPredictDelay, 3, 0 );
// Space filler
layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 );
// Display time server information selector
chNtpTab = new QCheckBox( tr( "Display time server information" ), container );
connect( chNtpTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayNTPTab(bool) ) );
layout->addMultiCellWidget( chNtpTab, 5, 5, 0, 1 );
// Display time prediction information selector
chPredictTab = new QCheckBox( tr( "Display time prediction information" ), container );
connect( chPredictTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayPredictTab(bool) ) );
layout->addMultiCellWidget( chPredictTab, 6, 6, 0, 1 );
// Space filler
layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 );
// Initialize values
QString ntpSrvsFile = QPEApplication::qpeDir();
ntpSrvsFile.append( "etc/ntpservers" );
Config ntpSrvs( ntpSrvsFile, Config::File );
ntpSrvs.setGroup( "servers" );
int srvCount = ntpSrvs.readNumEntry( "count", 0 );
for ( int i = 0; i < srvCount; i++ )
{
ntpSrvs.setGroup( QString::number( i ) );
cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) );
}
if ( srvCount==0 ) {
cbTimeServer->insertItem( "time.fu-berlin.de" );
cbTimeServer->insertItem( "time-a.nist.gov" );
cbTimeServer->insertItem( "ntp.bri.connect.com.au" );
}
Config config( "ntp" );
config.setGroup( "settings" );
sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) );
sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) );
cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) );
chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) );
chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) );
}
SettingsTabWidget::~SettingsTabWidget()
{
}
void SettingsTabWidget::saveSettings()
{
diff --git a/noncore/settings/netsystemtime/settingstabwidget.h b/noncore/settings/netsystemtime/settingstabwidget.h
index 2901bb3..9578245 100644
--- a/noncore/settings/netsystemtime/settingstabwidget.h
+++ b/noncore/settings/netsystemtime/settingstabwidget.h
@@ -1,62 +1,64 @@
/*
-                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.
+                 This file is part of the Opie Project
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
*/
#ifndef SETTINGSTABWIDGET_H
#define SETTINGSTABWIDGET_H
#include <qwidget.h>
class QCheckBox;
class QComboBox;
class QSpinBox;
class SettingsTabWidget : public QWidget
{
Q_OBJECT
public:
SettingsTabWidget( QWidget * = 0x0 );
~SettingsTabWidget();
void saveSettings();
QString ntpServer();
private:
QComboBox *cbTimeServer;
QSpinBox *sbNtpDelay;
QSpinBox *sbPredictDelay;
QCheckBox *chNtpTab;
QCheckBox *chPredictTab;
signals:
void ntpDelayChanged( int );
void displayNTPTab( bool );
void displayPredictTab( bool );
};
#endif
diff --git a/noncore/settings/netsystemtime/timetabwidget.cpp b/noncore/settings/netsystemtime/timetabwidget.cpp
index 905461f..bcfbdf7 100644
--- a/noncore/settings/netsystemtime/timetabwidget.cpp
+++ b/noncore/settings/netsystemtime/timetabwidget.cpp
@@ -1,215 +1,221 @@
/*
- 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,
+                 This file is part of the Opie Project
+
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
-
*/
#include "timetabwidget.h"
+#include <opie2/oresource.h>
+
+#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/datebookmonth.h>
#include <qpe/global.h>
-#include <qpe/resource.h>
#include <qpe/tzselect.h>
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qcombobox.h>
#include <qdatetime.h>
#include <qframe.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qscrollview.h>
#include <qspinbox.h>
#include <stdlib.h>
#include <sys/time.h>
static const int ValueAM = 0;
static const int ValuePM = 1;
TimeTabWidget::TimeTabWidget( QWidget *parent )
: QWidget( parent, 0x0, 0 )
{
// Synchronize HW clock to systemtime
// This app will update systemtime
// - if Cancel is clicked, will reset systemtime to HW clock's time
// - if Ok is clicked, will leave systemtime as is
system("/sbin/hwclock --systohc --utc");
QVBoxLayout *tmpvb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
tmpvb->addWidget( sv, 0, 0 );
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 );
// Hours
layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 );
sbHour = new QSpinBox( container );
sbHour->setWrapping( TRUE );
layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 );
// Minutes
layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 );
sbMin = new QSpinBox( container );
sbMin->setWrapping( TRUE );
sbMin->setMinValue( 0 );
sbMin->setMaxValue( 59 );
layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 );
// AM/PM
cbAmpm = new QComboBox( container );
cbAmpm->insertItem( tr( "AM" ), ValueAM );
cbAmpm->insertItem( tr( "PM" ), ValuePM );
layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 );
// Date
layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 );
btnDate = new DateButton( TRUE, container );
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
- m_ntpBtn = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ),
+ m_ntpBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "netsystemtime/ntptab", Opie::Core::OResource::SmallIcon ),
tr( "Get time from the network" ), container );
+ m_ntpBtn->setMinimumHeight( AppLnk::smallIconSize()+4 );
connect( m_ntpBtn, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) );
layout->addMultiCellWidget( m_ntpBtn, 8, 8, 0, 5 );
// Set predicted time button
- QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ),
- container );
+ QPushButton *pb = new QPushButton( Opie::Core::OResource::loadPixmap( "netsystemtime/predicttab", Opie::Core::OResource::SmallIcon ),
+ tr( "Set predicted time" ), container );
+ pb->setMinimumHeight( AppLnk::smallIconSize()+4 );
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;
setDateTime( QDateTime::currentDateTime() );
}
TimeTabWidget::~TimeTabWidget()
{
}
void TimeTabWidget::saveSettings( bool commit )
{
if ( commit )
{
// Set timezone and announce to world
QString tz = selTimeZone->currentZone();
Config config("locale");
config.setGroup( "Location" );
config.writeEntry( "Timezone", tz );
setenv( "TZ", tz, 1 );
QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" );
setTimeZone << tz;
// If controls have a valid date & time, update systemtime
int hour = sbHour->value();
if ( use12HourTime && cbAmpm->currentItem() == ValuePM )
hour += 12;
QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) );
setSystemTime( dt );
}
else
{
// Reset systemtime to hardware clock (i.e. undo any changes made by this app)
system("/sbin/hwclock --hctosys --utc");
}
}
void TimeTabWidget::setDateTime( const QDateTime &dt )
{
// Set time
QTime t = dt.time();
if( use12HourTime )
{
int show_hour = t.hour();
if ( t.hour() >= 12 )
{
show_hour -= 12;
cbAmpm->setCurrentItem( ValuePM );
}
else
{
cbAmpm->setCurrentItem( ValueAM );
}
if ( show_hour == 0 )
show_hour = 12;
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 );
/*
* Commit the datetime to the 'hardware'
* as Global::writeHWClock() is a NOOP with Opie Alarm
diff --git a/noncore/settings/netsystemtime/timetabwidget.h b/noncore/settings/netsystemtime/timetabwidget.h
index 949535d..4674c5c8 100644
--- a/noncore/settings/netsystemtime/timetabwidget.h
+++ b/noncore/settings/netsystemtime/timetabwidget.h
@@ -1,80 +1,82 @@
/*
- 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.
+                 This file is part of the Opie Project
+ Copyright (C) Opie Team <opie-devel@handhelds.org>
+ =.
+ .=l.
+           .>+-=
+ _;:,     .>    :=|. This program is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library 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 program 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
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+:     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
*/
#ifndef TIMETABWIDGET_H
#define TIMETABWIDGET_H
#include <qwidget.h>
class DateButton;
class DateFormat;
class QComboBox;
class QDateTime;
class QPushButton;
class QSpinBox;
class TimeZoneSelector;
class TimeTabWidget : public QWidget
{
Q_OBJECT
public:
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 & );
signals:
void tzChanged( const QString & );
void getNTPTime();
void getPredictedTime();
public slots:
void slotUse12HourTime( int );
void slotDateFormatChanged( const DateFormat & );
void slotWeekStartChanged( int );
private slots:
void slotTZChanged( const QString & );
};
#endif