• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kpilot

DataProxy Class Reference

#include <dataproxy.h>

Inheritance diagram for DataProxy:

Inheritance graph
[legend]

List of all members.


Detailed Description

Definition at line 40 of file dataproxy.h.


Public Types

enum  Mode { All = 1, Modified = 2 }

Public Member Functions

virtual void addCategory (Record *rec, const QString &category)=0
QMap< QString, QString > changedIds ()
bool commit ()
const CUDCounter * counter () const
QString create (Record *record)
virtual bool createDataStore ()=0
 DataProxy ()
Record * find (const QString &id) const
bool hasNext () const
QList< QString > ids () const
virtual bool isOpen () const =0
virtual void loadAllRecords ()=0
Record * next ()
unsigned int recordCount () const
void remove (const QString &id)
void resetIterator ()
bool rollback ()
virtual void setCategory (Record *rec, const QString &category)=0
void setEndcount ()
void setIterateMode (const Mode m=All)
virtual void syncFinished ()
void update (const QString &id, Record *record)
virtual ~DataProxy ()

Protected Member Functions

virtual bool _commit ()
bool _rollback ()
virtual bool commitCreate (Record *rec)=0
virtual bool commitDelete (Record *rec)=0
virtual bool commitUpdate (Record *rec)=0
virtual QString generateUniqueId ()=0

Protected Attributes

QMap< QString, QString > fChangedIds
CUDCounter fCounter
QMap< QString, bool > fCreated
QMap< QString, bool > fDeleted
QMap< QString, Record * > fDeletedRecords
QMapIterator< QString, Record * > fIterator
Mode fMode
QMap< QString, Record * > fOldRecords
QMap< QString, Record * > fRecords
QMap< QString, bool > fUpdated

Member Enumeration Documentation

enum DataProxy::Mode

Enumerator:
All 
Modified 

Definition at line 42 of file dataproxy.h.


Constructor & Destructor Documentation

DataProxy::DataProxy (  ) 

Definition at line 33 of file dataproxy.cc.

DataProxy::~DataProxy (  )  [virtual]

Definition at line 38 of file dataproxy.cc.


Member Function Documentation

virtual bool DataProxy::_commit (  )  [inline, protected, virtual]

This can be reimplemented by subclasses to do things after the regular commit action.

This method is called by commit() after the changes to records are committed.

WARNING: Please make sure that you do nothing with records unless: a) you know what you are doing. b) you *really* have to

Reimplemented in HHDataProxy.

Definition at line 192 of file dataproxy.h.

bool DataProxy::_rollback (  )  [inline, protected]

This can be implemented by subclasses to undo things from _commit().

This methdo is called by rollback() after the changes to the records are undone.

Reimplemented in HHDataProxy.

Definition at line 198 of file dataproxy.h.

virtual void DataProxy::addCategory ( Record *  rec,
const QString &  category 
) [pure virtual]

Adds the given category to the record and might do some internal things needed for category handling in the datastore.

All other categories that might have been set to this record should be unchanged.

Implemented in HHDataProxy, CalendarAkonadiProxy, ContactsAkonadiProxy, and TodoAkonadiProxy.

QMap< QString, QString > DataProxy::changedIds (  ) 

After a commit/rollback this returns a list of pairs with ids that have changed.

The keys are the old ids and the values are the new ids for the records. Note: before a commit or a rollback the list is cleared.

Definition at line 390 of file dataproxy.cc.

bool DataProxy::commit (  ) 

Commits all changes to the data store.

Definition at line 198 of file dataproxy.cc.

virtual bool DataProxy::commitCreate ( Record *  rec  )  [protected, pure virtual]

Commits created record rec to the datastore.

Returns the id that the data store created for this record.

Returns:
true when the record was succesfully added to the datastore managed by this proxy, false otherwise.

Implemented in AkonadiDataProxy, and HHDataProxy.

virtual bool DataProxy::commitDelete ( Record *  rec  )  [protected, pure virtual]

Delete record rec from the datastore.

Returns:
true when the record is succesfully deleted from the datastore managed by this proxy, false otherwise.

Implemented in AkonadiDataProxy, and HHDataProxy.

virtual bool DataProxy::commitUpdate ( Record *  rec  )  [protected, pure virtual]

Commits updated record rec to the datastore.

Must return rec->id() even if it's unchanged.

Returns:
true when the changes are succesfully committed to the datastore managed by this proxy, false otherwise.

Implemented in AkonadiDataProxy, and HHDataProxy.

const CUDCounter * DataProxy::counter (  )  const

Returns the CUDCounter.

Because the dataproxy is the only one who is authorized to change it the pointer is const.

Definition at line 114 of file dataproxy.cc.

QString DataProxy::create ( Record *  record  ) 

Adds the record to the database and returns the internal id for the added record.

This method resets the iterator.

Definition at line 45 of file dataproxy.cc.

virtual bool DataProxy::createDataStore (  )  [pure virtual]

