summaryrefslogtreecommitdiff
path: root/library/tzselect.cpp
authorllornkcor <llornkcor>2002-09-22 18:24:12 (UTC)
committer llornkcor <llornkcor>2002-09-22 18:24:12 (UTC)
commitf8aeb3c2e6b32600329ebbaeb0b4b7a2f371eca2 (patch) (unidiff)
tree216d939631c0ebd8319c6e9564d5d4a69a1b06d2 /library/tzselect.cpp
parent7d8e7e3dba1a42864560c4b493e3f35f6bcb9660 (diff)
downloadopie-f8aeb3c2e6b32600329ebbaeb0b4b7a2f371eca2.zip
opie-f8aeb3c2e6b32600329ebbaeb0b4b7a2f371eca2.tar.gz
opie-f8aeb3c2e6b32600329ebbaeb0b4b7a2f371eca2.tar.bz2
opie uses citytime, not worldtime, and changed tz to more opie specific
Diffstat (limited to 'library/tzselect.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/tzselect.cpp125
1 files changed, 63 insertions, 62 deletions
diff --git a/library/tzselect.cpp b/library/tzselect.cpp
index 6cc0bea..e16b8d4 100644
--- a/library/tzselect.cpp
+++ b/library/tzselect.cpp
@@ -46,23 +46,23 @@ TZCombo::TZCombo( QWidget *p, const char* n )
46 // check to see if TZ is set, if it is set the current item to that 46 // check to see if TZ is set, if it is set the current item to that
47 QString tz = getenv("TZ"); 47 QString tz = getenv("TZ");
48 if (parent()->inherits("TimeZoneSelector")) { 48 if (parent()->inherits("TimeZoneSelector")) {
49 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 49 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
50 // overide to the 'local' type. 50 // overide to the 'local' type.
51 tz = "None"; 51 tz = "None";
52 } 52 }
53 } 53 }
54 if ( !tz.isNull() ) { 54 if ( !tz.isNull() ) {
55 int n = 0, 55 int n = 0,
56 index = 0; 56 index = 0;
57 for ( QStringList::Iterator it=identifiers.begin(); 57 for ( QStringList::Iterator it=identifiers.begin();
58 it!=identifiers.end(); ++it) { 58 it!=identifiers.end(); ++it) {
59 if ( *it == tz ) 59 if ( *it == tz )
60 index = n; 60 index = n;
61 n++; 61 n++;
62 } 62 }
63 setCurrentItem(index); 63 setCurrentItem(index);
64 } else { 64 } else {
65 setCurrentItem(0); 65 setCurrentItem(0);
66 } 66 }
67 67
68 68
@@ -72,7 +72,7 @@ TZCombo::TZCombo( QWidget *p, const char* n )
72#if !defined(QT_NO_COP) 72#if !defined(QT_NO_COP)
73 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 73 QCopChannel *channel = new QCopChannel( "QPE/System", this );
74 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 74 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
75 this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) ); 75 this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) );
76#endif 76#endif
77#endif 77#endif
78 78
@@ -95,59 +95,59 @@ void TZCombo::updateZones()
95 cfg.setGroup("TimeZones"); 95 cfg.setGroup("TimeZones");
96 int listIndex = 0; 96 int listIndex = 0;
97 if (parent()->inherits("TimeZoneSelector")) { 97 if (parent()->inherits("TimeZoneSelector")) {
98 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 98 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
99 // overide to the 'local' type. 99 // overide to the 'local' type.
100 identifiers.append( "None" ); 100 identifiers.append( "None" );
101 insertItem( tr("None") ); 101 insertItem( tr("None") );
102 if ( cur == tr("None")) 102 if ( cur == tr("None"))
103 curix = 0; 103 curix = 0;
104 listIndex++; 104 listIndex++;
105 } 105 }
106 } 106 }
107 int cfgIndex = 0; 107 int cfgIndex = 0;
108 while (1) { 108 while (1) {
109 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); 109 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null);
110 if ( zn.isNull() ) 110 if ( zn.isNull() )
111 break; 111 break;
112 if ( zn == tz ) 112 if ( zn == tz )
113 tzFound = TRUE; 113 tzFound = TRUE;
114 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); 114 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex));
115 identifiers.append(zn); 115 identifiers.append(zn);
116 insertItem(nm); 116 insertItem(nm);
117 if ( nm == cur ) 117 if ( nm == cur )
118 curix = listIndex; 118 curix = listIndex;
119 ++cfgIndex; 119 ++cfgIndex;
120 ++listIndex; 120 ++listIndex;
121 } 121 }
122 if ( !listIndex ) { 122 if ( !listIndex ) {
123 QStringList list = timezoneDefaults(); 123 QStringList list = timezoneDefaults();
124 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) { 124 for ( QStringList::Iterator it = list.begin(); it!=list.end(); ++it ) {
125 QString zn = *it; 125 QString zn = *it;
126 QString nm = *++it; 126 QString nm = *++it;
127 if ( zn == tz ) 127 if ( zn == tz )
128 tzFound = TRUE; 128 tzFound = TRUE;
129 if ( nm == cur ) 129 if ( nm == cur )
130 curix = listIndex; 130 curix = listIndex;
131 identifiers.append(zn); 131 identifiers.append(zn);
132 insertItem(nm); 132 insertItem(nm);
133 ++listIndex; 133 ++listIndex;
134 } 134 }
135 } 135 }
136 for (QStringList::Iterator it=extras.begin(); it!=extras.end(); ++it) { 136 for (QStringList::Iterator it=extras.begin(); it!=extras.end(); ++it) {
137 insertItem(*it); 137 insertItem(*it);
138 identifiers.append(*it); 138 identifiers.append(*it);
139 if ( *it == cur ) 139 if ( *it == cur )
140 curix = listIndex; 140 curix = listIndex;
141 ++listIndex; 141 ++listIndex;
142 } 142 }
143 if ( !tzFound && !tz.isEmpty()) { 143 if ( !tzFound && !tz.isEmpty()) {
144 int i = tz.find( '/' ); 144 int i = tz.find( '/' );
145 QString nm = tz.mid( i+1 ).replace(QRegExp("_"), " "); 145 QString nm = tz.mid( i+1 ).replace(QRegExp("_"), " ");
146 identifiers.append(tz); 146 identifiers.append(tz);
147 insertItem(nm); 147 insertItem(nm);
148 if ( nm == cur ) 148 if ( nm == cur )
149 curix = listIndex; 149 curix = listIndex;
150 ++listIndex; 150 ++listIndex;
151 } 151 }
152 setCurrentItem(curix); 152 setCurrentItem(curix);
153} 153}
@@ -175,10 +175,10 @@ QString TZCombo::currZone() const
175void TZCombo::setCurrZone( const QString& id ) 175void TZCombo::setCurrZone( const QString& id )
176{ 176{
177 for (int i=0; i< count(); i++) { 177 for (int i=0; i< count(); i++) {
178 if ( identifiers[i] == id ) { 178 if ( identifiers[i] == id ) {
179 setCurrentItem(i); 179 setCurrentItem(i);
180 return; 180 return;
181 } 181}
182 } 182 }
183 insertItem(id); 183 insertItem(id);
184 setCurrentItem( count() - 1); 184 setCurrentItem( count() - 1);
@@ -191,7 +191,7 @@ void TZCombo::setCurrZone( const QString& id )
191void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&) 191void TZCombo::handleSystemChannel(const QCString&msg, const QByteArray&)
192{ 192{
193 if ( msg == "timeZoneListChange()" ) { 193 if ( msg == "timeZoneListChange()" ) {
194 updateZones(); 194 updateZones();
195 } 195 }
196} 196}
197 197
@@ -249,7 +249,7 @@ void TimeZoneSelector::slotTzActive( int )
249void TimeZoneSelector::slotExecute( void ) 249void TimeZoneSelector::slotExecute( void )
250{ 250{
251 // execute the world time application... 251 // execute the world time application...
252 Global::execute( "worldtime" ); 252 Global::execute( "citytime" );
253} 253}
254 254
255QStringList timezoneDefaults( void ) 255QStringList timezoneDefaults( void )
@@ -262,12 +262,13 @@ QStringList timezoneDefaults( void )
262 tzs.append( "Los Angeles" ); 262 tzs.append( "Los Angeles" );
263 tzs.append( "Australia/Brisbane" ); 263 tzs.append( "Australia/Brisbane" );
264 tzs.append( "Brisbane" ); 264 tzs.append( "Brisbane" );
265 tzs.append( "Europe/Oslo" ); 265 tzs.append( "Europe/Berlin" );
266 tzs.append( "Oslo" ); 266 tzs.append( "Berlin" );
267 tzs.append( "Asia/Tokyo" ); 267 tzs.append( "Asia/Tokyo" );
268 tzs.append( "Tokyo" ); 268 tzs.append( "Tokyo" );
269 tzs.append( "Asia/Hong_Kong" ); 269 tzs.append( "America/Denver" );
270 tzs.append( "Hong Kong" ); 270 tzs.append( "Denver" );
271
271 return tzs; 272 return tzs;
272} 273}
273 274