summaryrefslogtreecommitdiff
Unidiff
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,154 +1,156 @@
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" );
91 cbAppletFormat->setCurrentItem( config.readNumEntry( "ClockApplet", 0 ) ); 93 cbAppletFormat->setCurrentItem( config.readNumEntry( "ClockApplet", 0 ) );
92 94
93 DateFormat df(QChar(config.readEntry("Separator", "/")[0]), 95 DateFormat df(QChar(config.readEntry("Separator", "/")[0]),
94 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), 96 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear),
95 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); 97 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear));
96 98
97 int currentdf = 0; 99 int currentdf = 0;
98 date_formats[0] = DateFormat( '/', DateFormat::MonthDayYear ); 100 date_formats[0] = DateFormat( '/', DateFormat::MonthDayYear );
99 cbDateFormat->insertItem( tr( date_formats[0].toNumberString() ) ); 101 cbDateFormat->insertItem( tr( date_formats[0].toNumberString() ) );
100 date_formats[1] = DateFormat( '.', DateFormat::DayMonthYear ); 102 date_formats[1] = DateFormat( '.', DateFormat::DayMonthYear );
101 if ( df == date_formats[1] ) 103 if ( df == date_formats[1] )
102 currentdf = 1; 104 currentdf = 1;
103 cbDateFormat->insertItem( tr( date_formats[1].toNumberString() ) ); 105 cbDateFormat->insertItem( tr( date_formats[1].toNumberString() ) );
104 date_formats[2] = DateFormat( '-', DateFormat::YearMonthDay, DateFormat::DayMonthYear ); 106 date_formats[2] = DateFormat( '-', DateFormat::YearMonthDay, DateFormat::DayMonthYear );
105 if ( df == date_formats[2] ) 107 if ( df == date_formats[2] )
106 currentdf = 2; 108 currentdf = 2;
107 cbDateFormat->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601 109 cbDateFormat->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601
108 date_formats[3] = DateFormat( '/', DateFormat::DayMonthYear ); 110 date_formats[3] = DateFormat( '/', DateFormat::DayMonthYear );
109 if ( df == date_formats[3] ) 111 if ( df == date_formats[3] )
110 currentdf = 3; 112 currentdf = 3;
111 cbDateFormat->insertItem( tr( date_formats[3].toNumberString() ) ); 113 cbDateFormat->insertItem( tr( date_formats[3].toNumberString() ) );
112 114
113 cbDateFormat->setCurrentItem( currentdf ); 115 cbDateFormat->setCurrentItem( currentdf );
114 //dateButton->setDateFormat( df ); 116 //dateButton->setDateFormat( df );
115 117
116 config.setGroup( "Time" ); 118 config.setGroup( "Time" );
117 cbAmpm->setCurrentItem( config.readBoolEntry( "AMPM", FALSE ) ? 1 : 0 ); 119 cbAmpm->setCurrentItem( config.readBoolEntry( "AMPM", FALSE ) ? 1 : 0 );
118 cbWeekStart->setCurrentItem( config.readBoolEntry( "MONDAY", TRUE ) ? 1 : 0 ); 120 cbWeekStart->setCurrentItem( config.readBoolEntry( "MONDAY", TRUE ) ? 1 : 0 );
119 121
120 // Send initial configuration options 122 // Send initial configuration options
121 QTimer::singleShot( 1200, this, SLOT(sendOptions()) ); 123 QTimer::singleShot( 1200, this, SLOT(sendOptions()) );
122} 124}
123 125
124FormatTabWidget::~FormatTabWidget() 126FormatTabWidget::~FormatTabWidget()
125{ 127{
126} 128}
127 129
128void FormatTabWidget::saveSettings( bool commit ) 130void FormatTabWidget::saveSettings( bool commit )
129{ 131{
130 int ampm = cbAmpm->currentItem(); 132 int ampm = cbAmpm->currentItem();
131 int weekstart = cbWeekStart->currentItem(); 133 int weekstart = cbWeekStart->currentItem();
132 DateFormat df = date_formats[cbDateFormat->currentItem()]; 134 DateFormat df = date_formats[cbDateFormat->currentItem()];
133 int appletformat = cbAppletFormat->currentItem(); 135 int appletformat = cbAppletFormat->currentItem();
134 136
135 if ( commit ) 137 if ( commit )
136 { 138 {
137 // Write settings to config file 139 // Write settings to config file
138 Config config("qpe"); 140 Config config("qpe");
139 config.setGroup( "Time" ); 141 config.setGroup( "Time" );
140 config.writeEntry( "AMPM", ampm ); 142 config.writeEntry( "AMPM", ampm );
141 config.writeEntry( "MONDAY", weekstart ); 143 config.writeEntry( "MONDAY", weekstart );
142 config.setGroup( "Date" ); 144 config.setGroup( "Date" );
143 config.writeEntry( "Separator", QString( df.separator() ) ); 145 config.writeEntry( "Separator", QString( df.separator() ) );
144 config.writeEntry( "ShortOrder", df.shortOrder() ); 146 config.writeEntry( "ShortOrder", df.shortOrder() );
145 config.writeEntry( "LongOrder", df.longOrder() ); 147 config.writeEntry( "LongOrder", df.longOrder() );
146 config.writeEntry( "ClockApplet", appletformat ); 148 config.writeEntry( "ClockApplet", appletformat );
147 } 149 }
148 150
149 // Make rest of system aware of new settings 151 // Make rest of system aware of new settings
150 QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); 152 QCopEnvelope setClock( "QPE/System", "clockChange(bool)" );
151 setClock << ampm; 153 setClock << ampm;
152 QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" ); 154 QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" );
153 setWeek << weekstart; 155 setWeek << weekstart;
154 QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" ); 156 QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" );
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,154 +1,156 @@
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
91 // Create timer for automatic time lookups 93 // Create timer for automatic time lookups
92 ntpTimer = new QTimer( this ); 94 ntpTimer = new QTimer( this );
93 95
94 // Connect everything together 96 // Connect everything together
95 connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) ); 97 connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) );
96 connect( timeTab, SIGNAL(tzChanged(const QString&)), predictTab, SLOT(slotTZChanged(const QString&)) ); 98 connect( timeTab, SIGNAL(tzChanged(const QString&)), predictTab, SLOT(slotTZChanged(const QString&)) );
97 connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) ); 99 connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) );
98 connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime(int)) ); 100 connect( formatTab, SIGNAL(show12HourTime(int)), timeTab, SLOT(slotUse12HourTime(int)) );
99 connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat&)), 101 connect( formatTab, SIGNAL(dateFormatChanged(const DateFormat&)),
100 timeTab, SLOT(slotDateFormatChanged(const DateFormat&)) ); 102 timeTab, SLOT(slotDateFormatChanged(const DateFormat&)) );
101 connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) ); 103 connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) );
102 connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) ); 104 connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) );
103 connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) ); 105 connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) );
104 connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) ); 106 connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) );
105 connect( predictTab, SIGNAL(setTime(const QDateTime&)), this, SLOT(slotSetTime(const QDateTime&)) ); 107 connect( predictTab, SIGNAL(setTime(const QDateTime&)), this, SLOT(slotSetTime(const QDateTime&)) );
106 108
107 // Do initial time server check 109 // Do initial time server check
108 slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); 110 slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) );
109 slotCheckNtp( -1 ); 111 slotCheckNtp( -1 );
110 112
111 // Display app 113 // Display app
112 //showMaximized(); 114 //showMaximized();
113 (void)new QPEDialogListener(this); 115 (void)new QPEDialogListener(this);
114} 116}
115 117
116MainWindow::~MainWindow() 118MainWindow::~MainWindow()
117{ 119{
118 if ( ntpProcess ) 120 if ( ntpProcess )
119 delete ntpProcess; 121 delete ntpProcess;
120} 122}
121 123
122void MainWindow::accept() 124void MainWindow::accept()
123{ 125{
124 // Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends) 126 // Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends)
125 { 127 {
126 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 128 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
127 disableScreenSaver << 0 << 0 << 0; 129 disableScreenSaver << 0 << 0 << 0;
128 } 130 }
129 131
130 // Update the systemtime 132 // Update the systemtime
131 timeTab->saveSettings( true ); 133 timeTab->saveSettings( true );
132 134
133 // Save format options 135 // Save format options
134 formatTab->saveSettings( true ); 136 formatTab->saveSettings( true );
135 137
136 // Save settings options 138 // Save settings options
137 settingsTab->saveSettings(); 139 settingsTab->saveSettings();
138 140
139 // Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better 141 // Since time has changed quickly load in the DateBookDB to allow the alarm server to get a better
140 // grip on itself (example re-trigger alarms for when we travel back in time). 142 // grip on itself (example re-trigger alarms for when we travel back in time).
141 DateBookDB db; 143 DateBookDB db;
142 144
143 // Turn back on the screensaver 145 // Turn back on the screensaver
144 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 146 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
145 enableScreenSaver << -1 << -1 << -1; 147 enableScreenSaver << -1 << -1 << -1;
146 148
147 // Exit app 149 // Exit app
148 qApp->quit(); 150 qApp->quit();
149} 151}
150 152
151void MainWindow::reject() 153void MainWindow::reject()
152{ 154{
153 // Reset time settings 155 // Reset time settings
154 timeTab->saveSettings( false ); 156 timeTab->saveSettings( false );
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 @@
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();
91 void slotProbeNTPServer(); 93 void slotProbeNTPServer();
92 void slotNtpOutput( Opie::Core::OProcess *, char *, int ); 94 void slotNtpOutput( Opie::Core::OProcess *, char *, int );
93 void slotNtpFinished( Opie::Core::OProcess* ); 95 void slotNtpFinished( Opie::Core::OProcess* );
94 void slotNTPDelayChanged( int ); 96 void slotNTPDelayChanged( int );
95 void slotCheckNtp( int ); 97 void slotCheckNtp( int );
96}; 98};
97 99
98#endif 100#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 @@
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,154 +1,156 @@
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 );
91 93
92 // Set predicted time button 94 // Set predicted time button
93 pb = new QPushButton( tr( "Set predicted time" ), this ); 95 pb = new QPushButton( tr( "Set predicted time" ), this );
94 connect( pb, SIGNAL(clicked()), this, SLOT(slotSetPredictedTime()) ); 96 connect( pb, SIGNAL(clicked()), this, SLOT(slotSetPredictedTime()) );
95 layout->addWidget( pb, 4, 1 ); 97 layout->addWidget( pb, 4, 1 );
96 98
97 // Initialize values 99 // Initialize values
98 Config config( "ntp" ); 100 Config config( "ntp" );
99 config.setGroup( "lookups" ); 101 config.setGroup( "lookups" );
100 int lookupCount = config.readNumEntry( "count", 0 ); 102 int lookupCount = config.readNumEntry( "count", 0 );
101 float last, shift, shiftPerSec; 103 float last, shift, shiftPerSec;
102 tblLookups->setNumRows( lookupCount ); 104 tblLookups->setNumRows( lookupCount );
103 int cw = tblLookups->width() / 4; 105 int cw = tblLookups->width() / 4;
104 cw = 50; 106 cw = 50;
105 tblLookups->sortColumn( 0, FALSE, TRUE ); 107 tblLookups->sortColumn( 0, FALSE, TRUE );
106 _shiftPerSec = 0; 108 _shiftPerSec = 0;
107 QString grpname; 109 QString grpname;
108 for ( int i=0; i < lookupCount; i++ ) 110 for ( int i=0; i < lookupCount; i++ )
109 { 111 {
110 grpname = "lookup_"; 112 grpname = "lookup_";
111 grpname.append( QString::number( i ) ); 113 grpname.append( QString::number( i ) );
112 config.setGroup( grpname ); 114 config.setGroup( grpname );
113 last = config.readEntry( "secsSinceLast", 0 ).toFloat(); 115 last = config.readEntry( "secsSinceLast", 0 ).toFloat();
114 shift = QString( config.readEntry( "timeShift", 0 ) ).toFloat(); 116 shift = QString( config.readEntry( "timeShift", 0 ) ).toFloat();
115 shiftPerSec = shift / last; 117 shiftPerSec = shift / last;
116 _shiftPerSec += shiftPerSec; 118 _shiftPerSec += shiftPerSec;
117 tblLookups->setText( i, 0, QString::number( shiftPerSec * 60 * 60 ) ); 119 tblLookups->setText( i, 0, QString::number( shiftPerSec * 60 * 60 ) );
118 tblLookups->setText( i, 2, QString::number( shift ) ); 120 tblLookups->setText( i, 2, QString::number( shift ) );
119 tblLookups->setText( i, 1, QString::number( last / ( 60 * 60 ) ) ); 121 tblLookups->setText( i, 1, QString::number( last / ( 60 * 60 ) ) );
120 } 122 }
121 if(lookupCount) 123 if(lookupCount)
122 _shiftPerSec /= lookupCount; 124 _shiftPerSec /= lookupCount;
123 QString drift = QString::number( _shiftPerSec * 60 * 60); 125 QString drift = QString::number( _shiftPerSec * 60 * 60);
124 drift.append( tr( " s/h" ) ); 126 drift.append( tr( " s/h" ) );
125 lblDrift->setText( drift ); 127 lblDrift->setText( drift );
126 128
127 Config lconfig( "locale" ); 129 Config lconfig( "locale" );
128 lconfig.setGroup( "Location" ); 130 lconfig.setGroup( "Location" );
129 tz = lconfig.readEntry( "Timezone", "America/New_York" ); 131 tz = lconfig.readEntry( "Timezone", "America/New_York" );
130} 132}
131 133
132PredictTabWidget::~PredictTabWidget() 134PredictTabWidget::~PredictTabWidget()
133{ 135{
134} 136}
135 137
136void PredictTabWidget::setShiftPerSec( int i ) 138void PredictTabWidget::setShiftPerSec( int i )
137{ 139{
138 _shiftPerSec += i; 140 _shiftPerSec += i;
139} 141}
140 142
141void PredictTabWidget::slotTZChanged( const QString &newtz ) 143void PredictTabWidget::slotTZChanged( const QString &newtz )
142{ 144{
143 tz = newtz; 145 tz = newtz;
144} 146}
145 147
146void PredictTabWidget::slotPredictTime() 148void PredictTabWidget::slotPredictTime()
147{ 149{
148 Config config( "ntp" ); 150 Config config( "ntp" );
149 config.setGroup( "lookups" ); 151 config.setGroup( "lookups" );
150 int lastTime = config.readNumEntry( "time", 0 ); 152 int lastTime = config.readNumEntry( "time", 0 );
151 config.writeEntry( "lastNtp", TRUE ); 153 config.writeEntry( "lastNtp", TRUE );
152 setenv( "TZ", tz, 1 ); 154 setenv( "TZ", tz, 1 );
153 int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); 155 int now = TimeConversion::toUTC( QDateTime::currentDateTime() );
154 int corr = int( ( now - lastTime ) * _shiftPerSec ); 156 int corr = int( ( now - lastTime ) * _shiftPerSec );
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,154 +1,156 @@
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 );
91 93
92 // Initialize values 94 // Initialize values
93 QString ntpSrvsFile = QPEApplication::qpeDir(); 95 QString ntpSrvsFile = QPEApplication::qpeDir();
94 ntpSrvsFile.append( "etc/ntpservers" ); 96 ntpSrvsFile.append( "etc/ntpservers" );
95 Config ntpSrvs( ntpSrvsFile, Config::File ); 97 Config ntpSrvs( ntpSrvsFile, Config::File );
96 ntpSrvs.setGroup( "servers" ); 98 ntpSrvs.setGroup( "servers" );
97 int srvCount = ntpSrvs.readNumEntry( "count", 0 ); 99 int srvCount = ntpSrvs.readNumEntry( "count", 0 );
98 for ( int i = 0; i < srvCount; i++ ) 100 for ( int i = 0; i < srvCount; i++ )
99 { 101 {
100 ntpSrvs.setGroup( QString::number( i ) ); 102 ntpSrvs.setGroup( QString::number( i ) );
101 cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) ); 103 cbTimeServer->insertItem( ntpSrvs.readEntry( "name" ) );
102 } 104 }
103 if ( srvCount==0 ) { 105 if ( srvCount==0 ) {
104 cbTimeServer->insertItem( "time.fu-berlin.de" ); 106 cbTimeServer->insertItem( "time.fu-berlin.de" );
105 cbTimeServer->insertItem( "time-a.nist.gov" ); 107 cbTimeServer->insertItem( "time-a.nist.gov" );
106 cbTimeServer->insertItem( "ntp.bri.connect.com.au" ); 108 cbTimeServer->insertItem( "ntp.bri.connect.com.au" );
107 } 109 }
108 Config config( "ntp" ); 110 Config config( "ntp" );
109 config.setGroup( "settings" ); 111 config.setGroup( "settings" );
110 sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) ); 112 sbPredictDelay->setValue( config.readNumEntry( "minLookupDiff", 720 ) );
111 sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) ); 113 sbNtpDelay->setValue( config.readNumEntry( "ntpRefreshFreq", 1440 ) );
112 cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) ); 114 cbTimeServer->setCurrentItem( config.readNumEntry( "ntpServer", 0 ) );
113 chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) ); 115 chNtpTab->setChecked( config.readBoolEntry( "displayNtpTab", FALSE ) );
114 chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) ); 116 chPredictTab->setChecked( config.readBoolEntry( "displayPredictTab", FALSE ) );
115} 117}
116 118
117SettingsTabWidget::~SettingsTabWidget() 119SettingsTabWidget::~SettingsTabWidget()
118{ 120{
119} 121}
120 122
121void SettingsTabWidget::saveSettings() 123void SettingsTabWidget::saveSettings()
122{ 124{
123 int srvCount = cbTimeServer->count(); 125 int srvCount = cbTimeServer->count();
124 bool serversChanged = TRUE; 126 bool serversChanged = TRUE;
125 int curSrv = cbTimeServer->currentItem(); 127 int curSrv = cbTimeServer->currentItem();
126 QString edit = cbTimeServer->currentText(); 128 QString edit = cbTimeServer->currentText();
127 for ( int i = 0; i < srvCount; i++ ) 129 for ( int i = 0; i < srvCount; i++ )
128 { 130 {
129 if ( edit == cbTimeServer->text( i ) ) 131 if ( edit == cbTimeServer->text( i ) )
130 serversChanged = FALSE; 132 serversChanged = FALSE;
131 } 133 }
132 if ( serversChanged ) 134 if ( serversChanged )
133 { 135 {
134 QString ntpSrvsFile = QPEApplication::qpeDir(); 136 QString ntpSrvsFile = QPEApplication::qpeDir();
135 ntpSrvsFile.append( "etc/ntpservers" ); 137 ntpSrvsFile.append( "etc/ntpservers" );
136 Config ntpSrvs( ntpSrvsFile, Config::File ); 138 Config ntpSrvs( ntpSrvsFile, Config::File );
137 ntpSrvs.setGroup( "servers" ); 139 ntpSrvs.setGroup( "servers" );
138 ntpSrvs.writeEntry( "count", ++srvCount ); 140 ntpSrvs.writeEntry( "count", ++srvCount );
139 ntpSrvs.setGroup( "0" ); 141 ntpSrvs.setGroup( "0" );
140 ntpSrvs.writeEntry( "name", edit ); 142 ntpSrvs.writeEntry( "name", edit );
141 curSrv = 0; 143 curSrv = 0;
142 for ( int i = 1; i < srvCount; i++ ) 144 for ( int i = 1; i < srvCount; i++ )
143 { 145 {
144 // odebug << "ntpSrvs[" << i << "/" << srvCount << "]=" << cbTimeServer->text( i ).latin1() << "" << oendl; 146 // odebug << "ntpSrvs[" << i << "/" << srvCount << "]=" << cbTimeServer->text( i ).latin1() << "" << oendl;
145 ntpSrvs.setGroup( QString::number( i ) ); 147 ntpSrvs.setGroup( QString::number( i ) );
146 ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) ); 148 ntpSrvs.writeEntry( "name", cbTimeServer->text( i-1 ) );
147 } 149 }
148 } 150 }
149 Config config( "ntp", Config::User ); 151 Config config( "ntp", Config::User );
150 config.setGroup( "settings" ); 152 config.setGroup( "settings" );
151 config.writeEntry( "ntpServer", curSrv ); 153 config.writeEntry( "ntpServer", curSrv );
152 config.writeEntry( "minLookupDiff", sbPredictDelay->value() ); 154 config.writeEntry( "minLookupDiff", sbPredictDelay->value() );
153 config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() ); 155 config.writeEntry( "ntpRefreshFreq", sbNtpDelay->value() );
154 config.writeEntry( "displayNtpTab", chNtpTab->isChecked() ); 156 config.writeEntry( "displayNtpTab", chNtpTab->isChecked() );
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,247 +1,253 @@
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 );
184 } 190 }
185 else 191 else
186 { 192 {
187 sbHour->setValue( t.hour() ); 193 sbHour->setValue( t.hour() );
188 } 194 }
189 sbMin->setValue( t.minute() ); 195 sbMin->setValue( t.minute() );
190 196
191 // Set date 197 // Set date
192 btnDate->setDate( dt.date() ); 198 btnDate->setDate( dt.date() );
193} 199}
194 200
195void TimeTabWidget::setNTPBtnEnabled( bool enabled ) 201void TimeTabWidget::setNTPBtnEnabled( bool enabled )
196{ 202{
197 m_ntpBtn->setEnabled( enabled ); 203 m_ntpBtn->setEnabled( enabled );
198} 204}
199 205
200void TimeTabWidget::setSystemTime( const QDateTime &dt ) 206void TimeTabWidget::setSystemTime( const QDateTime &dt )
201{ 207{
202 // Set system clock 208 // Set system clock
203 if ( dt.isValid() ) 209 if ( dt.isValid() )
204 { 210 {
205 struct timeval myTv; 211 struct timeval myTv;
206 int t = TimeConversion::toUTC( dt ); 212 int t = TimeConversion::toUTC( dt );
207 myTv.tv_sec = t; 213 myTv.tv_sec = t;
208 myTv.tv_usec = 0; 214 myTv.tv_usec = 0;
209 215
210 if ( myTv.tv_sec != -1 ) 216 if ( myTv.tv_sec != -1 )
211 ::settimeofday( &myTv, 0 ); 217 ::settimeofday( &myTv, 0 );
212 218
213 /* 219 /*
214 * Commit the datetime to the 'hardware' 220 * Commit the datetime to the 'hardware'
215 * as Global::writeHWClock() is a NOOP with Opie Alarm 221 * as Global::writeHWClock() is a NOOP with Opie Alarm
216 */ 222 */
217 system("/sbin/hwclock --systohc --utc"); 223 system("/sbin/hwclock --systohc --utc");
218 } 224 }
219} 225}
220 226
221void TimeTabWidget::slotUse12HourTime( int i ) 227void TimeTabWidget::slotUse12HourTime( int i )
222{ 228{
223 use12HourTime = (i == 1); 229 use12HourTime = (i == 1);
224 230
225 cbAmpm->setEnabled( use12HourTime ); 231 cbAmpm->setEnabled( use12HourTime );
226 232
227 int show_hour = sbHour->value(); 233 int show_hour = sbHour->value();
228 234
229 if ( use12HourTime ) 235 if ( use12HourTime )
230 { 236 {
231 sbHour->setMinValue( 1 ); 237 sbHour->setMinValue( 1 );
232 sbHour->setMaxValue( 12 ); 238 sbHour->setMaxValue( 12 );
233 239
234 if ( show_hour >= 12 ) 240 if ( show_hour >= 12 )
235 { 241 {
236 show_hour -= 12; 242 show_hour -= 12;
237 cbAmpm->setCurrentItem( ValuePM ); 243 cbAmpm->setCurrentItem( ValuePM );
238 } 244 }
239 else 245 else
240 { 246 {
241 cbAmpm->setCurrentItem( ValueAM ); 247 cbAmpm->setCurrentItem( ValueAM );
242 } 248 }
243 if ( show_hour == 0 ) 249 if ( show_hour == 0 )
244 show_hour = 12; 250 show_hour = 12;
245 } 251 }
246 else 252 else
247 { 253 {
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