|         |      1 /* | 
|         |      2 * Copyright (c) 2006 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:  Handles CItemFinder and CFindItemMenu for mail viewer. | 
|         |     15 * | 
|         |     16 */ | 
|         |     17  | 
|         |     18 #ifndef CMSGMAILVIEWERFINDITEMHANDLER_H | 
|         |     19 #define CMSGMAILVIEWERFINDITEMHANDLER_H | 
|         |     20  | 
|         |     21 // INCLUDES | 
|         |     22 #include <e32base.h> | 
|         |     23 #include <MsgRecipientItem.h> | 
|         |     24 #include <ItemFinder.h> | 
|         |     25 #include <MsgEditor.hrh> | 
|         |     26  | 
|         |     27 // FORWARD DECLARATIONS | 
|         |     28 class CFindItemMenu; | 
|         |     29 class CEikMenuPane; | 
|         |     30 class CItemFinder; | 
|         |     31  | 
|         |     32 // CLASS DECLARATION | 
|         |     33  | 
|         |     34 /** | 
|         |     35 * Class for handling CItemFinder and CFindItemMenu for mail viewer. | 
|         |     36 *    | 
|         |     37 */ | 
|         |     38 NONSHARABLE_CLASS(CMsgMailViewerFindItemHandler) : public CBase | 
|         |     39 	{ | 
|         |     40     public: // Constructors and destructor | 
|         |     41      | 
|         |     42         /** | 
|         |     43         * NewL | 
|         |     44         * Creates find item handler | 
|         |     45         * @param aItemFinder, ownership is not transferred | 
|         |     46         * @return self | 
|         |     47         */     | 
|         |     48         static CMsgMailViewerFindItemHandler* NewL( | 
|         |     49              CItemFinder* aItemFinder ); | 
|         |     50  | 
|         |     51         /** | 
|         |     52         * Destructor. | 
|         |     53         */ | 
|         |     54         ~CMsgMailViewerFindItemHandler(); | 
|         |     55          | 
|         |     56     public: // New functions | 
|         |     57  | 
|         |     58         /** | 
|         |     59         * To be called from owner's DynInitMenuPaneL. | 
|         |     60         * @param aResourceId resource id from caller | 
|         |     61         * @param aMenuPane menu pane from caller | 
|         |     62         * @param aAddress address, may be empty | 
|         |     63         * @param aName alias name of aAddress, may be empty | 
|         |     64         * @param aFocusedControl focused control, EMsgComponentIdNull if none | 
|         |     65         */ | 
|         |     66         void DynInitMenuPaneL( TInt aResourceId, | 
|         |     67                                CEikMenuPane* aMenuPane, | 
|         |     68                                const TDesC& aAddress, | 
|         |     69                                const TDesC& aName, | 
|         |     70                                TMsgControlId aFocusedControl ); | 
|         |     71          | 
|         |     72         /** | 
|         |     73         * Method to test if given command is applicable for this class | 
|         |     74         * and at this very moment. | 
|         |     75         * @param aCommand command id | 
|         |     76         * @return ETrue if command can be handled | 
|         |     77         */                        | 
|         |     78         TBool CanHandleCommand( TInt aCommand ) const; | 
|         |     79  | 
|         |     80         /** | 
|         |     81         * Command handler. Use CanHandleCommand first to test if | 
|         |     82         * command is applicable. | 
|         |     83         * @param aCommand command id | 
|         |     84         * @return ETrue if command was consumed by this class | 
|         |     85         */ | 
|         |     86         void HandleFinderCommandL( TInt aCommand ); | 
|         |     87                                | 
|         |     88         /** | 
|         |     89         * Returns type of item currently selected by CItemFinder. | 
|         |     90         * If item finder doesn't exist or editor isn't focused | 
|         |     91         * then ENoneSelected is returned. | 
|         |     92         * @param aIsFocus does editor have focus         | 
|         |     93         * @return currently selected item type | 
|         |     94         */ | 
|         |     95         CItemFinder::TItemType SelectionType( TBool aIsFocused ) const; | 
|         |     96          | 
|         |     97         /** | 
|         |     98         * Returns text for item currently selected by CItemFinder. | 
|         |     99         * If item finder doesn't exist or editor isn't focused | 
|         |    100         * then KNullDesC is returned. | 
|         |    101         * @param aIsFocus does editor have focus | 
|         |    102         * @return currently selected item's text | 
|         |    103         */ | 
|         |    104         const TDesC& SelectionText( TBool aIsFocused ) const; | 
|         |    105          | 
|         |    106         /** | 
|         |    107         * Sets CItemFinder flags. If item finder doesn't exist | 
|         |    108         * then flags are just ignored. | 
|         |    109         * @param aFindFlags, see CItemFinder::SetFindModelL | 
|         |    110         */ | 
|         |    111         void SetFindModeL( TInt aFindFlags ); | 
|         |    112          | 
|         |    113         /** | 
|         |    114         * Gets CItemFinder mode. If not set at all, then  | 
|         |    115         * ENoneSelected is returned. | 
|         |    116         * @return find mode | 
|         |    117         */ | 
|         |    118         TInt FindMode() const; | 
|         |    119  | 
|         |    120     private: // New functions | 
|         |    121  | 
|         |    122         void DynInitOptionsMenuL( CEikMenuPane& aMenuPane ); | 
|         |    123          | 
|         |    124         TBool IsAddressControl( TMsgControlId aFocusedControl ) const; | 
|         |    125          | 
|         |    126     private: // Constructors | 
|         |    127                  | 
|         |    128         /** | 
|         |    129         * Default constructor. | 
|         |    130         */ | 
|         |    131         CMsgMailViewerFindItemHandler( CItemFinder* aItemFinder ); | 
|         |    132  | 
|         |    133         /** | 
|         |    134         * Symbian OS default constructor. | 
|         |    135         */ | 
|         |    136         void ConstructL(); | 
|         |    137                  | 
|         |    138     private: //Data | 
|         |    139      | 
|         |    140         // status of finder, maintained by ourselves since CItemFinder | 
|         |    141         // has only a setter but we need a getter too | 
|         |    142         TInt iFindMode; | 
|         |    143  | 
|         |    144         // Not own | 
|         |    145         CItemFinder* iItemFinder; | 
|         |    146  | 
|         |    147         // Find item, own | 
|         |    148         CFindItemMenu* iFindItemMenu; | 
|         |    149     }; | 
|         |    150  | 
|         |    151 #endif // CMSGMAILVIEWERFINDITEMHANDLER_H | 
|         |    152  | 
|         |    153 // End of File | 
|         |    154  |