--- a/calendarui/views/src/calendayview.cpp Tue Feb 02 10:12:19 2010 +0200
+++ b/calendarui/views/src/calendayview.cpp Fri Apr 16 14:57:40 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -11,744 +11,298 @@
*
* Contributors:
*
-* Description: Declares view class of View architecture for Day view.
- *
+* Description: CalenDayView implementation.
+*
*/
+// System includes
+#include <QGraphicsSceneEvent>
+#include <hbmainwindow.h>
+#include <hbaction.h>
-#include <aknnavide.h>
-#include <bldvariant.hrh> // For FeatureIds (lint warns without)
-#include <eikmenup.h>
-#include <eikspane.h>
-#include <featmgr.h>
-#include <Sendnorm.rsg>
-#include <eikbtgpc.h>
-#include <eikmenub.h>
-#include <StringLoader.h>
-#include <aknappui.h>
-#include <calinstance.h>
-#include <calendateutils.h>
-#include <Calendar.rsg>
-#include <calencommonui.rsg>
-#include <CalenStatusPaneUtils.h>
-#include <calencommands.hrh> // Calendar commands
-#include <calencontext.h>
-#include <calenservices.h>
-#include <calenviewutils.h>
-#include <calentoolbar.h>
-#include <calentry.h>
-#include <calentryview.h>
-#include "calendarui_debug.h"
+// User includes
#include "calendayview.h"
-#include "calencontainer.h"
-#include "calendaycontainer.h"
-#include "calensend.h"
-#include "calentitlepane.h"
-#include "calenlocationutil.h"
-#include <CalenInterimUtils2.h>
-#include "calendar.hrh"
-#include "CalenUid.h"
-#include "multicaluidialog.h"
+#include "calendocloader.h"
+#include "calendayviewwidget.h"
+#include "calenservices.h"
+#include "calencommon.h"
+#include "calencontext.h"
+#include "calendateutils.h"
-// LOCAL CONSTANTS AND MACROS
-#define iDayContainer static_cast<CCalenDayContainer*>(iContainer)
+// ----------------------------------------------------------------------------
+// CalenDayView::CalenDayView
+// Rest of the details are commented in the header
+// ----------------------------------------------------------------------------
+//
+CalenDayView::CalenDayView(MCalenServices &services):
+CalenNativeView(services),
+mSoftKeyAction(NULL),
+mGoToTodayAction(NULL),
+mActionTaken(false)
+{
+ // No implementation yet
+}
-// Button position of the MSK CBA button
-const TInt KSK2CBAPosition = 2;
-
-
-// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CCalenDayView::~CalenDayView
+// Rest of the details are commented in the header
+// ----------------------------------------------------------------------------
+//
+CalenDayView::~CalenDayView()
+{
+ // No implementation yet
+}
// ----------------------------------------------------------------------------
-// CCalenDayView::NewLC
-// Two-phased constructor.
-// (other items were commented in a header).
+// CCalenDayView::setupView
+// Rest of the details are commented in the header
// ----------------------------------------------------------------------------
-//
-EXPORT_C CCalenDayView* CCalenDayView::NewL( MCalenServices& aServices )
- {
- TRACE_ENTRY_POINT;
-
- CCalenDayView* self = new(ELeave) CCalenDayView( aServices );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
-
- TRACE_EXIT_POINT;
- return self;
+//
+void CalenDayView::setupView(CalenDocLoader *docLoader)
+{
+ if (!docLoader) {
+ // Nothing can be done. Simply return
+ return;
}
+ // Store the document loader for reference later
+ mDocLoader = docLoader;
+
+ // Listen to orientation change events
+ connect(&(mServices.MainWindow()), SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(orientationChanged(Qt::Orientation)));
+
+ // Get the pointer to the content widget
+ mDayViewWidget = qobject_cast<CalenDayViewWidget*>(mDocLoader->findWidget(CALEN_DAYVIEW_WIDGET));
+ if (!mDayViewWidget) {
+ qFatal("calendayview.cpp : Unable to find the content widget");
+ }
+ mDayViewWidget->setupWidget(this);
+
+ // Initialize all the menu and toolbar actions
+ setupActions();
+}
// ----------------------------------------------------------------------------
-// CCalenDayView::~CCalenDayView
-// Destructor
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-CCalenDayView::~CCalenDayView()
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- }
-
+// CCalenDayView::doPopulation
+// Rest of the details are commented in the header
// ----------------------------------------------------------------------------
-// CCalenDayView::CCalenDayView
-// C++ constructor can NOT contain any code, that might leave.
-// (other items were commented in a header).
-// ----------------------------------------------------------------------------
-//
-CCalenDayView::CCalenDayView( MCalenServices& aServices )
- : CCalenNativeView( aServices ),
- iPopulationStep( ENothingDone )
+//
+void CalenDayView::doPopulation()
{
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
+ // The content widget has not been constructed. Don't do anything
+ if (!mDayViewWidget) {
+ return;
+ }
+ // Get the day for which this view is being shown from the context
+ mDate = mServices.Context().focusDateAndTimeL();
+
+ // Check if the current day being shown is "Today"
+ if (mGoToTodayAction) {
+ if (mDate.date() == CalenDateUtils::today().date()) {
+ // Hide the "Go to today" option
+ mGoToTodayAction->setVisible(false);
+ } else {
+ mGoToTodayAction->setVisible(true);
+ }
+ }
+
+ // Set self as the current view
+ // mServices.MainWindow().setCurrentView(this);
+
+ // Dont override the soft key behavior if day view is the first view
+ if (ECalenDayView != mServices.getFirstView()) {
+ mSoftKeyAction = new HbAction(Hb::BackAction);
+ setNavigationAction(mSoftKeyAction);
+ // Connect to the signal triggered by clicking on back button.
+ connect(mSoftKeyAction, SIGNAL(triggered()), this,
+ SLOT(launchMonthView()));
+ }
+ // Initialize the content widget
+ mDayViewWidget->showWidget();
+
+ // Population is complete, issue a notification
+ populationComplete();
}
// ----------------------------------------------------------------------------
-// CCalenDayView::SetStatusPaneFromActiveContextL
-// Set a date text to StatusPane
-// (other items were commented in a header).
+// CCalenDayView::HandleNotification
+// Rest of the details are commented in the header
+// ----------------------------------------------------------------------------
+//
+void CalenDayView::HandleNotification(const TCalenNotification notification)
+{
+ Q_UNUSED(notification)
+ // No implementation yet
+}
+
+// ----------------------------------------------------------------------------
+// CCalenDayView::docLoader
+// Rest of the details are commented in the header
+// ----------------------------------------------------------------------------
+//
+CalenDocLoader* CalenDayView::docLoader()
+{
+ return mDocLoader;
+}
+
+// ----------------------------------------------------------------------------
+// CCalenDayView::hasEvents
+// Rest of the details are commented in the header
+// ----------------------------------------------------------------------------
+//
+void CalenDayView::hasEvents(bool yes)
+{
+ if (mDeleteAction) {
+ mDeleteAction->setVisible(yes);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// CalenDayView::handleLocaleChange
+// Rest of the details are commented in the header
+// ----------------------------------------------------------------------------
+//
+void CalenDayView::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ // TODO: Remove these after gestures are available
+ mTapPoint = event->pos();
+ event->accept();
+}
+
+// ----------------------------------------------------------------------------
+// CalenDayView::handleLocaleChange
+// Rest of the details are commented in the header
+// ----------------------------------------------------------------------------
+//
+void CalenDayView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ // TODO: Remove these after gestures are available
+ QPointF curPos = event->pos();
+ if (abs(curPos.y() - mTapPoint.y()) > 20) {
+ event->accept();
+ return;
+ }
+ if (curPos.x() - mTapPoint.x() > 50) {
+ mTapPoint = QPointF(0, 0);
+ mServices.IssueCommandL(ECalenShowPrevDay);
+ mActionTaken = true;
+ } else if (curPos.x() - mTapPoint.x() < -50) {
+ mTapPoint = QPointF(0, 0);
+ mServices.IssueCommandL(ECalenShowNextDay);
+ mActionTaken = true;
+ }
+ event->accept();
+}
+
+// ----------------------------------------------------------------------------
+// CCalenDayView::eventFilter
+// Rest of the details are commented in the header
// ----------------------------------------------------------------------------
//
-void CCalenDayView::SetStatusPaneFromActiveContextL()
- {
- TRACE_ENTRY_POINT;
-
- TTime activeDay = CCalenContainer::DateFromContextL( iServices.Context() );
- // title pane
- if ( CalenDateUtils::IsOnToday( activeDay ) )
- {
- iSPUtils->UnderLineTitleText( ETrue );
- }
- else
- {
- iSPUtils->UnderLineTitleText( EFalse );
- }
- TBuf<KMaxDayName> title;
- iSPUtils->DayNameByActiveTime( title, activeDay );
- iSPUtils->SetTitleTextL( title );
-
- // navi pane
- CAknNavigationDecorator* naviLabel = iSPUtils->ShowNaviPaneL( activeDay );
- ShowValidScrollButtons( *naviLabel,
- activeDay -TTimeIntervalDays( 1 ),
- activeDay +TTimeIntervalDays( 1 ) );
-
- iSPUtils->RefreshStatusPane();
- TRACE_EXIT_POINT;
- }
-
-// ---------------------------------------------------------
-// CCalenDayView::ConstructL
-// Symbian OS default constructor
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CCalenDayView::ConstructL()
- {
- TRACE_ENTRY_POINT;
-
- CommonConstructL( R_CALEN_DAYVIEW_INFO );
-
- TRACE_EXIT_POINT;
- }
-
-// ---------------------------------------------------------
-// CCalenDayView::DoActivateImplL
-// Second phase DoActivateL
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CCalenDayView::DoActivateImplL( const TVwsViewId& aPrevViewId,
- TUid aCustomMessageId,
- const TDesC8& /*aCustomMessage*/ )
- {
- TRACE_ENTRY_POINT;
- // When day view is activated, we store the previous view id so that when
- // "back" softkey is avaible and pressed, we can go back to previous view.
- // Whether or the "Back" softkey should be available is determined by the flag
- // iShowBackButtonOnCba, which is set/unset based on aCustomMessageId.
- //
- // When day view is switched from Calendar's internal view, the flag and
- // the previous view id are updated.
- // When day view is switched from Other application's view, the flag and
- // the previous view id are NOT updated
- //
- if( aPrevViewId.iAppUid == KUidCalendar ) // switch from internal view
- {
- iPreviousViewId = aPrevViewId;
-
- iShowBackButtonOnCba =
- ( aCustomMessageId == KUidCalenShowBackCba ? ETrue : EFalse );
- }
- else
- {
- iShowBackButtonOnCba = EFalse;
- }
- iDayContainer->UpdateContainerL();
- //UpdateCbaL();
-
- iEventViewCommandHandled = EFalse;
- TRACE_EXIT_POINT;
- }
-
-// ---------------------------------------------------------
-// CCalenDayView::DoDeactivateImpl
-// Second phase DoDeactivate
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CCalenDayView::DoDeactivateImpl()
- {
- TRACE_ENTRY_POINT;
-
- if (!iAvkonAppUi->IsDisplayingMenuOrDialog())
- {
- iSPUtils->HideNaviPane();
- }
-
- TRACE_EXIT_POINT;
- }
-
-// ---------------------------------------------------------
-// CCalenDayView::OnLocaleChangedL
-// Called when locale was changed and Time was crossovered
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CCalenDayView::OnLocaleChangedL(TInt aReason)
- {
- TRACE_ENTRY_POINT;
-
- if(!iContainer)
- {
- return;
- }
-
- if (IsContainerFocused())
- {
- if (!iContainer->IsFocused())
- {
- iLocChangeReason = EChangesLocale;
- }
- else
- {
- if (aReason & EChangesLocale)
- {
- iDayContainer->UpdateTimeFormat();
- iDayContainer->UpdateContainerL();
- }
- if (aReason & EChangesSystemTime)
- {
- RedrawStatusPaneL();
- }
- }
- }
- else
- {
- iLocChangeReason = EChangesLocale;
- }
-
- TRACE_EXIT_POINT;
- }
-
-
-
-// ---------------------------------------------------------
-// CCalenDayView::CreateContainerImplL
-// Creates container control for DayView
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-CCalenContainer* CCalenDayView::CreateContainerImplL()
- {
- TRACE_ENTRY_POINT;
-
- TRACE_EXIT_POINT;
- return new( ELeave )CCalenDayContainer( this,
- iDate,
- iHighlightedRowNumber,
- iFirstEntryOnScreenIndex,
- iServices );
- }
-
-// ---------------------------------------------------------
-// CCalenDayView::RedrawStatusPaneL
-// Redraw status pane when Form is closed
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CCalenDayView::RedrawStatusPaneL()
- {
- TRACE_ENTRY_POINT;
-
- SetStatusPaneFromActiveContextL();
-
- TRACE_EXIT_POINT;
+bool CalenDayView::eventFilter(QObject *source, QEvent *event)
+{
+ // TODO : remove this line after gestures are available
+ mActionTaken = false;
+ Q_UNUSED(source)
+ if (event->type() == QEvent::GraphicsSceneMousePress) {
+ QGraphicsSceneMouseEvent *mouseEvent = static_cast<QGraphicsSceneMouseEvent*>(event);
+ mousePressEvent(mouseEvent);
+ } else if (event->type() == QEvent::GraphicsSceneMouseMove) {
+ QGraphicsSceneMouseEvent *mouseEvent = static_cast<QGraphicsSceneMouseEvent*>(event);
+ mouseMoveEvent(mouseEvent);
}
-
-// ---------------------------------------------------------
-// CCalenDayView::DynInitMenuPaneL
-// Changes MenuPane dynamically
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CCalenDayView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
- {
- TRACE_ENTRY_POINT;
-
- CCalenNativeView::DynInitMenuPaneL(aResourceId, aMenuPane);
-
- switch (aResourceId)
- {
- case R_CALENDAR_DAY_MENUPANE:
- {
-
-#ifdef RD_CALEN_EXTERNAL_CAL
- TBool isit=ExtCalendarAvailableL();
- if (!isit)
- {
- //ECalenExtAiwCommandId
- ReleaseServiceHandler();
- TInt dummy;
- if (aMenuPane->MenuItemExists(ECalenExtAiwCommandId,dummy))
- {
- aMenuPane->DeleteMenuItem(ECalenExtAiwCommandId);
- }
- }
-#endif //RD_CALEN_EXTERNAL_CAL
-
-
- if ( ! FeatureManager::FeatureSupported(KFeatureIdHelp) )
- {
- aMenuPane->DeleteMenuItem(EAknCmdHelp);
- }
-
- TBool emptyList = iDayContainer->IsEmptyView();
- if ( emptyList )
- {
- aMenuPane->DeleteMenuItem( ECalenViewCurrentEntry );
- aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry );
- aMenuPane->DeleteMenuItem( ECalenCompleteTodo );
- aMenuPane->DeleteMenuItem( ECalenSend );
- //TODO: will be uncommented with copy to cal functionality.
- aMenuPane->DeleteMenuItem(ECalenCopyToCalendars);
- }
- else
- {
- // "Mark completed" item
- TCalenInstanceId instId = iServices.Context().InstanceId();
- TBool isTodoFocused; // true when instId is not null and instId type == todo
- isTodoFocused = !(instId == TCalenInstanceId::NullInstanceId()) &&
- instId.iType == CCalEntry::ETodo;
-
- if ( ! isTodoFocused )
- {
- aMenuPane->DeleteMenuItem( ECalenCompleteTodo );
- }
- }
- if(!iDayContainer->IsEmptyView() && CCalenLocationUtil::IsMapProviderAvailableL())
- {
- if(iDayContainer->IsEventHasMapLocationL() || iDayContainer->IsEventHasNoLocationTextL())
- {
- aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
- }
- if(!iDayContainer->IsEventHasMapLocationL())
- {
- aMenuPane->DeleteMenuItem( ECalenShowLocation );
- }
- }
- else // No map provider available, remove both option items
- {
- aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
- aMenuPane->DeleteMenuItem( ECalenShowLocation );
- }
-
- if( !iServices.InterimUtilsL().MRViewersEnabledL( ETrue ) )
- {
- aMenuPane->DeleteMenuItem( ECalenNewMeetingRequest );
- }
- // Offer the menu pane to the services for customisation by the
- // the view manager/plugins
- iServices.OfferMenuPaneL( aResourceId, aMenuPane );
-
- // Single click integration
- TInt menuIndex( 0 );
- if ( aMenuPane->MenuItemExists( ECalenSend, menuIndex ) )
- {
- aMenuPane->SetItemSpecific( ECalenSend, ETrue );
- }
- break;
- }
-
- default:
- break;
- }
-
- TRACE_EXIT_POINT;
+ if (mActionTaken) {
+ // Swipe gesture has been enforced.
+ // Do not pass the event to the source
+ return true;
}
-
-// ---------------------------------------------------------
-// CCalenDayView::HandleCommandL
-// Command handling for Day view.
-// This is needed for MSK. Check wheter Open or Context menu
-// events are triggered. By default call CCalenNativeView's
-// HandleCommand.
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CCalenDayView::HandleCommandL(TInt aCommand)
- {
- TRACE_ENTRY_POINT;
-
- switch (aCommand)
- {
- case EAknSoftkeyOpen:
- case ECalenViewCurrentEntry:
- {
- if(!iEventViewCommandHandled)
- {
- if(iDayContainer->IsValidEntryL()&&!iDayContainer->IsEmptyView())
- {
- // Set the context when performing an action
- iDayContainer->SetContextFromHighlightL();
-
- CCalenNativeView::HandleCommandL( ECalenEventView );
- iEventViewCommandHandled = ETrue;
- }
- }
- }
- break;
- // TODO:will be uncommented with copy to cal functionality.
- case ECalenCopyToCalendars:
- {
- CopyToCalendarsL();
- }
- break;
-
- case ECalenDeleteCurrentEntry:
- iDayContainer->NotifyDeleteItemL();
- CCalenNativeView::HandleCommandL( ECalenDeleteCurrentEntry );
- break;
-#ifdef RD_CALEN_ENHANCED_MSK
- case ECalenCmdOpenMskDialog:
- CCalenNativeView::HandleCommandL( ECalenNewMeeting );
- break;
-#else
- case EAknSoftkeyContextOptions:
- MenuBar()->TryDisplayContextMenuBarL();
- break;
-#endif //RD_CALEN_ENHANCED_MSK
-
- case EAknSoftkeyBack:
- //iServices.RequestActivationL( iPreviousViewId );
- SetCbaL( R_CALEN_DEFAULT_DAY_VIEW_CBA );
- iHighlightedRowNumber = KErrNotFound;
- iServices.IssueNotificationL(ECalenNotifyDayViewClosed);
- break;
-
- default:
- CCalenNativeView::HandleCommandL(aCommand);
- break;
- }
-
- TRACE_EXIT_POINT;
- }
-
-
-// ---------------------------------------------------------
-// CCalenDayView::UpdateCbaL
-// Set context menubar and also CBA button depending wheter
-// we have empty view or not.
-// (other items were commented in a header).
-// ---------------------------------------------------------
-//
-void CCalenDayView::UpdateCbaL()
- {
- TRACE_ENTRY_POINT;
-
- MenuBar()->SetContextMenuTitleResourceId( R_CALENDAR_DAY_CASE_MENUBAR );
-
- // if the view is empty then we use context menu CBA
- if( iDayContainer->IsEmptyView() )
- {
- SetCbaL( R_CALEN_DAY_AND_TODO_VIEW_CONTEXT_MENU_CBA );
- }
- else // set normal CBA
- {
- SetCbaL( R_CALEN_DAY_AND_TODO_VIEW_NORMAL_CBA );
- }
-
- if( iShowBackButtonOnCba )
- {
- CEikButtonGroupContainer* cba = Cba();
- cba->SetCommandL( KSK2CBAPosition, R_CALEN_BACK_CBA_BUTTON);
- cba->DrawNow();
- }
-
- TRACE_EXIT_POINT;
- }
+ return false;
+}
// ----------------------------------------------------------------------------
-// CCalenDayView::Id
-// From CAknView
-// Return the UID of the day view
-// (other items were commented in a header)
-// ----------------------------------------------------------------------------
-//
-TUid CCalenDayView::Id() const
- {
- TRACE_ENTRY_POINT;
-
- TRACE_EXIT_POINT;
- return KUidCalenDayView;
- }
-
-// ----------------------------------------------------------------------------
-// CCalenDayView::CopytoCalendarsL
-// From CAknView
-// Return the UID of the day view
-// (other items were commented in a header)
-// ----------------------------------------------------------------------------
-//
-void CCalenDayView::CopyToCalendarsL()
- {
-
- // Hide the toolbar before we display settings menu
- MCalenToolbar* toolbar = iServices.ToolbarOrNull();
- if(toolbar)
- {
- toolbar->SetToolbarVisibilityL(EFalse);
- }
- iSPUtils->UnderLineTitleText( EFalse );
- MCalenContext& context = iServices.Context();
- TCalLocalUid instanceId = context.InstanceId().iEntryLocalUid;
-
- CCalEntry* entry = iServices.EntryViewL(context.InstanceId().iColId)->FetchL(instanceId);
- CleanupStack::PushL(entry);
-
- RPointerArray<CCalEntry> calentryArray;
- calentryArray.Append( entry );
-
- // Launch the Calendar List Dialiog.
- CMultiCalUiDialog* calenDbListDialog = CMultiCalUiDialog::NewLC(calentryArray, ETrue);
- TInt err = KErrNone;
- // Execute.
- TRAP( err,calenDbListDialog->LaunchL() );
- CleanupStack::PopAndDestroy( calenDbListDialog );
-
- iSPUtils->UnderLineTitleText( EFalse );
- // Unhide the toolbar when settings is closed
- if(toolbar)
- {
- toolbar->SetToolbarVisibilityL(ETrue);
- }
- CleanupStack::Pop(entry);
- calentryArray.ResetAndDestroy();
-
- BeginRepopulationL();
- }
-
-// ----------------------------------------------------------------------------
-// CCalenDayView::ClearViewSpecificDataL
-// Clears any cached data for the specific view, e.g. currently
-// highlighted row, column, etc.
-// (other items were commented in a header)
-// ----------------------------------------------------------------------------
-//
-void CCalenDayView::ClearViewSpecificDataL()
- {
- TRACE_ENTRY_POINT;
-
- iDate = Time::NullTTime();
- //iHighlightedRowNumber = KErrNotFound;
- //iFirstEntryOnScreenIndex = KErrNotFound;
-
- TRACE_EXIT_POINT;
- }
-
-// ----------------------------------------------------------------------------
-// CCalenDayView::IsViewSpecificDataNullL
-// From CCalenNativeView
-// Returns ETrue if the view specific data is null, EFalse otherwise.
-// (other items were commented in a header)
-// ----------------------------------------------------------------------------
-//
-TBool CCalenDayView::IsViewSpecificDataNullL()
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return ( iDate == Time::NullTTime() ) &&
- ( iHighlightedRowNumber == KErrNotFound ) &&
- ( iFirstEntryOnScreenIndex == KErrNotFound );
- }
-
-// ----------------------------------------------------------------------------
-// CCalenDayView::ActiveStepL
-// From CCalenView
-// (other items were commented in a header)
+// CCalenDayView::createToolBar
+// Rest of the details are commented in the header
// ----------------------------------------------------------------------------
//
-CCalenView::TNextPopulationStep CCalenDayView::ActiveStepL()
- {
- TRACE_ENTRY_POINT;
-
- CCalenView::TNextPopulationStep nextStep = CCalenView::EDone;
- switch( iPopulationStep )
- {
- case ENothingDone:
- {
- RArray<TInt> colIdArray;
- CCalenNativeView::GetActiveCollectionidsL( iServices, colIdArray );
-
- if(colIdArray.Count() > 0)
- {
- if( !iServices.InstanceViewL(colIdArray) )
- {
- nextStep = CCalenView::EWaitForInstanceView;
- break;
- }
- }
- else
- {
- if( !iServices.InstanceViewL() )
- {
- nextStep = CCalenView::EWaitForInstanceView;
- break;
- }
- }
- colIdArray.Reset();
- }
-
- // else fall through...
- //lint -fallthrough
- case ERequestedInstanceView:
- {
- iDayContainer->GetInstanceListL();
- iPopulationStep = ESizedChanged;
- nextStep = CCalenView::EKeepGoing;
- }
- break;
- case ESizedChanged:
- {
- iDayContainer->UpdateSize();
- iPopulationStep = ECreateSlotTableNext;
- nextStep = CCalenView::EKeepGoing;
- }
- break;
- case ECreateSlotTableNext:
- {
- iDayContainer->CreateSlotTableL();
- iPopulationStep = ECreateListBoxDataNext;
- nextStep = CCalenView::EKeepGoing;
- }
- break;
- case ECreateListBoxDataNext:
- default:
- {
- iDayContainer->CompletePopulationL();
- iPopulationStep = EPopulationDone;
- nextStep = CCalenView::EDone;
- }
- break;
- }
-
- TRACE_EXIT_POINT;
- return nextStep;
- }
+void CalenDayView::setupActions()
+{
+ // Get the actions associated with this view
+ HbAction *newEventAction = qobject_cast<HbAction *>
+ (mDocLoader->findObject(CALEN_DAYVIEW_MENU_NEW_EVENT));
+ if (!newEventAction) {
+ qFatal("calendayview.cpp : Unable to find new event action");
+ }
+ // Connect to the signal triggered by new event action
+ connect(newEventAction, SIGNAL(triggered()), mDayViewWidget, SLOT(createNewEvent()));
+
+ mGoToTodayAction = qobject_cast<HbAction *>
+ (mDocLoader->findObject(CALEN_DAYVIEW_MENU_GO_TO_TODAY));
+ if (!mGoToTodayAction) {
+ qFatal("calendayview.cpp : Unable to find go to today action");
+ }
+ // Connect to the signal triggered by new event action
+ connect(mGoToTodayAction, SIGNAL(triggered()), mDayViewWidget, SLOT(goToToday()));
+
+ HbAction *goToDateAction = qobject_cast<HbAction *>
+ (mDocLoader->findObject(CALEN_DAYVIEW_MENU_GO_TO_DATE));
+ if (!goToDateAction) {
+ qFatal("calendayview.cpp : Unable to find go to date action");
+ }
+ // Connect to the signal triggered by new event action
+ connect(goToDateAction, SIGNAL(triggered()), this, SLOT(goToDate()));
+
+ mDeleteAction = qobject_cast<HbAction *>
+ (mDocLoader->findObject(CALEN_DAYVIEW_MENU_DELETE));
+ if (!mDeleteAction) {
+ qFatal("calendayview.cpp : Unable to find delete action");
+ }
+ // Connect to the signal triggered by new event action
+ connect(mDeleteAction, SIGNAL(triggered()), mDayViewWidget, SLOT(deleteEntries()));
+
+ HbAction *settingsAction = qobject_cast<HbAction *>
+ (mDocLoader->findObject(CALEN_DAYVIEW_MENU_SETTINGS));
+ if (!settingsAction) {
+ qFatal("calendayview.cpp : Unable to find settings action");
+ }
+ // Connect to the signal triggered by new event action
+ connect(settingsAction, SIGNAL(triggered()), this, SLOT(launchSettingsView()));
+}
// ----------------------------------------------------------------------------
-// CCalenDayView::CancelPopulation
-// From CCalenView
-// (other items were commented in a header)
+// CCalenDayView::onLocaleChanged
+// Rest of the details are commented in the header
// ----------------------------------------------------------------------------
-//
-void CCalenDayView::CancelPopulation()
- {
- TRACE_ENTRY_POINT;
-
- iPopulationStep = ENothingDone;
-
- TRACE_EXIT_POINT;
+//
+void CalenDayView::onLocaleChanged(int reason)
+{
+ Q_UNUSED(reason)
+ // Notify the content widget about the change
+ if(mDayViewWidget) {
+ mDayViewWidget->handleLocaleChange();
}
-
-// ----------------------------------------------------------------------------
-// CCalenDayView::CyclePosition
-// From CCalenView
-// (other items were commented in a header)
-// ----------------------------------------------------------------------------
-//
-CCalenView::TCyclePosition CCalenDayView::CyclePosition() const
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return CCalenView::EReplaceDayView;
- }
+}
// ----------------------------------------------------------------------------
-// CCalenDayView::LocalisedViewNameL
-// From CCalenView
-// (other items were commented in a header)
+// CCalenDayView::orientationChanged
+// Rest of the details are commented in the header
// ----------------------------------------------------------------------------
-//
-const TDesC& CCalenDayView::LocalisedViewNameL( CCalenView::TViewName aViewName )
- {
- TRACE_ENTRY_POINT;
-
- HBufC* ret = NULL;
-
- switch ( aViewName )
- {
- case CCalenView::EMenuName:
- if ( !iMenuName )
- {
- iMenuName = StringLoader::LoadL( R_CALEN_VIEW_DAY, iCoeEnv );
- }
- ret = iMenuName;
- break;
- case CCalenView::ESettingsName:
- if ( !iSettingsName )
- {
- iSettingsName = StringLoader::LoadL( R_CALEN_QTN_DEFAULT_DAY_VIEW,
- iCoeEnv );
- }
- ret = iSettingsName;
- break;
- default:
- ASSERT( EFalse );
- break;
- }
-
- TRACE_EXIT_POINT;
- return *ret;
+//
+void CalenDayView::orientationChanged(Qt::Orientation orientation)
+{
+ // Notify the content widget about the change
+ if (mDayViewWidget) {
+ mDayViewWidget->orientationChanged(orientation);
}
+}
// ----------------------------------------------------------------------------
-// CCalenDayView::ViewIconL
-// From CCalenView
-// (other items were commented in a header)
-// ----------------------------------------------------------------------------
-//
-CGulIcon* CCalenDayView::ViewIconL() const
- {
- TRACE_ENTRY_POINT;
- TRACE_EXIT_POINT;
- return iServices.GetIconL( MCalenServices::ECalenDayViewIcon );
- }
-
+// CCalenDayView::launchMonthView
// ----------------------------------------------------------------------------
-// CCalenDayView::UpdateDateFromContextL
-// Update date form context when entry is saved
-// (other items were commented in a header)
-// ----------------------------------------------------------------------------
-//
-void CCalenDayView::UpdateDateFromContextL()
- {
- TRACE_ENTRY_POINT;
-
- iDate = CCalenContainer::DateFromContextL( iServices.Context() );
-
- TRACE_EXIT_POINT;
- }
+//
+void CalenDayView::launchMonthView()
+{
+ // Issue the command to launch the month view
+ mServices.IssueCommandL(ECalenMonthView);
+}
-// End of File
+// End of file --Don't remove this.