calendarui/views/src/calenagendaview.cpp
author hgs
Tue, 05 Oct 2010 13:57:00 +0530
changeset 81 ce92091cbd61
parent 75 7ac58b2aae6f
child 83 5aadd1120515
permissions -rw-r--r--
201039
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  CalenAgendaView implementation.
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
// System includes
hgs
parents:
diff changeset
    19
#include <QGraphicsSceneEvent>
hgs
parents:
diff changeset
    20
#include <hbmainwindow.h>
70
hgs
parents: 51
diff changeset
    21
#include <hbmenu.h>
45
hgs
parents:
diff changeset
    22
#include <hbaction.h>
hgs
parents:
diff changeset
    23
#include <hbpangesture.h>
hgs
parents:
diff changeset
    24
#include <hbswipegesture.h>
hgs
parents:
diff changeset
    25
#include <hbapplication.h> // hbapplication
81
hgs
parents: 75
diff changeset
    26
45
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
// User includes
hgs
parents:
diff changeset
    29
#include "calenagendaview.h"
hgs
parents:
diff changeset
    30
#include "calendocloader.h"
hgs
parents:
diff changeset
    31
#include "calenagendaviewwidget.h"
hgs
parents:
diff changeset
    32
#include "calenservices.h"
hgs
parents:
diff changeset
    33
#include "calencommon.h"
hgs
parents:
diff changeset
    34
#include "calencontext.h"
hgs
parents:
diff changeset
    35
#include "calendateutils.h"
hgs
parents:
diff changeset
    36
#include "calenconstants.h"
51
hgs
parents: 45
diff changeset
    37
#include "OstTraceDefinitions.h"
hgs
parents: 45
diff changeset
    38
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents: 45
diff changeset
    39
#include "calenagendaviewTraces.h"
hgs
parents: 45
diff changeset
    40
#endif
hgs
parents: 45
diff changeset
    41
45
hgs
parents:
diff changeset
    42
hgs
parents:
diff changeset
    43
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
    44
// CalenAgendaView::CalenAgendaView
hgs
parents:
diff changeset
    45
// Rest of the details are commented in the header
hgs
parents:
diff changeset
    46
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
    47
//
hgs
parents:
diff changeset
    48
CalenAgendaView::CalenAgendaView(MCalenServices &services):
hgs
parents:
diff changeset
    49
CalenNativeView(services),
hgs
parents:
diff changeset
    50
mSoftKeyAction(NULL),
hgs
parents:
diff changeset
    51
mGoToTodayAction(NULL),
hgs
parents:
diff changeset
    52
mSwitchToDayViewAction(NULL),
hgs
parents:
diff changeset
    53
mActionTaken(false),
81
hgs
parents: 75
diff changeset
    54
mIsAboutToQuitEventConnected(false),
hgs
parents: 75
diff changeset
    55
mDayViewActivated(false)
45
hgs
parents:
diff changeset
    56
{
51
hgs
parents: 45
diff changeset
    57
    OstTraceFunctionEntry0( CALENAGENDAVIEW_CALENAGENDAVIEW_ENTRY );
hgs
parents: 45
diff changeset
    58
    
45
hgs
parents:
diff changeset
    59
    // No implementation yet
hgs
parents:
diff changeset
    60
    grabGesture(Qt::SwipeGesture);
51
hgs
parents: 45
diff changeset
    61
    
hgs
parents: 45
diff changeset
    62
    OstTraceFunctionExit0( CALENAGENDAVIEW_CALENAGENDAVIEW_EXIT );
45
hgs
parents:
diff changeset
    63
}
hgs
parents:
diff changeset
    64
hgs
parents:
diff changeset
    65
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
    66
// CalenAgendaView::~CalenAgendaView
hgs
parents:
diff changeset
    67
// Rest of the details are commented in the header
hgs
parents:
diff changeset
    68
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
    69
//    
hgs
parents:
diff changeset
    70
