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