emailcontacts/remotecontactlookup/engine/inc/cpbkxrclresultinfodlg.h
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
       
     2 * Copyright (c) 2008 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:  Definition of the class CPbkxRclResultInfoDlg
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBKXRCLRESULTINFODLG_H
       
    20 #define CPBKXRCLRESULTINFODLG_H
       
    21 
       
    22 #include "cpbkxrclbasedlg.h"
       
    23 #include "pbkxrclengineconstants.h"
       
    24 #include <eiklbo.h>                 // MEikListBoxObserver
       
    25 
       
    26 class CAknNavigationControlContainer;
       
    27 class CAknNavigationDecorator;
       
    28 class CAknTabGroup;
       
    29 class CAknTitlePane;
       
    30 class MPbkxRclContactRetrieval;
       
    31 class CPbkContactItem;
       
    32 class CPbkContactEngine;
       
    33 class CPbkxRclCbRSender;
       
    34 class CPbkxRclActionServiceWrapper;
       
    35 class TPbkContactItemField;
       
    36 class CPbkFieldArray;
       
    37 
       
    38 /**
       
    39  *  Result information view implementation.
       
    40  *
       
    41  *  @lib pbkxrclengine.lib
       
    42  *  @since S60 3.1
       
    43  */
       
    44 class CPbkxRclResultInfoDlg : public CPbkxRclBaseDlg,
       
    45 							  public MEikListBoxObserver
       
    46     {
       
    47 public: // constructor and destructor
       
    48 
       
    49     /**
       
    50     * Two-phase constructor.
       
    51     *
       
    52     * @param aIndex Selected item index, is updated by dialog after selection
       
    53     *               is made.
       
    54     * @param aArray Array of list box items.
       
    55     * @param aCommand Observer which executes dialog menu commands.
       
    56     * @param aContactRetrieval Used to get more information about contacts.
       
    57     * @param aContactEngine Used to create pbk contacts.
       
    58     * @param aActionService Contact action service.
       
    59     * @param aContactSelectorEnabled Flag indicating whether contact
       
    60     *                                selection is enabled.
       
    61     * @param aActiveItemIndex Initial active item index.
       
    62     * @return Created object.
       
    63     */
       
    64     static CPbkxRclResultInfoDlg* NewL( 
       
    65         TInt& aIndex, 
       
    66         CDesCArray* aArray,
       
    67         MEikCommandObserver* aCommand,
       
    68         MPbkxRclContactRetrieval* aContactRetrieval,
       
    69         CPbkContactEngine& aContactEngine,
       
    70         CPbkxRclActionServiceWrapper& aActionService,
       
    71         TBool aContactSelectorEnabled,
       
    72         TInt aActiveItemIndex );
       
    73     
       
    74     /**
       
    75     * Destructor.
       
    76     */
       
    77     virtual ~CPbkxRclResultInfoDlg();
       
    78 
       
    79 public: // methods from base classes
       
    80     
       
    81     /**
       
    82     * Hides option menu items that are not supposed to be shown.
       
    83     *
       
    84     * @param aResourceId Menu resource id.
       
    85     * @param aMenuPane Menu pane.
       
    86     */
       
    87     virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
    88 
       
    89     /**
       
    90     * Gets help context for this view.
       
    91     *
       
    92     * @param aContext On return, contains help context information
       
    93     */
       
    94     virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
       
    95 
       
    96 public: // new methods
       
    97 
       
    98     /**
       
    99     * Executes dialog and destroys it after it is closed.
       
   100     */
       
   101     void ExecuteLD();
       
   102 
       
   103     /**
       
   104     * Closes dialog.
       
   105     */
       
   106     void Close();
       
   107 
       
   108     /**
       
   109     * Sends callback request to selected contact.
       
   110     */
       
   111     void SendCallbackRequestL();
       
   112 
       
   113     /**
       
   114     * Sends bussiness card of currently selected contact.
       
   115     */ 
       
   116     void SendBusinessCardL();
       
   117 
       
   118     /**
       
   119     * Updates existing contact with currently selected field.
       
   120     *
       
   121     * If update is successful, a string is constructed which is shown
       
   122     * to the user.
       
   123     *
       
   124     * @return Constructed string to be shown to the user or NULL, if
       
   125     *         operation failed.
       
   126     */
       
   127     HBufC* UpdateExistingContactL();
       
   128     
       
   129 protected: // redefinition of functions in the base class
       
   130 
       
   131     /**
       
   132     * Handles key events.
       
   133     *
       
   134     * @param aKeyEvent Key event.
       
   135     * @param aType Type of the key event.
       
   136     * @return Key response (handled/not handled).
       
   137     */
       
   138     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   139 
       
   140 	// MEikListBoxObserver
       
   141 
       
   142     /**
       
   143      * Listbox event handler.
       
   144      *
       
   145      * @param aListBox that invoked the event.
       
   146      * @param aEventType Type of the event.
       
   147      */
       
   148     virtual void HandleListBoxEventL(
       
   149        CEikListBox* aListBox,
       
   150        TListBoxEvent aEventType );
       
   151 
       
   152     TBool OkToExitL( TInt aButtonId );
       
   153     
       
   154 private: // methods used internally
       
   155 
       
   156     /**
       
   157     * Setup status pane (tab group and title pane text).
       
   158     */
       
   159     void SetupStatusPaneL();
       
   160 
       
   161     /**
       
   162     * Setup tab group.
       
   163     *
       
   164     * Each contact gets its own tab.
       
   165     */
       
   166     void SetupTabGroupL();
       
   167 
       
   168     /**
       
   169     * Sets the visibility of navi indicators.
       
   170     */
       
   171     void SetNaviIndicatorsL();
       
   172 
       
   173     /**
       
   174     * Sets title pane text.
       
   175     */
       
   176     void SetTitlePaneTextL();
       
   177 
       
   178     /**
       
   179     * Reverts changes made to status pane.
       
   180     */
       
   181     void ResetStatusPane();
       
   182 
       
   183     /**
       
   184     * Removes tab group and frees the resources.
       
   185     */
       
   186     void ResetTabGroup();
       
   187 
       
   188     /**
       
   189     * Creates list box entries of the currently selected contact.
       
   190     */
       
   191     void CreateListBoxEntriesL();
       
   192 
       
   193     /**
       
   194     * Fetches current contact from contact retrieval interface.
       
   195     *
       
   196     * @return ETrue if fetching is successful, EFalse otherwise.
       
   197     */
       
   198     TBool FetchCurrentContactL();
       
   199 
       
   200     /**
       
   201     * Updates both list box entries and status pane.
       
   202     */
       
   203     void UpdateDialogL();
       
   204 
       
   205     /**
       
   206     * Returns ETrue if there are call actions available, EFalse
       
   207     * otherwise.
       
   208     *
       
   209     * @return ETrue if there is call actions available.
       
   210     */
       
   211     TBool CallActionsAvailable() const;
       
   212 
       
   213     /**
       
   214     * Returns ETrue if focus is on phone number field.
       
   215     *
       
   216     * @return ETrue if focus is on phone number field.
       
   217     */
       
   218     TBool FocusOnPhoneNumberField() const;
       
   219 
       
   220     /**
       
   221     * Returns ETrue if focus is on email address field.
       
   222     *
       
   223     * @return ETrue if focus is on email address field.
       
   224     */
       
   225     TBool FocusOnEmailAddressField() const;
       
   226         
       
   227     /**
       
   228     * Returns ETrue if focus is on voip field.
       
   229     *
       
   230     * @return ETrue if focus is on voip field.
       
   231     */
       
   232     TBool FocusOnVoipField() const;
       
   233 
       
   234     /**
       
   235     * Returns current field focused.
       
   236     */
       
   237     TPbkContactItemField& CurrentField() const;
       
   238 
       
   239 private: // constructors
       
   240 
       
   241     /**
       
   242     * Constructor.
       
   243     *
       
   244     * @param aIndex Selected item index, is updated by dialog after selection
       
   245     *               is made.
       
   246     * @param aArray Array of list box items.
       
   247     * @param aCommand Observer which executes dialog menu commands.
       
   248     * @param aContactRetrieval Used to get more information about contacts.
       
   249     * @param aContactEngine Used to create pbk contacts.
       
   250     * @param aActionService Contact action service.
       
   251     * @param aContactSelectorEnabled Flag indicating whether contact
       
   252     *                                selection is enabled.
       
   253     * @param aActiveItemIndex Initial active item index.
       
   254     */
       
   255     CPbkxRclResultInfoDlg( 
       
   256         TInt& aIndex, 
       
   257         CDesCArray* aArray, 
       
   258         MEikCommandObserver* aCommand,
       
   259         MPbkxRclContactRetrieval* aContactRetrieval,
       
   260         CPbkContactEngine& aContactEngine,
       
   261         CPbkxRclActionServiceWrapper& aActionService,
       
   262         TBool aContactSelectorEnabled,
       
   263         TInt aActiveItemIndex );
       
   264     
       
   265     /**
       
   266     * Second-phase constructor.
       
   267     */
       
   268     void ConstructL();    
       
   269     
       
   270 private: // data
       
   271 
       
   272     // Array of items. Not owned.
       
   273     CDesCArray* iItems;
       
   274 
       
   275     // Contacts which information are shown. Owned.
       
   276     CPbkContactItem* iCurrentContact;
       
   277     
       
   278     // Navi pane of the current UI application. Not owned.
       
   279     CAknNavigationControlContainer* iNaviPane;
       
   280 
       
   281     // Navigation decorator. Owned.
       
   282     CAknNavigationDecorator* iNaviDecorator;
       
   283 
       
   284     // Navigation tab group. Not owned.
       
   285     CAknTabGroup* iTabGroup;
       
   286 
       
   287     // Title pane of the application. Not owned.
       
   288     CAknTitlePane* iTitlePane;
       
   289     
       
   290     // Currently active tab.
       
   291     TInt iActiveTabIndex;
       
   292 
       
   293     // Flag indicating whether contact selector is enabled or not.
       
   294     TBool iContactSelectorEnabled;
       
   295 
       
   296     // Interface through which contact details are retrieved. Not owned.
       
   297     MPbkxRclContactRetrieval* iContactRetrieval;
       
   298 
       
   299     // Contact engine to fetch the correct item priorities.
       
   300     CPbkContactEngine& iContactEngine;
       
   301 
       
   302     // Action service wrapper for handling menu commands.
       
   303     CPbkxRclActionServiceWrapper& iContactActionService;
       
   304 
       
   305     // Text shown in wait note when details are retrieved. Owned.
       
   306     RBuf iWaitNoteText;
       
   307 
       
   308     // Original title pane text. Owned.
       
   309     HBufC* iTitlePaneText;
       
   310 
       
   311     // Class for making callback requests. Owned.
       
   312     CPbkxRclCbRSender* iCallbackReqSender;
       
   313 
       
   314     // Currently visible fields. Owned.
       
   315     CPbkFieldArray* iVisibleFields;
       
   316 
       
   317     // Flag indicating that we are exiting dialog. After this is set
       
   318     // no key presses are handled.
       
   319     TBool iExit;
       
   320 
       
   321     };
       
   322 
       
   323 #endif // CPBKXRCLRESULTINFODLG_H
       
   324