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

Opie::OPimContactAccessBackend_XML Class Reference

#include </home/clem/local/src/opie/libopie2/opiepim/backend/ocontactaccessbackend_xml.h>

Inheritance diagram for Opie::OPimContactAccessBackend_XML:

Inheritance graph
[legend]
Collaboration diagram for Opie::OPimContactAccessBackend_XML:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OPimContactAccessBackend_XML (const QString &appname, const QString &filename=QString::null)
bool save ()
bool load ()
void clear ()
bool wasChangedExternally ()
UIDArray allRecords () const
OPimContact find (int uid) const
UIDArray matchRegexp (const QRegExp &r) const
bool add (const OPimContact &newcontact)
bool replace (const OPimContact &contact)
bool remove (int uid)
bool reload ()

Protected Attributes

bool m_changed
QString m_journalName
QString m_fileName
QString m_appName
QList< OPimContactm_contactList
QDateTime m_readtime
QDict< OPimContactm_uidToContact

Private Types

enum  journal_action { ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE }

Private Member Functions

void addContact_p (const OPimContact &newcontact)
bool load (const QString filename, bool isJournal)
void updateJournal (const OPimContact &cnt, journal_action action)
void removeJournal ()

Detailed Description

This class is the XML implementation of a Contact backend it does implement everything available for OPimContact.
See also:
OPimAccessBackend for more information of available methods

Definition at line 49 of file ocontactaccessbackend_xml.h.


Member Enumeration Documentation

enum Opie::OPimContactAccessBackend_XML::journal_action [private]
 

Enumeration values:
ACTION_ADD 
ACTION_REMOVE 
ACTION_REPLACE 

Definition at line 76 of file ocontactaccessbackend_xml.h.


Constructor & Destructor Documentation

Opie::OPimContactAccessBackend_XML::OPimContactAccessBackend_XML const QString appname,
const QString filename = QString::null
 

Definition at line 59 of file ocontactaccessbackend_xml.cpp.

References Global::applicationFileName(), QString::isEmpty(), load(), m_appName, m_contactList, m_fileName, m_journalName, m_uidToContact, and QPtrCollection::setAutoDelete().


Member Function Documentation

bool Opie::OPimContactAccessBackend_XML::add const OPimContact newcontact  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 265 of file ocontactaccessbackend_xml.cpp.

References ACTION_ADD, addContact_p(), m_changed, and updateJournal().

void Opie::OPimContactAccessBackend_XML::addContact_p const OPimContact newcontact  )  [private]
 

Definition at line 316 of file ocontactaccessbackend_xml.cpp.

References QDict< type >::insert(), m_contactList, m_uidToContact, and Qtopia::Record::uid().

Referenced by add(), and load().

UIDArray Opie::OPimContactAccessBackend_XML::allRecords  )  const [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 186 of file ocontactaccessbackend_xml.cpp.

References m_contactList.

void Opie::OPimContactAccessBackend_XML::clear  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 169 of file ocontactaccessbackend_xml.cpp.

References QDict< type >::clear(), m_changed, m_contactList, and m_uidToContact.

OPimContact Opie::OPimContactAccessBackend_XML::find int  uid  )  const
 

Definition at line 199 of file ocontactaccessbackend_xml.cpp.

References QDict< type >::find(), and m_uidToContact.

Referenced by load().

bool Opie::OPimContactAccessBackend_XML::load const QString  filename,
bool  isJournal
[private]
 

Definition at line 325 of file ocontactaccessbackend_xml.cpp.

References ACTION_ADD, ACTION_REMOVE, ACTION_REPLACE, addContact_p(), Qtopia::AddressCategory, Qtopia::AddressUid, Qtopia::Anniversary, Qtopia::Assistant, Opie::XMLElement::attributes(), QMap< Key, T >::begin(), Qtopia::Birthday, Qtopia::BusinessCity, Qtopia::BusinessCountry, Qtopia::BusinessFax, Qtopia::BusinessMobile, Qtopia::BusinessPager, Qtopia::BusinessPhone, Qtopia::BusinessState, Qtopia::BusinessStreet, Qtopia::BusinessWebPage, Qtopia::BusinessZip, Qtopia::Children, QMap< Key, T >::clear(), Qtopia::Company, Qtopia::DefaultEmail, Qtopia::Department, Qtopia::Emails, QMap< Key, T >::end(), Qtopia::FileAs, find(), Opie::XMLElement::firstChild(), Qtopia::FirstName, QString::fromLatin1(), Qtopia::Gender, Qtopia::HomeCity, Qtopia::HomeCountry, Qtopia::HomeFax, Qtopia::HomeMobile, Qtopia::HomePhone, Qtopia::HomeState, Qtopia::HomeStreet, Qtopia::HomeWebPage, Qtopia::HomeZip, QMap< Key, T >::insert(), QAsciiDict< type >::insert(), Qtopia::JobTitle, l, QFileInfo::lastModified(), Qtopia::LastName, Opie::XMLElement::load(), m_readtime, Qtopia::Manager, Qtopia::MiddleName, Opie::XMLElement::nextChild(), Qtopia::Nickname, Qtopia::Notes, oendl, Qtopia::Office, owarn, Qtopia::Profession, remove(), replace(), QPtrCollection::setAutoDelete(), Qtopia::Record::setCustomField(), Qtopia::Spouse, Qtopia::Suffix, Opie::XMLElement::tagName(), Qtopia::Title, and TRUE.

