Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OContactAccessBackend_VCard Class Reference

#include </home/clem/local/src/opie/noncore/unsupported/libopie/pim/ocontactaccessbackend_vcard.h>

Inheritance diagram for OContactAccessBackend_VCard:

Inheritance graph
[legend]
Collaboration diagram for OContactAccessBackend_VCard:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OContactAccessBackend_VCard (const QString &appname, const QString &filename=QString::null)
bool load ()
bool reload ()
bool save ()
void clear ()
bool add (const OContact &newcontact)
bool remove (int uid)
bool replace (const OContact &contact)
OContact find (int uid) const
QArray< int > allRecords () const
QArray< int > queryByExample (const OContact &query, int settings, const QDateTime &d=QDateTime())
QArray< int > matchRegexp (const QRegExp &r) const
const uint querySettings ()
bool hasQuerySettings (uint querySettings) const
QArray< int > sorted (bool ascending, int sortOrder, int sortFilter, int cat)
bool wasChangedExternally ()

Private Member Functions

OContact parseVObject (VObject *obj)
VObjectcreateVObject (const OContact &c)
QString convDateToVCardDate (const QDate &c) const
QDate convVCardDateToDate (const QString &datestr)
VObjectsafeAddPropValue (VObject *o, const char *prop, const QString &value)
VObjectsafeAddProp (VObject *o, const char *prop)

Private Attributes

bool m_dirty: 1
QString m_file
QMap< int, OContactm_map

Detailed Description

This is the vCard 2.1 implementation of the Contact Storage
See also:
OContactAccessBackend_XML

OPimAccessBackend

Definition at line 63 of file ocontactaccessbackend_vcard.h.


Constructor & Destructor Documentation

OContactAccessBackend_VCard::OContactAccessBackend_VCard const QString appname,
const QString filename = QString::null
 

Definition at line 102 of file ocontactaccessbackend_vcard.cpp.

References load().


Member Function Documentation

bool OContactAccessBackend_VCard::add const OContact newcontact  )  [virtual]
 

add T

Implements OPimAccessBackend< OContact >.

Definition at line 185 of file ocontactaccessbackend_vcard.cpp.

References QMap< Key, T >::insert(), m_dirty, m_map, and Qtopia::Record::uid().

QArray< int > OContactAccessBackend_VCard::allRecords  )  const [virtual]
 

return an array of all available uids

Implements OPimAccessBackend< OContact >.

Definition at line 211 of file ocontactaccessbackend_vcard.cpp.

References QMap< Key, T >::begin(), QMap< Key, T >::count(), QMap< Key, T >::end(), i, and m_map.

void OContactAccessBackend_VCard::clear  )  [virtual]
 

clear the back end

Implements OPimAccessBackend< OContact >.

Definition at line 179 of file ocontactaccessbackend_vcard.cpp.

References QMap< Key, T >::clear(), m_dirty, and m_map.

QString OContactAccessBackend_VCard::convDateToVCardDate const QDate c  )  const [private]
 

Definition at line 596 of file ocontactaccessbackend_vcard.cpp.

References QDate::day(), QString::find(), QDate::month(), pos, QString::replace(), and QDate::year().

Referenced by createVObject().

QDate OContactAccessBackend_VCard::convVCardDateToDate const QString datestr  )  [private]
 

Definition at line 610 of file ocontactaccessbackend_vcard.cpp.

References OContactAccessBackend::d, QString::find(), QString::latin1(), QString::left(), QString::length(), QString::mid(), qDebug(), and Opie::MM::y.

Referenced by parseVObject().

VObject * OContactAccessBackend_VCard::createVObject const OContact c  )  [private]
 

Definition at line 490 of file ocontactaccessbackend_vcard.cpp.

