phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchersetdefault.h
changeset 0 e686773b3f54
child 3 04ab22b956c2
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  Implementation of comm launcher view plugin
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CCAPPCOMMLAUNCHERSETDEFAULT_H_
       
    19 #define CCAPPCOMMLAUNCHERSETDEFAULT_H_
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "ccalogger.h"
       
    23 #include <mvpbksinglecontactoperationobserver.h>
       
    24 #include <mvpbkcontactattributemanager.h>
       
    25 #include <mvpbkcontactstoreobserver.h>
       
    26 #include <vpbkfieldtype.hrh>
       
    27 #include <mvpbkcontactobserver.h>
       
    28 #include <rpbk2localizedresourcefile.h>
       
    29 #include <mvpbkbatchoperationobserver.h>
       
    30 
       
    31 class CCCAppCmsContactFetcherWrapper;
       
    32 class CPbk2ApplicationServices;
       
    33 
       
    34 class CCCAppCommLauncherLSetDefault: 
       
    35     public CBase,
       
    36     public MVPbkSingleContactOperationObserver,
       
    37     public MVPbkSetAttributeObserver,
       
    38     public MVPbkContactStoreObserver,
       
    39     public MVPbkContactObserver
       
    40 {
       
    41 public:
       
    42 	/**
       
    43 	 * Two phased constructor.
       
    44 	 */
       
    45 	 static CCCAppCommLauncherLSetDefault* NewL( CCCAppCommLauncherPlugin& aPlugin );
       
    46 
       
    47 	/**
       
    48 	 * Destructor.
       
    49 	 */
       
    50 	 ~CCCAppCommLauncherLSetDefault();
       
    51 	 
       
    52 	 void ExecuteAssignDefaultL();
       
    53 	 
       
    54 public: // From MVPbkSingleContactOperationObserver
       
    55 
       
    56     void VPbkSingleContactOperationComplete(
       
    57         MVPbkContactOperationBase& aOperation,
       
    58         MVPbkStoreContact* aContact);
       
    59 
       
    60     void VPbkSingleContactOperationFailed(
       
    61         MVPbkContactOperationBase& aOperation,
       
    62         TInt aError);
       
    63     
       
    64 private: // From MVPbkSetAttributeObserver
       
    65 	
       
    66     void AttributeOperationComplete(
       
    67             MVPbkContactOperationBase& aOperation );
       
    68     void AttributeOperationFailed(
       
    69             MVPbkContactOperationBase& aOperation,
       
    70             TInt aError );
       
    71     
       
    72 public: // From MVPbkContactStoreObserver
       
    73 
       
    74     void StoreReady(
       
    75         MVPbkContactStore& aContactStore);
       
    76 
       
    77     void StoreUnavailable(
       
    78         MVPbkContactStore& aContactStore,
       
    79         TInt aReason);
       
    80 
       
    81     void HandleStoreEventL(
       
    82         MVPbkContactStore& aContactStore,
       
    83         TVPbkContactStoreEvent aStoreEvent );
       
    84     
       
    85 private: // From MVPbkContactObserver
       
    86     
       
    87 	void ContactOperationCompleted(
       
    88             TContactOpResult aResult );
       
    89     
       
    90 	void ContactOperationFailed(
       
    91             TContactOp aOpCode,
       
    92             TInt aErrorCode,
       
    93             TBool aErrorNotified );
       
    94 	
       
    95 private:
       
    96 
       
    97     /**
       
    98      * Private constructor
       
    99      */    
       
   100 	CCCAppCommLauncherLSetDefault(CCCAppCommLauncherPlugin& aPlugin );
       
   101 
       
   102     /**
       
   103      * ConstructL
       
   104      */    
       
   105     void ConstructL();
       
   106     
       
   107 private: // New implemetations
       
   108 	
       
   109 	/* Wait to finish
       
   110      * @param - none
       
   111 	 * @return - none
       
   112      */
       
   113 	void WaitFinish();
       
   114 	
       
   115 	/* Stop wait
       
   116 	 * @param - none
       
   117 	 * @return - none
       
   118 	 */
       
   119 	void StopWait();
       
   120 	
       
   121 	/* Lock contact before setting default
       
   122 	 * @param - none
       
   123      * @return - none
       
   124 	 */
       
   125 	void LockContactL();
       
   126 	
       
   127 	/* Loop through all fields to find if have field for this default type
       
   128 	 * @param:aDefaultType - default type
       
   129 	 * @return - ETrue if find, EFalse if not find
       
   130 	 */
       
   131 	TBool FindContactFieldWithAttributeL( TVPbkDefaultType aDefaultType );
       
   132 	
       
   133 	/* Do set default atrribut
       
   134 	 * @param: aDefaultType - default type
       
   135 	 * @return: aIndex - the field index which will be set default
       
   136 	 */
       
   137 	void DoSetDefaultL( TVPbkDefaultType aDefaultType, TInt aIndex );
       
   138 	
       
   139 	/* Set next
       
   140 	 * @param - none
       
   141      * @return - none
       
   142 	 */
       
   143 	void SetNextL();
       
   144 	
       
   145 	/* Check if has field for this selector
       
   146 	 * @param:aContactAction - contact action
       
   147 	 * @param:aIndex - the field index 
       
   148 	 * @return - true for have, false for not have
       
   149 	 */
       
   150 	TBool IsContactActionHasField(
       
   151 	        VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction, TInt& aIndex);
       
   152 	
       
   153 	/* Map selector id to default type
       
   154 	 * @param:aSelectorID - selector id
       
   155 	 * @return - default type
       
   156 	 */
       
   157 	TVPbkDefaultType MapSelectorIdToDefaultType( 
       
   158 			const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID );
       
   159 	
       
   160 	/* Get next selector id
       
   161 	 * @param - none
       
   162 	 * @return - next selector id
       
   163 	 */
       
   164 	VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector NextAttribute();
       
   165 	
       
   166 	/* Default setting complete
       
   167 	 * @param - none
       
   168 	 * @return - none
       
   169 	 */
       
   170 	void DefaultSettingCompleteL();
       
   171 	
       
   172 	/* Process finished
       
   173 	 * @param:aError - error id
       
   174 	 * @return - none
       
   175 	 */
       
   176 	void ProcessFinished( TInt aError );
       
   177 	
       
   178 	/* Handle error
       
   179 	 * @param:aError - error id
       
   180 	 * @return - none
       
   181 	 */
       
   182 	void HandleError( TInt aError );
       
   183 	
       
   184 	/* Check if the contact is phone memory contact
       
   185 	 * @param:aContact - the contact
       
   186 	 * @return - true for phone memory contact, otherwise return false
       
   187 	 */
       
   188 	TBool IsPhoneMemoryContact(
       
   189 	        const MVPbkStoreContact& aContact) const;
       
   190     
       
   191 private: // Member variables
       
   192 	
       
   193 	// Own: array for action id
       
   194 	CArrayFixFlat<VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector>* iDefaultActions;
       
   195 	
       
   196 	// Own: Scheduler wait
       
   197 	CActiveSchedulerWait* iWaitFinish;
       
   198 	
       
   199 	// Own: store contact
       
   200 	MVPbkStoreContact* iStoreContact;
       
   201 	
       
   202 	// Own: retrieve operation
       
   203     MVPbkContactOperationBase* iRetrieveOperation; 
       
   204     
       
   205     // Own: links
       
   206     MVPbkContactLinkArray* iLinks;
       
   207     
       
   208     // Own: attribut operation
       
   209     MVPbkContactOperationBase* iSetAttributeOperation;
       
   210     
       
   211     // Own: contact store
       
   212     MVPbkContactStore* iContactStore;
       
   213     
       
   214     // referenct to plugin
       
   215     CCCAppCommLauncherPlugin& iPlugin;
       
   216     
       
   217     // wrapper
       
   218     CCCAppCmsContactFetcherWrapper* iCmsWrapper;
       
   219     
       
   220     // link array des
       
   221     HBufC8* iContactLinkArrayDes;
       
   222     
       
   223     // Application service
       
   224     CPbk2ApplicationServices* iAppServices;
       
   225     
       
   226     /// Own: Phonebook 2 commands dll resource file
       
   227     RPbk2LocalizedResourceFile iCommandsResourceFile;
       
   228 
       
   229     /// Own: Phonebook 2 UI controls dll resource file
       
   230     RPbk2LocalizedResourceFile iUiControlsResourceFile;
       
   231 
       
   232     /// Own: Phonebook 2 common UI dll resource file
       
   233     RPbk2LocalizedResourceFile iCommonUiResourceFile;
       
   234        
       
   235     };
       
   236 
       
   237 #endif /* CCAPPCOMMLAUNCHERSETDEFAULT_H_ */