calendarui/views/src/calenmonthview.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:
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     3
 * All rights reserved.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     4
 * This component and the accompanying materials are made available
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     6
 * which accompanies this distribution, and is available
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
 *
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
     9
 * Initial Contributors:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    10
 * Nokia Corporation - initial contribution.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    11
 *
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    12
 * Contributors:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    13
 *
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    14
 * Description:  CalenMonthView implementation.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    15
 *
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    16
 */
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    18
//system includes
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    19
#include <QtGui>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    20
#include <xqsettingsmanager.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    21
#include <xqsettingskey.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    22
#include <hbapplication.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    23
#include <hbmainwindow.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    24
#include <hbmenu.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    25
#include <hbaction.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    26
#include <hbview.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    27
#include <hblabel.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    28
#include <hbframeitem.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    29
#include <hbcolorscheme.h>
63
hgs
parents: 57
diff changeset
    30
#include <hbtheme.h>
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    31
#include <agendautil.h>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    32
#include <agendaentry.h>
45
hgs
parents: 23
diff changeset
    33
#include <hbapplication.h> // hbapplication
81
hgs
parents: 75
diff changeset
    34
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    36
//user includes
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include "calenmonthview.h"
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    38
#include "calenservices.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    39
#include "calennativeview.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    40
#include "calenview.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    41
#include "calenmonthdata.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    42
#include "calencontext.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    43
#include "calenagendautils.h"
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include "CalenUid.h"
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    45
#include "hb_calencommands.hrh" 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    46
#include "calendateutils.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    47
#include "calenmonthgrid.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    48
#include "calenpreviewpane.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    49
#include "calendocloader.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    50
#include "calenthicklinesdrawer.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    51
#include "calencommon.h"
45
hgs
parents: 23
diff changeset
    52
#include "calendarprivatecrkeys.h"
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
    53
#include "calenpluginlabel.h"
45
hgs
parents: 23
diff changeset
    54
#include "calenconstants.h"
51
hgs
parents: 45
diff changeset
    55
#include "OstTraceDefinitions.h"
hgs
parents: 45
diff changeset
    56
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents: 45
diff changeset
    57
#include "calenmonthviewTraces.h"
hgs
parents: 45
diff changeset
    58
#endif
hgs
parents: 45
diff changeset
    59
55
hgs
parents: 51
diff changeset
    60
// CONSTANTS
hgs
parents: 51
diff changeset
    61
#define WEEKNUMWIDTH 6.41604 // in units, need to update this value if it 
hgs
parents: 51
diff changeset
    62
								// is changed in the docml
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    63
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    64
 \class CalenMonthView
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    65
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    66
 Class implementing calendar month view
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    67
 */
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    69
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    70
 Default constructor.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    71
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    72
CalenMonthView::CalenMonthView(MCalenServices &services) :
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    73
	CalenNativeView(services), mAgendaUtil(services.agendaInterface()), 
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
    74
	mGoToTodayAction(0),
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
    75
	mPrevRegionalInfo(0),
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
    76
	mCurrRegionalInfo(0),
45
hgs
parents: 23
diff changeset
    77
	mNextRegionalInfo(0),
hgs
parents: 23
diff changeset
    78
	mIsAboutToQuitEventConnected(false)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    79
{
51
hgs
parents: 45
diff changeset
    80
    OstTraceFunctionEntry0( CALENMONTHVIEW_CALENMONTHVIEW_ENTRY );
hgs
parents: 45
diff changeset
    81
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    82
	mIsWeekNumbersShown = 0;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    83
	mOrientation = mServices.MainWindow().orientation();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    84
	// Read the date from the context
45
hgs
parents: 23
diff changeset
    85
	mDate = mServices.Context().focusDateAndTime();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    87
	// Create the settings manager instance and settings key for week number
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    88
	mSettingsManager = new XQSettingsManager(this);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    89
	mWeekNumberCenrepKey
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    90
	        = new XQSettingsKey(XQSettingsKey::TargetCentralRepository,
45
hgs
parents: 23
diff changeset
    91
	                            KCRUidCalendar, KCalendarShowWeekNum);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    93
	mLocale = HbExtendedLocale::system();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    94
	mFirstWeekLabel = NULL;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    95
	mIsPrevPaneGesture = false;
63
hgs
parents: 57
diff changeset
    96
	// Get the week day and preview heading color from the theme
45
hgs
parents: 23
diff changeset
    97
	mWeekDaysColor = HbColorScheme::color("qtc_cal_week_day");
51
hgs
parents: 45
diff changeset
    98
	
63
hgs
parents: 57
diff changeset
    99
	mPreviewHeadingColor = HbColorScheme::color("qtc_cal_day_preview_heading");
hgs
parents: 57
diff changeset
   100
	
hgs
parents: 57
diff changeset
   101
    connect(HbTheme::instance(), SIGNAL(changed()),
hgs
parents: 57
diff changeset
   102
                this, SLOT(handleThemeChange()));
hgs
parents: 57
diff changeset
   103
    
51
hgs
parents: 45
diff changeset
   104
	OstTraceFunctionExit0( CALENMONTHVIEW_CALENMONTHVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   105
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   106
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   107
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   108
 Destructor.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   109
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   110
CalenMonthView::~CalenMonthView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   111
{
51
hgs
parents: 45
diff changeset
   112
    OstTraceFunctionEntry0( DUP1_CALENMONTHVIEW_CALENMONTHVIEW_ENTRY );
hgs
parents: 45
diff changeset
   113
    
hgs
parents: 45
diff changeset
   114
    OstTraceFunctionExit0( DUP1_CALENMONTHVIEW_CALENMONTHVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   115
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   117
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   118
 Called by the CalenViewManager after loading the view from the docml.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   119
 The initializaion/setup of the view is done here. 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   120
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   121
void CalenMonthView::setupView(CalenDocLoader *docLoader)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   122
{
51
hgs
parents: 45
diff changeset
   123
    OstTraceFunctionEntry0( CALENMONTHVIEW_SETUPVIEW_ENTRY );
hgs
parents: 45
diff changeset
   124
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   125
	mDocLoader = docLoader;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   126
	mTitleLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   127
	        = qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   128
								   mDocLoader->findWidget(CALEN_MONTH_TITLE));
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   129
	// Set the title text color
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   130
	QColor monthTitleColor = HbColorScheme::color("qtc_cal_monthgrid_title");
45
hgs
parents: 23
diff changeset
   131
	if (mTitleLabel && monthTitleColor.isValid()) {
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   132
		mTitleLabel->setTextColor(monthTitleColor);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   133
	}
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   134
		
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   135
	mDayNameWidget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   136
	        = qobject_cast<CalenThickLinesDrawer *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   137
													mDocLoader->findWidget(
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   138
													CALEN_DAYNAMES_WIDGET));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   140
	// Get all the seven day labels
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   141
	mFirstDayLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   142
	        = qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   143
						mDocLoader->findWidget(CALEN_MONTVIEW_FIRST_DAY_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   144
	mSecondDayLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   145
	        = qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   146
					   mDocLoader->findWidget(CALEN_MONTVIEW_SECOND_DAY_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   147
	mThirdDayLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   148
	        = qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   149
					   mDocLoader->findWidget(CALEN_MONTVIEW_THIRD_DAY_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   150
	mFourthDayLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   151
	        = qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   152
					   mDocLoader->findWidget(CALEN_MONTVIEW_FOURTH_DAY_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   153
	mFifthDayLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   154
	        = qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   155
					   mDocLoader->findWidget(CALEN_MONTVIEW_FIFTH_DAY_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   156
	mSixthDayLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   157
	        = qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   158
					   mDocLoader->findWidget(CALEN_MONTVIEW_SIXTH_DAY_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   159
	mSeventhDayLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   160
	        = qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   161
					mDocLoader->findWidget(CALEN_MONTVIEW_SEVENTH_DAY_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   162
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   163
	// Get the weeknumber widget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   164
	mWeekNumberWidget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   165
			= qobject_cast<CalenThickLinesDrawer *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   166
							 mDocLoader->findWidget(CALEN_WEEKNUMBERS_WIDGET));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   167
	// Disable the item so that line seperator doesnt gets drawn by default
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   168
	mWeekNumberWidget->setEnabled(false);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   170
	// Get the month grid
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   171
	mMonthGrid
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   172
	        = qobject_cast<CalenMonthGrid *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   173
									mDocLoader->findWidget(CALEN_MONTHGRID));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   174
	mCurrPaneParent = qobject_cast<HbWidget *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   175
			mDocLoader->findWidget(CALEN_CURRPREVIEWPARENT));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   176
	// Get current day preview pane widget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   177
	mCurrPreviewPane
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   178
			= static_cast<CalenPreviewPane *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   179
					docLoader->findWidget(CALEN_CURRPREVIEWPANE));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   180
	//mCurrPreviewPane->setParent(mCurrPaneParent);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   181
	mCurrPaneParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   182
	HbLabel* currPaneNoEntriesLabel = static_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   183
			docLoader->findWidget(CALEN_NOENTRIES_LABEL_CURR));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   184
	mCurrPreviewPane->setView(this);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   185
	mCurrPreviewPane->setNoEntriesLabel(currPaneNoEntriesLabel);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   186
	
63
hgs
parents: 57
diff changeset
   187
    connect(
hgs
parents: 57
diff changeset
   188
            HbTheme::instance(), SIGNAL(changed()),
hgs
parents: 57
diff changeset
   189
            mCurrPreviewPane, SLOT(handleThemeChange()));
hgs
parents: 57
diff changeset
   190
	
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   191
	mCurrPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_CURRPANELAYOUT));
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   192
	mCurrPaneLayout = static_cast<QGraphicsLinearLayout*>(mCurrPaneLayoutWidget->layout());
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   193
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   194
	mPrevPaneParent = qobject_cast<HbWidget *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   195
			mDocLoader->findWidget(CALEN_PREVPREVIEWPARENT));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   196
	// Get previous day preview pane widget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   197
	mPrevPreviewPane
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   198
			= static_cast<CalenPreviewPane *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   199
					docLoader->findWidget(CALEN_PREVPREVIEWPANE));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   200
	//mPrevPreviewPane->setParent(mPrevPaneParent);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   201
	mPrevPaneParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   202
	HbLabel* prevPaneNoEntriesLabel = static_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   203
			docLoader->findWidget(CALEN_NOENTRIES_LABEL_PREV));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   204
	mPrevPreviewPane->setView(this);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   205
	mPrevPreviewPane->setNoEntriesLabel(prevPaneNoEntriesLabel);
63
hgs
parents: 57
diff changeset
   206
    connect(
hgs
parents: 57
diff changeset
   207
            HbTheme::instance(), SIGNAL(changed()),
hgs
parents: 57
diff changeset
   208
            mPrevPreviewPane, SLOT(handleThemeChange()));
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   209
	mPrevPaneParent->setVisible(false);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   210
	
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   211
	mPrevPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_PREVPANELAYOUT));
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   212
	mPrevPaneLayout = static_cast<QGraphicsLinearLayout*>(mPrevPaneLayoutWidget->layout());
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   213
	mNextPaneParent = qobject_cast<HbWidget *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   214
			mDocLoader->findWidget(CALEN_NEXTPREVIEWPARENT));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   215
	// Get next day preview pane widget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   216
	mNextPreviewPane
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   217
			= static_cast<CalenPreviewPane *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   218
					docLoader->findWidget(CALEN_NEXTPREVIEWPANE));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   219
	//mNextPreviewPane->setParent(mNextPaneParent);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   220
	mNextPaneParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   221
	HbLabel* nextPaneNoEntriesLabel = static_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   222
			docLoader->findWidget(CALEN_NOENTRIES_LABEL_NEXT));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   223
	mNextPreviewPane->setView(this);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   224
	mNextPreviewPane->setNoEntriesLabel(nextPaneNoEntriesLabel);
63
hgs
parents: 57
diff changeset
   225
    connect(
hgs
parents: 57
diff changeset
   226
            HbTheme::instance(), SIGNAL(changed()),
hgs
parents: 57
diff changeset
   227
            mNextPreviewPane, SLOT(handleThemeChange()));
hgs
parents: 57
diff changeset
   228
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   229
	mNextPaneParent->setVisible(false);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   230
	mNextPaneLayoutWidget = qobject_cast<HbWidget*>(docLoader->findWidget(CALEN_NEXTPANELAYOUT));
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   231
	mNextPaneLayout = static_cast<QGraphicsLinearLayout*>(mNextPaneLayoutWidget->layout());
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   232
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   233
	mMonthGridPlusWeekNumWidget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   234
	        = qobject_cast<HbWidget *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   235
					mDocLoader->findWidget(CALEN_MONTHGRID_WEEKNUMBERS_WIDGET));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   237
	mMonthGrid->setView(this);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
45
hgs
parents: 23
diff changeset
   239
	
hgs
parents: 23
diff changeset
   240
	
hgs
parents: 23
diff changeset
   241
	mIsFirstTimeLoad = true;
hgs
parents: 23
diff changeset
   242
81
hgs
parents: 75
diff changeset
   243
	// clean up any previous versions of this activity, if any, i.e. activityName
45
hgs
parents: 23
diff changeset
   244
	// Ignore return value, first boot would always return False. bool declared 
hgs
parents: 23
diff changeset
   245
	// only for debugging purpose.
81
hgs
parents: 75
diff changeset
   246
	bool ok = removeActivity();
45
hgs
parents: 23
diff changeset
   247
51
hgs
parents: 45
diff changeset
   248
	OstTraceFunctionExit0( CALENMONTHVIEW_SETUPVIEW_EXIT );
45
hgs
parents: 23
diff changeset
   249
}
hgs
parents: 23
diff changeset
   250
