summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/libopie.pro2
-rw-r--r--libopie/pim/ocontact.cpp14
-rw-r--r--libopie/pim/ocontact.h4
-rw-r--r--libopie/pim/oconversion.cpp76
-rw-r--r--libopie/pim/oconversion.h36
-rw-r--r--libopie2/opiepim/core/oconversion.cpp76
-rw-r--r--libopie2/opiepim/core/oconversion.h36
-rw-r--r--libopie2/opiepim/ocontact.cpp14
-rw-r--r--libopie2/opiepim/ocontact.h4
9 files changed, 240 insertions, 22 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index 5550c20..c0ccdf2 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -1,121 +1,123 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3HEADERS = ofontmenu.h \ 3HEADERS = ofontmenu.h \
4 ocolorbutton.h \ 4 ocolorbutton.h \
5 ofiledialog.h ofileselector.h \ 5 ofiledialog.h ofileselector.h \
6 ocheckitem.h \ 6 ocheckitem.h \
7 xmltree.h \ 7 xmltree.h \
8 colordialog.h colorpopupmenu.h \ 8 colordialog.h colorpopupmenu.h \
9 oclickablelabel.h oprocctrl.h \ 9 oclickablelabel.h oprocctrl.h \
10 oprocess.h odevice.h odevicebutton.h \ 10 oprocess.h odevice.h odevicebutton.h \
11 otimepicker.h otabwidget.h \ 11 otimepicker.h otabwidget.h \
12 otabbar.h otabinfo.h \ 12 otabbar.h otabinfo.h \
13 ofontselector.h \ 13 ofontselector.h \
14 pim/opimrecord.h \ 14 pim/opimrecord.h \
15 pim/otodo.h \ 15 pim/otodo.h \
16 pim/orecordlist.h \ 16 pim/orecordlist.h \
17 pim/opimaccesstemplate.h \ 17 pim/opimaccesstemplate.h \
18 pim/opimaccessbackend.h \ 18 pim/opimaccessbackend.h \
19 pim/otodoaccess.h \ 19 pim/otodoaccess.h \
20 pim/otodoaccessbackend.h \ 20 pim/otodoaccessbackend.h \
21 pim/oconversion.h \
21 pim/ocontact.h \ 22 pim/ocontact.h \
22 pim/ocontactaccess.h \ 23 pim/ocontactaccess.h \
23 pim/ocontactaccessbackend.h \ 24 pim/ocontactaccessbackend.h \
24 pim/ocontactaccessbackend_xml.h \ 25 pim/ocontactaccessbackend_xml.h \
25 pim/ocontactaccessbackend_vcard.h \ 26 pim/ocontactaccessbackend_vcard.h \
26 pim/obackendfactory.h \ 27 pim/obackendfactory.h \
27 pim/opimcache.h \ 28 pim/opimcache.h \
28 pim/otodoaccessvcal.h \ 29 pim/otodoaccessvcal.h \
29 pim/orecur.h \ 30 pim/orecur.h \
30 pim/opimstate.h \ 31 pim/opimstate.h \
31 pim/opimxrefpartner.h \ 32 pim/opimxrefpartner.h \
32 pim/opimxref.h \ 33 pim/opimxref.h \
33 pim/opimxrefmanager.h \ 34 pim/opimxrefmanager.h \
34 pim/opimmaintainer.h \ 35 pim/opimmaintainer.h \
35 pim/opimnotify.h \ 36 pim/opimnotify.h \
36 pim/opimnotifymanager.h \ 37 pim/opimnotifymanager.h \
37 pim/opimmainwindow.h \ 38 pim/opimmainwindow.h \
38 pim/opimresolver.h \ 39 pim/opimresolver.h \
39 pim/oevent.h \ 40 pim/oevent.h \
40 pim/otimezone.h \ 41 pim/otimezone.h \
41 pim/odatebookaccess.h \ 42 pim/odatebookaccess.h \
42 pim/odatebookaccessbackend.h \ 43 pim/odatebookaccessbackend.h \
43 pim/odatebookaccessbackend_xml.h \ 44 pim/odatebookaccessbackend_xml.h \
44 orecurrancewidget.h \ 45 orecurrancewidget.h \
45 oticker.h owait.h 46 oticker.h owait.h
46# pim/otodoaccesssql.h \ 47# pim/otodoaccesssql.h \
47 48
48SOURCES = ofontmenu.cc \ 49SOURCES = ofontmenu.cc \
49 ocolorbutton.cpp \ 50 ocolorbutton.cpp \
50 sharp_compat.cpp \ 51 sharp_compat.cpp \
51 xmltree.cc \ 52 xmltree.cc \
52 ofiledialog.cc ofileselector.cc \ 53 ofiledialog.cc ofileselector.cc \
53 ocheckitem.cpp \ 54 ocheckitem.cpp \
54 colordialog.cpp \ 55 colordialog.cpp \
55 colorpopupmenu.cpp oclickablelabel.cpp \ 56 colorpopupmenu.cpp oclickablelabel.cpp \
56 oprocctrl.cpp oprocess.cpp \ 57 oprocctrl.cpp oprocess.cpp \
57 odevice.cpp odevicebutton.cpp otimepicker.cpp \ 58 odevice.cpp odevicebutton.cpp otimepicker.cpp \
58 otabwidget.cpp otabbar.cpp \ 59 otabwidget.cpp otabbar.cpp \
59 ofontselector.cpp \ 60 ofontselector.cpp \
60 pim/otodo.cpp \ 61 pim/otodo.cpp \
61 pim/opimrecord.cpp \ 62 pim/opimrecord.cpp \
62 pim/otodoaccess.cpp \ 63 pim/otodoaccess.cpp \
63 pim/otodoaccessbackend.cpp \ 64 pim/otodoaccessbackend.cpp \
64 pim/otodoaccessxml.cpp \ 65 pim/otodoaccessxml.cpp \
66 pim/oconversion.cpp \
65 pim/ocontact.cpp \ 67 pim/ocontact.cpp \
66 pim/ocontactaccess.cpp \ 68 pim/ocontactaccess.cpp \
67 pim/ocontactaccessbackend_vcard.cpp \ 69 pim/ocontactaccessbackend_vcard.cpp \
68 pim/ocontactaccessbackend_xml.cpp \ 70 pim/ocontactaccessbackend_xml.cpp \
69 pim/otodoaccessvcal.cpp \ 71 pim/otodoaccessvcal.cpp \
70 pim/orecur.cpp \ 72 pim/orecur.cpp \
71 pim/opimstate.cpp \ 73 pim/opimstate.cpp \
72 pim/opimxrefpartner.cpp \ 74 pim/opimxrefpartner.cpp \
73 pim/opimxref.cpp \ 75 pim/opimxref.cpp \
74 pim/opimxrefmanager.cpp \ 76 pim/opimxrefmanager.cpp \
75 pim/opimmaintainer.cpp \ 77 pim/opimmaintainer.cpp \
76 pim/opimnotify.cpp \ 78 pim/opimnotify.cpp \
77 pim/opimnotifymanager.cpp \ 79 pim/opimnotifymanager.cpp \
78 pim/opimmainwindow.cpp \ 80 pim/opimmainwindow.cpp \
79 pim/opimresolver.cpp \ 81 pim/opimresolver.cpp \
80 pim/oevent.cpp \ 82 pim/oevent.cpp \
81 pim/otimezone.cpp \ 83 pim/otimezone.cpp \
82 pim/odatebookaccess.cpp \ 84 pim/odatebookaccess.cpp \
83 pim/odatebookaccessbackend.cpp \ 85 pim/odatebookaccessbackend.cpp \
84 pim/odatebookaccessbackend_xml.cpp \ 86 pim/odatebookaccessbackend_xml.cpp \
85 orecurrancewidget.cpp \ 87 orecurrancewidget.cpp \
86 oticker.cpp owait.cpp \ 88 oticker.cpp owait.cpp \
87# pim/otodoaccesssql.cpp \ 89# pim/otodoaccesssql.cpp \
88 90
89TARGET = opie 91TARGET = opie
90INCLUDEPATH += $(OPIEDIR)/include 92INCLUDEPATH += $(OPIEDIR)/include
91DESTDIR = $(OPIEDIR)/lib$(PROJMAK) 93DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
92#VERSION = 1.0.0 94#VERSION = 1.0.0
93 95
94LIBS += -lqpe 96LIBS += -lqpe
95 97
96# LIBS += -lopiesql 98# LIBS += -lopiesql
97 99
98INTERFACES = otimepickerbase.ui orecurrancebase.ui 100INTERFACES = otimepickerbase.ui orecurrancebase.ui
99TARGET = opie 101TARGET = opie
100 102
101TRANSLATIONS = ../i18n/de/libopie.ts \ 103TRANSLATIONS = ../i18n/de/libopie.ts \
102 ../i18n/nl/libopie.ts \ 104 ../i18n/nl/libopie.ts \
103 ../i18n/xx/libopie.ts \ 105 ../i18n/xx/libopie.ts \
104 ../i18n/en/libopie.ts \ 106 ../i18n/en/libopie.ts \
105 ../i18n/es/libopie.ts \ 107 ../i18n/es/libopie.ts \
106 ../i18n/fr/libopie.ts \ 108 ../i18n/fr/libopie.ts \
107 ../i18n/hu/libopie.ts \ 109 ../i18n/hu/libopie.ts \
108 ../i18n/ja/libopie.ts \ 110 ../i18n/ja/libopie.ts \
109 ../i18n/ko/libopie.ts \ 111 ../i18n/ko/libopie.ts \
110 ../i18n/no/libopie.ts \ 112 ../i18n/no/libopie.ts \
111 ../i18n/pl/libopie.ts \ 113 ../i18n/pl/libopie.ts \
112 ../i18n/pt/libopie.ts \ 114 ../i18n/pt/libopie.ts \
113 ../i18n/pt_BR/libopie.ts \ 115 ../i18n/pt_BR/libopie.ts \
114 ../i18n/sl/libopie.ts \ 116 ../i18n/sl/libopie.ts \
115 ../i18n/zh_CN/libopie.ts \ 117 ../i18n/zh_CN/libopie.ts \
116 ../i18n/zh_TW/libopie.ts \ 118 ../i18n/zh_TW/libopie.ts \
117 ../i18n/da/libopie.ts 119 ../i18n/da/libopie.ts
118 120
119 121
120 122
121include ( $(OPIEDIR)/include.pro ) 123include ( $(OPIEDIR)/include.pro )
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index 9cccfc8..96a5f65 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -1,92 +1,90 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4**
5** This file is part of the Qtopia Environment.
6** 4**
7** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 8** packaging of this file.
11** 9**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 12**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 13** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 14**
17** Contact info@trolltech.com if any conditions of this licensing are 15** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 16** not clear to you.
19** 17**
20**********************************************************************/ 18**********************************************************************/
21 19
22#define QTOPIA_INTERNAL_CONTACT_MRE 20#define QTOPIA_INTERNAL_CONTACT_MRE
23 21
24#include "ocontact.h" 22#include "ocontact.h"
25#include "opimresolver.h" 23#include "opimresolver.h"
26 24
27#include <qpe/stringutil.h> 25#include <qpe/stringutil.h>
28#include <qpe/timeconversion.h> 26#include "oconversion.h"
29#include <qpe/timestring.h> 27#include <qpe/timestring.h>
30 28
31#include <qobject.h> 29#include <qobject.h>
32#include <qregexp.h> 30#include <qregexp.h>
33#include <qstylesheet.h> 31#include <qstylesheet.h>
34#include <qfileinfo.h> 32#include <qfileinfo.h>
35#include <qmap.h> 33#include <qmap.h>
36 34
37#include <stdio.h> 35#include <stdio.h>
38 36
39/*! 37/*!
40 \class Contact contact.h 38 \class Contact contact.h
41 \brief The Contact class holds the data of an address book entry. 39 \brief The Contact class holds the data of an address book entry.
42 40
43 This data includes information the name of the person, contact 41 This data includes information the name of the person, contact
44 information, and business information such as deparment and job title. 42 information, and business information such as deparment and job title.
45 43
46 \ingroup qtopiaemb 44 \ingroup qtopiaemb
47 \ingroup qtopiadesktop 45 \ingroup qtopiadesktop
48*/ 46*/
49 47
50 48
51/*! 49/*!
52 Creates a new, empty contact. 50 Creates a new, empty contact.
53*/ 51*/
54OContact::OContact() 52OContact::OContact()
55 : OPimRecord(), mMap(), d( 0 ) 53 : OPimRecord(), mMap(), d( 0 )
56{ 54{
57} 55}
58 56
59/*! 57/*!
60 \internal 58 \internal
61 Creates a new contact. The properties of the contact are 59 Creates a new contact. The properties of the contact are
62 set from \a fromMap. 60 set from \a fromMap.
63*/ 61*/
64OContact::OContact( const QMap<int, QString> &fromMap ) : 62OContact::OContact( const QMap<int, QString> &fromMap ) :
65 OPimRecord(), mMap( fromMap ), d( 0 ) 63 OPimRecord(), mMap( fromMap ), d( 0 )
66{ 64{
67 QString cats = mMap[ Qtopia::AddressCategory ]; 65 QString cats = mMap[ Qtopia::AddressCategory ];
68 if ( !cats.isEmpty() ) 66 if ( !cats.isEmpty() )
69 setCategories( idsFromString( cats ) ); 67 setCategories( idsFromString( cats ) );
70 68
71 QString uidStr = find( Qtopia::AddressUid ); 69 QString uidStr = find( Qtopia::AddressUid );
72 70
73 if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ 71 if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){
74 qWarning( "Invalid UID found. Generate new one.." ); 72 qWarning( "Invalid UID found. Generate new one.." );
75 setUid( uidGen().generate() ); 73 setUid( uidGen().generate() );
76 }else 74 }else
77 setUid( uidStr.toInt() ); 75 setUid( uidStr.toInt() );
78 76
79// if ( !uidStr.isEmpty() ) 77// if ( !uidStr.isEmpty() )
80 // setUid( uidStr.toInt() ); 78 // setUid( uidStr.toInt() );
81} 79}
82 80
83/*! 81/*!
84 Destroys a contact. 82 Destroys a contact.
85*/ 83*/
86OContact::~OContact() 84OContact::~OContact()
87{ 85{
88} 86}
89 87
90/*! \fn void OContact::setTitle( const QString &str ) 88/*! \fn void OContact::setTitle( const QString &str )
91 Sets the title of the contact to \a str. 89 Sets the title of the contact to \a str.
92*/ 90*/
@@ -956,173 +954,173 @@ bool OContact::match( const QString &regexp ) const
956{ 954{
957 return match(QRegExp(regexp)); 955 return match(QRegExp(regexp));
958} 956}
959 957
960/*! 958/*!
961 \overload 959 \overload
962 Returns TRUE if the contact matches the regular expression \a regexp. 960 Returns TRUE if the contact matches the regular expression \a regexp.
963 Otherwise returns FALSE. 961 Otherwise returns FALSE.
964*/ 962*/
965bool OContact::match( const QRegExp &r ) const 963bool OContact::match( const QRegExp &r ) const
966{ 964{
967 bool match; 965 bool match;
968 match = false; 966 match = false;
969 QMap<int, QString>::ConstIterator it; 967 QMap<int, QString>::ConstIterator it;
970 for ( it = mMap.begin(); it != mMap.end(); ++it ) { 968 for ( it = mMap.begin(); it != mMap.end(); ++it ) {
971 if ( (*it).find( r ) > -1 ) { 969 if ( (*it).find( r ) > -1 ) {
972 match = true; 970 match = true;
973 break; 971 break;
974 } 972 }
975 } 973 }
976 return match; 974 return match;
977} 975}
978 976
979 977
980QString OContact::toShortText() const 978QString OContact::toShortText() const
981{ 979{
982 return ( fullName() ); 980 return ( fullName() );
983} 981}
984QString OContact::type() const 982QString OContact::type() const
985{ 983{
986 return QString::fromLatin1( "OContact" ); 984 return QString::fromLatin1( "OContact" );
987} 985}
988 986
989// Definition is missing ! (se) 987// Definition is missing ! (se)
990QMap<QString,QString> OContact::toExtraMap() const 988QMap<QString,QString> OContact::toExtraMap() const
991{ 989{
992 qWarning ("Function not implemented: OContact::toExtraMap()"); 990 qWarning ("Function not implemented: OContact::toExtraMap()");
993 QMap <QString,QString> useless; 991 QMap <QString,QString> useless;
994 return useless; 992 return useless;
995} 993}
996 994
997class QString OContact::recordField( int pos ) const 995class QString OContact::recordField( int pos ) const
998{ 996{
999 QStringList SLFIELDS = fields(); // ?? why this ? (se) 997 QStringList SLFIELDS = fields(); // ?? why this ? (se)
1000 return SLFIELDS[pos]; 998 return SLFIELDS[pos];
1001} 999}
1002 1000
1003// In future releases, we should store birthday and anniversary 1001// In future releases, we should store birthday and anniversary
1004// internally as QDate instead of QString ! 1002// internally as QDate instead of QString !
1005// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 1003// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
1006 1004
1007/*! \fn void OContact::setBirthday( const QDate& date ) 1005/*! \fn void OContact::setBirthday( const QDate& date )
1008 Sets the birthday for the contact to \a date. If date is null 1006 Sets the birthday for the contact to \a date. If date is null
1009 the current stored date will be removed. 1007 the current stored date will be removed.
1010*/ 1008*/
1011void OContact::setBirthday( const QDate &v ) 1009void OContact::setBirthday( const QDate &v )
1012{ 1010{
1013 if ( v.isNull() ){ 1011 if ( v.isNull() ){
1014 qWarning( "Remove Birthday"); 1012 qWarning( "Remove Birthday");
1015 replace( Qtopia::Birthday, QString::null ); 1013 replace( Qtopia::Birthday, QString::null );
1016 return; 1014 return;
1017 } 1015 }
1018 1016
1019 if ( v.isValid() ) 1017 if ( v.isValid() )
1020 replace( Qtopia::Birthday, TimeConversion::toString( v ) ); 1018 replace( Qtopia::Birthday, OConversion::dateToString( v ) );
1021 1019
1022} 1020}
1023 1021
1024 1022
1025/*! \fn void OContact::setAnniversary( const QDate &date ) 1023/*! \fn void OContact::setAnniversary( const QDate &date )
1026 Sets the anniversary of the contact to \a date. If date is 1024 Sets the anniversary of the contact to \a date. If date is
1027 null, the current stored date will be removed. 1025 null, the current stored date will be removed.
1028*/ 1026*/
1029void OContact::setAnniversary( const QDate &v ) 1027void OContact::setAnniversary( const QDate &v )
1030{ 1028{
1031 if ( v.isNull() ){ 1029 if ( v.isNull() ){
1032 qWarning( "Remove Anniversary"); 1030 qWarning( "Remove Anniversary");
1033 replace( Qtopia::Anniversary, QString::null ); 1031 replace( Qtopia::Anniversary, QString::null );
1034 return; 1032 return;
1035 } 1033 }
1036 1034
1037 if ( v.isValid() ) 1035 if ( v.isValid() )
1038 replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); 1036 replace( Qtopia::Anniversary, OConversion::dateToString( v ) );
1039} 1037}
1040 1038
1041/*! \fn QDate OContact::birthday() const 1039/*! \fn QDate OContact::birthday() const
1042 Returns the birthday of the contact. 1040 Returns the birthday of the contact.
1043*/ 1041*/
1044QDate OContact::birthday() const 1042QDate OContact::birthday() const
1045{ 1043{
1046 QString str = find( Qtopia::Birthday ); 1044 QString str = find( Qtopia::Birthday );
1047 qWarning ("Birthday %s", str.latin1() ); 1045 qWarning ("Birthday %s", str.latin1() );
1048 if ( !str.isEmpty() ) 1046 if ( !str.isEmpty() )
1049 return TimeConversion::fromString ( str ); 1047 return OConversion::dateFromString ( str );
1050 else 1048 else
1051 return QDate(); 1049 return QDate();
1052} 1050}
1053 1051
1054 1052
1055/*! \fn QDate OContact::anniversary() const 1053/*! \fn QDate OContact::anniversary() const
1056 Returns the anniversary of the contact. 1054 Returns the anniversary of the contact.
1057*/ 1055*/
1058QDate OContact::anniversary() const 1056QDate OContact::anniversary() const
1059{ 1057{
1060 QDate empty; 1058 QDate empty;
1061 QString str = find( Qtopia::Anniversary ); 1059 QString str = find( Qtopia::Anniversary );
1062 qWarning ("Anniversary %s", str.latin1() ); 1060 qWarning ("Anniversary %s", str.latin1() );
1063 if ( !str.isEmpty() ) 1061 if ( !str.isEmpty() )
1064 return TimeConversion::fromString ( str ); 1062 return OConversion::dateFromString ( str );
1065 else 1063 else
1066 return empty; 1064 return empty;
1067} 1065}
1068 1066
1069 1067
1070void OContact::insertEmail( const QString &v ) 1068void OContact::insertEmail( const QString &v )
1071{ 1069{
1072 //qDebug("insertEmail %s", v.latin1()); 1070 //qDebug("insertEmail %s", v.latin1());
1073 QString e = v.simplifyWhiteSpace(); 1071 QString e = v.simplifyWhiteSpace();
1074 QString def = defaultEmail(); 1072 QString def = defaultEmail();
1075 1073
1076 // if no default, set it as the default email and don't insert 1074 // if no default, set it as the default email and don't insert
1077 if ( def.isEmpty() ) { 1075 if ( def.isEmpty() ) {
1078 setDefaultEmail( e ); // will insert into the list for us 1076 setDefaultEmail( e ); // will insert into the list for us
1079 return; 1077 return;
1080 } 1078 }
1081 1079
1082 // otherwise, insert assuming doesn't already exist 1080 // otherwise, insert assuming doesn't already exist
1083 QString emailsStr = find( Qtopia::Emails ); 1081 QString emailsStr = find( Qtopia::Emails );
1084 if ( emailsStr.contains( e )) 1082 if ( emailsStr.contains( e ))
1085 return; 1083 return;
1086 if ( !emailsStr.isEmpty() ) 1084 if ( !emailsStr.isEmpty() )
1087 emailsStr += emailSeparator(); 1085 emailsStr += emailSeparator();
1088 emailsStr += e; 1086 emailsStr += e;
1089 replace( Qtopia::Emails, emailsStr ); 1087 replace( Qtopia::Emails, emailsStr );
1090} 1088}
1091 1089
1092void OContact::removeEmail( const QString &v ) 1090void OContact::removeEmail( const QString &v )
1093{ 1091{
1094 QString e = v.simplifyWhiteSpace(); 1092 QString e = v.simplifyWhiteSpace();
1095 QString def = defaultEmail(); 1093 QString def = defaultEmail();
1096 QString emailsStr = find( Qtopia::Emails ); 1094 QString emailsStr = find( Qtopia::Emails );
1097 QStringList emails = emailList(); 1095 QStringList emails = emailList();
1098 1096
1099 // otherwise, must first contain it 1097 // otherwise, must first contain it
1100 if ( !emailsStr.contains( e ) ) 1098 if ( !emailsStr.contains( e ) )
1101 return; 1099 return;
1102 1100
1103 // remove it 1101 // remove it
1104 //qDebug(" removing email from list %s", e.latin1()); 1102 //qDebug(" removing email from list %s", e.latin1());
1105 emails.remove( e ); 1103 emails.remove( e );
1106 // reset the string 1104 // reset the string
1107 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator 1105 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator
1108 replace( Qtopia::Emails, emailsStr ); 1106 replace( Qtopia::Emails, emailsStr );
1109 1107
1110 // if default, then replace the default email with the first one 1108 // if default, then replace the default email with the first one
1111 if ( def == e ) { 1109 if ( def == e ) {
1112 //qDebug("removeEmail is default; setting new default"); 1110 //qDebug("removeEmail is default; setting new default");
1113 if ( !emails.count() ) 1111 if ( !emails.count() )
1114 clearEmails(); 1112 clearEmails();
1115 else // setDefaultEmail will remove e from the list 1113 else // setDefaultEmail will remove e from the list
1116 setDefaultEmail( emails.first() ); 1114 setDefaultEmail( emails.first() );
1117 } 1115 }
1118} 1116}
1119void OContact::clearEmails() 1117void OContact::clearEmails()
1120{ 1118{
1121 mMap.remove( Qtopia::DefaultEmail ); 1119 mMap.remove( Qtopia::DefaultEmail );
1122 mMap.remove( Qtopia::Emails ); 1120 mMap.remove( Qtopia::Emails );
1123} 1121}
1124void OContact::setDefaultEmail( const QString &v ) 1122void OContact::setDefaultEmail( const QString &v )
1125{ 1123{
1126 QString e = v.simplifyWhiteSpace(); 1124 QString e = v.simplifyWhiteSpace();
1127 1125
1128 //qDebug("OContact::setDefaultEmail %s", e.latin1()); 1126 //qDebug("OContact::setDefaultEmail %s", e.latin1());
diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h
index 25fa0e7..50f6176 100644
--- a/libopie/pim/ocontact.h
+++ b/libopie/pim/ocontact.h
@@ -1,69 +1,67 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4**
5** This file is part of the Qtopia Environment.
6** 4**
7** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 8** packaging of this file.
11** 9**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 12**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 13** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 14**
17** Contact info@trolltech.com if any conditions of this licensing are 15** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 16** not clear to you.
19** 17**
20**********************************************************************/ 18**********************************************************************/
21 19
22#ifndef __OCONTACT_H__ 20#ifndef __OCONTACT_H__
23#define __OCONTACT_H__ 21#define __OCONTACT_H__
24 22
25#include <opie/opimrecord.h> 23#include <opie/opimrecord.h>
26#include <qpe/recordfields.h> 24#include <qpe/recordfields.h>
27 25
28#include <qdatetime.h> 26#include <qdatetime.h>
29#include <qstringlist.h> 27#include <qstringlist.h>
30 28
31#if defined(QPC_TEMPLATEDLL) 29#if defined(QPC_TEMPLATEDLL)
32// MOC_SKIP_BEGIN 30// MOC_SKIP_BEGIN
33QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; 31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
34// MOC_SKIP_END 32// MOC_SKIP_END
35#endif 33#endif
36 34
37class ContactPrivate; 35class ContactPrivate;
38 36
39/** 37/**
40 * OContact class represents a specialised PIM Record for contacts. 38 * OContact class represents a specialised PIM Record for contacts.
41 * It does store all kind of persopn related information. 39 * It does store all kind of persopn related information.
42 * 40 *
43 * @short Contact Container 41 * @short Contact Container
44 * @author TT, Stefan Eiler, Holger Freyther 42 * @author TT, Stefan Eiler, Holger Freyther
45 */ 43 */
46class QPC_EXPORT OContact : public OPimRecord 44class QPC_EXPORT OContact : public OPimRecord
47{ 45{
48 friend class DataSet; 46 friend class DataSet;
49public: 47public:
50 OContact(); 48 OContact();
51 OContact( const QMap<int, QString> &fromMap ); 49 OContact( const QMap<int, QString> &fromMap );
52 virtual ~OContact(); 50 virtual ~OContact();
53 51
54 /* 52 /*
55 * do we need to inline them 53 * do we need to inline them
56 * if yes do we need to inline them this way? 54 * if yes do we need to inline them this way?
57 * -zecke 55 * -zecke
58 */ 56 */
59 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); } 57 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); }
60 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); } 58 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); }
61 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); } 59 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); }
62 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); } 60 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); }
63 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); } 61 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); }
64 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); } 62 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); }
65 void setFileAs(); 63 void setFileAs();
66 64
67 // default email address 65 // default email address
68 void setDefaultEmail( const QString &v ); 66 void setDefaultEmail( const QString &v );
69 // inserts email to list and ensure's doesn't already exist 67 // inserts email to list and ensure's doesn't already exist
diff --git a/libopie/pim/oconversion.cpp b/libopie/pim/oconversion.cpp
new file mode 100644
index 0000000..c3aa89b
--- a/dev/null
+++ b/libopie/pim/oconversion.cpp
@@ -0,0 +1,76 @@
1/**********************************************************************
2** Copyright (C) 2003 by Stefan Eilers (eilers.stefan@epost.de)
3**
4** This file may be distributed and/or modified under the terms of the
5** GNU Lesser General Public License version 2 as published by the Free Software
6** Foundation and appearing in the file LICENSE.GPL included in the
7** packaging of this file.
8**
9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11**
12**********************************************************************/
13
14#include "oconversion.h"
15#include <qpe/timeconversion.h>
16
17
18QString OConversion::dateToString( const QDate &d )
19{
20 if ( d.isNull() || !d.isValid() )
21 return QString::null;
22
23 // ISO format in year, month, day (YYYYMMDD); e.g. 20021231
24 QString year = QString::number( d.year() );
25 QString month = QString::number( d.month() );
26 month = month.rightJustify( 2, '0' );
27 QString day = QString::number( d.day() );
28 day = day.rightJustify( 2, '0' );
29
30 QString str = year + month + day;
31 //qDebug( "\tPimContact dateToStr = %s", str.latin1() );
32
33 return str;
34}
35
36QDate OConversion::dateFromString( const QString& s )
37{
38 QDate date;
39
40 if ( s.isEmpty() )
41 return date;
42
43 // Be backward compatible to old Opie format:
44 // Try to load old format. If it fails, try new ISO-Format!
45 date = TimeConversion::fromString ( s );
46 if ( date.isValid() )
47 return date;
48
49 // Read ISO-Format (YYYYMMDD)
50 int year = s.mid(0, 4).toInt();
51 int month = s.mid(4,2).toInt();
52 int day = s.mid(6,2).toInt();
53
54 // do some quick sanity checking
55 if ( year < 1900 || year > 3000 ) {
56 qWarning( "PimContact year is not in range");
57 return date;
58 }
59 if ( month < 0 || month > 12 ) {
60 qWarning( "PimContact month is not in range");
61 return date;
62 }
63 if ( day < 0 || day > 31 ) {
64 qWarning( "PimContact day is not in range");
65 return date;
66 }
67
68 date.setYMD( year, month, day );
69 if ( !date.isValid() ) {
70 qWarning( "PimContact date is not valid");
71 return QDate();
72 }
73
74 return date;
75}
76
diff --git a/libopie/pim/oconversion.h b/libopie/pim/oconversion.h
new file mode 100644
index 0000000..6540889
--- a/dev/null
+++ b/libopie/pim/oconversion.h
@@ -0,0 +1,36 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4**
5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13** See http://www.trolltech.com/gpl/ for GPL licensing information.
14**
15** Contact info@trolltech.com if any conditions of this licensing are
16** not clear to you.
17**********************************************************************/
18
19#ifndef __oconversion_h__
20#define __oconversion_h__
21
22/* #include <time.h> */
23/* #include <sys/types.h> */
24#include <qdatetime.h>
25
26
27class OConversion
28{
29public:
30 static QString dateToString( const QDate &d );
31 static QDate dateFromString( const QString &datestr );
32
33};
34
35#endif // __oconversion_h__
36
diff --git a/libopie2/opiepim/core/oconversion.cpp b/libopie2/opiepim/core/oconversion.cpp
new file mode 100644
index 0000000..c3aa89b
--- a/dev/null
+++ b/libopie2/opiepim/core/oconversion.cpp
@@ -0,0 +1,76 @@
1/**********************************************************************
2** Copyright (C) 2003 by Stefan Eilers (eilers.stefan@epost.de)
3**
4** This file may be distributed and/or modified under the terms of the
5** GNU Lesser General Public License version 2 as published by the Free Software
6** Foundation and appearing in the file LICENSE.GPL included in the
7** packaging of this file.
8**
9** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11**
12**********************************************************************/
13
14#include "oconversion.h"
15#include <qpe/timeconversion.h>
16
17
18QString OConversion::dateToString( const QDate &d )
19{
20 if ( d.isNull() || !d.isValid() )
21 return QString::null;
22
23 // ISO format in year, month, day (YYYYMMDD); e.g. 20021231
24 QString year = QString::number( d.year() );
25 QString month = QString::number( d.month() );
26 month = month.rightJustify( 2, '0' );
27 QString day = QString::number( d.day() );
28 day = day.rightJustify( 2, '0' );
29
30 QString str = year + month + day;
31 //qDebug( "\tPimContact dateToStr = %s", str.latin1() );
32
33 return str;
34}
35
36QDate OConversion::dateFromString( const QString& s )
37{
38 QDate date;
39
40 if ( s.isEmpty() )
41 return date;
42
43 // Be backward compatible to old Opie format:
44 // Try to load old format. If it fails, try new ISO-Format!
45 date = TimeConversion::fromString ( s );
46 if ( date.isValid() )
47 return date;
48
49 // Read ISO-Format (YYYYMMDD)
50 int year = s.mid(0, 4).toInt();
51 int month = s.mid(4,2).toInt();
52 int day = s.mid(6,2).toInt();
53
54 // do some quick sanity checking
55 if ( year < 1900 || year > 3000 ) {
56 qWarning( "PimContact year is not in range");
57 return date;
58 }
59 if ( month < 0 || month > 12 ) {
60 qWarning( "PimContact month is not in range");
61 return date;
62 }
63 if ( day < 0 || day > 31 ) {
64 qWarning( "PimContact day is not in range");
65 return date;
66 }
67
68 date.setYMD( year, month, day );
69 if ( !date.isValid() ) {
70 qWarning( "PimContact date is not valid");
71 return QDate();
72 }
73
74 return date;
75}
76
diff --git a/libopie2/opiepim/core/oconversion.h b/libopie2/opiepim/core/oconversion.h
new file mode 100644
index 0000000..6540889
--- a/dev/null
+++ b/libopie2/opiepim/core/oconversion.h
@@ -0,0 +1,36 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4**
5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13** See http://www.trolltech.com/gpl/ for GPL licensing information.
14**
15** Contact info@trolltech.com if any conditions of this licensing are
16** not clear to you.
17**********************************************************************/
18
19#ifndef __oconversion_h__
20#define __oconversion_h__
21
22/* #include <time.h> */
23/* #include <sys/types.h> */
24#include <qdatetime.h>
25
26
27class OConversion
28{
29public:
30 static QString dateToString( const QDate &d );
31 static QDate dateFromString( const QString &datestr );
32
33};
34
35#endif // __oconversion_h__
36
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index 9cccfc8..96a5f65 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -1,92 +1,90 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4**
5** This file is part of the Qtopia Environment.
6** 4**
7** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 8** packaging of this file.
11** 9**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 12**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 13** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 14**
17** Contact info@trolltech.com if any conditions of this licensing are 15** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 16** not clear to you.
19** 17**
20**********************************************************************/ 18**********************************************************************/
21 19
22#define QTOPIA_INTERNAL_CONTACT_MRE 20#define QTOPIA_INTERNAL_CONTACT_MRE
23 21
24#include "ocontact.h" 22#include "ocontact.h"
25#include "opimresolver.h" 23#include "opimresolver.h"
26 24
27#include <qpe/stringutil.h> 25#include <qpe/stringutil.h>
28#include <qpe/timeconversion.h> 26#include "oconversion.h"
29#include <qpe/timestring.h> 27#include <qpe/timestring.h>
30 28
31#include <qobject.h> 29#include <qobject.h>
32#include <qregexp.h> 30#include <qregexp.h>
33#include <qstylesheet.h> 31#include <qstylesheet.h>
34#include <qfileinfo.h> 32#include <qfileinfo.h>
35#include <qmap.h> 33#include <qmap.h>
36 34
37#include <stdio.h> 35#include <stdio.h>
38 36
39/*! 37/*!
40 \class Contact contact.h 38 \class Contact contact.h
41 \brief The Contact class holds the data of an address book entry. 39 \brief The Contact class holds the data of an address book entry.
42 40
43 This data includes information the name of the person, contact 41 This data includes information the name of the person, contact
44 information, and business information such as deparment and job title. 42 information, and business information such as deparment and job title.
45 43
46 \ingroup qtopiaemb 44 \ingroup qtopiaemb
47 \ingroup qtopiadesktop 45 \ingroup qtopiadesktop
48*/ 46*/
49 47
50 48
51/*! 49/*!
52 Creates a new, empty contact. 50 Creates a new, empty contact.
53*/ 51*/
54OContact::OContact() 52OContact::OContact()
55 : OPimRecord(), mMap(), d( 0 ) 53 : OPimRecord(), mMap(), d( 0 )
56{ 54{
57} 55}
58 56
59/*! 57/*!
60 \internal 58 \internal
61 Creates a new contact. The properties of the contact are 59 Creates a new contact. The properties of the contact are
62 set from \a fromMap. 60 set from \a fromMap.
63*/ 61*/
64OContact::OContact( const QMap<int, QString> &fromMap ) : 62OContact::OContact( const QMap<int, QString> &fromMap ) :
65 OPimRecord(), mMap( fromMap ), d( 0 ) 63 OPimRecord(), mMap( fromMap ), d( 0 )
66{ 64{
67 QString cats = mMap[ Qtopia::AddressCategory ]; 65 QString cats = mMap[ Qtopia::AddressCategory ];
68 if ( !cats.isEmpty() ) 66 if ( !cats.isEmpty() )
69 setCategories( idsFromString( cats ) ); 67 setCategories( idsFromString( cats ) );
70 68
71 QString uidStr = find( Qtopia::AddressUid ); 69 QString uidStr = find( Qtopia::AddressUid );
72 70
73 if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ 71 if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){
74 qWarning( "Invalid UID found. Generate new one.." ); 72 qWarning( "Invalid UID found. Generate new one.." );
75 setUid( uidGen().generate() ); 73 setUid( uidGen().generate() );
76 }else 74 }else
77 setUid( uidStr.toInt() ); 75 setUid( uidStr.toInt() );
78 76
79// if ( !uidStr.isEmpty() ) 77// if ( !uidStr.isEmpty() )
80 // setUid( uidStr.toInt() ); 78 // setUid( uidStr.toInt() );
81} 79}
82 80
83/*! 81/*!
84 Destroys a contact. 82 Destroys a contact.
85*/ 83*/
86OContact::~OContact() 84OContact::~OContact()
87{ 85{
88} 86}
89 87
90/*! \fn void OContact::setTitle( const QString &str ) 88/*! \fn void OContact::setTitle( const QString &str )
91 Sets the title of the contact to \a str. 89 Sets the title of the contact to \a str.
92*/ 90*/
@@ -956,173 +954,173 @@ bool OContact::match( const QString &regexp ) const
956{ 954{
957 return match(QRegExp(regexp)); 955 return match(QRegExp(regexp));
958} 956}
959 957
960/*! 958/*!
961 \overload 959 \overload
962 Returns TRUE if the contact matches the regular expression \a regexp. 960 Returns TRUE if the contact matches the regular expression \a regexp.
963 Otherwise returns FALSE. 961 Otherwise returns FALSE.
964*/ 962*/
965bool OContact::match( const QRegExp &r ) const 963bool OContact::match( const QRegExp &r ) const
966{ 964{
967 bool match; 965 bool match;
968 match = false; 966 match = false;
969 QMap<int, QString>::ConstIterator it; 967 QMap<int, QString>::ConstIterator it;
970 for ( it = mMap.begin(); it != mMap.end(); ++it ) { 968 for ( it = mMap.begin(); it != mMap.end(); ++it ) {
971 if ( (*it).find( r ) > -1 ) { 969 if ( (*it).find( r ) > -1 ) {
972 match = true; 970 match = true;
973 break; 971 break;
974 } 972 }
975 } 973 }
976 return match; 974 return match;
977} 975}
978 976
979 977
980QString OContact::toShortText() const 978QString OContact::toShortText() const
981{ 979{
982 return ( fullName() ); 980 return ( fullName() );
983} 981}
984QString OContact::type() const 982QString OContact::type() const
985{ 983{
986 return QString::fromLatin1( "OContact" ); 984 return QString::fromLatin1( "OContact" );
987} 985}
988 986
989// Definition is missing ! (se) 987// Definition is missing ! (se)
990QMap<QString,QString> OContact::toExtraMap() const 988QMap<QString,QString> OContact::toExtraMap() const
991{ 989{
992 qWarning ("Function not implemented: OContact::toExtraMap()"); 990 qWarning ("Function not implemented: OContact::toExtraMap()");
993 QMap <QString,QString> useless; 991 QMap <QString,QString> useless;
994 return useless; 992 return useless;
995} 993}
996 994
997class QString OContact::recordField( int pos ) const 995class QString OContact::recordField( int pos ) const
998{ 996{
999 QStringList SLFIELDS = fields(); // ?? why this ? (se) 997 QStringList SLFIELDS = fields(); // ?? why this ? (se)
1000 return SLFIELDS[pos]; 998 return SLFIELDS[pos];
1001} 999}
1002 1000
1003// In future releases, we should store birthday and anniversary 1001// In future releases, we should store birthday and anniversary
1004// internally as QDate instead of QString ! 1002// internally as QDate instead of QString !
1005// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 1003// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
1006 1004
1007/*! \fn void OContact::setBirthday( const QDate& date ) 1005/*! \fn void OContact::setBirthday( const QDate& date )
1008 Sets the birthday for the contact to \a date. If date is null 1006 Sets the birthday for the contact to \a date. If date is null
1009 the current stored date will be removed. 1007 the current stored date will be removed.
1010*/ 1008*/
1011void OContact::setBirthday( const QDate &v ) 1009void OContact::setBirthday( const QDate &v )
1012{ 1010{
1013 if ( v.isNull() ){ 1011 if ( v.isNull() ){
1014 qWarning( "Remove Birthday"); 1012 qWarning( "Remove Birthday");
1015 replace( Qtopia::Birthday, QString::null ); 1013 replace( Qtopia::Birthday, QString::null );
1016 return; 1014 return;
1017 } 1015 }
1018 1016
1019 if ( v.isValid() ) 1017 if ( v.isValid() )
1020 replace( Qtopia::Birthday, TimeConversion::toString( v ) ); 1018 replace( Qtopia::Birthday, OConversion::dateToString( v ) );
1021 1019
1022} 1020}
1023 1021
1024 1022
1025/*! \fn void OContact::setAnniversary( const QDate &date ) 1023/*! \fn void OContact::setAnniversary( const QDate &date )
1026 Sets the anniversary of the contact to \a date. If date is 1024 Sets the anniversary of the contact to \a date. If date is
1027 null, the current stored date will be removed. 1025 null, the current stored date will be removed.
1028*/ 1026*/
1029void OContact::setAnniversary( const QDate &v ) 1027void OContact::setAnniversary( const QDate &v )
1030{ 1028{
1031 if ( v.isNull() ){ 1029 if ( v.isNull() ){
1032 qWarning( "Remove Anniversary"); 1030 qWarning( "Remove Anniversary");
1033 replace( Qtopia::Anniversary, QString::null ); 1031 replace( Qtopia::Anniversary, QString::null );
1034 return; 1032 return;
1035 } 1033 }
1036 1034
1037 if ( v.isValid() ) 1035 if ( v.isValid() )
1038 replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); 1036 replace( Qtopia::Anniversary, OConversion::dateToString( v ) );
1039} 1037}
1040 1038
1041/*! \fn QDate OContact::birthday() const 1039/*! \fn QDate OContact::birthday() const
1042 Returns the birthday of the contact. 1040 Returns the birthday of the contact.
1043*/ 1041*/
1044QDate OContact::birthday() const 1042QDate OContact::birthday() const
1045{ 1043{
1046 QString str = find( Qtopia::Birthday ); 1044 QString str = find( Qtopia::Birthday );
1047 qWarning ("Birthday %s", str.latin1() ); 1045 qWarning ("Birthday %s", str.latin1() );
1048 if ( !str.isEmpty() ) 1046 if ( !str.isEmpty() )
1049 return TimeConversion::fromString ( str ); 1047 return OConversion::dateFromString ( str );
1050 else 1048 else
1051 return QDate(); 1049 return QDate();
1052} 1050}
1053 1051
1054 1052
1055/*! \fn QDate OContact::anniversary() const 1053/*! \fn QDate OContact::anniversary() const
1056 Returns the anniversary of the contact. 1054 Returns the anniversary of the contact.
1057*/ 1055*/
1058QDate OContact::anniversary() const 1056QDate OContact::anniversary() const
1059{ 1057{
1060 QDate empty; 1058 QDate empty;
1061 QString str = find( Qtopia::Anniversary ); 1059 QString str = find( Qtopia::Anniversary );
1062 qWarning ("Anniversary %s", str.latin1() ); 1060 qWarning ("Anniversary %s", str.latin1() );
1063 if ( !str.isEmpty() ) 1061 if ( !str.isEmpty() )
1064 return TimeConversion::fromString ( str ); 1062 return OConversion::dateFromString ( str );
1065 else 1063 else
1066 return empty; 1064 return empty;
1067} 1065}
1068 1066
1069 1067
1070void OContact::insertEmail( const QString &v ) 1068void OContact::insertEmail( const QString &v )
1071{ 1069{
1072 //qDebug("insertEmail %s", v.latin1()); 1070 //qDebug("insertEmail %s", v.latin1());
1073 QString e = v.simplifyWhiteSpace(); 1071 QString e = v.simplifyWhiteSpace();
1074 QString def = defaultEmail(); 1072 QString def = defaultEmail();
1075 1073
1076 // if no default, set it as the default email and don't insert 1074 // if no default, set it as the default email and don't insert
1077 if ( def.isEmpty() ) { 1075 if ( def.isEmpty() ) {
1078 setDefaultEmail( e ); // will insert into the list for us 1076 setDefaultEmail( e ); // will insert into the list for us
1079 return; 1077 return;
1080 } 1078 }
1081 1079
1082 // otherwise, insert assuming doesn't already exist 1080 // otherwise, insert assuming doesn't already exist
1083 QString emailsStr = find( Qtopia::Emails ); 1081 QString emailsStr = find( Qtopia::Emails );
1084 if ( emailsStr.contains( e )) 1082 if ( emailsStr.contains( e ))
1085 return; 1083 return;
1086 if ( !emailsStr.isEmpty() ) 1084 if ( !emailsStr.isEmpty() )
1087 emailsStr += emailSeparator(); 1085 emailsStr += emailSeparator();
1088 emailsStr += e; 1086 emailsStr += e;
1089 replace( Qtopia::Emails, emailsStr ); 1087 replace( Qtopia::Emails, emailsStr );
1090} 1088}
1091 1089
1092void OContact::removeEmail( const QString &v ) 1090void OContact::removeEmail( const QString &v )
1093{ 1091{
1094 QString e = v.simplifyWhiteSpace(); 1092 QString e = v.simplifyWhiteSpace();
1095 QString def = defaultEmail(); 1093 QString def = defaultEmail();
1096 QString emailsStr = find( Qtopia::Emails ); 1094 QString emailsStr = find( Qtopia::Emails );
1097 QStringList emails = emailList(); 1095 QStringList emails = emailList();
1098 1096
1099 // otherwise, must first contain it 1097 // otherwise, must first contain it
1100 if ( !emailsStr.contains( e ) ) 1098 if ( !emailsStr.contains( e ) )
1101 return; 1099 return;
1102 1100
1103 // remove it 1101 // remove it
1104 //qDebug(" removing email from list %s", e.latin1()); 1102 //qDebug(" removing email from list %s", e.latin1());
1105 emails.remove( e ); 1103 emails.remove( e );
1106 // reset the string 1104 // reset the string
1107 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator 1105 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator
1108 replace( Qtopia::Emails, emailsStr ); 1106 replace( Qtopia::Emails, emailsStr );
1109 1107
1110 // if default, then replace the default email with the first one 1108 // if default, then replace the default email with the first one
1111 if ( def == e ) { 1109 if ( def == e ) {
1112 //qDebug("removeEmail is default; setting new default"); 1110 //qDebug("removeEmail is default; setting new default");
1113 if ( !emails.count() ) 1111 if ( !emails.count() )
1114 clearEmails(); 1112 clearEmails();
1115 else // setDefaultEmail will remove e from the list 1113 else // setDefaultEmail will remove e from the list
1116 setDefaultEmail( emails.first() ); 1114 setDefaultEmail( emails.first() );
1117 } 1115 }
1118} 1116}
1119void OContact::clearEmails() 1117void OContact::clearEmails()
1120{ 1118{
1121 mMap.remove( Qtopia::DefaultEmail ); 1119 mMap.remove( Qtopia::DefaultEmail );
1122 mMap.remove( Qtopia::Emails ); 1120 mMap.remove( Qtopia::Emails );
1123} 1121}
1124void OContact::setDefaultEmail( const QString &v ) 1122void OContact::setDefaultEmail( const QString &v )
1125{ 1123{
1126 QString e = v.simplifyWhiteSpace(); 1124 QString e = v.simplifyWhiteSpace();
1127 1125
1128 //qDebug("OContact::setDefaultEmail %s", e.latin1()); 1126 //qDebug("OContact::setDefaultEmail %s", e.latin1());
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index 25fa0e7..50f6176 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -1,69 +1,67 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4**
5** This file is part of the Qtopia Environment.
6** 4**
7** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file. 8** packaging of this file.
11** 9**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14** 12**
15** See http://www.trolltech.com/gpl/ for GPL licensing information. 13** See http://www.trolltech.com/gpl/ for GPL licensing information.
16** 14**
17** Contact info@trolltech.com if any conditions of this licensing are 15** Contact info@trolltech.com if any conditions of this licensing are
18** not clear to you. 16** not clear to you.
19** 17**
20**********************************************************************/ 18**********************************************************************/
21 19
22#ifndef __OCONTACT_H__ 20#ifndef __OCONTACT_H__
23#define __OCONTACT_H__ 21#define __OCONTACT_H__
24 22
25#include <opie/opimrecord.h> 23#include <opie/opimrecord.h>
26#include <qpe/recordfields.h> 24#include <qpe/recordfields.h>
27 25
28#include <qdatetime.h> 26#include <qdatetime.h>
29#include <qstringlist.h> 27#include <qstringlist.h>
30 28
31#if defined(QPC_TEMPLATEDLL) 29#if defined(QPC_TEMPLATEDLL)
32// MOC_SKIP_BEGIN 30// MOC_SKIP_BEGIN
33QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; 31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
34// MOC_SKIP_END 32// MOC_SKIP_END
35#endif 33#endif
36 34
37class ContactPrivate; 35class ContactPrivate;
38 36
39/** 37/**
40 * OContact class represents a specialised PIM Record for contacts. 38 * OContact class represents a specialised PIM Record for contacts.
41 * It does store all kind of persopn related information. 39 * It does store all kind of persopn related information.
42 * 40 *
43 * @short Contact Container 41 * @short Contact Container
44 * @author TT, Stefan Eiler, Holger Freyther 42 * @author TT, Stefan Eiler, Holger Freyther
45 */ 43 */
46class QPC_EXPORT OContact : public OPimRecord 44class QPC_EXPORT OContact : public OPimRecord
47{ 45{
48 friend class DataSet; 46 friend class DataSet;
49public: 47public:
50 OContact(); 48 OContact();
51 OContact( const QMap<int, QString> &fromMap ); 49 OContact( const QMap<int, QString> &fromMap );
52 virtual ~OContact(); 50 virtual ~OContact();
53 51
54 /* 52 /*
55 * do we need to inline them 53 * do we need to inline them
56 * if yes do we need to inline them this way? 54 * if yes do we need to inline them this way?
57 * -zecke 55 * -zecke
58 */ 56 */
59 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); } 57 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); }
60 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); } 58 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); }
61 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); } 59 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); }
62 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); } 60 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); }
63 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); } 61 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); }
64 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); } 62 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); }
65 void setFileAs(); 63 void setFileAs();
66 64
67 // default email address 65 // default email address
68 void setDefaultEmail( const QString &v ); 66 void setDefaultEmail( const QString &v );
69 // inserts email to list and ensure's doesn't already exist 67 // inserts email to list and ensure's doesn't already exist