Tries to create a new Datastore and returns whether or not it succeeded.

Implemented in AkonadiDataProxy, CalendarHHDataProxy, ContactsHHDataProxy, KeyringHHDataProxy, TodoHHDataProxy, and ContactsHHDataProxy.

Record * DataProxy::find ( const QString &  id  )  const

Looks for a matching record.

Should return 0L if there is no match.

Definition at line 140 of file dataproxy.cc.

virtual QString DataProxy::generateUniqueId (  )  [protected, pure virtual]

Generates a unique id for a new record.

Implemented in AkonadiDataProxy, and HHDataProxy.

bool DataProxy::hasNext (  )  const

Depending on the iterateMode it should give if there is a next record or if there is a next modified/deleted record.

Definition at line 151 of file dataproxy.cc.

QList< QString > DataProxy::ids (  )  const

Returns the list with ids from the records in the proxy.

Definition at line 109 of file dataproxy.cc.

virtual bool DataProxy::isOpen (  )  const [pure virtual]

Returns true when the proxy was able to open the underlying data store in read/write mode.

Implemented in AkonadiDataProxy, and HHDataProxy.

virtual void DataProxy::loadAllRecords (  )  [pure virtual]

Loads all records from underlying data source, sets the startcount of the counter and resets the iterator.

Implemented in AkonadiDataProxy, and HHDataProxy.

Record * DataProxy::next (  ) 

Depending on the iterateMode it should give the next record, the next modified/deleted record or 0L if there are no more records to iterate over.

Definition at line 175 of file dataproxy.cc.

unsigned int DataProxy::recordCount (  )  const

Returns the record count.

Keep in mind that if there are uncommitted changes this may differ from the record count of the actual datastore.

Definition at line 135 of file dataproxy.cc.

void DataProxy::remove ( const QString &  id  ) 

Deletes record with id from the database.

This method resets the iterator.

Definition at line 66 of file dataproxy.cc.

void DataProxy::resetIterator (  ) 

Resets the iterator.

Definition at line 146 of file dataproxy.cc.

bool DataProxy::rollback (  ) 

Reverts all changes that are committed to the data store.

Definition at line 312 of file dataproxy.cc.

virtual void DataProxy::setCategory ( Record *  rec,
const QString &  category 
) [pure virtual]

Sets the given category as the only category to the record and might do some internal things needed for category handling in the datastore.

All other categories that might have been set to this record should be removed.

Implemented in HHDataProxy, CalendarAkonadiProxy, ContactsAkonadiProxy, and TodoAkonadiProxy.

void DataProxy::setEndcount (  ) 

Sends the endcount for the CUD counter.

Definition at line 121 of file dataproxy.cc.

void DataProxy::setIterateMode ( const Mode  m = All  ) 

Sets the mode which is used to iterate over the loaded records.

It defaults to iterate over all records.

Definition at line 128 of file dataproxy.cc.

virtual void DataProxy::syncFinished (  )  [inline, virtual]

Notifies the proxy that the synchronization is finished and that no modifications will be done after this.

Reimplemented in AkonadiDataProxy, and HHDataProxy.

Definition at line 89 of file dataproxy.h.

void DataProxy::update ( const QString &  id,
Record *  record 
)

Updates the fields of record with id with the fields from record.

This method resets the iterator.

Definition at line 87 of file dataproxy.cc.


Member Data Documentation

QMap<QString, QString> DataProxy::fChangedIds [protected]

The list of ids that has changed during a commit or a rollback.

Definition at line 264 of file dataproxy.h.

CUDCounter DataProxy::fCounter [protected]

Definition at line 228 of file dataproxy.h.

QMap<QString, bool> DataProxy::fCreated [protected]

Id's from created records.

The bool indicates whether or not the created records are committed to the data store.

Definition at line 237 of file dataproxy.h.

QMap<QString, bool> DataProxy::fDeleted [protected]

Id's from deleted records.

The bool indicates whether or not the records are deleted from the data store.

Definition at line 259 of file dataproxy.h.

QMap<QString, Record*> DataProxy::fDeletedRecords [protected]

Deleted records;.

Definition at line 253 of file dataproxy.h.

QMapIterator<QString, Record*> DataProxy::fIterator [protected]

Definition at line 230 of file dataproxy.h.

Mode DataProxy::fMode [protected]

Definition at line 227 of file dataproxy.h.

QMap<QString, Record*> DataProxy::fOldRecords [protected]

Old values of updated records.

Definition at line 242 of file dataproxy.h.

QMap<QString, Record*> DataProxy::fRecords [protected]

Definition at line 229 of file dataproxy.h.

QMap<QString, bool> DataProxy::fUpdated [protected]

Id's from updated records.

The bool indicates whether or not the updated records are committed to the data store.

Definition at line 248 of file dataproxy.h.


The documentation for this class was generated from the following files:
  • dataproxy.h
  • dataproxy.cc

kpilot

Skip menu "kpilot"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal