meetingrequest/mrgui/inc/cesmrlocationpluginhandler.h
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2009 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:  ESMR GUI Location plugin handler
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CESMRLOCATIONPLUGINHANDLER_H
       
    19 #define CESMRLOCATIONPLUGINHANDLER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "mesmrlocationpluginobserver.h"
       
    23 
       
    24 class CESMRLocationPlugin;
       
    25 class MESMRCalEntry;
       
    26 class CESMRUrlParserPlugin;
       
    27 class CESMREditorDialog;
       
    28 class CESMRLocationHistoryManager;
       
    29 class MObjectProvider;
       
    30 
       
    31 /**
       
    32 * CESMRLocationPluginHandler encapsulates the handling of esmr location commands
       
    33 * with ESMR Location Plugin
       
    34 * 
       
    35 * @lib esmrgui.lib
       
    36 */
       
    37 NONSHARABLE_CLASS(CESMRLocationPluginHandler) : public CBase,
       
    38 												public MESMRLocationPluginObserver					
       
    39     {
       
    40 public: // Construction and destruction    
       
    41     /**
       
    42      * Creates new CESMRViewerCmdHandler object. Ownership
       
    43      * is transferred to caller.
       
    44      * @return Pointer to created CESMRViewerCmdHandler object.
       
    45      */
       
    46      static CESMRLocationPluginHandler* NewL( MObjectProvider& aParent );     
       
    47      
       
    48     /**
       
    49      * C++ destructor
       
    50      */
       
    51     ~CESMRLocationPluginHandler();
       
    52 
       
    53     /**
       
    54      * Handles a Location plugin command from editor.
       
    55      * 
       
    56      * @param aCommand the command to handle
       
    57      * @param aEntry   the entry to handle via command
       
    58      * @param aIgnoreQuery if ETrue
       
    59      * "Replace previous location" query is not shown.
       
    60      * @return ETrue if entry was updated during command processing
       
    61      */
       
    62     TBool HandleCommandL( TInt aCommand,
       
    63                          MESMRCalEntry& aEntry,
       
    64                          TBool aIgnoreQuery = EFalse );
       
    65     
       
    66     /**
       
    67      * Verifies if given command can be handled for given entry.
       
    68      * 
       
    69      * @param aCommand the command to verify
       
    70      * @param aEntry the entry for command
       
    71      * @return ETrue if the command can be handled using HandleCommandL
       
    72      *               for the entry.
       
    73      */
       
    74     TBool IsCommandAvailableL( TInt aCommand, const MESMRCalEntry& aEntry );
       
    75     
       
    76     /**
       
    77      * Stores calendar entry's location into location history.
       
    78      * 
       
    79      * @param aEntry calendar entry which's location is stored.
       
    80      */
       
    81     void StoreLocationToHistoryL( const MESMRCalEntry& aEntry );
       
    82     
       
    83     /**
       
    84      * Updates entry location field.
       
    85      * @param aEntry entry to update the location field
       
    86      * @param aLocation location text to update into entry
       
    87      * @param aIgnoreQuery if ETrue, "Replace previous location" query is
       
    88      * not displayed.
       
    89      * @param aLocationReplaced on return, ETrue if previous location was replaced
       
    90      * @return ETrue if aEntry location field was modified. 
       
    91      */
       
    92     static TBool UpdateEntryLocationL( MESMRCalEntry& aEntry,
       
    93                                        const TDesC& aLocation,
       
    94                                        TBool aIgnoreQuery,
       
    95                                        TBool& aLocationReplaced ); 
       
    96     
       
    97 protected: // From MESMRLocationPluginObserver
       
    98 	void SelectFromMapCompleted( TInt aError,
       
    99                                  CPosLandmark* aLandmark );
       
   100 	
       
   101 private: // Implementaton
       
   102 	CESMRLocationPluginHandler( MObjectProvider& aParent );
       
   103 	void ConstructL();
       
   104 	CESMRLocationPlugin& LocationPluginL();
       
   105 	void UpdateEntryFromLandmarkL( MESMRCalEntry& aEntry,
       
   106                                    const CPosLandmark& aLandmark );
       
   107 	HBufC* CreateAddressFromLandmarkL( const CPosLandmark& aLandmark );	
       
   108 	void SearchFromLandmarksL( MObjectProvider* aParent,
       
   109                                MESMRCalEntry& aEntry );
       
   110 	void ShowSelectPreviousLocationQueryL( MESMRCalEntry& aEntry );
       
   111 	void UpdateEntryLocationL( MESMRCalEntry& aEntry, const TDesC& aLocation );
       
   112 	void UpdateEntryDescriptionL( MESMRCalEntry& aEntry,
       
   113                                   const TDesC& aLocationUrl );
       
   114 	CESMRUrlParserPlugin& UrlParserL();
       
   115 	CESMRLocationHistoryManager& LocationHistoryManagerL();
       
   116 	
       
   117 private: // Data
       
   118 	
       
   119 	/**
       
   120      * Query ignore flag 
       
   121      */
       
   122     TBool iIgnoreQuery;
       
   123     
       
   124 	/**
       
   125      * Entry update flag
       
   126      * 
       
   127      */
       
   128     TBool iEntryUpdated;
       
   129     
       
   130     /**
       
   131      * Location replace flag
       
   132      */
       
   133     TBool iLocationReplaced;
       
   134     
       
   135 	/**
       
   136 	 *  Location plugin.
       
   137 	 *  Own.
       
   138 	 */
       
   139 	CESMRLocationPlugin* iLocationPlugin;
       
   140 	
       
   141 	/**
       
   142 	 * Location Plugin synchronizer.
       
   143 	 * Own.
       
   144 	 */
       
   145 	CActiveSchedulerWait* iWait;
       
   146 	
       
   147 	/**
       
   148 	 * Location url parser.
       
   149 	 * Own.
       
   150 	 */
       
   151 	CESMRUrlParserPlugin* iUrlParser;
       
   152 	
       
   153     /**
       
   154      * Pointer to result of landmark fetch.
       
   155      * Own.
       
   156      */
       
   157 	CPosLandmark* iLandmark;
       
   158 	
       
   159 	/**
       
   160 	 * Pointer to CLmkLandmarkSelectorDlg parent object.
       
   161 	 * Ref.
       
   162 	 */
       
   163 	MObjectProvider* iParent;
       
   164 	
       
   165 	/**
       
   166      * Location history manager.
       
   167      * Own.
       
   168 	 */
       
   169 	CESMRLocationHistoryManager* iLocationHistoryManager;
       
   170 	
       
   171     };
       
   172 
       
   173 #endif // CESMRLOCATIONPLUGINHANDLER_H
       
   174