Location:
agclient.h
Link against: agnmodel.lib
RAgendaServ
Supported from 5.0
The client interface to the agenda server. The agenda model can be used to access agenda data directly (when operating in normal mode) or indirectly, via the agenda server (when in client mode). A client-server architecture was added to the agenda model in order to allow shared access to an agenda file by more than one client. The existing architecture was maintained alongside the new architecture to allow for compatibility with existing software.
When the model is in client mode, it accesses agenda data by sending an asynchronous request to the server. When in normal mode, it accesses the data directly and exclusively. It is recommended that the model should always be used in client mode.
Most server functions should not be called directly — use the corresponding model function instead. This will route the call to the server, if appropriate.
The functions documented here are part of the client side API to the agenda server. They offer functionality which is not accessible using the model.
Note that a separate instance of the RAgendaServ
class
is required for each agenda file that is open — only one file can
be open at any one time in the same server session.
The API can be used as follows: —
RAgendaServ* agnServer = RAgendaServ::NewL(); // allocate and construct server
CleanupStack::PushL(agnServer);
agnServer->Connect(); // connect to the agenda server
CleanupClosePushL(*agnServer); // guarantees that the server's Close() method gets called
CAgnEntryModel* model = CAgnEntryModel::NewL(); // allocate and construct model
CleanupStack::PushL(model);
model->SetServer(agnServer); // set server pointer for model
model->OpenL(fileName) // Open file using server
// ...Use agenda model API as normal - invokes corresponding server functions
CleanupStack::PopAndDestroy(3); // model, close session with server, agnServer
|
Defined in RAgendaServ
:
CloseAgenda()
, CloseWriteStreamL()
, CompactFile()
, Connect()
, CreateDateIterator()
, CreateEntryIterator()
, CreateNewStreamL()
, DateIteratorAtEnd()
, DateIteratorAtStart()
, DateIteratorCurrentElement()
, DateIteratorCurrentKey()
, DateIteratorGoto()
, DateIteratorGotoLessOrEqual()
, DateIteratorNext()
, DateIteratorPrevious()
, DeleteEntry()
, DeleteTodoList()
, EntryIteratorNext()
, EntryIteratorPosition()
, EntryIteratorStreamCount()
, EntryIteratorStreamCurrent()
, FileIsReadOnly()
, FileLoaded()
, GetEntryId()
, GetUniqueId()
, GetWriteStreamL()
, HasUniqueIdBeenDeleted()
, NewL()
, StartNotifierL()
, TypeByUniqueId()
, UniqueIdLastChangedDate()
, WaitUntilLoaded()
, ~RAgendaServ()
Inherited from RHandleBase
:
Close()
,
Duplicate()
,
Handle()
,
SetHandle()
Inherited from RSessionBase
:
Attach()
,
CreateSession()
,
EAutoAttach
,
EExplicitAttach
,
Send()
,
SendReceive()
,
SetRetry()
,
Share()
,
TAttachMode
static RAgendaServ* NewL();
Constructs a new RAgendaServ
, initialising all
member data to NULL.
|
~RAgendaServ();
The destructor frees all resources owned by the server, prior to its destruction.
TInt Connect();
Connects the client process to the agenda server. A connection must be made before the server can be used.
|
TBool CompactFile();
Compacts the agenda file. The server carries out the compaction in the
background using a CIdle
object.
|
void WaitUntilLoaded();
Waits until the server has finished loading the file. Because the server loads files asynchronously, for large files there is a chance that the indexes are still being built when the client begins fetching entries. This function also causes the model's indexes to be built.
TBool FileLoaded();
Tests whether a file is open in the current agenda server session.
|
TBool FileIsReadOnly();
Tests whether the currently open file is read only.
|
CAgnEntry::TType TypeByUniqueId(TAgnUniqueId aUniqueId);
Retrieves an entry's type by its unique ID.
|
|
TBool HasUniqueIdBeenDeleted(TAgnUniqueId aUniqueId);
Tests whether an entry, identified by its unique ID, has been both synchronised and deleted.
This function is provided for synchronisation. If it returns true, the synchroniser can delete the corresponding entry on the PC.
|
|
TAgnDateTime UniqueIdLastChangedDate(TAgnUniqueId aUniqueId);
Retrieves the date an entry was last changed. The entry is identified by its unique ID.
|
|
TAgnEntryId GetEntryId(TAgnUniqueId aUniqueId);
Supported from 6.0
Retrieves an entry's entry ID, given its unique ID.
|
|
TAgnUniqueId GetUniqueId(TAgnEntryId aEntryId);
TAgnUniqueId GetUniqueId(TAgnTodoListId aTodoId);
Retrieves an entry or to-do list's unique ID, given its entry or to-do list ID.
|
|
void DeleteEntry(TAgnUniqueId aUid);
Withdrawn in 6.0
Deletes an entry, identified by its unique ID.
|
TInt DeleteEntry(TAgnUniqueId aUid);
Supported from 6.0
Deletes an entry, identified by its unique ID.
|
|
void DeleteTodoList(TAgnUniqueId aUid);
Withdrawn in 6.0
Deletes a to-do list, identified by its unique ID.
|
TInt DeleteTodoList(TAgnUniqueId aUid);
Supported from 6.0
Deletes a to-do list, identified by its unique ID.
|
|
void StartNotifierL(TCallBack aCallback, TInt aFrequency = KNotifierUpdateFrequency);
Starts notification of updates to the agenda server. Once notification
has started, the server will notify the client of any changes made by other
clients. The server will be polled at the given frequency for updates to the
model, and if no value is specified for the parameter, it defaults
toKNotifierUpdateFrequency
(5 seconds).
|
TStreamId CreateNewStreamL(TUid aStreamUid);
Creates a new write stream with the specified stream UID in the agenda
file. The stream can be opened for writing
usingGetWriteStreamL()
.
|
|
RWriteStream& GetWriteStreamL(TStreamId aStreamId);
Opens a stream which has been created
usingCreateNewStreamL()
for writing.
Note
The stream ID aStreamId
is returned
byCreateNewStreamL()
. It can also be obtained from the stream UID
by calling the CAgnEntryModel::StreamId()
method.
|
|
void CloseWriteStreamL();
Closes the previously opened write stream and sends the entire stream to the server for saving to file.
TBool CreateEntryIterator();
Creates an iterator for iterating though all the entries in the file.
This may be used for activities such as merging or finding. The function
returns EFalse
if no entries are available. If any entries are
available, the iterator is set to the first entry in the model.
Note
When the model is in client mode, this and the following functions should
be used for entry iteration. You should not use the
TAgnEntryIter
class directly because this does not use the
server.
|
TBool EntryIteratorNext();
Moves the entry iterator to the next entry. Returns EFalse
if
no more entries exist.
|
TAgnEntryId EntryIteratorPosition();
Retrieves the ID for the entry at the current iterator position. The ID
can be used to retrieve the entry
usingCAgnEntryModel::FetchEntryL()
.
|
TInt EntryIteratorStreamCount();
Retrieves a count of the total number of streams that contain entries, and need to be iterated through.
This value can be used in combination
withEntryIteratorStreamCurrent()
to calculate the amount of
processing remaining, for use in progress indicators.
|
TInt EntryIteratorStreamCurrent();
Retrieves the index of the current stream being processed. The first stream has an index of 1.
This figure can be used in combination with the value returned
byEntryIteratorStreamCount()
to calculate the amount of processing
remaining, for use in progress indicators.
|
void CreateDateIterator(TTime aToday, TAgnFilter* aFilter, TAgnDate aTidyStartDate);
Creates a date iterator. A date iterator is used to iterate through
entries according to their date. The iterator is set to the date specified
inaTidyStartDate
. The filter aFilter
is used to
specify which entry types should be included. The value of the
aToday
parameter should be set to the current
date/time.
|
void DateIteratorPrevious();
Moves the date iterator to the previous entry. A panic occurs if there are no previous entries.
void DateIteratorNext();
Moves the date iterator to the next entry. A panic occurs if there are no more entries.
TBool DateIteratorAtStart();
Tests whether the date iterator is at the first entry in the list of entries.
|
TBool DateIteratorAtEnd();
Tests whether the date iterator is at the last entry in the list of entries.
|
TAgnDate DateIteratorCurrentKey();
Retrieves the date of the entry at the current iterator position.
ATAgnDate
is the number of days since the start of the date range
for agenda entries (1/1/1980). To convert between a TAgnDate
and
other time-related classes, for instance TTime
, use the static
functions provided by class AgnDateTime
(defined in the header
file agmdate.h).
|
CAgnSortEntry* DateIteratorCurrentElement(CAgnSortEntryAllocator* aAllocator);
Retrieves the entry at the current iterator position.
|
|
void DateIteratorGoto(TAgnDate aDate);
Sets the iterator to the entry at the date specified, or the entry at the closest following date if there is no matching entry at the date specified.
|
void DateIteratorGotoLessOrEqual(TAgnDate aDate);
Sets the iterator to the entry at the date specified, or the entry at the closest previous date if there is no matching entry at the date specified.
|