hgs
parents: 23
diff changeset
   251
/*!
hgs
parents: 23
diff changeset
   252
 Constructs the remaining part of the month view that was kept as 
hgs
parents: 23
diff changeset
   253
 part if lazy loading
hgs
parents: 23
diff changeset
   254
 */
hgs
parents: 23
diff changeset
   255
void CalenMonthView::doLazyLoading()
hgs
parents: 23
diff changeset
   256
{
51
hgs
parents: 45
diff changeset
   257
    OstTraceFunctionEntry0( CALENMONTHVIEW_DOLAZYLOADING_ENTRY );
45
hgs
parents: 23
diff changeset
   258
	// Add background items to all the widgets
hgs
parents: 23
diff changeset
   259
	addBackgroundFrame();
hgs
parents: 23
diff changeset
   260
	
hgs
parents: 23
diff changeset
   261
	// Construct and add the previous month and next month items to the view
hgs
parents: 23
diff changeset
   262
	mMonthGrid->updateMonthGridWithInActiveMonths(mMonthDataArray);
hgs
parents: 23
diff changeset
   263
	
hgs
parents: 23
diff changeset
   264
	// Check if regional information needs to be shown
hgs
parents: 23
diff changeset
   265
	// and add it or remove it
hgs
parents: 23
diff changeset
   266
	showHideRegionalInformation();
hgs
parents: 23
diff changeset
   267
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   268
	// Connect to the menu actions
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   269
	HbAction
45
hgs
parents: 23
diff changeset
   270
			*newEventAction =
hgs
parents: 23
diff changeset
   271
					qobject_cast<HbAction *> (
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   272
						mDocLoader->findObject(CALEN_MONTVIEW_MENU_NEWEVENT));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   273
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   274
	connect(newEventAction, SIGNAL(triggered()), this, SLOT(createEditor()));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   276
	mGoToTodayAction =
45
hgs
parents: 23
diff changeset
   277
					qobject_cast<HbAction *> (
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   278
							mDocLoader->findObject(CALEN_MONTVIEW_MENU_GOTOTODAY));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   279
	connect(mGoToTodayAction, SIGNAL(triggered()), this, SLOT(goToToday()));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   280
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   281
	HbAction
45
hgs
parents: 23
diff changeset
   282
			*goToDateAction =
hgs
parents: 23
diff changeset
   283
					qobject_cast<HbAction *> (
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   284
						mDocLoader->findObject(CALEN_MONTVIEW_MENU_GOTODATE));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   285
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   286
	connect(goToDateAction, SIGNAL(triggered()), this, SLOT(goToDate()));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   288
	// TODO: Need to move this to docml
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   289
	// Set the title to the submenu
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   290
	mDeleteSubMenu =
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   291
	                qobject_cast<HbMenu *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   292
						mDocLoader->findObject(CALEN_MONTVIEW_DELETE_SUBMENU));
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   293
	mDeleteSubMenu->setTitle(hbTrId("txt_calendar_opt_delete_entries"));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   295
	HbAction
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   296
	        *beforeDateAction =
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   297
	                qobject_cast<HbAction *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   298
						mDocLoader->findObject(CALEN_MONTVIEW_MENU_BEFOREDATE));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   299
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   300
	connect(beforeDateAction, SIGNAL(triggered()), this,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   301
	        SLOT(deleteBeforeDate()));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   303
	HbAction
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   304
	        *allEntriesAction =
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   305
	                qobject_cast<HbAction *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   306
						mDocLoader->findObject(CALEN_MONTVIEW_MENU_ALLENTRIES));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   307
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   308
	connect(allEntriesAction, SIGNAL(triggered()), this,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   309
	        SLOT(deleteAllEntries()));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   311
	HbAction
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   312
	        *settingsAction =
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   313
	                qobject_cast<HbAction *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   314
						mDocLoader->findObject(CALEN_MONTVIEW_MENU_SETTINGS));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   316
	connect(settingsAction, SIGNAL(triggered()), this,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   317
	        SLOT(launchSettingsView()));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   320
	// Connect to the signal of change orientation.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   321
	connect(&(mServices.MainWindow()),
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   322
	        SIGNAL(orientationChanged(Qt::Orientation)), this,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   323
	        SLOT(changeOrientation(Qt::Orientation)));
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   324
	
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   325
	// Connect to the signal when options menu is shown
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   326
	// This is required to add/remove dynamically some options
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   327
	connect(menu(), SIGNAL(aboutToShow ()), this,
70
hgs
parents: 64
diff changeset
   328
										SLOT(addRemoveActionsInMenu()));
hgs
parents: 64
diff changeset
   329
	// Close the menu once closeDialogs() is received
hgs
parents: 64
diff changeset
   330
	connect(this, SIGNAL(closeDialogs()), menu(), SLOT(close()));
hgs
parents: 64
diff changeset
   331
		
51
hgs
parents: 45
diff changeset
   332
	//add "show lunar data" action item ,if regional plugin is present
hgs
parents: 45
diff changeset
   333
	//regional plugin will add the option itself and handles it accordingly
hgs
parents: 45
diff changeset
   334
	//use this api after adding all action item to the menu
hgs
parents: 45
diff changeset
   335
	//so that plugin add the "Show lunar data" item as a second last option 
hgs
parents: 45
diff changeset
   336
	// in all views
hgs
parents: 45
diff changeset
   337
	mServices.OfferMenu(menu());
hgs
parents: 45
diff changeset
   338
	
hgs
parents: 45
diff changeset
   339
	OstTraceFunctionExit0( CALENMONTHVIEW_DOLAZYLOADING_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   340
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   341
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   342
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   343
 Adds the week numbers to the weeknumber widget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   344
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   345
void CalenMonthView::addWeekNumbers()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   346
{
51
hgs
parents: 45
diff changeset
   347
    OstTraceFunctionEntry0( CALENMONTHVIEW_ADDWEEKNUMBERS_ENTRY );
hgs
parents: 45
diff changeset
   348
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   349
	if (!mFirstWeekLabel) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   350
	// Get all the six week labels
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   351
	mFirstWeekLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   352
			= qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   353
					mDocLoader->findWidget(CALEN_MONTVIEW_FIRST_WEEK_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   354
	mSecondWeekLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   355
			= qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   356
					mDocLoader->findWidget(CALEN_MONTVIEW_SECOND_WEEK_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   357
	mThirdWeekLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   358
			= qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   359
					mDocLoader->findWidget(CALEN_MONTVIEW_THIRD_WEEK_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   360
	mFourthWeekLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   361
			= qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   362
					mDocLoader->findWidget(CALEN_MONTVIEW_FOURTH_WEEK_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   363
	mFifthWeekLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   364
			= qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   365
					mDocLoader->findWidget(CALEN_MONTVIEW_FIFTH_WEEK_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   366
	mSixthWeekLabel
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   367
			= qobject_cast<HbLabel *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   368
					mDocLoader->findWidget(CALEN_MONTVIEW_SIXTH_WEEK_LABEL));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   369
	}
45
hgs
parents: 23
diff changeset
   370
	
hgs
parents: 23
diff changeset
   371
	// Set the text colors well before instead of setting it again and again
hgs
parents: 23
diff changeset
   372
	mFirstWeekLabel->setTextColor(mWeekDaysColor);
hgs
parents: 23
diff changeset
   373
	mSecondWeekLabel->setTextColor(mWeekDaysColor);
hgs
parents: 23
diff changeset
   374
	mThirdWeekLabel->setTextColor(mWeekDaysColor);
hgs
parents: 23
diff changeset
   375
	mFourthWeekLabel->setTextColor(mWeekDaysColor);
hgs
parents: 23
diff changeset
   376
	mFifthWeekLabel->setTextColor(mWeekDaysColor);
hgs
parents: 23
diff changeset
   377
	mSixthWeekLabel->setTextColor(mWeekDaysColor);
hgs
parents: 23
diff changeset
   378
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   379
	// Calculate the week numbers and set them to the week labels
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   380
	updateWeekNumGridModel();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   381
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   382
	// Get the day names layout
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   383
	QGraphicsLinearLayout *dayNamesLayout =
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   384
	        static_cast<QGraphicsLinearLayout *> (mDayNameWidget->layout());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   385
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   386
	if (KCalenDaysInWeek == dayNamesLayout->count()) {
55
hgs
parents: 51
diff changeset
   387
		// Add one empty label in the day name grid
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   388
		HbLabel *label = new HbLabel(mDayNameWidget);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   389
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   390
		// Set the attributes same as that of other day names to make it
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   391
		// look similar to the day names
55
hgs
parents: 51
diff changeset
   392
		label->setPlainText("");
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   393
		label->setFont(mFirstDayLabel->font());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   394
		label->setFontSpec(mFirstDayLabel->fontSpec());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   395
		label->setAlignment(mFirstDayLabel->alignment());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   396
		label->setElideMode(mFirstDayLabel->elideMode());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   397
		label->setZValue(mFirstDayLabel->zValue());
55
hgs
parents: 51
diff changeset
   398
		// Set the proper width to this empty label so that
hgs
parents: 51
diff changeset
   399
		// day names are dislayed against the correct columns
hgs
parents: 51
diff changeset
   400
		HbDeviceProfile deviceProf;
hgs
parents: 51
diff changeset
   401
        qreal unitValue = deviceProf.unitValue();
hgs
parents: 51
diff changeset
   402
        qreal widthInPixels = WEEKNUMWIDTH * unitValue;
hgs
parents: 51
diff changeset
   403
        label->setPreferredWidth(widthInPixels);
hgs
parents: 51
diff changeset
   404
        label->setMinimumWidth(widthInPixels);
hgs
parents: 51
diff changeset
   405
        label->setMaximumWidth(widthInPixels);
hgs
parents: 51
diff changeset
   406
        label->setContentsMargins(0,0,0,0);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   407
		
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   408
		// Add this label into layout
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   409
		dayNamesLayout->insertItem(0, label);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   410
		dayNamesLayout->invalidate();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   411
		dayNamesLayout->activate();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   412
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   413
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   414
	// Now insert the weekNumber Grid
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   415
	QGraphicsLinearLayout *layout = static_cast<QGraphicsLinearLayout *> 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   416
										(mMonthGridPlusWeekNumWidget->layout());
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   418
	if (1 == layout->count()) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   419
		layout->insertItem(0, mWeekNumberWidget);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   420
		// Enable the item so that line seperator gets drawn
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   421
		mWeekNumberWidget->setEnabled(true);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   422
		layout->invalidate();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   423
		layout->activate();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   424
	}
51
hgs
parents: 45
diff changeset
   425
	
hgs
parents: 45
diff changeset
   426
	OstTraceFunctionExit0( CALENMONTHVIEW_ADDWEEKNUMBERS_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   427
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   428
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   429
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   430
 Removes the week numbers from the view
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   431
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   432
void CalenMonthView::removeWeekNumbers()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   433
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   434
{
51
hgs
parents: 45
diff changeset
   435
    OstTraceFunctionEntry0( CALENMONTHVIEW_REMOVEWEEKNUMBERS_ENTRY );
hgs
parents: 45
diff changeset
   436
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   437
	// Remove the week number grid if setting is off
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   438
	QGraphicsLinearLayout *layout = static_cast<QGraphicsLinearLayout *> 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   439
									(mMonthGridPlusWeekNumWidget->layout());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   440
	if (2 == layout->count()) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   441
		layout->removeItem(mWeekNumberWidget);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   442
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   443
		// Disable the item as we are removing it from the layout
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   444
		mWeekNumberWidget->setEnabled(false);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   445
		layout->invalidate();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   446
		layout->activate();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   447
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   448
		// Clear the week labels
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   449
		mFirstWeekLabel->clear();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   450
		mSecondWeekLabel->clear();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   451
		mThirdWeekLabel->clear();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   452
		mFourthWeekLabel->clear();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   453
		mFifthWeekLabel->clear();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   454
		mSixthWeekLabel->clear();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   455
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   456
		// Get the day names layout
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   457
		QGraphicsLinearLayout *dayNamesLayout =
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   458
		        static_cast<QGraphicsLinearLayout *> (mDayNameWidget->layout());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   459
		if (dayNamesLayout->count() == KCalenDaysInWeek + 1) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   460
			// Remove the empty item in the day name grid
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   461
			QGraphicsLayoutItem *item = dayNamesLayout->itemAt(0);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   462
			dayNamesLayout->removeAt(0);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   463
			delete item;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   464
			dayNamesLayout->invalidate();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   465
			dayNamesLayout->activate();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   466
		}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   467
	}
51
hgs
parents: 45
diff changeset
   468
	
hgs
parents: 45
diff changeset
   469
	OstTraceFunctionExit0( CALENMONTHVIEW_REMOVEWEEKNUMBERS_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   470
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   471
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   472
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   473
 Sets the background frame for the month view
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   474
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   475
void CalenMonthView::addBackgroundFrame()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   476
{
51
hgs
parents: 45
diff changeset
   477
    OstTraceFunctionEntry0( CALENMONTHVIEW_ADDBACKGROUNDFRAME_ENTRY );
hgs
parents: 45
diff changeset
   478
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   479
    // Set the background items for all the widgets
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   480
    HbFrameItem* frame = NULL;
45
hgs
parents: 23
diff changeset
   481
    HbFrameDrawer *drawer = NULL;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   482
    HbWidget* monthViewExceptPreviewPane = qobject_cast<HbWidget *> (
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   483
						 mDocLoader->findWidget(CALEN_MONTHVIEW_EXCEPT_PANE));
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   484
    if (monthViewExceptPreviewPane) {
45
hgs
parents: 23
diff changeset
   485
        drawer = new HbFrameDrawer("qtg_fr_cal_monthgrid_bg", HbFrameDrawer::NinePieces);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   486
        // The grid background
45
hgs
parents: 23
diff changeset
   487
        frame = new HbFrameItem(drawer, this);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   488
        monthViewExceptPreviewPane->setBackgroundItem(frame->graphicsItem(), -2);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   489
    }
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   490
    if (mTitleLabel) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   491
        // The month title
45
hgs
parents: 23
diff changeset
   492
        drawer = new HbFrameDrawer("qtg_fr_cal_monthgrid_title_bg", HbFrameDrawer::ThreePiecesHorizontal);
hgs
parents: 23
diff changeset
   493
		if (drawer)
hgs
parents: 23
diff changeset
   494
        	frame = new HbFrameItem(drawer, this);
hgs
parents: 23
diff changeset
   495
		if(frame)
hgs
parents: 23
diff changeset
   496
			mTitleLabel->setBackgroundItem(frame->graphicsItem(), -2);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   497
    }
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   498
    
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   499
    // Set the frame to the preview pane
45
hgs
parents: 23
diff changeset
   500
    drawer = new HbFrameDrawer("qtg_fr_cal_preview_bg", HbFrameDrawer::NinePieces);
hgs
parents: 23
diff changeset
   501
	if (drawer)
hgs
parents: 23
diff changeset
   502
	    frame = new HbFrameItem(drawer, this);
hgs
parents: 23
diff changeset
   503
	if(frame)
hgs
parents: 23
diff changeset
   504
	    mPrevPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   505
    
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   506
    // Set the frame to the preview pane
45
hgs
parents: 23
diff changeset
   507
    drawer = new HbFrameDrawer("qtg_fr_cal_preview_bg", HbFrameDrawer::NinePieces);
hgs
parents: 23
diff changeset
   508
    if(drawer)
hgs
parents: 23
diff changeset
   509
	   frame = new HbFrameItem(drawer, this);
hgs
parents: 23
diff changeset
   510
	if(frame)
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   511
    mCurrPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   512
    
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   513
    // Set the frame to the preview pane
45
hgs
parents: 23
diff changeset
   514
    drawer = new HbFrameDrawer("qtg_fr_cal_preview_bg", HbFrameDrawer::NinePieces);
hgs
parents: 23
diff changeset
   515
	if(drawer)
hgs
parents: 23
diff changeset
   516
           frame = new HbFrameItem(drawer, this);
hgs
parents: 23
diff changeset
   517
	if(frame)
hgs
parents: 23
diff changeset
   518
	    mNextPaneLayoutWidget->setBackgroundItem(frame->graphicsItem(), -5);
51
hgs
parents: 45
diff changeset
   519
	
hgs
parents: 45
diff changeset
   520
	OstTraceFunctionExit0( CALENMONTHVIEW_ADDBACKGROUNDFRAME_EXIT );
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   521
}
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   522
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   523
void CalenMonthView::showHideRegionalInformation()
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   524
{
51
hgs
parents: 45
diff changeset
   525
    OstTraceFunctionEntry0( CALENMONTHVIEW_SHOWHIDEREGIONALINFORMATION_ENTRY );
hgs
parents: 45
diff changeset
   526
    
45
hgs
parents: 23
diff changeset
   527
	if (pluginEnabled()) {
hgs
parents: 23
diff changeset
   528
		XQSettingsKey regionalInfo(XQSettingsKey::TargetCentralRepository,
hgs
parents: 23
diff changeset
   529
									KCRUidCalendar, KCalendarShowRegionalInfo);
hgs
parents: 23
diff changeset
   530
hgs
parents: 23
diff changeset
   531
		int showRegionalInfo = 
hgs
parents: 23
diff changeset
   532
						mSettingsManager->readItemValue(regionalInfo).toUInt();
hgs
parents: 23
diff changeset
   533
		if (showRegionalInfo) {
hgs
parents: 23
diff changeset
   534
hgs
parents: 23
diff changeset
   535
			// Add the regional information to the preview panes
hgs
parents: 23
diff changeset
   536
			if (!mPrevRegionalInfo) {
hgs
parents: 23
diff changeset
   537
				mPrevRegionalInfo = qobject_cast<CalenPluginLabel *> 
hgs
parents: 23
diff changeset
   538
				(mDocLoader->findWidget(CALEN_PREVREGIONALINFO));
hgs
parents: 23
diff changeset
   539
				mPrevRegionalInfo->show();
hgs
parents: 23
diff changeset
   540
				mPrevPaneLayout->insertItem(0, mPrevRegionalInfo);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   541
45
hgs
parents: 23
diff changeset
   542
				HbFrameItem *frameCurr = new HbFrameItem(this);
hgs
parents: 23
diff changeset
   543
				frameCurr->frameDrawer().setFrameType(
hgs
parents: 23
diff changeset
   544
										HbFrameDrawer::ThreePiecesHorizontal);
hgs
parents: 23
diff changeset
   545
				frameCurr->frameDrawer().setFrameGraphicsName(
hgs
parents: 23
diff changeset
   546
										"qtg_fr_cal_preview_title_bg");
hgs
parents: 23
diff changeset
   547
				mPrevRegionalInfo->setBackgroundItem(
hgs
parents: 23
diff changeset
   548
										frameCurr->graphicsItem(), -2);
hgs
parents: 23
diff changeset
   549
			}
hgs
parents: 23
diff changeset
   550
			if (!mCurrRegionalInfo) {
hgs
parents: 23
diff changeset
   551
				mCurrRegionalInfo = qobject_cast<CalenPluginLabel *> 
hgs
parents: 23
diff changeset
   552
				(mDocLoader->findWidget(CALEN_CURRREGIONALINFO));
hgs
parents: 23
diff changeset
   553
				mCurrRegionalInfo->show();
hgs
parents: 23
diff changeset
   554
				mCurrPaneLayout->insertItem(0, mCurrRegionalInfo);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   555
45
hgs
parents: 23
diff changeset
   556
				HbFrameItem *frameCurr = new HbFrameItem(this);
hgs
parents: 23
diff changeset
   557
				frameCurr->frameDrawer().setFrameType(
hgs
parents: 23
diff changeset
   558
										HbFrameDrawer::ThreePiecesHorizontal);
hgs
parents: 23
diff changeset
   559
				frameCurr->frameDrawer().setFrameGraphicsName(
hgs
parents: 23
diff changeset
   560
										"qtg_fr_cal_preview_title_bg");
hgs
parents: 23
diff changeset
   561
				mCurrRegionalInfo->setBackgroundItem(
hgs
parents: 23
diff changeset
   562
										frameCurr->graphicsItem(), -2);
hgs
parents: 23
diff changeset
   563
			}
hgs
parents: 23
diff changeset
   564
			if (!mNextRegionalInfo) {
hgs
parents: 23
diff changeset
   565
				mNextRegionalInfo = qobject_cast<CalenPluginLabel *> 
hgs
parents: 23
diff changeset
   566
				(mDocLoader->findWidget(CALEN_NEXTREGIONALINFO));
hgs
parents: 23
diff changeset
   567
				mNextRegionalInfo->show();
hgs
parents: 23
diff changeset
   568
				mNextPaneLayout->insertItem(0, mNextRegionalInfo);
hgs
parents: 23
diff changeset
   569
hgs
parents: 23
diff changeset
   570
				HbFrameItem *frameCurr = new HbFrameItem(this);
hgs
parents: 23
diff changeset
   571
				frameCurr->frameDrawer().setFrameType(
hgs
parents: 23
diff changeset
   572
										HbFrameDrawer::ThreePiecesHorizontal);
hgs
parents: 23
diff changeset
   573
				frameCurr->frameDrawer().setFrameGraphicsName(
hgs
parents: 23
diff changeset
   574
										"qtg_fr_cal_preview_title_bg");
hgs
parents: 23
diff changeset
   575
				mNextRegionalInfo->setBackgroundItem(
hgs
parents: 23
diff changeset
   576
										frameCurr->graphicsItem(), -2);
hgs
parents: 23
diff changeset
   577
			}
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   578
			QString *pluginString = pluginText();
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   579
			mPrevRegionalInfo->setPlainText(*pluginString);
63
hgs
parents: 57
diff changeset
   580
			mPrevRegionalInfo->setTextColor(mPreviewHeadingColor);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   581
			mCurrRegionalInfo->setPlainText(*pluginString);
63
hgs
parents: 57
diff changeset
   582
			mCurrRegionalInfo->setTextColor(mPreviewHeadingColor);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   583
			mNextRegionalInfo->setPlainText(*pluginString);
63
hgs
parents: 57
diff changeset
   584
			mNextRegionalInfo->setTextColor(mPreviewHeadingColor);
45
hgs
parents: 23
diff changeset
   585
		} else {
hgs
parents: 23
diff changeset
   586
			if (mPrevRegionalInfo) {
hgs
parents: 23
diff changeset
   587
				mPrevPaneLayout->removeItem(mPrevRegionalInfo);
hgs
parents: 23
diff changeset
   588
				mPrevRegionalInfo->hide();
hgs
parents: 23
diff changeset
   589
				mPrevRegionalInfo = NULL;
hgs
parents: 23
diff changeset
   590
			}
hgs
parents: 23
diff changeset
   591
			if (mCurrRegionalInfo) {
64
1881ad52dc45 201033_03
hgs
parents: 63
diff changeset
   592
				mCurrPaneLayout->removeItem(mCurrRegionalInfo);
45
hgs
parents: 23
diff changeset
   593
				mCurrRegionalInfo->hide();
hgs
parents: 23
diff changeset
   594
				mCurrRegionalInfo = NULL;
hgs
parents: 23
diff changeset
   595
			}
hgs
parents: 23
diff changeset
   596
			if (mNextRegionalInfo) {
64
1881ad52dc45 201033_03
hgs
parents: 63
diff changeset
   597
				mNextPaneLayout->removeItem(mNextRegionalInfo);
45
hgs
parents: 23
diff changeset
   598
				mNextRegionalInfo->hide();
hgs
parents: 23
diff changeset
   599
				mNextRegionalInfo = NULL;
hgs
parents: 23
diff changeset
   600
			}
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   601
		}
45
hgs
parents: 23
diff changeset
   602
	}
51
hgs
parents: 45
diff changeset
   603
	
hgs
parents: 45
diff changeset
   604
	OstTraceFunctionExit0( CALENMONTHVIEW_SHOWHIDEREGIONALINFORMATION_EXIT );
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   605
}
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   606
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   607
/*!
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   608
 Handles the context changed notification
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   609
 */
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   610
void CalenMonthView::onContextChanged()
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   611
{
51
hgs
parents: 45
diff changeset
   612
    OstTraceFunctionEntry0( CALENMONTHVIEW_ONCONTEXTCHANGED_ENTRY );
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   613
	//Update plugin label after setting context
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   614
	if (mCurrRegionalInfo && mPrevRegionalInfo && mNextPaneLayout
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   615
	        && pluginEnabled()) {
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   616
		QString *pluginString = pluginText();
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   617
		mPrevRegionalInfo->setPlainText(*pluginString);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   618
		mCurrRegionalInfo->setPlainText(*pluginString);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   619
		mNextRegionalInfo->setPlainText(*pluginString);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   620
	}
51
hgs
parents: 45
diff changeset
   621
	OstTraceFunctionExit0( CALENMONTHVIEW_ONCONTEXTCHANGED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   622
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   624
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   625
 Calculates the week numbers and sets them to the week labels
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   626
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   627
void CalenMonthView::updateWeekNumGridModel()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   628
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   629
{
51
hgs
parents: 45
diff changeset
   630
    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEWEEKNUMGRIDMODEL_ENTRY );
hgs
parents: 45
diff changeset
   631
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   632
	// Get the visible date
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   633
	QDateTime firstVisibleDate = mFirstDayOfGrid.addDays(KCalenDaysInWeek
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   634
	        * mNumOfRowsInPrevMonth);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   635
	// Go to the last day so that we get the proper week number for the first
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   636
	// week of January
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   637
	mWeekNumbers.clear();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   638
	// get the proper week numbers
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   639
	for (int i = 0; i < KNumOfVisibleRows; i++) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   640
		// Get the week number
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   641
		QDateTime day = firstVisibleDate.addDays((KCalenDaysInWeek * i));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   642
		long weekNumber(day.date().weekNumber());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   643
		mWeekNumbers.append(weekNumber);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   644
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   645
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   646
	// Update the week labels text
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   647
	QString text = QString::number(mWeekNumbers.at(0));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   648
	mFirstWeekLabel->setPlainText(text);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   649
	text = QString::number(mWeekNumbers.at(1));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   650
	mSecondWeekLabel->setPlainText(text);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   651
	text = QString::number(mWeekNumbers.at(2));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   652
	mThirdWeekLabel->setPlainText(text);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   653
	text = QString::number(mWeekNumbers.at(3));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   654
	mFourthWeekLabel->setPlainText(text);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   655
	text = QString::number(mWeekNumbers.at(4));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   656
	mFifthWeekLabel->setPlainText(text);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   657
	text = QString::number(mWeekNumbers.at(5));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   658
	mSixthWeekLabel->setPlainText(text);
51
hgs
parents: 45
diff changeset
   659
	
hgs
parents: 45
diff changeset
   660
	OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEWEEKNUMGRIDMODEL_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   661
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   662
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   663
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   664
 Populates the month view with today as focussed item
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   665
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   666
void CalenMonthView::goToToday()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   667
{
51
hgs
parents: 45
diff changeset
   668
    OstTraceFunctionEntry0( CALENMONTHVIEW_GOTOTODAY_ENTRY );
hgs
parents: 45
diff changeset
   669
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   670
	QDateTime today = CalenDateUtils::today();
45
hgs
parents: 23
diff changeset
   671
	// Set the context and repopulate the view
hgs
parents: 23
diff changeset
   672
    MCalenContext &context = mServices.Context();
hgs
parents: 23
diff changeset
   673
    context.setFocusDateAndTime(today);
hgs
parents: 23
diff changeset
   674
	    
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   675
	// First check if we are not alread
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   676
	// showing today's month view
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   677
	if (mDate == today) {
51
hgs
parents: 45
diff changeset
   678
		OstTraceFunctionExit0( CALENMONTHVIEW_GOTOTODAY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   679
		return;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   680
	} else if (mActiveMonth.date().year() == today.date().year() && 
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   681
				mActiveMonth.date().month() == today.date().month()) {
45
hgs
parents: 23
diff changeset
   682
        mDate = today;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   683
		// User is in current month only, so just set the focus to current
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   684
		// date grid item and refresh the preview pane
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   685
		int currIndex = mFirstDayOfGrid.daysTo(today);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   686
		setCurrGridIndex(currIndex);
45
hgs
parents: 23
diff changeset
   687
		// Populate the preview panes
hgs
parents: 23
diff changeset
   688
		populatePreviewPane(mDate);
hgs
parents: 23
diff changeset
   689
	} else {	
hgs
parents: 23
diff changeset
   690
        refreshViewOnGoToDate();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   691
	}
51
hgs
parents: 45
diff changeset
   692
	
hgs
parents: 45
diff changeset
   693
	OstTraceFunctionExit0( DUP1_CALENMONTHVIEW_GOTOTODAY_EXIT );
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   694
}
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   695
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   696
/*
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   697
 Slot to handle adding / removing actions frm the menu when menu is about to
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   698
 shown to the user
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   699
 */
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   700
void CalenMonthView::addRemoveActionsInMenu()
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   701
{
51
hgs
parents: 45
diff changeset
   702
    OstTraceFunctionEntry0( CALENMONTHVIEW_ADDREMOVEACTIONSINMENU_ENTRY );
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   703
	HbAction* menuAction = mDeleteSubMenu->menuAction();
55
hgs
parents: 51
diff changeset
   704
	if (menuAction) {
hgs
parents: 51
diff changeset
   705
        if (!mEntriesInDataBase && mAgendaUtil->areNoEntriesInCalendar()) {
hgs
parents: 51
diff changeset
   706
            // hide the delete entries option
hgs
parents: 51
diff changeset
   707
            menuAction->setVisible(false);
hgs
parents: 51
diff changeset
   708
        } else {
hgs
parents: 51
diff changeset
   709
            mEntriesInDataBase = true;
hgs
parents: 51
diff changeset
   710
            // Show the option to delete
hgs
parents: 51
diff changeset
   711
            menuAction->setVisible(true);
hgs
parents: 51
diff changeset
   712
        }
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   713
	}
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   714
	
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   715
	// Check if we are population for current day, if yes then disable the
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   716
	// gototoday action
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   717
	if ((CalenDateUtils::today().date() == mDate.date()) && mGoToTodayAction) {
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   718
		mGoToTodayAction->setVisible(false);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   719
	} else if (mGoToTodayAction){
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   720
		mGoToTodayAction->setVisible(true);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   721
	}
51
hgs
parents: 45
diff changeset
   722
	OstTraceFunctionExit0( CALENMONTHVIEW_ADDREMOVEACTIONSINMENU_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   723
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   724
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   725
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   726
 Populates the view
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   727
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   728
void CalenMonthView::doPopulation()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   729
{
51
hgs
parents: 45
diff changeset
   730
    OstTraceFunctionEntry0( CALENMONTHVIEW_DOPOPULATION_ENTRY );
55
hgs
parents: 51
diff changeset
   731
    
45
hgs
parents: 23
diff changeset
   732
 	// Get the layout and add the preview pane layout.
hgs
parents: 23
diff changeset
   733
	QGraphicsLinearLayout* viewLayout = static_cast<QGraphicsLinearLayout *>
hgs
parents: 23
diff changeset
   734
														(widget()->layout());
hgs
parents: 23
diff changeset
   735
	if (viewLayout->count() == 1) {
hgs
parents: 23
diff changeset
   736
		// Count is 1 implies view has only month grid.
hgs
parents: 23
diff changeset
   737
		// Add the preview pane at corresponding position.
hgs
parents: 23
diff changeset
   738
		viewLayout->addItem(mCurrPaneParent);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   739
	}
45
hgs
parents: 23
diff changeset
   740
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   741
	// prepare for the population like reading the date frm the context 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   742
	// calculating the start of the grid etc.,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   743
	prepareForPopulation();
45
hgs
parents: 23
diff changeset
   744
	
hgs
parents: 23
diff changeset
   745
	// Populate the view and preview panes only if we are not opening the calendar
hgs
parents: 23
diff changeset
   746
	if (!mIsFirstTimeLoad) {
hgs
parents: 23
diff changeset
   747
		// fetch list of required calendar instances
hgs
parents: 23
diff changeset
   748
		populateWithInstanceView();
hgs
parents: 23
diff changeset
   749
		// Populate the preview panes
hgs
parents: 23
diff changeset
   750
		populatePreviewPane(mDate);
hgs
parents: 23
diff changeset
   751
	}
hgs
parents: 23
diff changeset
   752
	
hgs
parents: 23
diff changeset
   753
	
hgs
parents: 23
diff changeset
   754
    //update the day label 
hgs
parents: 23
diff changeset
   755
    //if changes in locale setting
hgs
parents: 23
diff changeset
   756
	updateDayLabel();
hgs
parents: 23
diff changeset
   757
	
hgs
parents: 23
diff changeset
   758
	  // Create the grid items with proper dates
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   759
	createGrid();
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   760
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   761
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   762
	// Complete the population
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   763
	completePopulation();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   764
45
hgs
parents: 23
diff changeset
   765
	//set Currect Activity to month view
hgs
parents: 23
diff changeset
   766
	mActivityId = ECalenMonthView;
hgs
parents: 23
diff changeset
   767
	
hgs
parents: 23
diff changeset
   768
	// connect to receive a call back on Month View exit. Call back would result in saveActivity 
hgs
parents: 23
diff changeset
   769
	// to be called in Native View.
hgs
parents: 23
diff changeset
   770
	if (!mIsAboutToQuitEventConnected) // check if not already connected
hgs
parents: 23
diff changeset
   771
	    {
hgs
parents: 23
diff changeset
   772
        connect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity()));
hgs
parents: 23
diff changeset
   773
        mIsAboutToQuitEventConnected = true;
hgs
parents: 23
diff changeset
   774
	    }
hgs
parents: 23
diff changeset
   775
	
hgs
parents: 23
diff changeset
   776
		
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   777
	// Population is complete, inform it
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   778
	populationComplete();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   779
	
45
hgs
parents: 23
diff changeset
   780
	// Handle regional data here if we are not populating the month view for
hgs
parents: 23
diff changeset
   781
	// the first time
hgs
parents: 23
diff changeset
   782
	if (!mIsFirstTimeLoad) {
hgs
parents: 23
diff changeset
   783
		showHideRegionalInformation();
hgs
parents: 23
diff changeset
   784
	}
hgs
parents: 23
diff changeset
   785
	// Reset the first time load flag
hgs
parents: 23
diff changeset
   786
	mIsFirstTimeLoad = false;
51
hgs
parents: 45
diff changeset
   787
	
hgs
parents: 45
diff changeset
   788
	OstTraceFunctionExit0( CALENMONTHVIEW_DOPOPULATION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   789
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   790
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   791
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   792
 Reads the date from the context and calculates the grid item dates
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   793
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   794
void CalenMonthView::prepareForPopulation()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   795
{
51
hgs
parents: 45
diff changeset
   796
    OstTraceFunctionEntry0( CALENMONTHVIEW_PREPAREFORPOPULATION_ENTRY );
hgs
parents: 45
diff changeset
   797
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   798
	setActiveDay(dateFromContext(mServices.Context()));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   799
	setDate();
45
hgs
parents: 23
diff changeset
   800
	updateMonthDataArrayWithActiveDates();
51
hgs
parents: 45
diff changeset
   801
	
hgs
parents: 45
diff changeset
   802
	OstTraceFunctionExit0( CALENMONTHVIEW_PREPAREFORPOPULATION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   803
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   805
/*!
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   806
 Slot to handle gotodate action
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   807
 */
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   808
void CalenMonthView::refreshViewOnGoToDate()
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   809
{
51
hgs
parents: 45
diff changeset
   810
    OstTraceFunctionEntry0( CALENMONTHVIEW_REFRESHVIEWONGOTODATE_ENTRY );
hgs
parents: 45
diff changeset
   811
    
45
hgs
parents: 23
diff changeset
   812
	prepareForPopulation();
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   813
	setDateToLabel();
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   814
	// fetch list of required calendar instances
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   815
	populateWithInstanceView();
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   816
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   817
	populatePreviewPane(mDate);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   818
	
45
hgs
parents: 23
diff changeset
   819
	mMonthGrid->updateMonthGridModel(mMonthDataArray, mIndexToBeScrolled, 
hgs
parents: 23
diff changeset
   820
	                                 mIsFirstTimeLoad);
hgs
parents: 23
diff changeset
   821
	// Update the week Numbers model
hgs
parents: 23
diff changeset
   822
	if (mIsWeekNumbersShown) {
hgs
parents: 23
diff changeset
   823
		updateWeekNumGridModel();
hgs
parents: 23
diff changeset
   824
	}
51
hgs
parents: 45
diff changeset
   825
	
hgs
parents: 45
diff changeset
   826
	OstTraceFunctionExit0( CALENMONTHVIEW_REFRESHVIEWONGOTODATE_EXIT );
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   827
}
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   828
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   829
/*!
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   830
 Reads the date from the context and stores into mDate
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   831
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   832
QDateTime CalenMonthView::dateFromContext(const MCalenContext &context)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   833
{
51
hgs
parents: 45
diff changeset
   834
    OstTraceFunctionEntry0( CALENMONTHVIEW_DATEFROMCONTEXT_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   835
	QDateTime ret;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   836
	if (AgendaEntry::TypeTodo == context.instanceId().mType) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   837
		QDateTime today = CalenDateUtils::today();
45
hgs
parents: 23
diff changeset
   838
		if (context.focusDateAndTime() < today) {
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   839
			ret = today;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   840
		} else {
45
hgs
parents: 23
diff changeset
   841
			ret = context.focusDateAndTime();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   842
		}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   843
	} else {
45
hgs
parents: 23
diff changeset
   844
		ret = context.focusDateAndTime();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   845
	}
51
hgs
parents: 45
diff changeset
   846
	OstTraceFunctionExit0( CALENMONTHVIEW_DATEFROMCONTEXT_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   847
	return ret;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   848
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   849
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   850
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   851
 Calculates the necesary parameters of the month view w.r.t mDate
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   852
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   853
void CalenMonthView::setActiveDay(QDateTime day)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   854
{
51
hgs
parents: 45
diff changeset
   855
    OstTraceFunctionEntry0( CALENMONTHVIEW_SETACTIVEDAY_ENTRY );
hgs
parents: 45
diff changeset
   856
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   857
	mDate = day;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   858
    
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   859
	mActiveMonth = mDate;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   860
	// Get the first day of the previous month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   861
	QDateTime prevMonthDate = mDate.addMonths(-1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   862
	int prevMonth = prevMonthDate.date().month();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   863
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   864
	// Get the first day of the month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   865
	QDate date = prevMonthDate.date();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   866
	date.setDate(date.year(), date.month(), 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   867
	QDateTime firstDayOfPrevMonth(date, day.time());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   868
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   869
	int offset(firstDayOfPrevMonth.date().dayOfWeek() - (mLocale.startOfWeek()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   870
	        + 1));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   871
	if (offset < 0) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   872
		offset += KCalenDaysInWeek;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   873
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   874
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   875
	// Substract the offset days
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   876
	mFirstDayOfGrid = firstDayOfPrevMonth.addDays(-offset);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   877
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   878
	// Calculate the number of weeks in the previous month that will be hidden
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   879
	mNumOfRowsInPrevMonth = offset + prevMonthDate.date().daysInMonth();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   880
	mNumOfRowsInPrevMonth = (mNumOfRowsInPrevMonth / KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   881
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   882
	// Index to be scrolled is the last day of the visible grid item
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   883
	mIndexToBeScrolled = ((mNumOfRowsInPrevMonth + KNumOfVisibleRows)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   884
	        * KCalenDaysInWeek) - 1;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   885
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   886
	// Now add the future month days to the count. While doing that, we need to
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   887
	// calcualte the count till the end of the week in which the month ends
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   888
	QDateTime futureMonthDate = mDate.addMonths(1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   889
	// Get the first day of the future month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   890
	date = futureMonthDate.date();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   891
	date.setDate(date.year(), date.month(), 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   892
	QDateTime firstDayOfFutMonth(date, day.time());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   893
	offset = firstDayOfFutMonth.date().dayOfWeek() - (mLocale.startOfWeek() + 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   894
	if (offset < 0) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   895
		offset += KCalenDaysInWeek;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   896
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   897
	// Substract the firstDayNoInWeek days
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   898
	QDateTime dateTime = firstDayOfFutMonth.addDays(-offset);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   899
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   900
	// Need to add 42 days for dateTime so that it fits into the visible grid
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   901
	mLastDayOfGrid = dateTime.addDays(KNumOfVisibleRows * KCalenDaysInWeek - 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   902
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   903
	// calculate the total numbers of dates that needs to be populated from 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   904
	// previous month to future month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   905
	mTotalNumOfGridItems = mFirstDayOfGrid.daysTo(mLastDayOfGrid) + 1;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   906
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   907
	// Calculate the last visible day
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   908
	int index = (mNumOfRowsInPrevMonth + KNumOfVisibleRows) * KCalenDaysInWeek;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   909
	QDateTime lastVisibleDate = mFirstDayOfGrid.addDays(index - 1);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   910
	QDateTime dateTimeToCalc = mLastDayOfGrid;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   911
	mNumOfRowsInFutureMonth = 0;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   912
	while (dateTimeToCalc > lastVisibleDate) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   913
		mNumOfRowsInFutureMonth++;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   914
		dateTimeToCalc = dateTimeToCalc.addDays(-KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   915
	}
51
hgs
parents: 45
diff changeset
   916
	
hgs
parents: 45
diff changeset
   917
	OstTraceFunctionExit0( CALENMONTHVIEW_SETACTIVEDAY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   918
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   919
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   920
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   921
 Calculates the dates that needs to be set to mMonthDataArray
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   922
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   923
void CalenMonthView::setDate()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   924
{
51
hgs
parents: 45
diff changeset
   925
    OstTraceFunctionEntry0( CALENMONTHVIEW_SETDATE_ENTRY );
hgs
parents: 45
diff changeset
   926
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   927
	mMonthDataArray.clear();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   928
	// Calculate the actual number of dates to be populated from previous month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   929
	// to future month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   930
	for (int i(0); i < mTotalNumOfGridItems; ++i) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   931
		QDateTime currentDay = CalenDateUtils::futureOf(mFirstDayOfGrid, i);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   932
		CalenMonthData element(currentDay);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   933
		mMonthDataArray.append(element);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   934
	}
51
hgs
parents: 45
diff changeset
   935
	
hgs
parents: 45
diff changeset
   936
	OstTraceFunctionExit0( CALENMONTHVIEW_SETDATE_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   937
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   938
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   939
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   940
 Returns the active day(currently focussed day)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   941
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   942
QDateTime CalenMonthView::getActiveDay()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   943
{
51
hgs
parents: 45
diff changeset
   944
    OstTraceFunctionEntry0( CALENMONTHVIEW_GETACTIVEDAY_ENTRY );
hgs
parents: 45
diff changeset
   945
    
hgs
parents: 45
diff changeset
   946
	OstTraceFunctionExit0( CALENMONTHVIEW_GETACTIVEDAY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   947
	return mDate;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   948
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   949
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   950
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   951
 Returns the array of CalenMonthData items
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   952
 */
55
hgs
parents: 51
diff changeset
   953
QList<CalenMonthData>& CalenMonthView::monthDataList()
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   954
{
51
hgs
parents: 45
diff changeset
   955
    OstTraceFunctionEntry0( CALENMONTHVIEW_MONTHDATALIST_ENTRY );
hgs
parents: 45
diff changeset
   956
    
hgs
parents: 45
diff changeset
   957
	OstTraceFunctionExit0( CALENMONTHVIEW_MONTHDATALIST_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   958
	return mMonthDataArray;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   959
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   960
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   961
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   962
 Creates the grid and adds the week numbers depending on the week number setting
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   963
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   964
void CalenMonthView::createGrid()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   965
{
51
hgs
parents: 45
diff changeset
   966
    OstTraceFunctionEntry0( CALENMONTHVIEW_CREATEGRID_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   967
	// Update the month grid
45
hgs
parents: 23
diff changeset
   968
	mMonthGrid->updateMonthGridModel(mMonthDataArray, mIndexToBeScrolled, 
hgs
parents: 23
diff changeset
   969
	                                 mIsFirstTimeLoad);
hgs
parents: 23
diff changeset
   970
    // Get start of week from the locale.
hgs
parents: 23
diff changeset
   971
    HbExtendedLocale locale = HbExtendedLocale::system();
hgs
parents: 23
diff changeset
   972
    int startOfWeek = locale.startOfWeek();
hgs
parents: 23
diff changeset
   973
    if(startOfWeek != HbExtendedLocale::Monday)
hgs
parents: 23
diff changeset
   974
        {
hgs
parents: 23
diff changeset
   975
        //if the start of week is other than Monday, don't show the week number
hgs
parents: 23
diff changeset
   976
        mIsWeekNumbersShown = 0;
hgs
parents: 23
diff changeset
   977
        }
hgs
parents: 23
diff changeset
   978
    else
hgs
parents: 23
diff changeset
   979
        {
hgs
parents: 23
diff changeset
   980
        // Read the week number setting from cenrep
hgs
parents: 23
diff changeset
   981
        QVariant value = mSettingsManager->readItemValue(*mWeekNumberCenrepKey);
hgs
parents: 23
diff changeset
   982
        mIsWeekNumbersShown = value.toUInt();
hgs
parents: 23
diff changeset
   983
        }
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   984
	if (mIsWeekNumbersShown) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   985
		// Add week numbers to week grid
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   986
		addWeekNumbers();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   987
	} else {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   988
		// remove the weeknumbergrid from the layout
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   989
		removeWeekNumbers();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   990
	}
51
hgs
parents: 45
diff changeset
   991
	OstTraceFunctionExit0( CALENMONTHVIEW_CREATEGRID_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   992
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   993
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   994
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   995
 Called when down gesture is performed
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   996
 Caluclates the necessary dates for the new previous month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   997
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   998
void CalenMonthView::updateModelWithPrevMonth()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   999
{
51
hgs
parents: 45
diff changeset
  1000
    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEMODELWITHPREVMONTH_ENTRY );
hgs
parents: 45
diff changeset
  1001
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1002
	// Get the new previous month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1003
	QDateTime prevMonthDateTime = mActiveMonth.addMonths(-1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1004
	QDateTime dateTime = mFirstDayOfGrid;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1005
	if (prevMonthDateTime.date().month() == mFirstDayOfGrid.date().month()) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1006
		//  Month starts right on Monday(Start of the week), 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1007
		//hence go back to previous month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1008
		dateTime = mFirstDayOfGrid.addMonths(-1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1009
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1010
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1011
	int prevMonth = dateTime.date().month();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1012
	QDateTime prevFirstDayOfGrid = mFirstDayOfGrid;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1013
	for (int i = 0; i < KNumOfVisibleRows; i++) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1014
		mFirstDayOfGrid = mFirstDayOfGrid.addDays(-KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1015
		if (mFirstDayOfGrid.date().month() == prevMonth) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1016
			continue;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1017
		} else {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1018
			// Entered to another month, stop here
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1019
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1020
		}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1021
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1022
	// Readjust the mFirstDayOfGrid
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1023
	if (mFirstDayOfGrid.addDays(KCalenDaysInWeek - 1).date().month()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1024
	        != prevMonth) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1025
		mFirstDayOfGrid = mFirstDayOfGrid.addDays(KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1026
	}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1027
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1028
	// Calculate the new days to be added
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1029
	int countToBeAdded = mFirstDayOfGrid.daysTo(prevFirstDayOfGrid);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1030
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1031
	// Remove the bottom month entries in mMonthDataArray
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1032
	int countToBeDeleted = mNumOfRowsInFutureMonth * KCalenDaysInWeek;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1033
	int count = mMonthDataArray.count() - 1;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1034
	for (int i = 0; i < countToBeDeleted; i++) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1035
		mMonthDataArray.removeAt(count--);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1036
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1037
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1038
	// Update the total number of grid items as we will be removing the month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1039
	// at the below
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1040
	mTotalNumOfGridItems -= countToBeDeleted;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1041
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1042
	// Prepend countToBeAdded new items to mMonthDataArray
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1043
	for (int i = 0; i < countToBeAdded; i++) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1044
		QDateTime currentDay = mFirstDayOfGrid.addDays(i);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1045
		CalenMonthData element(currentDay);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1046
		mMonthDataArray.insert(i, element);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1047
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1048
	mTotalNumOfGridItems += countToBeAdded;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1049
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1050
	// Update the mMonthDataArray with instances if any
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1051
	populatePrevMonth();
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1052
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1053
	// Update the necessary globals
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1054
	mActiveMonth = mActiveMonth.addMonths(-1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1055
	mNumOfRowsInPrevMonth = (countToBeAdded / KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1056
	mLastDayOfGrid = mFirstDayOfGrid.addDays(mTotalNumOfGridItems - 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1057
	// Calculate the last visible day
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1058
	int index = (mNumOfRowsInPrevMonth + KNumOfVisibleRows) * KCalenDaysInWeek;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1059
	QDateTime lastVisibleDate = mFirstDayOfGrid.addDays(index - 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1060
	QDateTime date = mLastDayOfGrid;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1061
	mNumOfRowsInFutureMonth = 0;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1062
	while (date > lastVisibleDate) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1063
		mNumOfRowsInFutureMonth++;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1064
		date = date.addDays(-KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1065
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1066
	// Update the week Numbers model
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1067
	if (mIsWeekNumbersShown) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1068
		updateWeekNumGridModel();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1069
	}
51
hgs
parents: 45
diff changeset
  1070
	
hgs
parents: 45
diff changeset
  1071
	OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEMODELWITHPREVMONTH_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1072
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1073
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1074
 Called when up gesture is performed
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1075
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1076
void CalenMonthView::updateModelWithFutureMonth()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1077
{
51
hgs
parents: 45
diff changeset
  1078
    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEMODELWITHFUTUREMONTH_ENTRY );
hgs
parents: 45
diff changeset
  1079
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1080
	// Get the new future month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1081
	QDateTime previousLastDayOfGrid = mLastDayOfGrid;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1082
	QDateTime futureMonthDateTime = mActiveMonth.addMonths(2);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1083
	QDate date = futureMonthDateTime.date();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1084
	date.setDate(date.year(), date.month(), 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1085
	// Get the first day of the future month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1086
	QDateTime firstDayOfFutMonth(date, futureMonthDateTime.time());
45
hgs
parents: 23
diff changeset
  1087
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1088
	int offset = firstDayOfFutMonth.date().dayOfWeek() - (mLocale.startOfWeek()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1089
	        + 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1090
	if (offset < 0) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1091
		offset += KCalenDaysInWeek;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1092
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1093
	// Substract the firstDayNoInWeek days
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1094
	QDateTime dateTime = firstDayOfFutMonth.addDays(-offset);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1095
	// Need to add 42 days for dateTime
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1096
	mLastDayOfGrid = dateTime.addDays(KNumOfVisibleRows * KCalenDaysInWeek - 1);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1097
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1098
	// Remove the first mNumOfRowsInPrevMonth rows in mMonthDataArray
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1099
	int countToBeDeleted = mNumOfRowsInPrevMonth * KCalenDaysInWeek;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1100
	for (int i = 0; i < countToBeDeleted; i++) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1101
		mMonthDataArray.removeAt(0);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1102
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1103
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1104
	// Update the total number of grid items as we will be removing the month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1105
	// at the top
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1106
	mTotalNumOfGridItems -= countToBeDeleted;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1107
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1108
	// Calcualate the num fo days to be added
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1109
	int countToBeAdded = previousLastDayOfGrid.daysTo(mLastDayOfGrid);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1110
	// Append countToBeAdded new items to mMonthDataArray
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1111
	for (int i = 1; i <= countToBeAdded; i++) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1112
		QDateTime currentDay = previousLastDayOfGrid.addDays(i);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1113
		CalenMonthData element(currentDay);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1114
		mMonthDataArray.append(element);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1115
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1116
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1117
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1118
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1119
	// Update the necessary globals
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1120
	mTotalNumOfGridItems += countToBeAdded;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1121
	mActiveMonth = mActiveMonth.addMonths(1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1122
	mNumOfRowsInFutureMonth = (countToBeAdded / KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1123
	mFirstDayOfGrid = mLastDayOfGrid.addDays(-(mTotalNumOfGridItems - 1));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1124
	// Calculate the first visible date
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1125
	int index = mTotalNumOfGridItems - ((mNumOfRowsInFutureMonth
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1126
	        + KNumOfVisibleRows) * KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1127
	QDateTime firstVisibleDate = mFirstDayOfGrid.addDays(index - 1);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1128
	QDateTime dateTimeToCalc = mFirstDayOfGrid;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1129
	mNumOfRowsInPrevMonth = 0;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1130
	while (dateTimeToCalc < firstVisibleDate) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1131
		mNumOfRowsInPrevMonth++;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1132
		dateTimeToCalc = dateTimeToCalc.addDays(KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1133
	}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1134
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1135
	// Update the week Numbers model
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1136
	if (mIsWeekNumbersShown) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1137
		updateWeekNumGridModel();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1138
	}
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1139
	
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1140
	// Update the mMonthDataArray with instances if any
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1141
	populateNextMonth();
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1142
		
51
hgs
parents: 45
diff changeset
  1143
	OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEMODELWITHFUTUREMONTH_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1144
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1145
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1146
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1147
 Returns the numner of rows in previous month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1148
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1149
int CalenMonthView::rowsInPrevMonth()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1150
{
51
hgs
parents: 45
diff changeset
  1151
    OstTraceFunctionEntry0( CALENMONTHVIEW_ROWSINPREVMONTH_ENTRY );
hgs
parents: 45
diff changeset
  1152
    
hgs
parents: 45
diff changeset
  1153
	OstTraceFunctionExit0( CALENMONTHVIEW_ROWSINPREVMONTH_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1154
	return mNumOfRowsInPrevMonth;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1155
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1156
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1157
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1158
 Returns the number of rows in future month
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1159
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1160
int CalenMonthView::rowsInFutMonth()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1161
{
51
hgs
parents: 45
diff changeset
  1162
    OstTraceFunctionEntry0( CALENMONTHVIEW_ROWSINFUTMONTH_ENTRY );
hgs
parents: 45
diff changeset
  1163
    
hgs
parents: 45
diff changeset
  1164
	OstTraceFunctionExit0( CALENMONTHVIEW_ROWSINFUTMONTH_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1165
	return mNumOfRowsInFutureMonth;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1166
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1167
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1168
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1169
 Returns current Grid index
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1170
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1171
int CalenMonthView::getCurrGridIndex()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1172
{
51
hgs
parents: 45
diff changeset
  1173
    OstTraceFunctionEntry0( CALENMONTHVIEW_GETCURRGRIDINDEX_ENTRY );
hgs
parents: 45
diff changeset
  1174
    
hgs
parents: 45
diff changeset
  1175
    OstTraceFunctionExit0( CALENMONTHVIEW_GETCURRGRIDINDEX_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1176
	return mMonthGrid->getCurrentIndex();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1177
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1178
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1179
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1180
 Set the currend Index of the Grid
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1181
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1182
void CalenMonthView::setCurrGridIndex(int index)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1183
{
51
hgs
parents: 45
diff changeset
  1184
    OstTraceFunctionEntry0( CALENMONTHVIEW_SETCURRGRIDINDEX_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1185
	mIsPrevPaneGesture = true;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1186
	mMonthGrid->setCurrentIdex(index);
51
hgs
parents: 45
diff changeset
  1187
	OstTraceFunctionExit0( CALENMONTHVIEW_SETCURRGRIDINDEX_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1188
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1189
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1190
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1191
 Sets the active flag to the required dates in the array
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1192
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1193
void CalenMonthView::updateMonthDataArrayWithActiveDates()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1194
{
51
hgs
parents: 45
diff changeset
  1195
    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEMONTHDATAARRAYWITHACTIVEDATES_ENTRY );
hgs
parents: 45
diff changeset
  1196
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1197
	int activeMonth = mActiveMonth.date().month();
45
hgs
parents: 23
diff changeset
  1198
	int monthDataCount = mMonthDataArray.count();
hgs
parents: 23
diff changeset
  1199
	for (int i = 0; i < monthDataCount; i++) {
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1200
		if (mMonthDataArray[i].Day().date().month() == activeMonth) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1201
			// Set the active flag
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1202
			mMonthDataArray[i].setActive(true);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1203
		} else {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1204
			// Disable the active flag
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1205
			mMonthDataArray[i].setActive(false);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1206
		}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1207
	}
51
hgs
parents: 45
diff changeset
  1208
	
hgs
parents: 45
diff changeset
  1209
	OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEMONTHDATAARRAYWITHACTIVEDATES_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1210
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1211
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1212
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1213
 Fetches the calenda entries for a given range
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1214
 */
45
hgs
parents: 23
diff changeset
  1215
void CalenMonthView::getInstanceList(QList<QDate> &list,
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1216
                                     QDateTime rangeStart, QDateTime rangeEnd)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1217
{
51
hgs
parents: 45
diff changeset
  1218
    OstTraceFunctionEntry0( CALENMONTHVIEW_GETINSTANCELIST_ENTRY );
hgs
parents: 45
diff changeset
  1219
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1220
	AgendaUtil::FilterFlags filter =
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1221
	        AgendaUtil::FilterFlags(AgendaUtil::IncludeAnniversaries
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1222
	                | AgendaUtil::IncludeAppointments
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1223
	                | AgendaUtil::IncludeEvents
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1224
	                | AgendaUtil::IncludeReminders
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1225
	                | AgendaUtil::IncludeIncompletedTodos);
45
hgs
parents: 23
diff changeset
  1226
	mAgendaUtil->markDatesWithEvents(rangeStart, rangeEnd, filter, list);
51
hgs
parents: 45
diff changeset
  1227
	
hgs
parents: 45
diff changeset
  1228
	OstTraceFunctionExit0( CALENMONTHVIEW_GETINSTANCELIST_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1229
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1230
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1231
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1232
 Parses the fetched entries and sets hasEvent attribute for necessary days
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1233
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1234
void CalenMonthView::populateWithInstanceView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1235
{
51
hgs
parents: 45
diff changeset
  1236
    OstTraceFunctionEntry0( CALENMONTHVIEW_POPULATEWITHINSTANCEVIEW_ENTRY );
hgs
parents: 45
diff changeset
  1237
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1238
	const QDateTime today(CalenDateUtils::today());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1239
	const QDateTime gridStart(CalenDateUtils::beginningOfDay(mFirstDayOfGrid));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1240
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1241
	// grid index for "today"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1242
	const int todayIndex(gridStart.daysTo(today)); 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1243
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1244
	QDateTime gridEnd(mLastDayOfGrid.date(), QTime(23, 59, 59, 0));
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1245
	
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1246
	// Get the list of dates which have events
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1247
	QList<QDate> datesWithEvents;
45
hgs
parents: 23
diff changeset
  1248
	getInstanceList(datesWithEvents,gridStart,gridEnd);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1249
	
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1250
	// Parse thru the list of dates and set the required flags
45
hgs
parents: 23
diff changeset
  1251
	int datesEventsCount = datesWithEvents.count();
hgs
parents: 23
diff changeset
  1252
	for(int i(0); i < datesEventsCount; i++) {
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1253
		int offset = mFirstDayOfGrid.date().daysTo(datesWithEvents.at(i));
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1254
		mMonthDataArray[offset].SetHasEvents(true);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1255
	}
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1256
	datesWithEvents.clear();
51
hgs
parents: 45
diff changeset
  1257
	
55
hgs
parents: 51
diff changeset
  1258
	if (datesEventsCount) {
hgs
parents: 51
diff changeset
  1259
        mEntriesInDataBase = true;
hgs
parents: 51
diff changeset
  1260
	}
hgs
parents: 51
diff changeset
  1261
	
51
hgs
parents: 45
diff changeset
  1262
	OstTraceFunctionExit0( CALENMONTHVIEW_POPULATEWITHINSTANCEVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1263
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1264
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1265
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1266
 Parses the fetched entries for previous month and 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1267
 sets hasEvent attribute for necessary days
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1268
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1269
void CalenMonthView::populatePrevMonth()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1270
{
51
hgs
parents: 45
diff changeset
  1271
    OstTraceFunctionEntry0( CALENMONTHVIEW_POPULATEPREVMONTH_ENTRY );
hgs
parents: 45
diff changeset
  1272
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1273
	const QDateTime gridStart(CalenDateUtils::beginningOfDay(mFirstDayOfGrid));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1274
	const QDateTime today(CalenDateUtils::today());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1275
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1276
	const int todayIndex(gridStart.daysTo(today)); // grid index for "today"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1277
	QDateTime end = gridStart.addDays(mNumOfRowsInPrevMonth * KCalenDaysInWeek);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1278
	QDateTime gridEnd(end.date(), QTime(23, 59, 59, 0));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1279
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1280
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1281
	// Get the list of dates which have events
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1282
	QList<QDate> datesWithEvents;
45
hgs
parents: 23
diff changeset
  1283
	getInstanceList(datesWithEvents,gridStart,gridEnd);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1284
	
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1285
	// Parse thru the list of dates and set the required flags
45
hgs
parents: 23
diff changeset
  1286
	int datesEventsCount = datesWithEvents.count();
hgs
parents: 23
diff changeset
  1287
	for(int i(0); i < datesEventsCount; i++) {
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1288
		int offset = mFirstDayOfGrid.date().daysTo(datesWithEvents.at(i));
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1289
		mMonthDataArray[offset].SetHasEvents(true);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1290
	}
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1291
	datesWithEvents.clear();
51
hgs
parents: 45
diff changeset
  1292
	
55
hgs
parents: 51
diff changeset
  1293
	if (datesEventsCount) {
hgs
parents: 51
diff changeset
  1294
        mEntriesInDataBase = true;
hgs
parents: 51
diff changeset
  1295
    }
hgs
parents: 51
diff changeset
  1296
	
51
hgs
parents: 45
diff changeset
  1297
	OstTraceFunctionExit0( CALENMONTHVIEW_POPULATEPREVMONTH_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1298
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1299
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1300
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1301
 Parses the fetched entries for future month and 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1302
 sets hasEvent attribute for necessary days
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1303
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1304
void CalenMonthView::populateNextMonth()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1305
{
51
hgs
parents: 45
diff changeset
  1306
    OstTraceFunctionEntry0( CALENMONTHVIEW_POPULATENEXTMONTH_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1307
	QList<AgendaEntry> list;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1308
	int actualIndex = mNumOfRowsInFutureMonth * KCalenDaysInWeek;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1309
	const QDateTime gridStart(mLastDayOfGrid.addDays(-actualIndex));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1310
	actualIndex = mMonthDataArray.count() - actualIndex -1;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1311
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1312
	const QDateTime today(CalenDateUtils::today());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1313
	const int todayIndex(gridStart.daysTo(today)); // grid index for "today"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1314
	QDateTime gridEnd(mLastDayOfGrid.date(), QTime(23, 59, 59, 0));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1315
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1316
	// Get the list of dates which have events
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1317
	QList<QDate> datesWithEvents;
45
hgs
parents: 23
diff changeset
  1318
	getInstanceList(datesWithEvents,gridStart,gridEnd);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1319
	
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1320
	// Parse thru the list of dates and set the required flags
45
hgs
parents: 23
diff changeset
  1321
	int datesEventsCount = datesWithEvents.count();
hgs
parents: 23
diff changeset
  1322
	for(int i(0); i < datesEventsCount; i++) {
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1323
		int offset = mFirstDayOfGrid.date().daysTo(datesWithEvents.at(i));
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1324
		mMonthDataArray[offset].SetHasEvents(true);
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1325
	}
45
hgs
parents: 23
diff changeset
  1326
	datesWithEvents.clear();
55
hgs
parents: 51
diff changeset
  1327
	
hgs
parents: 51
diff changeset
  1328
	if (datesEventsCount) {
hgs
parents: 51
diff changeset
  1329
        mEntriesInDataBase = true;
hgs
parents: 51
diff changeset
  1330
    }
51
hgs
parents: 45
diff changeset
  1331
	OstTraceFunctionExit0( CALENMONTHVIEW_POPULATENEXTMONTH_EXIT );
45
hgs
parents: 23
diff changeset
  1332
}
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1333
45
hgs
parents: 23
diff changeset
  1334
/*!
hgs
parents: 23
diff changeset
  1335
	Function that gets called when instacne view is created, so that it can
hgs
parents: 23
diff changeset
  1336
	query agenda server for any entries
hgs
parents: 23
diff changeset
  1337
 */
hgs
parents: 23
diff changeset
  1338
void CalenMonthView::fetchEntriesAndUpdateModel()
hgs
parents: 23
diff changeset
  1339
{
51
hgs
parents: 45
diff changeset
  1340
    OstTraceFunctionEntry0( CALENMONTHVIEW_FETCHENTRIESANDUPDATEMODEL_ENTRY );
hgs
parents: 45
diff changeset
  1341
    
45
hgs
parents: 23
diff changeset
  1342
	// Get to know if entries are there from the agenda server
hgs
parents: 23
diff changeset
  1343
	populateWithInstanceView();
hgs
parents: 23
diff changeset
  1344
	// Update the month grid model
hgs
parents: 23
diff changeset
  1345
	mMonthGrid->updateMonthGridWithEventIndicators(mMonthDataArray);
hgs
parents: 23
diff changeset
  1346
	// Populate the preview panes
hgs
parents: 23
diff changeset
  1347
	populatePreviewPane(mDate);
51
hgs
parents: 45
diff changeset
  1348
	
hgs
parents: 45
diff changeset
  1349
	OstTraceFunctionExit0( CALENMONTHVIEW_FETCHENTRIESANDUPDATEMODEL_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1350
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1351
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1352
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1353
 Populates the preview pane
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1354
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1355
void CalenMonthView::populatePreviewPane(QDateTime &dateTime)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1356
{
51
hgs
parents: 45
diff changeset
  1357
    OstTraceFunctionEntry0( CALENMONTHVIEW_POPULATEPREVIEWPANE_ENTRY );
hgs
parents: 45
diff changeset
  1358
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1359
	mPrevPreviewPane->populateLabel(dateTime.addDays(-1));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1360
	mCurrPreviewPane->populateLabel(dateTime);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1361
	mNextPreviewPane->populateLabel(dateTime.addDays(1));
45
hgs
parents: 23
diff changeset
  1362
	
hgs
parents: 23
diff changeset
  1363
	// Start the auto scroll on current preview pane
hgs
parents: 23
diff changeset
  1364
    mCurrPreviewPane->startAutoScroll();
51
hgs
parents: 45
diff changeset
  1365
    
hgs
parents: 45
diff changeset
  1366
    OstTraceFunctionExit0( CALENMONTHVIEW_POPULATEPREVIEWPANE_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1367
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1368
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1369
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1370
 Completes the population after setting the view as 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1371
 current view to the main window
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1372
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1373
void CalenMonthView::completePopulation()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1374
{
51
hgs
parents: 45
diff changeset
  1375
    OstTraceFunctionEntry0( CALENMONTHVIEW_COMPLETEPOPULATION_ENTRY );
hgs
parents: 45
diff changeset
  1376
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1377
	setDateToLabel();
51
hgs
parents: 45
diff changeset
  1378
	
hgs
parents: 45
diff changeset
  1379
	OstTraceFunctionExit0( CALENMONTHVIEW_COMPLETEPOPULATION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1380
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1381
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1382
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1383
 Launches the day view on tapping of the grid item
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1384
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1385
void CalenMonthView::handleGridItemActivated()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1386
{
51
hgs
parents: 45
diff changeset
  1387
    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLEGRIDITEMACTIVATED_ENTRY );
hgs
parents: 45
diff changeset
  1388
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1389
	mServices.IssueCommandL(ECalenDayView);
51
hgs
parents: 45
diff changeset
  1390
	
hgs
parents: 45
diff changeset
  1391
	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLEGRIDITEMACTIVATED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1392
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1393
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1394
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1395
 Sets the context w.r.t to the active day
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1396
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1397
void CalenMonthView::setContextForActiveDay(int index)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1398
{
51
hgs
parents: 45
diff changeset
  1399
    OstTraceFunctionEntry0( CALENMONTHVIEW_SETCONTEXTFORACTIVEDAY_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1400
	QDateTime newActiveDay = mFirstDayOfGrid.addDays(index);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1401
	// Set the context
45
hgs
parents: 23
diff changeset
  1402
	mServices.Context().setFocusDate(newActiveDay);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1403
	mDate = newActiveDay;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1404
	setDateToLabel();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1405
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1406
	if(!mIsPrevPaneGesture) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1407
		populatePreviewPane(mDate);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1408
	} else {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1409
		// reset flag
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1410
		mIsPrevPaneGesture = false;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1411
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1412
	
51
hgs
parents: 45
diff changeset
  1413
	OstTraceFunctionExit0( CALENMONTHVIEW_SETCONTEXTFORACTIVEDAY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1414
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1415
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1416
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1417
 Slot to launch the event editor
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1418
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1419
void CalenMonthView::createEditor()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1420
{
51
hgs
parents: 45
diff changeset
  1421
	OstTraceFunctionEntry0( CALENMONTHVIEW_CREATEEDITOR_ENTRY );
hgs
parents: 45
diff changeset
  1422
	
hgs
parents: 45
diff changeset
  1423
    captureScreenshot(true);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1424
	mServices.IssueCommandL(ECalenNewMeeting);
51
hgs
parents: 45
diff changeset
  1425
	
hgs
parents: 45
diff changeset
  1426
	OstTraceFunctionExit0( CALENMONTHVIEW_CREATEEDITOR_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1427
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1428
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1429
/*!
45
hgs
parents: 23
diff changeset
  1430
 Slot to launch the Day view
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1431
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1432
void CalenMonthView::launchDayView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1433
{
51
hgs
parents: 45
diff changeset
  1434
    OstTraceFunctionEntry0( CALENMONTHVIEW_LAUNCHDAYVIEW_ENTRY );
hgs
parents: 45
diff changeset
  1435
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1436
	mServices.IssueCommandL(ECalenDayView);
81
hgs
parents: 75
diff changeset
  1437
	// day view launched now, captre the screen shot of month view 
hgs
parents: 75
diff changeset
  1438
    captureScreenshot(true);
hgs
parents: 75
diff changeset
  1439
  
hgs
parents: 75
diff changeset
  1440
    OstTraceFunctionExit0( CALENMONTHVIEW_LAUNCHDAYVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1441
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1442
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1443
/*!
63
hgs
parents: 57
diff changeset
  1444
disconnects for the aboutToQuit events
hgs
parents: 57
diff changeset
  1445
 */
hgs
parents: 57
diff changeset
  1446
void CalenMonthView::disconnectAboutToQuitEvent()
hgs
parents: 57
diff changeset
  1447
{
hgs
parents: 57
diff changeset
  1448
	OstTraceFunctionEntry0( CALENMONTHVIEW_DISCONNECTABOUTTOQUITEVENT_ENTRY );
hgs
parents: 57
diff changeset
  1449
	
hgs
parents: 57
diff changeset
  1450
	if (mIsAboutToQuitEventConnected) {
hgs
parents: 57
diff changeset
  1451
		disconnect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity()));
hgs
parents: 57
diff changeset
  1452
		mIsAboutToQuitEventConnected = false;
hgs
parents: 57
diff changeset
  1453
	}
hgs
parents: 57
diff changeset
  1454
	
hgs
parents: 57
diff changeset
  1455
	OstTraceFunctionExit0( CALENMONTHVIEW_DISCONNECTABOUTTOQUITEVENT_EXIT );
hgs
parents: 57
diff changeset
  1456
}
hgs
parents: 57
diff changeset
  1457
hgs
parents: 57
diff changeset
  1458
/*!
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1459
 Slot to handle the change in orientation
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1460
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1461
void CalenMonthView::changeOrientation(Qt::Orientation orientation)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1462
{
51
hgs
parents: 45
diff changeset
  1463
    OstTraceFunctionEntry0( CALENMONTHVIEW_CHANGEORIENTATION_ENTRY );
hgs
parents: 45
diff changeset
  1464
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1465
		if (mOrientation != orientation) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1466
			// change the orientation here
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1467
			mOrientation = orientation;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1468
			handleChangeOrientation();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1469
		}
51
hgs
parents: 45
diff changeset
  1470
		
hgs
parents: 45
diff changeset
  1471
	OstTraceFunctionExit0( CALENMONTHVIEW_CHANGEORIENTATION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1472
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1473
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1474
/*!
63
hgs
parents: 57
diff changeset
  1475
 Slot to handle the change in theme
hgs
parents: 57
diff changeset
  1476
 */
hgs
parents: 57
diff changeset
  1477
void CalenMonthView::handleThemeChange()
hgs
parents: 57
diff changeset
  1478
{
hgs
parents: 57
diff changeset
  1479
    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLETHEMECHANGE_ENTRY );
hgs
parents: 57
diff changeset
  1480
    
hgs
parents: 57
diff changeset
  1481
    // Refresh the month view when the theme change happens
hgs
parents: 57
diff changeset
  1482
    mWeekDaysColor = HbColorScheme::color("qtc_cal_week_day");
hgs
parents: 57
diff changeset
  1483
    QColor monthTitleColor = HbColorScheme::color("qtc_cal_monthgrid_title");
hgs
parents: 57
diff changeset
  1484
    
hgs
parents: 57
diff changeset
  1485
    if (mTitleLabel && monthTitleColor.isValid()) {
hgs
parents: 57
diff changeset
  1486
		mTitleLabel->setTextColor(monthTitleColor);
hgs
parents: 57
diff changeset
  1487
	}
hgs
parents: 57
diff changeset
  1488
    
hgs
parents: 57
diff changeset
  1489
    mPreviewHeadingColor = HbColorScheme::color("qtc_cal_day_preview_heading");
hgs
parents: 57
diff changeset
  1490
    
hgs
parents: 57
diff changeset
  1491
    mServices.IssueCommandL(ECalenStartActiveStep);
hgs
parents: 57
diff changeset
  1492
    
hgs
parents: 57
diff changeset
  1493
    OstTraceFunctionExit0( CALENMONTHVIEW_HANDLETHEMECHANGE_EXIT );
hgs
parents: 57
diff changeset
  1494
}
hgs
parents: 57
diff changeset
  1495
hgs
parents: 57
diff changeset
  1496
/*!
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1497
 Loads appropriate section from the docml dsepending on the current orientation
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1498
 of the device
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1499
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1500
void CalenMonthView::handleChangeOrientation()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1501
{
51
hgs
parents: 45
diff changeset
  1502
    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLECHANGEORIENTATION_ENTRY );
hgs
parents: 45
diff changeset
  1503
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1504
	bool loadSuccess = false;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1505
	if (mOrientation == Qt::Horizontal) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1506
		mDocLoader->load(CALEN_MONTHVIEW_XML_FILE, CALEN_LANDSCAPE,
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1507
		                 &loadSuccess);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1508
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1509
	} else if (mOrientation == Qt::Vertical) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1510
		mDocLoader->load(CALEN_MONTHVIEW_XML_FILE, CALEN_PORTRAIT, 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1511
													&loadSuccess);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1512
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1513
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1514
	Q_ASSERT_X(loadSuccess, "calenmonthview.cpp", "Unable to load XML");
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1515
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1516
	// Remove the current pane read from the docml  from the layout 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1517
	// and add actual current pane to the layout
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1518
	QGraphicsLinearLayout* viewLayout = static_cast<QGraphicsLinearLayout *>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1519
													(widget()->layout());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1520
	viewLayout->removeAt(1);
45
hgs
parents: 23
diff changeset
  1521
	// Add this item only when orientaion is changed on month view
hgs
parents: 23
diff changeset
  1522
	// if it is changed in other views, adding the preview pane here was
hgs
parents: 23
diff changeset
  1523
	// overlapping with the month grid, hence, its been added in dopopulation()
hgs
parents: 23
diff changeset
  1524
	if (this == mServices.MainWindow().currentView()) {
hgs
parents: 23
diff changeset
  1525
		viewLayout->addItem(mCurrPaneParent);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1526
	}
51
hgs
parents: 45
diff changeset
  1527
	
hgs
parents: 45
diff changeset
  1528
	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLECHANGEORIENTATION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1529
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1530
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1531
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1532
 Sets the appropriate date to the month title
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1533
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1534
void CalenMonthView::setDateToLabel()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1535
{
51
hgs
parents: 45
diff changeset
  1536
    OstTraceFunctionEntry0( CALENMONTHVIEW_SETDATETOLABEL_ENTRY );
hgs
parents: 45
diff changeset
  1537
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1538
	// Get the localised string for month name from system locale
55
hgs
parents: 51
diff changeset
  1539
	QString dateString = mLocale.monthName(mDate.date().month(), HbExtendedLocale::LongFormat);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1540
	// Append a single space
55
hgs
parents: 51
diff changeset
  1541
	dateString.append(" ");
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1542
	mLocale.setNumberOptions(QLocale::OmitGroupSeparator);
55
hgs
parents: 51
diff changeset
  1543
	// Append the year string also
hgs
parents: 51
diff changeset
  1544
	dateString.append(mLocale.toString(mDate.date().year()));
hgs
parents: 51
diff changeset
  1545
	mTitleLabel->setPlainText(dateString);
51
hgs
parents: 45
diff changeset
  1546
	
hgs
parents: 45
diff changeset
  1547
	OstTraceFunctionExit0( CALENMONTHVIEW_SETDATETOLABEL_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1548
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1549
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1550
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1551
 To handle previewpane swipe 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1552
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1553
void CalenMonthView::handlePreviewPaneGesture(bool rightGesture)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1554
{
51
hgs
parents: 45
diff changeset
  1555
    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLEPREVIEWPANEGESTURE_ENTRY );
hgs
parents: 45
diff changeset
  1556
    
75
hgs
parents: 70
diff changeset
  1557
    // Check if we can swipe, if yes, then proceed, else, do nothing
hgs
parents: 70
diff changeset
  1558
    if (checkIfWeCanSwipe(mDate, rightGesture)) {
hgs
parents: 70
diff changeset
  1559
    
hgs
parents: 70
diff changeset
  1560
        QGraphicsLinearLayout* viewLayout = static_cast<QGraphicsLinearLayout *>
hgs
parents: 70
diff changeset
  1561
                                                    (widget()->layout());
hgs
parents: 70
diff changeset
  1562
        
hgs
parents: 70
diff changeset
  1563
        // Set the effect in progress flags for next and previous panes
hgs
parents: 70
diff changeset
  1564
        // For current pane, we would have set it in gestureEvent() function
hgs
parents: 70
diff changeset
  1565
        mPrevPreviewPane->effectStarted();
hgs
parents: 70
diff changeset
  1566
        mNextPreviewPane->effectStarted();
hgs
parents: 70
diff changeset
  1567
        
hgs
parents: 70
diff changeset
  1568
        if(rightGesture) {
hgs
parents: 70
diff changeset
  1569
            // Need to bring up the previous day preview pane
hgs
parents: 70
diff changeset
  1570
            // Create the effect on mCurrPreviewPane to slide to right side
hgs
parents: 70
diff changeset
  1571
            mPrevPaneParent->setVisible(true);
hgs
parents: 70
diff changeset
  1572
            if (mOrientation == Qt::Vertical) {
hgs
parents: 70
diff changeset
  1573
                HbEffect::add(mCurrPaneLayoutWidget,
hgs
parents: 70
diff changeset
  1574
                              ":/fxml/portrait_preview_pane_hide_on_right_gesture",
hgs
parents: 70
diff changeset
  1575
                              "hide");
hgs
parents: 70
diff changeset
  1576
                HbEffect::add(mPrevPaneLayoutWidget,
hgs
parents: 70
diff changeset
  1577
                              ":/fxml/portrait_preview_pane_show_on_right_gesture",
hgs
parents: 70
diff changeset
  1578
                              "show");
hgs
parents: 70
diff changeset
  1579
            } else {
hgs
parents: 70
diff changeset
  1580
                HbEffect::add(mCurrPaneLayoutWidget,
hgs
parents: 70
diff changeset
  1581
                              ":/fxml/landscape_preview_pane_hide_on_right_gesture",
hgs
parents: 70
diff changeset
  1582
                              "hide");
hgs
parents: 70
diff changeset
  1583
                HbEffect::add(mPrevPaneLayoutWidget,
hgs
parents: 70
diff changeset
  1584
                              ":/fxml/landscape_preview_pane_show_on_right_gesture",
hgs
parents: 70
diff changeset
  1585
                              "show");
hgs
parents: 70
diff changeset
  1586
            }
hgs
parents: 70
diff changeset
  1587
            // Start the effects
hgs
parents: 70
diff changeset
  1588
            HbEffect::start(mCurrPaneLayoutWidget, "hide");
hgs
parents: 70
diff changeset
  1589
            HbEffect::start(mPrevPaneLayoutWidget, "show", 
hgs
parents: 70
diff changeset
  1590
                                            this, "handleRightEffectCompleted");
hgs
parents: 70
diff changeset
  1591
            
hgs
parents: 70
diff changeset
  1592
            //Remove the mCurrPreviewPane from the layout and add mPrevPreviewPane
hgs
parents: 70
diff changeset
  1593
            // to the layout
hgs
parents: 70
diff changeset
  1594
            viewLayout->removeAt(1);
hgs
parents: 70
diff changeset
  1595
            viewLayout->addItem(mPrevPaneParent);
hgs
parents: 70
diff changeset
  1596
        } else {
hgs
parents: 70
diff changeset
  1597
            // Need to bring up the previous day preview pane
hgs
parents: 70
diff changeset
  1598
            // Create the effect on mCurrPreviewPane to slide to left side
hgs
parents: 70
diff changeset
  1599
            mNextPaneParent->setVisible(true);
hgs
parents: 70
diff changeset
  1600
            if (mOrientation == Qt::Vertical) {
hgs
parents: 70
diff changeset
  1601
                HbEffect::add(mCurrPaneLayoutWidget,
hgs
parents: 70
diff changeset
  1602
                              ":/fxml/portrait_preview_pane_hide_on_left_gesture",
hgs
parents: 70
diff changeset
  1603
                              "hide");
hgs
parents: 70
diff changeset
  1604
                HbEffect::add(mNextPaneLayoutWidget,
hgs
parents: 70
diff changeset
  1605
                              ":/fxml/portrait_preview_pane_show_on_left_gesture",
hgs
parents: 70
diff changeset
  1606
                              "show");
hgs
parents: 70
diff changeset
  1607
            } else {
hgs
parents: 70
diff changeset
  1608
                HbEffect::add(mCurrPaneLayoutWidget,
hgs
parents: 70
diff changeset
  1609
                              ":/fxml/landscape_preview_pane_hide_on_left_gesture",
hgs
parents: 70
diff changeset
  1610
                              "hide");
hgs
parents: 70
diff changeset
  1611
                HbEffect::add(mNextPaneLayoutWidget,
hgs
parents: 70
diff changeset
  1612
                              ":/fxml/landscape_preview_pane_show_on_left_gesture",
hgs
parents: 70
diff changeset
  1613
                              "show");
hgs
parents: 70
diff changeset
  1614
            }
hgs
parents: 70
diff changeset
  1615
            
hgs
parents: 70
diff changeset
  1616
            // Start the effects
hgs
parents: 70
diff changeset
  1617
            HbEffect::start(mCurrPaneLayoutWidget, "hide");
hgs
parents: 70
diff changeset
  1618
            HbEffect::start(mNextPaneLayoutWidget, "show", 
hgs
parents: 70
diff changeset
  1619
                                            this, "handleLeftEffectCompleted");
hgs
parents: 70
diff changeset
  1620
            
hgs
parents: 70
diff changeset
  1621
            //Remove the mCurrPreviewPane from the layout and add mNextPreviewPane
hgs
parents: 70
diff changeset
  1622
            // to the layout
hgs
parents: 70
diff changeset
  1623
            viewLayout->removeAt(1);
hgs
parents: 70
diff changeset
  1624
            viewLayout->addItem(mNextPaneParent);
hgs
parents: 70
diff changeset
  1625
        }
hgs
parents: 70
diff changeset
  1626
    }
51
hgs
parents: 45
diff changeset
  1627
	
hgs
parents: 45
diff changeset
  1628
	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLEPREVIEWPANEGESTURE_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1629
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1630
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1631
/*!
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1632
 Returns the first date in the month grid
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1633
 */
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1634
QDateTime CalenMonthView::firstDayOfGrid()
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1635
{
51
hgs
parents: 45
diff changeset
  1636
    OstTraceFunctionEntry0( CALENMONTHVIEW_FIRSTDAYOFGRID_ENTRY );
hgs
parents: 45
diff changeset
  1637
    
hgs
parents: 45
diff changeset
  1638
	OstTraceFunctionExit0( CALENMONTHVIEW_FIRSTDAYOFGRID_EXIT );
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1639
	return mFirstDayOfGrid;
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1640
}
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1641
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1642
/*!
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1643
 Function to handle any locale related changes
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1644
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1645
void CalenMonthView::onLocaleChanged(int reason)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1646
{
51
hgs
parents: 45
diff changeset
  1647
    OstTraceFunctionEntry0( CALENMONTHVIEW_ONLOCALECHANGED_ENTRY );
81
hgs
parents: 75
diff changeset
  1648
	Q_UNUSED(reason);
hgs
parents: 75
diff changeset
  1649
	return;
hgs
parents: 75
diff changeset
  1650
    OstTraceFunctionExit0( CALENMONTHVIEW_ONLOCALECHANGED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1651
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1652
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1653
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1654
 Slot to handle left gesture effects completion
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1655
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1656
void CalenMonthView::handleLeftEffectCompleted(
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1657
										const HbEffect::EffectStatus &status)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1658
{
51
hgs
parents: 45
diff changeset
  1659
    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLELEFTEFFECTCOMPLETED_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1660
	Q_UNUSED(status);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1661
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1662
	int index = getCurrGridIndex();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1663
	index++;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1664
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1665
	// Stop the scrolling on current preview pane
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1666
	mCurrPreviewPane->stopScrolling();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1667
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1668
	// Swap the preview panes properly
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1669
	CalenPreviewPane* pane = mCurrPreviewPane;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1670
	HbWidget* paneParent = mCurrPaneParent;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1671
	HbWidget* paneLayoutWidget = mCurrPaneLayoutWidget;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1672
	mCurrPreviewPane = mNextPreviewPane;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1673
	mCurrPaneParent = mNextPaneParent;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1674
	mCurrPaneLayoutWidget = mNextPaneLayoutWidget;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1675
	mNextPreviewPane = mPrevPreviewPane;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1676
	mNextPaneParent = mPrevPaneParent;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1677
	mNextPaneLayoutWidget = mPrevPaneLayoutWidget;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1678
	mPrevPreviewPane = pane;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1679
	mPrevPaneParent = paneParent;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1680
	mPrevPaneLayoutWidget = paneLayoutWidget;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1681
	
57
hgs
parents: 55
diff changeset
  1682
	// Reset the effect in progress flag
hgs
parents: 55
diff changeset
  1683
	mCurrPreviewPane->effectFinished();
hgs
parents: 55
diff changeset
  1684
    mPrevPreviewPane->effectFinished();
hgs
parents: 55
diff changeset
  1685
    mNextPreviewPane->effectFinished();
hgs
parents: 55
diff changeset
  1686
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1687
	// Set the focus to proper date
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1688
	setCurrGridIndex(index);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1689
	// Start the auto scroll on current preview pane
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1690
	mCurrPreviewPane->startAutoScroll();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1691
	mNextPreviewPane->populateLabel(mDate.addDays(1));
51
hgs
parents: 45
diff changeset
  1692
	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLELEFTEFFECTCOMPLETED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1693
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1694
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1695
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1696
 Slot to handle right gesture effects completion
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1697
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1698
void CalenMonthView::handleRightEffectCompleted(
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1699
										const HbEffect::EffectStatus &status) 	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1700
{
51
hgs
parents: 45
diff changeset
  1701
    OstTraceFunctionEntry0( CALENMONTHVIEW_HANDLERIGHTEFFECTCOMPLETED_ENTRY );
hgs
parents: 45
diff changeset
  1702
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1703
	Q_UNUSED(status);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1704
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1705
	int index = getCurrGridIndex();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1706
	index--;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1707
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1708
	// Stop the scrolling on current preview pane
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1709
	mCurrPreviewPane->stopScrolling();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1710
		
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1711
	// Swap the preview panes properly
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1712
	CalenPreviewPane* pane = mCurrPreviewPane;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1713
	HbWidget* paneParent = mCurrPaneParent;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1714
	HbWidget* paneLayoutWidget = mCurrPaneLayoutWidget;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1715
	mCurrPreviewPane = mPrevPreviewPane;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1716
	mCurrPaneParent = mPrevPaneParent;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1717
	mCurrPaneLayoutWidget = mPrevPaneLayoutWidget;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1718
	mPrevPreviewPane = mNextPreviewPane;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1719
	mPrevPaneParent = mNextPaneParent;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1720
	mPrevPaneLayoutWidget = mNextPaneLayoutWidget;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1721
	mNextPreviewPane = pane;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1722
	mNextPaneParent = paneParent;
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
  1723
	mNextPaneLayoutWidget = paneLayoutWidget;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1724
	
57
hgs
parents: 55
diff changeset
  1725
	// Reset the effect in progress flag
hgs
parents: 55
diff changeset
  1726
	mCurrPreviewPane->effectFinished();
hgs
parents: 55
diff changeset
  1727
    mNextPreviewPane->effectFinished();
hgs
parents: 55
diff changeset
  1728
    mPrevPreviewPane->effectFinished();
hgs
parents: 55
diff changeset
  1729
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1730
	// Set the focus to proper date
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1731
	setCurrGridIndex(index);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1732
	// Start the auto scroll on current preview pane
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1733
	mCurrPreviewPane->startAutoScroll();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1734
	mPrevPreviewPane->populateLabel(mDate.addDays(-1));
51
hgs
parents: 45
diff changeset
  1735
	
hgs
parents: 45
diff changeset
  1736
	OstTraceFunctionExit0( CALENMONTHVIEW_HANDLERIGHTEFFECTCOMPLETED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1737
}
45
hgs
parents: 23
diff changeset
  1738
/*!
hgs
parents: 23
diff changeset
  1739
 update the Day labels 
hgs
parents: 23
diff changeset
  1740
 */
hgs
parents: 23
diff changeset
  1741
void CalenMonthView::updateDayLabel()
hgs
parents: 23
diff changeset
  1742
{
51
hgs
parents: 45
diff changeset
  1743
    OstTraceFunctionEntry0( CALENMONTHVIEW_UPDATEDAYLABEL_ENTRY );
hgs
parents: 45
diff changeset
  1744
    
45
hgs
parents: 23
diff changeset
  1745
    // Set the short day names to these labels  
hgs
parents: 23
diff changeset
  1746
    int startOfWeek = mLocale.startOfWeek();
hgs
parents: 23
diff changeset
  1747
    int weekDayIndex = startOfWeek;
hgs
parents: 23
diff changeset
  1748
    QStringList  weekDayArray ;
hgs
parents: 23
diff changeset
  1749
    weekDayArray <<hbTrId("txt_calendar_grid_day_mo")
hgs
parents: 23
diff changeset
  1750
                           <<hbTrId("txt_calendar_grid_day_tu")
hgs
parents: 23
diff changeset
  1751
                           <<hbTrId("txt_calendar_grid_day_we")
hgs
parents: 23
diff changeset
  1752
                           <<hbTrId("txt_calendar_grid_day_th")
hgs
parents: 23
diff changeset
  1753
                           <<hbTrId("txt_calendar_grid_day_fr")
hgs
parents: 23
diff changeset
  1754
                           <<hbTrId("txt_calendar_grid_day_sa")
hgs
parents: 23
diff changeset
  1755
                           <<hbTrId("txt_calendar_grid_day_su");
hgs
parents: 23
diff changeset
  1756
            
hgs
parents: 23
diff changeset
  1757
    QList<HbLabel*> labels;
hgs
parents: 23
diff changeset
  1758
    // append seven day labels 
hgs
parents: 23
diff changeset
  1759
    labels.append(mFirstDayLabel);
hgs
parents: 23
diff changeset
  1760
    labels.append(mSecondDayLabel);
hgs
parents: 23
diff changeset
  1761
    labels.append(mThirdDayLabel);
hgs
parents: 23
diff changeset
  1762
    labels.append(mFourthDayLabel);
hgs
parents: 23
diff changeset
  1763
    labels.append(mFifthDayLabel);
hgs
parents: 23
diff changeset
  1764
    labels.append(mSixthDayLabel);
hgs
parents: 23
diff changeset
  1765
    labels.append(mSeventhDayLabel);
63
hgs
parents: 57
diff changeset
  1766
    QGraphicsLinearLayout* layout = static_cast<QGraphicsLinearLayout*> (mDayNameWidget->layout());
45
hgs
parents: 23
diff changeset
  1767
    for(int i=0;i < KCalenDaysInWeek; i++ )
hgs
parents: 23
diff changeset
  1768
        {
hgs
parents: 23
diff changeset
  1769
        labels.at(i)->setPlainText(weekDayArray[weekDayIndex]);
63
hgs
parents: 57
diff changeset
  1770
        // Set the stretch factor as 1 so that each label occupies equal space
hgs
parents: 57
diff changeset
  1771
        layout->setStretchFactor(labels.at(i), 1);
45
hgs
parents: 23
diff changeset
  1772
        if(weekDayIndex == KCalenDaysInWeek - 1 )//Sunday
hgs
parents: 23
diff changeset
  1773
            {
hgs
parents: 23
diff changeset
  1774
            weekDayIndex = 0;//reset to monday
hgs
parents: 23
diff changeset
  1775
            continue;
hgs
parents: 23
diff changeset
  1776
            }
hgs
parents: 23
diff changeset
  1777
        weekDayIndex++;//increase the index for next value
hgs
parents: 23
diff changeset
  1778
        }
hgs
parents: 23
diff changeset
  1779
    labels.clear();
hgs
parents: 23
diff changeset
  1780
    weekDayArray.clear();
51
hgs
parents: 45
diff changeset
  1781
    
hgs
parents: 45
diff changeset
  1782
    OstTraceFunctionExit0( CALENMONTHVIEW_UPDATEDAYLABEL_EXIT );
45
hgs
parents: 23
diff changeset
  1783
}
75
hgs
parents: 70
diff changeset
  1784
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1785
// End of file  --Don't remove this.