summaryrefslogtreecommitdiff
path: root/library/tzselect.cpp
Unidiff
Diffstat (limited to 'library/tzselect.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/tzselect.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/library/tzselect.cpp b/library/tzselect.cpp
index 4343eab..f28100b 100644
--- a/library/tzselect.cpp
+++ b/library/tzselect.cpp
@@ -1,121 +1,120 @@
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 "global.h"
26#include "config.h" 25#include "config.h"
27#include <qtoolbutton.h> 26#include <qtoolbutton.h>
28#include <qfile.h> 27#include <qfile.h>
29#include <stdlib.h> 28#include <stdlib.h>
30 29
31#include <qcopchannel_qws.h> 30#include <qcopchannel_qws.h>
32#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
33#include <qmessagebox.h> 32#include <qmessagebox.h>
34 33
35/*! 34/*!
36 \class TimeZoneSelector 35 \class TimeZoneSelector
37 36
38 \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.
39 38
40 \ingroup qtopiaemb 39 \ingroup qtopiaemb
41*/ 40*/
42 41
43class TimeZoneSelectorPrivate 42class TimeZoneSelectorPrivate
44{ 43{
45public: 44public:
46 TimeZoneSelectorPrivate() : includeLocal(FALSE) {} 45 TimeZoneSelectorPrivate() : includeLocal(FALSE) {}
47 bool includeLocal; 46 bool includeLocal;
48}; 47};
49 48
50TZCombo::TZCombo( QWidget *p, const char* n ) 49TZCombo::TZCombo( QWidget *p, const char* n )
51 : QComboBox( p, n ) 50 : QComboBox( p, n )
52{ 51{
53 updateZones(); 52 updateZones();
54 // 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
55 QString tz = getenv("TZ"); 54 QString tz = getenv("TZ");
56 if (parent()->inherits("TimeZoneSelector")) { 55 if (parent()->inherits("TimeZoneSelector")) {
57 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 56 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
58 // overide to the 'local' type. 57 // overide to the 'local' type.
59 tz = "None"; 58 tz = "None";
60 } 59 }
61 } 60 }
62 if ( !tz.isNull() ) { 61 if ( !tz.isNull() ) {
63 int n = 0, 62 int n = 0,
64 index = 0; 63 index = 0;
65 for ( QStringList::Iterator it=identifiers.begin(); 64 for ( QStringList::Iterator it=identifiers.begin();
66 it!=identifiers.end(); ++it) { 65 it!=identifiers.end(); ++it) {
67 if ( *it == tz ) 66 if ( *it == tz )
68 index = n; 67 index = n;
69 n++; 68 n++;
70 } 69 }
71 setCurrentItem(index); 70 setCurrentItem(index);
72 } else { 71 } else {
73 setCurrentItem(0); 72 setCurrentItem(0);
74 } 73 }
75 74
76 75
77 76
78 // listen on QPE/System 77 // listen on QPE/System
79#if !defined(QT_NO_COP) 78#if !defined(QT_NO_COP)
80 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 79 QCopChannel *channel = new QCopChannel( "QPE/System", this );
81 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 80 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
82 this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) ); 81 this, SLOT(handleSystemChannel(const QCString&, const QByteArray&)) );
83#endif 82#endif
84 83
85 84
86} 85}
87 86
88TZCombo::~TZCombo() 87TZCombo::~TZCombo()
89{ 88{
90} 89}
91 90
92void TZCombo::updateZones() 91void TZCombo::updateZones()
93{ 92{
94 QString cur = currentText(); 93 QString cur = currentText();
95 clear(); 94 clear();
96 identifiers.clear(); 95 identifiers.clear();
97 int curix=0; 96 int curix=0;
98 QString tz = getenv("TZ"); 97 QString tz = getenv("TZ");
99 bool tzFound = FALSE; 98 bool tzFound = FALSE;
100 Config cfg("CityTime"); 99 Config cfg("CityTime");
101 cfg.setGroup("TimeZones"); 100 cfg.setGroup("TimeZones");
102 int listIndex = 0; 101 int listIndex = 0;
103 if (parent()->inherits("TimeZoneSelector")) { 102 if (parent()->inherits("TimeZoneSelector")) {
104 if ( ((TimeZoneSelector *)parent())->localIncluded() ) { 103 if ( ((TimeZoneSelector *)parent())->localIncluded() ) {
105 // overide to the 'local' type. 104 // overide to the 'local' type.
106 identifiers.append( "None" ); 105 identifiers.append( "None" );
107 insertItem( tr("None") ); 106 insertItem( tr("None") );
108 if ( cur == tr("None")) 107 if ( cur == tr("None"))
109 curix = 0; 108 curix = 0;
110 listIndex++; 109 listIndex++;
111 } 110 }
112 } 111 }
113 int cfgIndex = 0; 112 int cfgIndex = 0;
114 while (1) { 113 while (1) {
115 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null); 114 QString zn = cfg.readEntry("Zone"+QString::number(cfgIndex), QString::null);
116 if ( zn.isNull() ) 115 if ( zn.isNull() )
117 break; 116 break;
118 if ( zn == tz ) 117 if ( zn == tz )
119 tzFound = TRUE; 118 tzFound = TRUE;
120 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex)); 119 QString nm = cfg.readEntry("ZoneName"+QString::number(cfgIndex));
121 identifiers.append(zn); 120 identifiers.append(zn);