epoc32/include/app/CPbkContactEngine.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *     Represents a connection to the Phonebook contact database
    16 *
    17 */
    18 
    19 
    20 #ifndef __CPBKCONTACTENGINE_H__
    21 #define __CPBKCONTACTENGINE_H__
    22 
    23 //  INCLUDES
    24 #include <e32base.h>        // CBase
    25 #include <cntdef.h>         // TContactItemId
    26 #include <cntdbobs.h>       // MContactDbObserver
    27 #include <f32file.h>        // RFs
    28 #include "PbkFields.hrh"    // TPbkFieldId
    29 
    30 
    31 // FORWARD DECLARATIONS
    32 class CContactDatabase;
    33 class MIdleFindObserver;
    34 class MPbkContactDbObserver;
    35 class CContactGroup;
    36 class CPbkFieldsInfo;
    37 class CPbkContactItem;
    38 class CPbkContactIter;
    39 class CPbkContactChangeNotifier;
    40 class CPbkIdleFinder;
    41 class MPbkCompressUi;
    42 class CPbkConstants;
    43 class MPbkContactNameFormat;
    44 class MPbkFieldDataArray;
    45 class CContactViewBase;
    46 class CContactItem;
    47 class RSharedDataClient;
    48 class TResourceReader;
    49 class CPbkEngineExtension;
    50 class CPbkSortOrderManager;
    51 class CPbkSINDHandlerInterface;
    52 
    53 
    54 // CLASS DECLARATION
    55 
    56 /**
    57  * The main entrypoint to the Phonebook contact engine. The Phonebook
    58  * contact engine builds on top of the Symbian Contacts model and
    59  * implements platform specific functionality and policies that can be 
    60  * reused and followed by clients to implement functionality that is
    61  * better integrated to the platform functionality. Functionality like
    62  * contact field typing is implemented by this engine. 
    63  */
    64 class   CPbkContactEngine :
    65         public CBase,
    66         private MContactDbObserver
    67     {
    68     public: // Constructors and destructor
    69         /**
    70          * Creates a new Phonebook engine object and connects to the default
    71          * contact database. If the default database does not exist it is
    72          * created.
    73          *
    74          * @param aFs   An open file server connection. If !=NULL aFs is used
    75          *              instead of a locally created RFs connection. aFs must
    76          *              remain connected for the lifetime of the returned
    77          *              object.
    78          * @return A new instance of this class.
    79          * @exception KErrCorrupt if the database is corrupted.
    80          */
    81 		IMPORT_C static CPbkContactEngine* NewL(RFs* aFs=NULL);
    82 
    83         /**
    84          * @internal
    85          * TESTING ONLY
    86          * Creates a new engine object and connects it to a specified
    87          * database file. If the database file does not exist it is created.
    88          *
    89          * @param aFileName The database filename.
    90          * @param aReplace  If ETrue replaces exisiting file with an empty one.
    91          *                  PLEASE NOTE: all data in the existing file
    92          *                  will be lost!
    93          * @param aFs   An open file server connection. If !=NULL aFs is used
    94          *              instead of a locally created RFs connection. aFs must
    95          *              remain connected for the lifetime of the returned
    96          *              object.
    97          * @return A new instance of this class.
    98          * @exception KErrCorrupt if the database is corrupted.
    99          * @deprecated
   100          */
   101 		IMPORT_C static CPbkContactEngine* NewL
   102             (const TDesC& aFileName, TBool aReplace=EFalse, RFs* aFs=NULL);
   103 
   104         /**
   105          * Replaces the default contact database and connects to it. See
   106          * Symbian Contacs model documentation for CContactDatabase::ReplaceL
   107          * for possible leave codes.
   108          * PLEASE NOTE: all data in the existing database will be lost!
   109          *
   110          * @param aFs   An open file server connection. If !=NULL aFs is used
   111          *              instead of a locally created RFs connection. aFs must
   112          *              remain connected for the lifetime of the returned
   113          *              object.
   114          * @return A new instance of this class.
   115          * @see CContactDatabase::ReplaceL
   116          */
   117         IMPORT_C static CPbkContactEngine* ReplaceL(RFs* aFs=NULL);
   118 
   119         /**
   120 		* Destructor. Destroys this object and closes the contact database
   121 		* connection. REComSession::FinalClose() is called. Notice that
   122 		* FinalClose -call releases resource handles of already destroyed ECom
   123 		* plugins also outside CPbkContactEngine. See REComSession
   124 		* documentation.
   125 		*/
   126 		~CPbkContactEngine();
   127 
   128     public: // Accessors
   129         /**
   130          * Returns the global Phonebook engine instance, NULL if no instance
   131          * created yet.
   132          * Note1: Uses thread local storage (TLS), which is slow. Cache the
   133          * returned pointer if it is used more than one time!
   134          * Note2: Only the first engine instance created in calling thread can
   135          * be accessed with this function.
   136          * @return  Global Phonebook engine instance.
   137          */
   138         IMPORT_C static CPbkContactEngine* Static();
   139 
   140         /**
   141          * Returns the underlying CContactDatabase object. Use only if this class's API
   142          * is not enough for your purposes.
   143          *
   144          * @return The underlying Symbian Contacts model CContactDatabase instance.
   145          * @see CContactDatabase
   146          */
   147         IMPORT_C CContactDatabase& Database();
   148 
   149         /**
   150          * Returns the field type info array.
   151          * @return  All the Phonebook field types.
   152          * @see CPbkFieldsInfo
   153          */
   154         IMPORT_C const CPbkFieldsInfo& FieldsInfo();
   155 
   156         /**
   157          * Returns an open file server session.
   158          * @return  A handle to a file server session.
   159          */
   160         IMPORT_C RFs& FsSession() const;
   161 
   162     public:  // Creating contacts
   163         /**
   164          * Returns a new contact card with default fields.
   165          * @return  A new empty contact item object.
   166          */
   167         IMPORT_C CPbkContactItem* CreateEmptyContactL();
   168 
   169          /**
   170           * Adds a new contact to the contact database.
   171           *
   172           * @param aContact         The new contact item to add.
   173           * @param aImmediateNotify Send notification to observers immediately.
   174           *                         NOTE: send immediately will result in
   175           *                         observers (MPbkContactDbObserver) receiving
   176           *                         the event twice!
   177           * @return The id of the new contact item.
   178           * @see CContactDatabase::AddNewContactL
   179           */
   180         IMPORT_C TContactItemId AddNewContactL
   181             (CPbkContactItem& aContact, TBool aImmediateNotify=EFalse);
   182 
   183         /**
   184          * Duplicates a contact in the database.
   185          *
   186          * @param aId               Id of the contact to duplicate.
   187          * @param aImmediateNotify  Send notification to observers immediately.
   188          *                          NOTE: send immediately will result in
   189          *                          observers (MPbkContactDbObserver) receiving
   190          *                          the event twice!
   191          * @return  Contact id of the new duplicate.
   192          */
   193         IMPORT_C TContactItemId DuplicateContactL
   194             (TContactItemId aId, TBool aImmediateNotify=EFalse);
   195 
   196     public:  // Reading contacts
   197         /**
   198          * Reads a contact and returns a phonebook contact item.
   199          *
   200          * @param aContactId Contact item id to be read.
   201          * @param aFieldTypes   Array of types of fields to read in, all
   202          *                      fields are read if NULL (which is default).
   203          *                      NOTE: when using this parameter ReadContactL
   204          *                      may return more fields than expected; for example
   205          *                      if aFieldTypes contains any phonenumber the
   206          *                      method may return all phone number fields
   207          *                      of the contact.
   208          * @return A new Phonebook contact item.
   209          * @see CContactDatabase::ReadContactL
   210          */
   211         IMPORT_C CPbkContactItem* ReadContactL
   212             (TContactItemId aContactId, const CPbkFieldIdArray* aFieldTypes=NULL);
   213 
   214         /**
   215          * Same as ReadContactL, but leaves the returned contact item
   216          * on the cleanup stack.
   217          *
   218          * @param aContactId Contact item id to be read.
   219          * @param aFieldTypes   Array of types of fields to read in, all
   220          *                      fields are read if NULL (which is default).
   221          *                      NOTE: when using this parameter ReadContactL
   222          *                      may return more fields than expected; for example
   223          *                      if aFieldTypes contains any phonenumber the
   224          *                      method may return all phone number fields
   225          *                      of the contact.
   226          * @return A new Phonebook contact item.
   227          */
   228         IMPORT_C CPbkContactItem* ReadContactLC
   229             (TContactItemId aContactId, const CPbkFieldIdArray* aFieldTypes=NULL);
   230 
   231         /**
   232          * Same as ReadContactLC but reads only minimal information. See
   233          * Symbian Contacts Model documentation for definition of "minimal" in this
   234          * case.
   235          *
   236          * @param aContactId Contact item id to be read.
   237          * @return A new phonebook contact item. Leaves the item on the cleanup stack.
   238          * @see CContactDatabase::ReadMinimalContactL
   239          */
   240         IMPORT_C CPbkContactItem* ReadMinimalContactLC(TContactItemId aContactId);
   241 
   242         /**
   243          * Returns a Phonebook contact iterator.
   244          * @param aUseMinimalRead   If ETrue the iterator will use the Symbian
   245          * Contacts model CContactDatabase::ReadMinimalContactL, EFalse will read 
   246          * all the contact fields. Default behaviour is to read all fields.
   247          * @see CPbkContactIter::NewL.
   248          * @see CContactDatabase::ReadMinimalContactL
   249          */
   250         IMPORT_C CPbkContactIter* CreateContactIteratorLC
   251             (TBool aUseMinimalRead=EFalse);
   252 
   253     public:  // Modifying contacts
   254         /**
   255          * Opens a contact and returns a phonebook contact item.
   256          * @param aContactId Contact item id to be opened.
   257          * @return A Phonebook contact item that is marked as open in the database.
   258          * @see CContactDatabase::OpenContactL
   259          */
   260         IMPORT_C CPbkContactItem* OpenContactL(TContactItemId aContactId);
   261 
   262         /**
   263          * Same as OpenContactL, but leaves a lock record AND the opened
   264          * contact object on the cleanup stack.
   265          * Use CleanupStack::PopAndDestroy(2) to close the contact and destroy
   266          * the returned object. First pop pops the contact object and second
   267          * the lock object.
   268          * @param aContactId    Contact item id to open.
   269          * @return A Phonebook contact item that is marked as open in the database.
   270          * @see CContactDatabase::OpenContactLX
   271          */
   272         IMPORT_C CPbkContactItem* OpenContactLCX(TContactItemId aContactId);
   273 
   274         /**
   275          * Commit changes to a previously opened contact item into the contact
   276          * database.
   277          *
   278          * @param aContact          Contact item to be updated in the database.
   279          * @param aImmediateNotify  Send notification to observers immediately.
   280          *                          NOTE: send immediately will result in
   281          *                          observers (MPbkContactDbObserver) receiving
   282          *                          the event twice!
   283          * @see CContactDatabase::CommitContactL
   284          */
   285         IMPORT_C void CommitContactL
   286             (CPbkContactItem& aContact, TBool aImmediateNotify=EFalse);
   287 
   288         /**
   289          * Closes a previously opened contact item without saving changes.
   290          * @param aContactId Contact item to be closed.
   291          * @see CContactDatabase::CloseContactL
   292          */
   293     	IMPORT_C void CloseContactL(TContactItemId aContactId);
   294 
   295     public:  // Deleting contacts
   296         /**
   297          * Deletes a contact item from the database.
   298          * @param aContactId    Contact item to be deleted.
   299          * @param aImmediateNotify  Send notification to observers immediately.
   300          *                          NOTE: send immediately will result in
   301          *                          observers (MPbkContactDbObserver) receiving
   302          *                          the event twice!
   303          * @see CContactDatabase::DeleteContactL
   304          */
   305     	IMPORT_C void DeleteContactL
   306             (TContactItemId aContactId, TBool aImmediateNotify=EFalse);
   307 
   308         /**
   309          * Deletes multiple contact items from the database.
   310          * @param aContactIds    Contact items to be deleted.
   311          * @param aImmediateNotify  Send notification to observers immediately.
   312          *                          NOTE: send immediately will result in
   313          *                          observers (MPbkContactDbObserver) receiving
   314          *                          the event twice!
   315          * @see CContactDatabase::DeleteContactsL
   316          */
   317     	IMPORT_C void DeleteContactsL
   318             (const CContactIdArray& aContactIds, TBool aImmediateNotify=EFalse);
   319 
   320         /**
   321          * Deletes multiple contacts from the database in an active object
   322          * -driven asynchronous background process.
   323          *
   324          * @param aContactIds   Contacts to delete.
   325          */
   326         IMPORT_C void DeleteContactsOnBackgroundL
   327             (const CContactIdArray& aContactIds);
   328 
   329     public:  // Contact groups
   330         /**
   331          * Creates a new contact group.
   332          *
   333          * @param aGroupLabel   Group name.
   334          * @param aInTransaction    See Symbian Contacts Model documentation
   335          * for CContactDatabase::CreateContactGroupL documentation.
   336          * @see CContactDatabase::CreateContactGroupL
   337          */
   338         IMPORT_C CContactGroup* CreateContactGroupL
   339             (const TDesC& aGroupLabel,TBool aInTransaction=EFalse);
   340 
   341         /**
   342          * Adds a Contact to a group.
   343          *
   344          * @param aItemId   Contact to be added to group.
   345          * @param aGroupId  Group where the contact will be added to.
   346          * @see CContactDatabase::AddContactToGroupL
   347          */
   348     	IMPORT_C void AddContactToGroupL
   349             (TContactItemId aItemId, TContactItemId aGroupId);
   350 
   351         /**
   352          * Removes a contact from a group
   353          *
   354          * @param aItemId   Contact to be removed from group.
   355          * @param aGroupId  Group where the contact will be removed from.
   356          * @see CContactDatabase::RemoveContactFromGroupL
   357          */
   358     	IMPORT_C void RemoveContactFromGroupL
   359             (TContactItemId aItemId, TContactItemId aGroupId);
   360 
   361         /**
   362          * Reads a Contact group.
   363          *
   364          * @param aId Group id.
   365          * @return Contact group object.
   366          * @see CContactDatabase::ReadContactL
   367          */
   368         IMPORT_C CContactGroup* ReadContactGroupL(TContactItemId aId);
   369 
   370         /**
   371          * Opens a Contact group for modification.
   372          *
   373          * @param aId Groups id
   374          * @return Contact group object.
   375          * @see CContactDatabase::OpenContactL
   376          */
   377         IMPORT_C CContactGroup* OpenContactGroupL(TContactItemId aId);
   378 
   379         /**
   380          * Opens a Contact group for modification. Pushes the returned
   381          * contact group object and a lock item on the cleanup stack.
   382          *
   383          * @param aId Groups id
   384          * @return Contact group object.
   385          * @see CContactDatabase::OpenContactLX
   386          */
   387         IMPORT_C CContactGroup* OpenContactGroupLCX(TContactItemId aId);
   388 
   389         /**
   390          * Commits changes to a contact group to the database.
   391          *
   392          * @param aId Groups id
   393          * @param aImmediateNotify  Send notification to observers immediately.
   394          *                          NOTE: send immediately will result in
   395          *                          observers (MPbkContactDbObserver) receiving
   396          *                          the event twice!
   397          * @see CContactDatabase::CommitContactL
   398          */
   399         IMPORT_C void CommitContactGroupL(CContactGroup& aGroup, TBool aImmediateNotify=EFalse);
   400 
   401         /**
   402          * Deletes a contact group from the database.
   403          * @param aContactId    Contact group to be deleted.
   404          * @param aImmediateNotify  Send notification to observers immediately.
   405          *                          NOTE: send immediately will result in
   406          *                          observers (MPbkContactDbObserver) receiving
   407          *                          the event twice!
   408          * @see CContactDatabase::DeleteContactL
   409          */
   410         IMPORT_C void DeleteContactGroupL
   411             (TContactItemId aContactId, TBool aImmediateNotify=EFalse);
   412 
   413     public:  // Speed dials
   414         /**
   415          * Sets a speed dial to a contact field.
   416          *
   417          * @param aItem         Contact item to add speed dial to.
   418          * @param aFieldIndex   Field index to add Speed dial to.
   419          * @param aSpeedDialPosition    Speed dial position number to set to
   420          *                              the field.
   421          * @see CContactDatabase::SetFieldAsSpeedDialL
   422          */
   423         IMPORT_C void SetFieldAsSpeedDialL
   424             (CPbkContactItem& aItem, TInt aFieldIndex, TInt aSpeedDialPosition);
   425 
   426         /**
   427          * Returns a speed dial contact.
   428          *
   429          * @param   aSpeedDialPosition  Speed dial position number.
   430          * @param   aPhoneNumber        Phone number
   431          * @see CContactDatabase::GetSpeedDialFieldL.
   432          */
   433       	IMPORT_C TContactItemId GetSpeedDialFieldL
   434             (TInt aSpeedDialPosition, TDes& aPhoneNumber) const;
   435 
   436         /**
   437          * Removes a speed dial from a contact.
   438          *
   439          * @param   aContactId  Contact item to remove the speed dial from.
   440          * @param   aSpeedDialPosition  Speed dial position number to remove.
   441          * @see CContactDatabase::RemoveSpeedDialFieldL.
   442          */
   443     	IMPORT_C void RemoveSpeedDialFieldL
   444             (TContactItemId aContactId, TInt aSpeedDialPosition);
   445 
   446         /**
   447          * Returns ETrue if this field has been assigned a speed dial position.
   448          *
   449          * @param aItem contact Item to check for speed dial.
   450          * @param aFieldIndex   Index of the field to check. This is an index
   451          *                      into aItem.CardFields().
   452          * @return  ETrue if Speed dial exitst, EFalse if not.
   453          */
   454         IMPORT_C TBool IsSpeedDialAssigned
   455             (const CPbkContactItem& aItem, TInt aFieldIndex) const;
   456 
   457     public:  // Contact views
   458         /**
   459          * Returns a contact view object containing all the contacts in the
   460          * database.
   461          *
   462          * @return  Contact view containing all the contacts in the database.
   463          * @see CContactViewBase
   464          */
   465         IMPORT_C CContactViewBase& AllContactsView();
   466 
   467         /**
   468          * Returns a contact view object containing all the groups in the
   469          * database.
   470          *
   471          * @return  Contact view containing all the groups in the database.
   472          * @see CContactViewBase
   473          */
   474         IMPORT_C CContactViewBase& AllGroupsViewL();
   475 
   476         /**
   477          * Returns a contact view object containing all the contacts in the
   478          * database that match a filter.
   479          *
   480          * @param aFilter   Use CContactDatabase::TContactViewFilter.
   481          * @see CContactViewBase
   482          */
   483         IMPORT_C CContactViewBase& FilteredContactsViewL(TInt aFilter);
   484 
   485     public:  // Events
   486         /**
   487          * Creates and returns a new CPbkContactChangeNotifier for the
   488          * default contact database. The returned object attaches aObserver
   489          * to this engine instance as long as the object exists.
   490          *
   491          * @param aObserver Observer to attach to this object.
   492          * @return  New CPbkContactChangeNotifier object. Caller is responsible
   493          *          of the object.
   494          * @see CPbkContactChangeNotifier
   495          * @see MPbkContactDbObserver
   496          */
   497         IMPORT_C CPbkContactChangeNotifier* CreateContactChangeNotifierL
   498             (MPbkContactDbObserver* aObserver);
   499 
   500     public:  // Contact name formatting
   501         /**
   502          * Gets a title text for a contact or localised text for unnamed
   503          * contact if contact contains no title.
   504          *
   505          * @param   aItem   Contact item for which to make the title.
   506          * @return  A buffer containing the title or unnamed text if no title
   507          *          can be generated. Caller is responsible of deleting the
   508          *          returned buffer.
   509          */
   510         IMPORT_C HBufC* GetContactTitleL(const CPbkContactItem& aItem) const;
   511 
   512         /**
   513          * Similar to GetContactTitleL but returns NULL if contact contains no
   514          * title. Uses the MPbkFieldDataArray interface to access the field 
   515          * content.
   516          * @param aContactData  The contact field data array.
   517          * @return  Contact title, NULL if field array did not contain any fields
   518          * used to for constructing contact titles.
   519          * @see CPbkContactEngine::GetContactTitleL
   520          */
   521         IMPORT_C HBufC* GetContactTitleOrNullL
   522             (const MPbkFieldDataArray& aContactData);
   523 
   524         /**
   525          * Returns ETrue if field is one of the fields used in building the
   526          * contact title.
   527          *
   528          * @param aFieldId  The id of the field.
   529          * @return  ETrue if aFieldId is type of a field used to build contact
   530          *          titles.
   531          * @see GetContactTitleL
   532          * @see GetContactTitleOrNullL
   533          */
   534         IMPORT_C TBool IsTitleField(TPbkFieldId aFieldId) const;
   535 
   536         /**
   537          * @internal
   538          * Returns the contact name formatter.
   539          *
   540          * @see MPbkContactNameFormat
   541          * @deprecated
   542          */
   543         IMPORT_C MPbkContactNameFormat& ContactNameFormat() const;
   544 
   545         /**
   546          * Returns the localised title text to use for unnamed contacts.
   547          * @return  Localised title text to use for unnamed contacts.
   548          */
   549         IMPORT_C const TDesC& UnnamedTitle() const;
   550 
   551     public: // Searching
   552         /**
   553          * Call-through for new Phone number matching function in 6.2 version
   554          * of class CContactDatabase. If you don't need any other functionality
   555          * from CPbkContactEngine than this consider using the CContactDatabase
   556          * API directly. See Symbian Contacts Model documentation for 
   557          * CContactDatabase::MatchPhoneNumberL use.
   558          *
   559          * @see CContactDatabase::MatchPhoneNumberL(const TDesC&,const TInt)
   560          */
   561         IMPORT_C CContactIdArray* MatchPhoneNumberL
   562             (const TDesC& aNumber, const TInt aMatchLengthFromRight);
   563 
   564         /**
   565          * Searches all contacts in the database for aText.
   566          *
   567          * @param aText         Text to search.
   568          * @param aFieldTypes   Phonebook fields types to <i>at least</i>
   569          *                      include in the search. If NULL searches all
   570          *                      fields.<br>
   571          *                      <b>PLEASE NOTE:</b> The find matches in most
   572          *                      cases also other fields than those specified
   573          *                      in aFieldTypes. Always loop through the
   574          *                      returned contacts to check match in the
   575          *                      required fields.
   576          * @return Array of matching contact IDs.
   577          * @see CContactDatabase::FindLC.
   578          */
   579         IMPORT_C CContactIdArray* FindLC
   580             (const TDesC& aText, const CPbkFieldIdArray* aFieldTypes=NULL);
   581 
   582         /**
   583          * Searches all contacts in the database for aText asynchronously.
   584          *
   585          * @param aText         Text to search.
   586          * @param aFieldTypes   Phonebook fields types to <i>at least</i>
   587          *                      include in the search. If NULL searches all
   588          *                      fields.<br>
   589          *                      <b>PLEASE NOTE:</b> The find matches in most
   590          *                      cases also other fields than those specified
   591          *                      in aFieldTypes. Always loop through the
   592          *                      returned contacts to check match in the
   593          *                      required fields.
   594          * @param  aObserver    Observer for this operation.
   595          * @return  CPbkIdleFinder object which is used to access the find
   596          *          results when complete. Deleting this object will cancel
   597          *          this asyncronous find operation.
   598          * @see CContactDatabase::FindAsyncL.
   599          * @see CPbkIdleFinder
   600          */
   601 	    IMPORT_C CPbkIdleFinder* FindAsyncL(
   602             const TDesC& aText,
   603             const CPbkFieldIdArray* aFieldTypes=NULL,
   604             MIdleFindObserver *aObserver=NULL);
   605 
   606     public:  // Phonebook internal API
   607         /**
   608          * @internal
   609          * Sets the compression UI for this engine.
   610          * To be called by Phonebook only!
   611          *
   612          * @see MPbkCompressUi
   613          * @see CheckCompress
   614          * @see CancelCompress
   615          * @deprecated
   616          */
   617         IMPORT_C void SetCompressUi(MPbkCompressUi* aCompressiUi);
   618 
   619         /**
   620          * @internal
   621          * Checks if the contact database needs a compression.
   622          * To be called by Phonebook only!
   623          *
   624          * @see SetCompressUi
   625          * @see CompressL
   626          * @see CancelCompress
   627          * @deprecated
   628          */
   629         IMPORT_C TBool CheckCompress();
   630 
   631         /**
   632          * @internal
   633          * Compresses the database if necessary. To be called by Phonebook only.
   634          *
   635          * @see SetCompressUi
   636          * @see CancelCompress
   637          * @deprecated
   638          */
   639         IMPORT_C void CompressL();
   640 
   641         /**
   642          * @internal
   643          * Call to cancel any ongoing database compression started with
   644          * CheckCompressL(). Calls PbkCompressCanceled() for any registered
   645          * compression UI. To be called by Phonebook only.
   646          *
   647          * @see SetCompressUi
   648          * @see CheckCompress
   649          * @deprecated
   650          */
   651         IMPORT_C void CancelCompress();
   652 
   653         /**
   654          * @internal
   655          * Checks current file system space and amount of wasted space in
   656          * Phonebook's database. Compresses the database synchronously if
   657          * Phonebook's database can be made smaller by compression. If file
   658          * system space is still under critical level after compression,
   659          * leaves with KErrDiskFull.
   660          *
   661          * @exception KErrDiskFull if file system is out of space.
   662          * @deprecated
   663          */
   664         IMPORT_C void CheckFileSystemSpaceAndCompressL();
   665 
   666 		/**
   667 		 * @internal
   668 		 * Phonebook name ordering information.
   669          * @deprecated
   670 		 */
   671 		enum TPbkNameOrder
   672 			{
   673 			EPbkNameOrderLastNameFirstName = 0, /// Last name then first name order
   674 			EPbkNameOrderFirstNameLastName, /// First name then last name order
   675 			EPbkNameOrderNotDefined /// undefined name order
   676 			};
   677 
   678 		/**
   679 		 * @internal
   680 		 * Sets name display order.
   681 		 * @param aNameOrder The ordering to use
   682          * @deprecated
   683 		 */
   684 		IMPORT_C void SetNameDisplayOrderL(TPbkNameOrder aNameOrder);
   685 
   686 		/**
   687 		 * @internal
   688 		 * Gets name display order.
   689 		 * @return The name ordering in use
   690          * @deprecated
   691 		 */
   692 		IMPORT_C TPbkNameOrder NameDisplayOrderL();
   693 
   694 		/**
   695 		 * @internal
   696 		 * Returns the phonebook constants object.
   697          * @return Phonebook constants manager
   698          * @deprecated
   699 		 */
   700 		IMPORT_C CPbkConstants* Constants();
   701 
   702         /**
   703          * @internal
   704          * Returns the sort order manager of the engine.
   705          */
   706         const CPbkSortOrderManager& SortOrderManager() const;
   707 
   708 
   709 		/**
   710 		 * @internal
   711 		 * Sets whether a separator character is shown between
   712 		 * last and first names.
   713 		 * @param aSeparator This parameter should contain the character to be
   714 		 *	      used as separator. If value is 0 then separator will not be
   715 		 * 	      used between names.
   716 		 */
   717 		IMPORT_C void SetNameSeparatorL(TChar aSeparator);
   718 
   719         /**
   720 		 * @internal
   721 		 * Return info on whether separator character is used between last
   722 		 * and first names.
   723 		 * @return The separator character. Empty (value 0) if there is no
   724          *         separator.
   725 		 */
   726 		IMPORT_C TChar NameSeparator() const;
   727 
   728 
   729 
   730     private:  // from MContactDbObserver
   731         void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
   732 
   733     private:  // Interface for CPbkContactChangeNotifier
   734         friend class CPbkContactChangeNotifier;
   735         void AddObserverL(MPbkContactDbObserver* aObserver);
   736         void RemoveObserver(MPbkContactDbObserver* aObserver);
   737         void SendEventToAllObservers(const TContactDbObserverEvent& aEvent);
   738 
   739     private:  // Implementation
   740 		CPbkContactEngine();
   741 		void ConstructL(const TDesC* aFileName, TBool aReplace, RFs* aFs);
   742         void ConnectFsL(RFs* aRfs);
   743         void ReadResourcesL(TBool& aSettingsVisibility);
   744         void CreateDbConnectionL(const TDesC* aFileName, 
   745                                  TBool aReplace, 
   746                                  TInt& aDbOpenError,
   747                                  TBool aSettingsVisible);
   748         void SendImmidiateEventToAllObservers(
   749             TContactDbObserverEventType aEventType,
   750             TContactItemId aContactId, TBool aSendEvent);
   751         void doDeleteContactL(TContactItemId aContactId);
   752         class CContactDbConnection;
   753         friend class CContactDbConnection;
   754 		friend class CPbkSharedDataObserver;
   755 
   756     private:  // Data
   757         /// Ref: file server connection
   758         RFs iFs;
   759         /// Own: file server connection
   760         RFs iOwnFs;
   761         /// Own: Contact database connection object.
   762 		CContactDbConnection* iDbConnection;
   763         /// Own: Observer array
   764         CArrayPtr<MPbkContactDbObserver>* iObservers;
   765         /// Own: fields info array.
   766         CPbkFieldsInfo* iPbkFieldsInfo;
   767         /// Own: Phonebook constants
   768         CPbkConstants* iPbkConstants;
   769         /// Own: shared data client
   770         RSharedDataClient* iSharedDataClient;
   771         /// Own: maximum free space required to delete a contact from the DB
   772         TInt iFreeSpaceRequiredToDelete;
   773         /// Own: Engine extension interface
   774         CPbkEngineExtension* iExtension;
   775         /// Is separator used between first- and last-names of contacts
   776         TBool iUseSeparator;
   777         /// The separator to be used between first- and last-names of contacts
   778         TChar iSeparator;
   779         /// CPbkSINDHandler instance identifier key.
   780         TUid iDtorIDKey;
   781         /// Own: SIND Handler
   782         CPbkSINDHandlerInterface* iSINDHandler;
   783 
   784 
   785 
   786     };
   787 
   788 #endif   // __CPBKCONTACTENGINE_H__
   789 
   790 // End of File