author | eilers <eilers> | 2002-11-09 14:32:55 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-09 14:32:55 (UTC) |
commit | cb7218cf112f24976e6f6bbd6e683d38ba31b00b (patch) (unidiff) | |
tree | aa177870ab587c8401f283801db432ea5c452578 /library | |
parent | 98a73d0b6feca9105a0ce8bb57a1308f0317badb (diff) | |
download | opie-cb7218cf112f24976e6f6bbd6e683d38ba31b00b.zip opie-cb7218cf112f24976e6f6bbd6e683d38ba31b00b.tar.gz opie-cb7218cf112f24976e6f6bbd6e683d38ba31b00b.tar.bz2 |
added
-rw-r--r-- | library/backend/contact.h | 4 | ||||
-rw-r--r-- | library/backend/timeconversion.cpp | 15 | ||||
-rw-r--r-- | library/library.pro | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/library/backend/contact.h b/library/backend/contact.h index 4999430..2294986 100644 --- a/library/backend/contact.h +++ b/library/backend/contact.h | |||
@@ -1,306 +1,306 @@ | |||
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 __CONTACT_H__ | 21 | #ifndef __CONTACT_H__ |
22 | #define __CONTACT_H__ | 22 | #define __CONTACT_H__ |
23 | 23 | ||
24 | #include <qtopia/private/palmtoprecord.h> | 24 | #include <qtopia/private/palmtoprecord.h> |
25 | #include <qtopia/private/recordfields.h> | 25 | #include <qtopia/private/recordfields.h> |
26 | 26 | ||
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | 28 | ||
29 | #if defined(QPC_TEMPLATEDLL) | 29 | #if defined(QPC_TEMPLATEDLL) |
30 | // MOC_SKIP_BEGIN | 30 | // MOC_SKIP_BEGIN |
31 | QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; | 31 | QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; |
32 | // MOC_SKIP_END | 32 | // MOC_SKIP_END |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | class ContactPrivate; | 35 | class ContactPrivate; |
36 | class QPC_EXPORT Contact : public Qtopia::Record | 36 | class QPC_EXPORT Contact : public Qtopia::Record |
37 | { | 37 | { |
38 | friend class DataSet; | 38 | friend class DataSet; |
39 | public: | 39 | public: |
40 | Contact(); | 40 | Contact(); |
41 | Contact( const QMap<int, QString> &fromMap ); | 41 | Contact( const QMap<int, QString> &fromMap ); |
42 | virtual ~Contact(); | 42 | virtual ~Contact(); |
43 | 43 | ||
44 | static void writeVCard( const QString &filename, const QValueList<Contact> &contacts); | 44 | static void writeVCard( const QString &filename, const QValueList<Contact> &contacts); |
45 | static void writeVCard( const QString &filename, const Contact &c ); | 45 | static void writeVCard( const QString &filename, const Contact &c ); |
46 | static QValueList<Contact> readVCard( const QString &filename ); | 46 | static QValueList<Contact> readVCard( const QString &filename ); |
47 | 47 | ||
48 | enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE }; | 48 | enum journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE }; |
49 | 49 | ||
50 | void setTitle( const QString &v ) { replace( Qtopia::Title, v ); } | 50 | void setTitle( const QString &v ) { replace( Qtopia::Title, v ); } |
51 | void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); } | 51 | void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); } |
52 | void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); } | 52 | void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); } |
53 | void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); } | 53 | void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); } |
54 | void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); } | 54 | void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); } |
55 | void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); } | 55 | void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); } |
56 | void setFileAs(); | 56 | void setFileAs(); |
57 | 57 | ||
58 | // default email address | 58 | // default email address |
59 | void setDefaultEmail( const QString &v ); | 59 | void setDefaultEmail( const QString &v ); |
60 | // inserts email to list and ensure's doesn't already exist | 60 | // inserts email to list and ensure's doesn't already exist |
61 | void insertEmail( const QString &v ); | 61 | void insertEmail( const QString &v ); |
62 | void removeEmail( const QString &v ); | 62 | void removeEmail( const QString &v ); |
63 | void clearEmails(); | 63 | void clearEmails(); |
64 | void insertEmails( const QStringList &v ); | 64 | void insertEmails( const QStringList &v ); |
65 | 65 | ||
66 | // home | 66 | // home |
67 | void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); } | 67 | void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); } |
68 | void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); } | 68 | void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); } |
69 | void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); } | 69 | void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); } |
70 | void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); } | 70 | void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); } |
71 | void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); } | 71 | void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); } |
72 | void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); } | 72 | void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); } |
73 | void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); } | 73 | void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); } |
74 | void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); } | 74 | void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); } |
75 | void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); } | 75 | void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); } |
76 | 76 | ||
77 | // business | 77 | // business |
78 | void setCompany( const QString &v ) { replace( Qtopia::Company, v ); } | 78 | void setCompany( const QString &v ) { replace( Qtopia::Company, v ); } |
79 | void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); } | 79 | void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); } |
80 | void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); } | 80 | void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); } |
81 | void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); } | 81 | void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); } |
82 | void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); } | 82 | void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); } |
83 | void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); } | 83 | void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); } |
84 | void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); } | 84 | void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); } |
85 | void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); } | 85 | void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); } |
86 | void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); } | 86 | void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); } |
87 | void setOffice( const QString &v ) { replace( Qtopia::Office, v ); } | 87 | void setOffice( const QString &v ) { replace( Qtopia::Office, v ); } |
88 | void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); } | 88 | void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); } |
89 | void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); } | 89 | void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); } |
90 | void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); } | 90 | void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); } |
91 | void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); } | 91 | void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); } |
92 | void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); } | 92 | void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); } |
93 | void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); } | 93 | void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); } |
94 | void setManager( const QString &v ) { replace( Qtopia::Manager, v ); } | 94 | void setManager( const QString &v ) { replace( Qtopia::Manager, v ); } |
95 | 95 | ||
96 | // personal | 96 | // personal |
97 | void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); } | 97 | void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); } |
98 | void setGender( const QString &v ) { replace( Qtopia::Gender, v ); } | 98 | void setGender( const QString &v ) { replace( Qtopia::Gender, v ); } |
99 | void setBirthday( const QString &v ) { replace( Qtopia::Birthday, v ); } | 99 | void setBirthday( const QString &v ) { replace( Qtopia::Birthday, v ); } |
100 | void setAnniversary( const QString &v ) { replace( Qtopia::Anniversary, v ); } | 100 | void setAnniversary( const QString &v ) { replace( Qtopia::Anniversary, v ); } |
101 | void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } | 101 | void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } |
102 | void setChildren( const QString &v ); | 102 | void setChildren( const QString &v ); |
103 | 103 | ||
104 | // other | 104 | // other |
105 | void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } | 105 | void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } |
106 | 106 | ||
107 | bool match( const QString ®exp ) const; | 107 | bool match( const QString ®exp ) const; |
108 | 108 | ||
109 | // DON'T ATTEMPT TO USE THIS | 109 | // DON'T ATTEMPT TO USE THIS |
110 | #ifdef QTOPIA_INTERNAL_CONTACT_MRE | 110 | #ifdef QTOPIA_INTERNAL_CONTACT_MRE |
111 | bool match( const QRegExp ®exp ) const; | 111 | bool match( const QRegExp ®exp ) const; |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | // // custom | 114 | // // custom |
115 | // void setCustomField( const QString &key, const QString &v ) | 115 | // void setCustomField( const QString &key, const QString &v ) |
116 | // { replace(Custom- + key, v ); } | 116 | // { replace(Custom- + key, v ); } |
117 | 117 | ||
118 | // name | 118 | // name |
119 | QString fullName() const; | 119 | QString fullName() const; |
120 | QString title() const { return find( Qtopia::Title ); } | 120 | QString title() const { return find( Qtopia::Title ); } |
121 | QString firstName() const { return find( Qtopia::FirstName ); } | 121 | QString firstName() const { return find( Qtopia::FirstName ); } |
122 | QString middleName() const { return find( Qtopia::MiddleName ); } | 122 | QString middleName() const { return find( Qtopia::MiddleName ); } |
123 | QString lastName() const { return find( Qtopia::LastName ); } | 123 | QString lastName() const { return find( Qtopia::LastName ); } |
124 | QString suffix() const { return find( Qtopia::Suffix ); } | 124 | QString suffix() const { return find( Qtopia::Suffix ); } |
125 | QString fileAs() const { return find( Qtopia::FileAs ); } | 125 | QString fileAs() const { return find( Qtopia::FileAs ); } |
126 | 126 | ||
127 | 127 | ||
128 | QString defaultEmail() const { return find( Qtopia::DefaultEmail ); } | 128 | QString defaultEmail() const { return find( Qtopia::DefaultEmail ); } |
129 | QStringList emailList() const; | 129 | QStringList emailList() const; |
130 | 130 | ||
131 | // home | 131 | // home |
132 | QString homeStreet() const { return find( Qtopia::HomeStreet ); } | 132 | QString homeStreet() const { return find( Qtopia::HomeStreet ); } |
133 | QString homeCity() const { return find( Qtopia::HomeCity ); } | 133 | QString homeCity() const { return find( Qtopia::HomeCity ); } |
134 | QString homeState() const { return find( Qtopia::HomeState ); } | 134 | QString homeState() const { return find( Qtopia::HomeState ); } |
135 | QString homeZip() const { return find( Qtopia::HomeZip ); } | 135 | QString homeZip() const { return find( Qtopia::HomeZip ); } |
136 | QString homeCountry() const { return find( Qtopia::HomeCountry ); } | 136 | QString homeCountry() const { return find( Qtopia::HomeCountry ); } |
137 | QString homePhone() const { return find( Qtopia::HomePhone ); } | 137 | QString homePhone() const { return find( Qtopia::HomePhone ); } |
138 | QString homeFax() const { return find( Qtopia::HomeFax ); } | 138 | QString homeFax() const { return find( Qtopia::HomeFax ); } |
139 | QString homeMobile() const { return find( Qtopia::HomeMobile ); } | 139 | QString homeMobile() const { return find( Qtopia::HomeMobile ); } |
140 | QString homeWebpage() const { return find( Qtopia::HomeWebPage ); } | 140 | QString homeWebpage() const { return find( Qtopia::HomeWebPage ); } |
141 | /** Multi line string containing all non-empty address info in the form | 141 | /** Multi line string containing all non-empty address info in the form |
142 | * Street | 142 | * Street |
143 | * City, State Zip | 143 | * City, State Zip |
144 | * Country | 144 | * Country |
145 | */ | 145 | */ |
146 | QString displayHomeAddress() const; | 146 | QString displayHomeAddress() const; |
147 | 147 | ||
148 | // business | 148 | // business |
149 | QString company() const { return find( Qtopia::Company ); } | 149 | QString company() const { return find( Qtopia::Company ); } |
150 | QString businessStreet() const { return find( Qtopia::BusinessStreet ); } | 150 | QString businessStreet() const { return find( Qtopia::BusinessStreet ); } |
151 | QString businessCity() const { return find( Qtopia::BusinessCity ); } | 151 | QString businessCity() const { return find( Qtopia::BusinessCity ); } |
152 | QString businessState() const { return find( Qtopia::BusinessState ); } | 152 | QString businessState() const { return find( Qtopia::BusinessState ); } |
153 | QString businessZip() const { return find( Qtopia::BusinessZip ); } | 153 | QString businessZip() const { return find( Qtopia::BusinessZip ); } |
154 | QString businessCountry() const { return find( Qtopia::BusinessCountry ); } | 154 | QString businessCountry() const { return find( Qtopia::BusinessCountry ); } |
155 | QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); } | 155 | QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); } |
156 | QString jobTitle() const { return find( Qtopia::JobTitle ); } | 156 | QString jobTitle() const { return find( Qtopia::JobTitle ); } |
157 | QString department() const { return find( Qtopia::Department ); } | 157 | QString department() const { return find( Qtopia::Department ); } |
158 | QString office() const { return find( Qtopia::Office ); } | 158 | QString office() const { return find( Qtopia::Office ); } |
159 | QString businessPhone() const { return find( Qtopia::BusinessPhone ); } | 159 | QString businessPhone() const { return find( Qtopia::BusinessPhone ); } |
160 | QString businessFax() const { return find( Qtopia::BusinessFax ); } | 160 | QString businessFax() const { return find( Qtopia::BusinessFax ); } |
161 | QString businessMobile() const { return find( Qtopia::BusinessMobile ); } | 161 | QString businessMobile() const { return find( Qtopia::BusinessMobile ); } |
162 | QString businessPager() const { return find( Qtopia::BusinessPager ); } | 162 | QString businessPager() const { return find( Qtopia::BusinessPager ); } |
163 | QString profession() const { return find( Qtopia::Profession ); } | 163 | QString profession() const { return find( Qtopia::Profession ); } |
164 | QString assistant() const { return find( Qtopia::Assistant ); } | 164 | QString assistant() const { return find( Qtopia::Assistant ); } |
165 | QString manager() const { return find( Qtopia::Manager ); } | 165 | QString manager() const { return find( Qtopia::Manager ); } |
166 | /** Multi line string containing all non-empty address info in the form | 166 | /** Multi line string containing all non-empty address info in the form |
167 | * Street | 167 | * Street |
168 | * City, State Zip | 168 | * City, State Zip |
169 | * Country | 169 | * Country |
170 | */ | 170 | */ |
171 | QString displayBusinessAddress() const; | 171 | QString displayBusinessAddress() const; |
172 | 172 | ||
173 | //personal | 173 | //personal |
174 | QString spouse() const { return find( Qtopia::Spouse ); } | 174 | QString spouse() const { return find( Qtopia::Spouse ); } |
175 | QString gender() const { return find( Qtopia::Gender ); } | 175 | QString gender() const { return find( Qtopia::Gender ); } |
176 | QString birthday() const { return find( Qtopia::Birthday ); } | 176 | QString birthday() const { return find( Qtopia::Birthday ); } |
177 | QString anniversary() const { return find( Qtopia::Anniversary ); } | 177 | QString anniversary() const { return find( Qtopia::Anniversary ); } |
178 | QString nickname() const { return find( Qtopia::Nickname ); } | 178 | QString nickname() const { return find( Qtopia::Nickname ); } |
179 | QString children() const { return find( Qtopia::Children ); } | 179 | QString children() const { return find( Qtopia::Children ); } |
180 | QStringList childrenList() const; | 180 | QStringList childrenList() const; |
181 | 181 | ||
182 | // other | 182 | // other |
183 | QString notes() const { return find( Qtopia::Notes ); } | 183 | QString notes() const { return find( Qtopia::Notes ); } |
184 | QString groups() const { return find( Qtopia::Groups ); } | 184 | QString groups() const { return find( Qtopia::Groups ); } |
185 | QStringList groupList() const; | 185 | QStringList groupList() const; |
186 | 186 | ||
187 | // // custom | 187 | // // custom |
188 | // const QString &customField( const QString &key ) | 188 | // const QString &customField( const QString &key ) |
189 | // { return find( Custom- + key ); } | 189 | // { return find( Custom- + key ); } |
190 | 190 | ||
191 | static QStringList fields(); | 191 | static QStringList fields(); |
192 | static QStringList trfields(); | 192 | static QStringList trfields(); |
193 | 193 | ||
194 | QString toRichText() const; | 194 | QString toRichText() const; |
195 | QMap<int, QString> toMap() const; | 195 | QMap<int, QString> toMap() const; |
196 | QString field( int key ) const { return find( key ); } | 196 | QString field( int key ) const { return find( key ); } |
197 | 197 | ||
198 | 198 | ||
199 | // journaling... | 199 | // journaling... |
200 | void saveJournal( journal_action action, const QString &key = QString::null ); | 200 | void saveJournal( journal_action action, const QString &key = QString::null ); |
201 | void save( QString &buf ) const; | 201 | void save( QString &buf ) const; |
202 | 202 | ||
203 | void setUid( int i ) | 203 | void setUid( int i ) |
204 | { Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } | 204 | { Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } |
205 | 205 | ||
206 | void setEmails( const QString &v ); | ||
207 | QString emails() const { return find( Qtopia::Emails ); } | ||
206 | private: | 208 | private: |
207 | friend class AbEditor; | 209 | friend class AbEditor; |
208 | friend class AbTable; | 210 | friend class AbTable; |
209 | friend class AddressBookAccessPrivate; | 211 | friend class AddressBookAccessPrivate; |
210 | friend class XMLIO; | 212 | friend class XMLIO; |
211 | 213 | ||
212 | QString emailSeparator() const { return " "; } | 214 | QString emailSeparator() const { return " "; } |
213 | // the emails should be seperated by a comma | 215 | // the emails should be seperated by a comma |
214 | void setEmails( const QString &v ); | ||
215 | QString emails() const { return find( Qtopia::Emails ); } | ||
216 | 216 | ||
217 | void insert( int key, const QString &value ); | 217 | void insert( int key, const QString &value ); |
218 | void replace( int key, const QString &value ); | 218 | void replace( int key, const QString &value ); |
219 | QString find( int key ) const; | 219 | QString find( int key ) const; |
220 | 220 | ||
221 | QString displayAddress( const QString &street, | 221 | QString displayAddress( const QString &street, |
222 | const QString &city, | 222 | const QString &city, |
223 | const QString &state, | 223 | const QString &state, |
224 | const QString &zip, | 224 | const QString &zip, |
225 | const QString &country ) const; | 225 | const QString &country ) const; |
226 | 226 | ||
227 | Qtopia::UidGen &uidGen() { return sUidGen; } | 227 | Qtopia::UidGen &uidGen() { return sUidGen; } |
228 | static Qtopia::UidGen sUidGen; | 228 | static Qtopia::UidGen sUidGen; |
229 | QMap<int, QString> mMap; | 229 | QMap<int, QString> mMap; |
230 | ContactPrivate *d; | 230 | ContactPrivate *d; |
231 | }; | 231 | }; |
232 | 232 | ||
233 | // these methods are inlined to keep binary compatability with Qtopia 1.5 | 233 | // these methods are inlined to keep binary compatability with Qtopia 1.5 |
234 | inline void Contact::insertEmail( const QString &v ) | 234 | inline void Contact::insertEmail( const QString &v ) |
235 | { | 235 | { |
236 | //qDebug("insertEmail %s", v.latin1()); | 236 | //qDebug("insertEmail %s", v.latin1()); |
237 | QString e = v.simplifyWhiteSpace(); | 237 | QString e = v.simplifyWhiteSpace(); |
238 | QString def = defaultEmail(); | 238 | QString def = defaultEmail(); |
239 | 239 | ||
240 | // if no default, set it as the default email and don't insert | 240 | // if no default, set it as the default email and don't insert |
241 | if ( def.isEmpty() ) { | 241 | if ( def.isEmpty() ) { |
242 | setDefaultEmail( e ); // will insert into the list for us | 242 | setDefaultEmail( e ); // will insert into the list for us |
243 | return; | 243 | return; |
244 | } | 244 | } |
245 | 245 | ||
246 | // otherwise, insert assuming doesn't already exist | 246 | // otherwise, insert assuming doesn't already exist |
247 | QString emailsStr = find( Qtopia::Emails ); | 247 | QString emailsStr = find( Qtopia::Emails ); |
248 | if ( emailsStr.contains( e )) | 248 | if ( emailsStr.contains( e )) |
249 | return; | 249 | return; |
250 | if ( !emailsStr.isEmpty() ) | 250 | if ( !emailsStr.isEmpty() ) |
251 | emailsStr += emailSeparator(); | 251 | emailsStr += emailSeparator(); |
252 | emailsStr += e; | 252 | emailsStr += e; |
253 | replace( Qtopia::Emails, emailsStr ); | 253 | replace( Qtopia::Emails, emailsStr ); |
254 | } | 254 | } |
255 | 255 | ||
256 | inline void Contact::removeEmail( const QString &v ) | 256 | inline void Contact::removeEmail( const QString &v ) |
257 | { | 257 | { |
258 | QString e = v.simplifyWhiteSpace(); | 258 | QString e = v.simplifyWhiteSpace(); |
259 | QString def = defaultEmail(); | 259 | QString def = defaultEmail(); |
260 | QString emailsStr = find( Qtopia::Emails ); | 260 | QString emailsStr = find( Qtopia::Emails ); |
261 | QStringList emails = emailList(); | 261 | QStringList emails = emailList(); |
262 | 262 | ||
263 | // otherwise, must first contain it | 263 | // otherwise, must first contain it |
264 | if ( !emailsStr.contains( e ) ) | 264 | if ( !emailsStr.contains( e ) ) |
265 | return; | 265 | return; |
266 | 266 | ||
267 | // remove it | 267 | // remove it |
268 | //qDebug(" removing email from list %s", e.latin1()); | 268 | //qDebug(" removing email from list %s", e.latin1()); |
269 | emails.remove( e ); | 269 | emails.remove( e ); |
270 | // reset the string | 270 | // reset the string |
271 | emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator | 271 | emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator |
272 | replace( Qtopia::Emails, emailsStr ); | 272 | replace( Qtopia::Emails, emailsStr ); |
273 | 273 | ||
274 | // if default, then replace the default email with the first one | 274 | // if default, then replace the default email with the first one |
275 | if ( def == e ) { | 275 | if ( def == e ) { |
276 | //qDebug("removeEmail is default; setting new default"); | 276 | //qDebug("removeEmail is default; setting new default"); |
277 | if ( !emails.count() ) | 277 | if ( !emails.count() ) |
278 | clearEmails(); | 278 | clearEmails(); |
279 | else // setDefaultEmail will remove e from the list | 279 | else // setDefaultEmail will remove e from the list |
280 | setDefaultEmail( emails.first() ); | 280 | setDefaultEmail( emails.first() ); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | inline void Contact::clearEmails() | 283 | inline void Contact::clearEmails() |
284 | { | 284 | { |
285 | mMap.remove( Qtopia::DefaultEmail ); | 285 | mMap.remove( Qtopia::DefaultEmail ); |
286 | mMap.remove( Qtopia::Emails ); | 286 | mMap.remove( Qtopia::Emails ); |
287 | } | 287 | } |
288 | inline void Contact::setDefaultEmail( const QString &v ) | 288 | inline void Contact::setDefaultEmail( const QString &v ) |
289 | { | 289 | { |
290 | QString e = v.simplifyWhiteSpace(); | 290 | QString e = v.simplifyWhiteSpace(); |
291 | 291 | ||
292 | //qDebug("Contact::setDefaultEmail %s", e.latin1()); | 292 | //qDebug("Contact::setDefaultEmail %s", e.latin1()); |
293 | replace( Qtopia::DefaultEmail, e ); | 293 | replace( Qtopia::DefaultEmail, e ); |
294 | 294 | ||
295 | if ( !e.isEmpty() ) | 295 | if ( !e.isEmpty() ) |
296 | insertEmail( e ); | 296 | insertEmail( e ); |
297 | 297 | ||
298 | } | 298 | } |
299 | 299 | ||
300 | inline void Contact::insertEmails( const QStringList &v ) | 300 | inline void Contact::insertEmails( const QStringList &v ) |
301 | { | 301 | { |
302 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) | 302 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) |
303 | insertEmail( *it ); | 303 | insertEmail( *it ); |
304 | } | 304 | } |
305 | 305 | ||
306 | #endif | 306 | #endif |
diff --git a/library/backend/timeconversion.cpp b/library/backend/timeconversion.cpp index 3c25922..df7b0d5 100644 --- a/library/backend/timeconversion.cpp +++ b/library/backend/timeconversion.cpp | |||
@@ -1,238 +1,247 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 <qglobal.h> | 21 | #include <qglobal.h> |
22 | #include <qtopia/timeconversion.h> | 22 | #include <qtopia/timeconversion.h> |
23 | #include <qregexp.h> | 23 | #include <qregexp.h> |
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | 25 | ||
26 | QString TimeConversion::toString( const QDate &d ) | 26 | QString TimeConversion::toString( const QDate &d ) |
27 | { | 27 | { |
28 | QString r = QString::number( d.day() ) + "." + | 28 | QString empty; |
29 | if ( d.isNull() ) | ||
30 | return empty; | ||
31 | |||
32 | QString r = QString::number( d.day() ) + "." + | ||
29 | QString::number( d.month() ) + "." + | 33 | QString::number( d.month() ) + "." + |
30 | QString::number( d.year() ); | 34 | QString::number( d.year() ); |
31 | //qDebug("TimeConversion::toString %s", r.latin1()); | 35 | //qDebug("TimeConversion::toString %s", r.latin1()); |
32 | return r; | 36 | |
37 | return r; | ||
33 | } | 38 | } |
34 | 39 | ||
35 | QDate TimeConversion::fromString( const QString &datestr ) | 40 | QDate TimeConversion::fromString( const QString &datestr ) |
36 | { | 41 | { |
42 | QDate empty; | ||
43 | if ( datestr.isEmpty() ) | ||
44 | return empty; | ||
45 | |||
37 | int monthPos = datestr.find('.'); | 46 | int monthPos = datestr.find('.'); |
38 | int yearPos = datestr.find('.', monthPos+1 ); | 47 | int yearPos = datestr.find('.', monthPos+1 ); |
39 | if ( monthPos == -1 || yearPos == -1 ) { | 48 | if ( monthPos == -1 || yearPos == -1 ) { |
40 | qDebug("fromString didn't find . in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, yearPos ); | 49 | qDebug("fromString didn't find . in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, yearPos ); |
41 | return QDate(); | 50 | return QDate(); |
42 | } | 51 | } |
43 | int d = datestr.left( monthPos ).toInt(); | 52 | int d = datestr.left( monthPos ).toInt(); |
44 | int m = datestr.mid( monthPos+1, yearPos - monthPos - 1 ).toInt(); | 53 | int m = datestr.mid( monthPos+1, yearPos - monthPos - 1 ).toInt(); |
45 | int y = datestr.mid( yearPos+1 ).toInt(); | 54 | int y = datestr.mid( yearPos+1 ).toInt(); |
46 | QDate date ( y,m,d ); | 55 | QDate date ( y,m,d ); |
47 | //qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, yearPos); | 56 | //qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, yearPos); |
48 | return date; | 57 | return date; |
49 | } | 58 | } |
50 | 59 | ||
51 | time_t TimeConversion::toUTC( const QDateTime& dt ) | 60 | time_t TimeConversion::toUTC( const QDateTime& dt ) |
52 | { | 61 | { |
53 | time_t tmp; | 62 | time_t tmp; |
54 | struct tm *lt; | 63 | struct tm *lt; |
55 | 64 | ||
56 | #if defined(_OS_WIN32) || defined (Q_OS_WIN32) || defined (Q_OS_WIN64) | 65 | #if defined(_OS_WIN32) || defined (Q_OS_WIN32) || defined (Q_OS_WIN64) |
57 | _tzset(); | 66 | _tzset(); |
58 | #else | 67 | #else |
59 | tzset(); | 68 | tzset(); |
60 | #endif | 69 | #endif |
61 | 70 | ||
62 | // get a tm structure from the system to get the correct tz_name | 71 | // get a tm structure from the system to get the correct tz_name |
63 | tmp = time( 0 ); | 72 | tmp = time( 0 ); |
64 | lt = localtime( &tmp ); | 73 | lt = localtime( &tmp ); |
65 | 74 | ||
66 | lt->tm_sec = dt.time().second(); | 75 | lt->tm_sec = dt.time().second(); |
67 | lt->tm_min = dt.time().minute(); | 76 | lt->tm_min = dt.time().minute(); |
68 | lt->tm_hour = dt.time().hour(); | 77 | lt->tm_hour = dt.time().hour(); |
69 | lt->tm_mday = dt.date().day(); | 78 | lt->tm_mday = dt.date().day(); |
70 | lt->tm_mon = dt.date().month() - 1; // 0-11 instead of 1-12 | 79 | lt->tm_mon = dt.date().month() - 1; // 0-11 instead of 1-12 |
71 | lt->tm_year = dt.date().year() - 1900; // year - 1900 | 80 | lt->tm_year = dt.date().year() - 1900; // year - 1900 |
72 | //lt->tm_wday = dt.date().dayOfWeek(); ignored anyway | 81 | //lt->tm_wday = dt.date().dayOfWeek(); ignored anyway |
73 | //lt->tm_yday = dt.date().dayOfYear(); ignored anyway | 82 | //lt->tm_yday = dt.date().dayOfYear(); ignored anyway |
74 | lt->tm_wday = -1; | 83 | lt->tm_wday = -1; |
75 | lt->tm_yday = -1; | 84 | lt->tm_yday = -1; |
76 | // tm_isdst negative -> mktime will find out about DST | 85 | // tm_isdst negative -> mktime will find out about DST |
77 | lt->tm_isdst = -1; | 86 | lt->tm_isdst = -1; |
78 | // keep tm_zone and tm_gmtoff | 87 | // keep tm_zone and tm_gmtoff |
79 | tmp = mktime( lt ); | 88 | tmp = mktime( lt ); |
80 | return tmp; | 89 | return tmp; |
81 | } | 90 | } |
82 | 91 | ||
83 | QDateTime TimeConversion::fromUTC( time_t time ) | 92 | QDateTime TimeConversion::fromUTC( time_t time ) |
84 | { | 93 | { |
85 | struct tm *lt; | 94 | struct tm *lt; |
86 | 95 | ||
87 | #if defined(_OS_WIN32) || defined (Q_OS_WIN32) || defined (Q_OS_WIN64) | 96 | #if defined(_OS_WIN32) || defined (Q_OS_WIN32) || defined (Q_OS_WIN64) |
88 | _tzset(); | 97 | _tzset(); |
89 | #else | 98 | #else |
90 | tzset(); | 99 | tzset(); |
91 | #endif | 100 | #endif |
92 | lt = localtime( &time ); | 101 | lt = localtime( &time ); |
93 | QDateTime dt; | 102 | QDateTime dt; |
94 | dt.setDate( QDate( lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday ) ); | 103 | dt.setDate( QDate( lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday ) ); |
95 | dt.setTime( QTime( lt->tm_hour, lt->tm_min, lt->tm_sec ) ); | 104 | dt.setTime( QTime( lt->tm_hour, lt->tm_min, lt->tm_sec ) ); |
96 | return dt; | 105 | return dt; |
97 | } | 106 | } |
98 | 107 | ||
99 | 108 | ||
100 | int TimeConversion::secsTo( const QDateTime &from, const QDateTime &to ) | 109 | int TimeConversion::secsTo( const QDateTime &from, const QDateTime &to ) |
101 | { | 110 | { |
102 | return toUTC( to ) - toUTC( from ); | 111 | return toUTC( to ) - toUTC( from ); |
103 | } | 112 | } |
104 | 113 | ||
105 | QCString TimeConversion::toISO8601( const QDate &d ) | 114 | QCString TimeConversion::toISO8601( const QDate &d ) |
106 | { | 115 | { |
107 | time_t tmp = toUTC( d ); | 116 | time_t tmp = toUTC( d ); |
108 | struct tm *utc = gmtime( &tmp ); | 117 | struct tm *utc = gmtime( &tmp ); |
109 | 118 | ||
110 | QCString str; | 119 | QCString str; |
111 | str.sprintf("%04d%02d%02d", (utc->tm_year + 1900), utc->tm_mon+1, utc->tm_mday ); | 120 | str.sprintf("%04d%02d%02d", (utc->tm_year + 1900), utc->tm_mon+1, utc->tm_mday ); |
112 | return str; | 121 | return str; |
113 | } | 122 | } |
114 | 123 | ||
115 | QCString TimeConversion::toISO8601( const QDateTime &dt ) | 124 | QCString TimeConversion::toISO8601( const QDateTime &dt ) |
116 | { | 125 | { |
117 | time_t tmp = toUTC( dt ); | 126 | time_t tmp = toUTC( dt ); |
118 | struct tm *utc = gmtime( &tmp ); | 127 | struct tm *utc = gmtime( &tmp ); |
119 | 128 | ||
120 | QCString str; | 129 | QCString str; |
121 | str.sprintf("%04d%02d%02dT%02d%02d%02dZ", | 130 | str.sprintf("%04d%02d%02dT%02d%02d%02dZ", |
122 | (utc->tm_year + 1900), utc->tm_mon+1, utc->tm_mday, | 131 | (utc->tm_year + 1900), utc->tm_mon+1, utc->tm_mday, |
123 | utc->tm_hour, utc->tm_min, utc->tm_sec ); | 132 | utc->tm_hour, utc->tm_min, utc->tm_sec ); |
124 | return str; | 133 | return str; |
125 | } | 134 | } |
126 | 135 | ||
127 | QDateTime TimeConversion::fromISO8601( const QCString &s ) | 136 | QDateTime TimeConversion::fromISO8601( const QCString &s ) |
128 | { | 137 | { |
129 | 138 | ||
130 | #if defined(_OS_WIN32) || defined (Q_OS_WIN32) || defined (Q_OS_WIN64) | 139 | #if defined(_OS_WIN32) || defined (Q_OS_WIN32) || defined (Q_OS_WIN64) |
131 | _tzset(); | 140 | _tzset(); |
132 | #else | 141 | #else |
133 | tzset(); | 142 | tzset(); |
134 | #endif | 143 | #endif |
135 | 144 | ||
136 | struct tm thetime; | 145 | struct tm thetime; |
137 | 146 | ||
138 | QCString str = s.copy(); | 147 | QCString str = s.copy(); |
139 | str.replace(QRegExp("-"), "" ); | 148 | str.replace(QRegExp("-"), "" ); |
140 | str.replace(QRegExp(":"), "" ); | 149 | str.replace(QRegExp(":"), "" ); |
141 | str.stripWhiteSpace(); | 150 | str.stripWhiteSpace(); |
142 | str = str.lower(); | 151 | str = str.lower(); |
143 | 152 | ||
144 | int i = str.find( "t" ); | 153 | int i = str.find( "t" ); |
145 | QCString date; | 154 | QCString date; |
146 | QCString timestr; | 155 | QCString timestr; |
147 | if ( i != -1 ) { | 156 | if ( i != -1 ) { |
148 | date = str.left( i ); | 157 | date = str.left( i ); |
149 | timestr = str.mid( i+1 ); | 158 | timestr = str.mid( i+1 ); |
150 | } else { | 159 | } else { |
151 | date = str; | 160 | date = str; |
152 | } | 161 | } |
153 | 162 | ||
154 | // qDebug("--- parsing ISO time---"); | 163 | // qDebug("--- parsing ISO time---"); |
155 | memset( &thetime, 0, sizeof(tm) ); | 164 | memset( &thetime, 0, sizeof(tm) ); |
156 | thetime.tm_year = 100; | 165 | thetime.tm_year = 100; |
157 | thetime.tm_mon = 0; | 166 | thetime.tm_mon = 0; |
158 | thetime.tm_mday = 0; | 167 | thetime.tm_mday = 0; |
159 | thetime.tm_hour = 0; | 168 | thetime.tm_hour = 0; |
160 | thetime.tm_min = 0; | 169 | thetime.tm_min = 0; |
161 | thetime.tm_sec = 0; | 170 | thetime.tm_sec = 0; |
162 | 171 | ||
163 | // qDebug("date = %s", date.data() ); | 172 | // qDebug("date = %s", date.data() ); |
164 | 173 | ||
165 | switch( date.length() ) { | 174 | switch( date.length() ) { |
166 | case 8: | 175 | case 8: |
167 | thetime.tm_mday = date.right( 2 ).toInt(); | 176 | thetime.tm_mday = date.right( 2 ).toInt(); |
168 | case 6: | 177 | case 6: |
169 | thetime.tm_mon = date.mid( 4, 2 ).toInt() - 1; | 178 | thetime.tm_mon = date.mid( 4, 2 ).toInt() - 1; |
170 | case 4: | 179 | case 4: |
171 | thetime.tm_year = date.left( 4 ).toInt(); | 180 | thetime.tm_year = date.left( 4 ).toInt(); |
172 | thetime.tm_year -= 1900; | 181 | thetime.tm_year -= 1900; |
173 | break; | 182 | break; |
174 | default: | 183 | default: |
175 | break; | 184 | break; |
176 | } | 185 | } |
177 | 186 | ||
178 | int tzoff = 0; | 187 | int tzoff = 0; |
179 | bool inLocalTime = FALSE; | 188 | bool inLocalTime = FALSE; |
180 | if ( timestr.find( 'z' ) == (int)timestr.length() - 1 ) | 189 | if ( timestr.find( 'z' ) == (int)timestr.length() - 1 ) |
181 | // UTC | 190 | // UTC |
182 | timestr = timestr.left( timestr.length() -1 ); | 191 | timestr = timestr.left( timestr.length() -1 ); |
183 | else { | 192 | else { |
184 | int plus = timestr.find( "+" ); | 193 | int plus = timestr.find( "+" ); |
185 | int minus = timestr.find( "-" ); | 194 | int minus = timestr.find( "-" ); |
186 | if ( plus != -1 || minus != -1 ) { | 195 | if ( plus != -1 || minus != -1 ) { |
187 | // have a timezone offset | 196 | // have a timezone offset |
188 | plus = (plus != -1) ? plus : minus; | 197 | plus = (plus != -1) ? plus : minus; |
189 | QCString off = timestr.mid( plus ); | 198 | QCString off = timestr.mid( plus ); |
190 | timestr = timestr.left( plus ); | 199 | timestr = timestr.left( plus ); |
191 | 200 | ||
192 | int tzoffhour = 0; | 201 | int tzoffhour = 0; |
193 | int tzoffmin = 0; | 202 | int tzoffmin = 0; |
194 | switch( off.length() ) { | 203 | switch( off.length() ) { |
195 | case 5: | 204 | case 5: |
196 | tzoffmin = off.mid(3).toInt(); | 205 | tzoffmin = off.mid(3).toInt(); |
197 | case 3: | 206 | case 3: |
198 | tzoffhour = off.left(3).toInt(); | 207 | tzoffhour = off.left(3).toInt(); |
199 | default: | 208 | default: |
200 | break; | 209 | break; |
201 | } | 210 | } |
202 | tzoff = 60*tzoffhour + tzoffmin; | 211 | tzoff = 60*tzoffhour + tzoffmin; |
203 | } else | 212 | } else |
204 | inLocalTime = TRUE; | 213 | inLocalTime = TRUE; |
205 | } | 214 | } |
206 | 215 | ||
207 | // get the time: | 216 | // get the time: |
208 | switch( timestr.length() ) { | 217 | switch( timestr.length() ) { |
209 | case 6: | 218 | case 6: |
210 | thetime.tm_sec = timestr.mid( 4 ).toInt(); | 219 | thetime.tm_sec = timestr.mid( 4 ).toInt(); |
211 | case 4: | 220 | case 4: |
212 | thetime.tm_min = timestr.mid( 2, 2 ).toInt(); | 221 | thetime.tm_min = timestr.mid( 2, 2 ).toInt(); |
213 | case 2: | 222 | case 2: |
214 | thetime.tm_hour = timestr.left( 2 ).toInt(); | 223 | thetime.tm_hour = timestr.left( 2 ).toInt(); |
215 | default: | 224 | default: |
216 | break; | 225 | break; |
217 | } | 226 | } |
218 | 227 | ||
219 | int tzloc = 0; | 228 | int tzloc = 0; |
220 | time_t tmp = time( 0 ); | 229 | time_t tmp = time( 0 ); |
221 | if ( !inLocalTime ) { | 230 | if ( !inLocalTime ) { |
222 | // have to get the offset between gmt and local time | 231 | // have to get the offset between gmt and local time |
223 | struct tm *lt = localtime( &tmp ); | 232 | struct tm *lt = localtime( &tmp ); |
224 | tzloc = mktime( lt ); | 233 | tzloc = mktime( lt ); |
225 | struct tm *ut = gmtime( &tmp ); | 234 | struct tm *ut = gmtime( &tmp ); |
226 | tzloc -= mktime( ut ); | 235 | tzloc -= mktime( ut ); |
227 | } | 236 | } |
228 | // qDebug("time: %d %d %d, tzloc=%d, tzoff=%d", thetime->tm_hour, thetime->tm_min, thetime->tm_sec, | 237 | // qDebug("time: %d %d %d, tzloc=%d, tzoff=%d", thetime->tm_hour, thetime->tm_min, thetime->tm_sec, |
229 | // tzloc, tzoff ); | 238 | // tzloc, tzoff ); |
230 | 239 | ||
231 | tmp = mktime( &thetime ); | 240 | tmp = mktime( &thetime ); |
232 | tmp += 60*(-tzloc + tzoff); | 241 | tmp += 60*(-tzloc + tzoff); |
233 | 242 | ||
234 | 243 | ||
235 | 244 | ||
236 | return fromUTC( tmp ); | 245 | return fromUTC( tmp ); |
237 | } | 246 | } |
238 | 247 | ||
diff --git a/library/library.pro b/library/library.pro index fba98f8..142c609 100644 --- a/library/library.pro +++ b/library/library.pro | |||
@@ -1,141 +1,143 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS= calendar.h \ | 3 | HEADERS= calendar.h \ |
4 | global.h \ | 4 | global.h \ |
5 | resource.h \ | 5 | resource.h \ |
6 | xmlreader.h \ | 6 | xmlreader.h \ |
7 | mimetype.h \ | 7 | mimetype.h \ |
8 | menubutton.h \ | 8 | menubutton.h \ |
9 | network.h \ | 9 | network.h \ |
10 | networkinterface.h \ | 10 | networkinterface.h \ |
11 | filemanager.h \ | 11 | filemanager.h \ |
12 | fontmanager.h \ | 12 | fontmanager.h \ |
13 | qdawg.h \ | 13 | qdawg.h \ |
14 | datebookmonth.h \ | 14 | datebookmonth.h \ |
15 | fileselector.h \ | 15 | fileselector.h \ |
16 | fileselector_p.h \ | 16 | fileselector_p.h \ |
17 | imageedit.h \ | 17 | imageedit.h \ |
18 | qcopenvelope_qws.h \ | 18 | qcopenvelope_qws.h \ |
19 | qpedecoration_qws.h \ | 19 | qpedecoration_qws.h \ |
20 | qpeapplication.h \ | 20 | qpeapplication.h \ |
21 | qpestyle.h \ | 21 | qpestyle.h \ |
22 | qpedialog.h \ | 22 | qpedialog.h \ |
23 | lightstyle.h \ | 23 | lightstyle.h \ |
24 | config.h \ | 24 | config.h \ |
25 | applnk.h \ | 25 | applnk.h \ |
26 | sound.h \ | 26 | sound.h \ |
27 | tzselect.h \ | 27 | tzselect.h \ |
28 | qmath.h \ | 28 | qmath.h \ |
29 | datebookdb.h \ | 29 | datebookdb.h \ |
30 | alarmserver.h \ | 30 | alarmserver.h \ |
31 | process.h \ | 31 | process.h \ |
32 | password.h \ | 32 | password.h \ |
33 | timestring.h \ | 33 | timestring.h \ |
34 | fontfactoryinterface.h \ | 34 | fontfactoryinterface.h \ |
35 | fontdatabase.h \ | 35 | fontdatabase.h \ |
36 | power.h \ | 36 | power.h \ |
37 | storage.h \ | 37 | storage.h \ |
38 | qpemessagebox.h \ | 38 | qpemessagebox.h \ |
39 | timeconversion.h \ | 39 | timeconversion.h \ |
40 | qpedebug.h \ | 40 | qpedebug.h \ |
41 | qpemenubar.h \ | 41 | qpemenubar.h \ |
42 | qpetoolbar.h \ | 42 | qpetoolbar.h \ |
43 | backend/categories.h \ | 43 | backend/categories.h \ |
44 | stringutil.h \ | 44 | stringutil.h \ |
45 | backend/palmtoprecord.h \ | 45 | backend/palmtoprecord.h \ |
46 | backend/task.h \ | 46 | backend/task.h \ |
47 | backend/event.h \ | 47 | backend/event.h \ |
48 | backend/contact.h\ | 48 | backend/contact.h\ |
49 | categorymenu.h \ | 49 | categorymenu.h \ |
50 | categoryedit_p.h \ | 50 | categoryedit_p.h \ |
51 | categoryselect.h \ | 51 | categoryselect.h \ |
52 | categorywidget.h \ | 52 | categorywidget.h \ |
53 | ir.h \ | 53 | ir.h \ |
54 | backend/vobject_p.h \ | 54 | backend/vobject_p.h \ |
55 | findwidget_p.h \ | 55 | findwidget_p.h \ |
56 | finddialog.h \ | 56 | finddialog.h \ |
57 | lnkproperties.h \ | 57 | lnkproperties.h \ |
58 | windowdecorationinterface.h \ | 58 | windowdecorationinterface.h \ |
59 | textcodecinterface.h \ | 59 | textcodecinterface.h \ |
60 | imagecodecinterface.h | 60 | imagecodecinterface.h |
61 | SOURCES= calendar.cpp \ | 61 | SOURCES= calendar.cpp \ |
62 | global.cpp \ | 62 | global.cpp \ |
63 | xmlreader.cpp \ | 63 | xmlreader.cpp \ |
64 | mimetype.cpp \ | 64 | mimetype.cpp \ |
65 | menubutton.cpp \ | 65 | menubutton.cpp \ |
66 | network.cpp \ | 66 | network.cpp \ |
67 | networkinterface.cpp \ | 67 | networkinterface.cpp \ |
68 | filemanager.cpp \ | 68 | filemanager.cpp \ |
69 | fontmanager.cpp \ | 69 | fontmanager.cpp \ |
70 | qdawg.cpp \ | 70 | qdawg.cpp \ |
71 | datebookmonth.cpp \ | 71 | datebookmonth.cpp \ |
72 | fileselector.cpp \ | 72 | fileselector.cpp \ |
73 | imageedit.cpp \ | 73 | imageedit.cpp \ |
74 | resource.cpp \ | 74 | resource.cpp \ |
75 | qpedecoration_qws.cpp \ | 75 | qpedecoration_qws.cpp \ |
76 | qcopenvelope_qws.cpp \ | 76 | qcopenvelope_qws.cpp \ |
77 | qpeapplication.cpp \ | 77 | qpeapplication.cpp \ |
78 | qpestyle.cpp \ | 78 | qpestyle.cpp \ |
79 | qpedialog.cpp \ | 79 | qpedialog.cpp \ |
80 | lightstyle.cpp \ | 80 | lightstyle.cpp \ |
81 | config.cpp \ | 81 | config.cpp \ |
82 | applnk.cpp \ | 82 | applnk.cpp \ |
83 | sound.cpp \ | 83 | sound.cpp \ |
84 | tzselect.cpp \ | 84 | tzselect.cpp \ |
85 | qmath.c \ | 85 | qmath.c \ |
86 | datebookdb.cpp \ | 86 | datebookdb.cpp \ |
87 | alarmserver.cpp \ | 87 | alarmserver.cpp \ |
88 | password.cpp \ | 88 | password.cpp \ |
89 | process.cpp \ | 89 | process.cpp \ |
90 | process_unix.cpp \ | 90 | process_unix.cpp \ |
91 | timestring.cpp \ | 91 | timestring.cpp \ |
92 | fontdatabase.cpp \ | 92 | fontdatabase.cpp \ |
93 | power.cpp \ | 93 | power.cpp \ |
94 | storage.cpp \ | 94 | storage.cpp \ |
95 | qpemessagebox.cpp \ | 95 | qpemessagebox.cpp \ |
96 | backend/timeconversion.cpp \ | 96 | backend/timeconversion.cpp \ |
97 | qpedebug.cpp \ | 97 | qpedebug.cpp \ |
98 | qpemenubar.cpp \ | 98 | qpemenubar.cpp \ |
99 | qpetoolbar.cpp \ | 99 | qpetoolbar.cpp \ |
100 | backend/categories.cpp \ | 100 | backend/categories.cpp \ |
101 | backend/stringutil.cpp \ | 101 | backend/stringutil.cpp \ |
102 | backend/palmtoprecord.cpp \ | 102 | backend/palmtoprecord.cpp \ |
103 | backend/task.cpp \ | 103 | backend/task.cpp \ |
104 | backend/event.cpp \ | 104 | backend/event.cpp \ |
105 | backend/contact.cpp \ | 105 | backend/contact.cpp \ |
106 | categorymenu.cpp \ | 106 | categorymenu.cpp \ |
107 | categoryedit_p.cpp \ | 107 | categoryedit_p.cpp \ |
108 | categoryselect.cpp \ | 108 | categoryselect.cpp \ |
109 | categorywidget.cpp \ | 109 | categorywidget.cpp \ |
110 | ir.cpp \ | 110 | ir.cpp \ |
111 | backend/vcc_yacc.cpp \ | 111 | backend/vcc_yacc.cpp \ |
112 | backend/vobject.cpp \ | 112 | backend/vobject.cpp \ |
113 | findwidget_p.cpp \ | 113 | findwidget_p.cpp \ |
114 | finddialog.cpp \ | 114 | finddialog.cpp \ |
115 | lnkproperties.cpp | 115 | lnkproperties.cpp |
116 | # QPE crashes on my Notebook if it tries to play sound | ||
117 | DEFINES = QT_NO_SOUND | ||
116 | # Qt 3 compatibility | 118 | # Qt 3 compatibility |
117 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h | 119 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h |
118 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp | 120 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp |
119 | INCLUDEPATH += $(OPIEDIR)/include backend | 121 | INCLUDEPATH += $(OPIEDIR)/include backend |
120 | LIBS += -ldl -lcrypt -lm | 122 | LIBS += -ldl -lcrypt -lm |
121 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui | 123 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui |
122 | TARGET = qpe | 124 | TARGET = qpe |
123 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 125 | DESTDIR = $(QTDIR)/lib$(PROJMAK) |
124 | # This is set by configure$(OPIEDIR). | 126 | # This is set by configure$(OPIEDIR). |
125 | VERSION = 1.5.0.1 | 127 | VERSION = 1.5.0.1 |
126 | 128 | ||
127 | TRANSLATIONS = ../i18n/de/libqpe.ts \ | 129 | TRANSLATIONS = ../i18n/de/libqpe.ts \ |
128 | ../i18n/en/libqpe.ts \ | 130 | ../i18n/en/libqpe.ts \ |
129 | ../i18n/es/libqpe.ts \ | 131 | ../i18n/es/libqpe.ts \ |
130 | ../i18n/fr/libqpe.ts \ | 132 | ../i18n/fr/libqpe.ts \ |
131 | ../i18n/hu/libqpe.ts \ | 133 | ../i18n/hu/libqpe.ts \ |
132 | ../i18n/ja/libqpe.ts \ | 134 | ../i18n/ja/libqpe.ts \ |
133 | ../i18n/ko/libqpe.ts \ | 135 | ../i18n/ko/libqpe.ts \ |
134 | ../i18n/no/libqpe.ts \ | 136 | ../i18n/no/libqpe.ts \ |
135 | ../i18n/pl/libqpe.ts \ | 137 | ../i18n/pl/libqpe.ts \ |
136 | ../i18n/pt/libqpe.ts \ | 138 | ../i18n/pt/libqpe.ts \ |
137 | ../i18n/pt_BR/libqpe.ts \ | 139 | ../i18n/pt_BR/libqpe.ts \ |
138 | ../i18n/sl/libqpe.ts \ | 140 | ../i18n/sl/libqpe.ts \ |
139 | ../i18n/zh_CN/libqpe.ts \ | 141 | ../i18n/zh_CN/libqpe.ts \ |
140 | ../i18n/it/libqpe.ts \ | 142 | ../i18n/it/libqpe.ts \ |
141 | ../i18n/zh_TW/libqpe.ts | 143 | ../i18n/zh_TW/libqpe.ts |