References OContact::anniversary(), OContact::assistant(), QValueList< T >::begin(), OContact::birthday(), OContact::businessCity(), OContact::businessCountry(), OContact::businessFax(), OContact::businessMobile(), OContact::businessPager(), OContact::businessPhone(), OContact::businessState(), OContact::businessStreet(), OContact::businessWebpage(), OContact::businessZip(), OContact::children(), OContact::company(), convDateToVCardDate(), QDateTime::currentDateTime(), OContact::department(), OContact::emailList(), QValueList< T >::end(), OContact::firstName(), OContact::fullName(), OContact::gender(), OContact::homeCity(), OContact::homeCountry(), OContact::homeFax(), OContact::homeMobile(), OContact::homePhone(), OContact::homeState(), OContact::homeStreet(), OContact::homeWebpage(), OContact::homeZip(), OContact::jobTitle(), OContact::lastName(), QString::latin1(), OContact::manager(), OContact::middleName(), name, OContact::nickname(), OContact::notes(), QString::number(), OContact::office(), OContact::profession(), qWarning(), safeAddProp(), safeAddPropValue(), OContact::spouse(), OContact::suffix(), title, OContact::title(), TimeConversion::toISO8601(), Qtopia::Record::uid(), VCAdditionalNamesProp, VCAdrProp, VCBirthDateProp, VCCardProp, VCCellularProp, VCCityProp, VCCountryNameProp, VCEmailAddressProp, VCFamilyNameProp, VCFaxProp, VCFullNameProp, VCGivenNameProp, VCHomeProp, VCInternetProp, VCLastRevisedProp, VCNamePrefixesProp, VCNameProp, VCNameSuffixesProp, VCNoteProp, VCOrgNameProp, VCOrgProp, VCOrgUnit2Prop, VCOrgUnitProp, VCPagerProp, VCPostalCodeProp, VCRegionProp, VCStreetAddressProp, VCTelephoneProp, VCTitleProp, VCUniqueStringProp, VCURLProp, VCVersionProp, and VCWorkProp.

Referenced by save().

OContact OContactAccessBackend_VCard::find int  uid  )  const [virtual]
 

find the OPimRecord with uid

Parameters:
uid returns T and T.isEmpty() if nothing was found

Implements OPimAccessBackend< OContact >.

Definition at line 206 of file ocontactaccessbackend_vcard.cpp.

References m_map.

bool OContactAccessBackend_VCard::hasQuerySettings uint  querySettings  )  const [virtual]
 

Check whether settings are correct.

Returns:
true if the given settings are correct and possible.

Implements OContactAccessBackend.

Definition at line 242 of file ocontactaccessbackend_vcard.cpp.

bool OContactAccessBackend_VCard::load  )  [virtual]
 

load the resource

Implements OPimAccessBackend< OContact >.

Definition at line 110 of file ocontactaccessbackend_vcard.cpp.

References QMap< Key, T >::clear(), data, QFile::encodeName(), QFile::exists(), QMap< Key, T >::insert(), l, m_dirty, m_file, m_map, parseVObject(), qWarning(), OContact::setUid(), t, and Qtopia::Record::uid().

Referenced by OContactAccessBackend_VCard(), and reload().

QArray< int > OContactAccessBackend_VCard::matchRegexp const QRegExp r  )  const [virtual]
 

return a List of records that match the regex

Implements OContactAccessBackend.

Definition at line 231 of file ocontactaccessbackend_vcard.cpp.

OContact OContactAccessBackend_VCard::parseVObject VObject obj  )  [private]
 

Definition at line 262 of file ocontactaccessbackend_vcard.cpp.

References convVCardDateToDate(), FALSE, OContact::insertEmail(), QString::latin1(), name, o, printf, qWarning(), OContact::setAnniversary(), OContact::setAssistant(), OContact::setBirthday(), OContact::setBusinessCity(), OContact::setBusinessCountry(), OContact::setBusinessFax(), OContact::setBusinessMobile(), OContact::setBusinessPager(), OContact::setBusinessPhone(), OContact::setBusinessState(), OContact::setBusinessStreet(), OContact::setBusinessWebpage(), OContact::setBusinessZip(), OContact::setChildren(), OContact::setCompany(), OContact::setDepartment(), OContact::setFileAs(), OContact::setFirstName(), OContact::setGender(), OContact::setHomeCity(), OContact::setHomeCountry(), OContact::setHomeFax(), OContact::setHomeMobile(), OContact::setHomePhone(), OContact::setHomeState(), OContact::setHomeStreet(), OContact::setHomeWebpage(), OContact::setHomeZip(), OContact::setJobTitle(), OContact::setLastName(), OContact::setManager(), OContact::setMiddleName(), OContact::setNickname(), OContact::setNotes(), OContact::setOffice(), OContact::setProfession(), OContact::setSpouse(), OContact::setSuffix(), OContact::setTitle(), TRUE, type, VCAdditionalNamesProp, VCAdrProp, VCBirthDateProp, VCCellularProp, VCCityProp, VCCommentProp, VCCountryNameProp, VCEmailAddressProp, VCFamilyNameProp, VCFaxProp, VCGivenNameProp, VCHomeProp, VCInternetProp, VCNamePrefixesProp, VCNameProp, VCNameSuffixesProp, VCOrgNameProp, VCOrgProp, VCOrgUnit2Prop, VCOrgUnitProp, VCPagerProp, VCPostalCodeProp, VCPreferredProp, VCRegionProp, VCStreetAddressProp, VCTelephoneProp, VCTitleProp, VCURLProp, VCVoiceProp, and VCWorkProp.

