Diffstat (limited to 'noncore/settings/netsystemtime/timetabwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/timetabwidget.cpp | 62 |
1 files changed, 34 insertions, 28 deletions
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,58 +1,62 @@ | |||
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 | ||
53 | static const int ValueAM = 0; | 57 | static const int ValueAM = 0; |
54 | static const int ValuePM = 1; | 58 | static const int ValuePM = 1; |
55 | 59 | ||
56 | TimeTabWidget::TimeTabWidget( QWidget *parent ) | 60 | TimeTabWidget::TimeTabWidget( QWidget *parent ) |
57 | : QWidget( parent, 0x0, 0 ) | 61 | : QWidget( parent, 0x0, 0 ) |
58 | { | 62 | { |
@@ -88,56 +92,58 @@ TimeTabWidget::TimeTabWidget( QWidget *parent ) | |||
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 | ||
134 | TimeTabWidget::~TimeTabWidget() | 140 | TimeTabWidget::~TimeTabWidget() |
135 | { | 141 | { |
136 | } | 142 | } |
137 | 143 | ||
138 | void TimeTabWidget::saveSettings( bool commit ) | 144 | void 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(); |