author | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
commit | b6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff) | |
tree | d3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /library | |
parent | 0d59c780513da78033f4d9040475dee9db0256d4 (diff) | |
download | opie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2 |
applied the patch generated by the optimize_connect script from
TT.
-rw-r--r-- | library/datebookmonth.cpp | 28 | ||||
-rw-r--r-- | library/fileselector.cpp | 16 | ||||
-rw-r--r-- | library/finddialog.cpp | 12 | ||||
-rw-r--r-- | library/findwidget_p.cpp | 4 | ||||
-rw-r--r-- | library/ir.cpp | 4 | ||||
-rw-r--r-- | library/network.cpp | 4 | ||||
-rw-r--r-- | library/qcopenvelope_qws.cpp | 4 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 12 | ||||
-rw-r--r-- | library/qpedialog.cpp | 4 | ||||
-rw-r--r-- | library/storage.cpp | 4 | ||||
-rw-r--r-- | library/timestring.cpp | 2 | ||||
-rw-r--r-- | library/tzselect.cpp | 8 |
12 files changed, 49 insertions, 53 deletions
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp index 76e022f..421559e 100644 --- a/library/datebookmonth.cpp +++ b/library/datebookmonth.cpp | |||
@@ -1,289 +1,289 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "config.h" | 20 | #include "config.h" |
21 | #include "datebookmonth.h" | 21 | #include "datebookmonth.h" |
22 | #include "datebookdb.h" | 22 | #include "datebookdb.h" |
23 | #include "resource.h" | 23 | #include "resource.h" |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | #include <qtoolbutton.h> | 26 | #include <qtoolbutton.h> |
27 | #include <qspinbox.h> | 27 | #include <qspinbox.h> |
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qvaluestack.h> | 29 | #include <qvaluestack.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | 31 | ||
32 | 32 | ||
33 | DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name ) | 33 | DateBookMonthHeader::DateBookMonthHeader( QWidget *parent, const char *name ) |
34 | : QHBox( parent, name ) | 34 | : QHBox( parent, name ) |
35 | { | 35 | { |
36 | setBackgroundMode( PaletteButton ); | 36 | setBackgroundMode( PaletteButton ); |
37 | 37 | ||
38 | begin = new QToolButton( this ); | 38 | begin = new QToolButton( this ); |
39 | begin->setFocusPolicy(NoFocus); | 39 | begin->setFocusPolicy(NoFocus); |
40 | begin->setPixmap( Resource::loadPixmap( "start" ) ); | 40 | begin->setPixmap( Resource::loadPixmap( "start" ) ); |
41 | begin->setAutoRaise( TRUE ); | 41 | begin->setAutoRaise( TRUE ); |
42 | begin->setFixedSize( begin->sizeHint() ); | 42 | begin->setFixedSize( begin->sizeHint() ); |
43 | QWhatsThis::add( begin, tr("Show January in the selected year") ); | 43 | QWhatsThis::add( begin, tr("Show January in the selected year") ); |
44 | 44 | ||
45 | back = new QToolButton( this ); | 45 | back = new QToolButton( this ); |
46 | back->setFocusPolicy(NoFocus); | 46 | back->setFocusPolicy(NoFocus); |
47 | back->setPixmap( Resource::loadPixmap( "back" ) ); | 47 | back->setPixmap( Resource::loadPixmap( "back" ) ); |
48 | back->setAutoRaise( TRUE ); | 48 | back->setAutoRaise( TRUE ); |
49 | back->setFixedSize( back->sizeHint() ); | 49 | back->setFixedSize( back->sizeHint() ); |
50 | QWhatsThis::add( back, tr("Show the previous month") ); | 50 | QWhatsThis::add( back, tr("Show the previous month") ); |
51 | 51 | ||
52 | month = new QComboBox( FALSE, this ); | 52 | month = new QComboBox( FALSE, this ); |
53 | for ( int i = 0; i < 12; ++i ) | 53 | for ( int i = 0; i < 12; ++i ) |
54 | month->insertItem( Calendar::nameOfMonth( i + 1 ) ); | 54 | month->insertItem( Calendar::nameOfMonth( i + 1 ) ); |
55 | 55 | ||
56 | year = new QSpinBox( 1752, 8000, 1, this ); | 56 | year = new QSpinBox( 1752, 8000, 1, this ); |
57 | 57 | ||
58 | next = new QToolButton( this ); | 58 | next = new QToolButton( this ); |
59 | next->setFocusPolicy(NoFocus); | 59 | next->setFocusPolicy(NoFocus); |
60 | next->setPixmap( Resource::loadPixmap( "forward" ) ); | 60 | next->setPixmap( Resource::loadPixmap( "forward" ) ); |
61 | next->setAutoRaise( TRUE ); | 61 | next->setAutoRaise( TRUE ); |
62 | next->setFixedSize( next->sizeHint() ); | 62 | next->setFixedSize( next->sizeHint() ); |
63 | QWhatsThis::add( next, tr("Show the next month") ); | 63 | QWhatsThis::add( next, tr("Show the next month") ); |
64 | 64 | ||
65 | end = new QToolButton( this ); | 65 | end = new QToolButton( this ); |
66 | end->setFocusPolicy(NoFocus); | 66 | end->setFocusPolicy(NoFocus); |
67 | end->setPixmap( Resource::loadPixmap( "finish" ) ); | 67 | end->setPixmap( Resource::loadPixmap( "finish" ) ); |
68 | end->setAutoRaise( TRUE ); | 68 | end->setAutoRaise( TRUE ); |
69 | end->setFixedSize( end->sizeHint() ); | 69 | end->setFixedSize( end->sizeHint() ); |
70 | QWhatsThis::add( end, tr("Show December in the selected year") ); | 70 | QWhatsThis::add( end, tr("Show December in the selected year") ); |
71 | 71 | ||
72 | connect( month, SIGNAL( activated( int ) ), | 72 | connect( month, SIGNAL( activated(int) ), |
73 | this, SLOT( updateDate() ) ); | 73 | this, SLOT( updateDate() ) ); |
74 | connect( year, SIGNAL( valueChanged( int ) ), | 74 | connect( year, SIGNAL( valueChanged(int) ), |
75 | this, SLOT( updateDate() ) ); | 75 | this, SLOT( updateDate() ) ); |
76 | connect( begin, SIGNAL( clicked() ), | 76 | connect( begin, SIGNAL( clicked() ), |
77 | this, SLOT( firstMonth() ) ); | 77 | this, SLOT( firstMonth() ) ); |
78 | connect( end, SIGNAL( clicked() ), | 78 | connect( end, SIGNAL( clicked() ), |
79 | this, SLOT( lastMonth() ) ); | 79 | this, SLOT( lastMonth() ) ); |
80 | connect( back, SIGNAL( clicked() ), | 80 | connect( back, SIGNAL( clicked() ), |
81 | this, SLOT( monthBack() ) ); | 81 | this, SLOT( monthBack() ) ); |
82 | connect( next, SIGNAL( clicked() ), | 82 | connect( next, SIGNAL( clicked() ), |
83 | this, SLOT( monthForward() ) ); | 83 | this, SLOT( monthForward() ) ); |
84 | back->setAutoRepeat( TRUE ); | 84 | back->setAutoRepeat( TRUE ); |
85 | next->setAutoRepeat( TRUE ); | 85 | next->setAutoRepeat( TRUE ); |
86 | } | 86 | } |
87 | 87 | ||
88 | 88 | ||
89 | DateBookMonthHeader::~DateBookMonthHeader() | 89 | DateBookMonthHeader::~DateBookMonthHeader() |
90 | { | 90 | { |
91 | 91 | ||
92 | } | 92 | } |
93 | 93 | ||
94 | void DateBookMonthHeader::updateDate() | 94 | void DateBookMonthHeader::updateDate() |
95 | { | 95 | { |
96 | emit dateChanged( year->value(), month->currentItem() + 1 ); | 96 | emit dateChanged( year->value(), month->currentItem() + 1 ); |
97 | } | 97 | } |
98 | 98 | ||
99 | void DateBookMonthHeader::firstMonth() | 99 | void DateBookMonthHeader::firstMonth() |
100 | { | 100 | { |
101 | emit dateChanged( year->value(), 1 ); | 101 | emit dateChanged( year->value(), 1 ); |
102 | month->setCurrentItem( 0 ); | 102 | month->setCurrentItem( 0 ); |
103 | } | 103 | } |
104 | 104 | ||
105 | void DateBookMonthHeader::lastMonth() | 105 | void DateBookMonthHeader::lastMonth() |
106 | { | 106 | { |
107 | emit dateChanged( year->value(), 12 ); | 107 | emit dateChanged( year->value(), 12 ); |
108 | month->setCurrentItem( 11 ); | 108 | month->setCurrentItem( 11 ); |
109 | } | 109 | } |
110 | 110 | ||
111 | void DateBookMonthHeader::monthBack() | 111 | void DateBookMonthHeader::monthBack() |
112 | { | 112 | { |
113 | if ( month->currentItem() > 0 ) { | 113 | if ( month->currentItem() > 0 ) { |
114 | emit dateChanged( year->value(), month->currentItem() ); | 114 | emit dateChanged( year->value(), month->currentItem() ); |
115 | month->setCurrentItem( month->currentItem() - 1 ); | 115 | month->setCurrentItem( month->currentItem() - 1 ); |
116 | } else { | 116 | } else { |
117 | emit dateChanged( year->value() - 1, 12 ); | 117 | emit dateChanged( year->value() - 1, 12 ); |
118 | // we have a signal set to a changed value in year so we only need to change | 118 | // we have a signal set to a changed value in year so we only need to change |
119 | // year to get the result... | 119 | // year to get the result... |
120 | month->setCurrentItem( 11 ); | 120 | month->setCurrentItem( 11 ); |
121 | year->setValue( year->value() - 1 ); | 121 | year->setValue( year->value() - 1 ); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | void DateBookMonthHeader::monthForward() | 125 | void DateBookMonthHeader::monthForward() |
126 | { | 126 | { |
127 | if ( month->currentItem() < 11 ) { | 127 | if ( month->currentItem() < 11 ) { |
128 | emit dateChanged( year->value(), month->currentItem() + 2 ); | 128 | emit dateChanged( year->value(), month->currentItem() + 2 ); |
129 | month->setCurrentItem( month->currentItem() + 1 ); | 129 | month->setCurrentItem( month->currentItem() + 1 ); |
130 | } else { | 130 | } else { |
131 | // we have a signal set to a changed value in year so we only need to change | 131 | // we have a signal set to a changed value in year so we only need to change |
132 | // year to get the result... | 132 | // year to get the result... |
133 | month->setCurrentItem( 0 ); | 133 | month->setCurrentItem( 0 ); |
134 | year->setValue( year->value() + 1 ); | 134 | year->setValue( year->value() + 1 ); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | void DateBookMonthHeader::setDate( int y, int m ) | 138 | void DateBookMonthHeader::setDate( int y, int m ) |
139 | { | 139 | { |
140 | year->setValue( y ); | 140 | year->setValue( y ); |
141 | month->setCurrentItem( m - 1 ); | 141 | month->setCurrentItem( m - 1 ); |
142 | } | 142 | } |
143 | 143 | ||
144 | //--------------------------------------------------------------------------- | 144 | //--------------------------------------------------------------------------- |
145 | 145 | ||
146 | class DateBookMonthTablePrivate | 146 | class DateBookMonthTablePrivate |
147 | { | 147 | { |
148 | public: | 148 | public: |
149 | DateBookMonthTablePrivate() {}; | 149 | DateBookMonthTablePrivate() {}; |
150 | ~DateBookMonthTablePrivate() { mMonthEvents.clear(); }; | 150 | ~DateBookMonthTablePrivate() { mMonthEvents.clear(); }; |
151 | 151 | ||
152 | QValueList<EffectiveEvent> mMonthEvents; | 152 | QValueList<EffectiveEvent> mMonthEvents; |
153 | bool onMonday; | 153 | bool onMonday; |
154 | }; | 154 | }; |
155 | 155 | ||
156 | DateBookMonthTable::DateBookMonthTable( QWidget *parent, const char *name, | 156 | DateBookMonthTable::DateBookMonthTable( QWidget *parent, const char *name, |
157 | DateBookDB *newDb ) | 157 | DateBookDB *newDb ) |
158 | : QTable( 6, 7, parent, name ), | 158 | : QTable( 6, 7, parent, name ), |
159 | db( newDb ) | 159 | db( newDb ) |
160 | { | 160 | { |
161 | d = new DateBookMonthTablePrivate(); | 161 | d = new DateBookMonthTablePrivate(); |
162 | selYear = -1; | 162 | selYear = -1; |
163 | selMonth = -1; | 163 | selMonth = -1; |
164 | selDay = -1; | 164 | selDay = -1; |
165 | 165 | ||
166 | /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */ | 166 | /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */ |
167 | year = -1; | 167 | year = -1; |
168 | month = -1; | 168 | month = -1; |
169 | day = -1; | 169 | day = -1; |
170 | 170 | ||
171 | Config cfg( "qpe" ); | 171 | Config cfg( "qpe" ); |
172 | cfg.setGroup( "Time" ); | 172 | cfg.setGroup( "Time" ); |
173 | d->onMonday = cfg.readBoolEntry( "MONDAY" ); | 173 | d->onMonday = cfg.readBoolEntry( "MONDAY" ); |
174 | 174 | ||
175 | horizontalHeader()->setResizeEnabled( FALSE ); | 175 | horizontalHeader()->setResizeEnabled( FALSE ); |
176 | // we have to do this here... or suffer the consequences later... | 176 | // we have to do this here... or suffer the consequences later... |
177 | for ( int i = 0; i < 7; i++ ){ | 177 | for ( int i = 0; i < 7; i++ ){ |
178 | horizontalHeader()->resizeSection( i, 30 ); | 178 | horizontalHeader()->resizeSection( i, 30 ); |
179 | setColumnStretchable( i, TRUE ); | 179 | setColumnStretchable( i, TRUE ); |
180 | } | 180 | } |
181 | setupLabels(); | 181 | setupLabels(); |
182 | 182 | ||
183 | verticalHeader()->hide(); | 183 | verticalHeader()->hide(); |
184 | setLeftMargin( 0 ); | 184 | setLeftMargin( 0 ); |
185 | for ( int i = 0; i < 6; ++i ) | 185 | for ( int i = 0; i < 6; ++i ) |
186 | setRowStretchable( i, TRUE ); | 186 | setRowStretchable( i, TRUE ); |
187 | 187 | ||
188 | setSelectionMode( NoSelection ); | 188 | setSelectionMode( NoSelection ); |
189 | 189 | ||
190 | connect( this, SIGNAL( clicked( int, int, int, const QPoint & ) ), | 190 | connect( this, SIGNAL( clicked(int,int,int,const QPoint&) ), |
191 | this, SLOT( dayClicked( int, int ) ) ); | 191 | this, SLOT( dayClicked(int,int) ) ); |
192 | connect( this, SIGNAL( currentChanged( int, int ) ), | 192 | connect( this, SIGNAL( currentChanged(int,int) ), |
193 | this, SLOT( dragDay( int, int ) ) ); | 193 | this, SLOT( dragDay(int,int) ) ); |
194 | setVScrollBarMode( AlwaysOff ); | 194 | setVScrollBarMode( AlwaysOff ); |
195 | setHScrollBarMode( AlwaysOff ); | 195 | setHScrollBarMode( AlwaysOff ); |
196 | } | 196 | } |
197 | 197 | ||
198 | DateBookMonthTable::~DateBookMonthTable() | 198 | DateBookMonthTable::~DateBookMonthTable() |
199 | { | 199 | { |
200 | monthsEvents.clear(); | 200 | monthsEvents.clear(); |
201 | delete d; | 201 | delete d; |
202 | } | 202 | } |
203 | 203 | ||
204 | void DateBookMonthTable::setDate(int y, int m, int d) | 204 | void DateBookMonthTable::setDate(int y, int m, int d) |
205 | { | 205 | { |
206 | if (month == m && year == y) { | 206 | if (month == m && year == y) { |
207 | if ( selYear == -1 ) | 207 | if ( selYear == -1 ) |
208 | year = selYear; | 208 | year = selYear; |
209 | if ( selMonth == -1 ) | 209 | if ( selMonth == -1 ) |
210 | month = selMonth; | 210 | month = selMonth; |
211 | int r1, c1, r2, c2; | 211 | int r1, c1, r2, c2; |
212 | findDay(selDay, r1, c1); | 212 | findDay(selDay, r1, c1); |
213 | selDay = day = d; | 213 | selDay = day = d; |
214 | findDay(selDay, r2, c2); | 214 | findDay(selDay, r2, c2); |
215 | setCurrentCell( r2, c2 ); | 215 | setCurrentCell( r2, c2 ); |
216 | //updateCell(r1,c1); | 216 | //updateCell(r1,c1); |
217 | //updateCell(r2,c2); | 217 | //updateCell(r2,c2); |
218 | } else { | 218 | } else { |
219 | selYear = year = y; | 219 | selYear = year = y; |
220 | selMonth = month = m; | 220 | selMonth = month = m; |
221 | selDay = day = d; | 221 | selDay = day = d; |
222 | setupTable(); | 222 | setupTable(); |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | void DateBookMonthTable::redraw() | 226 | void DateBookMonthTable::redraw() |
227 | { | 227 | { |
228 | setupLabels(); | 228 | setupLabels(); |
229 | setupTable(); | 229 | setupTable(); |
230 | } | 230 | } |
231 | 231 | ||
232 | void DateBookMonthTable::setWeekStart( bool onMonday ) | 232 | void DateBookMonthTable::setWeekStart( bool onMonday ) |
233 | { | 233 | { |
234 | d->onMonday = onMonday; | 234 | d->onMonday = onMonday; |
235 | setupLabels(); | 235 | setupLabels(); |
236 | setupTable(); | 236 | setupTable(); |
237 | } | 237 | } |
238 | 238 | ||
239 | void DateBookMonthTable::setupTable() | 239 | void DateBookMonthTable::setupTable() |
240 | { | 240 | { |
241 | QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday ); | 241 | QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday ); |
242 | QValueList<Calendar::Day>::Iterator it = days.begin(); | 242 | QValueList<Calendar::Day>::Iterator it = days.begin(); |
243 | int row = 0, col = 0; | 243 | int row = 0, col = 0; |
244 | int crow = 0; | 244 | int crow = 0; |
245 | int ccol = 0; | 245 | int ccol = 0; |
246 | for ( ; it != days.end(); ++it ) { | 246 | for ( ; it != days.end(); ++it ) { |
247 | DayItemMonth *i = (DayItemMonth *)item( row, col ); | 247 | DayItemMonth *i = (DayItemMonth *)item( row, col ); |
248 | if ( !i ) { | 248 | if ( !i ) { |
249 | i = new DayItemMonth( this, QTableItem::Never, "" ); | 249 | i = new DayItemMonth( this, QTableItem::Never, "" ); |
250 | setItem( row, col, i ); | 250 | setItem( row, col, i ); |
251 | } | 251 | } |
252 | Calendar::Day calDay = *it; | 252 | Calendar::Day calDay = *it; |
253 | i->clearEffEvents(); | 253 | i->clearEffEvents(); |
254 | i->setDay( calDay.date ); | 254 | i->setDay( calDay.date ); |
255 | i->setType( calDay.type ); | 255 | i->setType( calDay.type ); |
256 | if ( i->day() == day && calDay.type == Calendar::Day::ThisMonth ) { | 256 | if ( i->day() == day && calDay.type == Calendar::Day::ThisMonth ) { |
257 | crow = row; | 257 | crow = row; |
258 | ccol = col; | 258 | ccol = col; |
259 | } | 259 | } |
260 | 260 | ||
261 | updateCell( row, col ); | 261 | updateCell( row, col ); |
262 | 262 | ||
263 | if ( col == 6 ) { | 263 | if ( col == 6 ) { |
264 | ++row; | 264 | ++row; |
265 | col = 0; | 265 | col = 0; |
266 | } else { | 266 | } else { |
267 | ++col; | 267 | ++col; |
268 | } | 268 | } |
269 | } | 269 | } |
270 | setCurrentCell( crow, ccol ); | 270 | setCurrentCell( crow, ccol ); |
271 | getEvents(); | 271 | getEvents(); |
272 | } | 272 | } |
273 | 273 | ||
274 | void DateBookMonthTable::findDay( int day, int &row, int &col ) | 274 | void DateBookMonthTable::findDay( int day, int &row, int &col ) |
275 | { | 275 | { |
276 | QDate dtBegin( year, month, 1 ); | 276 | QDate dtBegin( year, month, 1 ); |
277 | int skips = dtBegin.dayOfWeek(); | 277 | int skips = dtBegin.dayOfWeek(); |
278 | int effective_day = day + skips - 1; // row/columns begin at 0 | 278 | int effective_day = day + skips - 1; // row/columns begin at 0 |
279 | // make an extra adjustment if we start on Mondays. | 279 | // make an extra adjustment if we start on Mondays. |
280 | if ( d->onMonday ) | 280 | if ( d->onMonday ) |
281 | effective_day--; | 281 | effective_day--; |
282 | row = effective_day / 7; | 282 | row = effective_day / 7; |
283 | col = effective_day % 7; | 283 | col = effective_day % 7; |
284 | } | 284 | } |
285 | 285 | ||
286 | void DateBookMonthTable::dayClicked( int row, int col ) | 286 | void DateBookMonthTable::dayClicked( int row, int col ) |
287 | { | 287 | { |
288 | changeDaySelection( row, col ); | 288 | changeDaySelection( row, col ); |
289 | emit dateClicked( selYear, selMonth, selDay ); | 289 | emit dateClicked( selYear, selMonth, selDay ); |
@@ -301,196 +301,196 @@ void DateBookMonthTable::changeDaySelection( int row, int col ) | |||
301 | return; | 301 | return; |
302 | switch ( i->type() ) { | 302 | switch ( i->type() ) { |
303 | case Calendar::Day::ThisMonth: | 303 | case Calendar::Day::ThisMonth: |
304 | selMonth = month; | 304 | selMonth = month; |
305 | break; | 305 | break; |
306 | case Calendar::Day::PrevMonth: | 306 | case Calendar::Day::PrevMonth: |
307 | selMonth = month-1; | 307 | selMonth = month-1; |
308 | break; | 308 | break; |
309 | default: | 309 | default: |
310 | selMonth = month+1; | 310 | selMonth = month+1; |
311 | } | 311 | } |
312 | 312 | ||
313 | selYear = year; | 313 | selYear = year; |
314 | if ( selMonth <= 0 ) { | 314 | if ( selMonth <= 0 ) { |
315 | selMonth = 12; | 315 | selMonth = 12; |
316 | selYear--; | 316 | selYear--; |
317 | } else if ( selMonth > 12 ) { | 317 | } else if ( selMonth > 12 ) { |
318 | selMonth = 1; | 318 | selMonth = 1; |
319 | selYear++; | 319 | selYear++; |
320 | } | 320 | } |
321 | selDay = i->day(); | 321 | selDay = i->day(); |
322 | } | 322 | } |
323 | 323 | ||
324 | 324 | ||
325 | void DateBookMonthTable::viewportMouseReleaseEvent( QMouseEvent * ) | 325 | void DateBookMonthTable::viewportMouseReleaseEvent( QMouseEvent * ) |
326 | { | 326 | { |
327 | dayClicked( currentRow(), currentColumn() ); | 327 | dayClicked( currentRow(), currentColumn() ); |
328 | } | 328 | } |
329 | 329 | ||
330 | void DateBookMonthTable::getEvents() | 330 | void DateBookMonthTable::getEvents() |
331 | { | 331 | { |
332 | if ( !db ) | 332 | if ( !db ) |
333 | return; | 333 | return; |
334 | 334 | ||
335 | QDate dtStart( year, month, 1 ); | 335 | QDate dtStart( year, month, 1 ); |
336 | d->mMonthEvents = db->getEffectiveEvents( dtStart, | 336 | d->mMonthEvents = db->getEffectiveEvents( dtStart, |
337 | QDate( year, month, | 337 | QDate( year, month, |
338 | dtStart.daysInMonth() ) ); | 338 | dtStart.daysInMonth() ) ); |
339 | QValueListIterator<EffectiveEvent> it = d->mMonthEvents.begin(); | 339 | QValueListIterator<EffectiveEvent> it = d->mMonthEvents.begin(); |
340 | // now that the events are sorted, basically go through the list, make | 340 | // now that the events are sorted, basically go through the list, make |
341 | // a small list for every day and set it for each item... | 341 | // a small list for every day and set it for each item... |
342 | // clear all the items... | 342 | // clear all the items... |
343 | while ( it != d->mMonthEvents.end() ) { | 343 | while ( it != d->mMonthEvents.end() ) { |
344 | QValueList<EffectiveEvent> dayEvent; | 344 | QValueList<EffectiveEvent> dayEvent; |
345 | EffectiveEvent e = *it; | 345 | EffectiveEvent e = *it; |
346 | ++it; | 346 | ++it; |
347 | dayEvent.append( e ); | 347 | dayEvent.append( e ); |
348 | while ( it != d->mMonthEvents.end() | 348 | while ( it != d->mMonthEvents.end() |
349 | && e.date() == (*it).date() ) { | 349 | && e.date() == (*it).date() ) { |
350 | dayEvent.append( *it ); | 350 | dayEvent.append( *it ); |
351 | ++it; | 351 | ++it; |
352 | } | 352 | } |
353 | int row, col; | 353 | int row, col; |
354 | findDay( e.date().day(), row, col ); | 354 | findDay( e.date().day(), row, col ); |
355 | DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) ); | 355 | DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) ); |
356 | w->setEvents( dayEvent ); | 356 | w->setEvents( dayEvent ); |
357 | updateCell( row, col ); | 357 | updateCell( row, col ); |
358 | dayEvent.clear(); | 358 | dayEvent.clear(); |
359 | } | 359 | } |
360 | } | 360 | } |
361 | 361 | ||
362 | 362 | ||
363 | void DateBookMonthTable::setupLabels() | 363 | void DateBookMonthTable::setupLabels() |
364 | { | 364 | { |
365 | for ( int i = 0; i < 7; ++i ) { | 365 | for ( int i = 0; i < 7; ++i ) { |
366 | // horizontalHeader()->resizeSection( i, 30 ); | 366 | // horizontalHeader()->resizeSection( i, 30 ); |
367 | // setColumnStretchable( i, TRUE ); | 367 | // setColumnStretchable( i, TRUE ); |
368 | if ( d->onMonday ) | 368 | if ( d->onMonday ) |
369 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( i + 1 ) ); | 369 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( i + 1 ) ); |
370 | else { | 370 | else { |
371 | if ( i == 0 ) | 371 | if ( i == 0 ) |
372 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( 7 ) ); | 372 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( 7 ) ); |
373 | else | 373 | else |
374 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( i ) ); | 374 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( i ) ); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | } | 377 | } |
378 | 378 | ||
379 | 379 | ||
380 | //--------------------------------------------------------------------------- | 380 | //--------------------------------------------------------------------------- |
381 | 381 | ||
382 | DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac, | 382 | DateBookMonth::DateBookMonth( QWidget *parent, const char *name, bool ac, |
383 | DateBookDB *data ) | 383 | DateBookDB *data ) |
384 | : QVBox( parent, name ), | 384 | : QVBox( parent, name ), |
385 | autoClose( ac ) | 385 | autoClose( ac ) |
386 | { | 386 | { |
387 | setFocusPolicy(StrongFocus); | 387 | setFocusPolicy(StrongFocus); |
388 | year = QDate::currentDate().year(); | 388 | year = QDate::currentDate().year(); |
389 | month = QDate::currentDate().month(); | 389 | month = QDate::currentDate().month(); |
390 | day = QDate::currentDate().day(); | 390 | day = QDate::currentDate().day(); |
391 | header = new DateBookMonthHeader( this, "DateBookMonthHeader" ); | 391 | header = new DateBookMonthHeader( this, "DateBookMonthHeader" ); |
392 | table = new DateBookMonthTable( this, "DateBookMonthTable", data ); | 392 | table = new DateBookMonthTable( this, "DateBookMonthTable", data ); |
393 | header->setDate( year, month ); | 393 | header->setDate( year, month ); |
394 | table->setDate( year, month, QDate::currentDate().day() ); | 394 | table->setDate( year, month, QDate::currentDate().day() ); |
395 | header->setFocusPolicy(NoFocus); | 395 | header->setFocusPolicy(NoFocus); |
396 | table->setFocusPolicy(NoFocus); | 396 | table->setFocusPolicy(NoFocus); |
397 | connect( header, SIGNAL( dateChanged( int, int ) ), | 397 | connect( header, SIGNAL( dateChanged(int,int) ), |
398 | this, SLOT( setDate( int, int ) ) ); | 398 | this, SLOT( setDate(int,int) ) ); |
399 | connect( table, SIGNAL( dateClicked( int, int, int ) ), | 399 | connect( table, SIGNAL( dateClicked(int,int,int) ), |
400 | this, SLOT( finalDate(int, int, int) ) ); | 400 | this, SLOT( finalDate(int,int,int) ) ); |
401 | connect( qApp, SIGNAL(weekChanged(bool)), this, | 401 | connect( qApp, SIGNAL(weekChanged(bool)), this, |
402 | SLOT(slotWeekChange(bool)) ); | 402 | SLOT(slotWeekChange(bool)) ); |
403 | table->setFocus(); | 403 | table->setFocus(); |
404 | } | 404 | } |
405 | 405 | ||
406 | DateBookMonth::~DateBookMonth() | 406 | DateBookMonth::~DateBookMonth() |
407 | { | 407 | { |
408 | 408 | ||
409 | } | 409 | } |
410 | 410 | ||
411 | void DateBookMonth::setDate( int y, int m ) | 411 | void DateBookMonth::setDate( int y, int m ) |
412 | { | 412 | { |
413 | /* only change the date if this is a different date, | 413 | /* only change the date if this is a different date, |
414 | * other wise we may mistakenly overide the day */ | 414 | * other wise we may mistakenly overide the day */ |
415 | if ( (y != year) || (m != month) ) { | 415 | if ( (y != year) || (m != month) ) { |
416 | year = y; | 416 | year = y; |
417 | month = m; | 417 | month = m; |
418 | QDate nd( y, m, 1 ); | 418 | QDate nd( y, m, 1 ); |
419 | if ( nd.daysInMonth() < day ) | 419 | if ( nd.daysInMonth() < day ) |
420 | day = nd.daysInMonth(); | 420 | day = nd.daysInMonth(); |
421 | table->setDate( year, month, day ); | 421 | table->setDate( year, month, day ); |
422 | } | 422 | } |
423 | } | 423 | } |
424 | 424 | ||
425 | void DateBookMonth::setDate( int y, int m, int d ) | 425 | void DateBookMonth::setDate( int y, int m, int d ) |
426 | { | 426 | { |
427 | header->setDate( y, m); | 427 | header->setDate( y, m); |
428 | table->setDate( y, m, d); | 428 | table->setDate( y, m, d); |
429 | year = y; | 429 | year = y; |
430 | month = m; | 430 | month = m; |
431 | day = d; | 431 | day = d; |
432 | } | 432 | } |
433 | 433 | ||
434 | /* called when we wish to close or pass back the date */ | 434 | /* called when we wish to close or pass back the date */ |
435 | void DateBookMonth::finalDate(int y, int m, int d) | 435 | void DateBookMonth::finalDate(int y, int m, int d) |
436 | { | 436 | { |
437 | setDate( y, m, d ); | 437 | setDate( y, m, d ); |
438 | 438 | ||
439 | emit dateClicked(y, m, d); | 439 | emit dateClicked(y, m, d); |
440 | // emit dateClicked(QDate(y, m, d).toString()); | 440 | // emit dateClicked(QDate(y, m, d).toString()); |
441 | 441 | ||
442 | if ( autoClose && parentWidget() ) | 442 | if ( autoClose && parentWidget() ) |
443 | parentWidget()->close(); | 443 | parentWidget()->close(); |
444 | } | 444 | } |
445 | 445 | ||
446 | void DateBookMonth::setDate( QDate d) | 446 | void DateBookMonth::setDate( QDate d) |
447 | { | 447 | { |
448 | setDate(d.year(), d.month(), d.day()); | 448 | setDate(d.year(), d.month(), d.day()); |
449 | } | 449 | } |
450 | 450 | ||
451 | void DateBookMonth::redraw() | 451 | void DateBookMonth::redraw() |
452 | { | 452 | { |
453 | table->setDate( year, month, day ); | 453 | table->setDate( year, month, day ); |
454 | table->redraw(); | 454 | table->redraw(); |
455 | } | 455 | } |
456 | 456 | ||
457 | QDate DateBookMonth::selectedDate() const | 457 | QDate DateBookMonth::selectedDate() const |
458 | { | 458 | { |
459 | if ( !table ) | 459 | if ( !table ) |
460 | return QDate::currentDate(); | 460 | return QDate::currentDate(); |
461 | int y, m, d; | 461 | int y, m, d; |
462 | table->getDate( y, m, d ); | 462 | table->getDate( y, m, d ); |
463 | return QDate( y, m, d ); | 463 | return QDate( y, m, d ); |
464 | } | 464 | } |
465 | 465 | ||
466 | void DateBookMonth::slotWeekChange( bool startOnMonday ) | 466 | void DateBookMonth::slotWeekChange( bool startOnMonday ) |
467 | { | 467 | { |
468 | table->setWeekStart( startOnMonday ); | 468 | table->setWeekStart( startOnMonday ); |
469 | } | 469 | } |
470 | 470 | ||
471 | void DateBookMonth::keyPressEvent( QKeyEvent *e ) | 471 | void DateBookMonth::keyPressEvent( QKeyEvent *e ) |
472 | { | 472 | { |
473 | switch(e->key()) { | 473 | switch(e->key()) { |
474 | case Key_Up: | 474 | case Key_Up: |
475 | setDate(QDate(year, month, day).addDays(-7)); | 475 | setDate(QDate(year, month, day).addDays(-7)); |
476 | break; | 476 | break; |
477 | case Key_Down: | 477 | case Key_Down: |
478 | setDate(QDate(year, month, day).addDays(7)); | 478 | setDate(QDate(year, month, day).addDays(7)); |
479 | break; | 479 | break; |
480 | case Key_Left: | 480 | case Key_Left: |
481 | setDate(QDate(year, month, day).addDays(-1)); | 481 | setDate(QDate(year, month, day).addDays(-1)); |
482 | break; | 482 | break; |
483 | case Key_Right: | 483 | case Key_Right: |
484 | setDate(QDate(year, month, day).addDays(1)); | 484 | setDate(QDate(year, month, day).addDays(1)); |
485 | break; | 485 | break; |
486 | case Key_Space: | 486 | case Key_Space: |
487 | qWarning("space"); | 487 | qWarning("space"); |
488 | emit dateClicked(year, month, day); | 488 | emit dateClicked(year, month, day); |
489 | if ( autoClose && parentWidget() ) | 489 | if ( autoClose && parentWidget() ) |
490 | parentWidget()->close(); | 490 | parentWidget()->close(); |
491 | break; | 491 | break; |
492 | default: | 492 | default: |
493 | qWarning("ignore"); | 493 | qWarning("ignore"); |
494 | e->ignore(); | 494 | e->ignore(); |
495 | break; | 495 | break; |
496 | } | 496 | } |
@@ -603,160 +603,160 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg, | |||
603 | p->save(); | 603 | p->save(); |
604 | 604 | ||
605 | if (normalAllDay) | 605 | if (normalAllDay) |
606 | if (repeatAllDay) { | 606 | if (repeatAllDay) { |
607 | p->fillRect( 0, 0, cr.width(), cr.height() / 2, | 607 | p->fillRect( 0, 0, cr.width(), cr.height() / 2, |
608 | colorNormalLight ); | 608 | colorNormalLight ); |
609 | p->fillRect( 0, cr.height() / 2, cr.width(), cr.height() / 2, | 609 | p->fillRect( 0, cr.height() / 2, cr.width(), cr.height() / 2, |
610 | colorRepeatLight ); | 610 | colorRepeatLight ); |
611 | } else | 611 | } else |
612 | p->fillRect( 0, 0, cr.width(), cr.height(), | 612 | p->fillRect( 0, 0, cr.width(), cr.height(), |
613 | colorNormalLight ); | 613 | colorNormalLight ); |
614 | else if (repeatAllDay) | 614 | else if (repeatAllDay) |
615 | p->fillRect( 0, 0, cr.width(), cr.height(), | 615 | p->fillRect( 0, 0, cr.width(), cr.height(), |
616 | colorRepeatLight ); | 616 | colorRepeatLight ); |
617 | } else { | 617 | } else { |
618 | p->fillRect( 0, 0, cr.width(), | 618 | p->fillRect( 0, 0, cr.width(), |
619 | cr.height(), selected | 619 | cr.height(), selected |
620 | ? g.brush( QColorGroup::Highlight ) | 620 | ? g.brush( QColorGroup::Highlight ) |
621 | : g.brush( QColorGroup::Base ) ); | 621 | : g.brush( QColorGroup::Base ) ); |
622 | } | 622 | } |
623 | 623 | ||
624 | // The lines | 624 | // The lines |
625 | // now for the lines. | 625 | // now for the lines. |
626 | int h = 5; | 626 | int h = 5; |
627 | int y = cr.height() / 2 - h; | 627 | int y = cr.height() / 2 - h; |
628 | 628 | ||
629 | while(normalLine.count() >= 2) { | 629 | while(normalLine.count() >= 2) { |
630 | int x2 = normalLine.pop(); | 630 | int x2 = normalLine.pop(); |
631 | int x1 = normalLine.pop(); | 631 | int x1 = normalLine.pop(); |
632 | if (x2 < x1 + 2) | 632 | if (x2 < x1 + 2) |
633 | x2 = x1 + 2; | 633 | x2 = x1 + 2; |
634 | p->fillRect(x1, y, x2 - x1, h, colorNormal); | 634 | p->fillRect(x1, y, x2 - x1, h, colorNormal); |
635 | } | 635 | } |
636 | 636 | ||
637 | y += h; | 637 | y += h; |
638 | 638 | ||
639 | while(repeatLine.count() >= 2) { | 639 | while(repeatLine.count() >= 2) { |
640 | int x2 = repeatLine.pop(); | 640 | int x2 = repeatLine.pop(); |
641 | int x1 = repeatLine.pop(); | 641 | int x1 = repeatLine.pop(); |
642 | if (x2 < x1 + 2) | 642 | if (x2 < x1 + 2) |
643 | x2 = x1 + 2; | 643 | x2 = x1 + 2; |
644 | p->fillRect(x1, y, x2 - x1, h, colorRepeat); | 644 | p->fillRect(x1, y, x2 - x1, h, colorRepeat); |
645 | } | 645 | } |
646 | 646 | ||
647 | 647 | ||
648 | // Finally, draw the number. | 648 | // Finally, draw the number. |
649 | QFont f = p->font(); | 649 | QFont f = p->font(); |
650 | f.setPointSize( ( f.pointSize() / 3 ) * 2 ); | 650 | f.setPointSize( ( f.pointSize() / 3 ) * 2 ); |
651 | p->setFont( f ); | 651 | p->setFont( f ); |
652 | QFontMetrics fm( f ); | 652 | QFontMetrics fm( f ); |
653 | p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) ); | 653 | p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) ); |
654 | 654 | ||
655 | p->restore(); | 655 | p->restore(); |
656 | } | 656 | } |
657 | 657 | ||
658 | 658 | ||
659 | 659 | ||
660 | void DayItemMonth::setType( Calendar::Day::Type t ) | 660 | void DayItemMonth::setType( Calendar::Day::Type t ) |
661 | { | 661 | { |
662 | switch ( t ) { | 662 | switch ( t ) { |
663 | case Calendar::Day::PrevMonth: | 663 | case Calendar::Day::PrevMonth: |
664 | case Calendar::Day::NextMonth: | 664 | case Calendar::Day::NextMonth: |
665 | back = QBrush( QColor( 224, 224, 224 ) ); | 665 | back = QBrush( QColor( 224, 224, 224 ) ); |
666 | forg = black; | 666 | forg = black; |
667 | break; | 667 | break; |
668 | case Calendar::Day::ThisMonth: | 668 | case Calendar::Day::ThisMonth: |
669 | back = QBrush( white ); | 669 | back = QBrush( white ); |
670 | forg = black; | 670 | forg = black; |
671 | break; | 671 | break; |
672 | } | 672 | } |
673 | typ = t; | 673 | typ = t; |
674 | } | 674 | } |
675 | 675 | ||
676 | 676 | ||
677 | 677 | ||
678 | DateButton::DateButton( bool longDate, QWidget *parent, const char * name ) | 678 | DateButton::DateButton( bool longDate, QWidget *parent, const char * name ) |
679 | :QPushButton( parent, name ) | 679 | :QPushButton( parent, name ) |
680 | { | 680 | { |
681 | longFormat = longDate; | 681 | longFormat = longDate; |
682 | df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear); | 682 | df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear); |
683 | setDate( QDate::currentDate() ); | 683 | setDate( QDate::currentDate() ); |
684 | 684 | ||
685 | connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); | 685 | connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); |
686 | 686 | ||
687 | 687 | ||
688 | } | 688 | } |
689 | 689 | ||
690 | 690 | ||
691 | void DateButton::pickDate() | 691 | void DateButton::pickDate() |
692 | { | 692 | { |
693 | static QPopupMenu *m1 = 0; | 693 | static QPopupMenu *m1 = 0; |
694 | static DateBookMonth *picker = 0; | 694 | static DateBookMonth *picker = 0; |
695 | if ( !m1 ) { | 695 | if ( !m1 ) { |
696 | m1 = new QPopupMenu( this ); | 696 | m1 = new QPopupMenu( this ); |
697 | picker = new DateBookMonth( m1, 0, TRUE ); | 697 | picker = new DateBookMonth( m1, 0, TRUE ); |
698 | m1->insertItem( picker ); | 698 | m1->insertItem( picker ); |
699 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | 699 | connect( picker, SIGNAL( dateClicked(int,int,int) ), |
700 | this, SLOT( setDate( int, int, int ) ) ); | 700 | this, SLOT( setDate(int,int,int) ) ); |
701 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | 701 | connect( picker, SIGNAL( dateClicked(int,int,int) ), |
702 | this, SIGNAL( dateSelected( int, int, int ) ) ); | 702 | this, SIGNAL( dateSelected(int,int,int) ) ); |
703 | connect( m1, SIGNAL( aboutToHide() ), | 703 | connect( m1, SIGNAL( aboutToHide() ), |
704 | this, SLOT( gotHide() ) ); | 704 | this, SLOT( gotHide() ) ); |
705 | } | 705 | } |
706 | picker->slotWeekChange( weekStartsMonday ); | 706 | picker->slotWeekChange( weekStartsMonday ); |
707 | picker->setDate( currDate.year(), currDate.month(), currDate.day() ); | 707 | picker->setDate( currDate.year(), currDate.month(), currDate.day() ); |
708 | m1->popup(mapToGlobal(QPoint(0,height()))); | 708 | m1->popup(mapToGlobal(QPoint(0,height()))); |
709 | picker->setFocus(); | 709 | picker->setFocus(); |
710 | } | 710 | } |
711 | 711 | ||
712 | 712 | ||
713 | void DateButton::gotHide() | 713 | void DateButton::gotHide() |
714 | { | 714 | { |
715 | // we have to redo the button... | 715 | // we have to redo the button... |
716 | setDown( false ); | 716 | setDown( false ); |
717 | } | 717 | } |
718 | 718 | ||
719 | 719 | ||
720 | // void dateSelected( int year, int month, int day ); | 720 | // void dateSelected( int year, int month, int day ); |
721 | 721 | ||
722 | void DateButton::setWeekStartsMonday( int b ) | 722 | void DateButton::setWeekStartsMonday( int b ) |
723 | { | 723 | { |
724 | weekStartsMonday = b; | 724 | weekStartsMonday = b; |
725 | } | 725 | } |
726 | 726 | ||
727 | void DateButton::setDate( int y, int m, int d ) | 727 | void DateButton::setDate( int y, int m, int d ) |
728 | { | 728 | { |
729 | setDate( QDate( y,m,d) ); | 729 | setDate( QDate( y,m,d) ); |
730 | } | 730 | } |
731 | 731 | ||
732 | void DateButton::setDate( QDate d ) | 732 | void DateButton::setDate( QDate d ) |
733 | { | 733 | { |
734 | currDate = d; | 734 | currDate = d; |
735 | setText( longFormat ? TimeString::longDateString( d, df ) : | 735 | setText( longFormat ? TimeString::longDateString( d, df ) : |
736 | TimeString::shortDate( d, df ) ); | 736 | TimeString::shortDate( d, df ) ); |
737 | 737 | ||
738 | } | 738 | } |
739 | 739 | ||
740 | void DateButton::setDateFormat( DateFormat f ) | 740 | void DateButton::setDateFormat( DateFormat f ) |
741 | { | 741 | { |
742 | df = f; | 742 | df = f; |
743 | setDate( currDate ); | 743 | setDate( currDate ); |
744 | } | 744 | } |
745 | 745 | ||
746 | bool DateButton::customWhatsThis() const | 746 | bool DateButton::customWhatsThis() const |
747 | { | 747 | { |
748 | return TRUE; | 748 | return TRUE; |
749 | } | 749 | } |
750 | 750 | ||
751 | 751 | ||
752 | // this class is only here for Sharp ROM compatibility | 752 | // this class is only here for Sharp ROM compatibility |
753 | // I have reverse engineered this class and it seems to | 753 | // I have reverse engineered this class and it seems to |
754 | // work (only qtmail seems to use it) - sandman | 754 | // work (only qtmail seems to use it) - sandman |
755 | // DO NOT USE IT IN NEW CODE !! | 755 | // DO NOT USE IT IN NEW CODE !! |
756 | 756 | ||
757 | DateBookMonthPopup::DateBookMonthPopup ( QWidget *w ) | 757 | DateBookMonthPopup::DateBookMonthPopup ( QWidget *w ) |
758 | : QPopupMenu ( w ) | 758 | : QPopupMenu ( w ) |
759 | { | 759 | { |
760 | m_dbm = new DateBookMonth( this, 0, TRUE ); | 760 | m_dbm = new DateBookMonth( this, 0, TRUE ); |
761 | insertItem( m_dbm ); | 761 | insertItem( m_dbm ); |
762 | } | 762 | } |
diff --git a/library/fileselector.cpp b/library/fileselector.cpp index 7c29aba..93fb429 100644 --- a/library/fileselector.cpp +++ b/library/fileselector.cpp | |||
@@ -215,221 +215,221 @@ public: | |||
215 | 215 | ||
216 | int width( const QFontMetrics &fm, const QListView *v, int c ) const { | 216 | int width( const QFontMetrics &fm, const QListView *v, int c ) const { |
217 | return FileSelectorItem::width( fm, v, c )*4/3; // allow for bold font | 217 | return FileSelectorItem::width( fm, v, c )*4/3; // allow for bold font |
218 | } | 218 | } |
219 | }; | 219 | }; |
220 | 220 | ||
221 | //=========================================================================== | 221 | //=========================================================================== |
222 | 222 | ||
223 | class FileSelectorPrivate | 223 | class FileSelectorPrivate |
224 | { | 224 | { |
225 | public: | 225 | public: |
226 | TypeCombo *typeCombo; | 226 | TypeCombo *typeCombo; |
227 | CategorySelect *catSelect; | 227 | CategorySelect *catSelect; |
228 | QValueList<QRegExp> mimeFilters; | 228 | QValueList<QRegExp> mimeFilters; |
229 | int catId; | 229 | int catId; |
230 | bool showNew; | 230 | bool showNew; |
231 | NewDocItem *newDocItem; | 231 | NewDocItem *newDocItem; |
232 | DocLnkSet files; | 232 | DocLnkSet files; |
233 | QHBox *toolbar; | 233 | QHBox *toolbar; |
234 | }; | 234 | }; |
235 | 235 | ||
236 | /*! | 236 | /*! |
237 | \class FileSelector fileselector.h | 237 | \class FileSelector fileselector.h |
238 | \brief The FileSelector widget allows the user to select DocLnk objects. | 238 | \brief The FileSelector widget allows the user to select DocLnk objects. |
239 | 239 | ||
240 | This class presents a file selection dialog to the user. This widget | 240 | This class presents a file selection dialog to the user. This widget |
241 | is usually the first widget seen in a \link docwidget.html | 241 | is usually the first widget seen in a \link docwidget.html |
242 | document-oriented application\endlink. The developer will most often | 242 | document-oriented application\endlink. The developer will most often |
243 | create this widget in combination with a <a | 243 | create this widget in combination with a <a |
244 | href="../qt/qwidgetstack.html"> QWidgetStack</a> and the appropriate | 244 | href="../qt/qwidgetstack.html"> QWidgetStack</a> and the appropriate |
245 | editor and/or viewer widget for their application. This widget | 245 | editor and/or viewer widget for their application. This widget |
246 | should be shown first and the user can the select which document | 246 | should be shown first and the user can the select which document |
247 | they wish to operate on. Please refer to the implementation of | 247 | they wish to operate on. Please refer to the implementation of |
248 | texteditor for an example of how to tie these classes together. | 248 | texteditor for an example of how to tie these classes together. |
249 | 249 | ||
250 | Use setNewVisible() depending on whether the application can be used | 250 | Use setNewVisible() depending on whether the application can be used |
251 | to create new files or not. Use setCloseVisible() depending on | 251 | to create new files or not. Use setCloseVisible() depending on |
252 | whether the user may leave the dialog without creating or selecting | 252 | whether the user may leave the dialog without creating or selecting |
253 | a document or not. The number of files in the view is available from | 253 | a document or not. The number of files in the view is available from |
254 | fileCount(). To force the view to be updated call reread(). | 254 | fileCount(). To force the view to be updated call reread(). |
255 | 255 | ||
256 | If the user presses the 'New Document' button the newSelected() | 256 | If the user presses the 'New Document' button the newSelected() |
257 | signal is emitted. If the user selects an existing file the | 257 | signal is emitted. If the user selects an existing file the |
258 | fileSelected() signal is emitted. The selected file's \link | 258 | fileSelected() signal is emitted. The selected file's \link |
259 | doclnk.html DocLnk\endlink is available from the selected() | 259 | doclnk.html DocLnk\endlink is available from the selected() |
260 | function. If the file selector is no longer necessary the closeMe() | 260 | function. If the file selector is no longer necessary the closeMe() |
261 | signal is emitted. | 261 | signal is emitted. |
262 | 262 | ||
263 | \ingroup qtopiaemb | 263 | \ingroup qtopiaemb |
264 | \sa FileManager | 264 | \sa FileManager |
265 | */ | 265 | */ |
266 | 266 | ||
267 | /*! | 267 | /*! |
268 | Constructs a FileSelector with mime filter \a f. | 268 | Constructs a FileSelector with mime filter \a f. |
269 | The standard Qt \a parent and \a name parameters are passed to the | 269 | The standard Qt \a parent and \a name parameters are passed to the |
270 | parent widget. | 270 | parent widget. |
271 | 271 | ||
272 | If \a newVisible is TRUE, the widget has a button to allow the user | 272 | If \a newVisible is TRUE, the widget has a button to allow the user |
273 | the create "new" documents; this is useful for applications that can | 273 | the create "new" documents; this is useful for applications that can |
274 | create and edit documents but not suitable for applications that | 274 | create and edit documents but not suitable for applications that |
275 | only provide viewing. | 275 | only provide viewing. |
276 | 276 | ||
277 | \a closeVisible is deprecated | 277 | \a closeVisible is deprecated |
278 | 278 | ||
279 | \sa DocLnkSet::DocLnkSet() | 279 | \sa DocLnkSet::DocLnkSet() |
280 | */ | 280 | */ |
281 | FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name, bool newVisible, bool closeVisible ) | 281 | FileSelector::FileSelector( const QString &f, QWidget *parent, const char *name, bool newVisible, bool closeVisible ) |
282 | : QVBox( parent, name ), filter( f ) | 282 | : QVBox( parent, name ), filter( f ) |
283 | { | 283 | { |
284 | setMargin( 0 ); | 284 | setMargin( 0 ); |
285 | setSpacing( 0 ); | 285 | setSpacing( 0 ); |
286 | 286 | ||
287 | d = new FileSelectorPrivate(); | 287 | d = new FileSelectorPrivate(); |
288 | d->newDocItem = 0; | 288 | d->newDocItem = 0; |
289 | d->showNew = newVisible; | 289 | d->showNew = newVisible; |
290 | d->catId = -2; // All files | 290 | d->catId = -2; // All files |
291 | 291 | ||
292 | d->toolbar = new QHBox( this ); | 292 | d->toolbar = new QHBox( this ); |
293 | d->toolbar->setBackgroundMode( PaletteButton ); // same colour as toolbars | 293 | d->toolbar->setBackgroundMode( PaletteButton ); // same colour as toolbars |
294 | d->toolbar->setSpacing( 0 ); | 294 | d->toolbar->setSpacing( 0 ); |
295 | d->toolbar->hide(); | 295 | d->toolbar->hide(); |
296 | 296 | ||
297 | QWidget *spacer = new QWidget( d->toolbar ); | 297 | QWidget *spacer = new QWidget( d->toolbar ); |
298 | spacer->setBackgroundMode( PaletteButton ); | 298 | spacer->setBackgroundMode( PaletteButton ); |
299 | 299 | ||
300 | QToolButton *tb = new QToolButton( d->toolbar ); | 300 | QToolButton *tb = new QToolButton( d->toolbar ); |
301 | tb->setPixmap( Resource::loadPixmap( "close" ) ); | 301 | tb->setPixmap( Resource::loadPixmap( "close" ) ); |
302 | connect( tb, SIGNAL( clicked() ), this, SIGNAL( closeMe() ) ); | 302 | connect( tb, SIGNAL( clicked() ), this, SIGNAL( closeMe() ) ); |
303 | buttonClose = tb; | 303 | buttonClose = tb; |
304 | tb->setFixedSize( 18, 20 ); // tb->sizeHint() ); | 304 | tb->setFixedSize( 18, 20 ); // tb->sizeHint() ); |
305 | tb->setAutoRaise( TRUE ); | 305 | tb->setAutoRaise( TRUE ); |
306 | QToolTip::add( tb, tr( "Close the File Selector" ) ); | 306 | QToolTip::add( tb, tr( "Close the File Selector" ) ); |
307 | QPEMenuToolFocusManager::manager()->addWidget( tb ); | 307 | QPEMenuToolFocusManager::manager()->addWidget( tb ); |
308 | 308 | ||
309 | view = new FileSelectorView( this, "fileview" ); | 309 | view = new FileSelectorView( this, "fileview" ); |
310 | QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold ); | 310 | QPEApplication::setStylusOperation( view->viewport(), QPEApplication::RightOnHold ); |
311 | connect( view, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), | 311 | connect( view, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), |
312 | this, SLOT( fileClicked( int, QListViewItem *, const QPoint &, int ) ) ); | 312 | this, SLOT( fileClicked(int,QListViewItem*,const QPoint&,int) ) ); |
313 | connect( view, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int ) ), | 313 | connect( view, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), |
314 | this, SLOT( filePressed( int, QListViewItem *, const QPoint &, int ) ) ); | 314 | this, SLOT( filePressed(int,QListViewItem*,const QPoint&,int) ) ); |
315 | connect( view, SIGNAL( returnPressed( QListViewItem * ) ), | 315 | connect( view, SIGNAL( returnPressed(QListViewItem*) ), |
316 | this, SLOT( fileClicked( QListViewItem * ) ) ); | 316 | this, SLOT( fileClicked(QListViewItem*) ) ); |
317 | 317 | ||
318 | QHBox *hb = new QHBox( this ); | 318 | QHBox *hb = new QHBox( this ); |
319 | 319 | ||
320 | d->typeCombo = new TypeCombo( hb ); | 320 | d->typeCombo = new TypeCombo( hb ); |
321 | connect( d->typeCombo, SIGNAL(selected(const QString&)), | 321 | connect( d->typeCombo, SIGNAL(selected(const QString&)), |
322 | this, SLOT(typeSelected(const QString&)) ); | 322 | this, SLOT(typeSelected(const QString&)) ); |
323 | QWhatsThis::add( d->typeCombo, tr("Show documents of this type") ); | 323 | QWhatsThis::add( d->typeCombo, tr("Show documents of this type") ); |
324 | 324 | ||
325 | Categories c; | 325 | Categories c; |
326 | c.load(categoryFileName()); | 326 | c.load(categoryFileName()); |
327 | QArray<int> vl( 0 ); | 327 | QArray<int> vl( 0 ); |
328 | d->catSelect = new CategorySelect( hb ); | 328 | d->catSelect = new CategorySelect( hb ); |
329 | d->catSelect->setRemoveCategoryEdit( TRUE ); | 329 | d->catSelect->setRemoveCategoryEdit( TRUE ); |
330 | d->catSelect->setCategories( vl, "Document View", tr("Document View") ); | 330 | d->catSelect->setCategories( vl, "Document View", tr("Document View") ); |
331 | d->catSelect->setAllCategories( TRUE ); | 331 | d->catSelect->setAllCategories( TRUE ); |
332 | connect( d->catSelect, SIGNAL(signalSelected(int)), this, SLOT(catSelected(int)) ); | 332 | connect( d->catSelect, SIGNAL(signalSelected(int)), this, SLOT(catSelected(int)) ); |
333 | QWhatsThis::add( d->catSelect, tr("Show documents in this category") ); | 333 | QWhatsThis::add( d->catSelect, tr("Show documents in this category") ); |
334 | 334 | ||
335 | setCloseVisible( closeVisible ); | 335 | setCloseVisible( closeVisible ); |
336 | 336 | ||
337 | QCopChannel *channel = new QCopChannel( "QPE/Card", this ); | 337 | QCopChannel *channel = new QCopChannel( "QPE/Card", this ); |
338 | connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), | 338 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
339 | this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); | 339 | this, SLOT(cardMessage(const QCString&,const QByteArray&)) ); |
340 | 340 | ||
341 | reread(); | 341 | reread(); |
342 | updateWhatsThis(); | 342 | updateWhatsThis(); |
343 | } | 343 | } |
344 | 344 | ||
345 | /*! | 345 | /*! |
346 | Destroys the widget. | 346 | Destroys the widget. |
347 | */ | 347 | */ |
348 | FileSelector::~FileSelector() | 348 | FileSelector::~FileSelector() |
349 | { | 349 | { |
350 | delete d; | 350 | delete d; |
351 | } | 351 | } |
352 | 352 | ||
353 | /*! | 353 | /*! |
354 | Returns the number of files in the view. If this is zero, an editor | 354 | Returns the number of files in the view. If this is zero, an editor |
355 | application might bypass the selector and immediately start with | 355 | application might bypass the selector and immediately start with |
356 | a "new" document. | 356 | a "new" document. |
357 | */ | 357 | */ |
358 | int FileSelector::fileCount() | 358 | int FileSelector::fileCount() |
359 | { | 359 | { |
360 | return d->files.children().count();; | 360 | return d->files.children().count();; |
361 | } | 361 | } |
362 | 362 | ||
363 | /*! | 363 | /*! |
364 | Calling this function is the programmatic equivalent of the user | 364 | Calling this function is the programmatic equivalent of the user |
365 | pressing the "new" button. | 365 | pressing the "new" button. |
366 | 366 | ||
367 | \sa newSelected(), closeMe() | 367 | \sa newSelected(), closeMe() |
368 | */ | 368 | */ |
369 | void FileSelector::createNew() | 369 | void FileSelector::createNew() |
370 | { | 370 | { |
371 | DocLnk f; | 371 | DocLnk f; |
372 | emit newSelected( f ); | 372 | emit newSelected( f ); |
373 | emit closeMe(); | 373 | emit closeMe(); |
374 | } | 374 | } |
375 | 375 | ||
376 | void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) | 376 | void FileSelector::fileClicked( int button, QListViewItem *i, const QPoint &, int ) |
377 | { | 377 | { |
378 | if ( !i ) | 378 | if ( !i ) |
379 | return; | 379 | return; |
380 | if ( button == Qt::LeftButton ) { | 380 | if ( button == Qt::LeftButton ) { |
381 | fileClicked( i ); | 381 | fileClicked( i ); |
382 | } | 382 | } |
383 | } | 383 | } |
384 | 384 | ||
385 | void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, int ) | 385 | void FileSelector::filePressed( int button, QListViewItem *i, const QPoint &, int ) |
386 | { | 386 | { |
387 | if ( !i || i == d->newDocItem ) | 387 | if ( !i || i == d->newDocItem ) |
388 | return; | 388 | return; |
389 | if ( button == Qt::RightButton ) { | 389 | if ( button == Qt::RightButton ) { |
390 | DocLnk l = ((FileSelectorItem *)i)->file(); | 390 | DocLnk l = ((FileSelectorItem *)i)->file(); |
391 | LnkProperties prop( &l ); | 391 | LnkProperties prop( &l ); |
392 | prop.showMaximized(); | 392 | prop.showMaximized(); |
393 | prop.exec(); | 393 | prop.exec(); |
394 | reread(); | 394 | reread(); |
395 | } | 395 | } |
396 | } | 396 | } |
397 | 397 | ||
398 | void FileSelector::fileClicked( QListViewItem *i ) | 398 | void FileSelector::fileClicked( QListViewItem *i ) |
399 | { | 399 | { |
400 | if ( !i ) | 400 | if ( !i ) |
401 | return; | 401 | return; |
402 | if ( i == d->newDocItem ) { | 402 | if ( i == d->newDocItem ) { |
403 | createNew(); | 403 | createNew(); |
404 | } else { | 404 | } else { |
405 | emit fileSelected( ( (FileSelectorItem*)i )->file() ); | 405 | emit fileSelected( ( (FileSelectorItem*)i )->file() ); |
406 | emit closeMe(); | 406 | emit closeMe(); |
407 | } | 407 | } |
408 | } | 408 | } |
409 | 409 | ||
410 | void FileSelector::typeSelected( const QString &type ) | 410 | void FileSelector::typeSelected( const QString &type ) |
411 | { | 411 | { |
412 | d->mimeFilters.clear(); | 412 | d->mimeFilters.clear(); |
413 | QStringList subFilter = QStringList::split(";", type); | 413 | QStringList subFilter = QStringList::split(";", type); |
414 | for( QStringList::Iterator it = subFilter.begin(); it != subFilter.end(); ++it ) | 414 | for( QStringList::Iterator it = subFilter.begin(); it != subFilter.end(); ++it ) |
415 | d->mimeFilters.append( QRegExp(*it, FALSE, TRUE) ); | 415 | d->mimeFilters.append( QRegExp(*it, FALSE, TRUE) ); |
416 | updateView(); | 416 | updateView(); |
417 | } | 417 | } |
418 | 418 | ||
419 | void FileSelector::catSelected( int c ) | 419 | void FileSelector::catSelected( int c ) |
420 | { | 420 | { |
421 | d->catId = c; | 421 | d->catId = c; |
422 | updateView(); | 422 | updateView(); |
423 | } | 423 | } |
424 | 424 | ||
425 | void FileSelector::cardMessage( const QCString &msg, const QByteArray &) | 425 | void FileSelector::cardMessage( const QCString &msg, const QByteArray &) |
426 | { | 426 | { |
427 | if ( msg == "mtabChanged()" ) | 427 | if ( msg == "mtabChanged()" ) |
428 | reread(); | 428 | reread(); |
429 | } | 429 | } |
430 | 430 | ||
431 | 431 | ||
432 | /*! | 432 | /*! |
433 | Returns the selected \link doclnk.html DocLnk\endlink. The caller is | 433 | Returns the selected \link doclnk.html DocLnk\endlink. The caller is |
434 | responsible for deleting the returned value. | 434 | responsible for deleting the returned value. |
435 | */ | 435 | */ |
diff --git a/library/finddialog.cpp b/library/finddialog.cpp index 64487c9..9417179 100644 --- a/library/finddialog.cpp +++ b/library/finddialog.cpp | |||
@@ -1,84 +1,80 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
22 | // have this class. | 22 | // have this class. |
23 | #define QTOPIA_INTERNAL_FD | 23 | #define QTOPIA_INTERNAL_FD |
24 | 24 | ||
25 | #include "finddialog.h" | 25 | #include "finddialog.h" |
26 | #include "findwidget_p.h" | 26 | #include "findwidget_p.h" |
27 | 27 | ||
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | 29 | ||
30 | /*! | 30 | /*! |
31 | \class FindDialog finddialog.h | 31 | \class FindDialog finddialog.h |
32 | \brief A simple FindDialog | 32 | \brief A simple FindDialog |
33 | 33 | ||
34 | A find dialog. FIXME!!!! | 34 | A find dialog. FIXME!!!! |
35 | 35 | ||
36 | */ | 36 | */ |
37 | FindDialog::FindDialog( const QString &appName, QWidget *parent, | 37 | FindDialog::FindDialog( const QString &appName, QWidget *parent, |
38 | const char *name, bool modal ) | 38 | const char *name, bool modal ) |
39 | : QDialog( parent, name, modal ) | 39 | : QDialog( parent, name, modal ) |
40 | { | 40 | { |
41 | setCaption( tr("Find") ); | 41 | setCaption( tr("Find") ); |
42 | QVBoxLayout *vb; | 42 | QVBoxLayout *vb; |
43 | vb = new QVBoxLayout( this ); | 43 | vb = new QVBoxLayout( this ); |
44 | fw = new FindWidget( appName, this, "Find Widget" ); | 44 | fw = new FindWidget( appName, this, "Find Widget" ); |
45 | vb->addWidget( fw ); | 45 | vb->addWidget( fw ); |
46 | QObject::connect( fw, SIGNAL(signalFindClicked(const QString&, | 46 | QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,bool,bool,int)), |
47 | bool,bool,int)), | 47 | this, SIGNAL(signalFindClicked(const QString&,bool,bool,int)) ); |
48 | this, SIGNAL(signalFindClicked(const QString&, | 48 | QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)), |
49 | bool,bool,int)) ); | 49 | this, SIGNAL(signalFindClicked(const QString&,const QDate&,bool,bool,int)) ); |
50 | QObject::connect( fw, SIGNAL(signalFindClicked(const QString&,const QDate&, | ||
51 | bool,bool,int)), | ||
52 | this, SIGNAL(signalFindClicked(const QString&, | ||
53 | const QDate&,bool,bool,int)) ); | ||
54 | d = 0; | 50 | d = 0; |
55 | } | 51 | } |
56 | 52 | ||
57 | FindDialog::~FindDialog() | 53 | FindDialog::~FindDialog() |
58 | { | 54 | { |
59 | } | 55 | } |
60 | 56 | ||
61 | QString FindDialog::findText() const | 57 | QString FindDialog::findText() const |
62 | { | 58 | { |
63 | return fw->findText(); | 59 | return fw->findText(); |
64 | } | 60 | } |
65 | 61 | ||
66 | void FindDialog::setUseDate( bool show ) | 62 | void FindDialog::setUseDate( bool show ) |
67 | { | 63 | { |
68 | fw->setUseDate( show ); | 64 | fw->setUseDate( show ); |
69 | } | 65 | } |
70 | 66 | ||
71 | void FindDialog::setDate( const QDate &dt ) | 67 | void FindDialog::setDate( const QDate &dt ) |
72 | { | 68 | { |
73 | fw->setDate( dt ); | 69 | fw->setDate( dt ); |
74 | } | 70 | } |
75 | 71 | ||
76 | void FindDialog::slotNotFound() | 72 | void FindDialog::slotNotFound() |
77 | { | 73 | { |
78 | fw->slotNotFound(); | 74 | fw->slotNotFound(); |
79 | } | 75 | } |
80 | 76 | ||
81 | void FindDialog::slotWrapAround() | 77 | void FindDialog::slotWrapAround() |
82 | { | 78 | { |
83 | fw->slotWrapAround(); | 79 | fw->slotWrapAround(); |
84 | } | 80 | } |
diff --git a/library/findwidget_p.cpp b/library/findwidget_p.cpp index e91d789..0591f07 100644 --- a/library/findwidget_p.cpp +++ b/library/findwidget_p.cpp | |||
@@ -1,114 +1,114 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "findwidget_p.h" | 21 | #include "findwidget_p.h" |
22 | 22 | ||
23 | #include <qpe/categoryselect.h> | 23 | #include <qpe/categoryselect.h> |
24 | #include <qpe/datebookmonth.h> | 24 | #include <qpe/datebookmonth.h> |
25 | 25 | ||
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | 29 | ||
30 | FindWidget::FindWidget( const QString &appName, QWidget *parent, | 30 | FindWidget::FindWidget( const QString &appName, QWidget *parent, |
31 | const char *name ) | 31 | const char *name ) |
32 | : FindWidgetBase( parent, name ), | 32 | : FindWidgetBase( parent, name ), |
33 | mStrApp( appName ), | 33 | mStrApp( appName ), |
34 | mDate( QDate::currentDate() ) | 34 | mDate( QDate::currentDate() ) |
35 | { | 35 | { |
36 | setMaximumSize( sizeHint() ); | 36 | setMaximumSize( sizeHint() ); |
37 | QArray<int> vl(0); | 37 | QArray<int> vl(0); |
38 | cmbCat->setCategories( vl, mStrApp ); | 38 | cmbCat->setCategories( vl, mStrApp ); |
39 | cmbCat->setRemoveCategoryEdit( TRUE ); | 39 | cmbCat->setRemoveCategoryEdit( TRUE ); |
40 | cmbCat->setAllCategories( TRUE ); | 40 | cmbCat->setAllCategories( TRUE ); |
41 | // hide junk for the moment... | 41 | // hide junk for the moment... |
42 | lblStartDate->hide(); | 42 | lblStartDate->hide(); |
43 | cmdStartDate->hide(); | 43 | cmdStartDate->hide(); |
44 | QPopupMenu *m1 = new QPopupMenu( this ); | 44 | QPopupMenu *m1 = new QPopupMenu( this ); |
45 | dtPicker = new DateBookMonth( m1, 0, TRUE ); | 45 | dtPicker = new DateBookMonth( m1, 0, TRUE ); |
46 | dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() ); | 46 | dtPicker->setDate( mDate.year(), mDate.month(), mDate.day() ); |
47 | m1->insertItem( dtPicker ); | 47 | m1->insertItem( dtPicker ); |
48 | cmdStartDate->setPopup( m1 ); | 48 | cmdStartDate->setPopup( m1 ); |
49 | cmdStartDate->setText( TimeString::shortDate(mDate) ); | 49 | cmdStartDate->setText( TimeString::shortDate(mDate) ); |
50 | QObject::connect( dtPicker, SIGNAL(dateClicked(int, int, int)), | 50 | QObject::connect( dtPicker, SIGNAL(dateClicked(int,int,int)), |
51 | this, SLOT(slotDateChanged(int, int, int)) ); | 51 | this, SLOT(slotDateChanged(int,int,int)) ); |
52 | 52 | ||
53 | QObject::connect( cmdFind, SIGNAL(clicked()), | 53 | QObject::connect( cmdFind, SIGNAL(clicked()), |
54 | this, SLOT(slotFindClicked()) ); | 54 | this, SLOT(slotFindClicked()) ); |
55 | } | 55 | } |
56 | 56 | ||
57 | FindWidget::~FindWidget() | 57 | FindWidget::~FindWidget() |
58 | { | 58 | { |
59 | } | 59 | } |
60 | 60 | ||
61 | QString FindWidget::findText() const | 61 | QString FindWidget::findText() const |
62 | { | 62 | { |
63 | return txtFind->text(); | 63 | return txtFind->text(); |
64 | } | 64 | } |
65 | 65 | ||
66 | void FindWidget::slotFindClicked() | 66 | void FindWidget::slotFindClicked() |
67 | { | 67 | { |
68 | lblStatus->setText( "" ); | 68 | lblStatus->setText( "" ); |
69 | if ( cmdStartDate->isVisible() ) | 69 | if ( cmdStartDate->isVisible() ) |
70 | emit signalFindClicked( findText(), | 70 | emit signalFindClicked( findText(), |
71 | mDate, | 71 | mDate, |
72 | chkCase->isChecked(), | 72 | chkCase->isChecked(), |
73 | chkBackwards->isChecked(), | 73 | chkBackwards->isChecked(), |
74 | cmbCat->currentCategory() ); | 74 | cmbCat->currentCategory() ); |
75 | else | 75 | else |
76 | emit signalFindClicked( findText(), chkCase->isChecked(), | 76 | emit signalFindClicked( findText(), chkCase->isChecked(), |
77 | chkBackwards->isChecked(), | 77 | chkBackwards->isChecked(), |
78 | cmbCat->currentCategory() ); | 78 | cmbCat->currentCategory() ); |
79 | } | 79 | } |
80 | 80 | ||
81 | void FindWidget::setUseDate( bool show ) | 81 | void FindWidget::setUseDate( bool show ) |
82 | { | 82 | { |
83 | if ( show ) { | 83 | if ( show ) { |
84 | lblStartDate->show(); | 84 | lblStartDate->show(); |
85 | cmdStartDate->show(); | 85 | cmdStartDate->show(); |
86 | } else { | 86 | } else { |
87 | lblStartDate->hide(); | 87 | lblStartDate->hide(); |
88 | cmdStartDate->hide(); | 88 | cmdStartDate->hide(); |
89 | } | 89 | } |
90 | chkBackwards->setDisabled( show ); | 90 | chkBackwards->setDisabled( show ); |
91 | } | 91 | } |
92 | 92 | ||
93 | void FindWidget::setDate( const QDate &dt ) | 93 | void FindWidget::setDate( const QDate &dt ) |
94 | { | 94 | { |
95 | slotDateChanged( dt.year(), dt.month(), dt.day() ); | 95 | slotDateChanged( dt.year(), dt.month(), dt.day() ); |
96 | } | 96 | } |
97 | 97 | ||
98 | void FindWidget::slotNotFound() | 98 | void FindWidget::slotNotFound() |
99 | { | 99 | { |
100 | lblStatus->setText( tr("String Not Found.") ); | 100 | lblStatus->setText( tr("String Not Found.") ); |
101 | } | 101 | } |
102 | 102 | ||
103 | void FindWidget::slotWrapAround() | 103 | void FindWidget::slotWrapAround() |
104 | { | 104 | { |
105 | lblStatus->setText( tr("End reached, starting at %1", "Date using TimeString::shortDate") | 105 | lblStatus->setText( tr("End reached, starting at %1", "Date using TimeString::shortDate") |
106 | .arg(TimeString::shortDate( mDate ) ) ); | 106 | .arg(TimeString::shortDate( mDate ) ) ); |
107 | } | 107 | } |
108 | 108 | ||
109 | void FindWidget::slotDateChanged( int year, int month, int day ) | 109 | void FindWidget::slotDateChanged( int year, int month, int day ) |
110 | { | 110 | { |
111 | mDate.setYMD( year, month, day ); | 111 | mDate.setYMD( year, month, day ); |
112 | cmdStartDate->setText( TimeString::shortDate( mDate ) ); | 112 | cmdStartDate->setText( TimeString::shortDate( mDate ) ); |
113 | dtPicker->setDate( year, month, day ); | 113 | dtPicker->setDate( year, month, day ); |
114 | } | 114 | } |
diff --git a/library/ir.cpp b/library/ir.cpp index 32c0925..c581eb1 100644 --- a/library/ir.cpp +++ b/library/ir.cpp | |||
@@ -1,116 +1,116 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "ir.h" | 21 | #include "ir.h" |
22 | 22 | ||
23 | #include "qcopenvelope_qws.h" | 23 | #include "qcopenvelope_qws.h" |
24 | #include "applnk.h" | 24 | #include "applnk.h" |
25 | 25 | ||
26 | /*! | 26 | /*! |
27 | \class Ir ir.h | 27 | \class Ir ir.h |
28 | \brief The Ir class implements basic support for sending objects over an | 28 | \brief The Ir class implements basic support for sending objects over an |
29 | infrared communication link. | 29 | infrared communication link. |
30 | 30 | ||
31 | Both \link doclnk.html DocLnk\endlink objects and files can be | 31 | Both \link doclnk.html DocLnk\endlink objects and files can be |
32 | sent to another device via the infrared link using the send() | 32 | sent to another device via the infrared link using the send() |
33 | function. When the send has completed the done() signal is | 33 | function. When the send has completed the done() signal is |
34 | emitted. | 34 | emitted. |
35 | 35 | ||
36 | The supported() function returns whether the device supports | 36 | The supported() function returns whether the device supports |
37 | infrared communication or not. | 37 | infrared communication or not. |
38 | 38 | ||
39 | \ingroup qtopiaemb | 39 | \ingroup qtopiaemb |
40 | */ | 40 | */ |
41 | 41 | ||
42 | /*! | 42 | /*! |
43 | Constructs an Ir object. The \a parent and \a name classes are the | 43 | Constructs an Ir object. The \a parent and \a name classes are the |
44 | standard QObject parameters. | 44 | standard QObject parameters. |
45 | */ | 45 | */ |
46 | Ir::Ir( QObject *parent, const char *name ) | 46 | Ir::Ir( QObject *parent, const char *name ) |
47 | : QObject( parent, name ) | 47 | : QObject( parent, name ) |
48 | { | 48 | { |
49 | #ifndef QT_NO_COP | 49 | #ifndef QT_NO_COP |
50 | ch = new QCopChannel( "QPE/Obex" ); | 50 | ch = new QCopChannel( "QPE/Obex" ); |
51 | connect( ch, SIGNAL(received(const QCString &, const QByteArray &)), | 51 | connect( ch, SIGNAL(received(const QCString&,const QByteArray&)), |
52 | this, SLOT(obexMessage( const QCString &, const QByteArray &)) ); | 52 | this, SLOT(obexMessage(const QCString&,const QByteArray&)) ); |
53 | #endif | 53 | #endif |
54 | } | 54 | } |
55 | 55 | ||
56 | /*! | 56 | /*! |
57 | Returns TRUE if the system supports infrared communication; | 57 | Returns TRUE if the system supports infrared communication; |
58 | otherwise returns FALSE. | 58 | otherwise returns FALSE. |
59 | */ | 59 | */ |
60 | bool Ir::supported() | 60 | bool Ir::supported() |
61 | { | 61 | { |
62 | #ifndef QT_NO_COP | 62 | #ifndef QT_NO_COP |
63 | return QCopChannel::isRegistered( "QPE/Obex" ); | 63 | return QCopChannel::isRegistered( "QPE/Obex" ); |
64 | #endif | 64 | #endif |
65 | } | 65 | } |
66 | 66 | ||
67 | /*! | 67 | /*! |
68 | Sends the object in file \a fn over the infrared link. The \a | 68 | Sends the object in file \a fn over the infrared link. The \a |
69 | description is used in the text shown to the user while sending | 69 | description is used in the text shown to the user while sending |
70 | is in progress. The optional \a mimetype parameter specifies the | 70 | is in progress. The optional \a mimetype parameter specifies the |
71 | mimetype of the object. If this parameter is not set, it is | 71 | mimetype of the object. If this parameter is not set, it is |
72 | determined by the the filename's suffix. | 72 | determined by the the filename's suffix. |
73 | 73 | ||
74 | \sa done() | 74 | \sa done() |
75 | */ | 75 | */ |
76 | void Ir::send( const QString &fn, const QString &description, const QString &mimetype) | 76 | void Ir::send( const QString &fn, const QString &description, const QString &mimetype) |
77 | { | 77 | { |
78 | if ( !filename.isEmpty() ) return; | 78 | if ( !filename.isEmpty() ) return; |
79 | filename = fn; | 79 | filename = fn; |
80 | #ifndef QT_NO_COP | 80 | #ifndef QT_NO_COP |
81 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); | 81 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); |
82 | e << description << filename << mimetype; | 82 | e << description << filename << mimetype; |
83 | #endif | 83 | #endif |
84 | } | 84 | } |
85 | 85 | ||
86 | /*! | 86 | /*! |
87 | \overload | 87 | \overload |
88 | 88 | ||
89 | Uses the DocLnk::file() and DocLnk::type() of \a doc. | 89 | Uses the DocLnk::file() and DocLnk::type() of \a doc. |
90 | 90 | ||
91 | \sa done() | 91 | \sa done() |
92 | */ | 92 | */ |
93 | void Ir::send( const DocLnk &doc, const QString &description ) | 93 | void Ir::send( const DocLnk &doc, const QString &description ) |
94 | { | 94 | { |
95 | send( doc.file(), description, doc.type() ); | 95 | send( doc.file(), description, doc.type() ); |
96 | } | 96 | } |
97 | 97 | ||
98 | /*! | 98 | /*! |
99 | \fn Ir::done( Ir *ir ); | 99 | \fn Ir::done( Ir *ir ); |
100 | 100 | ||
101 | This signal is emitted by \a ir, when the send comand has been processed. | 101 | This signal is emitted by \a ir, when the send comand has been processed. |
102 | */ | 102 | */ |
103 | 103 | ||
104 | /*!\internal | 104 | /*!\internal |
105 | */ | 105 | */ |
106 | void Ir::obexMessage( const QCString &msg, const QByteArray &data) | 106 | void Ir::obexMessage( const QCString &msg, const QByteArray &data) |
107 | { | 107 | { |
108 | if ( msg == "done(QString)" ) { | 108 | if ( msg == "done(QString)" ) { |
109 | QString fn; | 109 | QString fn; |
110 | QDataStream stream( data, IO_ReadOnly ); | 110 | QDataStream stream( data, IO_ReadOnly ); |
111 | stream >> fn; | 111 | stream >> fn; |
112 | if ( fn == filename ) | 112 | if ( fn == filename ) |
113 | emit done( this ); | 113 | emit done( this ); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/library/network.cpp b/library/network.cpp index 991e11a..df28857 100644 --- a/library/network.cpp +++ b/library/network.cpp | |||
@@ -68,194 +68,194 @@ void Network::start(const QString& choice, const QString& password) | |||
68 | 68 | ||
69 | /*! | 69 | /*! |
70 | \class Network network.h | 70 | \class Network network.h |
71 | \brief The Network class provides network access functionality. | 71 | \brief The Network class provides network access functionality. |
72 | \internal | 72 | \internal |
73 | */ | 73 | */ |
74 | 74 | ||
75 | // copy the proxy settings of the active config over to the Proxies.conf file | 75 | // copy the proxy settings of the active config over to the Proxies.conf file |
76 | /*! | 76 | /*! |
77 | \internal | 77 | \internal |
78 | */ | 78 | */ |
79 | void Network::writeProxySettings( Config &cfg ) | 79 | void Network::writeProxySettings( Config &cfg ) |
80 | { | 80 | { |
81 | Config proxy( Network::settingsDir() + "/Proxies.conf", Config::File ); | 81 | Config proxy( Network::settingsDir() + "/Proxies.conf", Config::File ); |
82 | proxy.setGroup("Properties"); | 82 | proxy.setGroup("Properties"); |
83 | cfg.setGroup("Proxy"); | 83 | cfg.setGroup("Proxy"); |
84 | proxy.writeEntry("type", cfg.readEntry("type") ); | 84 | proxy.writeEntry("type", cfg.readEntry("type") ); |
85 | proxy.writeEntry("autoconfig", cfg.readEntry("autoconfig") ); | 85 | proxy.writeEntry("autoconfig", cfg.readEntry("autoconfig") ); |
86 | proxy.writeEntry("httphost", cfg.readEntry("httphost") ); | 86 | proxy.writeEntry("httphost", cfg.readEntry("httphost") ); |
87 | proxy.writeEntry("httpport", cfg.readEntry("httpport") ); | 87 | proxy.writeEntry("httpport", cfg.readEntry("httpport") ); |
88 | proxy.writeEntry("ftphost", cfg.readEntry("ftphost") ); | 88 | proxy.writeEntry("ftphost", cfg.readEntry("ftphost") ); |
89 | proxy.writeEntry("ftpport", cfg.readEntry("ftpport") ); | 89 | proxy.writeEntry("ftpport", cfg.readEntry("ftpport") ); |
90 | proxy.writeEntry("noproxies", cfg.readEntry("noproxies") ); | 90 | proxy.writeEntry("noproxies", cfg.readEntry("noproxies") ); |
91 | cfg.setGroup("Properties"); | 91 | cfg.setGroup("Properties"); |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | /*! | 96 | /*! |
97 | \internal | 97 | \internal |
98 | 98 | ||
99 | Stops the current network service. | 99 | Stops the current network service. |
100 | */ | 100 | */ |
101 | void Network::stop() | 101 | void Network::stop() |
102 | { | 102 | { |
103 | QCopEnvelope e("QPE/Network", "stop()"); | 103 | QCopEnvelope e("QPE/Network", "stop()"); |
104 | } | 104 | } |
105 | 105 | ||
106 | static NetworkEmitter *emitter = 0; | 106 | static NetworkEmitter *emitter = 0; |
107 | 107 | ||
108 | /*! | 108 | /*! |
109 | \internal | 109 | \internal |
110 | */ | 110 | */ |
111 | void Network::connectChoiceChange(QObject* receiver, const char* slot) | 111 | void Network::connectChoiceChange(QObject* receiver, const char* slot) |
112 | { | 112 | { |
113 | if ( !emitter ) | 113 | if ( !emitter ) |
114 | emitter = new NetworkEmitter; | 114 | emitter = new NetworkEmitter; |
115 | QObject::connect(emitter,SIGNAL(changed()),receiver,slot); | 115 | QObject::connect(emitter,SIGNAL(changed()),receiver,slot); |
116 | } | 116 | } |
117 | 117 | ||
118 | #endif// QT_NO_COP | 118 | #endif// QT_NO_COP |
119 | /*! | 119 | /*! |
120 | \internal | 120 | \internal |
121 | */ | 121 | */ |
122 | QString Network::settingsDir() | 122 | QString Network::settingsDir() |
123 | { | 123 | { |
124 | return Global::applicationFileName("Network", "modules"); | 124 | return Global::applicationFileName("Network", "modules"); |
125 | } | 125 | } |
126 | 126 | ||
127 | #ifndef QT_NO_COP | 127 | #ifndef QT_NO_COP |
128 | /*! | 128 | /*! |
129 | \internal | 129 | \internal |
130 | */ | 130 | */ |
131 | QStringList Network::choices(QListBox* lb, const QString& dir) | 131 | QStringList Network::choices(QListBox* lb, const QString& dir) |
132 | { | 132 | { |
133 | QStringList list; | 133 | QStringList list; |
134 | 134 | ||
135 | if ( lb ) | 135 | if ( lb ) |
136 | lb->clear(); | 136 | lb->clear(); |
137 | 137 | ||
138 | QString adir = dir.isEmpty() ? settingsDir() : dir; | 138 | QString adir = dir.isEmpty() ? settingsDir() : dir; |
139 | QDir settingsdir(adir); | 139 | QDir settingsdir(adir); |
140 | settingsdir.mkdir(adir); | 140 | settingsdir.mkdir(adir); |
141 | 141 | ||
142 | QStringList files = settingsdir.entryList("*.conf"); | 142 | QStringList files = settingsdir.entryList("*.conf"); |
143 | for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) { | 143 | for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) { |
144 | QString filename = settingsdir.filePath(*it); | 144 | QString filename = settingsdir.filePath(*it); |
145 | Config cfg(filename, Config::File); | 145 | Config cfg(filename, Config::File); |
146 | cfg.setGroup("Info"); | 146 | cfg.setGroup("Info"); |
147 | if ( lb ) | 147 | if ( lb ) |
148 | lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")), | 148 | lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")), |
149 | cfg.readEntry("Name")); | 149 | cfg.readEntry("Name")); |
150 | list.append(filename); | 150 | list.append(filename); |
151 | } | 151 | } |
152 | 152 | ||
153 | return list; | 153 | return list; |
154 | } | 154 | } |
155 | 155 | ||
156 | class NetworkServer : public QCopChannel { | 156 | class NetworkServer : public QCopChannel { |
157 | Q_OBJECT | 157 | Q_OBJECT |
158 | public: | 158 | public: |
159 | NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0) | 159 | NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0) |
160 | { | 160 | { |
161 | up = FALSE; | 161 | up = FALSE; |
162 | examineNetworks( TRUE ); | 162 | examineNetworks( TRUE ); |
163 | QCopChannel* card = new QCopChannel("QPE/Card",parent); | 163 | QCopChannel* card = new QCopChannel("QPE/Card",parent); |
164 | connect(card,SIGNAL(received(const QCString &, const QByteArray&)), | 164 | connect(card,SIGNAL(received(const QCString&,const QByteArray&)), |
165 | this,SLOT(cardMessage(const QCString &, const QByteArray&))); | 165 | this,SLOT(cardMessage(const QCString&,const QByteArray&))); |
166 | } | 166 | } |
167 | 167 | ||
168 | ~NetworkServer() | 168 | ~NetworkServer() |
169 | { | 169 | { |
170 | stop(); | 170 | stop(); |
171 | } | 171 | } |
172 | 172 | ||
173 | bool networkOnline() const | 173 | bool networkOnline() const |
174 | { | 174 | { |
175 | return up; | 175 | return up; |
176 | } | 176 | } |
177 | 177 | ||
178 | private: | 178 | private: |
179 | void receive(const QCString &msg, const QByteArray& data) | 179 | void receive(const QCString &msg, const QByteArray& data) |
180 | { | 180 | { |
181 | if ( msg == "start(QString,QString)" ) { | 181 | if ( msg == "start(QString,QString)" ) { |
182 | QDataStream stream(data,IO_ReadOnly); | 182 | QDataStream stream(data,IO_ReadOnly); |
183 | QString file,password; | 183 | QString file,password; |
184 | stream >> file >> password; | 184 | stream >> file >> password; |
185 | if ( file.isEmpty() ) { | 185 | if ( file.isEmpty() ) { |
186 | QStringList l = Network::choices(); | 186 | QStringList l = Network::choices(); |
187 | for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) { | 187 | for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) { |
188 | Config cfg(*i,Config::File); | 188 | Config cfg(*i,Config::File); |
189 | cfg.setGroup("Info"); | 189 | cfg.setGroup("Info"); |
190 | QString type = cfg.readEntry("Type"); | 190 | QString type = cfg.readEntry("Type"); |
191 | NetworkInterface* plugin = Network::loadPlugin(type); | 191 | NetworkInterface* plugin = Network::loadPlugin(type); |
192 | cfg.setGroup("Properties"); | 192 | cfg.setGroup("Properties"); |
193 | if ( plugin && plugin->isAvailable(cfg) ) { | 193 | if ( plugin && plugin->isAvailable(cfg) ) { |
194 | file = *i; | 194 | file = *i; |
195 | break; | 195 | break; |
196 | } | 196 | } |
197 | } | 197 | } |
198 | if ( file.isEmpty() ) { | 198 | if ( file.isEmpty() ) { |
199 | QCopEnvelope("QPE/Network", "failed()"); | 199 | QCopEnvelope("QPE/Network", "failed()"); |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | start(file,password); | 203 | start(file,password); |
204 | } else if ( msg == "stop()" ) { | 204 | } else if ( msg == "stop()" ) { |
205 | stop(); | 205 | stop(); |
206 | } else if ( msg == "choicesChanged()" ) { | 206 | } else if ( msg == "choicesChanged()" ) { |
207 | examineNetworks(); | 207 | examineNetworks(); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | private slots: | 211 | private slots: |
212 | void cardMessage(const QCString &msg, const QByteArray&) | 212 | void cardMessage(const QCString &msg, const QByteArray&) |
213 | { | 213 | { |
214 | if ( msg == "stabChanged()" ) | 214 | if ( msg == "stabChanged()" ) |
215 | examineNetworks(); | 215 | examineNetworks(); |
216 | } | 216 | } |
217 | 217 | ||
218 | private: | 218 | private: |
219 | void examineNetworks( bool firstStart = FALSE ) | 219 | void examineNetworks( bool firstStart = FALSE ) |
220 | { | 220 | { |
221 | QStringList l = Network::choices(); | 221 | QStringList l = Network::choices(); |
222 | bool wasup = up; up=FALSE; | 222 | bool wasup = up; up=FALSE; |
223 | QStringList pavailable = available; | 223 | QStringList pavailable = available; |
224 | available.clear(); | 224 | available.clear(); |
225 | for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) { | 225 | for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) { |
226 | Config cfg(*it,Config::File); | 226 | Config cfg(*it,Config::File); |
227 | cfg.setGroup("Info"); | 227 | cfg.setGroup("Info"); |
228 | QString type = cfg.readEntry("Type"); | 228 | QString type = cfg.readEntry("Type"); |
229 | NetworkInterface* plugin = Network::loadPlugin(type); | 229 | NetworkInterface* plugin = Network::loadPlugin(type); |
230 | cfg.setGroup("Properties"); | 230 | cfg.setGroup("Properties"); |
231 | if ( plugin ) { | 231 | if ( plugin ) { |
232 | if ( plugin->isActive(cfg) ) { | 232 | if ( plugin->isActive(cfg) ) { |
233 | up = TRUE; | 233 | up = TRUE; |
234 | if ( firstStart ) | 234 | if ( firstStart ) |
235 | plugin->start( cfg ); | 235 | plugin->start( cfg ); |
236 | } | 236 | } |
237 | if ( plugin->isAvailable(cfg) ) | 237 | if ( plugin->isAvailable(cfg) ) |
238 | available.append(*it); | 238 | available.append(*it); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | // Try to work around unreproducible bug whereby | 242 | // Try to work around unreproducible bug whereby |
243 | // the netmon applet shows wrong state. | 243 | // the netmon applet shows wrong state. |
244 | bool reannounce = wait<0; | 244 | bool reannounce = wait<0; |
245 | 245 | ||
246 | if ( available != pavailable || reannounce ) { | 246 | if ( available != pavailable || reannounce ) { |
247 | QCopEnvelope e("QPE/Network", "available(QStringList)"); | 247 | QCopEnvelope e("QPE/Network", "available(QStringList)"); |
248 | e << available; | 248 | e << available; |
249 | } | 249 | } |
250 | if ( up != wasup || reannounce ) { | 250 | if ( up != wasup || reannounce ) { |
251 | QCopEnvelope("QPE/Network", up ? "up()" : "down()"); | 251 | QCopEnvelope("QPE/Network", up ? "up()" : "down()"); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | void start( const QString& file, const QString& password ) | 255 | void start( const QString& file, const QString& password ) |
256 | { | 256 | { |
257 | if ( !current.isEmpty() ) | 257 | if ( !current.isEmpty() ) |
258 | stop(); | 258 | stop(); |
259 | current = QString::null; | 259 | current = QString::null; |
260 | Config cfg(file, Config::File); | 260 | Config cfg(file, Config::File); |
261 | cfg.setGroup("Info"); | 261 | cfg.setGroup("Info"); |
diff --git a/library/qcopenvelope_qws.cpp b/library/qcopenvelope_qws.cpp index 8f58787..63efb13 100644 --- a/library/qcopenvelope_qws.cpp +++ b/library/qcopenvelope_qws.cpp | |||
@@ -1,145 +1,145 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef QT_NO_COP | 21 | #ifndef QT_NO_COP |
22 | #include "qcopenvelope_qws.h" | 22 | #include "qcopenvelope_qws.h" |
23 | #endif | 23 | #endif |
24 | #include <qbuffer.h> | 24 | #include <qbuffer.h> |
25 | #include <qfile.h> | 25 | #include <qfile.h> |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | #include <sys/file.h> | 28 | #include <sys/file.h> |
29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
30 | #include <sys/stat.h> | 30 | #include <sys/stat.h> |
31 | #include <time.h> | 31 | #include <time.h> |
32 | 32 | ||
33 | #ifndef QT_NO_COP | 33 | #ifndef QT_NO_COP |
34 | 34 | ||
35 | /*! | 35 | /*! |
36 | \class QCopEnvelope qcopenvelope_qws.h | 36 | \class QCopEnvelope qcopenvelope_qws.h |
37 | \brief The QCopEnvelope class encapsulates and sends QCop messages | 37 | \brief The QCopEnvelope class encapsulates and sends QCop messages |
38 | over QCopChannels. | 38 | over QCopChannels. |
39 | 39 | ||
40 | QCop messages allow applications to communicate with each other. | 40 | QCop messages allow applications to communicate with each other. |
41 | These messages are sent using QCopEnvelope, and received by connecting | 41 | These messages are sent using QCopEnvelope, and received by connecting |
42 | to a QCopChannel. | 42 | to a QCopChannel. |
43 | 43 | ||
44 | To send a message, use the following protocol: | 44 | To send a message, use the following protocol: |
45 | 45 | ||
46 | \code | 46 | \code |
47 | QCopEnvelope e(channelname, messagename); | 47 | QCopEnvelope e(channelname, messagename); |
48 | e << parameter1 << parameter2 << ...; | 48 | e << parameter1 << parameter2 << ...; |
49 | \endcode | 49 | \endcode |
50 | 50 | ||
51 | For messages without parameters, simply use: | 51 | For messages without parameters, simply use: |
52 | 52 | ||
53 | \code | 53 | \code |
54 | QCopEnvelope e(channelname, messagename); | 54 | QCopEnvelope e(channelname, messagename); |
55 | \endcode | 55 | \endcode |
56 | 56 | ||
57 | (Do not try to simplify this further as it may confuse some | 57 | (Do not try to simplify this further as it may confuse some |
58 | compilers.) | 58 | compilers.) |
59 | 59 | ||
60 | The \c{channelname} of channels within Qtopia all start with "QPE/". | 60 | The \c{channelname} of channels within Qtopia all start with "QPE/". |
61 | The \c{messagename} is a function identifier followed by a list of types | 61 | The \c{messagename} is a function identifier followed by a list of types |
62 | in parentheses. There is no whitespace in the message name. | 62 | in parentheses. There is no whitespace in the message name. |
63 | 63 | ||
64 | To receive a message, you will generally just use your application's | 64 | To receive a message, you will generally just use your application's |
65 | predefined QPE/Application/\e{appname} channel | 65 | predefined QPE/Application/\e{appname} channel |
66 | (see QPEApplication::appMessage()), but you can make another channel | 66 | (see QPEApplication::appMessage()), but you can make another channel |
67 | and connect it to a slot like this: | 67 | and connect it to a slot like this: |
68 | 68 | ||
69 | \code | 69 | \code |
70 | myChannel = new QCopChannel( "QPE/FooBar", this ); | 70 | myChannel = new QCopChannel( "QPE/FooBar", this ); |
71 | connect( myChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 71 | connect( myChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
72 | this, SLOT(fooBarMessage( const QCString &, const QByteArray &)) ); | 72 | this, SLOT(fooBarMessage(const QCString&,const QByteArray&)) ); |
73 | \endcode | 73 | \endcode |
74 | 74 | ||
75 | See also, the \link qcop.html list of Qtopia messages\endlink. | 75 | See also, the \link qcop.html list of Qtopia messages\endlink. |
76 | */ | 76 | */ |
77 | 77 | ||
78 | /*! | 78 | /*! |
79 | Constructs a QCopEnvelope that will write \a message to \a channel. | 79 | Constructs a QCopEnvelope that will write \a message to \a channel. |
80 | If \a message has parameters, you must then use operator<<() to | 80 | If \a message has parameters, you must then use operator<<() to |
81 | add these parameters to the envelope. | 81 | add these parameters to the envelope. |
82 | */ | 82 | */ |
83 | QCopEnvelope::QCopEnvelope( const QCString& channel, const QCString& message ) : | 83 | QCopEnvelope::QCopEnvelope( const QCString& channel, const QCString& message ) : |
84 | QDataStream(new QBuffer), | 84 | QDataStream(new QBuffer), |
85 | ch(channel), msg(message) | 85 | ch(channel), msg(message) |
86 | { | 86 | { |
87 | device()->open(IO_WriteOnly); | 87 | device()->open(IO_WriteOnly); |
88 | } | 88 | } |
89 | 89 | ||
90 | /*! | 90 | /*! |
91 | Writes the message and then destroys the QCopEnvelope. | 91 | Writes the message and then destroys the QCopEnvelope. |
92 | */ | 92 | */ |
93 | QCopEnvelope::~QCopEnvelope() | 93 | QCopEnvelope::~QCopEnvelope() |
94 | { | 94 | { |
95 | QByteArray data = ((QBuffer*)device())->buffer(); | 95 | QByteArray data = ((QBuffer*)device())->buffer(); |
96 | const int pref=16; | 96 | const int pref=16; |
97 | if ( qstrncmp(ch.data(),"QPE/Application/",pref)==0 ) { | 97 | if ( qstrncmp(ch.data(),"QPE/Application/",pref)==0 ) { |
98 | QString qcopfn("/tmp/qcop-msg-"); | 98 | QString qcopfn("/tmp/qcop-msg-"); |
99 | qcopfn += ch.mid(pref); | 99 | qcopfn += ch.mid(pref); |
100 | QFile qcopfile(qcopfn); | 100 | QFile qcopfile(qcopfn); |
101 | 101 | ||
102 | if ( qcopfile.open(IO_WriteOnly | IO_Append) ) { | 102 | if ( qcopfile.open(IO_WriteOnly | IO_Append) ) { |
103 | #ifndef Q_OS_WIN32 | 103 | #ifndef Q_OS_WIN32 |
104 | if(flock(qcopfile.handle(), LOCK_EX)) { | 104 | if(flock(qcopfile.handle(), LOCK_EX)) { |
105 | /* some error occurred */ | 105 | /* some error occurred */ |
106 | qWarning(QString("Failed to obtain file lock on %1 (%2)") | 106 | qWarning(QString("Failed to obtain file lock on %1 (%2)") |
107 | .arg(qcopfn).arg( errno )); | 107 | .arg(qcopfn).arg( errno )); |
108 | } | 108 | } |
109 | #endif | 109 | #endif |
110 | { | 110 | { |
111 | QDataStream ds(&qcopfile); | 111 | QDataStream ds(&qcopfile); |
112 | ds << ch << msg << data; | 112 | ds << ch << msg << data; |
113 | qcopfile.flush(); | 113 | qcopfile.flush(); |
114 | #ifndef Q_OS_WIN32 | 114 | #ifndef Q_OS_WIN32 |
115 | flock(qcopfile.handle(), LOCK_UN); | 115 | flock(qcopfile.handle(), LOCK_UN); |
116 | #endif | 116 | #endif |
117 | qcopfile.close(); | 117 | qcopfile.close(); |
118 | } | 118 | } |
119 | 119 | ||
120 | QByteArray b; | 120 | QByteArray b; |
121 | QDataStream stream(b, IO_WriteOnly); | 121 | QDataStream stream(b, IO_WriteOnly); |
122 | stream << QString(ch.mid(pref)); | 122 | stream << QString(ch.mid(pref)); |
123 | QCopChannel::send("QPE/Server", "processQCop(QString)", b); | 123 | QCopChannel::send("QPE/Server", "processQCop(QString)", b); |
124 | delete device(); | 124 | delete device(); |
125 | return; | 125 | return; |
126 | } else { | 126 | } else { |
127 | qWarning(QString("Failed to open file %1") | 127 | qWarning(QString("Failed to open file %1") |
128 | .arg(qcopfn)); | 128 | .arg(qcopfn)); |
129 | } // endif open | 129 | } // endif open |
130 | } | 130 | } |
131 | else if (qstrncmp(ch.data(), "QPE/SOAP/", 9) == 0) { | 131 | else if (qstrncmp(ch.data(), "QPE/SOAP/", 9) == 0) { |
132 | // If this is a message that should go along the SOAP channel, we move the | 132 | // If this is a message that should go along the SOAP channel, we move the |
133 | // endpoint URL to the data section. | 133 | // endpoint URL to the data section. |
134 | QString endpoint = ch.mid(9); | 134 | QString endpoint = ch.mid(9); |
135 | 135 | ||
136 | ch = "QPE/SOAP"; | 136 | ch = "QPE/SOAP"; |
137 | // Since byte arrays are explicitly shared, this is appended to the data variable.. | 137 | // Since byte arrays are explicitly shared, this is appended to the data variable.. |
138 | *this << endpoint; | 138 | *this << endpoint; |
139 | } | 139 | } |
140 | 140 | ||
141 | QCopChannel::send(ch,msg,data); | 141 | QCopChannel::send(ch,msg,data); |
142 | delete device(); | 142 | delete device(); |
143 | } | 143 | } |
144 | 144 | ||
145 | #endif | 145 | #endif |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 262221e..c339a78 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -535,317 +535,317 @@ void QPEApplication::processQCopFile() | |||
535 | { | 535 | { |
536 | QString qcopfn("/tmp/qcop-msg-"); | 536 | QString qcopfn("/tmp/qcop-msg-"); |
537 | qcopfn += d->appName; // append command name | 537 | qcopfn += d->appName; // append command name |
538 | 538 | ||
539 | QFile f(qcopfn); | 539 | QFile f(qcopfn); |
540 | if ( f.open(IO_ReadWrite) ) { | 540 | if ( f.open(IO_ReadWrite) ) { |
541 | #ifndef Q_OS_WIN32 | 541 | #ifndef Q_OS_WIN32 |
542 | flock(f.handle(), LOCK_EX); | 542 | flock(f.handle(), LOCK_EX); |
543 | #endif | 543 | #endif |
544 | QDataStream ds(&f); | 544 | QDataStream ds(&f); |
545 | QCString channel, message; | 545 | QCString channel, message; |
546 | QByteArray data; | 546 | QByteArray data; |
547 | while(!ds.atEnd()) { | 547 | while(!ds.atEnd()) { |
548 | ds >> channel >> message >> data; | 548 | ds >> channel >> message >> data; |
549 | d->enqueueQCop(channel,message,data); | 549 | d->enqueueQCop(channel,message,data); |
550 | } | 550 | } |
551 | ::ftruncate(f.handle(), 0); | 551 | ::ftruncate(f.handle(), 0); |
552 | #ifndef Q_OS_WIN32 | 552 | #ifndef Q_OS_WIN32 |
553 | f.flush(); | 553 | f.flush(); |
554 | flock(f.handle(), LOCK_UN); | 554 | flock(f.handle(), LOCK_UN); |
555 | #endif | 555 | #endif |
556 | } | 556 | } |
557 | #endif | 557 | #endif |
558 | } | 558 | } |
559 | 559 | ||
560 | 560 | ||
561 | /*! | 561 | /*! |
562 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 562 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
563 | 563 | ||
564 | This signal is emitted when a message is received on this | 564 | This signal is emitted when a message is received on this |
565 | application's QPE/Application/<i>appname</i> \link qcop.html | 565 | application's QPE/Application/<i>appname</i> \link qcop.html |
566 | QCop\endlink channel. | 566 | QCop\endlink channel. |
567 | 567 | ||
568 | The slot to which you connect this signal uses \a msg and \a data | 568 | The slot to which you connect this signal uses \a msg and \a data |
569 | in the following way: | 569 | in the following way: |
570 | 570 | ||
571 | \code | 571 | \code |
572 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 572 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
573 | { | 573 | { |
574 | QDataStream stream( data, IO_ReadOnly ); | 574 | QDataStream stream( data, IO_ReadOnly ); |
575 | if ( msg == "someMessage(int,int,int)" ) { | 575 | if ( msg == "someMessage(int,int,int)" ) { |
576 | int a,b,c; | 576 | int a,b,c; |
577 | stream >> a >> b >> c; | 577 | stream >> a >> b >> c; |
578 | ... | 578 | ... |
579 | } else if ( msg == "otherMessage(QString)" ) { | 579 | } else if ( msg == "otherMessage(QString)" ) { |
580 | ... | 580 | ... |
581 | } | 581 | } |
582 | } | 582 | } |
583 | \endcode | 583 | \endcode |
584 | 584 | ||
585 | \sa qcop.html | 585 | \sa qcop.html |
586 | Note that messages received here may be processed by qpe application | 586 | Note that messages received here may be processed by qpe application |
587 | and emitted as signals, such as flush() and reload(). | 587 | and emitted as signals, such as flush() and reload(). |
588 | */ | 588 | */ |
589 | 589 | ||
590 | /*! | 590 | /*! |
591 | Constructs a QPEApplication just as you would construct | 591 | Constructs a QPEApplication just as you would construct |
592 | a QApplication, passing \a argc, \a argv, and \a t. | 592 | a QApplication, passing \a argc, \a argv, and \a t. |
593 | 593 | ||
594 | For applications, \a t should be the default, GuiClient. Only | 594 | For applications, \a t should be the default, GuiClient. Only |
595 | the Qtopia server passes GuiServer. | 595 | the Qtopia server passes GuiServer. |
596 | */ | 596 | */ |
597 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 597 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
598 | : QApplication( hack(argc), argv, t ), pidChannel( 0 ) | 598 | : QApplication( hack(argc), argv, t ), pidChannel( 0 ) |
599 | { | 599 | { |
600 | QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. | 600 | QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. |
601 | 601 | ||
602 | d = new QPEApplicationData; | 602 | d = new QPEApplicationData; |
603 | d->loadTextCodecs(); | 603 | d->loadTextCodecs(); |
604 | d->loadImageCodecs(); | 604 | d->loadImageCodecs(); |
605 | int dw = desktop() ->width(); | 605 | int dw = desktop() ->width(); |
606 | 606 | ||
607 | if ( dw < 200 ) { | 607 | if ( dw < 200 ) { |
608 | setFont( QFont( "vera", 8 ) ); | 608 | setFont( QFont( "vera", 8 ) ); |
609 | AppLnk::setSmallIconSize( 10 ); | 609 | AppLnk::setSmallIconSize( 10 ); |
610 | AppLnk::setBigIconSize( 28 ); | 610 | AppLnk::setBigIconSize( 28 ); |
611 | } | 611 | } |
612 | #if defined(OPIE_HIGH_RES_SMALL_PHY) | 612 | #if defined(OPIE_HIGH_RES_SMALL_PHY) |
613 | else if ( dw > 600 ) { | 613 | else if ( dw > 600 ) { |
614 | setFont( QFont( "vera", 16 ) ); | 614 | setFont( QFont( "vera", 16 ) ); |
615 | AppLnk::setSmallIconSize( 24 ); | 615 | AppLnk::setSmallIconSize( 24 ); |
616 | AppLnk::setBigIconSize( 48 ); | 616 | AppLnk::setBigIconSize( 48 ); |
617 | } | 617 | } |
618 | #endif | 618 | #endif |
619 | else if ( dw > 200 ) { | 619 | else if ( dw > 200 ) { |
620 | setFont( QFont( "vera", 10 ) ); | 620 | setFont( QFont( "vera", 10 ) ); |
621 | AppLnk::setSmallIconSize( 14 ); | 621 | AppLnk::setSmallIconSize( 14 ); |
622 | AppLnk::setBigIconSize( 32 ); | 622 | AppLnk::setBigIconSize( 32 ); |
623 | } | 623 | } |
624 | 624 | ||
625 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 625 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
626 | 626 | ||
627 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 627 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
628 | 628 | ||
629 | 629 | ||
630 | sysChannel = new QCopChannel( "QPE/System", this ); | 630 | sysChannel = new QCopChannel( "QPE/System", this ); |
631 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 631 | connect( sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
632 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 632 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); |
633 | 633 | ||
634 | /* COde now in initapp */ | 634 | /* COde now in initapp */ |
635 | #if 0 | 635 | #if 0 |
636 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 636 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
637 | 637 | ||
638 | QString qcopfn( "/tmp/qcop-msg-" ); | 638 | QString qcopfn( "/tmp/qcop-msg-" ); |
639 | qcopfn += QString( argv[ 0 ] ); // append command name | 639 | qcopfn += QString( argv[ 0 ] ); // append command name |
640 | 640 | ||
641 | QFile f( qcopfn ); | 641 | QFile f( qcopfn ); |
642 | if ( f.open( IO_ReadOnly ) ) { | 642 | if ( f.open( IO_ReadOnly ) ) { |
643 | flock( f.handle(), LOCK_EX ); | 643 | flock( f.handle(), LOCK_EX ); |
644 | } | 644 | } |
645 | 645 | ||
646 | 646 | ||
647 | 647 | ||
648 | QCString channel = QCString( argv[ 0 ] ); | 648 | QCString channel = QCString( argv[ 0 ] ); |
649 | channel.replace( QRegExp( ".*/" ), "" ); | 649 | channel.replace( QRegExp( ".*/" ), "" ); |
650 | d->appName = channel; | 650 | d->appName = channel; |
651 | channel = "QPE/Application/" + channel; | 651 | channel = "QPE/Application/" + channel; |
652 | pidChannel = new QCopChannel( channel, this ); | 652 | pidChannel = new QCopChannel( channel, this ); |
653 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 653 | connect( pidChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
654 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 654 | this, SLOT( pidMessage(const QCString&,const QByteArray&) ) ); |
655 | 655 | ||
656 | if ( f.isOpen() ) { | 656 | if ( f.isOpen() ) { |
657 | d->keep_running = FALSE; | 657 | d->keep_running = FALSE; |
658 | QDataStream ds( &f ); | 658 | QDataStream ds( &f ); |
659 | QCString channel, message; | 659 | QCString channel, message; |
660 | QByteArray data; | 660 | QByteArray data; |
661 | while ( !ds.atEnd() ) { | 661 | while ( !ds.atEnd() ) { |
662 | ds >> channel >> message >> data; | 662 | ds >> channel >> message >> data; |
663 | d->enqueueQCop( channel, message, data ); | 663 | d->enqueueQCop( channel, message, data ); |
664 | } | 664 | } |
665 | 665 | ||
666 | flock( f.handle(), LOCK_UN ); | 666 | flock( f.handle(), LOCK_UN ); |
667 | f.close(); | 667 | f.close(); |
668 | f.remove(); | 668 | f.remove(); |
669 | } | 669 | } |
670 | 670 | ||
671 | for ( int a = 0; a < argc; a++ ) { | 671 | for ( int a = 0; a < argc; a++ ) { |
672 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 672 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
673 | argv[ a ] = argv[ a + 1 ]; | 673 | argv[ a ] = argv[ a + 1 ]; |
674 | a++; | 674 | a++; |
675 | d->preloaded = TRUE; | 675 | d->preloaded = TRUE; |
676 | argc -= 1; | 676 | argc -= 1; |
677 | } | 677 | } |
678 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 678 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
679 | argv[ a ] = argv[ a + 1 ]; | 679 | argv[ a ] = argv[ a + 1 ]; |
680 | a++; | 680 | a++; |
681 | d->preloaded = TRUE; | 681 | d->preloaded = TRUE; |
682 | d->forceshow = TRUE; | 682 | d->forceshow = TRUE; |
683 | argc -= 1; | 683 | argc -= 1; |
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
687 | /* overide stored arguments */ | 687 | /* overide stored arguments */ |
688 | setArgs( argc, argv ); | 688 | setArgs( argc, argv ); |
689 | 689 | ||
690 | #endif | 690 | #endif |
691 | #else | 691 | #else |
692 | initApp( argc, argv ); | 692 | initApp( argc, argv ); |
693 | #endif | 693 | #endif |
694 | // qwsSetDecoration( new QPEDecoration() ); | 694 | // qwsSetDecoration( new QPEDecoration() ); |
695 | 695 | ||
696 | #ifndef QT_NO_TRANSLATION | 696 | #ifndef QT_NO_TRANSLATION |
697 | 697 | ||
698 | d->langs = Global::languageList(); | 698 | d->langs = Global::languageList(); |
699 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { | 699 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { |
700 | QString lang = *it; | 700 | QString lang = *it; |
701 | 701 | ||
702 | installTranslation( lang + "/libopie.qm"); | 702 | installTranslation( lang + "/libopie.qm"); |
703 | installTranslation( lang + "/libqpe.qm" ); | 703 | installTranslation( lang + "/libqpe.qm" ); |
704 | installTranslation( lang + "/" + d->appName + ".qm" ); | 704 | installTranslation( lang + "/" + d->appName + ".qm" ); |
705 | 705 | ||
706 | 706 | ||
707 | //###language/font hack; should look it up somewhere | 707 | //###language/font hack; should look it up somewhere |
708 | #ifdef QWS | 708 | #ifdef QWS |
709 | 709 | ||
710 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 710 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
711 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 711 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
712 | setFont( fn ); | 712 | setFont( fn ); |
713 | } | 713 | } |
714 | #endif | 714 | #endif |
715 | } | 715 | } |
716 | #endif | 716 | #endif |
717 | 717 | ||
718 | applyStyle(); | 718 | applyStyle(); |
719 | 719 | ||
720 | if ( type() == GuiServer ) { | 720 | if ( type() == GuiServer ) { |
721 | setVolume(); | 721 | setVolume(); |
722 | } | 722 | } |
723 | 723 | ||
724 | installEventFilter( this ); | 724 | installEventFilter( this ); |
725 | 725 | ||
726 | QPEMenuToolFocusManager::initialize(); | 726 | QPEMenuToolFocusManager::initialize(); |
727 | 727 | ||
728 | #ifdef QT_NO_QWS_CURSOR | 728 | #ifdef QT_NO_QWS_CURSOR |
729 | // if we have no cursor, probably don't want tooltips | 729 | // if we have no cursor, probably don't want tooltips |
730 | QToolTip::setEnabled( FALSE ); | 730 | QToolTip::setEnabled( FALSE ); |
731 | #endif | 731 | #endif |
732 | } | 732 | } |
733 | 733 | ||
734 | 734 | ||
735 | #ifdef QTOPIA_INTERNAL_INITAPP | 735 | #ifdef QTOPIA_INTERNAL_INITAPP |
736 | void QPEApplication::initApp( int argc, char **argv ) | 736 | void QPEApplication::initApp( int argc, char **argv ) |
737 | { | 737 | { |
738 | delete pidChannel; | 738 | delete pidChannel; |
739 | d->keep_running = TRUE; | 739 | d->keep_running = TRUE; |
740 | d->preloaded = FALSE; | 740 | d->preloaded = FALSE; |
741 | d->forceshow = FALSE; | 741 | d->forceshow = FALSE; |
742 | 742 | ||
743 | QCString channel = QCString(argv[0]); | 743 | QCString channel = QCString(argv[0]); |
744 | 744 | ||
745 | channel.replace(QRegExp(".*/"),""); | 745 | channel.replace(QRegExp(".*/"),""); |
746 | d->appName = channel; | 746 | d->appName = channel; |
747 | 747 | ||
748 | #if QT_VERSION > 235 | 748 | #if QT_VERSION > 235 |
749 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 | 749 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 |
750 | #endif | 750 | #endif |
751 | 751 | ||
752 | channel = "QPE/Application/" + channel; | 752 | channel = "QPE/Application/" + channel; |
753 | pidChannel = new QCopChannel( channel, this); | 753 | pidChannel = new QCopChannel( channel, this); |
754 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 754 | connect( pidChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
755 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); | 755 | this, SLOT(pidMessage(const QCString&,const QByteArray&))); |
756 | 756 | ||
757 | 757 | ||
758 | 758 | ||
759 | processQCopFile(); | 759 | processQCopFile(); |
760 | d->keep_running = d->qcopq.isEmpty(); | 760 | d->keep_running = d->qcopq.isEmpty(); |
761 | 761 | ||
762 | for (int a=0; a<argc; a++) { | 762 | for (int a=0; a<argc; a++) { |
763 | if ( qstrcmp(argv[a],"-preload")==0 ) { | 763 | if ( qstrcmp(argv[a],"-preload")==0 ) { |
764 | argv[a] = argv[a+1]; | 764 | argv[a] = argv[a+1]; |
765 | a++; | 765 | a++; |
766 | d->preloaded = TRUE; | 766 | d->preloaded = TRUE; |
767 | argc-=1; | 767 | argc-=1; |
768 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { | 768 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { |
769 | argv[a] = argv[a+1]; | 769 | argv[a] = argv[a+1]; |
770 | a++; | 770 | a++; |
771 | d->preloaded = TRUE; | 771 | d->preloaded = TRUE; |
772 | d->forceshow = TRUE; | 772 | d->forceshow = TRUE; |
773 | argc-=1; | 773 | argc-=1; |
774 | } | 774 | } |
775 | } | 775 | } |
776 | 776 | ||
777 | /* overide stored arguments */ | 777 | /* overide stored arguments */ |
778 | setArgs(argc, argv); | 778 | setArgs(argc, argv); |
779 | 779 | ||
780 | /* install translation here */ | 780 | /* install translation here */ |
781 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) | 781 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) |
782 | installTranslation( (*it) + "/" + d->appName + ".qm" ); | 782 | installTranslation( (*it) + "/" + d->appName + ".qm" ); |
783 | } | 783 | } |
784 | #endif | 784 | #endif |
785 | 785 | ||
786 | 786 | ||
787 | static QPtrDict<void>* inputMethodDict = 0; | 787 | static QPtrDict<void>* inputMethodDict = 0; |
788 | static void createInputMethodDict() | 788 | static void createInputMethodDict() |
789 | { | 789 | { |
790 | if ( !inputMethodDict ) | 790 | if ( !inputMethodDict ) |
791 | inputMethodDict = new QPtrDict<void>; | 791 | inputMethodDict = new QPtrDict<void>; |
792 | } | 792 | } |
793 | 793 | ||
794 | /*! | 794 | /*! |
795 | Returns the currently set hint to the system as to whether | 795 | Returns the currently set hint to the system as to whether |
796 | widget \a w has any use for text input methods. | 796 | widget \a w has any use for text input methods. |
797 | 797 | ||
798 | 798 | ||
799 | \sa setInputMethodHint() InputMethodHint | 799 | \sa setInputMethodHint() InputMethodHint |
800 | */ | 800 | */ |
801 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | 801 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) |
802 | { | 802 | { |
803 | if ( inputMethodDict && w ) | 803 | if ( inputMethodDict && w ) |
804 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); | 804 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); |
805 | return Normal; | 805 | return Normal; |
806 | } | 806 | } |
807 | 807 | ||
808 | /*! | 808 | /*! |
809 | \enum QPEApplication::InputMethodHint | 809 | \enum QPEApplication::InputMethodHint |
810 | 810 | ||
811 | \value Normal the application sometimes needs text input (the default). | 811 | \value Normal the application sometimes needs text input (the default). |
812 | \value AlwaysOff the application never needs text input. | 812 | \value AlwaysOff the application never needs text input. |
813 | \value AlwaysOn the application always needs text input. | 813 | \value AlwaysOn the application always needs text input. |
814 | */ | 814 | */ |
815 | 815 | ||
816 | /*! | 816 | /*! |
817 | Hints to the system that widget \a w has use for text input methods | 817 | Hints to the system that widget \a w has use for text input methods |
818 | as specified by \a mode. | 818 | as specified by \a mode. |
819 | 819 | ||
820 | \sa inputMethodHint() InputMethodHint | 820 | \sa inputMethodHint() InputMethodHint |
821 | */ | 821 | */ |
822 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) | 822 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) |
823 | { | 823 | { |
824 | createInputMethodDict(); | 824 | createInputMethodDict(); |
825 | if ( mode == Normal ) { | 825 | if ( mode == Normal ) { |
826 | inputMethodDict->remove | 826 | inputMethodDict->remove |
827 | ( w ); | 827 | ( w ); |
828 | } | 828 | } |
829 | else { | 829 | else { |
830 | inputMethodDict->insert( w, ( void* ) mode ); | 830 | inputMethodDict->insert( w, ( void* ) mode ); |
831 | } | 831 | } |
832 | } | 832 | } |
833 | 833 | ||
834 | class HackDialog : public QDialog | 834 | class HackDialog : public QDialog |
835 | { | 835 | { |
836 | public: | 836 | public: |
837 | void acceptIt() | 837 | void acceptIt() |
838 | { | 838 | { |
839 | accept(); | 839 | accept(); |
840 | } | 840 | } |
841 | void rejectIt() | 841 | void rejectIt() |
842 | { | 842 | { |
843 | reject(); | 843 | reject(); |
844 | } | 844 | } |
845 | }; | 845 | }; |
846 | 846 | ||
847 | 847 | ||
848 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) | 848 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) |
849 | { | 849 | { |
850 | // specialised actions for certain widgets. May want to | 850 | // specialised actions for certain widgets. May want to |
851 | // add more stuff here. | 851 | // add more stuff here. |
diff --git a/library/qpedialog.cpp b/library/qpedialog.cpp index ac42972..da461b7 100644 --- a/library/qpedialog.cpp +++ b/library/qpedialog.cpp | |||
@@ -1,74 +1,74 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define protected public | 21 | #define protected public |
22 | #include <qdialog.h> | 22 | #include <qdialog.h> |
23 | #undef protected | 23 | #undef protected |
24 | 24 | ||
25 | #include "qpedialog.h" | 25 | #include "qpedialog.h" |
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | 27 | ||
28 | 28 | ||
29 | /** | 29 | /** |
30 | * \brief This is the only c'tor. | 30 | * \brief This is the only c'tor. |
31 | * | 31 | * |
32 | * The parent of this Listener is the Dialog you pass. This means once | 32 | * The parent of this Listener is the Dialog you pass. This means once |
33 | * the dialog is deleted this listener will be deleted too. | 33 | * the dialog is deleted this listener will be deleted too. |
34 | * This Listener listens on QPEApplication::appMessage signal and implements | 34 | * This Listener listens on QPEApplication::appMessage signal and implements |
35 | * accept() and reject(). | 35 | * accept() and reject(). |
36 | * | 36 | * |
37 | * \code | 37 | * \code |
38 | *QDialog *dialog = new YourDialog(); | 38 | *QDialog *dialog = new YourDialog(); |
39 | (void)new QPEDialogListener(dialog); | 39 | (void)new QPEDialogListener(dialog); |
40 | if( QPEApplication::execDialog(dialog) == QDialog::Accept ){ | 40 | if( QPEApplication::execDialog(dialog) == QDialog::Accept ){ |
41 | // do some stuff | 41 | // do some stuff |
42 | } | 42 | } |
43 | delete dialog; | 43 | delete dialog; |
44 | 44 | ||
45 | * \endcode | 45 | * \endcode |
46 | * | 46 | * |
47 | * @param di The dialog to handle | 47 | * @param di The dialog to handle |
48 | */ | 48 | */ |
49 | QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di) | 49 | QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di) |
50 | { | 50 | { |
51 | dialog = di; | 51 | dialog = di; |
52 | connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 52 | connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
53 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); | 53 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
57 | /** | 57 | /** |
58 | * d'tor | 58 | * d'tor |
59 | */ | 59 | */ |
60 | QPEDialogListener::~QPEDialogListener() {} | 60 | QPEDialogListener::~QPEDialogListener() {} |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * \internal | 63 | * \internal |
64 | */ | 64 | */ |
65 | void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & ) | 65 | void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & ) |
66 | { | 66 | { |
67 | if (!dialog) | 67 | if (!dialog) |
68 | return; | 68 | return; |
69 | if (msg == "accept()") { | 69 | if (msg == "accept()") { |
70 | dialog->accept(); | 70 | dialog->accept(); |
71 | } else if (msg == "reject()") { | 71 | } else if (msg == "reject()") { |
72 | dialog->reject(); | 72 | dialog->reject(); |
73 | } | 73 | } |
74 | } | 74 | } |
diff --git a/library/storage.cpp b/library/storage.cpp index 0ea465b..fcee689 100644 --- a/library/storage.cpp +++ b/library/storage.cpp | |||
@@ -2,194 +2,194 @@ | |||
2 | ** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org> | 2 | ** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org> |
3 | ** Copyright (C) Lorn Potter <llornkcor@handhelds.org> | 3 | ** Copyright (C) Lorn Potter <llornkcor@handhelds.org> |
4 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 4 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
5 | ** | 5 | ** |
6 | ** This file is part of Opie Environment. | 6 | ** This file is part of Opie Environment. |
7 | ** | 7 | ** |
8 | ** This file may be distributed and/or modified under the terms of the | 8 | ** This file may be distributed and/or modified under the terms of the |
9 | ** GNU General Public License version 2 as published by the Free Software | 9 | ** GNU General Public License version 2 as published by the Free Software |
10 | ** Foundation and appearing in the file LICENSE.GPL included in the | 10 | ** Foundation and appearing in the file LICENSE.GPL included in the |
11 | ** packaging of this file. | 11 | ** packaging of this file. |
12 | ** | 12 | ** |
13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
15 | ** | 15 | ** |
16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 16 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
17 | ** | 17 | ** |
18 | ** Contact info@trolltech.com if any conditions of this licensing are | 18 | ** Contact info@trolltech.com if any conditions of this licensing are |
19 | ** not clear to you. | 19 | ** not clear to you. |
20 | ** | 20 | ** |
21 | **********************************************************************/ | 21 | **********************************************************************/ |
22 | 22 | ||
23 | #include <qpe/storage.h> | 23 | #include <qpe/storage.h> |
24 | 24 | ||
25 | #include <qcopchannel_qws.h> | 25 | #include <qcopchannel_qws.h> |
26 | 26 | ||
27 | #include <stdio.h> | 27 | #include <stdio.h> |
28 | 28 | ||
29 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 29 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
30 | #include <sys/vfs.h> | 30 | #include <sys/vfs.h> |
31 | #include <mntent.h> | 31 | #include <mntent.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #ifdef Q_OS_MACX | 34 | #ifdef Q_OS_MACX |
35 | # include <sys/param.h> | 35 | # include <sys/param.h> |
36 | # include <sys/ucred.h> | 36 | # include <sys/ucred.h> |
37 | # include <sys/mount.h> | 37 | # include <sys/mount.h> |
38 | # include <stdio.h> // For strerror() | 38 | # include <stdio.h> // For strerror() |
39 | # include <errno.h> | 39 | # include <errno.h> |
40 | #endif /* Q_OS_MACX */ | 40 | #endif /* Q_OS_MACX */ |
41 | 41 | ||
42 | 42 | ||
43 | // Shouldn't be here ! (eilers) | 43 | // Shouldn't be here ! (eilers) |
44 | // #include <sys/vfs.h> | 44 | // #include <sys/vfs.h> |
45 | // #include <mntent.h> | 45 | // #include <mntent.h> |
46 | 46 | ||
47 | 47 | ||
48 | static bool isCF(const QString& m) | 48 | static bool isCF(const QString& m) |
49 | { | 49 | { |
50 | 50 | ||
51 | #ifndef Q_OS_MACX | 51 | #ifndef Q_OS_MACX |
52 | FILE* f = fopen("/var/run/stab", "r"); | 52 | FILE* f = fopen("/var/run/stab", "r"); |
53 | if (!f) f = fopen("/var/state/pcmcia/stab", "r"); | 53 | if (!f) f = fopen("/var/state/pcmcia/stab", "r"); |
54 | if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); | 54 | if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); |
55 | if ( f ) | 55 | if ( f ) |
56 | { | 56 | { |
57 | char line[1024]; | 57 | char line[1024]; |
58 | char devtype[80]; | 58 | char devtype[80]; |
59 | char devname[80]; | 59 | char devname[80]; |
60 | while ( fgets( line, 1024, f ) ) | 60 | while ( fgets( line, 1024, f ) ) |
61 | { | 61 | { |
62 | // 0 ide ide-cs 0 hda 3 0 | 62 | // 0 ide ide-cs 0 hda 3 0 |
63 | if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) | 63 | if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) |
64 | { | 64 | { |
65 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) | 65 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) |
66 | { | 66 | { |
67 | fclose(f); | 67 | fclose(f); |
68 | return TRUE; | 68 | return TRUE; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | } | 71 | } |
72 | fclose(f); | 72 | fclose(f); |
73 | } | 73 | } |
74 | #endif /* Q_OS_MACX */ | 74 | #endif /* Q_OS_MACX */ |
75 | return FALSE; | 75 | return FALSE; |
76 | } | 76 | } |
77 | 77 | ||
78 | /*! \class StorageInfo storage.h | 78 | /*! \class StorageInfo storage.h |
79 | \brief The StorageInfo class describes the disks mounted on the file system. | 79 | \brief The StorageInfo class describes the disks mounted on the file system. |
80 | 80 | ||
81 | This class provides access to the mount information for the Linux | 81 | This class provides access to the mount information for the Linux |
82 | filesystem. Each mount point is represented by the FileSystem class. | 82 | filesystem. Each mount point is represented by the FileSystem class. |
83 | To ensure this class has the most up to date size information, call | 83 | To ensure this class has the most up to date size information, call |
84 | the update() method. Note that this will automatically be signaled | 84 | the update() method. Note that this will automatically be signaled |
85 | by the operating system when a disk has been mounted or unmounted. | 85 | by the operating system when a disk has been mounted or unmounted. |
86 | 86 | ||
87 | \ingroup qtopiaemb | 87 | \ingroup qtopiaemb |
88 | */ | 88 | */ |
89 | 89 | ||
90 | /*! Constructor that determines the current mount points of the filesystem. | 90 | /*! Constructor that determines the current mount points of the filesystem. |
91 | The standard \a parent parameters is passed on to QObject. | 91 | The standard \a parent parameters is passed on to QObject. |
92 | */ | 92 | */ |
93 | StorageInfo::StorageInfo( QObject *parent ) | 93 | StorageInfo::StorageInfo( QObject *parent ) |
94 | : QObject( parent ) | 94 | : QObject( parent ) |
95 | { | 95 | { |
96 | mFileSystems.setAutoDelete( TRUE ); | 96 | mFileSystems.setAutoDelete( TRUE ); |
97 | channel = new QCopChannel( "QPE/Card", this ); | 97 | channel = new QCopChannel( "QPE/Card", this ); |
98 | connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), | 98 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
99 | this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); | 99 | this, SLOT(cardMessage(const QCString&,const QByteArray&)) ); |
100 | update(); | 100 | update(); |
101 | } | 101 | } |
102 | 102 | ||
103 | /*! Returns the longest matching FileSystem that starts with the | 103 | /*! Returns the longest matching FileSystem that starts with the |
104 | same prefix as \a filename as its mount point. | 104 | same prefix as \a filename as its mount point. |
105 | */ | 105 | */ |
106 | const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) | 106 | const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) |
107 | { | 107 | { |
108 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) | 108 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) |
109 | { | 109 | { |
110 | if ( filename.startsWith( (*i)->path() ) ) | 110 | if ( filename.startsWith( (*i)->path() ) ) |
111 | return (*i); | 111 | return (*i); |
112 | } | 112 | } |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) | 117 | void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) |
118 | { | 118 | { |
119 | if ( msg == "mtabChanged()" ) | 119 | if ( msg == "mtabChanged()" ) |
120 | update(); | 120 | update(); |
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | /*! Updates the mount and free space available information for each mount | 124 | /*! Updates the mount and free space available information for each mount |
125 | point. This method is automatically called when a disk is mounted or | 125 | point. This method is automatically called when a disk is mounted or |
126 | unmounted. | 126 | unmounted. |
127 | */ | 127 | */ |
128 | // cause of the lack of a d pointer we need | 128 | // cause of the lack of a d pointer we need |
129 | // to store informations in a config file :( | 129 | // to store informations in a config file :( |
130 | void StorageInfo::update() | 130 | void StorageInfo::update() |
131 | { | 131 | { |
132 | //qDebug("StorageInfo::updating"); | 132 | //qDebug("StorageInfo::updating"); |
133 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 133 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
134 | struct mntent *me; | 134 | struct mntent *me; |
135 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); | 135 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); |
136 | 136 | ||
137 | QStringList curdisks; | 137 | QStringList curdisks; |
138 | QStringList curopts; | 138 | QStringList curopts; |
139 | QStringList curfs; | 139 | QStringList curfs; |
140 | bool rebuild = FALSE; | 140 | bool rebuild = FALSE; |
141 | int n=0; | 141 | int n=0; |
142 | if ( mntfp ) | 142 | if ( mntfp ) |
143 | { | 143 | { |
144 | while ( (me = getmntent( mntfp )) != 0 ) | 144 | while ( (me = getmntent( mntfp )) != 0 ) |
145 | { | 145 | { |
146 | QString fs = me->mnt_fsname; | 146 | QString fs = me->mnt_fsname; |
147 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" | 147 | if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" |
148 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" | 148 | || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" |
149 | || fs.left( 14 ) == "/dev/mmc/part1" | 149 | || fs.left( 14 ) == "/dev/mmc/part1" |
150 | || fs.left(5)=="tmpfs" || fs.left(9)=="/dev/root" ) | 150 | || fs.left(5)=="tmpfs" || fs.left(9)=="/dev/root" ) |
151 | { | 151 | { |
152 | n++; | 152 | n++; |
153 | curdisks.append(fs); | 153 | curdisks.append(fs); |
154 | curopts.append( me->mnt_opts ); | 154 | curopts.append( me->mnt_opts ); |
155 | //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); | 155 | //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); |
156 | curfs.append( me->mnt_dir ); | 156 | curfs.append( me->mnt_dir ); |
157 | bool found = FALSE; | 157 | bool found = FALSE; |
158 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) | 158 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) |
159 | { | 159 | { |
160 | if ( (*i)->disk() == fs ) | 160 | if ( (*i)->disk() == fs ) |
161 | { | 161 | { |
162 | found = TRUE; | 162 | found = TRUE; |
163 | break; | 163 | break; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | if ( !found ) | 166 | if ( !found ) |
167 | rebuild = TRUE; | 167 | rebuild = TRUE; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | endmntent( mntfp ); | 170 | endmntent( mntfp ); |
171 | } | 171 | } |
172 | if ( rebuild || n != (int)mFileSystems.count() ) | 172 | if ( rebuild || n != (int)mFileSystems.count() ) |
173 | { | 173 | { |
174 | mFileSystems.clear(); | 174 | mFileSystems.clear(); |
175 | QStringList::ConstIterator it=curdisks.begin(); | 175 | QStringList::ConstIterator it=curdisks.begin(); |
176 | QStringList::ConstIterator fsit=curfs.begin(); | 176 | QStringList::ConstIterator fsit=curfs.begin(); |
177 | QStringList::ConstIterator optsIt=curopts.begin(); | 177 | QStringList::ConstIterator optsIt=curopts.begin(); |
178 | for (; it!=curdisks.end(); ++it, ++fsit, ++optsIt) | 178 | for (; it!=curdisks.end(); ++it, ++fsit, ++optsIt) |
179 | { | 179 | { |
180 | QString opts = *optsIt; | 180 | QString opts = *optsIt; |
181 | 181 | ||
182 | QString disk = *it; | 182 | QString disk = *it; |
183 | QString humanname; | 183 | QString humanname; |
184 | bool removable = FALSE; | 184 | bool removable = FALSE; |
185 | if ( isCF(disk) ) | 185 | if ( isCF(disk) ) |
186 | { | 186 | { |
187 | humanname = tr("CF Card"); | 187 | humanname = tr("CF Card"); |
188 | removable = TRUE; | 188 | removable = TRUE; |
189 | } | 189 | } |
190 | else if ( disk == "/dev/hda1" ) | 190 | else if ( disk == "/dev/hda1" ) |
191 | { | 191 | { |
192 | humanname = tr("Hard Disk"); | 192 | humanname = tr("Hard Disk"); |
193 | } | 193 | } |
194 | else if ( disk.left(9) == "/dev/mmcd" ) | 194 | else if ( disk.left(9) == "/dev/mmcd" ) |
195 | { | 195 | { |
diff --git a/library/timestring.cpp b/library/timestring.cpp index 2fd0191..91c29ae 100644 --- a/library/timestring.cpp +++ b/library/timestring.cpp | |||
@@ -1,152 +1,152 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "timestring.h" | 21 | #include "timestring.h" |
22 | #include <qobject.h> | 22 | #include <qobject.h> |
23 | #include <qpe/qpeapplication.h> //for qApp | 23 | #include <qpe/qpeapplication.h> //for qApp |
24 | #include "config.h" | 24 | #include "config.h" |
25 | 25 | ||
26 | 26 | ||
27 | class TimeStringFormatKeeper : public QObject | 27 | class TimeStringFormatKeeper : public QObject |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | static DateFormat currentFormat() | 31 | static DateFormat currentFormat() |
32 | { | 32 | { |
33 | if ( !self ) | 33 | if ( !self ) |
34 | self = new TimeStringFormatKeeper; | 34 | self = new TimeStringFormatKeeper; |
35 | return self->format; | 35 | return self->format; |
36 | } | 36 | } |
37 | private slots: | 37 | private slots: |
38 | void formatChanged( DateFormat f ) | 38 | void formatChanged( DateFormat f ) |
39 | { | 39 | { |
40 | format = f; | 40 | format = f; |
41 | } | 41 | } |
42 | private: | 42 | private: |
43 | static TimeStringFormatKeeper *self; | 43 | static TimeStringFormatKeeper *self; |
44 | DateFormat format; | 44 | DateFormat format; |
45 | 45 | ||
46 | TimeStringFormatKeeper() | 46 | TimeStringFormatKeeper() |
47 | : QObject( qApp ) | 47 | : QObject( qApp ) |
48 | { | 48 | { |
49 | Config config("qpe"); | 49 | Config config("qpe"); |
50 | config.setGroup( "Date" ); | 50 | config.setGroup( "Date" ); |
51 | format = DateFormat(QChar(config.readEntry("Separator", "/")[0]), | 51 | format = DateFormat(QChar(config.readEntry("Separator", "/")[0]), |
52 | (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), | 52 | (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), |
53 | (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); | 53 | (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); |
54 | 54 | ||
55 | connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), | 55 | connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), |
56 | this, SLOT( formatChanged( DateFormat ) ) ); | 56 | this, SLOT( formatChanged(DateFormat) ) ); |
57 | } | 57 | } |
58 | }; | 58 | }; |
59 | 59 | ||
60 | TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0; | 60 | TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0; |
61 | 61 | ||
62 | QString DateFormat::toNumberString() const | 62 | QString DateFormat::toNumberString() const |
63 | { | 63 | { |
64 | QString buf = ""; | 64 | QString buf = ""; |
65 | // for each part of the order | 65 | // for each part of the order |
66 | for (int i = 0; i < 3; i++) { | 66 | for (int i = 0; i < 3; i++) { |
67 | // switch on the relavent 3 bits. | 67 | // switch on the relavent 3 bits. |
68 | switch((_shortOrder >> (i * 3)) & 0x0007) { | 68 | switch((_shortOrder >> (i * 3)) & 0x0007) { |
69 | case 0x0001: | 69 | case 0x0001: |
70 | buf += QObject::tr( "D" , "Shortcut for Day"); | 70 | buf += QObject::tr( "D" , "Shortcut for Day"); |
71 | break; | 71 | break; |
72 | case 0x0002: | 72 | case 0x0002: |
73 | buf += QObject::tr( "M", "Shortcur for Month" ); | 73 | buf += QObject::tr( "M", "Shortcur for Month" ); |
74 | break; | 74 | break; |
75 | case 0x0004: | 75 | case 0x0004: |
76 | buf += QObject::tr( "Y" ); | 76 | buf += QObject::tr( "Y" ); |
77 | break; | 77 | break; |
78 | } | 78 | } |
79 | if (i < 2) | 79 | if (i < 2) |
80 | buf += _shortSeparator; | 80 | buf += _shortSeparator; |
81 | } | 81 | } |
82 | return buf; | 82 | return buf; |
83 | } | 83 | } |
84 | 84 | ||
85 | QString DateFormat::toWordString() const | 85 | QString DateFormat::toWordString() const |
86 | { | 86 | { |
87 | QString buf = ""; | 87 | QString buf = ""; |
88 | // for each part of the order | 88 | // for each part of the order |
89 | for (int i = 0; i < 3; i++) { | 89 | for (int i = 0; i < 3; i++) { |
90 | // switch on the relavent 3 bits. | 90 | // switch on the relavent 3 bits. |
91 | switch((_longOrder >> (i * 3)) & 0x0007) { | 91 | switch((_longOrder >> (i * 3)) & 0x0007) { |
92 | case 0x0001: | 92 | case 0x0001: |
93 | buf += QObject::tr( "day" ); | 93 | buf += QObject::tr( "day" ); |
94 | if (i < 2) { | 94 | if (i < 2) { |
95 | if ((_shortOrder << ((i+1) * 3)) & 0x0007) | 95 | if ((_shortOrder << ((i+1) * 3)) & 0x0007) |
96 | buf += ", "; | 96 | buf += ", "; |
97 | else | 97 | else |
98 | buf += " "; | 98 | buf += " "; |
99 | } | 99 | } |
100 | break; | 100 | break; |
101 | case 0x0002: | 101 | case 0x0002: |
102 | buf += QObject::tr( "month" ); | 102 | buf += QObject::tr( "month" ); |
103 | if (i < 2) | 103 | if (i < 2) |
104 | buf += " "; | 104 | buf += " "; |
105 | break; | 105 | break; |
106 | case 0x0004: | 106 | case 0x0004: |
107 | buf += QObject::tr( "year" ); | 107 | buf += QObject::tr( "year" ); |
108 | if (i < 2) | 108 | if (i < 2) |
109 | buf += ", "; | 109 | buf += ", "; |
110 | break; | 110 | break; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | return buf; | 113 | return buf; |
114 | } | 114 | } |
115 | 115 | ||
116 | QString DateFormat::numberDate(const QDate &d, int v) const | 116 | QString DateFormat::numberDate(const QDate &d, int v) const |
117 | { | 117 | { |
118 | QString buf = ""; | 118 | QString buf = ""; |
119 | 119 | ||
120 | int pad = 2; | 120 | int pad = 2; |
121 | 121 | ||
122 | // for each part of the order | 122 | // for each part of the order |
123 | for (int i = 0; i < 3; i++) { | 123 | for (int i = 0; i < 3; i++) { |
124 | // switch on the relavent 3 bits. | 124 | // switch on the relavent 3 bits. |
125 | switch((_shortOrder >> (i * 3)) & 0x0007) { | 125 | switch((_shortOrder >> (i * 3)) & 0x0007) { |
126 | case 0x0001: | 126 | case 0x0001: |
127 | if (pad==2) buf += QString().sprintf("%02d",d.day()); | 127 | if (pad==2) buf += QString().sprintf("%02d",d.day()); |
128 | else buf += QString().sprintf("%d",d.day()); | 128 | else buf += QString().sprintf("%d",d.day()); |
129 | break; | 129 | break; |
130 | case 0x0002: | 130 | case 0x0002: |
131 | if (i==0) { // no padding with only MM/DD/YY format | 131 | if (i==0) { // no padding with only MM/DD/YY format |
132 | pad=0; | 132 | pad=0; |
133 | } | 133 | } |
134 | if (pad==2) buf += QString().sprintf("%02d",d.month()); | 134 | if (pad==2) buf += QString().sprintf("%02d",d.month()); |
135 | else buf += QString().sprintf("%d",d.month()); | 135 | else buf += QString().sprintf("%d",d.month()); |
136 | break; | 136 | break; |
137 | case 0x0004: | 137 | case 0x0004: |
138 | { | 138 | { |
139 | int year = d.year(); | 139 | int year = d.year(); |
140 | if (!(v & longNumber)) | 140 | if (!(v & longNumber)) |
141 | year = year % 100; | 141 | year = year % 100; |
142 | buf += QString().sprintf("%02d",year); | 142 | buf += QString().sprintf("%02d",year); |
143 | } | 143 | } |
144 | break; | 144 | break; |
145 | } | 145 | } |
146 | if (i < 2) | 146 | if (i < 2) |
147 | buf += _shortSeparator; | 147 | buf += _shortSeparator; |
148 | } | 148 | } |
149 | return buf; | 149 | return buf; |
150 | } | 150 | } |
151 | 151 | ||
152 | QString DateFormat::wordDate(const QDate &d, int v) const | 152 | QString DateFormat::wordDate(const QDate &d, int v) const |
diff --git a/library/tzselect.cpp b/library/tzselect.cpp index f28100b..848dfb7 100644 --- a/library/tzselect.cpp +++ b/library/tzselect.cpp | |||
@@ -1,302 +1,302 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_TZSELECT_INC_LOCAL | 21 | #define QTOPIA_INTERNAL_TZSELECT_INC_LOCAL |
22 | 22 | ||
23 | #include "tzselect.h" | 23 | #include "tzselect.h" |
24 | #include "resource.h" | 24 | #include "resource.h" |
25 | #include "config.h" | 25 | #include "config.h" |
26 | #include <qtoolbutton.h> | 26 | #include <qtoolbutton.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | 29 | ||
30 | #include <qcopchannel_qws.h> | 30 | #include <qcopchannel_qws.h> |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
33 | 33 | ||
34 | /*! | 34 | /*! |
35 | \class TimeZoneSelector | 35 | \class TimeZoneSelector |
36 | 36 | ||
37 | \brief The TimeZoneSelector widget allows users to configure their time zone information. | 37 | \brief The TimeZoneSelector widget allows users to configure their time zone information. |
38 | 38 | ||
39 | \ingroup qtopiaemb | 39 | \ingroup qtopiaemb |
40 | */ | 40 | */ |
41 | 41 | ||
42 | class TimeZoneSelectorPrivate | 42 | class TimeZoneSelectorPrivate |
43 | { | 43 | { |
44 | public: | 44 | public: |
45 | TimeZoneSelectorPrivate() : includeLocal(FALSE) {} | 45 | TimeZoneSelectorPrivate() : includeLocal(FALSE) {} |
46 | bool includeLocal; | 46 | bool includeLocal; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | TZCombo::TZCombo( QWidget *p, const char* n ) | 49 | TZCombo::TZCombo( QWidget *p, const char* n ) |
50 | : QComboBox( p, n ) | 50 | : QComboBox( p, n ) |
51 | { | 51 | { |
52 | updateZones(); | 52 | updateZones(); |
53 | // check to see if TZ is set, if it is set the current item to that | 53 | // check to see if TZ is set, if it is set the current item to that |
54 | QString tz = getenv("TZ"); | 54 | QString tz = getenv("TZ"); |
55 | if (parent()->inherits("TimeZoneSelector")) { | 55 | if (parent()->inherits("TimeZoneSelector")) { |
56 | if ( ((TimeZoneSelector *)parent())->localIncluded() ) { | 56 | if ( ((TimeZoneSelector *)parent())->localIncluded() ) { |
57 | // overide to the 'local' type. | 57 | // overide to the 'local' type. |
58 | tz = "None"; | 58 | tz = "None"; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | if ( !tz.isNull() ) { | 61 | if ( !tz.isNull() ) { |
62 | int n = 0, | 62 | int n = 0, |
63 | index = 0; | 63 | index = 0; |
64 | for ( QStringList::Iterator it=identifiers.begin(); | 64 | for ( QStringList::Iterator it=identifiers.begin(); |
65 | it!=identifiers.end(); ++it) { | 65 | it!=identifiers.end(); ++it) { |
66 | if ( *it == tz ) | 66 | if ( *it == tz ) |
67 | index = n; | 67 | index = n; |
68 | n++; | 68 | n++; |
69 | } | 69 | } |
70 | setCurrentItem(index); | 70 | setCurrentItem(index); |
71 | } else { | 71 | } else { |
72 | setCurrentItem(0); | 72 | setCurrentItem(0); |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | // listen on QPE/System | 77 | // listen on QPE/System |
78 | #if !defined(QT_NO_COP) | 78 | #if !defined(QT_NO_COP) |
79 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 79 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
80 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 80 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
81 | this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) ); | 81 | this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) ); |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | 84 | ||
85 | } | 85 | } |
86 | 86 | ||
87 | TZCombo::~TZCombo() | 87 | TZCombo::~TZCombo() |
88 | { | 88 | { |
89 | } | 89 | } |
90 | 90 | ||
91 | void TZCombo::updateZones() | 91 | void TZCombo::updateZones() |
92 | { | 92 | { |
93 | QString cur = currentText(); | 93 | QString cur = currentText(); |
94 | clear(); | 94 | clear(); |
95 | identifiers.clear(); | 95 | identifiers.clear(); |
96 | int curix=0; | 96 | int curix=0; |
97 | QString tz = getenv("TZ"); | 97 | QString tz = getenv("TZ"); |
98 | bool tzFound = FALSE; | 98 | bool tzFound = FALSE; |
99 | Config cfg("CityTime"); | 99 | Config cfg("CityTime"); |
100 | cfg.setGroup("TimeZones"); | 100 | cfg.setGroup("TimeZones"); |
101 | int listIndex = 0; | 101 | int listIndex = 0; |
102 | if (parent()->inherits("TimeZoneSelector")) { | 102 | if (parent()->inherits("TimeZoneSelector")) { |
103 | if ( ((TimeZoneSelector *)parent())->localIncluded() ) { | 103 | if ( ((TimeZoneSelector *)parent())->localIncluded() ) { |
104 | // overide to the 'local' type. | 104 | // overide to the 'local' type. |
105 | identifiers.append( "None" ); | 105 | identifiers.append( "None" ); |
106 | insertItem( tr("None") ); | 106 | insertItem( tr("None") ); |
107 | if ( cur == tr("None")) | 107 | if ( cur == tr("None")) |
108 | curix = 0; | 108 | curix = 0; |
109 | listIndex++; | 109 | listIndex++; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | int cfgIndex = 0; | 112 | int cfgIndex = 0; |
113 | while (1) { | 113 | while (1) { |
114 | QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); | 114 | QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); |
115 | if ( zn.isNull() ) | 115 | if ( zn.isNull() ) |
116 | break; | 116 | break; |
117 | if ( zn == tz ) | 117 | if ( zn == tz ) |
118 | tzFound = TRUE; | 118 | tzFound = TRUE; |
119 | QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); | 119 | QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); |
120 | identifiers.append(zn); | 120 | identifiers.append(zn); |
121 | insertItem(nm); | 121 | insertItem(nm); |
122 | if ( nm == cur ) | 122 | if ( nm == cur ) |
123 | curix = listIndex; | 123 | curix = listIndex; |
124 | ++cfgIndex; | 124 | ++cfgIndex; |
125 | ++listIndex; | 125 | ++listIndex; |
126 | } | 126 | } |
127 | if ( !listIndex ) { | 127 | if ( !listIndex ) { |
128 | QStringList list = timezoneDefaults(); | 128 | QStringList list = timezoneDefaults(); |
129 | for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { | 129 | for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { |
130 | QString zn = *it; | 130 | QString zn = *it; |
131 | QString nm = *++it; | 131 | QString nm = *++it; |
132 | if ( zn == tz ) | 132 | if ( zn == tz ) |
133 | tzFound = TRUE; | 133 | tzFound = TRUE; |
134 | if ( nm == cur ) | 134 | if ( nm == cur ) |
135 | curix = listIndex; | 135 | curix = listIndex; |
136 | identifiers.append(zn); | 136 | identifiers.append(zn); |
137 | insertItem(nm); | 137 | insertItem(nm); |
138 | ++listIndex; | 138 | ++listIndex; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | for (QStringList::Iterator it=extras.begin(); it!=extras.end(); ++it) { | 141 | for (QStringList::Iterator it=extras.begin(); it!=extras.end(); ++it) { |
142 | insertItem(*it); | 142 | insertItem(*it); |
143 | identifiers.append(*it); | 143 | identifiers.append(*it); |
144 | if ( *it == cur ) | 144 | if ( *it == cur ) |
145 | curix = listIndex; | 145 | curix = listIndex; |
146 | ++listIndex; | 146 | ++listIndex; |
147 | } | 147 | } |
148 | if ( !tzFound && !tz.isEmpty()) { | 148 | if ( !tzFound && !tz.isEmpty()) { |
149 | int i = tz.find( '/' ); | 149 | int i = tz.find( '/' ); |
150 | QString nm = tz.mid( i+1 ).replace(QRegExp("_"), " "); | 150 | QString nm = tz.mid( i+1 ).replace(QRegExp("_"), " "); |
151 | identifiers.append(tz); | 151 | identifiers.append(tz); |
152 | insertItem(nm); | 152 | insertItem(nm); |
153 | if ( nm == cur ) | 153 | if ( nm == cur ) |
154 | curix = listIndex; | 154 | curix = listIndex; |
155 | ++listIndex; | 155 | ++listIndex; |
156 | } | 156 | } |
157 | setCurrentItem(curix); | 157 | setCurrentItem(curix); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | void TZCombo::keyPressEvent( QKeyEvent *e ) | 161 | void TZCombo::keyPressEvent( QKeyEvent *e ) |
162 | { | 162 | { |
163 | // ### should popup() in Qt 3.0 (it's virtual there) | 163 | // ### should popup() in Qt 3.0 (it's virtual there) |
164 | // updateZones(); | 164 | // updateZones(); |
165 | QComboBox::keyPressEvent(e); | 165 | QComboBox::keyPressEvent(e); |
166 | } | 166 | } |
167 | 167 | ||
168 | void TZCombo::mousePressEvent(QMouseEvent*e) | 168 | void TZCombo::mousePressEvent(QMouseEvent*e) |
169 | { | 169 | { |
170 | // ### should popup() in Qt 3.0 (it's virtual there) | 170 | // ### should popup() in Qt 3.0 (it's virtual there) |
171 | // updateZones(); | 171 | // updateZones(); |
172 | QComboBox::mousePressEvent(e); | 172 | QComboBox::mousePressEvent(e); |
173 | } | 173 | } |
174 | 174 | ||
175 | QString TZCombo::currZone() const | 175 | QString TZCombo::currZone() const |
176 | { | 176 | { |
177 | return identifiers[currentItem()]; | 177 | return identifiers[currentItem()]; |
178 | } | 178 | } |
179 | 179 | ||
180 | void TZCombo::setCurrZone( const QString& id ) | 180 | void TZCombo::setCurrZone( const QString& id ) |
181 | { | 181 | { |
182 | for (int i=0; i< count(); i++) { | 182 | for (int i=0; i< count(); i++) { |
183 | if ( identifiers[i] == id ) { | 183 | if ( identifiers[i] == id ) { |
184 | setCurrentItem(i); | 184 | setCurrentItem(i); |
185 | return; | 185 | return; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | insertItem(id); | 188 | insertItem(id); |
189 | setCurrentItem( count() - 1); | 189 | setCurrentItem( count() - 1); |
190 | identifiers.append(id); | 190 | identifiers.append(id); |
191 | extras.append(id); | 191 | extras.append(id); |
192 | } | 192 | } |
193 | 193 | ||
194 | 194 | ||
195 | 195 | ||
196 | void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&) | 196 | void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&) |
197 | { | 197 | { |
198 | if ( msg == "timeZoneListChange()" ) { | 198 | if ( msg == "timeZoneListChange()" ) { |
199 | updateZones(); | 199 | updateZones(); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | /*! | 203 | /*! |
204 | Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be | 204 | Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be |
205 | populated with the available timezones. | 205 | populated with the available timezones. |
206 | */ | 206 | */ |
207 | 207 | ||
208 | TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) : | 208 | TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) : |
209 | QHBox(p,n) | 209 | QHBox(p,n) |
210 | { | 210 | { |
211 | d = new TimeZoneSelectorPrivate(); | 211 | d = new TimeZoneSelectorPrivate(); |
212 | // build the combobox before we do any updates... | 212 | // build the combobox before we do any updates... |
213 | cmbTz = new TZCombo( this, "timezone combo" ); | 213 | cmbTz = new TZCombo( this, "timezone combo" ); |
214 | 214 | ||
215 | cmdTz = new QToolButton( this, "timezone button" ); | 215 | cmdTz = new QToolButton( this, "timezone button" ); |
216 | cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) ); | 216 | cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) ); |
217 | cmdTz->setMaximumSize( cmdTz->sizeHint() ); | 217 | cmdTz->setMaximumSize( cmdTz->sizeHint() ); |
218 | 218 | ||
219 | // set up a connection to catch a newly selected item and throw our | 219 | // set up a connection to catch a newly selected item and throw our |
220 | // signal | 220 | // signal |
221 | QObject::connect( cmbTz, SIGNAL( activated( int ) ), | 221 | QObject::connect( cmbTz, SIGNAL( activated(int) ), |
222 | this, SLOT( slotTzActive( int ) ) ); | 222 | this, SLOT( slotTzActive(int) ) ); |
223 | QObject::connect( cmdTz, SIGNAL( clicked() ), | 223 | QObject::connect( cmdTz, SIGNAL( clicked() ), |
224 | this, SLOT( slotExecute() ) ); | 224 | this, SLOT( slotExecute() ) ); |
225 | } | 225 | } |
226 | 226 | ||
227 | /*! | 227 | /*! |
228 | Destroys a TimeZoneSelector. | 228 | Destroys a TimeZoneSelector. |
229 | */ | 229 | */ |
230 | TimeZoneSelector::~TimeZoneSelector() | 230 | TimeZoneSelector::~TimeZoneSelector() |
231 | { | 231 | { |
232 | } | 232 | } |
233 | 233 | ||
234 | void TimeZoneSelector::setLocalIncluded(bool b) | 234 | void TimeZoneSelector::setLocalIncluded(bool b) |
235 | { | 235 | { |
236 | d->includeLocal = b; | 236 | d->includeLocal = b; |
237 | cmbTz->updateZones(); | 237 | cmbTz->updateZones(); |
238 | } | 238 | } |
239 | 239 | ||
240 | bool TimeZoneSelector::localIncluded() const | 240 | bool TimeZoneSelector::localIncluded() const |
241 | { | 241 | { |
242 | return d->includeLocal; | 242 | return d->includeLocal; |
243 | } | 243 | } |
244 | 244 | ||
245 | /*! | 245 | /*! |
246 | Returns the currently selected timezone as a string in location format, e.g. | 246 | Returns the currently selected timezone as a string in location format, e.g. |
247 | \code Australia/Brisbane \endcode | 247 | \code Australia/Brisbane \endcode |
248 | */ | 248 | */ |
249 | QString TimeZoneSelector::currentZone() const | 249 | QString TimeZoneSelector::currentZone() const |
250 | { | 250 | { |
251 | return cmbTz->currZone(); | 251 | return cmbTz->currZone(); |
252 | } | 252 | } |
253 | 253 | ||
254 | /*! | 254 | /*! |
255 | Sets the current timezone to \a id. | 255 | Sets the current timezone to \a id. |
256 | */ | 256 | */ |
257 | void TimeZoneSelector::setCurrentZone( const QString& id ) | 257 | void TimeZoneSelector::setCurrentZone( const QString& id ) |
258 | { | 258 | { |
259 | cmbTz->setCurrZone( id ); | 259 | cmbTz->setCurrZone( id ); |
260 | } | 260 | } |
261 | /*! \fn void TimeZoneSelector::signalNewTz( const QString& id ) | 261 | /*! \fn void TimeZoneSelector::signalNewTz( const QString& id ) |
262 | This signal is emitted when a timezone has been selected by the user. The id | 262 | This signal is emitted when a timezone has been selected by the user. The id |
263 | is a \l QString in location format, eg \code Australia/Brisbane \endcode | 263 | is a \l QString in location format, eg \code Australia/Brisbane \endcode |
264 | */ | 264 | */ |
265 | 265 | ||
266 | 266 | ||
267 | void TimeZoneSelector::slotTzActive( int ) | 267 | void TimeZoneSelector::slotTzActive( int ) |
268 | { | 268 | { |
269 | emit signalNewTz( cmbTz->currZone() ); | 269 | emit signalNewTz( cmbTz->currZone() ); |
270 | } | 270 | } |
271 | 271 | ||
272 | void TimeZoneSelector::slotExecute( void ) | 272 | void TimeZoneSelector::slotExecute( void ) |
273 | { | 273 | { |
274 | // execute the world time application... | 274 | // execute the world time application... |
275 | if (QFile::exists(QPEApplication::qpeDir()+"bin/citytime")) | 275 | if (QFile::exists(QPEApplication::qpeDir()+"bin/citytime")) |
276 | Global::execute( "citytime" ); | 276 | Global::execute( "citytime" ); |
277 | else | 277 | else |
278 | QMessageBox::warning(this,tr("citytime executable not found"), | 278 | QMessageBox::warning(this,tr("citytime executable not found"), |
279 | tr("In order to choose the time zones,\nplease install citytime.")); | 279 | tr("In order to choose the time zones,\nplease install citytime.")); |
280 | } | 280 | } |
281 | 281 | ||
282 | QStringList timezoneDefaults( void ) | 282 | QStringList timezoneDefaults( void ) |
283 | { | 283 | { |
284 | QStringList tzs; | 284 | QStringList tzs; |
285 | // load up the list just like the file format (citytime.cpp) | 285 | // load up the list just like the file format (citytime.cpp) |
286 | tzs.append( "America/New_York" ); | 286 | tzs.append( "America/New_York" ); |
287 | tzs.append( "New York" ); | 287 | tzs.append( "New York" ); |
288 | tzs.append( "America/Los_Angeles" ); | 288 | tzs.append( "America/Los_Angeles" ); |
289 | tzs.append( "Los Angeles" ); | 289 | tzs.append( "Los Angeles" ); |
290 | tzs.append( "Australia/Brisbane" ); | 290 | tzs.append( "Australia/Brisbane" ); |
291 | tzs.append( "Brisbane" ); | 291 | tzs.append( "Brisbane" ); |
292 | tzs.append( "Europe/Berlin" ); | 292 | tzs.append( "Europe/Berlin" ); |
293 | tzs.append( "Berlin" ); | 293 | tzs.append( "Berlin" ); |
294 | tzs.append( "Asia/Tokyo" ); | 294 | tzs.append( "Asia/Tokyo" ); |
295 | tzs.append( "Tokyo" ); | 295 | tzs.append( "Tokyo" ); |
296 | tzs.append( "America/Denver" ); | 296 | tzs.append( "America/Denver" ); |
297 | tzs.append( "Denver" ); | 297 | tzs.append( "Denver" ); |
298 | 298 | ||
299 | return tzs; | 299 | return tzs; |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||