phonebookui/Phonebook2/remotecontactlookup/engine/inc/cpbkxrclsearchresultdlg.h
changeset 0 e686773b3f54
child 8 5586b4d2ec3e
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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 CPbkxRclSearchResultDlg.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBKXRCLSEARCHRESULTDIALOG_H
       
    20 #define CPBKXRCLSEARCHRESULTDIALOG_H
       
    21 
       
    22 #include <coemain.h>
       
    23 
       
    24 #include "cpbkxrclbasedlg.h"
       
    25 #include "pbkxrclengineconstants.h"
       
    26 #include "fsccontactactionmenudefines.h"  //"pbkxcontactactionmenudefines.h"
       
    27 
       
    28 class CAknNavigationControlContainer;
       
    29 class CAknNavigationDecorator;
       
    30 class CAknTitlePane;
       
    31 class CContactCard;
       
    32 class CPbkContactEngine;
       
    33 class CPbkxRclActionServiceWrapper;
       
    34 class CPbkxContactActionMenu;
       
    35 class CGulIcon;
       
    36 class CFscContactActionMenu;
       
    37 class CAknLongTapDetector;
       
    38 
       
    39 /**
       
    40 * Dialog for showing remote contact lookup search results.
       
    41 *
       
    42 * Offers menu options and acion menu to initiate actions for contacts.
       
    43 */
       
    44 class CPbkxRclSearchResultDlg : 
       
    45     public CPbkxRclBaseDlg, 
       
    46     public MCoeForegroundObserver,
       
    47     public MEikListBoxObserver, 
       
    48     public MFsActionMenuPositionGiver
       
    49     {                          
       
    50 public: // constructor and destructor
       
    51     
       
    52     /**
       
    53     * Creates new object and returns pointer to it.
       
    54     *
       
    55     * @param aIndex Index which user selected from the list (probably not used?)
       
    56     * @param aArray Array of items.
       
    57     * @param aCommand Command observer for observing menu commands.
       
    58     * @param aContactItems Contact items to be shown on the dialog.
       
    59     * @param aContactEngine Contact engine for creating pbk contact items.
       
    60     * @param aActionService Action service wrapper.
       
    61     * @param aNaviText Navi text to be displayed.
       
    62     * @param aContactSelectorEnabled Flag indicating whether RCL is in contact
       
    63     *                                selector mode or not.
       
    64     * @return Created object.
       
    65     */
       
    66     static CPbkxRclSearchResultDlg* NewL(
       
    67         TInt &aIndex,
       
    68         CDesCArray* aArray,
       
    69         MEikCommandObserver* aCommand,
       
    70         RPointerArray<CContactCard>& aContactItems,
       
    71         CPbkContactEngine& aContactEngine,
       
    72         CPbkxRclActionServiceWrapper& aActionService,
       
    73         TBool aContactSelectorEnabled,
       
    74         TBool aMoreThanMaxResults);
       
    75         
       
    76     /**
       
    77     * Destructor.
       
    78     */
       
    79     virtual ~CPbkxRclSearchResultDlg();
       
    80 
       
    81 public: // methods from base classes
       
    82 
       
    83     /**
       
    84     * Hides menu items that are not usable.
       
    85     *
       
    86     * @param aResourceId Menu resource id.
       
    87     * @param aMenu Menu pane.
       
    88     */
       
    89     virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane );
       
    90 
       
    91     /**
       
    92     * Gets help context for this view.
       
    93     *
       
    94     * @param aContext On return, contains help context information
       
    95     */
       
    96     virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
       
    97  
       
    98     /**
       
    99     * Dialog is popped on foreground.
       
   100     */
       
   101     virtual void HandleGainingForeground();
       
   102 
       
   103     /**
       
   104     * Dialog is popped background.
       
   105     */
       
   106     virtual void HandleLosingForeground();
       
   107     
       
   108     /**
       
   109     * From MEikListBoxObserver
       
   110     * Handles listbox pointer events
       
   111     */
       
   112     void HandleListBoxEventL(
       
   113             CEikListBox *aListBox, TListBoxEvent aEventType );
       
   114 
       
   115 
       
   116 public: // new methods
       
   117 
       
   118     /**
       
   119     * Executes dialog and destroys it after dialog is closed.
       
   120     */
       
   121     void ExecuteLD();
       
   122 
       
   123     /**
       
   124     * Returns index of the currently selected item.
       
   125     *
       
   126     * @return Index of the currently selected item.
       
   127     */
       
   128     TInt CurrentItemIndex() const;
       
   129 
       
   130     /**
       
   131     * Sets index of the currently selected item.
       
   132     *
       
   133     * @param aIndex Index to be set.
       
   134     */
       
   135     void SetCurrentItemIndexL( TInt aIndex );
       
   136     
       
   137     /**
       
   138     * Sets current contact to action service.
       
   139     *
       
   140     * This affect menu item visibility.
       
   141     */
       
   142     void SetCurrentContactToActionServiceL();
       
   143     
       
   144     /**
       
   145     * Closes dialog.
       
   146     */
       
   147     void Close();
       
   148     
       
   149     /**
       
   150     * Updates search result dialog.
       
   151     *
       
   152     * @param aNaviText New navi text.
       
   153     */
       
   154     void UpdateDialogL();
       
   155     
       
   156     /**
       
   157     * Sends business card of the currently selected contact.
       
   158     */
       
   159     void SendBusinessCardL();
       
   160 
       
   161     //Fix for: PKAO-7NNCJ2
       
   162     /**
       
   163     * Informs dialog that info dialog is visible.
       
   164     */
       
   165     void InfoDlgVisible( TBool aVisible );
       
   166     
       
   167 
       
   168 protected: // redefinition of functions of the base class
       
   169 
       
   170     /**
       
   171     * From CAknSelectionListDialog.
       
   172     *
       
   173     * Handles key events.
       
   174     *
       
   175     * @param aKeyEvent Key event.
       
   176     * @param aType Type of the key event.
       
   177     * @return Key response (handled/not handled).
       
   178     */
       
   179     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   180 
       
   181     TBool OkToExitL( TInt aButtonId );
       
   182     
       
   183 private: // methods used internally
       
   184     
       
   185    /**
       
   186     * Sets up title pane text.
       
   187     */
       
   188     void SetTitlePaneTextL();
       
   189     
       
   190     /**
       
   191     * Sets up status pane.
       
   192     */
       
   193     void SetupStatusPaneL();
       
   194     
       
   195     /**
       
   196     * Updates status pane.
       
   197     */
       
   198     void UpdateStatusPaneL();
       
   199 
       
   200     /**
       
   201     * Resets status pane.
       
   202     */
       
   203     void ResetStatusPane();
       
   204 
       
   205     /**
       
   206     * Creates list box entries.
       
   207     */
       
   208     void CreateListBoxEntriesL();
       
   209 
       
   210     /**
       
   211     * Creates given list box entry.
       
   212     *
       
   213     * @param aIndex Index of the list box entry.
       
   214     */
       
   215     void CreateListBoxEntryL( TInt aIndex );
       
   216     
       
   217     /**
       
   218     * Updates given list box entry.
       
   219     *
       
   220     * @param aIndex List box entry index.
       
   221     */
       
   222     void UpdateListBoxEntryL( TInt aIndex );
       
   223 
       
   224     /**
       
   225     * Loads navi text from resources.
       
   226     *
       
   227     * @return Navi text.
       
   228     */
       
   229     void LoadNaviTextL();
       
   230 
       
   231     /**
       
   232     * Returns ETrue if there is at least one call action available.
       
   233     *
       
   234     * @return ETrue if there is at least one call action available.
       
   235     */
       
   236     TBool CallActionsAvailable() const;
       
   237 
       
   238     /**
       
   239     * Creates and initializes action menu.
       
   240     */
       
   241     void InitializeActionMenuL();
       
   242 
       
   243     /**
       
   244     * Shows action menu and handles possible custom command.
       
   245     */
       
   246     void ShowActionMenuL( const TPoint& aPenEventScreenLocation );
       
   247 
       
   248     /**
       
   249     * Calculates action menu position based on currently selected
       
   250     * item.
       
   251     *
       
   252     * @return Action menu position.
       
   253     */
       
   254     TFscContactActionMenuPosition GetActionMenuPosition();
       
   255 
       
   256     /**
       
   257     * Returns ETrue if action menu is available.
       
   258     *
       
   259     * @return ETrue if action menu is available.
       
   260     */
       
   261     TBool ActionMenuAvailable() const;
       
   262 
       
   263     /**
       
   264     * Creates and adds save as contact action to action menu.
       
   265     */
       
   266     void CreateAndAddSaveAsContactActionL();
       
   267 
       
   268     /**
       
   269     * Returns ETrue if scrolling is in progress.
       
   270     *
       
   271     * Scrolling means that user is pressing up or down arrow so that
       
   272     * it creates multiple key presses.
       
   273     *
       
   274     * @return ETrue if scrolling is enabled.
       
   275     */ 
       
   276     TBool ScrollingInProgress() const;
       
   277     
       
   278     /**
       
   279     * This method is called when scrolling has stopped.
       
   280     */
       
   281     void ScrollingStoppedL();
       
   282     
       
   283     /**
       
   284      * Shows a note to user that more than max number of
       
   285      * results found and only N number of those is shown
       
   286      */
       
   287     void DisplayTooManyResultsInfoNoteL();
       
   288 
       
   289 private: // constructors
       
   290 
       
   291     /**
       
   292     * Constructor.
       
   293     *
       
   294     * @param aIndex Index which user selected from the list (probably not used?)
       
   295     * @param aArray Array of items.
       
   296     * @param aCommand Command observer for observing menu commands.
       
   297     * @param aContactItems Contact items to be shown on the dialog.
       
   298     * @param aContactEngine Contact engine for creating pbk contact items.
       
   299     * @param aActionService For executing menu commands.
       
   300     * @param aContactSelectorEnabled Flag indicating whether RCL is in contact
       
   301     *                                selector mode or not.
       
   302     */ 
       
   303     CPbkxRclSearchResultDlg(
       
   304         TInt& aIndex,
       
   305         CDesCArray* aArray,
       
   306         MEikCommandObserver* aCommand,
       
   307         RPointerArray<CContactCard>& aContactItems,
       
   308         CPbkContactEngine& aContactEngine,
       
   309         CPbkxRclActionServiceWrapper& aActionService,
       
   310         TBool aContactSelectorEnabled,
       
   311         TBool aMoreThanMaxResults);
       
   312         
       
   313 
       
   314     /**
       
   315     * Second-phase constructor.
       
   316     *
       
   317     * @param aNaviText Navi text to be displayed.
       
   318     */
       
   319     void ConstructL();
       
   320 
       
   321     /**
       
   322     * Constructs menu bar.
       
   323     * 
       
   324     * @param aResourceId - menubar resource id 
       
   325     */
       
   326     void ConstructMenuBarL( TInt aResourceId );
       
   327   
       
   328 private:
       
   329     
       
   330     /**
       
   331     * From CCoeControl,HandlePointerEventL.
       
   332     */
       
   333     void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
       
   334     
       
   335     
       
   336     /**
       
   337     * From MFsActionMenuPositionGiver
       
   338     */    
       
   339     TPoint ActionMenuPosition();
       
   340     
       
   341     
       
   342     CAknLongTapDetector& LongTapDetectorL();
       
   343     
       
   344 private: // data
       
   345     
       
   346     // Indexes of icon array.
       
   347     enum TIconIndex
       
   348         {
       
   349         EActionMenuEnabled = 0    // Action menu enabled icon
       
   350         };
       
   351 
       
   352     // Contact engine.
       
   353     CPbkContactEngine& iContactEngine;
       
   354 
       
   355     // Contact action service wrapper. Used to execute menu commands.
       
   356     CPbkxRclActionServiceWrapper& iContactActionService;
       
   357 
       
   358     // Contact action menu for executing commands. Owned.
       
   359     CFscContactActionMenu* iActionMenu;
       
   360     
       
   361     // Items. Not owned.
       
   362     CDesCArray* iItems;
       
   363 
       
   364     // Navi pane of the current UI application. Not owned.
       
   365     CAknNavigationControlContainer* iNaviPane;
       
   366     
       
   367     // Navigation label to be shown while result dialog is shown. Owned.
       
   368     CAknNavigationDecorator* iNaviDecorator;
       
   369     
       
   370     // Contact items. Not owned.
       
   371     RPointerArray<CContactCard>& iContactItems;
       
   372 
       
   373     // Flag indicating if contact selector is enabled.
       
   374     TBool iContactSelectorEnabled;
       
   375 
       
   376     // Flag indicating whether dialog should be closed after processing user command.
       
   377     TBool iClose;
       
   378 
       
   379     // Selected item index.
       
   380     TInt& iSelectedItemIndex;
       
   381 
       
   382     // Navigation label text. Owned.
       
   383     RBuf iNaviText;
       
   384 
       
   385     // Icon for add recipient action menu item. Owned.
       
   386     CGulIcon* iAddRecipientIcon;
       
   387 
       
   388     // Flag indicating whether save as contact action menu item is
       
   389     // already added.
       
   390     TBool iSaveAsAdded;
       
   391 
       
   392     // Set when dialog is exiting. After that no key presses are handled.
       
   393     TBool iExit;
       
   394     
       
   395     // Flag indicating that up or down arrow is held down.
       
   396     TBool iKeyDown;
       
   397 
       
   398     // Counter how many keypresses has occurred since key has been pressed 
       
   399     // down.
       
   400     TInt iKeyCounter;
       
   401 
       
   402     //Fix for: PWAN-7MC7WA
       
   403     //Flag indicating that CAS query was performed
       
   404     TBool iIsScrollLaunched;
       
   405     
       
   406     //Fix for: PKAO-7NNCJ2
       
   407     //Flag indicating that info dialog is visible. Owned.
       
   408     TBool iIsInfoDlgVisible;
       
   409     
       
   410     //Holds the position of the Contact Action Menu
       
   411     TPoint iActionMenuPosition;
       
   412     
       
   413     //ETrue - If Contact Action Menu is being Shown
       
   414     TBool iActionMenuStarted;
       
   415 	
       
   416     ///ETrue - if the more than max results note needs to be shown
       
   417     TBool iMoreThanMaxResults;
       
   418     
       
   419     // Original title pane text. Owned.
       
   420     HBufC* iOriginalTitleText;
       
   421     // Pointer reference to title pane. Not owned.
       
   422     CAknTitlePane* iTitlePane;
       
   423     };
       
   424 
       
   425 #endif