eventsui/eventseditor/inc/evtmgmtuiplacecomponent.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     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:   'Set Place' component for retrieving place.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef EVTMGMTUIPLACECOMPONENT_H_
       
    20 #define EVTMGMTUIPLACECOMPONENT_H_
       
    21 
       
    22 #include <e32base.h>        // CBase
       
    23 
       
    24 #include "evtmgmtuimapnavigationadapter.h"
       
    25 #include "evtmgmtuilocationserviceadapter.h"
       
    26 #include "evtmgmtuiwaitdlglauncher.h"
       
    27 #include "evtmgmtuilocsettinglauncherobserver.h"
       
    28 
       
    29 class TCoordinate;
       
    30 class CEvtMgmtUiLocSettingsLauncher;
       
    31 class CAknIconArray;
       
    32 
       
    33 /**
       
    34  *  @class CEvtMgmtUiPlaceComponent
       
    35  *  Class that represents 'Set place' component of editor
       
    36  *
       
    37  *  This class acts as 'set place' component of editor.
       
    38  *  It  is used to retrieve location details for which event will be set.
       
    39  *  Location details can be retrieved from current location, map or landmark
       
    40  *
       
    41  *  @since S60 v9.1
       
    42  */
       
    43 
       
    44 class CEvtMgmtUiPlaceComponent: public CBase,
       
    45                                 public MEvtMgmtUiMapAndNavigationObserver,
       
    46                                 public MEvtMgmtUiLocationServiceObserver,
       
    47                                 public MEvtMgmtUiWaitDialogLauncherObserver,
       
    48                                 public MEvtMgmtUiLocSettingsLauncherObserver
       
    49     {
       
    50 private:
       
    51     /*
       
    52      *  'Set place' popup dialog options
       
    53      */
       
    54     enum TEvtMgmtUiSetPlace
       
    55        {
       
    56        /*
       
    57         * It indicates that 'Current location' is selected
       
    58         * from popup dialog
       
    59         */
       
    60        EEvtMgmtUiSetPlaceCurrentPlace,
       
    61        /*
       
    62         * It indicates that 'Landmark' is selected
       
    63         * from popup dialog
       
    64         */
       
    65        EEvtMgmtUiSetPlaceLandmark,
       
    66        /*
       
    67         * It indicates that 'Map' is selected
       
    68         * from popup dialog
       
    69         */
       
    70        EEvtMgmtUiSetPlaceFromMap,
       
    71        };
       
    72     
       
    73     public:  // Constructor and destructor  
       
    74       /**
       
    75        * Static Two phase constructor
       
    76        * @param[in] aPrevPlace - place of existing event
       
    77        *                         empty string for newly create event     
       
    78        * @param[in/out] aTriggerLocation - location of the existing event is passed.
       
    79        *                                   after successful completion of retrieval operation
       
    80        *                                   new location is set to it.    
       
    81        */
       
    82       static CEvtMgmtUiPlaceComponent* NewLC(const TPtrC aPrevPlace,  
       
    83               TCoordinate& aTriggerLocation );
       
    84 
       
    85       static CEvtMgmtUiPlaceComponent* NewL(const TPtrC aPrevPlace,  
       
    86                    TCoordinate& aTriggerLocation );
       
    87 
       
    88       /**
       
    89        * Virtual destructor
       
    90        */
       
    91       virtual ~CEvtMgmtUiPlaceComponent(); 
       
    92       
       
    93     public:// new functions
       
    94      /**
       
    95      * It is used as a wrapper class to trap leaving function DisplayPlacePopupDlgL()
       
    96      *
       
    97      * @since S60 v5.0
       
    98      * 
       
    99      * @param[in] aStatus - status which will contain success/failure state
       
   100      *                       based on retrieval of location is successful or failed
       
   101      */
       
   102      void DisplayPlacePopupDlg( TRequestStatus& aStatus );    
       
   103      
       
   104      /**
       
   105      * It is used to retrieve place details
       
   106      * 
       
   107      * @since S60 v5.0
       
   108      * 
       
   109      * @ret place details retrieved
       
   110      */
       
   111      TPtrC Place() const;
       
   112      
       
   113      /**
       
   114       * It is used to retrieve location details
       
   115       * 
       
   116       * @since S60 v5.0
       
   117       * 
       
   118       * @ret location details retrieved
       
   119       */
       
   120      TCoordinate& TriggerLocation() const;
       
   121   
       
   122      /**
       
   123       * It is used to launch position settings
       
   124       * 
       
   125       * @since S60 v5.0
       
   126       */
       
   127      void LaunchPositioningSettingsL();
       
   128            
       
   129     public: //Derived
       
   130        
       
   131        /**
       
   132          * Derived from MEvtMgmtUiMapAndNavigationObserver
       
   133          */
       
   134        void HandleMapAndNavigationResponseL( TInt aErrorCode, const TPtrC aPlace, TCoordinate aTriggerLocation  );
       
   135        
       
   136        /**
       
   137         * Derived from MEvtMgmtUiLocationServiceObserver
       
   138         */
       
   139        void HandleLocationServiceResponseL( const TInt aStatus );
       
   140 
       
   141        /**
       
   142         * Derived from MEvtMgmtUiLocationServiceObserver
       
   143         */      
       
   144        void HandleLocationServiceErrorL( TInt aErrorCode );
       
   145        
       
   146        /**
       
   147        * Derived from MEvtMgmtUiWaitDialogLauncherObserver
       
   148        */ 
       
   149        void HandleDialogDismissed( TInt aButtonId );
       
   150        
       
   151        /**
       
   152          * Derived from MEvtMgmtUiLocSettingsLauncherObserver
       
   153          */ 
       
   154        void NotifyLocSettingLaucherChangeL( TInt aErrorCode );
       
   155 
       
   156     private://new functions
       
   157         /*
       
   158          * It is used to display accuracy note
       
   159          */
       
   160         void DisplayAccuracyNoteL();
       
   161         /*
       
   162          * It is used to display accuracy note
       
   163          */
       
   164         void DisplayAccuracyNoteL(TPosition& aPos);
       
   165         /*
       
   166          * It is used to get the accuracy string
       
   167          */
       
   168         void GetAccuracyStringL( TReal& aAccuracy, HBufC*& aAccuracyString );
       
   169         /*
       
   170          * Gets the place details from retrieved position information.
       
   171          */
       
   172         TInt GetPlaceL();
       
   173         /*
       
   174          * Resolves the Error code
       
   175          */
       
   176         void ResolveErrorL( TInt aErrorCode );
       
   177        
       
   178     private:  // Constructor
       
   179         /**
       
   180          * C++ Default constructor
       
   181          */       
       
   182         CEvtMgmtUiPlaceComponent( TCoordinate& aTriggerLocation );
       
   183   
       
   184         /**
       
   185          * Second phase of the two phase constructor
       
   186          */ 
       
   187          void ConstructL( const TPtrC aPrevPlace );
       
   188          
       
   189     private: //new function
       
   190         
       
   191         /**
       
   192          * It is used to display 'set place' popup dialog and retrieve place 
       
   193          * using selected method.
       
   194          *
       
   195          * @since S60 v5.0
       
   196          * 
       
   197          * @ret it returns the option selected.
       
   198          *      it leaves with KErrCancel, if popup dialog is cancelled.
       
   199          *      it may leave with other errors, if retrieval of place fails.
       
   200          */
       
   201         TInt DisplayPlacePopupDlgL();
       
   202            
       
   203         /*
       
   204          * It is used to display error note.
       
   205          * 
       
   206          * @since S60 v5.0
       
   207          * 
       
   208          * @param[in] aResourceId - resource ID of the text to be displayed on error note.
       
   209          */
       
   210         void DisplayErrorNoteL(TInt aResourceId );
       
   211         
       
   212        
       
   213        /**
       
   214         * It retrieves place details from landmark     
       
   215         * 
       
   216         * @since S60 v5.0
       
   217         *       
       
   218         */
       
   219        void PlaceFromLandmarkL();
       
   220          
       
   221        /**
       
   222          * It returns total number of landmarks stored in landmark database.     
       
   223          * If there is any error in retrieving details, it will return zero landmark.
       
   224          * 
       
   225          * @since S60 v5.0
       
   226          * 
       
   227          * @ret total number of landmarks stored in landmark database
       
   228          */
       
   229        TInt LandmarksL();       
       
   230 
       
   231        /**
       
   232         * It displays message query if there is no positioning method enabled.     
       
   233         * 
       
   234         * @since S60 v5.0
       
   235         * 
       
   236         * @ret If pressed Ok, it will return true.
       
   237         *      If pressed Close, it will return false.
       
   238         */
       
   239        TBool DisplayNoPositioningMethodInfoNoteL( TInt aResourceId );
       
   240        
       
   241        /**
       
   242         * It initiates set place request from current location.
       
   243         * If there is no positioning method enabled, it will leave with KErrCancel.
       
   244         * Otherwise it will request current location and will launch busy dialog.     
       
   245         * 
       
   246         * @since S60 v5.0
       
   247         *        
       
   248         */
       
   249        void PlaceFromCurrentLocationL();
       
   250        
       
   251        /**
       
   252         * Update icons
       
   253         */
       
   254        void UpdateIconsL( CAknListQueryDialog& aDialog );    
       
   255         
       
   256        /**
       
   257         * Append icon to icon array. CAknIconArray owns icons so it is 
       
   258         * easier to it leave safely.
       
   259         * @param aIcons icon array
       
   260         * @param aIconFileWithPath icon file name with path
       
   261         * @param aSkinID skin id of the icon
       
   262         * @param aIconGraphicsIndex picture index
       
   263         * @param aIconGraphicsMaskIndex mask index
       
   264         */
       
   265        void AddIconL( CAknIconArray&       aIcons,
       
   266                       const TDesC&         aIconFileWithPath,
       
   267                       TAknsItemID          aSkinID,
       
   268                       TInt                 aIconGraphicsIndex,
       
   269                       TInt                 aIconGraphicsMaskIndex );
       
   270                             
       
   271        /**
       
   272         * Gets Events Management UI icon file path and name. Ownership
       
   273         * is transferred, item is left in the cleanup stack.
       
   274         * @return TFileName* The full name of the Events UI icon file.
       
   275         */        
       
   276        TFileName* IconFileNameLC() const;
       
   277       /**
       
   278        * It will create new trigger;    
       
   279        */
       
   280       //void CreateTriggerL();
       
   281     private:
       
   282         /**
       
   283          * Place value
       
   284          * owns
       
   285          */
       
   286         HBufC*                              iPlace;
       
   287         /*
       
   288          *  location details 
       
   289          */
       
   290         TCoordinate&                        iTriggerLocation;
       
   291        
       
   292         /*
       
   293          *  status of retrieval of place 
       
   294          *  Not own
       
   295          */
       
   296         TRequestStatus*                     iStatus;
       
   297         
       
   298         /*
       
   299          * object used to retrieve place details from map 
       
   300          * Owns
       
   301          */
       
   302         CEvtMgmtUiMapNavigationAdapter*     iMapAdapter;
       
   303         /*
       
   304          * object used to retrieve place details from current location
       
   305          * Owns
       
   306          */
       
   307         CEvtMgmtUiLocationServiceAdapter*   iLocationServiceAdapter;
       
   308         /**
       
   309           * Wait dialog launcher
       
   310           * Owns
       
   311           */ 
       
   312        CEvtMgmtUiWaitDialogLauncher*        iWaitDialogLauncher;   
       
   313        /*
       
   314         * object used to display position settings
       
   315         * Owns
       
   316         */
       
   317        CEvtMgmtUiLocSettingsLauncher*       iPosSetLauncher;
       
   318        
       
   319        TBool                                iIsDlgOutstanding;
       
   320     };
       
   321 
       
   322 #endif //EVTMGMTUIPLACECOMPONENT_H_