summaryrefslogtreecommitdiff
path: root/library
Unidiff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/alarmserver.cpp9
-rw-r--r--library/applnk.cpp1
-rw-r--r--library/tzselect.cpp1
3 files changed, 6 insertions, 5 deletions
diff --git a/library/alarmserver.cpp b/library/alarmserver.cpp
index 48ab9c1..ba7b015 100644
--- a/library/alarmserver.cpp
+++ b/library/alarmserver.cpp
@@ -1,288 +1,287 @@
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 <qdir.h> 21#include "alarmserver.h"
22
23 22
23#include <qpe/global.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25
26#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
27#include "alarmserver.h"
28#include <qpe/timeconversion.h> 26#include <qpe/timeconversion.h>
29 27
28#include <qdir.h>
29
30#include <sys/types.h> 30#include <sys/types.h>
31#include <sys/stat.h> 31#include <sys/stat.h>
32
33#include <stdlib.h> 32#include <stdlib.h>
34#include <unistd.h> 33#include <unistd.h>
35 34
36 35
37#undef USE_ATD // not used anymore -- we run opie-alarm on suspend/resume 36#undef USE_ATD // not used anymore -- we run opie-alarm on suspend/resume
38 37
39 38
40struct timerEventItem 39struct timerEventItem
41{ 40{
42 time_t UTCtime; 41 time_t UTCtime;
43 QCString channel, message; 42 QCString channel, message;
44 int data; 43 int data;
45 bool operator==( const timerEventItem &right ) const 44 bool operator==( const timerEventItem &right ) const
46 { 45 {
47 return ( UTCtime == right.UTCtime 46 return ( UTCtime == right.UTCtime
48 && channel == right.channel 47 && channel == right.channel
49 && message == right.message 48 && message == right.message
50 && data == right.data ); 49 && data == right.data );
51 } 50 }
52}; 51};
53 52
54class TimerReceiverObject : public QObject 53class TimerReceiverObject : public QObject
55{ 54{
56public: 55public:
57 TimerReceiverObject() 56 TimerReceiverObject()
58 { } 57 { }
59 ~TimerReceiverObject() 58 ~TimerReceiverObject()
60 { } 59 { }
61 void resetTimer(); 60 void resetTimer();
62 void setTimerEventItem(); 61 void setTimerEventItem();
63 void deleteTimer(); 62 void deleteTimer();
64protected: 63protected:
65 void timerEvent( QTimerEvent *te ); 64 void timerEvent( QTimerEvent *te );
66 65
67#ifdef USE_ATD 66#ifdef USE_ATD
68private: 67private:
69 QString atfilename; 68 QString atfilename;
70#endif 69#endif
71}; 70};
72 71
73TimerReceiverObject *timerEventReceiver = NULL; 72TimerReceiverObject *timerEventReceiver = NULL;
74QList<timerEventItem> timerEventList; 73QList<timerEventItem> timerEventList;
75timerEventItem *nearestTimerEvent = NULL; 74timerEventItem *nearestTimerEvent = NULL;
76 75
77 76
78// set the timer to go off on the next event in the list 77// set the timer to go off on the next event in the list
79void setNearestTimerEvent() 78void setNearestTimerEvent()
80{ 79{
81 nearestTimerEvent = NULL; 80 nearestTimerEvent = NULL;
82 QListIterator<timerEventItem> it( timerEventList ); 81 QListIterator<timerEventItem> it( timerEventList );
83 if ( *it ) 82 if ( *it )
84 nearestTimerEvent = *it; 83 nearestTimerEvent = *it;
85 for ( ; *it; ++it ) 84 for ( ; *it; ++it )
86 if ( (*it)->UTCtime < nearestTimerEvent->UTCtime ) 85 if ( (*it)->UTCtime < nearestTimerEvent->UTCtime )
87 nearestTimerEvent = *it; 86 nearestTimerEvent = *it;
88 if (nearestTimerEvent) 87 if (nearestTimerEvent)
89 timerEventReceiver->resetTimer(); 88 timerEventReceiver->resetTimer();
90 else 89 else
91 timerEventReceiver->deleteTimer(); 90 timerEventReceiver->deleteTimer();
92} 91}
93 92
94 93
95//store current state to file 94//store current state to file
96//Simple implementation. Should run on a timer. 95//Simple implementation. Should run on a timer.
97 96
98static void saveState() 97static void saveState()
99{ 98{
100 QString savefilename = Global::applicationFileName( "AlarmServer", "saveFile" ); 99 QString savefilename = Global::applicationFileName( "AlarmServer", "saveFile" );
101 if ( timerEventList.isEmpty() ) { 100 if ( timerEventList.isEmpty() ) {
102 unlink( savefilename ); 101 unlink( savefilename );
103 return ; 102 return ;
104 } 103 }
105 104
106 QFile savefile(savefilename + ".new"); 105 QFile savefile(savefilename + ".new");
107 if ( savefile.open(IO_WriteOnly) ) { 106 if ( savefile.open(IO_WriteOnly) ) {
108 QDataStream ds( &savefile ); 107 QDataStream ds( &savefile );
109 108
110 //save 109 //save
111 110
112 QListIterator<timerEventItem> it( timerEventList ); 111 QListIterator<timerEventItem> it( timerEventList );
113 for ( ; *it; ++it ) { 112 for ( ; *it; ++it ) {
114 ds << it.current()->UTCtime; 113 ds << it.current()->UTCtime;
115 ds << it.current()->channel; 114 ds << it.current()->channel;
116 ds << it.current()->message; 115 ds << it.current()->message;
117 ds << it.current()->data; 116 ds << it.current()->data;
118 } 117 }
119 118
120 119
121 savefile.close(); 120 savefile.close();
122 unlink( savefilename ); 121 unlink( savefilename );
123 QDir d; 122 QDir d;
124 d.rename(savefilename + ".new", savefilename); 123 d.rename(savefilename + ".new", savefilename);
125 124
126 } 125 }
127} 126}
128 127
129/*! 128/*!
130 Sets up the alarm server. Restoring to previous state (session management). 129 Sets up the alarm server. Restoring to previous state (session management).
131 */ 130 */
132void AlarmServer::initialize() 131void AlarmServer::initialize()
133{ 132{
134 //read autosave file and put events in timerEventList 133 //read autosave file and put events in timerEventList
135 134
136 QString savefilename = Global::applicationFileName( "AlarmServer", "saveFile" ); 135 QString savefilename = Global::applicationFileName( "AlarmServer", "saveFile" );
137 136
138 QFile savefile(savefilename); 137 QFile savefile(savefilename);
139 if ( savefile.open(IO_ReadOnly) ) { 138 if ( savefile.open(IO_ReadOnly) ) {
140 QDataStream ds( &savefile ); 139 QDataStream ds( &savefile );
141 while ( !ds.atEnd() ) { 140 while ( !ds.atEnd() ) {
142 timerEventItem *newTimerEventItem = new timerEventItem; 141 timerEventItem *newTimerEventItem = new timerEventItem;
143 ds >> newTimerEventItem->UTCtime; 142 ds >> newTimerEventItem->UTCtime;
144 ds >> newTimerEventItem->channel; 143 ds >> newTimerEventItem->channel;
145 ds >> newTimerEventItem->message; 144 ds >> newTimerEventItem->message;
146 ds >> newTimerEventItem->data; 145 ds >> newTimerEventItem->data;
147 timerEventList.append( newTimerEventItem ); 146 timerEventList.append( newTimerEventItem );
148 } 147 }
149 savefile.close(); 148 savefile.close();
150 if (!timerEventReceiver) 149 if (!timerEventReceiver)
151 timerEventReceiver = new TimerReceiverObject; 150 timerEventReceiver = new TimerReceiverObject;
152 setNearestTimerEvent(); 151 setNearestTimerEvent();
153 } 152 }
154} 153}
155 154
156 155
157#ifdef USE_ATD 156#ifdef USE_ATD
158 157
159static const char* atdir = "/var/spool/at/"; 158static const char* atdir = "/var/spool/at/";
160 159
161static bool triggerAtd( bool writeHWClock = FALSE ) 160static bool triggerAtd( bool writeHWClock = FALSE )
162{ 161{
163 QFile trigger(QString(atdir) + "trigger"); 162 QFile trigger(QString(atdir) + "trigger");
164 if ( trigger.open(IO_WriteOnly | IO_Raw) ) { 163 if ( trigger.open(IO_WriteOnly | IO_Raw) ) {
165 if ( trigger.writeBlock("\n", 2) != 2 ) { 164 if ( trigger.writeBlock("\n", 2) != 2 ) {
166 QMessageBox::critical( 0, QObject::tr( "Out of Space" ), 165 QMessageBox::critical( 0, QObject::tr( "Out of Space" ),
167 QObject::tr( "Unable to schedule alarm.\nFree some memory and try again." ) ); 166 QObject::tr( "Unable to schedule alarm.\nFree some memory and try again." ) );
168 trigger.close(); 167 trigger.close();
169 QFile::remove 168 QFile::remove
170 ( trigger.name() ); 169 ( trigger.name() );
171 return FALSE; 170 return FALSE;
172 } 171 }
173 return TRUE; 172 return TRUE;
174 } 173 }
175 return FALSE; 174 return FALSE;
176} 175}
177 176
178#else 177#else
179 178
180static bool writeResumeAt ( time_t wakeup ) 179static bool writeResumeAt ( time_t wakeup )
181{ 180{
182 FILE *fp = ::fopen ( "/var/run/resumeat", "w" ); 181 FILE *fp = ::fopen ( "/var/run/resumeat", "w" );
183 182
184 if ( fp ) { 183 if ( fp ) {
185 ::fprintf ( fp, "%d\n", (int) wakeup ); 184 ::fprintf ( fp, "%d\n", (int) wakeup );
186 ::fclose ( fp ); 185 ::fclose ( fp );
187 } 186 }
188 else 187 else
189 qWarning ( "Failed to write wakeup time to /var/run/resumeat" ); 188 qWarning ( "Failed to write wakeup time to /var/run/resumeat" );
190 189
191 return ( fp ); 190 return ( fp );
192} 191}
193 192
194#endif 193#endif
195 194
196void TimerReceiverObject::deleteTimer() 195void TimerReceiverObject::deleteTimer()
197{ 196{
198#ifdef USE_ATD 197#ifdef USE_ATD
199 if ( !atfilename.isEmpty() ) { 198 if ( !atfilename.isEmpty() ) {
200 unlink( atfilename ); 199 unlink( atfilename );
201 atfilename = QString::null; 200 atfilename = QString::null;
202 triggerAtd( FALSE ); 201 triggerAtd( FALSE );
203 } 202 }
204#else 203#else
205 writeResumeAt ( 0 ); 204 writeResumeAt ( 0 );
206#endif 205#endif
207} 206}
208 207
209void TimerReceiverObject::resetTimer() 208void TimerReceiverObject::resetTimer()
210{ 209{
211 const int maxsecs = 2147000; 210 const int maxsecs = 2147000;
212 QDateTime nearest = TimeConversion::fromUTC(nearestTimerEvent->UTCtime); 211 QDateTime nearest = TimeConversion::fromUTC(nearestTimerEvent->UTCtime);
213 QDateTime now = QDateTime::currentDateTime(); 212 QDateTime now = QDateTime::currentDateTime();
214 if ( nearest < now ) 213 if ( nearest < now )
215 nearest = now; 214 nearest = now;
216 int secs = TimeConversion::secsTo( now, nearest ); 215 int secs = TimeConversion::secsTo( now, nearest );
217 if ( secs > maxsecs ) { 216 if ( secs > maxsecs ) {
218 // too far for millisecond timing 217 // too far for millisecond timing
219 secs = maxsecs; 218 secs = maxsecs;
220 } 219 }
221 220
222 // System timer (needed so that we wake from deep sleep), 221 // System timer (needed so that we wake from deep sleep),
223 // from the Epoch in seconds. 222 // from the Epoch in seconds.
224 // 223 //
225 int at_secs = TimeConversion::toUTC(nearest); 224 int at_secs = TimeConversion::toUTC(nearest);
226 // qDebug("reset timer to %d seconds from Epoch",at_secs); 225 // qDebug("reset timer to %d seconds from Epoch",at_secs);
227 226
228#ifdef USE_ATD 227#ifdef USE_ATD
229 228
230 QString fn = atdir + QString::number(at_secs) + "." 229 QString fn = atdir + QString::number(at_secs) + "."
231 + QString::number(getpid()); 230 + QString::number(getpid());
232 if ( fn != atfilename ) { 231 if ( fn != atfilename ) {
233 QFile atfile(fn + ".new"); 232 QFile atfile(fn + ".new");
234 if ( atfile.open(IO_WriteOnly | IO_Raw) ) { 233 if ( atfile.open(IO_WriteOnly | IO_Raw) ) {
235 int total_written; 234 int total_written;
236 235
237 // just wake up and delete the at file 236 // just wake up and delete the at file
238 QString cmd = "#!/bin/sh\nrm " + fn; 237 QString cmd = "#!/bin/sh\nrm " + fn;
239 total_written = atfile.writeBlock(cmd.latin1(), cmd.length()); 238 total_written = atfile.writeBlock(cmd.latin1(), cmd.length());
240 if ( total_written != int(cmd.length()) ) { 239 if ( total_written != int(cmd.length()) ) {
241 QMessageBox::critical( 0, tr("Out of Space"), 240 QMessageBox::critical( 0, tr("Out of Space"),
242 tr("Unable to schedule alarm.\n" 241 tr("Unable to schedule alarm.\n"
243 "Please free up space and try again") ); 242 "Please free up space and try again") );
244 atfile.close(); 243 atfile.close();
245 QFile::remove 244 QFile::remove
246 ( atfile.name() ); 245 ( atfile.name() );
247 return ; 246 return ;
248 } 247 }
249 atfile.close(); 248 atfile.close();
250 unlink( atfilename ); 249 unlink( atfilename );
251 QDir d; 250 QDir d;
252 d.rename(fn + ".new", fn); 251 d.rename(fn + ".new", fn);
253 chmod(fn.latin1(), 0755); 252 chmod(fn.latin1(), 0755);
254 atfilename = fn; 253 atfilename = fn;
255 triggerAtd( FALSE ); 254 triggerAtd( FALSE );
256 } 255 }
257 else { 256 else {
258 qWarning("Cannot open atd file %s", fn.latin1()); 257 qWarning("Cannot open atd file %s", fn.latin1());
259 } 258 }
260 } 259 }
261#else 260#else
262 writeResumeAt ( at_secs ); 261 writeResumeAt ( at_secs );
263 262
264#endif 263#endif
265 264
266 // Qt timers (does the actual alarm) 265 // Qt timers (does the actual alarm)
267 // from now in milliseconds 266 // from now in milliseconds
268 // 267 //
269 qDebug("AlarmServer waiting %d seconds", secs); 268 qDebug("AlarmServer waiting %d seconds", secs);
270 startTimer( 1000 * secs + 500 ); 269 startTimer( 1000 * secs + 500 );
271} 270}
272 271
273void TimerReceiverObject::timerEvent( QTimerEvent * ) 272void TimerReceiverObject::timerEvent( QTimerEvent * )
274{ 273{
275 bool needSave = FALSE; 274 bool needSave = FALSE;
276 killTimers(); 275 killTimers();
277 if (nearestTimerEvent) { 276 if (nearestTimerEvent) {
278 if ( nearestTimerEvent->UTCtime 277 if ( nearestTimerEvent->UTCtime
279 <= TimeConversion::toUTC(QDateTime::currentDateTime()) ) { 278 <= TimeConversion::toUTC(QDateTime::currentDateTime()) ) {
280#ifndef QT_NO_COP 279#ifndef QT_NO_COP
281 QCopEnvelope e( nearestTimerEvent->channel, 280 QCopEnvelope e( nearestTimerEvent->channel,
282 nearestTimerEvent->message ); 281 nearestTimerEvent->message );
283 e << TimeConversion::fromUTC( nearestTimerEvent->UTCtime ) 282 e << TimeConversion::fromUTC( nearestTimerEvent->UTCtime )
284 << nearestTimerEvent->data; 283 << nearestTimerEvent->data;
285#endif 284#endif
286 285
287 timerEventList.remove( nearestTimerEvent ); 286 timerEventList.remove( nearestTimerEvent );
288 needSave = TRUE; 287 needSave = TRUE;
diff --git a/library/applnk.cpp b/library/applnk.cpp
index e9d519e..1c1a227 100644
--- a/library/applnk.cpp
+++ b/library/applnk.cpp
@@ -1,285 +1,286 @@
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_MIMEEXT 21#define QTOPIA_INTERNAL_MIMEEXT
22#define QTOPIA_INTERNAL_PRELOADACCESS 22#define QTOPIA_INTERNAL_PRELOADACCESS
23#define QTOPIA_INTERNAL_APPLNKASSIGN 23#define QTOPIA_INTERNAL_APPLNKASSIGN
24 24
25#include "applnk.h" 25#include "applnk.h"
26 26
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/categories.h> 28#include <qpe/categories.h>
29#include <qpe/categoryselect.h> 29#include <qpe/categoryselect.h>
30#include <qpe/global.h>
30#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
31#include <qpe/mimetype.h> 32#include <qpe/mimetype.h>
32#include <qpe/config.h> 33#include <qpe/config.h>
33#include <qpe/storage.h> 34#include <qpe/storage.h>
34#include <qpe/resource.h> 35#include <qpe/resource.h>
35 36
36#include <qdir.h> 37#include <qdir.h>
37 38
38 39
39#include <stdlib.h> 40#include <stdlib.h>
40 41
41int AppLnk::lastId = 5000; 42int AppLnk::lastId = 5000;
42 43
43static int smallSize = 14; 44static int smallSize = 14;
44static int bigSize = 32; 45static int bigSize = 32;
45 46
46static QString safeFileName(const QString& n) 47static QString safeFileName(const QString& n)
47{ 48{
48 QString safename=n; 49 QString safename=n;
49 safename.replace(QRegExp("[^0-9A-Za-z.]"),"_"); 50 safename.replace(QRegExp("[^0-9A-Za-z.]"),"_");
50 safename.replace(QRegExp("^[^A-Za-z]*"),""); 51 safename.replace(QRegExp("^[^A-Za-z]*"),"");
51 if ( safename.isEmpty() ) 52 if ( safename.isEmpty() )
52 safename = "_"; 53 safename = "_";
53 return safename; 54 return safename;
54} 55}
55 56
56static bool prepareDirectories(const QString& lf) 57static bool prepareDirectories(const QString& lf)
57{ 58{
58 if ( !QFile::exists(lf) ) { 59 if ( !QFile::exists(lf) ) {
59 // May need to create directories 60 // May need to create directories
60 QFileInfo fi(lf); 61 QFileInfo fi(lf);
61 if ( system(("mkdir -p "+fi.dirPath(TRUE))) ) 62 if ( system(("mkdir -p "+fi.dirPath(TRUE))) )
62 return FALSE; 63 return FALSE;
63 } 64 }
64 return TRUE; 65 return TRUE;
65} 66}
66 67
67class AppLnkPrivate 68class AppLnkPrivate
68{ 69{
69public: 70public:
70 /* the size of the Pixmap */ 71 /* the size of the Pixmap */
71 enum Size {Normal = 0, Big }; 72 enum Size {Normal = 0, Big };
72 AppLnkPrivate() { 73 AppLnkPrivate() {
73 /* we want one normal and one big item */ 74 /* we want one normal and one big item */
74 75
75 QPixmap pix; 76 QPixmap pix;
76 mPixmaps.insert(0, pix ); 77 mPixmaps.insert(0, pix );
77 mPixmaps.insert(1, pix); 78 mPixmaps.insert(1, pix);
78 } 79 }
79 80
80 QStringList mCatList; // always correct 81 QStringList mCatList; // always correct
81 QArray<int> mCat; // cached value; correct if not empty 82 QArray<int> mCat; // cached value; correct if not empty
82 QMap<int, QPixmap> mPixmaps; 83 QMap<int, QPixmap> mPixmaps;
83 84
84 void updateCatListFromArray() 85 void updateCatListFromArray()
85 { 86 {
86 Categories cat( 0 ); 87 Categories cat( 0 );
87 cat.load( categoryFileName() ); 88 cat.load( categoryFileName() );
88 // we need to update the names for the mCat... to mCatList 89 // we need to update the names for the mCat... to mCatList
89 mCatList.clear(); 90 mCatList.clear();
90 for (uint i = 0; i < mCat.count(); i++ ) 91 for (uint i = 0; i < mCat.count(); i++ )
91 mCatList << cat.label("Document View", mCat[i] ); 92 mCatList << cat.label("Document View", mCat[i] );
92 93
93 } 94 }
94 95
95 void setCatArrayDirty() 96 void setCatArrayDirty()
96 { 97 {
97 mCat.resize(0); 98 mCat.resize(0);
98 } 99 }
99 100
100 void ensureCatArray() 101 void ensureCatArray()
101 { 102 {
102 if ( mCat.count() > 0 || mCatList.count()==0 ) 103 if ( mCat.count() > 0 || mCatList.count()==0 )
103 return; 104 return;
104 105
105 Categories cat( 0 ); 106 Categories cat( 0 );
106 cat.load( categoryFileName() ); 107 cat.load( categoryFileName() );
107 mCat.resize( mCatList.count() ); 108 mCat.resize( mCatList.count() );
108 int i; 109 int i;
109 QStringList::ConstIterator it; 110 QStringList::ConstIterator it;
110 for ( i = 0, it = mCatList.begin(); it != mCatList.end(); 111 for ( i = 0, it = mCatList.begin(); it != mCatList.end();
111 ++it, i++ ) { 112 ++it, i++ ) {
112 113
113 bool number; 114 bool number;
114 int id = (*it).toInt( &number ); 115 int id = (*it).toInt( &number );
115 if ( !number ) { 116 if ( !number ) {
116 id = cat.id( "Document View", *it ); 117 id = cat.id( "Document View", *it );
117 if ( id == 0 ) 118 if ( id == 0 )
118 id = cat.addCategory( "Document View", *it ); 119 id = cat.addCategory( "Document View", *it );
119 } 120 }
120 mCat[i] = id; 121 mCat[i] = id;
121 } 122 }
122 } 123 }
123}; 124};
124 125
125/*! 126/*!
126 \class AppLnk applnk.h 127 \class AppLnk applnk.h
127 \brief The AppLnk class represents an application available on the system. 128 \brief The AppLnk class represents an application available on the system.
128 129
129 Every Qtopia application \e app has a corresponding \e app.desktop 130 Every Qtopia application \e app has a corresponding \e app.desktop
130 file. When one of these files is read its data is stored as an 131 file. When one of these files is read its data is stored as an
131 AppLnk object. 132 AppLnk object.
132 133
133 The AppLnk class introduces some Qtopia-specific concepts, and 134 The AppLnk class introduces some Qtopia-specific concepts, and
134 provides a variety of functions, as described in the following 135 provides a variety of functions, as described in the following
135 sections. 136 sections.
136 \tableofcontents 137 \tableofcontents
137 138
138 \target Types 139 \target Types
139 \section1 Types 140 \section1 Types
140 141
141 Every AppLnk object has a \e type. For applications, games and 142 Every AppLnk object has a \e type. For applications, games and
142 settings the type is \c Application; for documents the 143 settings the type is \c Application; for documents the
143 type is the document's MIME type. 144 type is the document's MIME type.
144 145
145 \target files-and-links 146 \target files-and-links
146 \section1 Files and Links 147 \section1 Files and Links
147 148
148 When you create an AppLnk (or more likely, a \link doclnk.html 149 When you create an AppLnk (or more likely, a \link doclnk.html
149 DocLnk\endlink), you don't deal directly with filenames in the 150 DocLnk\endlink), you don't deal directly with filenames in the
150 filesystem. Instead you do this: 151 filesystem. Instead you do this:
151 \code 152 \code
152 DocLnk d; 153 DocLnk d;
153 d.setType("text/plain"); 154 d.setType("text/plain");
154 d.setName("My Nicely Named Document / Whatever"); // Yes, "/" is legal. 155 d.setName("My Nicely Named Document / Whatever"); // Yes, "/" is legal.
155 \endcode 156 \endcode
156 At this point, the file() and linkFile() are unknown. Normally 157 At this point, the file() and linkFile() are unknown. Normally
157 this is uninteresting, and the names become automatically known, 158 this is uninteresting, and the names become automatically known,
158 and more importantly, becomes reserved, when you ask what they are: 159 and more importantly, becomes reserved, when you ask what they are:
159 160
160 \code 161 \code
161 QString fn = d.file(); 162 QString fn = d.file();
162 \endcode 163 \endcode
163 This invents a filename, and creates the file on disk (an empty 164 This invents a filename, and creates the file on disk (an empty
164 reservation file) to prevent the name being used by another 165 reservation file) to prevent the name being used by another
165 application. 166 application.
166 167
167 In some circumstances, you don't want to create the file if it 168 In some circumstances, you don't want to create the file if it
168 doesn't already exist (e.g. in the Document tab, some of the \link 169 doesn't already exist (e.g. in the Document tab, some of the \link
169 doclnk.html DocLnk\endlink objects represented by icons are 170 doclnk.html DocLnk\endlink objects represented by icons are
170 DocLnk's created just for that view - they don't have 171 DocLnk's created just for that view - they don't have
171 corresponding \c .desktop files. To avoid littering empty 172 corresponding \c .desktop files. To avoid littering empty
172 reservation files around, we check in a few places to see whether 173 reservation files around, we check in a few places to see whether
173 the file really needs to exist). 174 the file really needs to exist).
174 175
175 \section1 Functionality 176 \section1 Functionality
176 177
177 AppLnk objects are created by calling the constructor with the 178 AppLnk objects are created by calling the constructor with the
178 name of a \e .desktop file. The object can be checked for validity 179 name of a \e .desktop file. The object can be checked for validity
179 using isValid(). 180 using isValid().
180 181
181 The following functions are used to set or retrieve information 182 The following functions are used to set or retrieve information
182 about the application: 183 about the application:
183 \table 184 \table
184 \header \i Get Function \i Set Function \i Short Description 185 \header \i Get Function \i Set Function \i Short Description
185 \row \i \l name() \i \l setName() \i application's name 186 \row \i \l name() \i \l setName() \i application's name
186 \row \i \l pixmap() \i \e none \i application's icon 187 \row \i \l pixmap() \i \e none \i application's icon
187 \row \i \l bigPixmap() \i \e none \i application's large icon 188 \row \i \l bigPixmap() \i \e none \i application's large icon
188 \row \i \e none \i setIcon() \i sets the icon's filename 189 \row \i \e none \i setIcon() \i sets the icon's filename
189 \row \i \l type() \i \l setType() \i see \link #Types Types\endlink above 190 \row \i \l type() \i \l setType() \i see \link #Types Types\endlink above
190 \row \i \l rotation() \i \e none \i 0, 90, 180 or 270 degrees 191 \row \i \l rotation() \i \e none \i 0, 90, 180 or 270 degrees
191 \row \i \l comment() \i \l setComment() \i text for the Details dialog 192 \row \i \l comment() \i \l setComment() \i text for the Details dialog
192 \row \i \l exec() \i \l setExec() \i executable's filename 193 \row \i \l exec() \i \l setExec() \i executable's filename
193 \row \i \l file() \i \e none \i document's filename 194 \row \i \l file() \i \e none \i document's filename
194 \row \i \l linkFile() \i \l setLinkFile() \i \e .desktop filename 195 \row \i \l linkFile() \i \l setLinkFile() \i \e .desktop filename
195 \row \i \l mimeTypes() \i \e none \i the mime types the application can view or edit 196 \row \i \l mimeTypes() \i \e none \i the mime types the application can view or edit
196 \row \i \l categories() \i \l setCategories() \i \e{see the function descriptions} 197 \row \i \l categories() \i \l setCategories() \i \e{see the function descriptions}
197 \row \i \l fileKnown() \i \e none \i see \link 198 \row \i \l fileKnown() \i \e none \i see \link
198#files-and-links Files and Links\endlink above 199#files-and-links Files and Links\endlink above
199 \row \i \l linkFileKnown() \i \e none \i see \link 200 \row \i \l linkFileKnown() \i \e none \i see \link
200#files-and-links Files and Links\endlink above 201#files-and-links Files and Links\endlink above
201 \row \i \l property() \i \l setProperty() \i any AppLnk property 202 \row \i \l property() \i \l setProperty() \i any AppLnk property
202 can be retrieved or set (if writeable) using these 203 can be retrieved or set (if writeable) using these
203 \endtable 204 \endtable
204 205
205 To save an AppLnk to disk use writeLink(). To execute the 206 To save an AppLnk to disk use writeLink(). To execute the
206 application that the AppLnk object refers to, use execute(). 207 application that the AppLnk object refers to, use execute().
207 208
208 AppLnk's can be deleted from disk using removeLinkFile(). To 209 AppLnk's can be deleted from disk using removeLinkFile(). To
209 remove both the link and the application's executable use 210 remove both the link and the application's executable use
210 removeFiles(). 211 removeFiles().
211 212
212 Icon sizes can be globally changed (but only for AppLnk objects 213 Icon sizes can be globally changed (but only for AppLnk objects
213 created after the calls) with setSmallIconSize() and 214 created after the calls) with setSmallIconSize() and
214 setBigIconSize(). 215 setBigIconSize().
215 216
216 \ingroup qtopiaemb 217 \ingroup qtopiaemb
217*/ 218*/
218 219
219/*! 220/*!
220 Sets the size used for small icons to \a small pixels. 221 Sets the size used for small icons to \a small pixels.
221 Only affects AppLnk objects created after the call. 222 Only affects AppLnk objects created after the call.
222 223
223 \sa smallIconSize() setIcon() 224 \sa smallIconSize() setIcon()
224*/ 225*/
225void AppLnk::setSmallIconSize(int small) 226void AppLnk::setSmallIconSize(int small)
226{ 227{
227 smallSize = small; 228 smallSize = small;
228} 229}
229 230
230/*! 231/*!
231 Returns the size used for small icons. 232 Returns the size used for small icons.
232 233
233 \sa setSmallIconSize() setIcon() 234 \sa setSmallIconSize() setIcon()
234*/ 235*/
235int AppLnk::smallIconSize() 236int AppLnk::smallIconSize()
236{ 237{
237 return smallSize; 238 return smallSize;
238} 239}
239 240
240 241
241/*! 242/*!
242 Sets the size used for large icons to \a big pixels. 243 Sets the size used for large icons to \a big pixels.
243 Only affects AppLnk objects created after the call. 244 Only affects AppLnk objects created after the call.
244 245
245 \sa bigIconSize() setIcon() 246 \sa bigIconSize() setIcon()
246*/ 247*/
247void AppLnk::setBigIconSize(int big) 248void AppLnk::setBigIconSize(int big)
248{ 249{
249 bigSize = big; 250 bigSize = big;
250} 251}
251 252
252/*! 253/*!
253 Returns the size used for large icons. 254 Returns the size used for large icons.
254 255
255 \sa setBigIconSize() setIcon() 256 \sa setBigIconSize() setIcon()
256*/ 257*/
257int AppLnk::bigIconSize() 258int AppLnk::bigIconSize()
258{ 259{
259 return bigSize; 260 return bigSize;
260} 261}
261 262
262 263
263/*! 264/*!
264 \fn QString AppLnk::name() const 265 \fn QString AppLnk::name() const
265 266
266 Returns the Name property. This is the user-visible name for the 267 Returns the Name property. This is the user-visible name for the
267 document or application, not the filename. 268 document or application, not the filename.
268 269
269 See \link #files-and-links Files and Links\endlink. 270 See \link #files-and-links Files and Links\endlink.
270 271
271 \sa setName() 272 \sa setName()
272*/ 273*/
273/*! 274/*!
274 \fn QString AppLnk::exec() const 275 \fn QString AppLnk::exec() const
275 276
276 Returns the Exec property. This is the name of the executable 277 Returns the Exec property. This is the name of the executable
277 program associated with the AppLnk. 278 program associated with the AppLnk.
278 279
279 \sa setExec() 280 \sa setExec()
280*/ 281*/
281/*! 282/*!
282 \fn QString AppLnk::rotation() const 283 \fn QString AppLnk::rotation() const
283 284
284 Returns the Rotation property. The value is 0, 90, 180 or 270 285 Returns the Rotation property. The value is 0, 90, 180 or 270
285 degrees. 286 degrees.
diff --git a/library/tzselect.cpp b/library/tzselect.cpp
index 848dfb7..8dd427f 100644
--- a/library/tzselect.cpp
+++ b/library/tzselect.cpp
@@ -1,286 +1,287 @@
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/global.h>
31#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
32#include <qmessagebox.h> 33#include <qmessagebox.h>
33 34
34/*! 35/*!
35 \class TimeZoneSelector 36 \class TimeZoneSelector
36 37
37 \brief The TimeZoneSelector widget allows users to configure their time zone information. 38 \brief The TimeZoneSelector widget allows users to configure their time zone information.
38 39
39 \ingroup qtopiaemb 40 \ingroup qtopiaemb
40*/ 41*/
41 42
42class TimeZoneSelectorPrivate 43class TimeZoneSelectorPrivate
43{ 44{
44public: 45public:
45 TimeZoneSelectorPrivate() : includeLocal(FALSE) {} 46 TimeZoneSelectorPrivate() : includeLocal(FALSE) {}
46 bool includeLocal; 47 bool includeLocal;
47}; 48};
48 49
49TZCombo::TZCombo( QWidget *p, const char* n ) 50TZCombo::TZCombo( QWidget *p, const char* n )
50 : QComboBox( p, n ) 51 : QComboBox( p, n )
51{ 52{
52 updateZones(); 53 updateZones();
53 // check to see if TZ is set, if it is set the current item to that 54 // check to see if TZ is set, if it is set the current item to that
54 QString tz = getenv("TZ"); 55 QString tz = getenv("TZ");
55 if (parent()->inherits("TimeZoneSelector")) { 56 if (parent()->inherits("TimeZoneSelector")) {
56 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 57 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
57 // overide to the 'local' type. 58 // overide to the 'local' type.
58 tz = "None"; 59 tz = "None";
59 } 60 }
60 } 61 }
61 if ( !tz.isNull() ) { 62 if ( !tz.isNull() ) {
62 int n = 0, 63 int n = 0,
63 index = 0; 64 index = 0;
64 for ( QStringList::Iterator it=identifiers.begin(); 65 for ( QStringList::Iterator it=identifiers.begin();
65 it!=identifiers.end(); ++it) { 66 it!=identifiers.end(); ++it) {
66 if ( *it == tz ) 67 if ( *it == tz )
67 index = n; 68 index = n;
68 n++; 69 n++;
69 } 70 }
70 setCurrentItem(index); 71 setCurrentItem(index);
71 } else { 72 } else {
72 setCurrentItem(0); 73 setCurrentItem(0);
73 } 74 }
74 75
75 76
76 77
77 // listen on QPE/System 78 // listen on QPE/System
78#if !defined(QT_NO_COP) 79#if !defined(QT_NO_COP)
79 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 80 QCopChannel *channel = new QCopChannel( "QPE/System", this );
80 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 81 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
81 this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) ); 82 this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) );
82#endif 83#endif
83 84
84 85
85} 86}
86 87
87TZCombo::~TZCombo() 88TZCombo::~TZCombo()
88{ 89{
89} 90}
90 91
91void TZCombo::updateZones() 92void TZCombo::updateZones()
92{ 93{
93 QString cur = currentText(); 94 QString cur = currentText();
94 clear(); 95 clear();
95 identifiers.clear(); 96 identifiers.clear();
96 int curix=0; 97 int curix=0;
97 QString tz = getenv("TZ"); 98 QString tz = getenv("TZ");
98 bool tzFound = FALSE; 99 bool tzFound = FALSE;
99 Config cfg("CityTime"); 100 Config cfg("CityTime");
100 cfg.setGroup("TimeZones"); 101 cfg.setGroup("TimeZones");
101 int listIndex = 0; 102 int listIndex = 0;
102 if (parent()->inherits("TimeZoneSelector")) { 103 if (parent()->inherits("TimeZoneSelector")) {
103 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 104 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
104 // overide to the 'local' type. 105 // overide to the 'local' type.
105 identifiers.append( "None" ); 106 identifiers.append( "None" );
106 insertItem( tr("None") ); 107 insertItem( tr("None") );
107 if ( cur == tr("None")) 108 if ( cur == tr("None"))
108 curix = 0; 109 curix = 0;
109 listIndex++; 110 listIndex++;
110 } 111 }
111 } 112 }
112 int cfgIndex = 0; 113 int cfgIndex = 0;
113 while (1) { 114 while (1) {
114 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); 115 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null);
115 if ( zn.isNull() ) 116 if ( zn.isNull() )
116 break; 117 break;
117 if ( zn == tz ) 118 if ( zn == tz )
118 tzFound = TRUE; 119 tzFound = TRUE;
119 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); 120 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex));
120 identifiers.append(zn); 121 identifiers.append(zn);
121 insertItem(nm); 122 insertItem(nm);
122 if ( nm == cur ) 123 if ( nm == cur )
123 curix = listIndex; 124 curix = listIndex;
124 ++cfgIndex; 125 ++cfgIndex;
125 ++listIndex; 126 ++listIndex;
126 } 127 }
127 if ( !listIndex ) { 128 if ( !listIndex ) {
128 QStringList list = timezoneDefaults(); 129 QStringList list = timezoneDefaults();
129 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { 130 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) {
130 QString zn = *it; 131 QString zn = *it;
131 QString nm = *++it; 132 QString nm = *++it;
132 if ( zn == tz ) 133 if ( zn == tz )
133 tzFound = TRUE; 134 tzFound = TRUE;
134 if ( nm == cur ) 135 if ( nm == cur )
135 curix = listIndex; 136 curix = listIndex;
136 identifiers.append(zn); 137 identifiers.append(zn);
137 insertItem(nm); 138 insertItem(nm);
138 ++listIndex; 139 ++listIndex;
139 } 140 }
140 } 141 }
141 for (QStringList::Iterator it=extras.begin(); it!=extras.end(); ++it) { 142 for (QStringList::Iterator it=extras.begin(); it!=extras.end(); ++it) {
142 insertItem(*it); 143 insertItem(*it);
143 identifiers.append(*it); 144 identifiers.append(*it);
144 if ( *it == cur ) 145 if ( *it == cur )
145 curix = listIndex; 146 curix = listIndex;
146 ++listIndex; 147 ++listIndex;
147 } 148 }
148 if ( !tzFound && !tz.isEmpty()) { 149 if ( !tzFound && !tz.isEmpty()) {
149 int i = tz.find( '/' ); 150 int i = tz.find( '/' );
150 QString nm = tz.mid( i+1 ).replace(QRegExp("_"), " "); 151 QString nm = tz.mid( i+1 ).replace(QRegExp("_"), " ");
151 identifiers.append(tz); 152 identifiers.append(tz);
152 insertItem(nm); 153 insertItem(nm);
153 if ( nm == cur ) 154 if ( nm == cur )
154 curix = listIndex; 155 curix = listIndex;
155 ++listIndex; 156 ++listIndex;
156 } 157 }
157 setCurrentItem(curix); 158 setCurrentItem(curix);
158} 159}
159 160
160 161
161void TZCombo::keyPressEvent( QKeyEvent *e ) 162void TZCombo::keyPressEvent( QKeyEvent *e )
162{ 163{
163 // ### should popup() in Qt 3.0 (it's virtual there) 164 // ### should popup() in Qt 3.0 (it's virtual there)
164// updateZones(); 165// updateZones();
165 QComboBox::keyPressEvent(e); 166 QComboBox::keyPressEvent(e);
166} 167}
167 168
168void TZCombo::mousePressEvent(QMouseEvent*e) 169void TZCombo::mousePressEvent(QMouseEvent*e)
169{ 170{
170 // ### should popup() in Qt 3.0 (it's virtual there) 171 // ### should popup() in Qt 3.0 (it's virtual there)
171// updateZones(); 172// updateZones();
172 QComboBox::mousePressEvent(e); 173 QComboBox::mousePressEvent(e);
173} 174}
174 175
175QString TZCombo::currZone() const 176QString TZCombo::currZone() const
176{ 177{
177 return identifiers[currentItem()]; 178 return identifiers[currentItem()];
178} 179}
179 180
180void TZCombo::setCurrZone( const QString& id ) 181void TZCombo::setCurrZone( const QString& id )
181{ 182{
182 for (int i=0; i< count(); i++) { 183 for (int i=0; i< count(); i++) {
183 if ( identifiers[i] == id ) { 184 if ( identifiers[i] == id ) {
184 setCurrentItem(i); 185 setCurrentItem(i);
185 return; 186 return;
186} 187}
187 } 188 }
188 insertItem(id); 189 insertItem(id);
189 setCurrentItem( count() - 1); 190 setCurrentItem( count() - 1);
190 identifiers.append(id); 191 identifiers.append(id);
191 extras.append(id); 192 extras.append(id);
192} 193}
193 194
194 195
195 196
196void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&) 197void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&)
197{ 198{
198 if ( msg == "timeZoneListChange()" ) { 199 if ( msg == "timeZoneListChange()" ) {
199 updateZones(); 200 updateZones();
200 } 201 }
201} 202}
202 203
203/*! 204/*!
204 Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be 205 Creates a new TimeZoneSelector with parent \a p and name \a n. The combobox will be
205 populated with the available timezones. 206 populated with the available timezones.
206*/ 207*/
207 208
208TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) : 209TimeZoneSelector::TimeZoneSelector(QWidget* p, const char* n) :
209 QHBox(p,n) 210 QHBox(p,n)
210{ 211{
211 d = new TimeZoneSelectorPrivate(); 212 d = new TimeZoneSelectorPrivate();
212 // build the combobox before we do any updates... 213 // build the combobox before we do any updates...
213 cmbTz = new TZCombo( this, "timezone combo" ); 214 cmbTz = new TZCombo( this, "timezone combo" );
214 215
215 cmdTz = new QToolButton( this, "timezone button" ); 216 cmdTz = new QToolButton( this, "timezone button" );
216 cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) ); 217 cmdTz->setIconSet( Resource::loadIconSet( "citytime_icon" ) );
217 cmdTz->setMaximumSize( cmdTz->sizeHint() ); 218 cmdTz->setMaximumSize( cmdTz->sizeHint() );
218 219
219 // set up a connection to catch a newly selected item and throw our 220 // set up a connection to catch a newly selected item and throw our
220 // signal 221 // signal
221 QObject::connect( cmbTz, SIGNAL( activated(int) ), 222 QObject::connect( cmbTz, SIGNAL( activated(int) ),
222 this, SLOT( slotTzActive(int) ) ); 223 this, SLOT( slotTzActive(int) ) );
223 QObject::connect( cmdTz, SIGNAL( clicked() ), 224 QObject::connect( cmdTz, SIGNAL( clicked() ),
224 this, SLOT( slotExecute() ) ); 225 this, SLOT( slotExecute() ) );
225} 226}
226 227
227/*! 228/*!
228 Destroys a TimeZoneSelector. 229 Destroys a TimeZoneSelector.
229*/ 230*/
230TimeZoneSelector::~TimeZoneSelector() 231TimeZoneSelector::~TimeZoneSelector()
231{ 232{
232} 233}
233 234
234void TimeZoneSelector::setLocalIncluded(bool b) 235void TimeZoneSelector::setLocalIncluded(bool b)
235{ 236{
236 d->includeLocal = b; 237 d->includeLocal = b;
237 cmbTz->updateZones(); 238 cmbTz->updateZones();
238} 239}
239 240
240bool TimeZoneSelector::localIncluded() const 241bool TimeZoneSelector::localIncluded() const
241{ 242{
242 return d->includeLocal; 243 return d->includeLocal;
243} 244}
244 245
245/*! 246/*!
246 Returns the currently selected timezone as a string in location format, e.g. 247 Returns the currently selected timezone as a string in location format, e.g.
247 \code Australia/Brisbane \endcode 248 \code Australia/Brisbane \endcode
248*/ 249*/
249QString TimeZoneSelector::currentZone() const 250QString TimeZoneSelector::currentZone() const
250{ 251{
251 return cmbTz->currZone(); 252 return cmbTz->currZone();
252} 253}
253 254
254/*! 255/*!
255 Sets the current timezone to \a id. 256 Sets the current timezone to \a id.
256*/ 257*/
257void TimeZoneSelector::setCurrentZone( const QString& id ) 258void TimeZoneSelector::setCurrentZone( const QString& id )
258{ 259{
259 cmbTz->setCurrZone( id ); 260 cmbTz->setCurrZone( id );
260} 261}
261/*! \fn void TimeZoneSelector::signalNewTz( const QString& id ) 262/*! \fn void TimeZoneSelector::signalNewTz( const QString& id )
262 This signal is emitted when a timezone has been selected by the user. The id 263 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 264 is a \l QString in location format, eg \code Australia/Brisbane \endcode
264*/ 265*/
265 266
266 267
267void TimeZoneSelector::slotTzActive( int ) 268void TimeZoneSelector::slotTzActive( int )
268{ 269{
269 emit signalNewTz( cmbTz->currZone() ); 270 emit signalNewTz( cmbTz->currZone() );
270} 271}
271 272
272void TimeZoneSelector::slotExecute( void ) 273void TimeZoneSelector::slotExecute( void )
273{ 274{
274 // execute the world time application... 275 // execute the world time application...
275 if (QFile::exists(QPEApplication::qpeDir()+"bin/citytime")) 276 if (QFile::exists(QPEApplication::qpeDir()+"bin/citytime"))
276 Global::execute( "citytime" ); 277 Global::execute( "citytime" );
277 else 278 else
278 QMessageBox::warning(this,tr("citytime executable not found"), 279 QMessageBox::warning(this,tr("citytime executable not found"),
279 tr("In order to choose the time zones,\nplease install citytime.")); 280 tr("In order to choose the time zones,\nplease install citytime."));
280} 281}
281 282
282QStringList timezoneDefaults( void ) 283QStringList timezoneDefaults( void )
283{ 284{
284 QStringList tzs; 285 QStringList tzs;
285 // load up the list just like the file format (citytime.cpp) 286 // load up the list just like the file format (citytime.cpp)
286 tzs.append( "America/New_York" ); 287 tzs.append( "America/New_York" );