Referenced by load().

QArray< int > OContactAccessBackend_VCard::queryByExample const OContact query,
int  settings,
const QDateTime d = QDateTime()
[virtual]
 

queryByExample for T with the given Settings

Implements OPimAccessBackend< OContact >.

Definition at line 224 of file ocontactaccessbackend_vcard.cpp.

const uint OContactAccessBackend_VCard::querySettings  )  [virtual]
 

Return all possible settings.

Returns:
All settings provided by the current backend (i.e.: query_WildCards & query_IgnoreCase)

Implements OContactAccessBackend.

Definition at line 237 of file ocontactaccessbackend_vcard.cpp.

bool OContactAccessBackend_VCard::reload  )  [virtual]
 

reload the resource

Implements OPimAccessBackend< OContact >.

Definition at line 148 of file ocontactaccessbackend_vcard.cpp.

References load().

bool OContactAccessBackend_VCard::remove int  uid  )  [virtual]
 

remove

Implements OPimAccessBackend< OContact >.

Definition at line 192 of file ocontactaccessbackend_vcard.cpp.

References m_dirty, m_map, and QMap< Key, T >::remove().

bool OContactAccessBackend_VCard::replace const OContact contact  )  [virtual]
 

replace a record with T.uid()

Implements OPimAccessBackend< OContact >.

Definition at line 199 of file ocontactaccessbackend_vcard.cpp.

References m_dirty, m_map, and QMap< Key, T >::replace().

VObject * OContactAccessBackend_VCard::safeAddProp VObject o,
const char *  prop
[private]
 

Definition at line 643 of file ocontactaccessbackend_vcard.cpp.

Referenced by createVObject().

VObject * OContactAccessBackend_VCard::safeAddPropValue VObject o,
const char *  prop,
const QString value
[private]
 

Definition at line 635 of file ocontactaccessbackend_vcard.cpp.

References QString::isEmpty(), and QString::latin1().

Referenced by createVObject().

bool OContactAccessBackend_VCard::save  )  [virtual]
 

save the resource and all it's changes

Implements OPimAccessBackend< OContact >.

Definition at line 152 of file ocontactaccessbackend_vcard.cpp.

References QMap< Key, T >::begin(), createVObject(), QFileDirect::directHandle(), QMap< Key, T >::end(), IO_WriteOnly, m_dirty, m_file, m_map, QFile::open(), VCCalProp, VCVersionProp, and writeVObject().

QArray< int > OContactAccessBackend_VCard::sorted bool  ascending,
int  sortOrder,
int  sortFilter,
int  cat
[virtual]
 

FIXME!!! Returns a sorted list of records either ascendinf or descending for a giving criteria and category

Implements OContactAccessBackend.

Definition at line 253 of file ocontactaccessbackend_vcard.cpp.

bool OContactAccessBackend_VCard::wasChangedExternally  )  [virtual]
 

Return if database was changed externally. This may just make sense on file based databases like a XML-File. It is used to prevent to overwrite the current database content if the file was already changed by something else ! If this happens, we have to reload before save our data. If we use real databases, this should be handled by the database management system themselve, therefore this function should always return false in this case. It is not our problem to handle this conflict ...

Returns:
true if the database was changed and if save without reload will be dangerous. false if the database was not changed or it is save to write in this situation.

Implements OContactAccessBackend.

Definition at line 247 of file ocontactaccessbackend_vcard.cpp.


Member Data Documentation

bool OContactAccessBackend_VCard::m_dirty [private]
 

Definition at line 94 of file ocontactaccessbackend_vcard.h.

Referenced by add(), clear(), load(), remove(), replace(), and save().

QString OContactAccessBackend_VCard::m_file [private]
 

Definition at line 95 of file ocontactaccessbackend_vcard.h.

Referenced by load(), and save().

QMap<int, OContact> OContactAccessBackend_VCard::m_map [private]
 

Definition at line 96 of file ocontactaccessbackend_vcard.h.

Referenced by add(), allRecords(), clear(), find(), load(), remove(), replace(), and save().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:42:09 2005 for OPIE by  doxygen 1.4.2