calendarui/views/inc/calennativeview.h
changeset 0 f979ecb2b13e
child 13 0f07cd1b5772
child 18 c198609911f9
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2007-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:   This class is the base class of all Calendar views.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CALENNATIVEVIEW_H
       
    21 #define CALENNATIVEVIEW_H
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include <calentry.h>
       
    26 //#include <aknview.h>
       
    27 #include <calenview.h>
       
    28 #include "CalendarVariant.hrh"
       
    29 #include "calensetting.h"
       
    30 
       
    31 #ifdef RD_CALEN_EXTERNAL_CAL
       
    32 #include <aiwcommon.h>
       
    33 #endif
       
    34 
       
    35 #include <calennotificationhandler.h>
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CCalenContainer;
       
    39 class CCalInstance;
       
    40 class CCalEntry;
       
    41 class MCalenModelChangeHandler;
       
    42 class CAknNavigationControlContainer;
       
    43 class CAknNavigationDecorator;
       
    44 class CAknWaitDialog;
       
    45 
       
    46 class CAknToolbar;
       
    47 
       
    48 class CCnvCharacterSetConverter;
       
    49 class MCalenServices;
       
    50 class CCalenStatusPaneUtils;
       
    51 
       
    52 #ifdef RD_CALEN_EXTERNAL_CAL
       
    53 class CAiwServiceHandler;
       
    54 #endif
       
    55 
       
    56 //  CLASS DEFINITIONS
       
    57 
       
    58 /**
       
    59  *  CCalenNativeView
       
    60  *  This class is the base class of all Calendar views.
       
    61  */
       
    62 NONSHARABLE_CLASS( CCalenNativeView ) : public CCalenView,
       
    63                                         public MCalenNotificationHandler
       
    64 #ifdef RD_CALEN_EXTERNAL_CAL
       
    65                                        ,public MAiwNotifyCallback
       
    66 #endif //RD_CALEN_EXTERNAL_CAL
       
    67 
       
    68     {
       
    69 public:  // Constructors and destructor
       
    70     /**
       
    71      * Destructor.
       
    72      */
       
    73     virtual ~CCalenNativeView();
       
    74 
       
    75 public:  // New functions
       
    76     
       
    77     /**
       
    78      * This function is called when Locale or Today was chenged.
       
    79      * @param aReason Notify reason EChangesLocale |
       
    80      *                              EChangesMidnightCrossover
       
    81      */
       
    82     virtual void OnLocaleChangedL(TInt aReason)=0;
       
    83     
       
    84     /**
       
    85      * This function is called when Editor/Viewer is closed
       
    86      */
       
    87     virtual void OnEditorClosedL();
       
    88 
       
    89     /**
       
    90      * Set date to Status pane. Default implementation does nothing.
       
    91      * @param aTime it will be refrect to StatusPane
       
    92      */
       
    93     virtual void SetStatusPaneFromActiveContextL();
       
    94     
       
    95     /**
       
    96      * Return container control pointer.
       
    97      * @return Container control pointer
       
    98      */
       
    99     CCalenContainer* Container();
       
   100 
       
   101     /**
       
   102      * Change NoteView.
       
   103      */
       
   104     //void OnCmdChangeNoteViewL();
       
   105 
       
   106     /**
       
   107      * Handling command "Go to day"
       
   108      */
       
   109     void OnCmdGotoDateL();
       
   110     /**
       
   111      * Handling command "Today". # key is pressed.
       
   112      */
       
   113     void OnCmdGotoTodayL();
       
   114 
       
   115     /**
       
   116      * Starts repopulation again.
       
   117      */
       
   118     void BeginRepopulationL();
       
   119 
       
   120     /**
       
   121      * Process "Send As"
       
   122      * @param aCommand command to be handled
       
   123      */
       
   124     void DoSendAsL(TInt aCommand);
       
   125 
       
   126     /**
       
   127      * Redraw status pane when Form is closed
       
   128      */
       
   129     virtual void RedrawStatusPaneL() = 0;
       
   130 
       
   131     /**
       
   132      * Notified that the focus of Container changes.
       
   133      */
       
   134     void NotifyFocusChanged();
       
   135 
       
   136     /**
       
   137      * Is container focused?
       
   138      * @return If value is ETrue, container has focus
       
   139      */
       
   140     TBool IsContainerFocused();
       
   141 
       
   142     void ShowValidScrollButtons(CAknNavigationDecorator& iNaviLabel,
       
   143                                 const TTime& aRangeStart,
       
   144                                 const TTime& aRangeEnd);
       
   145 
       
   146 
       
   147     /**
       
   148      * Set CBA from resources.
       
   149      * @param aCbaResourceId is id of CBA resource
       
   150      */
       
   151     void SetCbaL(TInt aCbaResourceId);
       
   152 
       
   153     //void EditEntryL( CCalEntry *aEntry, const TTime& aInstanceDate );
       
   154 
       
   155     /**
       
   156      * Returns an array of abbreviated day names (MO, TU etc.)
       
   157      */
       
   158     const CDesCArrayFlat& AbbreviatedDayArrayL();
       
   159     
       
   160     /**
       
   161      * Returns ETrue whenever editor is active or whenever fake exit is active 
       
   162      * Used to hide the preview popup
       
   163      */
       
   164     TBool IsEditorActiveOrFasterAppExit();
       
   165     
       
   166     /**
       
   167      * Set fasterappflag whenever fake exit is done
       
   168      */
       
   169     void SetFasterAppActive( TBool aFasterAppActive );
       
   170     
       
   171     /**
       
   172      * Set editor active flag
       
   173      */
       
   174     void SetEditorActive(TBool aEditorActive);
       
   175     
       
   176 	/**
       
   177      * @brief Checks if any command is being handled
       
   178      * 
       
   179      * @return ETrue if some command is being handled, EFalse otherwise
       
   180      */
       
   181     TBool IsCommandHandlingInProgress();
       
   182     
       
   183     /**
       
   184      * @brief Marks that a command is being processed currently
       
   185      * 
       
   186      * @param aInProgress ETrue if the command is being handled, EFalse otherwise
       
   187      */
       
   188     void SetCommandHandlingInProgress( TBool aInProgress );
       
   189     
       
   190     /**
       
   191      * @brief Checks if any command is being handled
       
   192      * 
       
   193      * @param aServices Reference to the calendar services.
       
   194      * @param aCollectionIds Out parameter.
       
   195      */
       
   196     static void GetActiveCollectionidsL( 
       
   197             MCalenServices& aServices, 
       
   198             RArray< TInt >& aCollectionIds );
       
   199 
       
   200 #ifdef RD_CALEN_EXTERNAL_CAL
       
   201 
       
   202     /**
       
   203      * Returns Service Handler if available
       
   204      */
       
   205     CAiwServiceHandler* ServiceHandler();
       
   206 
       
   207     /**
       
   208      * Releases service handler and unloads loaded plugins
       
   209      */
       
   210     void ReleaseServiceHandler();
       
   211 
       
   212     /**
       
   213      * Create service handler if needed.
       
   214      * it will also attach to menu services if needed
       
   215      */
       
   216     void CreateServiceHandlerL(TBool aAttachMenu);
       
   217 
       
   218     /*
       
   219     * Handles notifications caused by an asynchronous Execute*CmdL call
       
   220     * or an event.
       
   221     *
       
   222     * @param aCmdId The service command associated to the event.
       
   223     * @param aEventId Occured event, see AiwCommon.hrh.
       
   224     * @param aEventParamList Event parameters, if any, as defined per
       
   225     *        each event.
       
   226     * @param aInParamList Input parameters, if any, given in the
       
   227     *        related HandleCommmandL.
       
   228     * @return Error code for the callback.
       
   229     */
       
   230     TInt HandleNotifyL(TInt aCmdId,TInt aEventId,CAiwGenericParamList& aEventParamList,const CAiwGenericParamList& aInParamList);
       
   231 
       
   232 
       
   233     /**
       
   234      * Returns ETrue if wait note for multiple entry delete is currently shown.
       
   235      */
       
   236     TBool ExtCalendarAvailableL();
       
   237 
       
   238 #endif //RD_CALEN_EXTERNAL_CAL
       
   239 
       
   240 
       
   241 public: // From CCalenView
       
   242     void RemoveViewsFromCycle( RArray<TInt>& aViews );
       
   243     void GetHelpContext( TCoeHelpContext& aHelpContext );
       
   244     TAny* CalenViewExtensionL( TUid aExtensionUid );
       
   245 
       
   246 public: // From MCalenDBChangeObserver
       
   247     void HandleDBChangeL();
       
   248 
       
   249 public: // From MCalenNotificationHandler
       
   250     void HandleNotification( const TCalenNotification aNotification );
       
   251 
       
   252 public:    // from MEikMenuObserver
       
   253     void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
       
   254     /**
       
   255      * From CAknView. Command handling for each view
       
   256      * @param aCommand command id
       
   257      */
       
   258     void HandleCommandL(TInt aCommand);
       
   259     
       
   260     /**
       
   261     * @brief From MEikMenuObserver. Dynamically initializes the menubar.
       
   262     * @see MEikMenuObserver.
       
   263     */
       
   264     void DynInitMenuBarL( TInt aResourceId, CEikMenuBar* aMenuBar );
       
   265 
       
   266 protected:  // New functions
       
   267     /**
       
   268      * C++ constructor.
       
   269      */
       
   270     CCalenNativeView( MCalenServices& aServices );
       
   271 
       
   272     /**
       
   273      * 2nd phase construction common to all Calendar views.
       
   274      */
       
   275     void CommonConstructL( TInt aViewResource );
       
   276     
       
   277     /**
       
   278      * Second phase DoActivateL
       
   279      */
       
   280     virtual void DoActivateImplL( const TVwsViewId& aPrevViewId,
       
   281                                   TUid aCustomMessageId,
       
   282                                   const TDesC8& aCustomMessage) = 0;
       
   283     /**
       
   284      * Second phase DoDeactivate
       
   285      */
       
   286     virtual void DoDeactivateImpl() = 0;
       
   287 
       
   288     /**
       
   289      * Creates container control for each views
       
   290      */
       
   291     virtual CCalenContainer* CreateContainerImplL() = 0;
       
   292     
       
   293     /**
       
   294      * Notify marked entryy deleted.
       
   295      * Used to notify the todo view
       
   296      */
       
   297     virtual void NotifyMarkedEntryDeletedL(){ };
       
   298 
       
   299     /**
       
   300      * Notify marked entryy deleted.
       
   301      * Used to notify the todo view
       
   302      */
       
   303     virtual void NotifyMarkedEntryCompletedL(){ };    
       
   304 
       
   305     /*
       
   306      * Clears view specific data
       
   307      */
       
   308     virtual void ClearViewSpecificDataL()=0;
       
   309 
       
   310     /**
       
   311      * Update date form context when entry is saved
       
   312      */
       
   313     virtual void UpdateDateFromContextL(){ };
       
   314     
       
   315     /**
       
   316      * Updates preview pane whenever application comes to foreground
       
   317      */
       
   318     virtual void UpdatePreviewPaneL(){ };
       
   319     
       
   320     /**
       
   321      * Hides the preview pane whenever application goes to background
       
   322      * or whenever fake exit is done
       
   323      */
       
   324     virtual void HidePreviewPane(){ };
       
   325 
       
   326 private:    // New Functions
       
   327     
       
   328     /**
       
   329      * A container control is created.
       
   330      */
       
   331     void CreateContainerL();
       
   332 
       
   333     /**
       
   334      * Prcess "Send As"
       
   335      * @param aCommand command to be handled
       
   336      */
       
   337     void DoSendAsImplL(TInt aCommand);
       
   338 
       
   339 private:    // From CAknView
       
   340     /**
       
   341      * From CAknView View activation handler
       
   342      */
       
   343     void DoActivateL(   const TVwsViewId& aPrevViewId,
       
   344                         TUid aCustomMessageId,
       
   345                         const TDesC8& aCustomMessage);
       
   346     /**
       
   347      * From CAknView View deactivation handler
       
   348      */
       
   349     void DoDeactivate();
       
   350 
       
   351 protected:  // Data
       
   352     CCalenContainer*                iContainer;
       
   353     MCalenModelChangeHandler*       iHandler;
       
   354     CAknNavigationControlContainer* iNaviContainer; // cache
       
   355     TInt                            iLocChangeReason;
       
   356     MCalenServices&                 iServices; // not owned.
       
   357     TBool                           iNeedsRefresh;
       
   358 
       
   359     CAknToolbar *iToolbar;  // not owned
       
   360 
       
   361     HBufC* iMenuName; // localised name of view for change view menu. Owned.
       
   362     HBufC* iSettingsName; // localised name of view for default view setting. Owned.
       
   363     
       
   364     CCalenStatusPaneUtils* iSPUtils;  // owned, status pane utils
       
   365 
       
   366 #ifdef RD_CALEN_EXTERNAL_CAL
       
   367 
       
   368 private:
       
   369     CAiwServiceHandler* iServiceHandler;    // own
       
   370 #endif //RD_CALEN_EXTERNAL_CAL
       
   371 
       
   372 private:  // Data
       
   373     CDesCArrayFlat* iAbbreviatedDayArray; 
       
   374     TBool iFasterAppActive;
       
   375     TBool iIsEditorActive;
       
   376     TBool iIsBackgrounded;
       
   377     
       
   378     /**
       
   379      * @var iCommandProcessing
       
   380      * @brief ETrue if some command handling is under progress, EFalse otherwise
       
   381      */
       
   382     TBool iCommandProcessing;
       
   383     };
       
   384 
       
   385 #endif  // CALENNATIVEVIEW_H
       
   386 
       
   387 
       
   388 // End of File