summaryrefslogtreecommitdiff
authordrw <drw>2005-06-15 18:52:47 (UTC)
committer drw <drw>2005-06-15 18:52:47 (UTC)
commitc93c8f75bb082c0257ce80f9e8a1eb470bdce397 (patch) (unidiff)
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,90 +1,92 @@
1/* 1/*
2                This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =. 3
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5           .>+-= 5 =.
6 _;:,     .>    :=|. This file is free software; you can 6 .=l.
7.> <`_,   >  .   <= redistribute it and/or modify it under 7           .>+-=
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8 _;:,     .>    :=|. This program is free software; you can
9.="- .-=="i,     .._ License as published by the Free Software 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11     ._= =}       : or (at your option) any later version. 11.="- .-=="i,     .._ License as published by the Free Software
12    .%`+i>       _;_. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13    .i_,=:_.      -<s. This file is distributed in the hope that 13     ._= =}       : or (at your option) any later version.
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14    .%`+i>       _;_.
15    : ..    .:,     . . . without even the implied warranty of 15    .i_,=:_.      -<s. This program is distributed in the hope that
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17 : ..    .:,     . . . without even the implied warranty of
18..}^=.=       =       ; Public License for more details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19++=   -.     .`     .: 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 :     =  ...= . :.=- You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -.   .:....=;==+<; General Public License along with this file; 21++=   -.     .`     .: details.
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22:     =  ...= . :.=-
23    --        :-=` Free Software Foundation, Inc., 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 59 Temple Place - Suite 330, 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "formattabwidget.h" 31#include "formattabwidget.h"
30 32
31#include <qpe/config.h> 33#include <qpe/config.h>
32 34
33#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 35#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
34#include <qpe/qcopenvelope_qws.h> 36#include <qpe/qcopenvelope_qws.h>
35#endif 37#endif
36 38
37#include <qcombobox.h> 39#include <qcombobox.h>
38#include <qlabel.h> 40#include <qlabel.h>
39#include <qlayout.h> 41#include <qlayout.h>
40#include <qscrollview.h> 42#include <qscrollview.h>
41#include <qtimer.h> 43#include <qtimer.h>
42 44
43FormatTabWidget::FormatTabWidget( QWidget *parent ) 45FormatTabWidget::FormatTabWidget( QWidget *parent )
44 : QWidget( parent, 0x0, 0 ) 46 : QWidget( parent, 0x0, 0 )
45{ 47{
46 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 48 QVBoxLayout *tmpvb = new QVBoxLayout( this );
47 QScrollView *sv = new QScrollView( this ); 49 QScrollView *sv = new QScrollView( this );
48 tmpvb->addWidget( sv, 0, 0 ); 50 tmpvb->addWidget( sv, 0, 0 );
49 sv->setResizePolicy( QScrollView::AutoOneFit ); 51 sv->setResizePolicy( QScrollView::AutoOneFit );
50 sv->setFrameStyle( QFrame::NoFrame ); 52 sv->setFrameStyle( QFrame::NoFrame );
51 QWidget *container = new QWidget( sv->viewport() ); 53 QWidget *container = new QWidget( sv->viewport() );
52 sv->addChild( container ); 54 sv->addChild( container );
53 55
54 QGridLayout *layout = new QGridLayout( container ); 56 QGridLayout *layout = new QGridLayout( container );
55 layout->setMargin( 2 ); 57 layout->setMargin( 2 );
56 layout->setSpacing( 4 ); 58 layout->setSpacing( 4 );
57 59
58 // Time format selector 60 // Time format selector
59 layout->addWidget( new QLabel( tr( "Time format" ), container ), 0, 0 ); 61 layout->addWidget( new QLabel( tr( "Time format" ), container ), 0, 0 );
60 cbAppletFormat = new QComboBox( container ); 62 cbAppletFormat = new QComboBox( container );
61 cbAppletFormat->insertItem( tr( "hh:mm" ), 0 ); 63 cbAppletFormat->insertItem( tr( "hh:mm" ), 0 );
62 cbAppletFormat->insertItem( tr( "D/M hh:mm" ), 1 ); 64 cbAppletFormat->insertItem( tr( "D/M hh:mm" ), 1 );
63 cbAppletFormat->insertItem( tr( "M/D hh:mm" ), 2 ); 65 cbAppletFormat->insertItem( tr( "M/D hh:mm" ), 2 );
64 layout->addWidget( cbAppletFormat, 0, 1 ); 66 layout->addWidget( cbAppletFormat, 0, 1 );
65 67
66 // 12/24 hour selector 68 // 12/24 hour selector
67 layout->addWidget( new QLabel( tr( "12/24 hour" ), container ), 1, 0 ); 69 layout->addWidget( new QLabel( tr( "12/24 hour" ), container ), 1, 0 );
68 cbAmpm = new QComboBox( container ); 70 cbAmpm = new QComboBox( container );
69 cbAmpm->insertItem( tr( "24 hour" ), 0 ); 71 cbAmpm->insertItem( tr( "24 hour" ), 0 );
70 cbAmpm->insertItem( tr( "12 hour" ), 1 ); 72 cbAmpm->insertItem( tr( "12 hour" ), 1 );
71 connect( cbAmpm, SIGNAL(activated(int)), this, SIGNAL(show12HourTime(int)) ); 73 connect( cbAmpm, SIGNAL(activated(int)), this, SIGNAL(show12HourTime(int)) );
72 layout->addWidget( cbAmpm, 1, 1 ); 74 layout->addWidget( cbAmpm, 1, 1 );
73 75
74 // Date format selector 76 // Date format selector
75 layout->addWidget( new QLabel( tr( "Date format" ), container ), 2, 0 ); 77 layout->addWidget( new QLabel( tr( "Date format" ), container ), 2, 0 );
76 cbDateFormat = new QComboBox( container ); 78 cbDateFormat = new QComboBox( container );
77 connect( cbDateFormat, SIGNAL(activated(int)), this, SLOT(slotDateFormatChanged(int)) ); 79 connect( cbDateFormat, SIGNAL(activated(int)), this, SLOT(slotDateFormatChanged(int)) );
78 layout->addWidget( cbDateFormat, 2, 1 ); 80 layout->addWidget( cbDateFormat, 2, 1 );
79 81
80 // Week starts on selector 82 // Week starts on selector
81 layout->addWidget( new QLabel( tr( "Weeks start on" ), container ), 3, 0 ); 83 layout->addWidget( new QLabel( tr( "Weeks start on" ), container ), 3, 0 );
82 cbWeekStart = new QComboBox( container ); 84 cbWeekStart = new QComboBox( container );
83 cbWeekStart->insertItem( tr( "Sunday" ), 0 ); 85 cbWeekStart->insertItem( tr( "Sunday" ), 0 );
84 cbWeekStart->insertItem( tr( "Monday" ), 1 ); 86 cbWeekStart->insertItem( tr( "Monday" ), 1 );
85 connect( cbWeekStart, SIGNAL(activated(int)), this, SIGNAL(weekStartChanged(int)) ); 87 connect( cbWeekStart, SIGNAL(activated(int)), this, SIGNAL(weekStartChanged(int)) );
86 layout->addWidget( cbWeekStart, 3, 1 ); 88 layout->addWidget( cbWeekStart, 3, 1 );
87 89
88 // Initialize values 90 // Initialize values
89 Config config( "qpe" ); 91 Config config( "qpe" );
90 config.setGroup( "Date" ); 92 config.setGroup( "Date" );
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 @@
1/* 1/*
2                This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =.
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26 3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
27*/ 29*/
28 30
29#ifndef FORMATTABWIDGET_H 31#ifndef FORMATTABWIDGET_H
30#define FORMATTABWIDGET_H 32#define FORMATTABWIDGET_H
31 33
32#include <qpe/timestring.h> 34#include <qpe/timestring.h>
33 35
34#include <qwidget.h> 36#include <qwidget.h>
35 37
36class QComboBox; 38class QComboBox;
37 39
38class FormatTabWidget : public QWidget 40class FormatTabWidget : public QWidget
39{ 41{
40 Q_OBJECT 42 Q_OBJECT
41 43
42public: 44public:
43 FormatTabWidget( QWidget * = 0x0 ); 45 FormatTabWidget( QWidget * = 0x0 );
44 ~FormatTabWidget(); 46 ~FormatTabWidget();
45 47
46 void saveSettings( bool ); 48 void saveSettings( bool );
47 49
48private: 50private:
49 QComboBox *cbAmpm; 51 QComboBox *cbAmpm;
50 QComboBox *cbWeekStart; 52 QComboBox *cbWeekStart;
51 QComboBox *cbDateFormat; 53 QComboBox *cbDateFormat;
52 QComboBox *cbAppletFormat; 54 QComboBox *cbAppletFormat;
53 DateFormat date_formats[4]; 55 DateFormat date_formats[4];
54 56
55signals: 57signals:
56 void show12HourTime( int ); 58 void show12HourTime( int );
57 void dateFormatChanged( const DateFormat & ); 59 void dateFormatChanged( const DateFormat & );
58 void weekStartChanged( int ); 60 void weekStartChanged( int );
59 61
60private slots: 62private slots:
61 void slotDateFormatChanged( int ); 63 void slotDateFormatChanged( int );
62 void sendOptions(); 64 void sendOptions();
63}; 65};
64 66
65#endif 67#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 @@
1/* 1/*
2                This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =.
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26 3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
27*/ 29*/
28 30
29#include "mainwindow.h" 31#include "mainwindow.h"
30 32
31#include <opie2/oapplicationfactory.h> 33#include <opie2/oapplicationfactory.h>
32 34
33using namespace Opie::Core; 35using namespace Opie::Core;
34OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) 36OPIE_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,90 +1,92 @@
1/* 1/*
2 This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =. 3
4 .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 .>+-= 5 =.
6_;:, .> :=|. This file is free software; you can 6 .=l.
7.> <`_, > . <= redistribute it and/or modify it under 7           .>+-=
8:`=1 )Y*s>-.-- : the terms of the GNU General Public 8 _;:,     .>    :=|. This program is free software; you can
9.="- .-=="i, .._ License as published by the Free Software 9.> <`_,   >  .   <= redistribute it and/or modify it under
10- . .-<_> .<> Foundation; either version 2 of the License, 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 ._= =} : or (at your option) any later version. 11.="- .-=="i,     .._ License as published by the Free Software
12 .%`+i> _;_. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .i_,=:_. -<s. This file is distributed in the hope that 13     ._= =}       : or (at your option) any later version.
14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 14    .%`+i>       _;_.
15 : .. .:, . . . without even the implied warranty of 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 17 : ..    .:,     . . . without even the implied warranty of
18..}^=.= = ; Public License for more details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19++= -. .` .: 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20: = ...= . :.=- You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21-. .:....=;==+<; General Public License along with this file; 21++=   -.     .`     .: details.
22 -_. . . )=. = see the file COPYING. If not, write to the 22:     =  ...= . :.=-
23 -- :-=` Free Software Foundation, Inc., 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 59 Temple Place - Suite 330, 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "mainwindow.h" 31#include "mainwindow.h"
30#include "timetabwidget.h" 32#include "timetabwidget.h"
31#include "formattabwidget.h" 33#include "formattabwidget.h"
32#include "settingstabwidget.h" 34#include "settingstabwidget.h"
33#include "ntptabwidget.h" 35#include "ntptabwidget.h"
34#include "predicttabwidget.h" 36#include "predicttabwidget.h"
35 37
36#include <qpe/config.h> 38#include <qpe/config.h>
37#include <qpe/datebookdb.h> 39#include <qpe/datebookdb.h>
38#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
39#include <qpe/qpedialog.h> 41#include <qpe/qpedialog.h>
40 42
41#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 43#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
42#include <qpe/qcopenvelope_qws.h> 44#include <qpe/qcopenvelope_qws.h>
43#endif 45#endif
44 46
45#include <qlayout.h> 47#include <qlayout.h>
46#include <qmessagebox.h> 48#include <qmessagebox.h>
47#include <qsocket.h> 49#include <qsocket.h>
48#include <qstring.h> 50#include <qstring.h>
49#include <qtimer.h> 51#include <qtimer.h>
50 52
51using namespace Opie::Ui; 53using namespace Opie::Ui;
52using namespace Opie::Core; 54using namespace Opie::Core;
53MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f ) 55MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f )
54 : QDialog( parent, name, modal, f ) 56 : QDialog( parent, name, modal, f )
55{ 57{
56 setCaption( tr( "SystemTime" ) ); 58 setCaption( tr( "SystemTime" ) );
57 59
58 QVBoxLayout *layout = new QVBoxLayout( this ); 60 QVBoxLayout *layout = new QVBoxLayout( this );
59 layout->setMargin( 2 ); 61 layout->setMargin( 2 );
60 layout->setSpacing( 4 ); 62 layout->setSpacing( 4 );
61 63
62 // Create main tabbed control 64 // Create main tabbed control
63 mainWidget = new OTabWidget( this ); 65 mainWidget = new OTabWidget( this );
64 66
65 // Default object pointers to null 67 // Default object pointers to null
66 ntpProcess = 0x0; 68 ntpProcess = 0x0;
67 ntpTab = 0x0; 69 ntpTab = 0x0;
68 70
69 // Add tab widgets 71 // Add tab widgets
70 mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) ); 72 mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) );
71 mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) ); 73 mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) );
72 mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) ); 74 mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) );
73 mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) ); 75 mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) );
74 Config config( "ntp" ); 76 Config config( "ntp" );
75 config.setGroup( "settings" ); 77 config.setGroup( "settings" );
76 slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", false ) ); 78 slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", false ) );
77 slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", false ) ); 79 slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", false ) );
78 80
79 mainWidget->setCurrentTab( tr( "Time" ) ); 81 mainWidget->setCurrentTab( tr( "Time" ) );
80 layout->addWidget( mainWidget ); 82 layout->addWidget( mainWidget );
81 83
82 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), 84 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
83 this, SLOT(slotQCopReceive(const QCString&,const QByteArray&)) ); 85 this, SLOT(slotQCopReceive(const QCString&,const QByteArray&)) );
84 86
85 87
86 // Create NTP socket 88 // Create NTP socket
87 ntpSock = new QSocket( this ); 89 ntpSock = new QSocket( this );
88 connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) ); 90 connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) );
89 slotProbeNTPServer(); 91 slotProbeNTPServer();
90 92
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,90 +1,92 @@
1/* 1/*
2                This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =. 3
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5           .>+-= 5 =.
6 _;:,     .>    :=|. This file is free software; you can 6 .=l.
7.> <`_,   >  .   <= redistribute it and/or modify it under 7           .>+-=
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8 _;:,     .>    :=|. This program is free software; you can
9.="- .-=="i,     .._ License as published by the Free Software 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11     ._= =}       : or (at your option) any later version. 11.="- .-=="i,     .._ License as published by the Free Software
12    .%`+i>       _;_. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13    .i_,=:_.      -<s. This file is distributed in the hope that 13     ._= =}       : or (at your option) any later version.
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14    .%`+i>       _;_.
15    : ..    .:,     . . . without even the implied warranty of 15    .i_,=:_.      -<s. This program is distributed in the hope that
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17 : ..    .:,     . . . without even the implied warranty of
18..}^=.=       =       ; Public License for more details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19++=   -.     .`     .: 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 :     =  ...= . :.=- You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -.   .:....=;==+<; General Public License along with this file; 21++=   -.     .`     .: details.
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22:     =  ...= . :.=-
23    --        :-=` Free Software Foundation, Inc., 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 59 Temple Place - Suite 330, 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#ifndef MAINWINDOW_H 31#ifndef MAINWINDOW_H
30#define MAINWINDOW_H 32#define MAINWINDOW_H
31 33
32#include <qdialog.h> 34#include <qdialog.h>
33 35
34#include <opie2/oprocess.h> 36#include <opie2/oprocess.h>
35#include <opie2/otabwidget.h> 37#include <opie2/otabwidget.h>
36 38
37class TimeTabWidget; 39class TimeTabWidget;
38class FormatTabWidget; 40class FormatTabWidget;
39class SettingsTabWidget; 41class SettingsTabWidget;
40class NTPTabWidget; 42class NTPTabWidget;
41class PredictTabWidget; 43class PredictTabWidget;
42 44
43 45
44class QDateTime; 46class QDateTime;
45class QSocket; 47class QSocket;
46class QTimer; 48class QTimer;
47 49
48class MainWindow : public QDialog 50class MainWindow : public QDialog
49{ 51{
50 Q_OBJECT 52 Q_OBJECT
51 53
52public: 54public:
53 MainWindow( QWidget *parent = 0, const char *name = 0, bool modal = FALSE,WFlags f = 0); 55 MainWindow( QWidget *parent = 0, const char *name = 0, bool modal = FALSE,WFlags f = 0);
54 ~MainWindow(); 56 ~MainWindow();
55 static QString appName() { return QString::fromLatin1("systemtime"); } 57 static QString appName() { return QString::fromLatin1("systemtime"); }
56 58
57protected: 59protected:
58 void accept(); 60 void accept();
59 void reject(); 61 void reject();
60 62
61private: 63private:
62 Opie::Ui::OTabWidget *mainWidget; 64 Opie::Ui::OTabWidget *mainWidget;
63 65
64 TimeTabWidget *timeTab; 66 TimeTabWidget *timeTab;
65 FormatTabWidget *formatTab; 67 FormatTabWidget *formatTab;
66 SettingsTabWidget *settingsTab; 68 SettingsTabWidget *settingsTab;
67 NTPTabWidget *ntpTab; 69 NTPTabWidget *ntpTab;
68 PredictTabWidget *predictTab; 70 PredictTabWidget *predictTab;
69 71
70 bool ntpTabEnabled; 72 bool ntpTabEnabled;
71 bool predictTabEnabled; 73 bool predictTabEnabled;
72 74
73 Opie::Core::OProcess *ntpProcess; 75 Opie::Core::OProcess *ntpProcess;
74 QTimer *ntpTimer; 76 QTimer *ntpTimer;
75 QSocket *ntpSock; 77 QSocket *ntpSock;
76 int ntpDelay; 78 int ntpDelay;
77 bool ntpInteractive; 79 bool ntpInteractive;
78 QString ntpOutput; 80 QString ntpOutput;
79 int _lookupDiff; 81 int _lookupDiff;
80 82
81 void runNTP(); 83 void runNTP();
82 bool ntpDelayElapsed(); 84 bool ntpDelayElapsed();
83 85
84private slots: 86private slots:
85 void slotSetTime( const QDateTime & ); 87 void slotSetTime( const QDateTime & );
86 void slotQCopReceive( const QCString &, const QByteArray & ); 88 void slotQCopReceive( const QCString &, const QByteArray & );
87 void slotDisplayNTPTab( bool ); 89 void slotDisplayNTPTab( bool );
88 void slotDisplayPredictTab( bool ); 90 void slotDisplayPredictTab( bool );
89 void slotGetNTPTime(); 91 void slotGetNTPTime();
90 void slotTimerGetNTPTime(); 92 void slotTimerGetNTPTime();
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 @@
1/* 1/*
2 This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =. 3
4 .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 .>+-= 5 =.
6_;:, .> :=|. This file is free software; you can 6 .=l.
7.> <`_, > . <= redistribute it and/or modify it under 7           .>+-=
8:`=1 )Y*s>-.-- : the terms of the GNU General Public 8 _;:,     .>    :=|. This program is free software; you can
9.="- .-=="i, .._ License as published by the Free Software 9.> <`_,   >  .   <= redistribute it and/or modify it under
10- . .-<_> .<> Foundation; either version 2 of the License, 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 ._= =} : or (at your option) any later version. 11.="- .-=="i,     .._ License as published by the Free Software
12 .%`+i> _;_. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .i_,=:_. -<s. This file is distributed in the hope that 13     ._= =}       : or (at your option) any later version.
14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 14    .%`+i>       _;_.
15 : .. .:, . . . without even the implied warranty of 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 17 : ..    .:,     . . . without even the implied warranty of
18..}^=.= = ; Public License for more details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19++= -. .` .: 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20: = ...= . :.=- You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21-. .:....=;==+<; General Public License along with this file; 21++=   -.     .`     .: details.
22 -_. . . )=. = see the file COPYING. If not, write to the 22:     =  ...= . :.=-
23 -- :-=` Free Software Foundation, Inc., 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 59 Temple Place - Suite 330, 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "ntptabwidget.h" 31#include "ntptabwidget.h"
30 32
31#include <qpe/resource.h> 33#include <opie2/oresource.h>
34
35#include <qpe/applnk.h>
32 36
33#include <qlabel.h> 37#include <qlabel.h>
34#include <qlayout.h> 38#include <qlayout.h>
35#include <qmultilineedit.h> 39#include <qmultilineedit.h>
36#include <qpushbutton.h> 40#include <qpushbutton.h>
37#include <qscrollview.h> 41#include <qscrollview.h>
38 42
39NTPTabWidget::NTPTabWidget( QWidget *parent ) 43NTPTabWidget::NTPTabWidget( QWidget *parent )
40 : QWidget( parent, 0x0, 0 ) 44 : QWidget( parent, 0x0, 0 )
41{ 45{
42 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 46 QVBoxLayout *tmpvb = new QVBoxLayout( this );
43 QScrollView *sv = new QScrollView( this ); 47 QScrollView *sv = new QScrollView( this );
44 tmpvb->addWidget( sv, 0, 0 ); 48 tmpvb->addWidget( sv, 0, 0 );
45 sv->setResizePolicy( QScrollView::AutoOneFit ); 49 sv->setResizePolicy( QScrollView::AutoOneFit );
46 sv->setFrameStyle( QFrame::NoFrame ); 50 sv->setFrameStyle( QFrame::NoFrame );
47 QWidget *container = new QWidget( sv->viewport() ); 51 QWidget *container = new QWidget( sv->viewport() );
48 sv->addChild( container ); 52 sv->addChild( container );
49 53
50 QGridLayout *layout = new QGridLayout( container ); 54 QGridLayout *layout = new QGridLayout( container );
51 layout->setMargin( 2 ); 55 layout->setMargin( 2 );
52 layout->setSpacing( 4 ); 56 layout->setSpacing( 4 );
53 57
54 // Start time 58 // Start time
55 layout->addWidget( new QLabel( tr( "Start time" ), container ), 0, 0 ); 59 layout->addWidget( new QLabel( tr( "Start time" ), container ), 0, 0 );
56 lblStartTime = new QLabel( tr( "n/a" ), container ); 60 lblStartTime = new QLabel( tr( "n/a" ), container );
57 layout->addWidget( lblStartTime, 0, 1 ); 61 layout->addWidget( lblStartTime, 0, 1 );
58 62
59 // Time shift 63 // Time shift
60 layout->addWidget( new QLabel( tr( "Time shift" ), container ), 1, 0 ); 64 layout->addWidget( new QLabel( tr( "Time shift" ), container ), 1, 0 );
61 lblTimeShift = new QLabel( tr( "n/a" ), container ); 65 lblTimeShift = new QLabel( tr( "n/a" ), container );
62 layout->addWidget( lblTimeShift, 1, 1 ); 66 layout->addWidget( lblTimeShift, 1, 1 );
63 67
64 // New time 68 // New time
65 layout->addWidget( new QLabel( tr( "New time" ), container ), 2, 0 ); 69 layout->addWidget( new QLabel( tr( "New time" ), container ), 2, 0 );
66 lblNewTime = new QLabel( tr( "n/a" ), container ); 70 lblNewTime = new QLabel( tr( "n/a" ), container );
67 layout->addWidget( lblNewTime, 2, 1 ); 71 layout->addWidget( lblNewTime, 2, 1 );
68 72
69 // NTP output display 73 // NTP output display
70 mleNtpOutput = new QMultiLineEdit( container ); 74 mleNtpOutput = new QMultiLineEdit( container );
71 QFont font( mleNtpOutput->font() ); 75 QFont font( mleNtpOutput->font() );
72 font.setPointSize( 7 ); 76 font.setPointSize( 7 );
73 mleNtpOutput->setFont( font ); 77 mleNtpOutput->setFont( font );
74 mleNtpOutput->setWordWrap( QMultiLineEdit::WidgetWidth ); 78 mleNtpOutput->setWordWrap( QMultiLineEdit::WidgetWidth );
75 layout->addMultiCellWidget( mleNtpOutput, 3, 3, 0, 1 ); 79 layout->addMultiCellWidget( mleNtpOutput, 3, 3, 0, 1 );
76 80
77 // Set NTP time button 81 // Set NTP time button
78 m_ntpBtn = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ), 82 m_ntpBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "netsystemtime/ntptab", Opie::Core::OResource::SmallIcon ),
79 tr( "Get time from the network" ), container ); 83 tr( "Get time from the network" ), container );
84 m_ntpBtn->setMinimumHeight( AppLnk::smallIconSize()+4 );
80 connect( m_ntpBtn, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) ); 85 connect( m_ntpBtn, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) );
81 layout->addMultiCellWidget( m_ntpBtn, 4, 4, 0, 1 ); 86 layout->addMultiCellWidget( m_ntpBtn, 4, 4, 0, 1 );
82} 87}
83 88
84NTPTabWidget::~NTPTabWidget() 89NTPTabWidget::~NTPTabWidget()
85{ 90{
86} 91}
87 92
88void NTPTabWidget::setStartTime( const QString &str ) 93void NTPTabWidget::setStartTime( const QString &str )
89{ 94{
90 lblStartTime->setText( str ); 95 lblStartTime->setText( str );
91} 96}
92 97
93void NTPTabWidget::setTimeShift( const QString &str ) 98void NTPTabWidget::setTimeShift( const QString &str )
94{ 99{
95 lblTimeShift->setText( str ); 100 lblTimeShift->setText( str );
96} 101}
97 102
98void NTPTabWidget::setNewTime( const QString &str ) 103void NTPTabWidget::setNewTime( const QString &str )
99{ 104{
100 lblNewTime->setText( str ); 105 lblNewTime->setText( str );
101} 106}
102 107
103void NTPTabWidget::addNtpOutput( const QString &str ) 108void NTPTabWidget::addNtpOutput( const QString &str )
104{ 109{
105 mleNtpOutput->append( str ); 110 mleNtpOutput->append( str );
106 mleNtpOutput->setCursorPosition( mleNtpOutput->numLines() + 1, 0, FALSE ); 111 mleNtpOutput->setCursorPosition( mleNtpOutput->numLines() + 1, 0, FALSE );
107} 112}
108 113
109void NTPTabWidget::setNTPBtnEnabled( bool enabled ) 114void NTPTabWidget::setNTPBtnEnabled( bool enabled )
110{ 115{
111 m_ntpBtn->setEnabled( enabled ); 116 m_ntpBtn->setEnabled( enabled );
112} 117}
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 @@
1/* 1/*
2 This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =.
4 .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
5 .>+-=
6_;:, .> :=|. This file is free software; you can
7.> <`_, > . <= redistribute it and/or modify it under
8:`=1 )Y*s>-.-- : the terms of the GNU General Public
9.="- .-=="i, .._ License as published by the Free Software
10- . .-<_> .<> Foundation; either version 2 of the License,
11 ._= =} : or (at your option) any later version.
12 .%`+i> _;_.
13 .i_,=:_. -<s. This file is distributed in the hope that
14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
15 : .. .:, . . . without even the implied warranty of
16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.= = ; Public License for more details.
19++= -. .` .:
20: = ...= . :.=- You should have received a copy of the GNU
21-. .:....=;==+<; General Public License along with this file;
22 -_. . . )=. = see the file COPYING. If not, write to the
23 -- :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26 3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
27*/ 29*/
28 30
29#ifndef NTPTABWIDGET_H 31#ifndef NTPTABWIDGET_H
30#define NTPTABWIDGET_H 32#define NTPTABWIDGET_H
31 33
32#include <qwidget.h> 34#include <qwidget.h>
33 35
34class QLabel; 36class QLabel;
35class QMultiLineEdit; 37class QMultiLineEdit;
36class QPushButton; 38class QPushButton;
37 39
38class NTPTabWidget : public QWidget 40class NTPTabWidget : public QWidget
39{ 41{
40 Q_OBJECT 42 Q_OBJECT
41 43
42public: 44public:
43 NTPTabWidget( QWidget * = 0x0 ); 45 NTPTabWidget( QWidget * = 0x0 );
44 ~NTPTabWidget(); 46 ~NTPTabWidget();
45 47
46 void setStartTime( const QString & ); 48 void setStartTime( const QString & );
47 void setTimeShift( const QString & ); 49 void setTimeShift( const QString & );
48 void setNewTime( const QString & ); 50 void setNewTime( const QString & );
49 void addNtpOutput( const QString & ); 51 void addNtpOutput( const QString & );
50 void setNTPBtnEnabled( bool enabled ); 52 void setNTPBtnEnabled( bool enabled );
51 53
52private: 54private:
53 QLabel *lblStartTime; 55 QLabel *lblStartTime;
54 QLabel *lblTimeShift; 56 QLabel *lblTimeShift;
55 QLabel *lblNewTime; 57 QLabel *lblNewTime;
56 QMultiLineEdit *mleNtpOutput; 58 QMultiLineEdit *mleNtpOutput;
57 QPushButton *m_ntpBtn; 59 QPushButton *m_ntpBtn;
58 60
59 61
60signals: 62signals:
61 void getNTPTime(); 63 void getNTPTime();
62}; 64};
63 65
64#endif 66#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,90 +1,92 @@
1/* 1/*
2                This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =. 3
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5           .>+-= 5 =.
6 _;:,     .>    :=|. This file is free software; you can 6 .=l.
7.> <`_,   >  .   <= redistribute it and/or modify it under 7           .>+-=
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8 _;:,     .>    :=|. This program is free software; you can
9.="- .-=="i,     .._ License as published by the Free Software 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11     ._= =}       : or (at your option) any later version. 11.="- .-=="i,     .._ License as published by the Free Software
12    .%`+i>       _;_. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13    .i_,=:_.      -<s. This file is distributed in the hope that 13     ._= =}       : or (at your option) any later version.
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14    .%`+i>       _;_.
15    : ..    .:,     . . . without even the implied warranty of 15    .i_,=:_.      -<s. This program is distributed in the hope that
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17 : ..    .:,     . . . without even the implied warranty of
18..}^=.=       =       ; Public License for more details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19++=   -.     .`     .: 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 :     =  ...= . :.=- You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -.   .:....=;==+<; General Public License along with this file; 21++=   -.     .`     .: details.
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22:     =  ...= . :.=-
23    --        :-=` Free Software Foundation, Inc., 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 59 Temple Place - Suite 330, 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "predicttabwidget.h" 31#include "predicttabwidget.h"
30 32
31#include <qpe/config.h> 33#include <qpe/config.h>
32#include <qpe/timeconversion.h> 34#include <qpe/timeconversion.h>
33 35
34#include <qlabel.h> 36#include <qlabel.h>
35#include <qlayout.h> 37#include <qlayout.h>
36#include <qpushbutton.h> 38#include <qpushbutton.h>
37#include <qscrollview.h> 39#include <qscrollview.h>
38#include <qtable.h> 40#include <qtable.h>
39 41
40#include <stdlib.h> 42#include <stdlib.h>
41 43
42PredictTabWidget::PredictTabWidget( QWidget *parent ) 44PredictTabWidget::PredictTabWidget( QWidget *parent )
43 : QWidget( parent, 0x0, 0 ) 45 : QWidget( parent, 0x0, 0 )
44{ 46{
45/* 47/*
46 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 48 QVBoxLayout *tmpvb = new QVBoxLayout( this );
47 QScrollView *sv = new QScrollView( this ); 49 QScrollView *sv = new QScrollView( this );
48 tmpvb->addWidget( sv, 0, 0 ); 50 tmpvb->addWidget( sv, 0, 0 );
49 sv->setResizePolicy( QScrollView::AutoOneFit ); 51 sv->setResizePolicy( QScrollView::AutoOneFit );
50 sv->setFrameStyle( QFrame::NoFrame ); 52 sv->setFrameStyle( QFrame::NoFrame );
51 QWidget *container = new QWidget( sv->viewport() ); 53 QWidget *container = new QWidget( sv->viewport() );
52 sv->addChild( container ); 54 sv->addChild( container );
53*/ 55*/
54 56
55 QGridLayout *layout = new QGridLayout( this ); 57 QGridLayout *layout = new QGridLayout( this );
56 layout->setMargin( 2 ); 58 layout->setMargin( 2 );
57 layout->setSpacing( 4 ); 59 layout->setSpacing( 4 );
58 60
59 // Predicted time drift 61 // Predicted time drift
60 layout->addWidget( new QLabel( tr( "Predicted time drift" ), this ), 0, 0 ); 62 layout->addWidget( new QLabel( tr( "Predicted time drift" ), this ), 0, 0 );
61 lblDrift = new QLabel( tr( "n/a" ), this ); 63 lblDrift = new QLabel( tr( "n/a" ), this );
62 layout->addWidget( lblDrift, 0, 1 ); 64 layout->addWidget( lblDrift, 0, 1 );
63 65
64 // Estimated time difference 66 // Estimated time difference
65 layout->addWidget( new QLabel( tr( "Estimated shift" ), this ), 1, 0 ); 67 layout->addWidget( new QLabel( tr( "Estimated shift" ), this ), 1, 0 );
66 lblDiff = new QLabel( tr( "n/a" ), this ); 68 lblDiff = new QLabel( tr( "n/a" ), this );
67 layout->addWidget( lblDiff, 1, 1 ); 69 layout->addWidget( lblDiff, 1, 1 );
68 70
69 // Predicted time 71 // Predicted time
70 layout->addWidget( new QLabel( tr( "Predicted time" ), this ), 2, 0 ); 72 layout->addWidget( new QLabel( tr( "Predicted time" ), this ), 2, 0 );
71 lblPredicted = new QLabel( tr( "n/a" ), this ); 73 lblPredicted = new QLabel( tr( "n/a" ), this );
72 layout->addWidget( lblPredicted, 2, 1 ); 74 layout->addWidget( lblPredicted, 2, 1 );
73 75
74 // Prediction table 76 // Prediction table
75 tblLookups = new QTable( 2, 3, this ); 77 tblLookups = new QTable( 2, 3, this );
76 QFont font( tblLookups->font() ); 78 QFont font( tblLookups->font() );
77 font.setPointSize( 7 ); 79 font.setPointSize( 7 );
78 tblLookups->setFont( font ); 80 tblLookups->setFont( font );
79 tblLookups->horizontalHeader()->setLabel( 0, tr( "Shift [s/h]" ) ); 81 tblLookups->horizontalHeader()->setLabel( 0, tr( "Shift [s/h]" ) );
80 tblLookups->horizontalHeader()->setLabel( 1, tr( "Last [h]" ) ); 82 tblLookups->horizontalHeader()->setLabel( 1, tr( "Last [h]" ) );
81 tblLookups->horizontalHeader()->setLabel( 2, tr( "Offset [s]" ) ); 83 tblLookups->horizontalHeader()->setLabel( 2, tr( "Offset [s]" ) );
82 84
83 tblLookups->setMinimumHeight( 50 ); 85 tblLookups->setMinimumHeight( 50 );
84 tblLookups->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) ); 86 tblLookups->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
85 layout->addMultiCellWidget( tblLookups, 3, 3, 0, 1 ); 87 layout->addMultiCellWidget( tblLookups, 3, 3, 0, 1 );
86 88
87 // Predict time button 89 // Predict time button
88 QPushButton *pb = new QPushButton( tr( "Predict time" ), this ); 90 QPushButton *pb = new QPushButton( tr( "Predict time" ), this );
89 connect( pb, SIGNAL(clicked()), this, SLOT(slotPredictTime()) ); 91 connect( pb, SIGNAL(clicked()), this, SLOT(slotPredictTime()) );
90 layout->addWidget( pb, 4, 0 ); 92 layout->addWidget( pb, 4, 0 );
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 @@
1/* 1/*
2                This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =.
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26 3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
27*/ 29*/
28 30
29#ifndef PREDICTTABWIDGET_H 31#ifndef PREDICTTABWIDGET_H
30#define PREDICTTABWIDGET_H 32#define PREDICTTABWIDGET_H
31 33
32#include <qdatetime.h> 34#include <qdatetime.h>
33#include <qstring.h> 35#include <qstring.h>
34#include <qwidget.h> 36#include <qwidget.h>
35 37
36class QLabel; 38class QLabel;
37class QTable; 39class QTable;
38 40
39class PredictTabWidget : public QWidget 41class PredictTabWidget : public QWidget
40{ 42{
41 Q_OBJECT 43 Q_OBJECT
42 44
43public: 45public:
44 PredictTabWidget( QWidget * = 0x0 ); 46 PredictTabWidget( QWidget * = 0x0 );
45 ~PredictTabWidget(); 47 ~PredictTabWidget();
46 48
47 void setShiftPerSec( int ); 49 void setShiftPerSec( int );
48 50
49private: 51private:
50 QTable *tblLookups; 52 QTable *tblLookups;
51 QLabel *lblDrift; 53 QLabel *lblDrift;
52 QLabel *lblDiff; 54 QLabel *lblDiff;
53 QLabel *lblPredicted; 55 QLabel *lblPredicted;
54 56
55 float _shiftPerSec; 57 float _shiftPerSec;
56 QString tz; 58 QString tz;
57 QDateTime predictedTime; 59 QDateTime predictedTime;
58 60
59signals: 61signals:
60 void setTime( const QDateTime & ); 62 void setTime( const QDateTime & );
61 63
62public slots: 64public slots:
63 void slotTZChanged( const QString & ); 65 void slotTZChanged( const QString & );
64 void slotPredictTime(); 66 void slotPredictTime();
65 void slotSetPredictedTime(); 67 void slotSetPredictedTime();
66}; 68};
67 69
68#endif 70#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,90 +1,92 @@
1/* 1/*
2                This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =. 3
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5           .>+-= 5 =.
6 _;:,     .>    :=|. This file is free software; you can 6 .=l.
7.> <`_,   >  .   <= redistribute it and/or modify it under 7           .>+-=
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8 _;:,     .>    :=|. This program is free software; you can
9.="- .-=="i,     .._ License as published by the Free Software 9.> <`_,   >  .   <= redistribute it and/or modify it under
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11     ._= =}       : or (at your option) any later version. 11.="- .-=="i,     .._ License as published by the Free Software
12    .%`+i>       _;_. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13    .i_,=:_.      -<s. This file is distributed in the hope that 13     ._= =}       : or (at your option) any later version.
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14    .%`+i>       _;_.
15    : ..    .:,     . . . without even the implied warranty of 15    .i_,=:_.      -<s. This program is distributed in the hope that
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17 : ..    .:,     . . . without even the implied warranty of
18..}^=.=       =       ; Public License for more details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19++=   -.     .`     .: 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20 :     =  ...= . :.=- You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21 -.   .:....=;==+<; General Public License along with this file; 21++=   -.     .`     .: details.
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22:     =  ...= . :.=-
23    --        :-=` Free Software Foundation, Inc., 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 59 Temple Place - Suite 330, 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "settingstabwidget.h" 31#include "settingstabwidget.h"
30 32
31#include <qpe/config.h> 33#include <qpe/config.h>
32#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
33 35
34#include <qcheckbox.h> 36#include <qcheckbox.h>
35#include <qcombobox.h> 37#include <qcombobox.h>
36#include <qlabel.h> 38#include <qlabel.h>
37#include <qlayout.h> 39#include <qlayout.h>
38#include <qscrollview.h> 40#include <qscrollview.h>
39#include <qspinbox.h> 41#include <qspinbox.h>
40 42
41SettingsTabWidget::SettingsTabWidget( QWidget *parent ) 43SettingsTabWidget::SettingsTabWidget( QWidget *parent )
42 : QWidget( parent, 0x0, 0 ) 44 : QWidget( parent, 0x0, 0 )
43{ 45{
44 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 46 QVBoxLayout *tmpvb = new QVBoxLayout( this );
45 QScrollView *sv = new QScrollView( this ); 47 QScrollView *sv = new QScrollView( this );
46 tmpvb->addWidget( sv, 0, 0 ); 48 tmpvb->addWidget( sv, 0, 0 );
47 sv->setResizePolicy( QScrollView::AutoOneFit ); 49 sv->setResizePolicy( QScrollView::AutoOneFit );
48 sv->setFrameStyle( QFrame::NoFrame ); 50 sv->setFrameStyle( QFrame::NoFrame );
49 QWidget *container = new QWidget( sv->viewport() ); 51 QWidget *container = new QWidget( sv->viewport() );
50 sv->addChild( container ); 52 sv->addChild( container );
51 53
52 QGridLayout *layout = new QGridLayout( container ); 54 QGridLayout *layout = new QGridLayout( container );
53 layout->setMargin( 2 ); 55 layout->setMargin( 2 );
54 layout->setSpacing( 4 ); 56 layout->setSpacing( 4 );
55 57
56 // Time server selector 58 // Time server selector
57 layout->addWidget( new QLabel( tr( "Time server" ), container ), 0, 0 ); 59 layout->addWidget( new QLabel( tr( "Time server" ), container ), 0, 0 );
58 cbTimeServer = new QComboBox( TRUE, container ); 60 cbTimeServer = new QComboBox( TRUE, container );
59 layout->addMultiCellWidget( cbTimeServer, 1, 1, 0, 1 ); 61 layout->addMultiCellWidget( cbTimeServer, 1, 1, 0, 1 );
60 62
61 // Lookup delay selector 63 // Lookup delay selector
62 layout->addWidget( new QLabel( tr( "minutes between time updates" ), container ), 2, 1 ); 64 layout->addWidget( new QLabel( tr( "minutes between time updates" ), container ), 2, 1 );
63 sbNtpDelay = new QSpinBox( 1, 9999999, 1, container ); 65 sbNtpDelay = new QSpinBox( 1, 9999999, 1, container );
64 sbNtpDelay->setWrapping( TRUE ); 66 sbNtpDelay->setWrapping( TRUE );
65 sbNtpDelay->setMaximumWidth( 50 ); 67 sbNtpDelay->setMaximumWidth( 50 );
66 connect( sbNtpDelay, SIGNAL(valueChanged(int)), this, SIGNAL(ntpDelayChanged(int)) ); 68 connect( sbNtpDelay, SIGNAL(valueChanged(int)), this, SIGNAL(ntpDelayChanged(int)) );
67 layout->addWidget( sbNtpDelay, 2, 0 ); 69 layout->addWidget( sbNtpDelay, 2, 0 );
68 70
69 // Prediction delay selector 71 // Prediction delay selector
70 layout->addWidget( new QLabel( tr( "minutes between prediction updates" ), container ), 3, 1 ); 72 layout->addWidget( new QLabel( tr( "minutes between prediction updates" ), container ), 3, 1 );
71 sbPredictDelay = new QSpinBox( 42, 9999999, 1, container ); 73 sbPredictDelay = new QSpinBox( 42, 9999999, 1, container );
72 sbPredictDelay->setWrapping( TRUE ); 74 sbPredictDelay->setWrapping( TRUE );
73 sbPredictDelay->setMaximumWidth( 50 ); 75 sbPredictDelay->setMaximumWidth( 50 );
74 layout->addWidget( sbPredictDelay, 3, 0 ); 76 layout->addWidget( sbPredictDelay, 3, 0 );
75 77
76 // Space filler 78 // Space filler
77 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 ); 79 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 4, 0 );
78 80
79 // Display time server information selector 81 // Display time server information selector
80 chNtpTab = new QCheckBox( tr( "Display time server information" ), container ); 82 chNtpTab = new QCheckBox( tr( "Display time server information" ), container );
81 connect( chNtpTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayNTPTab(bool) ) ); 83 connect( chNtpTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayNTPTab(bool) ) );
82 layout->addMultiCellWidget( chNtpTab, 5, 5, 0, 1 ); 84 layout->addMultiCellWidget( chNtpTab, 5, 5, 0, 1 );
83 85
84 // Display time prediction information selector 86 // Display time prediction information selector
85 chPredictTab = new QCheckBox( tr( "Display time prediction information" ), container ); 87 chPredictTab = new QCheckBox( tr( "Display time prediction information" ), container );
86 connect( chPredictTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayPredictTab(bool) ) ); 88 connect( chPredictTab, SIGNAL( toggled(bool) ), this, SIGNAL( displayPredictTab(bool) ) );
87 layout->addMultiCellWidget( chPredictTab, 6, 6, 0, 1 ); 89 layout->addMultiCellWidget( chPredictTab, 6, 6, 0, 1 );
88 90
89 // Space filler 91 // Space filler
90 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); 92 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 );
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 @@
1/* 1/*
2                This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =.
4             .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26 3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
27*/ 29*/
28 30
29#ifndef SETTINGSTABWIDGET_H 31#ifndef SETTINGSTABWIDGET_H
30#define SETTINGSTABWIDGET_H 32#define SETTINGSTABWIDGET_H
31 33
32#include <qwidget.h> 34#include <qwidget.h>
33 35
34class QCheckBox; 36class QCheckBox;
35class QComboBox; 37class QComboBox;
36class QSpinBox; 38class QSpinBox;
37 39
38class SettingsTabWidget : public QWidget 40class SettingsTabWidget : public QWidget
39{ 41{
40 Q_OBJECT 42 Q_OBJECT
41 43
42public: 44public:
43 SettingsTabWidget( QWidget * = 0x0 ); 45 SettingsTabWidget( QWidget * = 0x0 );
44 ~SettingsTabWidget(); 46 ~SettingsTabWidget();
45 47
46 void saveSettings(); 48 void saveSettings();
47 QString ntpServer(); 49 QString ntpServer();
48 50
49private: 51private:
50 QComboBox *cbTimeServer; 52 QComboBox *cbTimeServer;
51 QSpinBox *sbNtpDelay; 53 QSpinBox *sbNtpDelay;
52 QSpinBox *sbPredictDelay; 54 QSpinBox *sbPredictDelay;
53 QCheckBox *chNtpTab; 55 QCheckBox *chNtpTab;
54 QCheckBox *chPredictTab; 56 QCheckBox *chPredictTab;
55 57
56signals: 58signals:
57 void ntpDelayChanged( int ); 59 void ntpDelayChanged( int );
58 void displayNTPTab( bool ); 60 void displayNTPTab( bool );
59 void displayPredictTab( bool ); 61 void displayPredictTab( bool );
60}; 62};
61 63
62#endif 64#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,183 +1,189 @@
1/* 1/*
2 This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =. 3
4 .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> 4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 .>+-= 5 =.
6_;:, .> :=|. This file is free software; you can 6 .=l.
7.> <`_, > . <= redistribute it and/or modify it under 7           .>+-=
8:`=1 )Y*s>-.-- : the terms of the GNU General Public 8 _;:,     .>    :=|. This program is free software; you can
9.="- .-=="i, .._ License as published by the Free Software 9.> <`_,   >  .   <= redistribute it and/or modify it under
10- . .-<_> .<> Foundation; either version 2 of the License, 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 ._= =} : or (at your option) any later version. 11.="- .-=="i,     .._ License as published by the Free Software
12 .%`+i> _;_. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .i_,=:_. -<s. This file is distributed in the hope that 13     ._= =}       : or (at your option) any later version.
14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 14    .%`+i>       _;_.
15 : .. .:, . . . without even the implied warranty of 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 17 : ..    .:,     . . . without even the implied warranty of
18..}^=.= = ; Public License for more details. 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19++= -. .` .: 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20: = ...= . :.=- You should have received a copy of the GNU 20..}^=.=       =       ; Library General Public License for more
21-. .:....=;==+<; General Public License along with this file; 21++=   -.     .`     .: details.
22 -_. . . )=. = see the file COPYING. If not, write to the 22:     =  ...= . :.=-
23 -- :-=` Free Software Foundation, Inc., 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 59 Temple Place - Suite 330, 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
26
27*/ 29*/
28 30
29#include "timetabwidget.h" 31#include "timetabwidget.h"
30 32
33#include <opie2/oresource.h>
34
35#include <qpe/applnk.h>
31#include <qpe/config.h> 36#include <qpe/config.h>
32#include <qpe/datebookmonth.h> 37#include <qpe/datebookmonth.h>
33#include <qpe/global.h> 38#include <qpe/global.h>
34#include <qpe/resource.h>
35#include <qpe/tzselect.h> 39#include <qpe/tzselect.h>
36 40
37#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 41#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
38#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
39#endif 43#endif
40 44
41#include <qcombobox.h> 45#include <qcombobox.h>
42#include <qdatetime.h> 46#include <qdatetime.h>
43#include <qframe.h> 47#include <qframe.h>
44#include <qlabel.h> 48#include <qlabel.h>
45#include <qlayout.h> 49#include <qlayout.h>
46#include <qpushbutton.h> 50#include <qpushbutton.h>
47#include <qscrollview.h> 51#include <qscrollview.h>
48#include <qspinbox.h> 52#include <qspinbox.h>
49 53
50#include <stdlib.h> 54#include <stdlib.h>
51#include <sys/time.h> 55#include <sys/time.h>
52 56
53static const int ValueAM = 0; 57static const int ValueAM = 0;
54static const int ValuePM = 1; 58static const int ValuePM = 1;
55 59
56TimeTabWidget::TimeTabWidget( QWidget *parent ) 60TimeTabWidget::TimeTabWidget( QWidget *parent )
57 : QWidget( parent, 0x0, 0 ) 61 : QWidget( parent, 0x0, 0 )
58{ 62{
59 // Synchronize HW clock to systemtime 63 // Synchronize HW clock to systemtime
60 // This app will update systemtime 64 // This app will update systemtime
61 // - if Cancel is clicked, will reset systemtime to HW clock's time 65 // - if Cancel is clicked, will reset systemtime to HW clock's time
62 // - if Ok is clicked, will leave systemtime as is 66 // - if Ok is clicked, will leave systemtime as is
63 system("/sbin/hwclock --systohc --utc"); 67 system("/sbin/hwclock --systohc --utc");
64 68
65 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 69 QVBoxLayout *tmpvb = new QVBoxLayout( this );
66 QScrollView *sv = new QScrollView( this ); 70 QScrollView *sv = new QScrollView( this );
67 tmpvb->addWidget( sv, 0, 0 ); 71 tmpvb->addWidget( sv, 0, 0 );
68 sv->setResizePolicy( QScrollView::AutoOneFit ); 72 sv->setResizePolicy( QScrollView::AutoOneFit );
69 sv->setFrameStyle( QFrame::NoFrame ); 73 sv->setFrameStyle( QFrame::NoFrame );
70 QWidget *container = new QWidget( sv->viewport() ); 74 QWidget *container = new QWidget( sv->viewport() );
71 sv->addChild( container ); 75 sv->addChild( container );
72 76
73 QGridLayout *layout = new QGridLayout( container ); 77 QGridLayout *layout = new QGridLayout( container );
74 layout->setMargin( 2 ); 78 layout->setMargin( 2 );
75 layout->setSpacing( 4 ); 79 layout->setSpacing( 4 );
76 80
77 // Hours 81 // Hours
78 layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 ); 82 layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 );
79 sbHour = new QSpinBox( container ); 83 sbHour = new QSpinBox( container );
80 sbHour->setWrapping( TRUE ); 84 sbHour->setWrapping( TRUE );
81 layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 ); 85 layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 );
82 86
83 // Minutes 87 // Minutes
84 layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 ); 88 layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 );
85 sbMin = new QSpinBox( container ); 89 sbMin = new QSpinBox( container );
86 sbMin->setWrapping( TRUE ); 90 sbMin->setWrapping( TRUE );
87 sbMin->setMinValue( 0 ); 91 sbMin->setMinValue( 0 );
88 sbMin->setMaxValue( 59 ); 92 sbMin->setMaxValue( 59 );
89 layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 ); 93 layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 );
90 94
91 // AM/PM 95 // AM/PM
92 cbAmpm = new QComboBox( container ); 96 cbAmpm = new QComboBox( container );
93 cbAmpm->insertItem( tr( "AM" ), ValueAM ); 97 cbAmpm->insertItem( tr( "AM" ), ValueAM );
94 cbAmpm->insertItem( tr( "PM" ), ValuePM ); 98 cbAmpm->insertItem( tr( "PM" ), ValuePM );
95 layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 ); 99 layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 );
96 100
97 // Date 101 // Date
98 layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 ); 102 layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 );
99 btnDate = new DateButton( TRUE, container ); 103 btnDate = new DateButton( TRUE, container );
100 layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 ); 104 layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 );
101 105
102 // Timezone 106 // Timezone
103 layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 ); 107 layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 );
104 selTimeZone = new TimeZoneSelector( container ); 108 selTimeZone = new TimeZoneSelector( container );
105 connect( selTimeZone, SIGNAL(signalNewTz(const QString&)), this, SLOT(slotTZChanged(const QString&)) ); 109 connect( selTimeZone, SIGNAL(signalNewTz(const QString&)), this, SLOT(slotTZChanged(const QString&)) );
106 layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 ); 110 layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 );
107 111
108 // Space filler 112 // Space filler
109 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); 113 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 );
110 114
111 // Set NTP time button 115 // Set NTP time button
112 m_ntpBtn = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ), 116 m_ntpBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "netsystemtime/ntptab", Opie::Core::OResource::SmallIcon ),
113 tr( "Get time from the network" ), container ); 117 tr( "Get time from the network" ), container );
118 m_ntpBtn->setMinimumHeight( AppLnk::smallIconSize()+4 );
114 connect( m_ntpBtn, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) ); 119 connect( m_ntpBtn, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) );
115 layout->addMultiCellWidget( m_ntpBtn, 8, 8, 0, 5 ); 120 layout->addMultiCellWidget( m_ntpBtn, 8, 8, 0, 5 );
116 121
117 // Set predicted time button 122 // Set predicted time button
118 QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ), 123 QPushButton *pb = new QPushButton( Opie::Core::OResource::loadPixmap( "netsystemtime/predicttab", Opie::Core::OResource::SmallIcon ),
119 container ); 124 tr( "Set predicted time" ), container );
125 pb->setMinimumHeight( AppLnk::smallIconSize()+4 );
120 connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) ); 126 connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) );
121 layout->addMultiCellWidget( pb, 9, 9, 0, 5 ); 127 layout->addMultiCellWidget( pb, 9, 9, 0, 5 );
122 128
123 // Space filler at bottom of widget 129 // Space filler at bottom of widget
124 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 ); 130 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 );
125 131
126 // Initialize values 132 // Initialize values
127 Config config( "locale" ); 133 Config config( "locale" );
128 config.setGroup( "Location" ); 134 config.setGroup( "Location" );
129 selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) ); 135 selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) );
130 use12HourTime = FALSE; 136 use12HourTime = FALSE;
131 setDateTime( QDateTime::currentDateTime() ); 137 setDateTime( QDateTime::currentDateTime() );
132} 138}
133 139
134TimeTabWidget::~TimeTabWidget() 140TimeTabWidget::~TimeTabWidget()
135{ 141{
136} 142}
137 143
138void TimeTabWidget::saveSettings( bool commit ) 144void TimeTabWidget::saveSettings( bool commit )
139{ 145{
140 if ( commit ) 146 if ( commit )
141 { 147 {
142 // Set timezone and announce to world 148 // Set timezone and announce to world
143 QString tz = selTimeZone->currentZone(); 149 QString tz = selTimeZone->currentZone();
144 Config config("locale"); 150 Config config("locale");
145 config.setGroup( "Location" ); 151 config.setGroup( "Location" );
146 config.writeEntry( "Timezone", tz ); 152 config.writeEntry( "Timezone", tz );
147 setenv( "TZ", tz, 1 ); 153 setenv( "TZ", tz, 1 );
148 QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); 154 QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" );
149 setTimeZone << tz; 155 setTimeZone << tz;
150 156
151 // If controls have a valid date & time, update systemtime 157 // If controls have a valid date & time, update systemtime
152 int hour = sbHour->value(); 158 int hour = sbHour->value();
153 if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) 159 if ( use12HourTime && cbAmpm->currentItem() == ValuePM )
154 hour += 12; 160 hour += 12;
155 QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) ); 161 QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) );
156 setSystemTime( dt ); 162 setSystemTime( dt );
157 } 163 }
158 else 164 else
159 { 165 {
160 // Reset systemtime to hardware clock (i.e. undo any changes made by this app) 166 // Reset systemtime to hardware clock (i.e. undo any changes made by this app)
161 system("/sbin/hwclock --hctosys --utc"); 167 system("/sbin/hwclock --hctosys --utc");
162 } 168 }
163} 169}
164 170
165void TimeTabWidget::setDateTime( const QDateTime &dt ) 171void TimeTabWidget::setDateTime( const QDateTime &dt )
166{ 172{
167 // Set time 173 // Set time
168 QTime t = dt.time(); 174 QTime t = dt.time();
169 if( use12HourTime ) 175 if( use12HourTime )
170 { 176 {
171 int show_hour = t.hour(); 177 int show_hour = t.hour();
172 if ( t.hour() >= 12 ) 178 if ( t.hour() >= 12 )
173 { 179 {
174 show_hour -= 12; 180 show_hour -= 12;
175 cbAmpm->setCurrentItem( ValuePM ); 181 cbAmpm->setCurrentItem( ValuePM );
176 } 182 }
177 else 183 else
178 { 184 {
179 cbAmpm->setCurrentItem( ValueAM ); 185 cbAmpm->setCurrentItem( ValueAM );
180 } 186 }
181 if ( show_hour == 0 ) 187 if ( show_hour == 0 )
182 show_hour = 12; 188 show_hour = 12;
183 sbHour->setValue( show_hour ); 189 sbHour->setValue( show_hour );
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 @@
1/* 1/*
2 This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 =.
4 .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?>
5 .>+-=
6_;:, .> :=|. This file is free software; you can
7.> <`_, > . <= redistribute it and/or modify it under
8:`=1 )Y*s>-.-- : the terms of the GNU General Public
9.="- .-=="i, .._ License as published by the Free Software
10- . .-<_> .<> Foundation; either version 2 of the License,
11 ._= =} : or (at your option) any later version.
12 .%`+i> _;_.
13 .i_,=:_. -<s. This file is distributed in the hope that
14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
15 : .. .:, . . . without even the implied warranty of
16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.= = ; Public License for more details.
19++= -. .` .:
20: = ...= . :.=- You should have received a copy of the GNU
21-. .:....=;==+<; General Public License along with this file;
22 -_. . . )=. = see the file COPYING. If not, write to the
23 -- :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26 3
4 Copyright (C) Opie Team <opie-devel@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22:     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
27*/ 29*/
28 30
29#ifndef TIMETABWIDGET_H 31#ifndef TIMETABWIDGET_H
30#define TIMETABWIDGET_H 32#define TIMETABWIDGET_H
31 33
32#include <qwidget.h> 34#include <qwidget.h>
33 35
34class DateButton; 36class DateButton;
35class DateFormat; 37class DateFormat;
36class QComboBox; 38class QComboBox;
37class QDateTime; 39class QDateTime;
38class QPushButton; 40class QPushButton;
39class QSpinBox; 41class QSpinBox;
40class TimeZoneSelector; 42class TimeZoneSelector;
41 43
42class TimeTabWidget : public QWidget 44class TimeTabWidget : public QWidget
43{ 45{
44 Q_OBJECT 46 Q_OBJECT
45 47
46public: 48public:
47 TimeTabWidget( QWidget * = 0l ); 49 TimeTabWidget( QWidget * = 0l );
48 ~TimeTabWidget(); 50 ~TimeTabWidget();
49 51
50 void saveSettings( bool ); 52 void saveSettings( bool );
51 void setDateTime( const QDateTime & ); 53 void setDateTime( const QDateTime & );
52 void setNTPBtnEnabled( bool enabled ); 54 void setNTPBtnEnabled( bool enabled );
53 55
54private: 56private:
55 QSpinBox *sbHour; 57 QSpinBox *sbHour;
56 QSpinBox *sbMin; 58 QSpinBox *sbMin;
57 QComboBox *cbAmpm; 59 QComboBox *cbAmpm;
58 DateButton *btnDate; 60 DateButton *btnDate;
59 TimeZoneSelector *selTimeZone; 61 TimeZoneSelector *selTimeZone;
60 QPushButton *m_ntpBtn; 62 QPushButton *m_ntpBtn;
61 63
62 bool use12HourTime; 64 bool use12HourTime;
63 65
64 void setSystemTime( const QDateTime & ); 66 void setSystemTime( const QDateTime & );
65 67
66signals: 68signals:
67 void tzChanged( const QString & ); 69 void tzChanged( const QString & );
68 void getNTPTime(); 70 void getNTPTime();
69 void getPredictedTime(); 71 void getPredictedTime();
70 72
71public slots: 73public slots:
72 void slotUse12HourTime( int ); 74 void slotUse12HourTime( int );
73 void slotDateFormatChanged( const DateFormat & ); 75 void slotDateFormatChanged( const DateFormat & );
74 void slotWeekStartChanged( int ); 76 void slotWeekStartChanged( int );
75 77
76private slots: 78private slots:
77 void slotTZChanged( const QString & ); 79 void slotTZChanged( const QString & );
78}; 80};
79 81
80#endif 82#endif