summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/contact.h4
-rw-r--r--library/backend/timeconversion.cpp12
2 files changed, 8 insertions, 8 deletions
diff --git a/library/backend/contact.h b/library/backend/contact.h
index 2294986..4999430 100644
--- a/library/backend/contact.h
+++ b/library/backend/contact.h
@@ -158,106 +158,106 @@ public:
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 ); }
208private: 206private:
209 friend class AbEditor; 207 friend class AbEditor;
210 friend class AbTable; 208 friend class AbTable;
211 friend class AddressBookAccessPrivate; 209 friend class AddressBookAccessPrivate;
212 friend class XMLIO; 210 friend class XMLIO;
213 211
214 QString emailSeparator() const { return " "; } 212 QString emailSeparator() const { return " "; }
215 // the emails should be seperated by a comma 213 // 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
234inline void Contact::insertEmail( const QString &v ) 234inline 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
256inline void Contact::removeEmail( const QString &v ) 256inline 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
diff --git a/library/backend/timeconversion.cpp b/library/backend/timeconversion.cpp
index df7b0d5..6551697 100644
--- a/library/backend/timeconversion.cpp
+++ b/library/backend/timeconversion.cpp
@@ -1,92 +1,92 @@
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
26QString TimeConversion::toString( const QDate &d ) 26QString TimeConversion::toString( const QDate &d )
27{ 27{
28 QString empty; 28 // QString empty;
29 if ( d.isNull() ) 29 // if ( d.isNull() )
30 return empty; 30 // return empty;
31 31
32 QString r = QString::number( d.day() ) + "." + 32 QString r = QString::number( d.day() ) + "." +
33 QString::number( d.month() ) + "." + 33 QString::number( d.month() ) + "." +
34 QString::number( d.year() ); 34 QString::number( d.year() );
35 //qDebug("TimeConversion::toString %s", r.latin1()); 35 //qDebug("TimeConversion::toString %s", r.latin1());
36 36
37 return r; 37 return r;
38} 38}
39 39
40QDate TimeConversion::fromString( const QString &datestr ) 40QDate TimeConversion::fromString( const QString &datestr )
41{ 41{
42 QDate empty; 42// QDate empty;
43 if ( datestr.isEmpty() ) 43// if ( datestr.isEmpty() )
44 return empty; 44 // return empty;
45 45
46 int monthPos = datestr.find('.'); 46 int monthPos = datestr.find('.');
47 int yearPos = datestr.find('.', monthPos+1 ); 47 int yearPos = datestr.find('.', monthPos+1 );
48 if ( monthPos == -1 || yearPos == -1 ) { 48 if ( monthPos == -1 || yearPos == -1 ) {
49 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 );
50 return QDate(); 50 return QDate();
51 } 51 }
52 int d = datestr.left( monthPos ).toInt(); 52 int d = datestr.left( monthPos ).toInt();
53 int m = datestr.mid( monthPos+1, yearPos - monthPos - 1 ).toInt(); 53 int m = datestr.mid( monthPos+1, yearPos - monthPos - 1 ).toInt();
54 int y = datestr.mid( yearPos+1 ).toInt(); 54 int y = datestr.mid( yearPos+1 ).toInt();
55 QDate date ( y,m,d ); 55 QDate date ( y,m,d );
56 //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);
57 return date; 57 return date;
58} 58}
59 59
60time_t TimeConversion::toUTC( const QDateTime& dt ) 60time_t TimeConversion::toUTC( const QDateTime& dt )
61{ 61{
62 time_t tmp; 62 time_t tmp;
63 struct tm *lt; 63 struct tm *lt;
64 64
65#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)
66 _tzset(); 66 _tzset();
67#else 67#else
68 tzset(); 68 tzset();
69#endif 69#endif
70 70
71 // 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
72 tmp = time( 0 ); 72 tmp = time( 0 );
73 lt = localtime( &tmp ); 73 lt = localtime( &tmp );
74 74
75 lt->tm_sec = dt.time().second(); 75 lt->tm_sec = dt.time().second();
76 lt->tm_min = dt.time().minute(); 76 lt->tm_min = dt.time().minute();
77 lt->tm_hour = dt.time().hour(); 77 lt->tm_hour = dt.time().hour();
78 lt->tm_mday = dt.date().day(); 78 lt->tm_mday = dt.date().day();
79 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
80 lt->tm_year = dt.date().year() - 1900; // year - 1900 80 lt->tm_year = dt.date().year() - 1900; // year - 1900
81 //lt->tm_wday = dt.date().dayOfWeek(); ignored anyway 81 //lt->tm_wday = dt.date().dayOfWeek(); ignored anyway
82 //lt->tm_yday = dt.date().dayOfYear(); ignored anyway 82 //lt->tm_yday = dt.date().dayOfYear(); ignored anyway
83 lt->tm_wday = -1; 83 lt->tm_wday = -1;
84 lt->tm_yday = -1; 84 lt->tm_yday = -1;
85 // tm_isdst negative -> mktime will find out about DST 85 // tm_isdst negative -> mktime will find out about DST
86 lt->tm_isdst = -1; 86 lt->tm_isdst = -1;
87 // keep tm_zone and tm_gmtoff 87 // keep tm_zone and tm_gmtoff
88 tmp = mktime( lt ); 88 tmp = mktime( lt );
89 return tmp; 89 return tmp;
90} 90}
91 91
92QDateTime TimeConversion::fromUTC( time_t time ) 92QDateTime TimeConversion::fromUTC( time_t time )