1.1 --- a/epoc32/include/cntdb.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,1427 +0,0 @@
1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#ifndef __CNTDB_H__
1.20 -#define __CNTDB_H__
1.21 -
1.22 -// System includes
1.23 -#include <e32base.h>
1.24 -#include <cntdef.h>
1.25 -#include <cntdbobs.h>
1.26 -#include <cntsync.h>
1.27 -#include <s32file.h>
1.28 -#include <badesca.h>
1.29 -#include <versit.h>
1.30 -#include <collate.h>
1.31 -
1.32 -#include <ecom/ecom.h>
1.33 -
1.34 -// Classes referenced
1.35 -//
1.36 -class CContactViewDef;
1.37 -class CFoundMatches;
1.38 -class CContactTextDef;
1.39 -class CContactItem;
1.40 -class CContactItemViewDef;
1.41 -class CContactItemFieldSet;
1.42 -class CContactItemFieldDef;
1.43 -class CContactActiveCompress;
1.44 -class CContactActiveRecover;
1.45 -class CContactDatabase;
1.46 -class CContactTables;
1.47 -class CCntFilter;
1.48 -class CContentType;
1.49 -class CContactItemField;
1.50 -class CIdleFinder;
1.51 -class CContactClientSession;
1.52 -class CPrivConverter;
1.53 -class RCntModel;
1.54 -class CProxyFactory;
1.55 -class CCntTemplateCache;
1.56 -class CSortArray;
1.57 -class CCntIdleSorter;
1.58 -class MLplPersistenceLayerFactory;
1.59 -class CContactOpenOperation;
1.60 -class CDataBaseChangeObserver;
1.61 -class CContactConverter;
1.62 -
1.63 -// Constants
1.64 -const TInt KMaxContactTextSeperator=4;
1.65 -const TInt KTextFieldMinimalLength=64;
1.66 -const TInt KMaxCustomFilterableFields=4;
1.67 -
1.68 -const TInt KMajorVersion=1;
1.69 -const TInt KMinorVersion=0;
1.70 -const TInt KBuildNumber=40;
1.71 -
1.72 -
1.73 -//
1.74 -// Classes used for compact
1.75 -//
1.76 -
1.77 -class MContactStorageObserver
1.78 -/**
1.79 -Mixin used to observe low disk events
1.80 -
1.81 -@publishedAll
1.82 -@released
1.83 -*/
1.84 - {
1.85 -public:
1.86 - virtual void HandleDiskSpaceEvent(TInt aDrive) = 0;
1.87 - };
1.88 -
1.89 -class MContactUiCompactObserver
1.90 -/** Mixin used to observe contact database compaction status
1.91 -@publishedAll
1.92 -@released
1.93 -*/
1.94 - {
1.95 -public:
1.96 - virtual void Step(TInt aStep)=0;
1.97 - virtual void HandleError(TInt aError)=0;
1.98 - };
1.99 -
1.100 -class MContactUiActive
1.101 -/** Mixin used to register the observer.
1.102 -@publishedAll
1.103 -@released
1.104 -*/
1.105 - {
1.106 -public:
1.107 - virtual void Cancel()=0;
1.108 - virtual void SetObserver(MContactUiCompactObserver *aObserver)=0;
1.109 - virtual TInt StepsTogo() const=0;
1.110 - virtual TInt Step()=0;
1.111 - virtual TInt Error() const=0;
1.112 -private:
1.113 - IMPORT_C virtual void MContactUiActive_Reserved1();
1.114 - };
1.115 -
1.116 -class CContactActiveBase : public CBase, public MContactUiActive
1.117 -/**
1.118 -@internalTechnology
1.119 -*/
1.120 - {
1.121 -public:
1.122 - ~CContactActiveBase();
1.123 - void SetObserver(MContactUiCompactObserver *aObserver);
1.124 - void Cancel();
1.125 - TInt StepsTogo() const;
1.126 - TInt Step();
1.127 - TInt Error() const;
1.128 - void SetContactDatabase(CContactDatabase* aContactDatabase);
1.129 - void SetFileManager(RCntModel& aCntSvr);
1.130 -
1.131 -#ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__
1.132 -protected:
1.133 - void ConstructL();
1.134 - static TInt CompactCallBack(TAny *aThis);
1.135 -protected:
1.136 - MContactUiCompactObserver *iObserver;
1.137 - RCntModel* iCntSvr;
1.138 - CIdle *iIdle;
1.139 - TInt iStep;
1.140 - TInt iError;
1.141 - CContactDatabase* iContactDatabase;
1.142 -#endif
1.143 - };
1.144 -
1.145 -class CContactActiveCompress : public CContactActiveBase
1.146 -/**
1.147 -@publishedAll
1.148 -@released
1.149 -*/
1.150 - {
1.151 -public:
1.152 -#if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ && defined __SYMBIAN_CNTMODEL_USE_SQLITE__ )
1.153 - void ConstructL(RDbNamedDatabase /* &aDataBase */) {};
1.154 -#endif
1.155 - };
1.156 -
1.157 -class CContactActiveRecover : public CContactActiveBase
1.158 -/**
1.159 -@publishedAll
1.160 -@released
1.161 -*/
1.162 - {
1.163 -public:
1.164 -#if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ && defined __SYMBIAN_CNTMODEL_USE_SQLITE__ )
1.165 - void ConstructL(RDbNamedDatabase /* &aDataBase */) {};
1.166 -#endif
1.167 - };
1.168 -
1.169 -
1.170 -
1.171 -
1.172 -class TContactTextDefItem
1.173 -/** An item in a text definition.
1.174 -
1.175 -A TContactTextDefItem has a field type and an optional separator string
1.176 -with a maximum length of 4 characters.
1.177 -
1.178 -@see CContactTextDef
1.179 -@publishedAll
1.180 -@released
1.181 -*/
1.182 - {
1.183 -public:
1.184 - IMPORT_C TContactTextDefItem();
1.185 - IMPORT_C TContactTextDefItem(TFieldType aFieldType);
1.186 - IMPORT_C TContactTextDefItem(TFieldType aFieldType, const TDesC &aSeperator);
1.187 -public:
1.188 - /** The field type. */
1.189 - TFieldType iFieldType;
1.190 - /** The string used to separate the fields in the text definition. */
1.191 - TBuf<KMaxContactTextSeperator> iSeperator;
1.192 - };
1.193 -
1.194 -class CContactTextDef : public CArrayFixFlat<TContactTextDefItem>
1.195 -/** Defines a way of grouping fields to form a string which represents
1.196 -a contact item.
1.197 -
1.198 -A text definition is implemented as an array of text definition items
1.199 -(TContactTextDefItems).
1.200 -
1.201 -For example, CContactDatabase::ReadContactTextDefL() uses a text definition to
1.202 -build up a string from a contact item. When creating the string, it searches
1.203 -the item for fields whose type matches one of the fields specified in the text
1.204 -definition. The contents of the first matching field of each type found in the
1.205 -item are read into the string. These strings may be separated using a field
1.206 -separator, which is also specified in the text definition. A separator is not
1.207 -appended to the last field used to make up the string. It is only inserted when
1.208 -there is a following non-empty field.
1.209 -
1.210 -Additionally, the text definition may also contain a fallback field
1.211 -type. This is used when none of the fields specified in the text
1.212 -definition contain any text. If the item's fallback field contains no text
1.213 -either, or if the fallback field type's value is KUidContactFieldNone, the
1.214 -text is read from the first non-empty field in the item.
1.215 -
1.216 -A contact database can have a default text definition which is set using CContactDatabase::SetTextDefinitionL().
1.217 -This may be overridden using the variants of CContactDatabase::ReadContactTextDefL()
1.218 -which take a CContactTextDef* argument.
1.219 -
1.220 -CContactTextDef is derived from CArrayFixFlat<TContactTextDefItem>, so all
1.221 -relevant functions can be used, e.g. to add and remove elements.
1.222 -
1.223 -@publishedAll
1.224 -@released
1.225 -*/
1.226 - {
1.227 - friend class CContactDatabase;
1.228 - friend class CContactTables;
1.229 -public:
1.230 - CContactTextDef();
1.231 - IMPORT_C static CContactTextDef* NewL();
1.232 - IMPORT_C static CContactTextDef* NewLC();
1.233 - static CContactTextDef* NewLC(RReadStream& aStream);
1.234 - IMPORT_C void SetFallbackField(TFieldType iFieldType);
1.235 - IMPORT_C TFieldType FallbackField() const;
1.236 - IMPORT_C TBool ExactMatchOnly();
1.237 - IMPORT_C void SetExactMatchOnly(TBool aExactMatchOnly);
1.238 - void ExternalizeL(RWriteStream& aStream) const;
1.239 - void InternalizeL(RReadStream& aStream);
1.240 -private:
1.241 - TFieldType iFallbackFieldType;
1.242 - TBool iExactMatchOnly;//Default to EFalse cause ReadInTextDef to only match the chosen fields and not attempt a matchall
1.243 - };
1.244 -
1.245 -class CContactItemViewDef : public CBase
1.246 -/** A view definition for a contact item.
1.247 -
1.248 -When reading or opening a contact item using the CContactDatabase class,
1.249 -a view definition may be specified to indicate which field data should be
1.250 -retrieved. See for instance CContactDatabase::ReadContactL().
1.251 -
1.252 -A view definition for a contact item contains an array of field types, a use
1.253 -(CContactItemViewDef::TUse) and a mode (CContactItemViewDef::TMode). The use
1.254 -indicates whether the field types contained in the view definition should
1.255 -be included in or excluded from the view. The mode indicates whether fields
1.256 -with the hidden attribute should be included or excluded.
1.257 -
1.258 -@publishedAll
1.259 -@released
1.260 -*/
1.261 - {
1.262 -public:
1.263 - /** Include or exclude specified fields. */
1.264 - enum TUse
1.265 - {
1.266 - /** Include specified fields in the view. */
1.267 - EIncludeFields,
1.268 - /** Exclude specified fields from the view. */
1.269 - EMaskFields
1.270 - };
1.271 - /** Include or exclude hidden fields.*/
1.272 - enum TMode
1.273 - {
1.274 - /** Include hidden fields in the view. */
1.275 - EIncludeHiddenFields,
1.276 - /** Exclude hidden fields from the view. */
1.277 - EMaskHiddenFields
1.278 - };
1.279 -public:
1.280 - IMPORT_C static CContactItemViewDef* NewL(TUse aUse, TMode aMode);
1.281 - IMPORT_C static CContactItemViewDef* NewLC(TUse aUse, TMode aMode);
1.282 - static CContactItemViewDef* NewLC(RReadStream& aStream);
1.283 - inline TUid operator[](TInt aIndex) const;
1.284 - IMPORT_C TInt Find(const CContentType &aContentType) const;
1.285 - IMPORT_C TInt Find(TFieldType aFieldType) const;
1.286 - inline TInt Count() const;
1.287 - inline void Reset();
1.288 - IMPORT_C void AddL(TFieldType aFieldType);
1.289 - IMPORT_C void Remove(TFieldType aFieldType);
1.290 - IMPORT_C void Remove(TInt aIndex);
1.291 - inline TUse Use() const;
1.292 - inline void SetUse(TUse aUse);
1.293 - inline TMode Mode() const;
1.294 - inline void SetMode(TMode aMode);
1.295 - IMPORT_C TBool Contains(const CContactItem& aItem);
1.296 - IMPORT_C void InternalizeL(RReadStream& aStream);
1.297 - IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.298 - IMPORT_C TBool MatchesAll() const;
1.299 -private:
1.300 - CContactItemViewDef(TUse aUse,TMode aMode);
1.301 -private:
1.302 - CArrayFixFlat<TUid> iFieldTypes;
1.303 - TUse iUse;
1.304 - TMode iMode;
1.305 - };
1.306 -
1.307 -class CContactViewDef : public CBase
1.308 -/** Specifies a subset of fields to be loaded when reading a contact item.
1.309 -
1.310 -A default view definition is owned by the contact database.
1.311 -It is set using CContactDatabase::SetViewDefinitionL() and is used in calls
1.312 -to CContactDatabase::ReadContactL(), ReadContactLC() and ReadContactAndAgentL()
1.313 -when no view definition is specified.
1.314 -
1.315 -The view definition owns the item view definition (see the CContactItemViewDef
1.316 -class), which stores the view definition's field types, use and mode.
1.317 -
1.318 -The following functions declared in class CContactViewDef have not been
1.319 -implemented:- Groups(), AddL().
1.320 -
1.321 -@publishedAll
1.322 -@released
1.323 -*/
1.324 - {
1.325 -public:
1.326 - IMPORT_C static CContactViewDef* NewL();
1.327 - IMPORT_C static CContactViewDef* NewLC();
1.328 - IMPORT_C static CContactViewDef* NewL(CContactItemViewDef* aItemDef);
1.329 - IMPORT_C static CContactViewDef* NewLC(CContactItemViewDef* aItemDef);
1.330 - static CContactViewDef* NewLC(RReadStream& aStream);
1.331 - IMPORT_C ~CContactViewDef();
1.332 - IMPORT_C void InternalizeL(RReadStream& aStream);
1.333 - IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.334 - IMPORT_C CContactItemViewDef& ItemDef() const;
1.335 - /** This function is not implemented */
1.336 - IMPORT_C CContactIdArray& Groups() const;
1.337 - /** This function is not implemented.
1.338 - @param aFieldType The field type to append to the array of field types. */
1.339 - inline void AddL(TFieldType aFieldType);
1.340 -private:
1.341 - CContactViewDef();
1.342 - void ConstructL(CContactItemViewDef* aItemDef);
1.343 -private:
1.344 - CContactItemViewDef* iItemDef;
1.345 -// CContactIdArray* iGroupIds; // unused for now
1.346 - };
1.347 -
1.348 -class TContactIter
1.349 -/** Iterates through the sorted contact items in a contact database.
1.350 -
1.351 -A value of KNullContactId is returned by the iterator if a requested item cannot
1.352 -be found.
1.353 -
1.354 -@publishedAll
1.355 -@released
1.356 -*/
1.357 - {
1.358 -public:
1.359 - IMPORT_C TContactIter(CContactDatabase &aDatabase);
1.360 - IMPORT_C TContactItemId FirstL();
1.361 - IMPORT_C TContactItemId NextL();
1.362 - IMPORT_C TContactItemId PreviousL();
1.363 - IMPORT_C TContactItemId LastL();
1.364 - IMPORT_C void GotoL(TContactItemId aContactId);
1.365 - IMPORT_C void Reset();
1.366 -private:
1.367 - void GotoIndexL(TInt aPos);
1.368 -private:
1.369 - CContactDatabase &iDatabase;
1.370 - TContactItemId iCursorId;
1.371 - };
1.372 -
1.373 -class MIdleFindObserver
1.374 -/** The interface for an asynchronous find observer.
1.375 -
1.376 -An object which implements this interface is passed to the asynchronous find
1.377 -functions defined in class CContactDatabase, (FindAsyncL() and FindInTextDefAsyncL()).
1.378 -The observer would typically notify the user of the progress of the operation.
1.379 -
1.380 -@publishedAll
1.381 -@released
1.382 -*/
1.383 - {
1.384 -public:
1.385 - /** Asynchronous find observer callback.
1.386 -
1.387 - If an observer is supplied to CContactDatabase::FindAsyncL()
1.388 - or FindInTextDefAsyncL(), this callback function is called by CIdle::RunL()
1.389 - when nothing of a higher priority can be scheduled. It is called for every
1.390 - 16 items searched to give the application a chance to update its search status.
1.391 -
1.392 - An implementation might test for and handle errors and retrieve information
1.393 - about the progress of the search. This information may be retrieved using
1.394 - functions provided by the CIdleFinder class. */
1.395 - virtual void IdleFindCallback()=0;
1.396 - };
1.397 -
1.398 -struct SFindInTextDefWordParser
1.399 -/** Search string parser struct.
1.400 -
1.401 -An object of this type is used in the callback parser function passed to
1.402 -CContactDatabase::FindInTextDefLC(). The parser function must walk
1.403 -through and parse iSearchString, adding any words found to iWordArray.
1.404 -
1.405 -@publishedAll
1.406 -@released
1.407 -*/
1.408 - {
1.409 -public:
1.410 - inline SFindInTextDefWordParser(const TDesC *aSearchString, CDesCArray *aWordArray) : iSearchString(aSearchString), iWordArray(aWordArray)
1.411 - /** Initialises the search string and the word array.
1.412 -
1.413 - @param aSearchString Pointer to the input string to be parsed.
1.414 - @param aWordArray Pointer to the array to which words parsed from the input
1.415 - string should be added. */
1.416 - {};
1.417 -public:
1.418 - /** Pointer to the input string to be parsed. */
1.419 - const TDesC *iSearchString;
1.420 - /** Pointer to the array to which words parsed from the input string should be
1.421 - added. */
1.422 - CDesCArray *iWordArray;
1.423 - };
1.424 -
1.425 -class CIdleFinder : public CIdle
1.426 -/** Provides information about the progress of an asynchronous contact database search,
1.427 -and can be used to get the results of the search.
1.428 -
1.429 -An instance of this class is returned by calls to CContactDatabase::FindAsyncL()
1.430 -and CContactDatabase::FindInTextDefAsyncL().
1.431 -
1.432 -@publishedAll
1.433 -@released
1.434 -*/
1.435 - {
1.436 -public:
1.437 - ~CIdleFinder();
1.438 - IMPORT_C TBool IsComplete() const;
1.439 - IMPORT_C CContactIdArray *TakeContactIds();
1.440 - IMPORT_C TInt Error() const;
1.441 - TInt RunError(TInt aError);
1.442 -private:
1.443 - friend class CContactDatabase;
1.444 - static CIdleFinder *NewL(CContactDatabase &aContactDatabase, const TDesC& aText, const CContactItemFieldDef *aFieldDef, MIdleFindObserver *aObserver);
1.445 - static CIdleFinder *NewL(CContactDatabase &aContactDatabase, const MDesCArray* aFindWords,const CContactTextDef* aTextDef, MIdleFindObserver *aObserver, const TCallBack &aWordParserCallback);
1.446 - void DoCancel();
1.447 - void Start();
1.448 - static TInt CallbackL(TAny *aSelf);
1.449 - void ConstructL(const TDesC *aText, const MDesCArray* aFindWords, const TCallBack *aWordParserCallback);
1.450 - TBool ScanForMatchL(const TDesC &aFieldText,const TDesC &aFindText, CFoundMatches *aFoundMatches) const;
1.451 - TBool CheckFindL(TContactItemId aContactId) const;
1.452 - TBool CheckFindL() const;
1.453 - CIdleFinder(CContactDatabase &aContactDatabase, const CContactItemFieldDef *aFieldDef, const CContactTextDef* aTextDef, MIdleFindObserver *aObserver);
1.454 - TBool doFindL();
1.455 -
1.456 - enum TAsyncFindState
1.457 - {
1.458 - EFindInBlobFinished =0x00000001,
1.459 - EFindInIdentityFinished =0x00000002,
1.460 - EFindInEmailFinished =0x00000004,
1.461 - EFindInTextDefFinished =0x00000008
1.462 - };
1.463 -private:
1.464 - CContactDatabase *iContactDatabase;
1.465 - CContactIdArray *iIdsFound;
1.466 - TBool iOwnsIds;
1.467 - CDesCArray* iFindWords;
1.468 - TInt iReserved1;
1.469 - TInt iReserved2;
1.470 - TInt iReserved3;
1.471 - const CContactItemFieldDef* iFieldDef;
1.472 - const CContactTextDef* iTextDef;
1.473 - MIdleFindObserver *iObserver;
1.474 - TInt iError;
1.475 - TCallBack iWordParserCallback;
1.476 - TInt iReserved4;
1.477 - TInt iReserved5;
1.478 - TInt iReserved6;
1.479 - TInt iReserved7; //was TDbColNo
1.480 - TInt iReserved8; //was RDbView
1.481 - TInt iReserved9; //was RDbView
1.482 - TInt iReserved10; //was CIdentityTableColSet*
1.483 - };
1.484 -
1.485 -class MContactDbPrivObserver
1.486 -/** Provides notification of database changes to clients.
1.487 -* Provides information about database change event details and the type of changed event.
1.488 -@publishedAll
1.489 -@released
1.490 -*/
1.491 - {
1.492 -public:
1.493 -
1.494 -#if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ && defined __SYMBIAN_CNTMODEL_USE_SQLITE__ )
1.495 - virtual void HandleDatabaseEventL(RDbNotifier::TEvent)=0;
1.496 -#endif
1.497 - virtual void HandleDatabaseEventL(const TContactDbObserverEvent &aEvent)=0;
1.498 - };
1.499 -
1.500 -
1.501 -class MContactSortObserver
1.502 -/**
1.503 -@publishedAll
1.504 -@deprecated
1.505 -*/
1.506 - {
1.507 -public:
1.508 - /**
1.509 - @deprecated
1.510 - */
1.511 - virtual void HandleSortEventL(TInt aContactsSorted, TInt aContactsTotal)=0;
1.512 - };
1.513 -
1.514 -class MConverterCallBack
1.515 -/**
1.516 -Interface class for providing Intra-Contact Properties during a PBAP specific contacts export.
1.517 -@prototype
1.518 -@internalTechnology
1.519 -*/
1.520 -{
1.521 - public:
1.522 - /**
1.523 - PBAP clients are supposed to provide any information regarding the contact item represented by aContactId.
1.524 - This information should be in form of standard vCard property, all such properties should be appended to the array aPropertyList.
1.525 - */
1.526 - virtual void AddIntraContactPropertiesL(const TContactItemId& aContactId, CArrayPtr<CParserProperty>* aPropertyList) = 0;
1.527 -};
1.528 -
1.529 -enum TVCardVersion
1.530 -/**
1.531 -Specifies type of export of contact items.
1.532 -PBAP clients should use EPBAPVCard21 and EPBAPVCard30.
1.533 -@prototype
1.534 -@internalTechnology
1.535 -*/
1.536 - {
1.537 - EVCardUDEF = -1,
1.538 - EVCard21 = 0,
1.539 - EVCard30,
1.540 - EPBAPVCard21,
1.541 - EPBAPVCard30
1.542 - };
1.543 -
1.544 -class CContactDatabase : public CBase, public MContactDbPrivObserver, public MContactStorageObserver
1.545 -/** A database of contact items.
1.546 -
1.547 -Contact items can be added to and removed from the database and items in the
1.548 -database can be opened or read. To edit an item, it must first be opened.
1.549 -Changes to the item can then be committed using CommitContactL()
1.550 -(committing can only take place to an open item).
1.551 -
1.552 -If the available disk space is less than 128 kilobytes then changes to the
1.553 -contact database cannot be started, and methods such as CreateL() or CommitContactL()
1.554 -will leave with a KErrDiskFull error. Less obviously OpenL() can also fail with
1.555 -KErrDiskFull when trying to update the system template.
1.556 -
1.557 -Each item has an access count. An item cannot be fully deleted unless its
1.558 -access count is zero. This is to prevent items which have been
1.559 -synchronised with another contacts application from being deleted.
1.560 -Also, if the item is a template, it cannot be deleted if other items are based
1.561 -on it.
1.562 -
1.563 -More than one contact database can exist on a phone, but there is a
1.564 -default contact database. Its filename is contacts.cdb. It
1.565 -can be moved between drives.
1.566 -
1.567 -CContactDatabase implements searching and sorting and also provides
1.568 -separate phone number matching functions. These provide a fast way of indexing
1.569 -and looking up phone numbers, e.g. for looking up caller IDs on incoming
1.570 -calls.
1.571 -
1.572 -The database owns speed dial information. This is a mapping between a single
1.573 -digit integer and a telephone number. There may be up to 9 speed dial telephone
1.574 -numbers; each of them belongs to a contact item in the database. If a
1.575 -contact item is deleted, its speed dial mapping is removed.
1.576 -
1.577 -The following functions defined in class CContactDatabase are not
1.578 -supported. If called, they leave with KErrNotSupported.
1.579 -
1.580 -- ReplacePrefL()
1.581 -
1.582 -- ReadPrefL()
1.583 -
1.584 -- CreatePrefL()
1.585 -
1.586 -@publishedAll
1.587 -@released
1.588 -*/
1.589 - {
1.590 - friend class TContactIter;
1.591 - friend class CIdleFinder;
1.592 - friend class CCntIdleSorter;
1.593 - friend class CContactLocalView;
1.594 - friend class CContactOpenOperation;
1.595 - friend class RContactRemoteView;
1.596 - friend class CViewIteratorProxyManager;
1.597 - friend class CCollectionProxy;
1.598 - friend class CContactActiveBase;
1.599 -public:
1.600 - class TSortPref
1.601 - /** Specifies the field type and order preferences used for sorting items in the
1.602 - contacts database.
1.603 -
1.604 - The contents of the first field in a contact item matching the field type
1.605 - is used as the data to sort on. The order can either be ascending or descending.
1.606 -
1.607 - @see CContactDatabase::SortL()
1.608 - @see CContactDatabase::SortArrayL()
1.609 - @publishedAll
1.610 - @deprecated
1.611 - */
1.612 - {
1.613 - public:
1.614 - /** The sort order. */
1.615 - enum TOrder
1.616 - {
1.617 - /** Ascending sort order. */
1.618 - EAsc,
1.619 - /** Descending sort order. */
1.620 - EDesc
1.621 - };
1.622 - public:
1.623 - inline TSortPref();
1.624 - inline TSortPref(TFieldType aFieldType,TOrder aOrder=EAsc);
1.625 - IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.626 - IMPORT_C void InternalizeL(RReadStream& aStream);
1.627 - public:
1.628 - /** Specifies whether the sort should be ascending or descending. */
1.629 - TOrder iOrder;
1.630 - /** The first field matching this field type is used for the text to sort on. */
1.631 - TFieldType iFieldType;
1.632 - };
1.633 -
1.634 - /** Import and export format flags. Contacts can be imported into
1.635 - or exported from the contact database as vCards.
1.636 -
1.637 - The following options are available during import and export.
1.638 -
1.639 - @deprecated This enum is deprecated. It has been replaced by the TOptions enum in
1.640 - the plugin convertor class CContactVCardConverter, so that each plugin converter
1.641 - can define its own options. */
1.642 - enum TOptions
1.643 - {
1.644 - EDefault=0x0000,
1.645 - /** Handle Symbian's extended vCard format options. */
1.646 - EIncludeX =0x0001,
1.647 - /** Support non-standard extensions requried by Symbian PC connectivity software
1.648 - and Microsoft, amongst others. */
1.649 - ETTFormat =0x0002,
1.650 - /** Don't export the contact ID (for exporting only). */
1.651 - EExcludeUid=0x0004,
1.652 - /** Decrease the contact's access count when importing and exporting. */
1.653 - EDecreaseAccessCount=0x0008,
1.654 - /** Only import the first contact in the read stream (for importing only). */
1.655 - EImportSingleContact=0x0010,
1.656 - /** Increase the contact's access count when importing and exporting. */
1.657 - EIncreaseAccessCount=0x0020,
1.658 - /** Sets a contact item to the local time when importing. */
1.659 - ELocalTime=0x0040,
1.660 - /** Allows you to set a template to a contact item that does not exist. */
1.661 - ENullTemplateId=0x0080,
1.662 - /** For use by implementor of converter plug-in. */
1.663 - EConverterDefined1=0x0100,
1.664 - /** For use by implementor of converter plug-in. */
1.665 - EConverterDefined2=0x0200,
1.666 - /** For use by implementor of converter plug-in. */
1.667 - EConverterDefined3=0x0400,
1.668 - /** For use by implementor of converter plug-in. */
1.669 - EConverterDefined4=0x0800,
1.670 - /** For use by implementor of converter plug-in. */
1.671 - EConverterDefined5=0x1000,
1.672 - /** For use by implementor of converter plug-in. */
1.673 - EConverterDefined6=0x2000,
1.674 - /** For use by implementor of converter plug-in. */
1.675 - EConverterDefined7=0x4000,
1.676 - /** For use by implementor of converter plug-in. */
1.677 - EConverterDefined8=0x8000,
1.678 - /** Reserved for use by Symbian. */
1.679 - EConverterReserved1=0x00010000,
1.680 - /** Reserved for use by Symbian. */
1.681 - EConverterReserved2=0x00020000,
1.682 - /** Reserved for use by Symbian. */
1.683 - EConverterReserved3=0x00040000,
1.684 - /** Reserved for use by Symbian. */
1.685 - EConverterReserved4=0x00080000,
1.686 - /** Reserved for use by Symbian. */
1.687 - EConverterReserved5=0x00100000,
1.688 - /** Reserved for use by Symbian. */
1.689 - EConverterReserved6=0x00200000,
1.690 - /** Reserved for use by Symbian. */
1.691 - EConverterReserved7=0x00400000,
1.692 - /** Reserved for use by Symbian. */
1.693 - EConverterReserved8=0x00800000,
1.694 - /** Reserved for use by Symbian. */
1.695 - EConverterReserved9=0x01000000,
1.696 - /** Reserved for use by Symbian. */
1.697 - EConverterReserved10=0x02000000,
1.698 - /** Reserved for use by Symbian. */
1.699 - EConverterReserved11=0x04000000,
1.700 - /** Reserved for use by Symbian. */
1.701 - EConverterReserved12=0x08000000,
1.702 - /** Reserved for use by Symbian. */
1.703 - EConverterReserved13=0x10000000,
1.704 - /** Reserved for use by Symbian. */
1.705 - EConverterReserved14=0x20000000,
1.706 - /** Reserved for use by Symbian. */
1.707 - EConverterReserved15=0x40000000,
1.708 - /** Reserved for use by Symbian. */
1.709 - EConverterReserved16=0x80000000
1.710 - };
1.711 - /** Specifies whether the database can be accessed from single or multiple threads. */
1.712 - enum TThreadAccess
1.713 - {
1.714 - /** Allows access to the contacts database from a single thread only. */
1.715 - ESingleThread,
1.716 - /** Allows for a multi-threaded program to access the contact database from multiple
1.717 - threads but note that the contacts model provides no synchronisation support
1.718 - for such use. */
1.719 - EMultiThread
1.720 - };
1.721 -/**
1.722 -@internalComponent
1.723 -*/
1.724 - enum TSortDataSource
1.725 - {
1.726 - ENoOrder,
1.727 - EUsesIdentityTableOnly,
1.728 - EUsesAllTables,
1.729 - EIdentityTableNotUsed //Not used
1.730 - };
1.731 -public:
1.732 - IMPORT_C static CContactDatabase* OpenL(TThreadAccess aAccess=ESingleThread);
1.733 - IMPORT_C static CContactDatabase* OpenL(const TDesC& aFileName,TThreadAccess aAccess=ESingleThread);
1.734 - IMPORT_C static CContactDatabase* CreateL(TThreadAccess aAccess=ESingleThread);
1.735 - IMPORT_C static CContactDatabase* CreateL(const TDesC& aFileName,TThreadAccess aAccess=ESingleThread);
1.736 - IMPORT_C static CContactDatabase* ReplaceL(TThreadAccess aAccess=ESingleThread);
1.737 - IMPORT_C static CContactDatabase* ReplaceL(const TDesC& aFileName,TThreadAccess aAccess=ESingleThread);
1.738 - // asynchronous Open
1.739 - IMPORT_C static CContactOpenOperation* Open(TRequestStatus& aStatus, TThreadAccess aAccess=ESingleThread);
1.740 - IMPORT_C static CContactOpenOperation* Open(const TDesC& aFileName, TRequestStatus& aStatus, TThreadAccess aAccess=ESingleThread);
1.741 - IMPORT_C static TBool DatabaseDrive(TDriveUnit &aDriveUnit);
1.742 - inline static TInt NullUidValue();
1.743 - IMPORT_C static void SetDatabaseDriveL(TDriveUnit aDriveUnit, TBool aCopy=ETrue);
1.744 - IMPORT_C static void GetDefaultNameL(TDes &aDes);
1.745 - IMPORT_C static void DeleteDefaultFileL();
1.746 - // database file mangement
1.747 - IMPORT_C static void DeleteDatabaseL(const TDesC& aFileName);
1.748 - IMPORT_C static CDesCArray* ListDatabasesL();
1.749 - IMPORT_C static CDesCArray* ListDatabasesL(TDriveUnit aDriveUnit);
1.750 - IMPORT_C static TBool DefaultContactDatabaseExistsL();
1.751 - IMPORT_C static TBool ContactDatabaseExistsL(const TDesC& aFileName);
1.752 - IMPORT_C ~CContactDatabase();
1.753 -
1.754 - IMPORT_C void SetViewDefinitionL(CContactViewDef* aView);
1.755 - IMPORT_C void SetTextDefinitionL(CContactTextDef* aView);
1.756 - IMPORT_C const CContactTextDef* TextDefinition() const;
1.757 - IMPORT_C TInt CountL();
1.758 - IMPORT_C void SetDbViewContactType(const TUid aUid);
1.759 - IMPORT_C TUid GetDbViewContactType() const;
1.760 -
1.761 -
1.762 - IMPORT_C TContactItemId AddNewContactL(CContactItem& aContact);
1.763 -
1.764 - IMPORT_C CContactItem* CreateContactGroupL(TBool aInTransaction=EFalse);
1.765 - IMPORT_C CContactItem* CreateContactGroupLC(TBool aInTransaction=EFalse);
1.766 - IMPORT_C CContactItem* CreateContactGroupL(const TDesC& aGroupLabel,TBool aInTransaction=EFalse);
1.767 - IMPORT_C CContactItem* CreateContactGroupLC(const TDesC& aGroupLabel,TBool aInTransaction=EFalse);
1.768 - IMPORT_C CContactItem* CreateContactCardTemplateL(const TDesC& aTemplateLabel,TBool aInTransaction=EFalse);
1.769 - IMPORT_C CContactItem* CreateContactCardTemplateLC(const TDesC& aTemplateLabel,TBool aInTransaction=EFalse);
1.770 - IMPORT_C CContactItem* CreateContactCardTemplateL(const CContactItem* aTemplate,const TDesC& aTemplateLabel,TBool aInTransaction=EFalse);
1.771 - IMPORT_C CContactItem* CreateContactCardTemplateLC(const CContactItem* aTemplate,const TDesC& aTemplateLabel,TBool aInTransaction=EFalse);
1.772 -
1.773 - IMPORT_C CContactIdArray* GetCardTemplateIdListL() const;
1.774 - IMPORT_C CContactIdArray* GetGroupIdListL() const;
1.775 - IMPORT_C void AddContactToGroupL(TContactItemId aItemId, TContactItemId aGroupId);
1.776 - IMPORT_C void AddContactToGroupL(CContactItem& aItem, CContactItem& aGroup);
1.777 - IMPORT_C void AddContactToGroupL(TContactItemId aItemId, TContactItemId aGroupId,TBool aInTransaction);
1.778 - IMPORT_C void RemoveContactFromGroupL(CContactItem& aItem, CContactItem& aGroup);
1.779 - IMPORT_C void RemoveContactFromGroupL(TContactItemId aItemId, TContactItemId aGroupId);
1.780 - inline TInt GroupCount() const;
1.781 - inline TInt TemplateCount() const;
1.782 -
1.783 - // speed dial functions
1.784 - IMPORT_C void SetFieldAsSpeedDialL(CContactItem& aItem, TInt aFieldIndex, TInt aSpeedDialPosition);
1.785 - IMPORT_C TContactItemId GetSpeedDialFieldL(TInt aSpeedDialPosition, TDes& aPhoneNumber);
1.786 - IMPORT_C void RemoveSpeedDialFieldL(TContactItemId aContactId, TInt aSpeedDialPosition);
1.787 -
1.788 - // reading contacts from the db
1.789 - IMPORT_C CContactItem* ReadMinimalContactL(TContactItemId aContactId);
1.790 - IMPORT_C CContactItem* ReadMinimalContactLC(TContactItemId aContactId);
1.791 - IMPORT_C CContactItem* ReadContactL(TContactItemId aContactId);
1.792 - IMPORT_C CArrayPtr<CContactItem>* ReadContactAndAgentL(TContactItemId aContactId);
1.793 - IMPORT_C CContactItem* ReadContactL(TContactItemId aContactId,const CContactItemViewDef& aViewDef);
1.794 - IMPORT_C CContactItem* ReadContactLC(TContactItemId aContactId);
1.795 - IMPORT_C CContactItem* ReadContactLC(TContactItemId aContactId,const CContactItemViewDef& aViewDef);
1.796 - IMPORT_C void ReadContactTextDefL(const CContactItem &aItem, TDes &aResult);
1.797 - IMPORT_C void ReadContactTextDefL(const CContactItem &aItem, TDes &aResult,CContactTextDef* aTextDef);
1.798 - IMPORT_C void ReadContactTextDefL(TContactItemId aContactId, TDes &aResult);
1.799 - IMPORT_C void ReadContactTextDefL(TContactItemId aContactId, TDes &aResult,CContactTextDef* aTextDef);
1.800 - IMPORT_C CContactItem* OpenContactL(TContactItemId aContactId);
1.801 - IMPORT_C CContactItem* OpenContactL(TContactItemId aContactId,const CContactItemViewDef& aViewDef);
1.802 - IMPORT_C CContactItem* OpenContactLX(TContactItemId aContactId);
1.803 - IMPORT_C CContactItem* OpenContactLX(TContactItemId aContactId,const CContactItemViewDef& aViewDef);
1.804 - IMPORT_C void CloseContactL(TContactItemId aContactId);
1.805 - IMPORT_C void CommitContactL(const CContactItem& aContact);
1.806 - IMPORT_C void DeleteContactL(TContactItemId aContactId);
1.807 - IMPORT_C void DeleteContactsL(const CContactIdArray& aContactIds);
1.808 - IMPORT_C CArrayPtr<CContactItem>* ImportContactsL(const TUid& aFormat,RReadStream& aReadStream,TBool& aImportSuccessful,TInt aOption);
1.809 - IMPORT_C void ExportSelectedContactsL(const TUid& aFormat,const CContactIdArray& aSelectedContactIds,RWriteStream& aWriteStream,TInt aOption,TBool aExportPrivateFields=ETrue);
1.810 - IMPORT_C void ExportSelectedContactsL(const TUid& aFormat,const CContactIdArray& aSelectedContactIds,RWriteStream& aWriteStream,TInt aOption,const Versit::TVersitCharSet aCharSet, TBool aExportPrivateFields=ETrue);
1.811 - IMPORT_C void CompactL();
1.812 -
1.813 - IMPORT_C CContactIdArray* FindLC(const TDesC& aText,const CContactItemFieldDef *aFieldDef);
1.814 - IMPORT_C CIdleFinder* FindAsyncL(const TDesC& aText,const CContactItemFieldDef *aFieldDef, MIdleFindObserver *aObserver);
1.815 - IMPORT_C CContactIdArray* FindInTextDefLC(const MDesCArray& aFindWords, const TCallBack &aWordParserCallback);
1.816 - IMPORT_C CContactIdArray* FindInTextDefLC(const MDesCArray& aFindWords,CContactTextDef* aTextDef, const TCallBack &aWordParserCallback);
1.817 - IMPORT_C CIdleFinder* FindInTextDefAsyncL(const MDesCArray& aFindWords, MIdleFindObserver *aObserver, const TCallBack &aWordParserCallback);
1.818 - IMPORT_C CIdleFinder* FindInTextDefAsyncL(const MDesCArray& aFindWords,const CContactTextDef* aTextDef, MIdleFindObserver *aObserver, const TCallBack &aWordParserCallback);
1.819 - IMPORT_C CContactIdArray* SortArrayL(const CContactIdArray* aIdArray, const CArrayFix<TSortPref>* aSortOrder);
1.820 - IMPORT_C CContactIdArray* SortArrayLC(const CContactIdArray* aIdArray, const CArrayFix<TSortPref>* aSortOrder);
1.821 - IMPORT_C void SortByTypeL(CArrayFix<TSortPref>* aSortOrder);
1.822 - IMPORT_C void SortL(CArrayFix<TSortPref>* aSortOrder);
1.823 - IMPORT_C void SortAsyncL(CArrayFix<TSortPref>* aSortOrder, TRequestStatus& aStatus);
1.824 - IMPORT_C void CancelAsyncSort();
1.825 - IMPORT_C void SortAsyncL(CArrayFix<TSortPref>* aSortOrder, TRequestStatus& aStatus, MContactSortObserver& aObserver);
1.826 -
1.827 - IMPORT_C void SetOperationTimeOutL(const TInt aMicroSeconds) const;
1.828 - IMPORT_C TPtrC FileUid();
1.829 - IMPORT_C CContactActiveCompress* CreateCompressorLC();
1.830 - IMPORT_C CContactActiveRecover* CreateRecoverLC();
1.831 - IMPORT_C void RecoverL();
1.832 - IMPORT_C TBool IsDamaged() const;
1.833 - IMPORT_C TBool CompressRequired();
1.834 - IMPORT_C void CloseTables();
1.835 - IMPORT_C void OpenTablesL();
1.836 -
1.837 - //New Phone Matching function, takes a number as a TDesc& and will match from the right of the string
1.838 - //by the the number defined
1.839 - IMPORT_C CContactIdArray* MatchPhoneNumberL(const TDesC& aNumber, TInt aMatchLengthFromRight);
1.840 -
1.841 -
1.842 - IMPORT_C const CContactIdArray* SortedItemsL();
1.843 - IMPORT_C TContactItemId TemplateId() const;
1.844 - IMPORT_C CContactItem* CreateOwnCardLC();
1.845 - IMPORT_C CContactItem* CreateOwnCardL();
1.846 - IMPORT_C TContactItemId OwnCardId() const;
1.847 - IMPORT_C void SetOwnCardL(const CContactItem& aContact);
1.848 -
1.849 -// Preferred Template
1.850 - IMPORT_C TContactItemId PrefTemplateId() const;
1.851 - IMPORT_C void SetPrefTemplateL(const CContactItem& aContact);
1.852 -
1.853 -// Current item
1.854 - IMPORT_C void SetCurrentItem(const TContactItemId aContactId);
1.855 - IMPORT_C TContactItemId GetCurrentItem() const;
1.856 -
1.857 -// Connectivity
1.858 - IMPORT_C void SetDateFormatTextL(const TDesC& aFormat);
1.859 - IMPORT_C void FilterDatabaseL(CCntFilter& aFilter);
1.860 - IMPORT_C CContactIdArray* ContactsChangedSinceL(const TTime& aTime);
1.861 - IMPORT_C TContactSyncId SetLastSyncDateL(const TTime& aSyncDate);
1.862 - IMPORT_C void SetLastSyncDateL(TContactSyncId aSyncId, const TTime& aSyncDate);
1.863 - IMPORT_C void GetLastSyncDateL(TContactSyncId aSyncId, TTime& aSyncDate);
1.864 -
1.865 - IMPORT_C TInt FileSize() const;
1.866 - IMPORT_C TInt WastedSpaceInBytes() const;
1.867 - IMPORT_C TUint ConnectionId() const;
1.868 - IMPORT_C const CContentType &TemplateContentType(const CContactItemField &aField) const;
1.869 - IMPORT_C TVersion Version() const;
1.870 - IMPORT_C TInt64 MachineId() const;
1.871 - IMPORT_C TContactItemId ICCTemplateIdL();
1.872 - IMPORT_C TContactItemId ICCTemplateIdL(TUid aPhonebookUid);
1.873 - IMPORT_C TContactItemId PhonebookGroupIdL();
1.874 -
1.875 -public: // For test code only
1.876 - IMPORT_C void DamageDatabaseL(TInt aSecretCode); // Don't use this, you don't really want to damage your database do you?
1.877 - IMPORT_C void OverrideMachineUniqueId(TInt64 aMachineUniqueId);
1.878 - IMPORT_C TInt CntServerResourceCount();
1.879 - IMPORT_C void SetCntServerHeapFailure(TInt aTAllocFailType,TInt aRate);
1.880 - IMPORT_C CContactIdArray* DeletedContactsLC();
1.881 - IMPORT_C void ResetServerSpeedDialsL();
1.882 -
1.883 -public: // For cnt server only
1.884 -#if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ && defined __SYMBIAN_CNTMODEL_USE_SQLITE__ )
1.885 - void HandleDatabaseEventL(RDbNotifier::TEvent) {};
1.886 -#endif
1.887 - IMPORT_C void HandleDatabaseEventL(const TContactDbObserverEvent &aEvent);
1.888 - IMPORT_C TInt GetCurrentDatabase(TDes& aDatabase) const;
1.889 - IMPORT_C TInt SetCurrentDatabase(const TDesC& aDatabase) const;
1.890 -
1.891 - IMPORT_C void StoreSortOrderL();
1.892 - IMPORT_C void RestoreSortOrderL();
1.893 - IMPORT_C const CArrayFix<TSortPref>* SortOrder() const;
1.894 - //Contact Hint Field Access
1.895 -
1.896 - /** Contact view filter flags.
1.897 -
1.898 - These flags define the bits that can be set in filtered views (CContactFilteredView)
1.899 - and in the filter passed to CContactDatabase::ContactMatchesHintFieldL() for
1.900 - comparing against contact view items (CViewContact).
1.901 -
1.902 - If the item's bit field and the view's filter have the same settings for the
1.903 - CContactDatabase::EHome and CContactDatabase::EWork flags and any of the other
1.904 - flags are set in both, a match occurs and the item is included in the view.
1.905 -
1.906 - Filters only apply to non-hidden contact fields with content. */
1.907 - enum TContactViewFilter
1.908 - {
1.909 - /** The view is unfiltered; it includes all contact items. */
1.910 - EUnfiltered =0x00000000,
1.911 - /** The filter includes items that have an email address. */
1.912 - EMailable =0x00000001,
1.913 - /** The filter includes items that have a mobile telephone number. */
1.914 - ESmsable =0x00000002,
1.915 - /** The filter includes items that have a landline telephone number. */
1.916 - ELandLine =0x00000004,
1.917 - /** The filter includes items that have a fax number. */
1.918 - EFaxable =0x00000008,
1.919 - /** The filter includes items that are phonable. (All items with any of the above
1.920 - three flags set also have this flag set). */
1.921 - EPhonable =0x00000010,
1.922 - /** The filter excludes items without a work telephone number or email address. */
1.923 - EWork =0x00000020,
1.924 - /** The filter excludes items without a home telephone number or email address. */
1.925 - EHome =0x00000040,
1.926 - /** The filter includes items that have a non-empty ring tone field (a ring tone
1.927 - that is associated with the item). */
1.928 - ERingTone =0x00000080,
1.929 - /** The filter includes items that have a non-empty voice dial field (a voice
1.930 - recording associated with a telephone number field in the item). */
1.931 - EVoiceDial =0x00000100,
1.932 - /** The filter includes items that have any non empty instant messaging address field. */
1.933 - EIMAddress =0x00000200,
1.934 - /** The filter includes items that have a non empty Wireless Village ID field.
1.935 - An item with this flag set will also have the EIMAddress flag set. */
1.936 - EWirelessVillage = 0x00000400,
1.937 - /** Reserved filters for future use. */
1.938 - ECustomFilter1 = 0x00000800,
1.939 - /** Reserved filters for future use. */
1.940 - ECustomFilter2 = 0x00001000,
1.941 - /** Reserved filters for future use. */
1.942 - ECustomFilter3 = 0x00002000,
1.943 - /** Reserved filters for future use. */
1.944 - ECustomFilter4 = 0x00004000
1.945 - };
1.946 -
1.947 - IMPORT_C TBool ContactMatchesHintFieldL(TInt aBitWiseFilter,TContactItemId aContactId);
1.948 -public: // for vCard converter only
1.949 - IMPORT_C void DatabaseBeginLC(TBool aIsInTransaction);
1.950 - IMPORT_C void DatabaseCommitLP(TBool aIsInTransaction);
1.951 - IMPORT_C CContactItem *UpdateContactLC(TContactItemId aContactId,CContactItem* aNewContact);
1.952 - IMPORT_C TContactItemId doAddNewContactL(CContactItem& aContact,TBool aIsTemplate,TBool aIsInTransaction);
1.953 - IMPORT_C void doCommitContactL(const CContactItem& aContact,TBool aIsInTransaction, TBool aSendChangedEvent);
1.954 - IMPORT_C TContactItemId ContactIdByGuidL(const TDesC& aGuid);
1.955 - IMPORT_C void doDeleteContactL(TContactItemId aContactId, TBool aIsInTransaction, TBool aSendChangedEvent, TBool aDecAccessCount=EFalse);
1.956 - IMPORT_C CContactItemViewDef* AllFieldsView();
1.957 -public: // For Symbian use only
1.958 - IMPORT_C void DatabaseBeginL(TBool aIsInTransaction);
1.959 - IMPORT_C void DatabaseCommitL(TBool aIsInTransaction);
1.960 - IMPORT_C void DatabaseRollback();
1.961 - IMPORT_C void SetSortedItemsList(CContactIdArray* aSortedItems, CArrayFix<TSortPref>* aSortOrder);
1.962 - IMPORT_C CContactIdArray* UnfiledContactsL();
1.963 - IMPORT_C static void RecreateSystemTemplateL(const TDesC& aFileName);
1.964 -public: // For Contacts Lock Server use only
1.965 - IMPORT_C static CContactDatabase* LockServerConnectL(const TDesC& aFileName);
1.966 - IMPORT_C static CContactDatabase* LockServerConnectL(const TDesC& aFileName, TInt aOperation);
1.967 - IMPORT_C TInt LockServerCallBackL(TUint aServerOperation);
1.968 - IMPORT_C void LockServerCleanup();
1.969 -public:
1.970 - IMPORT_C void ExportSelectedContactsL(const TUid& aFormat, const CContactIdArray& aSelectedContactIds, RWriteStream& aWriteStream, TInt aOption, const TInt64 aContactFieldFilter, MConverterCallBack* aCallback, const TVCardVersion aVersion, const TBool aExportTel, Versit::TVersitCharSet aCharSet = Versit::EUTF8CharSet, TBool aExportPrivateFields = ETrue);
1.971 -private:
1.972 - //for cntiter
1.973 - TInt ContactPosL(TContactItemId aContactId);
1.974 - TInt DoGotoL(TContactItemId aContactId);
1.975 -
1.976 - void DoReadContactTextDefL(const CContactItemFieldSet* aFieldSet,TDes& aResult,CContactTextDef* aTextDef);
1.977 - CContactItem* OpenNoMergeLCX(TContactItemId aContactId);
1.978 -
1.979 - void FetchGroupAndTemplateListsL();
1.980 -
1.981 -public:
1.982 - void CancelNotifyRequestL();
1.983 - TBool IsICCSynchronisedL();
1.984 -
1.985 - //for LocalView
1.986 - void AddObserverL(MContactDbObserver& aChangeNotifier);
1.987 - void RemoveObserver(const MContactDbObserver& aChangeNotifier);
1.988 -
1.989 - void OpenDatabaseAsyncL(TRequestStatus& aStatus, const TDesC& aFileName = KNullDesC);
1.990 - static void CleanupLastLockedContact(TAny *aDatabase);
1.991 -
1.992 -private:
1.993 - CContactConverter& CContactDatabase::ConverterL(const TUid& aFormat);
1.994 - CContactConverter& CContactDatabase::ConverterL(const TUid& aFormat, const TInt64 aContactFieldFilter, MConverterCallBack* aCallback, const TVCardVersion aVersion,const TBool aExportTel);
1.995 - static void CleanupDatabaseRollback(TAny *aDatabase);
1.996 -
1.997 - CContactIdArray* SortLC(const CArrayFix<TSortPref>* aSortOrder, const CContactIdArray* aIdArray);
1.998 - TBool CheckType(TUid aUid) const;
1.999 - void SortDuplicatesL(const CArrayFix<TSortPref>& aSortOrder,CSortArray& aList,TInt aPos);
1.1000 - void SortDuplicatesL(const CArrayFix<TSortPref>& aSortOrder,CSortArray& aList,
1.1001 - TInt aIndex,TInt aStartPos,TInt aEndPos);
1.1002 - TBool AddContactToSortListL(TContactItemId aReqId, TContactItemId& aActualId,CBase* aItems, TUid& aFieldType, TBool aHasSortOrder);
1.1003 - void RemoveFromSortArray(TContactItemId aContactId);
1.1004 - void HandleDbObserverEventGroupDeletedL(const TContactItemId aContactId);
1.1005 - void RemoveFromGroupIds(const TContactItemId aContactId);
1.1006 -
1.1007 -public:
1.1008 - static void CleanupTableCancel(TAny *aTable);
1.1009 -/** A text buffer of KTextFieldMinimalLength used during sorting and searching of contacts */
1.1010 - typedef TBuf<KTextFieldMinimalLength> TTextFieldMinimal;
1.1011 - static TUid SpeedDialFieldUidFromSpeedDialPosition(TInt aSpeedDialPosition);
1.1012 - void HandleDiskSpaceEvent(TInt aDrive);
1.1013 -
1.1014 - /** State of database connection
1.1015 - */
1.1016 - enum TDbConnState
1.1017 - {
1.1018 - /** Database is open, connection is available for use. */
1.1019 - EDbConnectionOpen = 0,
1.1020 - /** Initial state. */
1.1021 - EDbConnectionNotReady,
1.1022 - /** Asynchronous Open failed. */
1.1023 - EDbConnectionFailed,
1.1024 - /** A Rollback has occurred and a Recover is required now. */
1.1025 - EDbConnectionRecoverRequired,
1.1026 - /** Write access is locked during backup. */
1.1027 - EDbConnectionWriteLockedForBackup,
1.1028 - /** The database has been closed whilst a Restore is in progress. */
1.1029 - EDbConnectionClosedForRestore,
1.1030 - /** Restore is in progress need to close after current transaction. */
1.1031 - EDbConnectionNeedToCloseForRestore,
1.1032 - };
1.1033 - /** Currently unused */
1.1034 - enum TDirection {EAsc,EDesc}; //unused
1.1035 - void SetDbConnectionState(TDbConnState aDbConnectionState);
1.1036 -private:
1.1037 - void CheckDbConnForWriteL() const;
1.1038 - void CheckDbConnForReadL() const;
1.1039 - void CheckDbConnForRecoverL() const;
1.1040 - void CheckTemplateField(CContactItem& aCnt);
1.1041 - static void ValidateDatabaseNameL(const TParse& aParseName);
1.1042 - void StartAsyncActivityL();
1.1043 - void EndAsyncActivityL();
1.1044 - TBool DatabaseReadyL() const;
1.1045 - enum TSvrSessionType //unused
1.1046 - {
1.1047 - // Server Session is persistent, for Open(L), CreateL or ReplaceL
1.1048 - ESvrSessionPersistent,
1.1049 - // Server Session is temporary, for a simple static API
1.1050 - ESvrSessionTemporary,
1.1051 - // Session is from the Contacts Lock Server
1.1052 - ESvrSessionFromLockServer,
1.1053 - };
1.1054 -private: // objec construction/destruction
1.1055 -
1.1056 - CContactDatabase();
1.1057 - static CContactDatabase* NewLC();
1.1058 - void ConstructL();
1.1059 - void CreateViewDefL();
1.1060 - MLplPersistenceLayerFactory* FactoryL();
1.1061 -
1.1062 -private:
1.1063 - CContactItem* doCreateContactGroupLC(const TDesC& aGroupLabel = KNullDesC);
1.1064 - void AddCntToOpenedGroupL(TContactItemId aItemId, CContactItem& aGroup);
1.1065 - void ReadTemplateIds();
1.1066 - void AddToTemplateListL(const TContactItemId aNewTemplateId);
1.1067 - void RemoveFromTemplateList(const TContactItemId aOldTemplateId);
1.1068 - TBool SystemTemplateFieldsValid(const CContactItem& aContact);
1.1069 - void RespondToEventL(const TContactDbObserverEventType aEventType, const TContactItemId aContactId);
1.1070 - void HandleDbObserverEventGroupOrContactChangedL(const TContactItemId aContactId);
1.1071 - void HandleDbObserverEventGroupOrContactAddedL(const TContactDbObserverEventType aEventType, const TContactItemId aContactId);
1.1072 - TBool CheckSortError(TInt aError);
1.1073 - TInt NextExistingL(TInt aIndex);
1.1074 - TInt PreviousExistingL(TInt aIndex);
1.1075 - void ReSortL(CArrayFix<TSortPref>* aSortOrder);
1.1076 - void InsertInSortArray(const CContactItem& aContact);
1.1077 - void MoveInSortArray(const CContactItem& aContact);
1.1078 - void InsertInSortArrayL(const CContactItem& aContact);
1.1079 - void MoveInSortArrayL(const CContactItem& aContact);
1.1080 - TInt NewSortIndexL(const CContactItem& aContact,TInt aStartPos,TInt aEndPos);
1.1081 - TInt CompareSortFieldsL(const CContactItem& aContact);
1.1082 - void ConstructTableUsageFlagsFromSortOrderL(TInt& aFlags);
1.1083 - void LoadSyncPluginL();
1.1084 - void DeleteContactSendEventActionL(TContactItemId aContactId, TCntSendEventAction aActionType);
1.1085 -
1.1086 -private:
1.1087 - // Member variables
1.1088 - RCntModel* iCntSvr; //was RDbNamedDatabase iDatabase;
1.1089 - CProxyFactory* iProxyFactory; //was RDbs iDbsSession;
1.1090 - TDbConnState iDbConnectionState; //was CContactClientSession* iContactClientSession;
1.1091 - CDataBaseChangeObserver* iDataBaseObserver; //was CPrivateDbChangeNotifier* iDbChangeNotifier;
1.1092 - CCntIdleSorter* iIdleSorter; //was CPrivateSvrSessionManager* iServerSessionManager;
1.1093 - CPrivConverter* iConv; //was TContactItemId iLastLockedContactId;
1.1094 - TBool iTablesOpen; //was TContactItemId iTemplateId;
1.1095 - CContactItemViewDef* iAllFieldsView; //was TContactItemId iOwnCardId;
1.1096 - TUid iDbViewContactType; //used to select which contact type to sort / search on
1.1097 -
1.1098 - //These two members are accessed via the inline functions!
1.1099 - CContactIdArray* iCardTemplateIds;
1.1100 - CContactIdArray* iGroupIds;
1.1101 -
1.1102 - CCntTemplateCache* iTemplateCache; //was CContactTables* iItemTable;
1.1103 - CContactTextDef* iTextDef; //remains
1.1104 - CContactIdArray* iSortedItems; //remains
1.1105 - CContactViewDef* iView; //remains
1.1106 -
1.1107 - // Used in SetLastSyncDateL() and GetLastSyncDateL()
1.1108 - TTime iSyncDate; //was TInt64 iMachineUniqueId;
1.1109 - TCollationMethod iCollateMethod; //remains: used for sorting contacts
1.1110 -
1.1111 - TInt iAsyncActivityCount;
1.1112 - CContactSynchroniser* iContactSynchroniser; //a handle to the synchroniser plugin
1.1113 - CArrayFix<TSortPref>* iSortOrder; // holds a sort order passed into SortL(), as in cntmodelv1,
1.1114 - // for delayed deletion to maintain backwards compatibility
1.1115 - };
1.1116 -
1.1117 -
1.1118 -class CContactChangeNotifier : public CBase
1.1119 -/** Receives events reporting changes to a contact database.
1.1120 -
1.1121 -After the change notifier has been created, it notifies the specified
1.1122 -observer whenever a change takes place to the database.
1.1123 -
1.1124 -@publishedAll
1.1125 -@released
1.1126 -*/
1.1127 - {
1.1128 -public:
1.1129 - IMPORT_C ~CContactChangeNotifier();
1.1130 - IMPORT_C static CContactChangeNotifier* NewL(CContactDatabase& aDatabase, MContactDbObserver *aObserver);
1.1131 -private:
1.1132 - CContactChangeNotifier(CContactDatabase& aDatabase, MContactDbObserver *aObserver);
1.1133 - void ConstructL();
1.1134 -private:
1.1135 - CContactDatabase &iDatabase;
1.1136 - MContactDbObserver* iObserver;
1.1137 - };
1.1138 -
1.1139 -
1.1140 -/** The UID of the default vCard converter implemented by an ECom plugin. */
1.1141 -#define KUidEComCntVCardConverterDefaultImplementation 0x102035F9
1.1142 -/** The UID of the default vCard converter plugin implementation. This
1.1143 -implementation is independent of the plugin framework used. */
1.1144 -#define KUidVCardConvDefaultImpl KUidEComCntVCardConverterDefaultImplementation
1.1145 -
1.1146 -/** The UID of the vCard converter ECom plugin interface. */
1.1147 -const TUid KUidEcomCntVCardConverterInterface = {0x102035F7};
1.1148 -
1.1149 -/** The UID of the phone number parser ECom plugin interface. */
1.1150 -const TUid KUidEcomCntPhoneNumberParserInterface = {0x102035FA};
1.1151 -
1.1152 -/** The UID of PBAP vCard Converter plugin Implementation.
1.1153 -@prototype
1.1154 -@internalTechnology
1.1155 -*/
1.1156 -#define KUidPBAPVCardConvImpl 0xA00015C1
1.1157 -
1.1158 -class TPluginParameters
1.1159 -/**
1.1160 -Class used to pack the extra arguments required for a PBAP conveter,
1.1161 -PBAP client provides these arguments using overloaded CContactDatabase::ExportSelectedContacts.
1.1162 -@prototype
1.1163 -@internalComponent
1.1164 -*/
1.1165 -{
1.1166 -public:
1.1167 - TPluginParameters(TInt64 aContactFieldFilter, MConverterCallBack* aCallback, TVCardVersion aVersion, TBool aExportTel);
1.1168 - TInt64 GetFilter()const;
1.1169 - MConverterCallBack* GetCallback()const;
1.1170 - TVCardVersion GetExportVersion()const;
1.1171 - TBool IsExportTel()const;
1.1172 -private:
1.1173 - TInt64 iFilter;
1.1174 - MConverterCallBack* iCallback;
1.1175 - TVCardVersion iVersion;
1.1176 - TBool iExportTel;
1.1177 -};
1.1178 -
1.1179 -inline TBool TPluginParameters::IsExportTel()const
1.1180 - {
1.1181 - return iExportTel;
1.1182 - }
1.1183 -inline TInt64 TPluginParameters::GetFilter()const
1.1184 - {
1.1185 - return iFilter;
1.1186 - }
1.1187 -
1.1188 -inline MConverterCallBack* TPluginParameters::GetCallback()const
1.1189 - {
1.1190 - return iCallback;
1.1191 - }
1.1192 -
1.1193 -inline TVCardVersion TPluginParameters::GetExportVersion()const
1.1194 - {
1.1195 - return iVersion;
1.1196 - }
1.1197 -
1.1198 -inline TPluginParameters::TPluginParameters(TInt64 aContactFieldFilter, MConverterCallBack* aCallback, TVCardVersion aVersion, TBool aExportTel):iFilter(aContactFieldFilter), iCallback(aCallback), iVersion(aVersion), iExportTel(aExportTel)
1.1199 - {
1.1200 - }
1.1201 -
1.1202 -class CContactConverter : public CBase
1.1203 -/** Provides functionality to import and export vCards.
1.1204 -One or more vCards can be imported from a read stream (the vCards are converted
1.1205 -into contact items and added to the database). Also, contact items can be exported as vCards.
1.1206 -
1.1207 -@publishedPartner
1.1208 -@released
1.1209 -*/
1.1210 - {
1.1211 -public:
1.1212 - virtual CArrayPtr<CContactItem>* ImportL(CContactDatabase& aDb,RReadStream& aReadStream,TBool& aImportSuccessful,TInt aOptions,TBool aImportSingle)=0;
1.1213 - virtual void ExportL(CContactDatabase& aDb,const CContactIdArray& aSelectedContactIds,RWriteStream& aWriteStream,TInt aOptions,const Versit::TVersitCharSet aCharSet,TBool aExportPrivateFields, TInt aCommitNumber=10)=0;
1.1214 - };
1.1215 -
1.1216 -
1.1217 -class CContactEcomConverter : public CContactConverter
1.1218 -/**
1.1219 -It provides Ecom Framework based facilities to resolve and load the appropriate implementations at run-time.
1.1220 -The framework supplies a default resolver for selecting appropriate implementations.
1.1221 -@publishedPartner
1.1222 -@released
1.1223 -*/
1.1224 - {
1.1225 -public:
1.1226 - static CContactEcomConverter* NewL(TUid aImplementationUid);
1.1227 - static CContactEcomConverter* NewL(TUid aImplementationUid, TInt64 aContactFieldFilter, MConverterCallBack* aCallback, TVCardVersion aVersion, TBool aExportTel);
1.1228 - inline virtual ~CContactEcomConverter();
1.1229 -private:
1.1230 - TUid iDtor_ID_Key;
1.1231 - };
1.1232 -
1.1233 -inline CContactEcomConverter* CContactEcomConverter::NewL(TUid aImplementationUid)
1.1234 -/** Allocates and instantiates an interface implementation to satisfy the specified interface.
1.1235 -@param aImplementationUid Denotes the type of implemetation that needs to be loaded.
1.1236 -@return A pointer to a newly allocated and initialised object of type CContactEcomConverter. */
1.1237 -
1.1238 -{
1.1239 - TAny* ptr = REComSession::CreateImplementationL(aImplementationUid,
1.1240 - _FOFF(CContactEcomConverter,
1.1241 - iDtor_ID_Key));
1.1242 - return reinterpret_cast<CContactEcomConverter*>(ptr);
1.1243 -}
1.1244 -
1.1245 -inline CContactEcomConverter* CContactEcomConverter::NewL(TUid aImplementationUid, TInt64 aContactFieldFilter, MConverterCallBack* aCallback, TVCardVersion aVersion, TBool aExportTel)
1.1246 -/** Allocates and instantiates an interface implementation for PBAP export.
1.1247 -@param aImplementationUid Denotes the type of implemetation that needs to be loaded.
1.1248 -@param aContactFieldFilter Specifies contact fields to be exported.
1.1249 -@param aCallback Callback to client for providing intra-contact properties.
1.1250 -@param aVersion Denotes the vCard version for contact export.
1.1251 -@return A pointer to a newly allocated and initialised object of type CContactEcomConverter. */
1.1252 -
1.1253 -{
1.1254 - TPluginParameters partr(aContactFieldFilter,aCallback,aVersion,aExportTel);
1.1255 -
1.1256 - TAny* ptr = REComSession::CreateImplementationL(aImplementationUid,
1.1257 - _FOFF(CContactEcomConverter,
1.1258 - iDtor_ID_Key), &partr);
1.1259 - return reinterpret_cast<CContactEcomConverter*>(ptr);
1.1260 -}
1.1261 -
1.1262 -inline CContactEcomConverter::~CContactEcomConverter()
1.1263 -/** The destruction of the interface implementation referred to by iDtor_ID_Key */
1.1264 - {
1.1265 - REComSession::DestroyedImplementation(iDtor_ID_Key);
1.1266 - }
1.1267 -
1.1268 -
1.1269 -class CContactPhoneNumberParser : public CBase
1.1270 -/** Provides functionality to extract the real phone number from a contact's phone number field.
1.1271 -@publishedPartner
1.1272 -@released
1.1273 -*/
1.1274 - {
1.1275 -public:
1.1276 - virtual void ExtractRawNumber(const TDesC& aTextualNumber, TDes& aRawNumber)=0;
1.1277 - };
1.1278 -
1.1279 -
1.1280 -class CContactEcomPhoneNumberParser : public CContactPhoneNumberParser
1.1281 -/** It provides Ecom Framework based facilities to resolve and load the appropriate implementations at run-time.
1.1282 -The framework supplies a default resolver for selecting appropriate implementations.
1.1283 -@publishedPartner
1.1284 -@released
1.1285 -*/
1.1286 - {
1.1287 -public:
1.1288 - static CContactEcomPhoneNumberParser* NewL(TUid aImplementationUid);
1.1289 - inline virtual ~CContactEcomPhoneNumberParser();
1.1290 -private:
1.1291 - TUid iDtor_ID_Key;
1.1292 - };
1.1293 -
1.1294 -inline CContactEcomPhoneNumberParser* CContactEcomPhoneNumberParser::NewL(TUid aImplementationUid)
1.1295 -/** Allocates and Instantiates an interface implementation to satisfy the specified interface.
1.1296 -@param aImplementationUid denotes the type of implemetation that need to be loaded.
1.1297 -@return A pointer to a newly allocated and initialised object of type CContactEcomPhoneNumberParser. */
1.1298 - {
1.1299 - TAny* ptr = REComSession::CreateImplementationL(aImplementationUid,
1.1300 - _FOFF(CContactEcomPhoneNumberParser,
1.1301 - iDtor_ID_Key));
1.1302 - return reinterpret_cast<CContactEcomPhoneNumberParser*>(ptr);
1.1303 - }
1.1304 -
1.1305 -inline CContactEcomPhoneNumberParser::~CContactEcomPhoneNumberParser()
1.1306 -/** The destruction of the interface implementation referred to by iDtor_ID_Key */
1.1307 - {
1.1308 - REComSession::DestroyedImplementation(iDtor_ID_Key);
1.1309 - }
1.1310 -
1.1311 -
1.1312 -inline TInt CContactDatabase::TemplateCount() const
1.1313 -/** Gets the number of contact card templates that exist in the database.
1.1314 -This does not include the system template.
1.1315 -@deprecated
1.1316 -@return The number of contact card templates that exist in the database. */
1.1317 - { return iCardTemplateIds->Count(); }
1.1318 -
1.1319 -inline TInt CContactDatabase::GroupCount() const
1.1320 -/** Gets the number of groups that exist in the database.
1.1321 -@deprecated
1.1322 -@return The number of groups that exist in the database. */
1.1323 - { return iGroupIds->Count(); }
1.1324 -
1.1325 -inline TInt CContactDatabase::NullUidValue()
1.1326 -/** Gets the NULL contact ID value.
1.1327 -
1.1328 -@return KNullContactId. */
1.1329 - { return KNullContactId; }
1.1330 -
1.1331 -inline TUid CContactItemViewDef::operator[](TInt aIndex) const
1.1332 -/** Gets the field type located at a specified index position within the field type array.
1.1333 -
1.1334 -@param aIndex The position of the field type in the array, relative to zero. It
1.1335 -must be non-negative and less than the number of objects in the array otherwise the
1.1336 -function raises a panic.
1.1337 -@return The field type located at index aIndex within the array (this is equivalent to a
1.1338 -TFieldType). */
1.1339 - { return iFieldTypes[aIndex]; }
1.1340 -
1.1341 -inline TInt CContactItemViewDef::Count() const
1.1342 -/** Gets the number of field types in the view definition.
1.1343 -
1.1344 -@return The number of field types in the view definition. */
1.1345 - { return iFieldTypes.Count(); }
1.1346 -
1.1347 -inline void CContactItemViewDef::Reset()
1.1348 -/** Deletes all field types from the view definition's field type array. */
1.1349 - { iFieldTypes.Reset(); }
1.1350 -
1.1351 -inline CContactItemViewDef::TUse CContactItemViewDef::Use() const
1.1352 -/** Gets the view definition's use.
1.1353 -
1.1354 -@return The current TUse setting. */
1.1355 - { return iUse; }
1.1356 -
1.1357 -inline void CContactItemViewDef::SetUse(CContactItemViewDef::TUse aUse)
1.1358 -/** Sets the view definition's use.
1.1359 -
1.1360 -@param aUse The new TUse setting. */
1.1361 - { iUse=aUse; }
1.1362 -
1.1363 -inline CContactItemViewDef::TMode CContactItemViewDef::Mode() const
1.1364 -/** Gets the view definition's mode.
1.1365 -
1.1366 -@return The current TMode setting. */
1.1367 - { return iMode; }
1.1368 -
1.1369 -inline void CContactItemViewDef::SetMode(CContactItemViewDef::TMode aMode)
1.1370 -/** Sets the view definition's mode.
1.1371 -
1.1372 -@param aMode The new TMode setting. */
1.1373 - { iMode=aMode; }
1.1374 -
1.1375 -inline CContactDatabase::TSortPref::TSortPref()
1.1376 - : iOrder(EAsc), iFieldType(KNullUid)
1.1377 -/** Constructs a TSortPref object. The order is initialised to EAsc and the field
1.1378 -type to KNullUid.
1.1379 -@deprecated
1.1380 -*/
1.1381 - {}
1.1382 -
1.1383 -inline CContactDatabase::TSortPref::TSortPref(TFieldType aFieldType,TOrder aOrder)
1.1384 - : iOrder(aOrder), iFieldType(aFieldType)
1.1385 -/** Constructs the TSortPref object with a field type and an order.
1.1386 -@param aFieldType Specifies the field type to sort on.
1.1387 -@param aOrder Specifies the sort order.
1.1388 -@deprecated
1.1389 -*/
1.1390 - {}
1.1391 -
1.1392 -
1.1393 -/** A class that manages the asynchronous open operation for a CContactDatabase.
1.1394 -
1.1395 -The object can be deleted before the asynchronous open completes. This will set
1.1396 -the state of the client supplied TRequestStatus to KErrCancel.
1.1397 -
1.1398 -When the client supplied TRequestStatus is completed with KErrNone the TakeDatabase()
1.1399 -method is called to pass ownership of the open database to the client.
1.1400 -
1.1401 -@publishedAll
1.1402 -@released
1.1403 -
1.1404 -@see CContactDatabase::OpenL()
1.1405 -*/
1.1406 -class CContactOpenOperation : private CActive
1.1407 - {
1.1408 -public:
1.1409 - IMPORT_C CContactDatabase* TakeDatabase();
1.1410 - IMPORT_C ~CContactOpenOperation();
1.1411 -
1.1412 - static CContactOpenOperation* NewL(TRequestStatus& aPtrStatus);
1.1413 - static CContactOpenOperation* NewL(const TDesC& aFileName, TRequestStatus& aPtrStatus);
1.1414 -
1.1415 -private:
1.1416 - // from CActive (for BC reasons)
1.1417 - void RunL();
1.1418 - TInt RunError(TInt aError);
1.1419 - void DoCancel();
1.1420 -
1.1421 - CContactOpenOperation (TRequestStatus& aClientStatus);
1.1422 - void ConstructL (const TDesC& aFileName = KNullDesC);
1.1423 -
1.1424 -private:
1.1425 - TRequestStatus* iClientStatus;
1.1426 - CContactDatabase* iContactDatabase;
1.1427 - };
1.1428 -
1.1429 -
1.1430 -#endif //__CNTDB_H__