CalenAgendaView::~CalenAgendaView()
hgs
parents:
diff changeset
    71
{
51
hgs
parents: 45
diff changeset
    72
    OstTraceFunctionEntry0( DUP1_CALENAGENDAVIEW_CALENAGENDAVIEW_ENTRY );
hgs
parents: 45
diff changeset
    73
    
45
hgs
parents:
diff changeset
    74
    // No implementation yet
51
hgs
parents: 45
diff changeset
    75
    
hgs
parents: 45
diff changeset
    76
    OstTraceFunctionExit0( DUP1_CALENAGENDAVIEW_CALENAGENDAVIEW_EXIT );
45
hgs
parents:
diff changeset
    77
}
hgs
parents:
diff changeset
    78
hgs
parents:
diff changeset
    79
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
    80
// CalenAgendaView::setupView
hgs
parents:
diff changeset
    81
// Rest of the details are commented in the header
hgs
parents:
diff changeset
    82
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
    83
//    
hgs
parents:
diff changeset
    84
void CalenAgendaView::setupView(CalenDocLoader *docLoader)
hgs
parents:
diff changeset
    85
{
51
hgs
parents: 45
diff changeset
    86
    OstTraceFunctionEntry0( CALENAGENDAVIEW_SETUPVIEW_ENTRY );
hgs
parents: 45
diff changeset
    87
    
45
hgs
parents:
diff changeset
    88
    if (!docLoader) {
hgs
parents:
diff changeset
    89
        // Nothing can be done. Simply return
51
hgs
parents: 45
diff changeset
    90
        OstTraceFunctionExit0( CALENAGENDAVIEW_SETUPVIEW_EXIT );
45
hgs
parents:
diff changeset
    91
        return;
hgs
parents:
diff changeset
    92
    }
hgs
parents:
diff changeset
    93
    // Store the document loader for reference later
hgs
parents:
diff changeset
    94
	mDocLoader = docLoader;
hgs
parents:
diff changeset
    95
	
hgs
parents:
diff changeset
    96
	// Listen to orientation change events
hgs
parents:
diff changeset
    97
	connect(&(mServices.MainWindow()), SIGNAL(orientationChanged(Qt::Orientation)),
hgs
parents:
diff changeset
    98
	        this, SLOT(orientationChanged(Qt::Orientation)));
hgs
parents:
diff changeset
    99
	
hgs
parents:
diff changeset
   100
	// Get the pointer to the content widget
hgs
parents:
diff changeset
   101
	mAgendaViewWidget = qobject_cast<CalenAgendaViewWidget*>(mDocLoader->findWidget(CALEN_AGENDAVIEW_WIDGET));
hgs
parents:
diff changeset
   102
	if (!mAgendaViewWidget) {
hgs
parents:
diff changeset
   103
	    qFatal("calenagendaview.cpp : Unable to find the content widget");
hgs
parents:
diff changeset
   104
	}
hgs
parents:
diff changeset
   105
	mAgendaViewWidget->setupWidget(this);
hgs
parents:
diff changeset
   106
	
hgs
parents:
diff changeset
   107
	// Initialize all the menu and toolbar actions
hgs
parents:
diff changeset
   108
	setupActions();
51
hgs
parents: 45
diff changeset
   109
	
hgs
parents: 45
diff changeset
   110
    //add "show lunar data" action item ,if regional plugin is present
hgs
parents: 45
diff changeset
   111
    //regional plugin will add the option itself and handles it accordingly
hgs
parents: 45
diff changeset
   112
    //use this api after adding all action item to the menu
hgs
parents: 45
diff changeset
   113
    //so that plugin add the "Show lunar data" item as a second last option 
hgs
parents: 45
diff changeset
   114
    // in all views
hgs
parents: 45
diff changeset
   115
   mServices.OfferMenu(menu());
hgs
parents: 45
diff changeset
   116
	
81
hgs
parents: 75
diff changeset
   117
    // clean up any previous versions of this activity, if any, i.e. activityName, 
45
hgs
parents:
diff changeset
   118
	// Ignore return value, first boot would always return False. bool declared 
hgs
parents:
diff changeset
   119
	// only for debugging purpose.
81
hgs
parents: 75
diff changeset
   120
	bool ok = removeActivity();
51
hgs
parents: 45
diff changeset
   121
	OstTraceFunctionExit0( DUP1_CALENAGENDAVIEW_SETUPVIEW_EXIT );
45
hgs
parents:
diff changeset
   122
}
hgs
parents:
diff changeset
   123
hgs
parents:
diff changeset
   124
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   125
// CalenAgendaView::doPopulation
hgs
parents:
diff changeset
   126
// Rest of the details are commented in the header
hgs
parents:
diff changeset
   127
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   128
// 
hgs
parents:
diff changeset
   129
void CalenAgendaView::doPopulation()
hgs
parents:
diff changeset
   130
    {
51
hgs
parents: 45
diff changeset
   131
    OstTraceFunctionEntry0( CALENAGENDAVIEW_DOPOPULATION_ENTRY );
81
hgs
parents: 75
diff changeset
   132
    mDayViewActivated = false;
45
hgs
parents:
diff changeset
   133
    // The content widget has not been constructed. Don't do anything
hgs
parents:
diff changeset
   134
    if (!mAgendaViewWidget) {
51
hgs
parents: 45
diff changeset
   135
        OstTraceFunctionExit0( CALENAGENDAVIEW_DOPOPULATION_EXIT );
45
hgs
parents:
diff changeset
   136
        return;
hgs
parents:
diff changeset
   137
    }
hgs
parents:
diff changeset
   138
    // Get the day for which this view is being shown from the context
hgs
parents:
diff changeset
   139
    mDate = mServices.Context().focusDateAndTime();
hgs
parents:
diff changeset
   140
    
hgs
parents:
diff changeset
   141
    // Check if the current day being shown is "Today"
hgs
parents:
diff changeset
   142
    if (mGoToTodayAction) {
hgs
parents:
diff changeset
   143
        if (mDate.date() == CalenDateUtils::today().date()) {
hgs
parents:
diff changeset
   144
            // Hide the "Go to today" option
hgs
parents:
diff changeset
   145
            mGoToTodayAction->setVisible(false);
hgs
parents:
diff changeset
   146
        } else {
hgs
parents:
diff changeset
   147
            mGoToTodayAction->setVisible(true);
hgs
parents:
diff changeset
   148
        }
hgs
parents:
diff changeset
   149
    }
hgs
parents:
diff changeset
   150
    
hgs
parents:
diff changeset
   151
    // Set self as the current view
hgs
parents:
diff changeset
   152
    // mServices.MainWindow().setCurrentView(this);
hgs
parents:
diff changeset
   153
    
75
hgs
parents: 70
diff changeset
   154
    // Dont override the soft key behavior if day view or agenda view is the first view
hgs
parents: 70
diff changeset
   155
    if (ECalenMonthView == mServices.getFirstView()) {
45
hgs
parents:
diff changeset
   156
		mSoftKeyAction = new HbAction(Hb::BackNaviAction);
hgs
parents:
diff changeset
   157
		setNavigationAction(mSoftKeyAction);
hgs
parents:
diff changeset
   158
		// Connect to the signal triggered by clicking on back button.
hgs
parents:
diff changeset
   159
		connect(mSoftKeyAction, SIGNAL(triggered()), this,
hgs
parents:
diff changeset
   160
		        SLOT(launchMonthView()));
hgs
parents:
diff changeset
   161
	}
75
hgs
parents: 70
diff changeset
   162
    
45
hgs
parents:
diff changeset
   163
    // Initialize the content widget
hgs
parents:
diff changeset
   164
    mAgendaViewWidget->showWidget();
hgs
parents:
diff changeset
   165
    
hgs
parents:
diff changeset
   166
	//set Current Activity as day view
hgs
parents:
diff changeset
   167
    mActivityId = ECalenAgendaView;
hgs
parents:
diff changeset
   168
hgs
parents:
diff changeset
   169
	// connect to receive a call back on Day View exit. Call back would result in saveActivity 
hgs
parents:
diff changeset
   170
	// to be called in Native View
hgs
parents:
diff changeset
   171
    if (!mIsAboutToQuitEventConnected) // check if already not connected
hgs
parents:
diff changeset
   172
        {
hgs
parents:
diff changeset
   173
        connect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity()));
hgs
parents:
diff changeset
   174
		mIsAboutToQuitEventConnected = true;
hgs
parents:
diff changeset
   175
        }
hgs
parents:
diff changeset
   176
hgs
parents:
diff changeset
   177
hgs
parents:
diff changeset
   178
    // Population is complete, issue a notification
hgs
parents:
diff changeset
   179
    populationComplete();
81
hgs
parents: 75
diff changeset
   180
    captureScreenshot(true);
51
hgs
parents: 45
diff changeset
   181
    OstTraceFunctionExit0( DUP1_CALENAGENDAVIEW_DOPOPULATION_EXIT );
45
hgs
parents:
diff changeset
   182
    }
hgs
parents:
diff changeset
   183
hgs
parents:
diff changeset
   184
/*!
hgs
parents:
diff changeset
   185
 Funtion to refresh the current view upon selecting a date
hgs
parents:
diff changeset
   186
 from GoToDate popup
hgs
parents:
diff changeset
   187
 */
hgs
parents:
diff changeset
   188
void CalenAgendaView::refreshViewOnGoToDate()
hgs
parents:
diff changeset
   189
{
51
hgs
parents: 45
diff changeset
   190
    OstTraceFunctionEntry0( CALENAGENDAVIEW_REFRESHVIEWONGOTODATE_ENTRY );
hgs
parents: 45
diff changeset
   191
    
45
hgs
parents:
diff changeset
   192
	// Get the day for which this view is being shown from the context
hgs
parents:
diff changeset
   193
	mDate = mServices.Context().focusDateAndTime();
hgs
parents:
diff changeset
   194
	
hgs
parents:
diff changeset
   195
	// Check if the current day being shown is "Today"
hgs
parents:
diff changeset
   196
	if (mGoToTodayAction) {
hgs
parents:
diff changeset
   197
		if (mDate.date() == CalenDateUtils::today().date()) {
hgs
parents:
diff changeset
   198
			// Hide the "Go to today" option
hgs
parents:
diff changeset
   199
			mGoToTodayAction->setVisible(false);
hgs
parents:
diff changeset
   200
		} else {
hgs
parents:
diff changeset
   201
			mGoToTodayAction->setVisible(true);
hgs
parents:
diff changeset
   202
		}
hgs
parents:
diff changeset
   203
	}
hgs
parents:
diff changeset
   204
	
hgs
parents:
diff changeset
   205
	// Initialize the content widget
hgs
parents:
diff changeset
   206
	mAgendaViewWidget->showWidget();
51
hgs
parents: 45
diff changeset
   207
	
hgs
parents: 45
diff changeset
   208
	OstTraceFunctionExit0( CALENAGENDAVIEW_REFRESHVIEWONGOTODATE_EXIT );
45
hgs
parents:
diff changeset
   209
}
hgs
parents:
diff changeset
   210
hgs
parents:
diff changeset
   211
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   212
// CalenAgendaView::docLoader
hgs
parents:
diff changeset
   213
// Rest of the details are commented in the header
hgs
parents:
diff changeset
   214
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   215
//    
hgs
parents:
diff changeset
   216
CalenDocLoader* CalenAgendaView::docLoader()
hgs
parents:
diff changeset
   217
{
51
hgs
parents: 45
diff changeset
   218
    OstTraceFunctionEntry0( CALENAGENDAVIEW_DOCLOADER_ENTRY );
hgs
parents: 45
diff changeset
   219
    
hgs
parents: 45
diff changeset
   220
    OstTraceFunctionExit0( CALENAGENDAVIEW_DOCLOADER_EXIT );
45
hgs
parents:
diff changeset
   221
    return mDocLoader;
hgs
parents:
diff changeset
   222
}
hgs
parents:
diff changeset
   223
hgs
parents:
diff changeset
   224
/*
hgs
parents:
diff changeset
   225
	Function to listen for gestures
hgs
parents:
diff changeset
   226
*/
hgs
parents:
diff changeset
   227
void CalenAgendaView::gestureEvent(QGestureEvent *event)
hgs
parents:
diff changeset
   228
{
51
hgs
parents: 45
diff changeset
   229
    OstTraceFunctionEntry0( CALENAGENDAVIEW_GESTUREEVENT_ENTRY );
hgs
parents: 45
diff changeset
   230
    
45
hgs
parents:
diff changeset
   231
    if(HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) {
hgs
parents:
diff changeset
   232
        if (gesture->state() == Qt::GestureStarted) {
hgs
parents:
diff changeset
   233
            if(QSwipeGesture::Left == gesture->sceneHorizontalDirection()) {
75
hgs
parents: 70
diff changeset
   234
                // Check if we can swipe
hgs
parents: 70
diff changeset
   235
                if (checkIfWeCanSwipe(mDate, false)) {
hgs
parents: 70
diff changeset
   236
                    mServices.IssueCommandL(ECalenShowNextDay);
hgs
parents: 70
diff changeset
   237
                }
45
hgs
parents:
diff changeset
   238
                event->accept(Qt::SwipeGesture);
hgs
parents:
diff changeset
   239
            } else if(QSwipeGesture::Right == gesture->sceneHorizontalDirection()) {
75
hgs
parents: 70
diff changeset
   240
                // Check if we can swipe
hgs
parents: 70
diff changeset
   241
                if (checkIfWeCanSwipe(mDate, true)) {
hgs
parents: 70
diff changeset
   242
                    mServices.IssueCommandL(ECalenShowPrevDay);
hgs
parents: 70
diff changeset
   243
                }
45
hgs
parents:
diff changeset
   244
               event->accept(Qt::SwipeGesture);
hgs
parents:
diff changeset
   245
            }
hgs
parents:
diff changeset
   246
        }
hgs
parents:
diff changeset
   247
    } 
51
hgs
parents: 45
diff changeset
   248
    
hgs
parents: 45
diff changeset
   249
    OstTraceFunctionExit0( CALENAGENDAVIEW_GESTUREEVENT_EXIT );
45
hgs
parents:
diff changeset
   250
}
hgs
parents:
diff changeset
   251
hgs
parents:
diff changeset
   252
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   253
// CalenAgendaView::createToolBar
hgs
parents:
diff changeset
   254
// Rest of the details are commented in the header
hgs
parents:
diff changeset
   255
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   256
//
hgs
parents:
diff changeset
   257
void CalenAgendaView::setupActions()
hgs
parents:
diff changeset
   258
{
51
hgs
parents: 45
diff changeset
   259
    OstTraceFunctionEntry0( CALENAGENDAVIEW_SETUPACTIONS_ENTRY );
hgs
parents: 45
diff changeset
   260
    
45
hgs
parents:
diff changeset
   261
	// Get the actions associated with this view
hgs
parents:
diff changeset
   262
	HbAction *newEventAction = qobject_cast<HbAction *>
hgs
parents:
diff changeset
   263
                                (mDocLoader->findObject(CALEN_AGENDAVIEW_MENU_NEW_EVENT));
hgs
parents:
diff changeset
   264
	if (!newEventAction) {
hgs
parents:
diff changeset
   265
	    qFatal("calenagendaview.cpp : Unable to find new event action");
hgs
parents:
diff changeset
   266
	}
hgs
parents:
diff changeset
   267
	// Connect to the signal triggered by new event action
51
hgs
parents: 45
diff changeset
   268
	connect(newEventAction, SIGNAL(triggered()), this, SLOT(createNewEvent()));
hgs
parents: 45
diff changeset
   269
	    
45
hgs
parents:
diff changeset
   270
	mGoToTodayAction = qobject_cast<HbAction *>
hgs
parents:
diff changeset
   271
                        (mDocLoader->findObject(CALEN_AGENDAVIEW_MENU_GO_TO_TODAY));
hgs
parents:
diff changeset
   272
	if (!mGoToTodayAction) {
hgs
parents:
diff changeset
   273
	    qFatal("calenagendaview.cpp : Unable to find go to today action");
hgs
parents:
diff changeset
   274
	}
hgs
parents:
diff changeset
   275
	// Connect to the signal triggered by go to Today action
hgs
parents:
diff changeset
   276
	connect(mGoToTodayAction, SIGNAL(triggered()), mAgendaViewWidget, SLOT(goToToday()));
hgs
parents:
diff changeset
   277
	
hgs
parents:
diff changeset
   278
	HbAction *goToDateAction = qobject_cast<HbAction *>
hgs
parents:
diff changeset
   279
                                (mDocLoader->findObject(CALEN_AGENDAVIEW_MENU_GO_TO_DATE));
hgs
parents:
diff changeset
   280
	if (!goToDateAction) {
hgs
parents:
diff changeset
   281
	    qFatal("calenagendaview.cpp : Unable to find go to date action");
hgs
parents:
diff changeset
   282
	}
hgs
parents:
diff changeset
   283
	// Connect to the signal triggered by go to Date action
hgs
parents:
diff changeset
   284
	connect(goToDateAction, SIGNAL(triggered()), this, SLOT(goToDate()));
hgs
parents:
diff changeset
   285
	
hgs
parents:
diff changeset
   286
	mSwitchToDayViewAction = qobject_cast<HbAction *>
hgs
parents:
diff changeset
   287
	                                (mDocLoader->findObject(CALEN_AGENDAVIEW_MENU_SWITCH_TO_DAYVIEW));
hgs
parents:
diff changeset
   288
	if (!mSwitchToDayViewAction) {
hgs
parents:
diff changeset
   289
		    qFatal("calenagendaview.cpp : Unable to find go to date action");
hgs
parents:
diff changeset
   290
		}
hgs
parents:
diff changeset
   291
	// Connect to the signal triggered by switch to dayview action
hgs
parents:
diff changeset
   292
	connect(mSwitchToDayViewAction, SIGNAL(triggered()), this, SLOT(launchDayView()));
hgs
parents:
diff changeset
   293
	
hgs
parents:
diff changeset
   294
	HbAction *settingsAction = qobject_cast<HbAction *>
hgs
parents:
diff changeset
   295
                                (mDocLoader->findObject(CALEN_AGENDAVIEW_MENU_SETTINGS));
hgs
parents:
diff changeset
   296
	if (!settingsAction) {
hgs
parents:
diff changeset
   297
	    qFatal("calenagendaview.cpp : Unable to find settings action");
hgs
parents:
diff changeset
   298
	}
hgs
parents:
diff changeset
   299
	// Connect to the signal triggered by settings action
hgs
parents:
diff changeset
   300
	connect(settingsAction, SIGNAL(triggered()), this, SLOT(launchSettingsView()));
51
hgs
parents: 45
diff changeset
   301
	
70
hgs
parents: 51
diff changeset
   302
	// Close the menu once closeDialogs() is received
hgs
parents: 51
diff changeset
   303
	connect(this, SIGNAL(closeDialogs()), menu(), SLOT(close()));
51
hgs
parents: 45
diff changeset
   304
	OstTraceFunctionExit0( CALENAGENDAVIEW_SETUPACTIONS_EXIT );
hgs
parents: 45
diff changeset
   305
}
hgs
parents: 45
diff changeset
   306
hgs
parents: 45
diff changeset
   307
// ----------------------------------------------------------------------------
hgs
parents: 45
diff changeset
   308
// CalenAgendaView::createNewEvent
hgs
parents: 45
diff changeset
   309
// ----------------------------------------------------------------------------
hgs
parents: 45
diff changeset
   310
//    
hgs
parents: 45
diff changeset
   311
void CalenAgendaView::createNewEvent()
hgs
parents: 45
diff changeset
   312
{
81
hgs
parents: 75
diff changeset
   313
 
51
hgs
parents: 45
diff changeset
   314
    mAgendaViewWidget->createNewEvent();
45
hgs
parents:
diff changeset
   315
}
hgs
parents:
diff changeset
   316
hgs
parents:
diff changeset
   317
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   318
// CalenAgendaView::onLocaleChanged
hgs
parents:
diff changeset
   319
// Rest of the details are commented in the header
hgs
parents:
diff changeset
   320
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   321
//    
hgs
parents:
diff changeset
   322
void CalenAgendaView::onLocaleChanged(int reason)
hgs
parents:
diff changeset
   323
{
51
hgs
parents: 45
diff changeset
   324
    OstTraceFunctionEntry0( CALENAGENDAVIEW_ONLOCALECHANGED_ENTRY );
hgs
parents: 45
diff changeset
   325
    
45
hgs
parents:
diff changeset
   326
    Q_UNUSED(reason)
hgs
parents:
diff changeset
   327
    // Notify the content widget about the change
hgs
parents:
diff changeset
   328
    if(mAgendaViewWidget) {
hgs
parents:
diff changeset
   329
    mAgendaViewWidget->handleLocaleChange();
hgs
parents:
diff changeset
   330
    }
51
hgs
parents: 45
diff changeset
   331
    
hgs
parents: 45
diff changeset
   332
    OstTraceFunctionExit0( CALENAGENDAVIEW_ONLOCALECHANGED_EXIT );
45
hgs
parents:
diff changeset
   333
}
hgs
parents:
diff changeset
   334
hgs
parents:
diff changeset
   335
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   336
// CalenAgendaView::orientationChanged
hgs
parents:
diff changeset
   337
// Rest of the details are commented in the header
hgs
parents:
diff changeset
   338
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   339
// 
hgs
parents:
diff changeset
   340
void CalenAgendaView::orientationChanged(Qt::Orientation orientation)
hgs
parents:
diff changeset
   341
{
51
hgs
parents: 45
diff changeset
   342
    OstTraceFunctionEntry0( CALENAGENDAVIEW_ORIENTATIONCHANGED_ENTRY );
hgs
parents: 45
diff changeset
   343
    
45
hgs
parents:
diff changeset
   344
    // Notify the content widget about the change
hgs
parents:
diff changeset
   345
    if (mAgendaViewWidget) {
hgs
parents:
diff changeset
   346
    mAgendaViewWidget->orientationChanged(orientation);
hgs
parents:
diff changeset
   347
    }
51
hgs
parents: 45
diff changeset
   348
    OstTraceFunctionExit0( CALENAGENDAVIEW_ORIENTATIONCHANGED_EXIT );
45
hgs
parents:
diff changeset
   349
}
hgs
parents:
diff changeset
   350
hgs
parents:
diff changeset
   351
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   352
// CalenAgendaView::launchMonthView
hgs
parents:
diff changeset
   353
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   354
//    
hgs
parents:
diff changeset
   355
void CalenAgendaView::launchMonthView()
hgs
parents:
diff changeset
   356
{
51
hgs
parents: 45
diff changeset
   357
    OstTraceFunctionEntry0( CALENAGENDAVIEW_LAUNCHMONTHVIEW_ENTRY );
hgs
parents: 45
diff changeset
   358
    
45
hgs
parents:
diff changeset
   359
    // Issue the command to launch the month view
hgs
parents:
diff changeset
   360
    mServices.IssueCommandL(ECalenMonthView);
hgs
parents:
diff changeset
   361
	// month view launched now, disconnect to get the call backs for saveActivity 
hgs
parents:
diff changeset
   362
	// on aboutToQuit signal
hgs
parents:
diff changeset
   363
    disconnectAboutToQuitEvent();
51
hgs
parents: 45
diff changeset
   364
    
hgs
parents: 45
diff changeset
   365
    OstTraceFunctionExit0( CALENAGENDAVIEW_LAUNCHMONTHVIEW_EXIT );
45
hgs
parents:
diff changeset
   366
}
hgs
parents:
diff changeset
   367
hgs
parents:
diff changeset
   368
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   369
// CalenAgendaView::launchDayView
hgs
parents:
diff changeset
   370
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   371
//    
hgs
parents:
diff changeset
   372
void CalenAgendaView::launchDayView()
hgs
parents:
diff changeset
   373
{
51
hgs
parents: 45
diff changeset
   374
    OstTraceFunctionEntry0( CALENAGENDAVIEW_LAUNCHDAYVIEW_ENTRY );
81
hgs
parents: 75
diff changeset
   375
    mDayViewActivated = true;
45
hgs
parents:
diff changeset
   376
    // Issue the command to launch the day view
hgs
parents:
diff changeset
   377
    mServices.IssueCommandL(ECalenDayView);
51
hgs
parents: 45
diff changeset
   378
    
hgs
parents: 45
diff changeset
   379
    OstTraceFunctionExit0( CALENAGENDAVIEW_LAUNCHDAYVIEW_EXIT );
45
hgs
parents:
diff changeset
   380
}
hgs
parents:
diff changeset
   381
hgs
parents:
diff changeset
   382
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   383
// clears the list model 
hgs
parents:
diff changeset
   384
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   385
// 
hgs
parents:
diff changeset
   386
void CalenAgendaView::clearListModel()
hgs
parents:
diff changeset
   387
    {
51
hgs
parents: 45
diff changeset
   388
    OstTraceFunctionEntry0( CALENAGENDAVIEW_CLEARLISTMODEL_ENTRY );
81
hgs
parents: 75
diff changeset
   389
    // do not disconnect if day view is open
hgs
parents: 75
diff changeset
   390
    // save the agenda view as an activity
hgs
parents: 75
diff changeset
   391
    if(!mDayViewActivated){
45
hgs
parents:
diff changeset
   392
	// day view is removed from the list disconnect for aboutToQuit events
hgs
parents:
diff changeset
   393
    disconnectAboutToQuitEvent();
81
hgs
parents: 75
diff changeset
   394
    }
45
hgs
parents:
diff changeset
   395
    mAgendaViewWidget->clearListModel();
51
hgs
parents: 45
diff changeset
   396
    
hgs
parents: 45
diff changeset
   397
    OstTraceFunctionExit0( CALENAGENDAVIEW_CLEARLISTMODEL_EXIT );
45
hgs
parents:
diff changeset
   398
    }
hgs
parents:
diff changeset
   399
hgs
parents:
diff changeset
   400
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   401
// disconnectAboutToQuitEvent disconnects for the aboutToQuit events
hgs
parents:
diff changeset
   402
// ----------------------------------------------------------------------------
hgs
parents:
diff changeset
   403
// 
hgs
parents:
diff changeset
   404
void CalenAgendaView::disconnectAboutToQuitEvent()
hgs
parents:
diff changeset
   405
    {
51
hgs
parents: 45
diff changeset
   406
    OstTraceFunctionEntry0( CALENAGENDAVIEW_DISCONNECTABOUTTOQUITEVENT_ENTRY );
hgs
parents: 45
diff changeset
   407
    
45
hgs
parents:
diff changeset
   408
    if (mIsAboutToQuitEventConnected)
hgs
parents:
diff changeset
   409
        {
hgs
parents:
diff changeset
   410
        disconnect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity()));
hgs
parents:
diff changeset
   411
        mIsAboutToQuitEventConnected = false;
hgs
parents:
diff changeset
   412
        }
51
hgs
parents: 45
diff changeset
   413
    
hgs
parents: 45
diff changeset
   414
    OstTraceFunctionExit0( CALENAGENDAVIEW_DISCONNECTABOUTTOQUITEVENT_EXIT );
45
hgs
parents:
diff changeset
   415
    }
hgs
parents:
diff changeset
   416
hgs
parents:
diff changeset
   417
// End of file	--Don't remove this.