calendarui/views/src/calenagendaview.cpp
changeset 81 ce92091cbd61
parent 75 7ac58b2aae6f
child 83 5aadd1120515
equal deleted inserted replaced
75:7ac58b2aae6f 81:ce92091cbd61
    21 #include <hbmenu.h>
    21 #include <hbmenu.h>
    22 #include <hbaction.h>
    22 #include <hbaction.h>
    23 #include <hbpangesture.h>
    23 #include <hbpangesture.h>
    24 #include <hbswipegesture.h>
    24 #include <hbswipegesture.h>
    25 #include <hbapplication.h> // hbapplication
    25 #include <hbapplication.h> // hbapplication
    26 #include <hbactivitymanager.h> // Activity Manager
    26 
    27 
    27 
    28 // User includes
    28 // User includes
    29 #include "calenagendaview.h"
    29 #include "calenagendaview.h"
    30 #include "calendocloader.h"
    30 #include "calendocloader.h"
    31 #include "calenagendaviewwidget.h"
    31 #include "calenagendaviewwidget.h"
    49 CalenNativeView(services),
    49 CalenNativeView(services),
    50 mSoftKeyAction(NULL),
    50 mSoftKeyAction(NULL),
    51 mGoToTodayAction(NULL),
    51 mGoToTodayAction(NULL),
    52 mSwitchToDayViewAction(NULL),
    52 mSwitchToDayViewAction(NULL),
    53 mActionTaken(false),
    53 mActionTaken(false),
    54 mIsAboutToQuitEventConnected(false)
    54 mIsAboutToQuitEventConnected(false),
       
    55 mDayViewActivated(false)
    55 {
    56 {
    56     OstTraceFunctionEntry0( CALENAGENDAVIEW_CALENAGENDAVIEW_ENTRY );
    57     OstTraceFunctionEntry0( CALENAGENDAVIEW_CALENAGENDAVIEW_ENTRY );
    57     
    58     
    58     // No implementation yet
    59     // No implementation yet
    59     grabGesture(Qt::SwipeGesture);
    60     grabGesture(Qt::SwipeGesture);
   111     //use this api after adding all action item to the menu
   112     //use this api after adding all action item to the menu
   112     //so that plugin add the "Show lunar data" item as a second last option 
   113     //so that plugin add the "Show lunar data" item as a second last option 
   113     // in all views
   114     // in all views
   114    mServices.OfferMenu(menu());
   115    mServices.OfferMenu(menu());
   115 	
   116 	
   116 	// get a poitner to activity manager
   117     // clean up any previous versions of this activity, if any, i.e. activityName, 
   117 	HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();
       
   118 
       
   119 	// clean up any previous versions of this activity, if any, i.e. activityName, from the activity manager. 
       
   120 	// Ignore return value, first boot would always return False. bool declared 
   118 	// Ignore return value, first boot would always return False. bool declared 
   121 	// only for debugging purpose.
   119 	// only for debugging purpose.
   122 	bool ok = activityManager->removeActivity(activityName);
   120 	bool ok = removeActivity();
   123 	
       
   124 	OstTraceFunctionExit0( DUP1_CALENAGENDAVIEW_SETUPVIEW_EXIT );
   121 	OstTraceFunctionExit0( DUP1_CALENAGENDAVIEW_SETUPVIEW_EXIT );
   125 }
   122 }
   126 
   123 
   127 // ----------------------------------------------------------------------------
   124 // ----------------------------------------------------------------------------
   128 // CalenAgendaView::doPopulation
   125 // CalenAgendaView::doPopulation
   130 // ----------------------------------------------------------------------------
   127 // ----------------------------------------------------------------------------
   131 // 
   128 // 
   132 void CalenAgendaView::doPopulation()
   129 void CalenAgendaView::doPopulation()
   133     {
   130     {
   134     OstTraceFunctionEntry0( CALENAGENDAVIEW_DOPOPULATION_ENTRY );
   131     OstTraceFunctionEntry0( CALENAGENDAVIEW_DOPOPULATION_ENTRY );
   135     
   132     mDayViewActivated = false;
   136     // The content widget has not been constructed. Don't do anything
   133     // The content widget has not been constructed. Don't do anything
   137     if (!mAgendaViewWidget) {
   134     if (!mAgendaViewWidget) {
   138         OstTraceFunctionExit0( CALENAGENDAVIEW_DOPOPULATION_EXIT );
   135         OstTraceFunctionExit0( CALENAGENDAVIEW_DOPOPULATION_EXIT );
   139         return;
   136         return;
   140     }
   137     }
   178         }
   175         }
   179 
   176 
   180 
   177 
   181     // Population is complete, issue a notification
   178     // Population is complete, issue a notification
   182     populationComplete();
   179     populationComplete();
   183     
   180     captureScreenshot(true);
   184     OstTraceFunctionExit0( DUP1_CALENAGENDAVIEW_DOPOPULATION_EXIT );
   181     OstTraceFunctionExit0( DUP1_CALENAGENDAVIEW_DOPOPULATION_EXIT );
   185     }
   182     }
   186 
   183 
   187 /*!
   184 /*!
   188  Funtion to refresh the current view upon selecting a date
   185  Funtion to refresh the current view upon selecting a date
   311 // CalenAgendaView::createNewEvent
   308 // CalenAgendaView::createNewEvent
   312 // ----------------------------------------------------------------------------
   309 // ----------------------------------------------------------------------------
   313 //    
   310 //    
   314 void CalenAgendaView::createNewEvent()
   311 void CalenAgendaView::createNewEvent()
   315 {
   312 {
   316     captureScreenshot(true);
   313  
   317     mAgendaViewWidget->createNewEvent();
   314     mAgendaViewWidget->createNewEvent();
   318 }
   315 }
   319 
   316 
   320 // ----------------------------------------------------------------------------
   317 // ----------------------------------------------------------------------------
   321 // CalenAgendaView::onLocaleChanged
   318 // CalenAgendaView::onLocaleChanged
   373 // ----------------------------------------------------------------------------
   370 // ----------------------------------------------------------------------------
   374 //    
   371 //    
   375 void CalenAgendaView::launchDayView()
   372 void CalenAgendaView::launchDayView()
   376 {
   373 {
   377     OstTraceFunctionEntry0( CALENAGENDAVIEW_LAUNCHDAYVIEW_ENTRY );
   374     OstTraceFunctionEntry0( CALENAGENDAVIEW_LAUNCHDAYVIEW_ENTRY );
   378     
   375     mDayViewActivated = true;
   379     // Issue the command to launch the day view
   376     // Issue the command to launch the day view
   380     mServices.IssueCommandL(ECalenDayView);
   377     mServices.IssueCommandL(ECalenDayView);
   381     
   378     
   382     OstTraceFunctionExit0( CALENAGENDAVIEW_LAUNCHDAYVIEW_EXIT );
   379     OstTraceFunctionExit0( CALENAGENDAVIEW_LAUNCHDAYVIEW_EXIT );
   383 }
   380 }
   387 // ----------------------------------------------------------------------------
   384 // ----------------------------------------------------------------------------
   388 // 
   385 // 
   389 void CalenAgendaView::clearListModel()
   386 void CalenAgendaView::clearListModel()
   390     {
   387     {
   391     OstTraceFunctionEntry0( CALENAGENDAVIEW_CLEARLISTMODEL_ENTRY );
   388     OstTraceFunctionEntry0( CALENAGENDAVIEW_CLEARLISTMODEL_ENTRY );
   392     
   389     // do not disconnect if day view is open
       
   390     // save the agenda view as an activity
       
   391     if(!mDayViewActivated){
   393 	// day view is removed from the list disconnect for aboutToQuit events
   392 	// day view is removed from the list disconnect for aboutToQuit events
   394     disconnectAboutToQuitEvent();
   393     disconnectAboutToQuitEvent();
       
   394     }
   395     mAgendaViewWidget->clearListModel();
   395     mAgendaViewWidget->clearListModel();
   396     
   396     
   397     OstTraceFunctionExit0( CALENAGENDAVIEW_CLEARLISTMODEL_EXIT );
   397     OstTraceFunctionExit0( CALENAGENDAVIEW_CLEARLISTMODEL_EXIT );
   398     }
   398     }
   399 
   399