calendarui/views/inc/calennativeview.h
branchRCL_3
changeset 30 bd7edf625bdd
parent 29 12af337248b1
child 31 97232defd20e
equal deleted inserted replaced
29:12af337248b1 30:bd7edf625bdd
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  This class is the base class of all Calendar views.
    14 * Description:   This class is the base class of all Calendar views.
    15  *
    15  *
    16 */
    16 */
    17 
    17 
    18 
    18 
       
    19 
    19 #ifndef CALENNATIVEVIEW_H
    20 #ifndef CALENNATIVEVIEW_H
    20 #define CALENNATIVEVIEW_H
    21 #define CALENNATIVEVIEW_H
    21 
    22 
    22 #ifdef  CALENVIEWS_DLL
    23 //  INCLUDES
    23 #define CALENNATIVEVIEW_EXPORT Q_DECL_EXPORT
    24 
    24 #else
    25 #include <calentry.h>
    25 #define CALENNATIVEVIEW_EXPORT Q_DECL_IMPORT
    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>
    26 #endif
    33 #endif
    27 
    34 
    28 //  System includes
    35 #include <calennotificationhandler.h>
    29 #include <hblabel.h>
    36 
    30 #include <hblistwidget.h>
    37 // FORWARD DECLARATIONS
    31 #include <hbabstractviewitem.h>
    38 class CCalenContainer;
    32 
    39 class CCalInstance;
    33 // User includes
    40 class CCalEntry;
    34 #include "calennotificationhandler.h"   // MCalenNotificationHandler
    41 class MCalenModelChangeHandler;
    35 #include "calenview.h"
    42 class CAknNavigationControlContainer;
    36 
    43 class CAknNavigationDecorator;
    37 const int WORKAROUND_TO_LIMIT_MAX_SPEED=8000;
    44 class CAknWaitDialog;
    38 
    45 
       
    46 class CAknToolbar;
       
    47 
       
    48 class CCnvCharacterSetConverter;
    39 class MCalenServices;
    49 class MCalenServices;
    40 class HbDateTimePicker;
    50 class CCalenStatusPaneUtils;
    41 
    51 
    42 class  CalenNativeView : public CalenView,
    52 #ifdef RD_CALEN_EXTERNAL_CAL
    43                         public MCalenNotificationHandler
    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 
    44     {
    68     {
    45     Q_OBJECT
    69 public:  // Constructors and destructor
    46     
    70     /**
    47 	public:  // Constructors and destructor
    71      * Destructor.
    48         /**
    72      */
    49          * Destructor.
    73     virtual ~CCalenNativeView();
    50          */
    74 
    51 	    virtual ~CalenNativeView();
    75 public:  // New functions
    52 	    virtual void populationComplete();
    76     
    53 		TBool pluginEnabled();
    77     /**
    54 		virtual void refreshViewOnGoToDate();
    78      * This function is called when Locale or Today was chenged.
    55 		QString *pluginText();
    79      * @param aReason Notify reason EChangesLocale |
    56 	    /**
    80      *                              EChangesMidnightCrossover
    57 	     * captureScreenshot captures the current screenshot
    81      */
    58 	     */
    82     virtual void OnLocaleChangedL(TInt aReason)=0;
    59 		CALENNATIVEVIEW_EXPORT void captureScreenshot(bool captureScreenShot = false);
    83     
    60 		
    84     /**
    61 	protected:  // New functions
    85      * This function is called when Editor/Viewer is closed
    62 	    CalenNativeView( MCalenServices& services );
    86      */
    63 	    
    87     virtual void OnEditorClosedL();
    64 	    void HandleNotification( const TCalenNotification notification );
    88 
    65 	    virtual void onLocaleChanged(int reason)=0;
    89     /**
    66 	    virtual void onContextChanged() {};
    90      * Set date to Status pane. Default implementation does nothing.
    67 
    91      * @param aTime it will be refrect to StatusPane
    68 	protected slots:
    92      */
    69 	
    93     virtual void SetStatusPaneFromActiveContextL();
    70         void goToDate();
    94     
    71         void goToSelectedDate();
    95     /**
    72         void deleteBeforeDate();
    96      * Return container control pointer.
    73         void deleteAllEntries();
    97      * @return Container control pointer
    74         void launchSettingsView();
    98      */
    75 	    virtual void changeOrientation(Qt::Orientation orientation);
    99     CCalenContainer* Container();
    76 	    /**
   100 
    77 	     * saveActivity saves the current view as an activity
   101     /**
    78 	     * 
   102      * Change NoteView.
    79 	     */
   103      */
    80 	    void saveActivity();
   104     //void OnCmdChangeNoteViewL();
    81 	    
   105 
    82     protected:
   106     /**
    83     
   107      * Handling command "Go to day"
    84         MCalenServices	&mServices; // not owned.
   108      */
    85         int             mActivityId; // Recent Activity ID, currently it holdes wither of ECalenMonthView or ECalenAgendaView
   109     void OnCmdGotoDateL();
    86         QVariantHash    mScreenShotMetadata; // Screenshot
   110     /**
    87         bool mEntriesInDataBase;
   111      * Handling command "Today". # key is pressed.
    88     private:
   112      */
    89         HbDateTimePicker	*mDatePicker;
   113     void OnCmdGotoTodayL();
    90         bool                mIsCapturedScreenShotValid; // to check if the captured screenshot is valid
   114 
    91 	};
   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 Checks whether eventview is launched from alarm
       
   185      * 
       
   186      * @return ETrue if launched from alarm popup, EFalse otherwise
       
   187      */
       
   188     TBool IsEventViewLaunchedFromAlarm();
       
   189     
       
   190     /**
       
   191      * @brief Marks that a command is being processed currently
       
   192      * 
       
   193      * @param aInProgress ETrue if the command is being handled, EFalse otherwise
       
   194      */
       
   195     void SetCommandHandlingInProgress( TBool aInProgress );
       
   196     
       
   197     /**
       
   198      * @brief Checks if any command is being handled
       
   199      * 
       
   200      * @param aServices Reference to the calendar services.
       
   201      * @param aCollectionIds Out parameter.
       
   202      */
       
   203     static void GetActiveCollectionidsL( 
       
   204             MCalenServices& aServices, 
       
   205             RArray< TInt >& aCollectionIds );
       
   206     /**
       
   207     * @brief Sets flag to ignore tap on any of the views
       
   208     * 
       
   209     * @param bool value to ignore the tap
       
   210     */
       
   211     void SetTapIgnore(TBool);
       
   212 #ifdef RD_CALEN_EXTERNAL_CAL
       
   213 
       
   214     /**
       
   215      * Returns Service Handler if available
       
   216      */
       
   217     CAiwServiceHandler* ServiceHandler();
       
   218 
       
   219     /**
       
   220      * Releases service handler and unloads loaded plugins
       
   221      */
       
   222     void ReleaseServiceHandler();
       
   223 
       
   224     /**
       
   225      * Create service handler if needed.
       
   226      * it will also attach to menu services if needed
       
   227      */
       
   228     void CreateServiceHandlerL(TBool aAttachMenu);
       
   229 
       
   230     /*
       
   231     * Handles notifications caused by an asynchronous Execute*CmdL call
       
   232     * or an event.
       
   233     *
       
   234     * @param aCmdId The service command associated to the event.
       
   235     * @param aEventId Occured event, see AiwCommon.hrh.
       
   236     * @param aEventParamList Event parameters, if any, as defined per
       
   237     *        each event.
       
   238     * @param aInParamList Input parameters, if any, given in the
       
   239     *        related HandleCommmandL.
       
   240     * @return Error code for the callback.
       
   241     */
       
   242     TInt HandleNotifyL(TInt aCmdId,TInt aEventId,CAiwGenericParamList& aEventParamList,const CAiwGenericParamList& aInParamList);
       
   243 
       
   244 
       
   245     /**
       
   246      * Returns ETrue if wait note for multiple entry delete is currently shown.
       
   247      */
       
   248     TBool ExtCalendarAvailableL();
       
   249 
       
   250 #endif //RD_CALEN_EXTERNAL_CAL
       
   251 
       
   252 
       
   253 public: // From CCalenView
       
   254     void RemoveViewsFromCycle( RArray<TInt>& aViews );
       
   255     void GetHelpContext( TCoeHelpContext& aHelpContext );
       
   256     TAny* CalenViewExtensionL( TUid aExtensionUid );
       
   257 
       
   258 public: // From MCalenDBChangeObserver
       
   259     void HandleDBChangeL();
       
   260 
       
   261 public: // From MCalenNotificationHandler
       
   262     void HandleNotification( const TCalenNotification aNotification );
       
   263 
       
   264 public:    // from MEikMenuObserver
       
   265     void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
       
   266     /**
       
   267      * From CAknView. Command handling for each view
       
   268      * @param aCommand command id
       
   269      */
       
   270     void HandleCommandL(TInt aCommand);
       
   271     
       
   272     /**
       
   273     * @brief From MEikMenuObserver. Dynamically initializes the menubar.
       
   274     * @see MEikMenuObserver.
       
   275     */
       
   276     void DynInitMenuBarL( TInt aResourceId, CEikMenuBar* aMenuBar );
       
   277     
       
   278     /**
       
   279     * @brief copies the calendar entry to respective calendar.
       
   280     */
       
   281     void CopyToCalendarsL();
       
   282     
       
   283 
       
   284 protected:  // New functions
       
   285     /**
       
   286      * C++ constructor.
       
   287      */
       
   288     CCalenNativeView( MCalenServices& aServices );
       
   289 
       
   290     /**
       
   291      * 2nd phase construction common to all Calendar views.
       
   292      */
       
   293     void CommonConstructL( TInt aViewResource );
       
   294     
       
   295     /**
       
   296      * Second phase DoActivateL
       
   297      */
       
   298     virtual void DoActivateImplL( const TVwsViewId& aPrevViewId,
       
   299                                   TUid aCustomMessageId,
       
   300                                   const TDesC8& aCustomMessage) = 0;
       
   301     /**
       
   302      * Second phase DoDeactivate
       
   303      */
       
   304     virtual void DoDeactivateImpl() = 0;
       
   305 
       
   306     /**
       
   307      * Creates container control for each views
       
   308      */
       
   309     virtual CCalenContainer* CreateContainerImplL() = 0;
       
   310     
       
   311     /**
       
   312      * Notify marked entryy deleted.
       
   313      * Used to notify the todo view
       
   314      */
       
   315     virtual void NotifyMarkedEntryDeletedL(){ };
       
   316 
       
   317     /**
       
   318      * Notify marked entryy deleted.
       
   319      * Used to notify the todo view
       
   320      */
       
   321     virtual void NotifyMarkedEntryCompletedL(){ };    
       
   322 
       
   323     /*
       
   324      * Clears view specific data
       
   325      */
       
   326     virtual void ClearViewSpecificDataL()=0;
       
   327 
       
   328     /**
       
   329      * Update date form context when entry is saved
       
   330      */
       
   331     virtual void UpdateDateFromContextL(){ };
       
   332     
       
   333     /**
       
   334      * Updates preview pane whenever application comes to foreground
       
   335      */
       
   336     virtual void UpdatePreviewPaneL(){ };
       
   337     
       
   338     /**
       
   339      * Hides the preview pane whenever application goes to background
       
   340      * or whenever fake exit is done
       
   341      */
       
   342     virtual void HidePreviewPane(){ };
       
   343 
       
   344 private:    // New Functions
       
   345     
       
   346     /**
       
   347      * A container control is created.
       
   348      */
       
   349     void CreateContainerL();
       
   350 
       
   351     /**
       
   352      * Prcess "Send As"
       
   353      * @param aCommand command to be handled
       
   354      */
       
   355     void DoSendAsImplL(TInt aCommand);
       
   356 
       
   357 private:    // From CAknView
       
   358     /**
       
   359      * From CAknView View activation handler
       
   360      */
       
   361     void DoActivateL(   const TVwsViewId& aPrevViewId,
       
   362                         TUid aCustomMessageId,
       
   363                         const TDesC8& aCustomMessage);
       
   364     /**
       
   365      * From CAknView View deactivation handler
       
   366      */
       
   367     void DoDeactivate();
       
   368     
       
   369     /**
       
   370     * @brief asynchronous call back for copy to calendar functionality.
       
   371     *        added because of err VGGG-82X8TV . 
       
   372     * 
       
   373     */
       
   374     static TInt AsyncCopyToCalendarsL(TAny* aThisPtr);
       
   375 
       
   376     /**
       
   377     * @brief called from AsyncCopyToCalendarsL
       
   378     */
       
   379     void CopyEntryToCalendarsL();
       
   380 
       
   381 protected:  // Data
       
   382     CCalenContainer*                iContainer;
       
   383     MCalenModelChangeHandler*       iHandler;
       
   384     CAknNavigationControlContainer* iNaviContainer; // cache
       
   385     TInt                            iLocChangeReason;
       
   386     MCalenServices&                 iServices; // not owned.
       
   387     TBool                           iNeedsRefresh;
       
   388 
       
   389     CAknToolbar *iToolbar;  // not owned
       
   390 
       
   391     HBufC* iMenuName; // localised name of view for change view menu. Owned.
       
   392     HBufC* iSettingsName; // localised name of view for default view setting. Owned.
       
   393     
       
   394     CCalenStatusPaneUtils* iSPUtils;  // owned, status pane utils
       
   395 
       
   396 #ifdef RD_CALEN_EXTERNAL_CAL
       
   397 
       
   398 private:
       
   399     CAiwServiceHandler* iServiceHandler;    // own
       
   400 #endif //RD_CALEN_EXTERNAL_CAL
       
   401 
       
   402 private:  // Data
       
   403     CDesCArrayFlat* iAbbreviatedDayArray; 
       
   404     TBool iFasterAppActive;
       
   405     TBool iIsEditorActive;
       
   406     TBool iIsBackgrounded;
       
   407     
       
   408     /**
       
   409      * @var iCommandProcessing
       
   410      * @brief ETrue if some command handling is under progress, EFalse otherwise
       
   411      */
       
   412     TBool iCommandProcessing;
       
   413     TBool iIgnoreTap;
       
   414     CAsyncCallBack* iAsyncCallback; 
       
   415     };
    92 
   416 
    93 #endif  // CALENNATIVEVIEW_H
   417 #endif  // CALENNATIVEVIEW_H
    94 
   418 
    95 // End of file
   419 
       
   420 // End of File