bool Opie::OPimContactAccessBackend_XML::load  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 150 of file ocontactaccessbackend_xml.cpp.

References QDict< type >::clear(), m_contactList, m_fileName, m_journalName, and m_uidToContact.

Referenced by OPimContactAccessBackend_XML(), and reload().

UIDArray Opie::OPimContactAccessBackend_XML::matchRegexp const QRegExp r  )  const [virtual]
 

Reimplemented from Opie::OPimAccessBackend< OPimContact >.

Definition at line 213 of file ocontactaccessbackend_xml.cpp.

References m_contactList.

bool Opie::OPimContactAccessBackend_XML::reload  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 311 of file ocontactaccessbackend_xml.cpp.

References load().

bool Opie::OPimContactAccessBackend_XML::remove int  uid  ) 
 

Definition at line 295 of file ocontactaccessbackend_xml.cpp.

References ACTION_REMOVE, QDict< type >::find(), m_changed, m_contactList, m_uidToContact, QDict< type >::remove(), and updateJournal().

Referenced by load().

void Opie::OPimContactAccessBackend_XML::removeJournal  )  [private]
 

Definition at line 529 of file ocontactaccessbackend_xml.cpp.

References QFile::exists(), f, m_journalName, and QFile::remove().

Referenced by save().

bool Opie::OPimContactAccessBackend_XML::replace const OPimContact contact  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 275 of file ocontactaccessbackend_xml.cpp.

References ACTION_REPLACE, QDict< type >::find(), QDict< type >::insert(), m_changed, m_contactList, m_uidToContact, QDict< type >::remove(), Qtopia::Record::uid(), and updateJournal().

Referenced by load().

bool Opie::OPimContactAccessBackend_XML::save  )  [virtual]
 

Implements Opie::OPimAccessBackend< OPimContact >.

Definition at line 83 of file ocontactaccessbackend_xml.cpp.

References QFile::close(), f, IO_Raw, IO_WriteOnly, QString::latin1(), QCString::length(), m_changed, m_contactList, m_fileName, QFile::open(), out, QFile::remove(), removeJournal(), QString::utf8(), and QFile::writeBlock().

void Opie::OPimContactAccessBackend_XML::updateJournal const OPimContact cnt,
journal_action  action
[private]
 

Definition at line 501 of file ocontactaccessbackend_xml.cpp.

References buf, created, QFile::exists(), f, IO_Append, IO_WriteOnly, QCString::length(), m_journalName, QString::number(), QFile::open(), Opie::OPimContact::save(), str, QString::utf8(), and QFile::writeBlock().

Referenced by add(), remove(), and replace().

bool Opie::OPimContactAccessBackend_XML::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 Opie::OPimContactAccessBackend.

Definition at line 177 of file ocontactaccessbackend_xml.cpp.

References QFileInfo::lastModified(), m_fileName, and m_readtime.


Member Data Documentation

QString Opie::OPimContactAccessBackend_XML::m_appName [protected]
 

Definition at line 91 of file ocontactaccessbackend_xml.h.

Referenced by OPimContactAccessBackend_XML().

bool Opie::OPimContactAccessBackend_XML::m_changed [protected]
 

Definition at line 88 of file ocontactaccessbackend_xml.h.

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

QList<OPimContact> Opie::OPimContactAccessBackend_XML::m_contactList [protected]
 

Definition at line 92 of file ocontactaccessbackend_xml.h.

Referenced by addContact_p(), allRecords(), clear(), load(), matchRegexp(), OPimContactAccessBackend_XML(), remove(), replace(), and save().

QString Opie::OPimContactAccessBackend_XML::m_fileName [protected]
 

Definition at line 90 of file ocontactaccessbackend_xml.h.

Referenced by load(), OPimContactAccessBackend_XML(), save(), and wasChangedExternally().

QString Opie::OPimContactAccessBackend_XML::m_journalName [protected]
 

Definition at line 89 of file ocontactaccessbackend_xml.h.

Referenced by load(), OPimContactAccessBackend_XML(), removeJournal(), and updateJournal().

QDateTime Opie::OPimContactAccessBackend_XML::m_readtime [protected]
 

Definition at line 93 of file ocontactaccessbackend_xml.h.

Referenced by load(), and wasChangedExternally().

QDict<OPimContact> Opie::OPimContactAccessBackend_XML::m_uidToContact [protected]
 

Definition at line 95 of file ocontactaccessbackend_xml.h.

Referenced by addContact_p(), clear(), find(), load(), OPimContactAccessBackend_XML(), remove(), and replace().


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