summaryrefslogtreecommitdiff
path: root/library/backend/contact.cpp
Side-by-side diff
Diffstat (limited to 'library/backend/contact.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/contact.cpp107
1 files changed, 61 insertions, 46 deletions
diff --git a/library/backend/contact.cpp b/library/backend/contact.cpp
index a5f10ab..b10b19a 100644
--- a/library/backend/contact.cpp
+++ b/library/backend/contact.cpp
@@ -17,11 +17,13 @@
** not clear to you.
**
**********************************************************************/
+#define QTOPIA_INTERNAL_CONTACT_MRE
+
#include "contact.h"
-#include "vobject_p.h"
-#include "qfiledirect_p.h"
+#include "vobject_p.h"
+#include "qfiledirect_p.h"
#include <qpe/stringutil.h>
#include <qpe/timeconversion.h>
@@ -385,47 +387,51 @@ QStringList Contact::fields()
list.append( "LastName" );
list.append( "Suffix" );
list.append( "FileAs" );
+ list.append( "JobTitle" );
+ list.append( "Department" );
+ list.append( "Company" );
+ list.append( "BusinessPhone" );
+ list.append( "BusinessFax" );
+ list.append( "BusinessMobile" );
+
list.append( "DefaultEmail" );
list.append( "Emails" );
- list.append( "HomeStreet" );
- list.append( "HomeCity" );
- list.append( "HomeState" );
- list.append( "HomeZip" );
- list.append( "HomeCountry" );
list.append( "HomePhone" );
list.append( "HomeFax" );
list.append( "HomeMobile" );
- list.append( "HomeWebPage" );
- list.append( "Company" );
list.append( "BusinessStreet" );
list.append( "BusinessCity" );
list.append( "BusinessState" );
list.append( "BusinessZip" );
list.append( "BusinessCountry" );
+ list.append( "BusinessPager" );
list.append( "BusinessWebPage" );
- list.append( "JobTitle" );
- list.append( "Department" );
+
list.append( "Office" );
- list.append( "BusinessPhone" );
- list.append( "BusinessFax" );
- list.append( "BusinessMobile" );
- list.append( "BusinessPager" );
list.append( "Profession" );
list.append( "Assistant" );
list.append( "Manager" );
+ list.append( "HomeStreet" );
+ list.append( "HomeCity" );
+ list.append( "HomeState" );
+ list.append( "HomeZip" );
+ list.append( "HomeCountry" );
+ list.append( "HomeWebPage" );
+
list.append( "Spouse" );
list.append( "Gender" );
list.append( "Birthday" );
list.append( "Anniversary" );
list.append( "Nickname" );
-
list.append( "Children" );
+
list.append( "Notes" );
+ list.append( "Groups" );
return list;
}
@@ -439,47 +445,51 @@ QStringList Contact::trfields()
list.append( QObject::tr( "Last Name" ) );
list.append( QObject::tr( "Suffix" ) );
list.append( QObject::tr( "File As" ) );
+ list.append( QObject::tr( "Job Title" ) );
+ list.append( QObject::tr( "Department" ) );
+ list.append( QObject::tr( "Company" ) );
+ list.append( QObject::tr( "Business Phone" ) );
+ list.append( QObject::tr( "Business Fax" ) );
+ list.append( QObject::tr( "Business Mobile" ) );
+
list.append( QObject::tr( "Default Email" ) );
list.append( QObject::tr( "Emails" ) );
- list.append( QObject::tr( "Home Street" ) );
- list.append( QObject::tr( "Home City" ) );
- list.append( QObject::tr( "Home State" ) );
- list.append( QObject::tr( "Home Zip" ) );
- list.append( QObject::tr( "Home Country" ) );
list.append( QObject::tr( "Home Phone" ) );
list.append( QObject::tr( "Home Fax" ) );
list.append( QObject::tr( "Home Mobile" ) );
- list.append( QObject::tr( "Home Web Page" ) );
- list.append( QObject::tr( "Company" ) );
list.append( QObject::tr( "Business Street" ) );
list.append( QObject::tr( "Business City" ) );
list.append( QObject::tr( "Business State" ) );
list.append( QObject::tr( "Business Zip" ) );
list.append( QObject::tr( "Business Country" ) );
+ list.append( QObject::tr( "Business Pager" ) );
list.append( QObject::tr( "Business WebPage" ) );
- list.append( QObject::tr( "Job Title" ) );
- list.append( QObject::tr( "Department" ) );
+
list.append( QObject::tr( "Office" ) );
- list.append( QObject::tr( "Business Phone" ) );
- list.append( QObject::tr( "Business Fax" ) );
- list.append( QObject::tr( "Business Mobile" ) );
- list.append( QObject::tr( "Business Pager" ) );
list.append( QObject::tr( "Profession" ) );
list.append( QObject::tr( "Assistant" ) );
list.append( QObject::tr( "Manager" ) );
+ list.append( QObject::tr( "Home Street" ) );
+ list.append( QObject::tr( "Home City" ) );
+ list.append( QObject::tr( "Home State" ) );
+ list.append( QObject::tr( "Home Zip" ) );
+ list.append( QObject::tr( "Home Country" ) );
+ list.append( QObject::tr( "Home Web Page" ) );
+
list.append( QObject::tr( "Spouse" ) );
list.append( QObject::tr( "Gender" ) );
list.append( QObject::tr( "Birthday" ) );
list.append( QObject::tr( "Anniversary" ) );
list.append( QObject::tr( "Nickname" ) );
-
list.append( QObject::tr( "Children" ) );
+
list.append( QObject::tr( "Notes" ) );
+ list.append( QObject::tr( "Groups" ) );
return list;
}
@@ -628,9 +638,9 @@ static Contact parseVObject( VObject *obj )
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
- QCString name = vObjectName( o );
+ QCString name = vObjectTypeInfo( o );
QString value = vObjectStringZValue( o );
if ( name == VCNamePrefixesProp )
c.setTitle( value );
else if ( name == VCNameSuffixesProp )
@@ -701,9 +711,9 @@ static Contact parseVObject( VObject *obj )
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
- QCString name = vObjectName( o );
+ QCString name = vObjectTypeInfo( o );
if ( name == VCHomeProp )
type |= HOME;
else if ( name == VCWorkProp )
type |= WORK;
@@ -748,9 +758,9 @@ static Contact parseVObject( VObject *obj )
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
- QCString name = vObjectName( o );
+ QCString name = vObjectTypeInfo( o );
if ( name != VCInternetProp && name != VCHomeProp &&
name != VCWorkProp &&
name != VCPreferredProp )
// ### preffered should map to default email
@@ -771,9 +781,9 @@ static Contact parseVObject( VObject *obj )
VObjectIterator nit;
initPropIterator( &nit, o );
while( moreIteration( &nit ) ) {
VObject *o = nextVObject( &nit );
- QCString name = vObjectName( o );
+ QCString name = vObjectTypeInfo( o );
if ( name == VCHomeProp )
c.setHomeWebpage( value );
else if ( name == VCWorkProp )
c.setBusinessWebpage( value );
@@ -841,14 +851,14 @@ static Contact parseVObject( VObject *obj )
return c;
}
void Contact::writeVCard( const QString &filename, const QValueList<Contact> &contacts)
-{
- QFileDirect f( filename.utf8().data() );
- if ( !f.open( IO_WriteOnly ) ) {
- qWarning("Unable to open vcard write");
- return;
- }
+{
+ QFileDirect f( filename.utf8().data() );
+ if ( !f.open( IO_WriteOnly ) ) {
+ qWarning("Unable to open vcard write");
+ return;
+ }
QValueList<Contact>::ConstIterator it;
for( it = contacts.begin(); it != contacts.end(); ++it ) {
VObject *obj = createVObject( *it );
@@ -858,14 +868,14 @@ void Contact::writeVCard( const QString &filename, const QValueList<Contact> &co
cleanStrTbl();
}
void Contact::writeVCard( const QString &filename, const Contact &contact)
-{
- QFileDirect f( filename.utf8().data() );
- if ( !f.open( IO_WriteOnly ) ) {
- qWarning("Unable to open vcard write");
- return;
- }
+{
+ QFileDirect f( filename.utf8().data() );
+ if ( !f.open( IO_WriteOnly ) ) {
+ qWarning("Unable to open vcard write");
+ return;
+ }
VObject *obj = createVObject( contact );
writeVObject( f.directHandle() , obj );
cleanVObject( obj );
@@ -893,8 +903,13 @@ QValueList<Contact> Contact::readVCard( const QString &filename )
return contacts;
}
+bool Contact::match( const QString &regexp ) const
+{
+ return match(QRegExp(regexp));
+}
+
bool Contact::match( const QRegExp &r ) const
{
bool match;
match = false;