S60 3rd Edition SDK for Symbian OS
Example Applications Guide

LandmarksEditDialog.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : LandmarksEditDialog.h
00004 *  Part of     : Landmark Reference Application
00005 *  Interface   : -
00006 *  Description : See class description below
00007 *  Version     : 1.0
00008 *
00009 *  Copyright (c) 2004-2006 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 #ifndef __LANDMARKS_EDIT_DIALOG_H__
00017 #define __LANDMARKS_EDIT_DIALOG_H__
00018 
00019 // INCLUDES
00020 #include <aknform.h>
00021 #include <lbspositioninfo.h>
00022 #include <EPos_Landmarks.h>
00023 #include "LandmarksOperationObserver.h"
00024 
00025 // DATA TYPES
00026 
00027 // FORWARD DECLARATIONS
00028 class CLandmarksApplicationEngine;
00029 class CLandmarksLmCategoriesModel;
00030 class CLandmarksPositionRequest;
00031 class CPosLandmarkCategory;
00032 class CAknTitlePane;
00033 class CPosLandmark;
00034 class TLocality;
00035 
00036 // CLASS DECLARATION
00037 
00038 /**
00039 *  A dialog that makes it possible to edit certain fields of a landmark.
00040 */
00041 class CLandmarksEditDialog : public CAknForm, public MLandmarksOperationObserver
00042     {
00043     public: // Constructors and destructor
00044 
00045         /**
00046         * Two-phased constructor.
00047         *
00048         * @param aLandmark the landmark to edit
00049         * @param aUseCurrentLocation whether to initiate landmark with
00050         * current location
00051         * @param aEdited ETrue if the landmark has been modified,
00052         * EFalse otherwise
00053         * @param aEngine the application engine used for accessing categories
00054         * @param aInitialFocusFieldId Item to select on startup
00055         */
00056         static CLandmarksEditDialog* NewLC(
00057             CPosLandmark& aLandmark,
00058             TBool aUseCurrentLocation,
00059             TBool& aEdited,
00060             CLandmarksApplicationEngine& aEngine,
00061             TInt aInitialFocusFieldId = 0);
00062 
00063         /**
00064         * Destructor.
00065         */
00066         ~CLandmarksEditDialog();
00067 
00068     public: // From CAknDialog
00069 
00070         /**
00071         * DynInitMenuPaneL initializes the menu pane before it is displayed.
00072         *
00073         * @param aResourceId a resource ID indetifying the menu bar containing
00074         * the menu pane to be initialized.
00075         * @param aMenuPane the menu pane to initialize.
00076         */
00077         void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
00078 
00079         /**
00080         * Processes user commands.
00081         *
00082         * @param aCommandId id of the command to respond to
00083         */
00084         void ProcessCommandL(TInt aCommandId);
00085 
00086     public: // From MLandmarksOperationObserver
00087 
00088         /**
00089         * NotifyOperationProgressL notifies the progress and status of an
00090         * asynchronous operation.
00091         *
00092         * @param aOperation the type of operation that is reported.
00093         * @param aProgress the progress of the operation.
00094         * @param aErrorCode the status of the operation.
00095         */
00096         void NotifyOperationProgressL(
00097             TOperation aOperation,
00098             TInt aProgress,
00099             TInt aErrorCode);
00100 
00101     protected: // From CAknForm
00102 
00103         /**
00104         * Handles a dialog button press for the specified dialog button.
00105         *
00106         * @param aButtonId
00107         * @return ETrue if OK to exit, EFalse to keep the dialog active
00108         */
00109         TBool OkToExitL(TInt aButtonId);
00110 
00111 
00112         /**
00113         * SaveFormDataL deals with the occasion of a change from
00114         * edit->view mode and the user wishes to save the changes.
00115         *
00116         * @return ETrue if the editable state can be left, EFalse otherwise
00117         */
00118         TBool SaveFormDataL();
00119 
00120     private: // From CEikDialog
00121 
00122         /**
00123         * PreLayoutDynInitL initialises the dialog's controls before the dialog
00124         * is sized and layed out.
00125         */
00126         void PreLayoutDynInitL();
00127 
00128         /**
00129         * PostLayoutDynInitL initialises the dialog's controls after the dialog
00130         * has been sized but before it has been activated.
00131         */
00132         void PostLayoutDynInitL();
00133 
00134         /**
00135         * Selects desired line on startup
00136         */
00137         void SetInitialCurrentLine();
00138 
00139         /**
00140         * Handles control events.
00141         *
00142         * @param aControl The control reporting the event
00143         * @param aEventType The event type
00144         */
00145         void HandleControlEventL(
00146             CCoeControl* aControl,
00147             TCoeEvent aEventType);
00148 
00149     private:
00150 
00151         /**
00152         * Constructor.
00153         *
00154         * @param aLandmark the landmark to edit
00155         * @param aUseCurrentLocation whether to initiate landmark with
00156         * current location
00157         * @param aEdited ETrue if the landmark has been modified, EFalse otherwise
00158         * @param aEngine the application engine used for accessing categories
00159         * @param aInitialFocusFieldId Item to select on startup
00160         */
00161         CLandmarksEditDialog(
00162             CPosLandmark& aLandmark,
00163             TBool aUseCurrentLocation,
00164             TBool& aEdited,
00165             CLandmarksApplicationEngine& aEngine,
00166             TInt aInitialFocusFieldId);
00167 
00168         /**
00169         * By default Symbian 2nd phase constructor is private.
00170         */
00171         void ConstructL();
00172 
00173         /**
00174         * Configures the fields of the landmark to view/edit.
00175         */
00176         void ConfigureFieldsL();
00177 
00178         /**
00179         * Configures the location fields of the landmark to view/edit.
00180         *
00181         * @param aLocation contains the location data to update location fields
00182         * with.
00183         */
00184         void ConfigureLocationFieldsL(TLocality& aLocation);
00185 
00186         /**
00187         * Configures the category field.
00188         */
00189         void ConfigureCategoryFieldL();
00190 
00191         /**
00192         * Sets text to the specified field
00193         *
00194         * @param aControlId ID of control in the dialog
00195         * @param aText Text to set to the control
00196         */
00197         void ConfigureTextFieldL(TInt aControlId, const TDesC& aText);
00198 
00199         /**
00200         * Updates the title bar based on the contents in the name field.
00201         * @param aFromField Whether to get text from name field or from
00202         * landmark.
00203         */
00204         void UpdateTitleBarL(TBool aFromField = EFalse);
00205 
00206         /**
00207         * Retrieves a float from am EDWIN editor.
00208         *
00209         * @param aFloat float that is retrieved from editor.
00210         * @param aEditorResourceId the resource id of the editor to read
00211         * @param aErrorResourceId a resource id for a descriptor containing an
00212         * error message that is displayed in case fetching failed
00213         */
00214         void FetchFloatL(
00215             TRealX& aFloat,
00216             TInt aEditorResourceId,
00217             TInt aErrorResourceId);
00218 
00219         /**
00220         * Launches an error dialog displaying an error message to the user.
00221         *
00222         * @param aResourceId a resource id for a descriptor containing an
00223         * error message
00224         */
00225         void NotifyErrorToUserL(TInt aResourceId);
00226 
00227         /**
00228         * Launches a markable list dialog for editing categories for this
00229         * landmark.
00230         */
00231         void EditCategoriesL();
00232         
00233         /**
00234         * Start location request to update landmark
00235         * with current location
00236         */
00237         void UpdateToCurrentLocationL();
00238 
00239     private: // Data
00240 
00241         //! The landmark to be viewed/edited
00242         CPosLandmark* iLandmark;
00243         
00244         //! Whether to get location on startup
00245         TBool iUseCurrentLocation;
00246 
00247         //! Indicates if the landmark has been edited or not
00248         TBool& iEdited;
00249 
00250         //! Engine is used for reading categories
00251         CLandmarksApplicationEngine& iEngine;
00252 
00253         //! Item selected on startup
00254         TInt iInitialFocusFieldId;
00255 
00256         //! The title pane that is dynamically updated
00257         CAknTitlePane* iTitlePane;
00258 
00259         //! The original title that the title pane displayed before modified
00260         HBufC* iOriginalTitle;
00261 
00262         //! Contains a location if the user wants to update to current location
00263         TPositionInfo iPositionInfo;
00264 
00265         //! The name of the application. Used when fetching locations
00266         HBufC* iAppName;
00267 
00268         //! A position request used for retriveing locations
00269         CLandmarksPositionRequest* iPositionRequest;
00270 
00271         //! The listbox model for categories editor
00272         CLandmarksLmCategoriesModel* iLmCategoriesModel;
00273 
00274         //! The category ids that are set for this landmark
00275         RArray<TPosLmItemId> iCategoryIds;
00276 
00277         //! Defines how real numbers are formatted
00278         TRealFormat iRealFormat;
00279 
00280         //! Defines which real values that have been edited
00281         RArray<TBool> iIsRealValueEdited;
00282     };
00283 
00284 #endif // __LANDMARKS_EDIT_DIALOG__
00285 
00286 // End of File
00287 

© Nokia 2006

Back to top