calendarui/controller/src/calenviewmanager.cpp
author hgs
Mon, 26 Jul 2010 13:54:38 +0530
changeset 55 2c54b51f39c4
parent 51 0b38fc5b94c6
child 57 bb2d3e476f29
permissions -rw-r--r--
201029
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
/*
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  Calendar view manager
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    15
 *
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    19
//system includes
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    20
#include <hbmainwindow.h>
45
hgs
parents: 23
diff changeset
    21
#include <hbinstance.h>
hgs
parents: 23
diff changeset
    22
#include <hbapplication.h> // hbapplication
hgs
parents: 23
diff changeset
    23
#include <xqserviceutil.h> // service utils
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    25
//user includes
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include "calenviewmanager.h"
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include "calencontroller.h"
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    28
#include "hb_calencommands.hrh"
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include "calenservicesimpl.h"
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    30
#include "calenmonthview.h"
45
hgs
parents: 23
diff changeset
    31
#include "calenagendaview.h"
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    32
#include "calenmonthview.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    33
#include "agendaeventviewer.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    34
#include "calennotificationhandler.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    35
#include "CalenUid.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    36
#include "calenactionuiutils.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    37
#include "calensettingsview.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    38
#include "calendocloader.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    39
#include "calendarui_debug.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    40
#include "calencommon.h"
45
hgs
parents: 23
diff changeset
    41
#include "calendayview.h"
55
hgs
parents: 51
diff changeset
    42
#include <agendautil.h>
51
hgs
parents: 45
diff changeset
    43
#include "OstTraceDefinitions.h"
hgs
parents: 45
diff changeset
    44
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents: 45
diff changeset
    45
#include "calenviewmanagerTraces.h"
hgs
parents: 45
diff changeset
    46
#endif
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    49
// CalenViewManager::CalenViewManager
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
// 2nd phase of construction.
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
//
45
hgs
parents: 23
diff changeset
    54
CalenViewManager::CalenViewManager( CCalenController& aController)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    55
: mController(aController)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    56
{
51
hgs
parents: 45
diff changeset
    57
	OstTraceFunctionEntry0( CALENVIEWMANAGER_CALENVIEWMANAGER_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    58
	
45
hgs
parents: 23
diff changeset
    59
	// Following block intializes member variables
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    60
	mCalenEventViewer = NULL;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    61
	mMonthViewDocLoader = NULL;
45
hgs
parents: 23
diff changeset
    62
	mAgendaViewDocLoader = NULL;	
hgs
parents: 23
diff changeset
    63
	mAgendaViewAltDocLoader = NULL;
hgs
parents: 23
diff changeset
    64
	mCalenAgendaView = NULL;
hgs
parents: 23
diff changeset
    65
	mCalenMonthView = NULL;
hgs
parents: 23
diff changeset
    66
	mCalenAgendaViewAlt = NULL;
hgs
parents: 23
diff changeset
    67
	mSettingsView = NULL;
hgs
parents: 23
diff changeset
    68
	mCalenDayView = NULL;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    69
	
45
hgs
parents: 23
diff changeset
    70
	// Connect to instance view and entry view creation signals from agenda
hgs
parents: 23
diff changeset
    71
	// interface
hgs
parents: 23
diff changeset
    72
	connect(mController.agendaInterface(), SIGNAL(instanceViewCreationCompleted(int)),
hgs
parents: 23
diff changeset
    73
	        this, SLOT(handleInstanceViewCreation(int)));
hgs
parents: 23
diff changeset
    74
	connect(mController.agendaInterface(), SIGNAL(entryViewCreationCompleted(int)),
hgs
parents: 23
diff changeset
    75
		        this, SLOT(handleEntryViewCreation(int)));
51
hgs
parents: 45
diff changeset
    76
	connect(mController.agendaInterface(), SIGNAL(entriesChanged(QList<ulong>)),
hgs
parents: 45
diff changeset
    77
								this, SLOT(handleEntriesChanged(QList<ulong>)));
55
hgs
parents: 51
diff changeset
    78
    connect(mController.agendaInterface(), SIGNAL(entryUpdated(ulong)),
hgs
parents: 51
diff changeset
    79
                                this, SLOT(handleEntryUpdation(ulong)));
hgs
parents: 51
diff changeset
    80
    connect(mController.agendaInterface(), SIGNAL(entryAdded(ulong)),
hgs
parents: 51
diff changeset
    81
                                this, SLOT(handleEntryUpdation(ulong)));
51
hgs
parents: 45
diff changeset
    82
	OstTraceFunctionExit0( CALENVIEWMANAGER_CALENVIEWMANAGER_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    83
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
45
hgs
parents: 23
diff changeset
    85
void CalenViewManager::SecondPhaseConstruction()
hgs
parents: 23
diff changeset
    86
{
51
hgs
parents: 45
diff changeset
    87
    OstTraceFunctionEntry0( CALENVIEWMANAGER_SECONDPHASECONSTRUCTION_ENTRY );
45
hgs
parents: 23
diff changeset
    88
    
hgs
parents: 23
diff changeset
    89
    // Check the Application Startup reason from Activity Manager
hgs
parents: 23
diff changeset
    90
    int activityReason = qobject_cast<HbApplication*>(qApp)->activateReason();
hgs
parents: 23
diff changeset
    91
    
hgs
parents: 23
diff changeset
    92
    // Check if calendar is launched thru XQService framework
hgs
parents: 23
diff changeset
    93
    bool isFromServiceFrmWrk = XQServiceUtil::isService(); // Since activateReason 
hgs
parents: 23
diff changeset
    94
    //of hbapplication is not returning right value if the activity is started 
hgs
parents: 23
diff changeset
    95
    //as services so using the above line temporarily untill a fix is available in 
hgs
parents: 23
diff changeset
    96
    // hbappliacation. Need to remove this line after the fix is available for hbapplcation
hgs
parents: 23
diff changeset
    97
hgs
parents: 23
diff changeset
    98
    
hgs
parents: 23
diff changeset
    99
    if (Hb::ActivationReasonActivity == activityReason) // Check if application is started 
hgs
parents: 23
diff changeset
   100
    // as an activity
hgs
parents: 23
diff changeset
   101
        {
hgs
parents: 23
diff changeset
   102
        // Application is started from an activity
hgs
parents: 23
diff changeset
   103
        // Extract activity data
hgs
parents: 23
diff changeset
   104
        QVariant data = qobject_cast<HbApplication*>(qApp)->activateData();
hgs
parents: 23
diff changeset
   105
        // Restore state from activity data
hgs
parents: 23
diff changeset
   106
        QByteArray serializedModel = data.toByteArray();
hgs
parents: 23
diff changeset
   107
        QDataStream stream(&serializedModel, QIODevice::ReadOnly);
hgs
parents: 23
diff changeset
   108
        int viewId; // int declared for debugging purpose
hgs
parents: 23
diff changeset
   109
        stream >> viewId; // read stream into an int
hgs
parents: 23
diff changeset
   110
        
hgs
parents: 23
diff changeset
   111
        mFirstView = viewId;
hgs
parents: 23
diff changeset
   112
        if (ECalenMonthView == viewId) // Check if Activity was stored for month view
hgs
parents: 23
diff changeset
   113
            {
hgs
parents: 23
diff changeset
   114
            loadMonthView(); // Load month view
hgs
parents: 23
diff changeset
   115
            }
hgs
parents: 23
diff changeset
   116
        else if (ECalenAgendaView == viewId) // Check if Activity was stored for agenda view
hgs
parents: 23
diff changeset
   117
            {
hgs
parents: 23
diff changeset
   118
        	loadAgendaView(); // Load agenda view
hgs
parents: 23
diff changeset
   119
            }
hgs
parents: 23
diff changeset
   120
        
hgs
parents: 23
diff changeset
   121
        ActivateDefaultViewL(viewId);
hgs
parents: 23
diff changeset
   122
        // Connect to the view ready signal so that we can construct other views 
hgs
parents: 23
diff changeset
   123
        // once this view is ready
hgs
parents: 23
diff changeset
   124
        connect(&mController.MainWindow(), SIGNAL(viewReady()), 
hgs
parents: 23
diff changeset
   125
                this, SLOT(handleMainViewReady()));
hgs
parents: 23
diff changeset
   126
hgs
parents: 23
diff changeset
   127
        if (ECalenMonthView == viewId) // Check if Activity was stored for month view
hgs
parents: 23
diff changeset
   128
            {
hgs
parents: 23
diff changeset
   129
            mController.MainWindow().addView(mCalenMonthView); // Add month view to main window
hgs
parents: 23
diff changeset
   130
            mController.MainWindow().setCurrentView(mCalenMonthView); // Set month view as current view
hgs
parents: 23
diff changeset
   131
            } 
hgs
parents: 23
diff changeset
   132
        else if (ECalenAgendaView == viewId) // Check if Activity was stored for agenda view
hgs
parents: 23
diff changeset
   133
            {
hgs
parents: 23
diff changeset
   134
            mController.MainWindow().addView(mCalenAgendaView); // Add agenda view to main window
hgs
parents: 23
diff changeset
   135
            mController.MainWindow().setCurrentView(mCalenAgendaView); // Set agenda view as current view
hgs
parents: 23
diff changeset
   136
            }
hgs
parents: 23
diff changeset
   137
        } else if (isFromServiceFrmWrk/*Hb::ActivationReasonService == activityReason*/) {
hgs
parents: 23
diff changeset
   138
        // Dont load any views until our remote slot gets called in
hgs
parents: 23
diff changeset
   139
        // calenserviceprovider.cpp
hgs
parents: 23
diff changeset
   140
        // Just have an empty mainwindow
hgs
parents: 23
diff changeset
   141
    } else {
hgs
parents: 23
diff changeset
   142
        // Do the normal startup
hgs
parents: 23
diff changeset
   143
        // Load the month view and active it and add it to main window
hgs
parents: 23
diff changeset
   144
        mFirstView = ECalenMonthView;
hgs
parents: 23
diff changeset
   145
        loadMonthView();
hgs
parents: 23
diff changeset
   146
        ActivateDefaultViewL(ECalenMonthView);
hgs
parents: 23
diff changeset
   147
        // Connect to the view ready signal so that we construct other view 
hgs
parents: 23
diff changeset
   148
        // once this view is shown
hgs
parents: 23
diff changeset
   149
        connect(&mController.MainWindow(), SIGNAL(viewReady()), 
hgs
parents: 23
diff changeset
   150
                        this, SLOT(handleMainViewReady()));
hgs
parents: 23
diff changeset
   151
        
hgs
parents: 23
diff changeset
   152
        mController.MainWindow().addView(mCalenMonthView);
hgs
parents: 23
diff changeset
   153
        mController.MainWindow().setCurrentView(mCalenMonthView);
hgs
parents: 23
diff changeset
   154
    }
hgs
parents: 23
diff changeset
   155
    
hgs
parents: 23
diff changeset
   156
51
hgs
parents: 45
diff changeset
   157
    OstTraceFunctionExit0( CALENVIEWMANAGER_SECONDPHASECONSTRUCTION_EXIT );
45
hgs
parents: 23
diff changeset
   158
}
hgs
parents: 23
diff changeset
   159
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   161
// CalenViewManager::~CalenViewManager
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   162
// Destructor.
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   166
CalenViewManager::~CalenViewManager()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   167
{
51
hgs
parents: 45
diff changeset
   168
    OstTraceFunctionEntry0( DUP1_CALENVIEWMANAGER_CALENVIEWMANAGER_ENTRY );
hgs
parents: 45
diff changeset
   169
    
45
hgs
parents: 23
diff changeset
   170
	if (mSettingsView) {
hgs
parents: 23
diff changeset
   171
		delete mSettingsView;
hgs
parents: 23
diff changeset
   172
		mSettingsView = 0;
hgs
parents: 23
diff changeset
   173
	}
hgs
parents: 23
diff changeset
   174
	if (mAgendaViewDocLoader) {
hgs
parents: 23
diff changeset
   175
		delete mAgendaViewDocLoader;
hgs
parents: 23
diff changeset
   176
		mAgendaViewDocLoader = 0;
hgs
parents: 23
diff changeset
   177
	}
hgs
parents: 23
diff changeset
   178
	if (mAgendaViewAltDocLoader) {
hgs
parents: 23
diff changeset
   179
		delete mAgendaViewAltDocLoader;
hgs
parents: 23
diff changeset
   180
		mAgendaViewAltDocLoader = 0;
hgs
parents: 23
diff changeset
   181
	}
hgs
parents: 23
diff changeset
   182
	if (mMonthViewDocLoader) {
hgs
parents: 23
diff changeset
   183
		delete mMonthViewDocLoader;
hgs
parents: 23
diff changeset
   184
		mMonthViewDocLoader = 0;
hgs
parents: 23
diff changeset
   185
	}
51
hgs
parents: 45
diff changeset
   186
	
hgs
parents: 45
diff changeset
   187
	OstTraceFunctionExit0( DUP1_CALENVIEWMANAGER_CALENVIEWMANAGER_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   188
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   191
// CalenViewManager::constructAndActivateView
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   192
// Constructs and activates the requested view
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   196
void CalenViewManager::constructAndActivateView(int view)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   197
{
51
hgs
parents: 45
diff changeset
   198
	OstTraceFunctionEntry0( CALENVIEWMANAGER_CONSTRUCTANDACTIVATEVIEW_ENTRY );
hgs
parents: 45
diff changeset
   199
	
hgs
parents: 45
diff changeset
   200
    // We are here because, some other application is launching calendar with 
45
hgs
parents: 23
diff changeset
   201
	// the view, hence connect to viewReady() signal to do any lazy loading
hgs
parents: 23
diff changeset
   202
	// in the slot
hgs
parents: 23
diff changeset
   203
	
hgs
parents: 23
diff changeset
   204
	// Connect to the view ready signal so that we construct other view 
hgs
parents: 23
diff changeset
   205
	// once this view is shown
hgs
parents: 23
diff changeset
   206
	connect(&mController.MainWindow(), SIGNAL(viewReady()), 
hgs
parents: 23
diff changeset
   207
					this, SLOT(handleMainViewReady()));
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   208
	if (view == ECalenMonthView) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   209
		mFirstView = ECalenMonthView;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   210
		loadMonthView();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   211
		ActivateDefaultViewL(ECalenMonthView);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   212
		// Add month view to mainwindow.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   213
		mController.MainWindow().addView(mCalenMonthView);
45
hgs
parents: 23
diff changeset
   214
		mController.MainWindow().setCurrentView(mCalenMonthView);
hgs
parents: 23
diff changeset
   215
	} else if (view == ECalenAgendaView) {
hgs
parents: 23
diff changeset
   216
		mFirstView = ECalenAgendaView;
hgs
parents: 23
diff changeset
   217
		loadAgendaView();
hgs
parents: 23
diff changeset
   218
		ActivateDefaultViewL(ECalenAgendaView);
hgs
parents: 23
diff changeset
   219
		// Add agenda view to mainwindow.
hgs
parents: 23
diff changeset
   220
		mController.MainWindow().addView(mCalenAgendaView);
hgs
parents: 23
diff changeset
   221
		mController.MainWindow().setCurrentView(mCalenAgendaView);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   222
	}
51
hgs
parents: 45
diff changeset
   223
	OstTraceFunctionExit0( CALENVIEWMANAGER_CONSTRUCTANDACTIVATEVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   224
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   225
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   227
// CalenViewManager::loadMonthView
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   228
// Loads month view frm the docml
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   232
void CalenViewManager::loadMonthView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   233
{
51
hgs
parents: 45
diff changeset
   234
    OstTraceFunctionEntry0( CALENVIEWMANAGER_LOADMONTHVIEW_ENTRY );
hgs
parents: 45
diff changeset
   235
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   236
	bool loadSuccess = false;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   237
	Qt::Orientation currentOrienation = mController.MainWindow().orientation();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   238
	// Create the month view docloader object.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   239
	mMonthViewDocLoader = new CalenDocLoader(mController);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   240
	mMonthViewDocLoader->load(CALEN_MONTHVIEW_XML_FILE, &loadSuccess);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   241
	Q_ASSERT_X(loadSuccess, "calenviewmanager.cpp", 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   242
											"Unable to load month view XML");
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   243
	// Based on the current orientation, load the appropriate section
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   244
	if (Qt::Vertical == currentOrienation) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   245
		mMonthViewDocLoader->load(CALEN_MONTHVIEW_XML_FILE, 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   246
											CALEN_PORTRAIT, &loadSuccess);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   247
		} else {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   248
			mMonthViewDocLoader->load(CALEN_MONTHVIEW_XML_FILE, 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   249
											CALEN_LANDSCAPE, &loadSuccess);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   250
		}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   251
	Q_ASSERT_X(loadSuccess, "calenviewmanager.cpp", "Unable to load XML");
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   252
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   253
	// Get the calenmonth view from the loader.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   254
	mCalenMonthView = static_cast<CalenMonthView *> 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   255
							(mMonthViewDocLoader->findWidget(CALEN_MONTHVIEW));
45
hgs
parents: 23
diff changeset
   256
	Q_ASSERT_X(mCalenMonthView, "calenviewmanager.cpp", 
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   257
											"Unable to load calenMonth view");
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   258
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   259
	// Setup the month view.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   260
	mCalenMonthView->setupView(mMonthViewDocLoader);
51
hgs
parents: 45
diff changeset
   261
	
hgs
parents: 45
diff changeset
   262
	OstTraceFunctionExit0( CALENVIEWMANAGER_LOADMONTHVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   263
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
// ----------------------------------------------------------------------------
45
hgs
parents: 23
diff changeset
   266
// CalenViewManager::loadAgendaView
hgs
parents: 23
diff changeset
   267
// Loads the agenda view frm the docml
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
//
45
hgs
parents: 23
diff changeset
   271
void CalenViewManager::loadAgendaView()
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   272
{
51
hgs
parents: 45
diff changeset
   273
    OstTraceFunctionEntry0( CALENVIEWMANAGER_LOADAGENDAVIEW_ENTRY );
hgs
parents: 45
diff changeset
   274
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   275
	bool loadSuccess = false;
45
hgs
parents: 23
diff changeset
   276
	// Create the agenda view docloader object.
hgs
parents: 23
diff changeset
   277
	mAgendaViewDocLoader = new CalenDocLoader(mController);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   278
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   279
	// Load default section
45
hgs
parents: 23
diff changeset
   280
	mAgendaViewDocLoader->load(CALEN_AGENDAVIEW_XML_FILE, &loadSuccess);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   281
	if (!loadSuccess) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   282
		qFatal("calenviewmanager.cpp : Unable to load XML");
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   283
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   284
	
45
hgs
parents: 23
diff changeset
   285
	// Get the calenagenda view from the loader
hgs
parents: 23
diff changeset
   286
	mCalenAgendaView = static_cast<CalenAgendaView *> (mAgendaViewDocLoader->findWidget(CALEN_AGENDAVIEW));
hgs
parents: 23
diff changeset
   287
	if (!mCalenAgendaView) {
hgs
parents: 23
diff changeset
   288
		qFatal("calenviewmanager.cpp : Unable to find agenda view");
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   289
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   290
	
45
hgs
parents: 23
diff changeset
   291
	// Setup the agenda view
hgs
parents: 23
diff changeset
   292
	mCalenAgendaView->setupView(mAgendaViewDocLoader);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   293
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   294
	// The following code is done to provide swipe support
45
hgs
parents: 23
diff changeset
   295
	// in agenda view. Idea is to create two views and keep
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   296
	// switiching between these two using view switch effects
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   297
	// to provide an illusion of flow to the user
45
hgs
parents: 23
diff changeset
   298
	loadAlternateAgendaView();
hgs
parents: 23
diff changeset
   299
	
51
hgs
parents: 45
diff changeset
   300
	OstTraceFunctionExit0( CALENVIEWMANAGER_LOADAGENDAVIEW_EXIT );
45
hgs
parents: 23
diff changeset
   301
}
hgs
parents: 23
diff changeset
   302
hgs
parents: 23
diff changeset
   303
// ----------------------------------------------------------------------------
55
hgs
parents: 51
diff changeset
   304
// CalenViewManager::loadDayView
hgs
parents: 51
diff changeset
   305
// Loads day view from the docml
hgs
parents: 51
diff changeset
   306
// ----------------------------------------------------------------------------
hgs
parents: 51
diff changeset
   307
void CalenViewManager::loadDayView()
hgs
parents: 51
diff changeset
   308
{
hgs
parents: 51
diff changeset
   309
    bool loadSuccess = false;
hgs
parents: 51
diff changeset
   310
    
hgs
parents: 51
diff changeset
   311
    // Create the docloader object
hgs
parents: 51
diff changeset
   312
    CalenDocLoader *docLoader = new CalenDocLoader(mController);
hgs
parents: 51
diff changeset
   313
    
hgs
parents: 51
diff changeset
   314
    if (docLoader) {
hgs
parents: 51
diff changeset
   315
        docLoader->load(CALEN_DAYVIEW_DOCML, &loadSuccess);
hgs
parents: 51
diff changeset
   316
        if (!loadSuccess) {
hgs
parents: 51
diff changeset
   317
            qFatal("calenviewmanager.cpp : Unable to load day view XML");
hgs
parents: 51
diff changeset
   318
        }
hgs
parents: 51
diff changeset
   319
        
hgs
parents: 51
diff changeset
   320
        // Get the CalenDayView object from the loader
hgs
parents: 51
diff changeset
   321
        mCalenDayView = static_cast<CalenDayView *>
hgs
parents: 51
diff changeset
   322
            (docLoader->findWidget(CALEN_DAYVIEW));
hgs
parents: 51
diff changeset
   323
        if (!mCalenDayView) {
hgs
parents: 51
diff changeset
   324
            qFatal("calenviewmanager.cpp : Unable to find day view");
hgs
parents: 51
diff changeset
   325
        }
hgs
parents: 51
diff changeset
   326
        
hgs
parents: 51
diff changeset
   327
        // Set up the day view - day view takes the ownership
hgs
parents: 51
diff changeset
   328
        mCalenDayView->setupView(docLoader);
hgs
parents: 51
diff changeset
   329
    }
hgs
parents: 51
diff changeset
   330
}
hgs
parents: 51
diff changeset
   331
hgs
parents: 51
diff changeset
   332
// ----------------------------------------------------------------------------
45
hgs
parents: 23
diff changeset
   333
// CalenViewManager::handleMainViewReady
hgs
parents: 23
diff changeset
   334
// Slot to handle viewReady() signal from mainwindow
hgs
parents: 23
diff changeset
   335
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   336
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   337
//
hgs
parents: 23
diff changeset
   338
void CalenViewManager::handleMainViewReady()
hgs
parents: 23
diff changeset
   339
{
51
hgs
parents: 45
diff changeset
   340
    OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEMAINVIEWREADY_ENTRY );
hgs
parents: 45
diff changeset
   341
    
45
hgs
parents: 23
diff changeset
   342
	// Construct the month view part that is kept for lazy loading
hgs
parents: 23
diff changeset
   343
	if (mCalenMonthView) {
hgs
parents: 23
diff changeset
   344
		mCalenMonthView->doLazyLoading();
hgs
parents: 23
diff changeset
   345
	}
hgs
parents: 23
diff changeset
   346
	
hgs
parents: 23
diff changeset
   347
	// Construct other views
hgs
parents: 23
diff changeset
   348
	constructOtherViews();
hgs
parents: 23
diff changeset
   349
	
hgs
parents: 23
diff changeset
   350
    // Install the event filter for the controller once the view is ready
hgs
parents: 23
diff changeset
   351
    // so that system language/locale changes can be handled
hgs
parents: 23
diff changeset
   352
	//hbInstance->allMainWindows().first()->installEventFilter(&mController);
hgs
parents: 23
diff changeset
   353
	
hgs
parents: 23
diff changeset
   354
	// disconnect the view ready signal as we dont need it anymore
hgs
parents: 23
diff changeset
   355
	disconnect(&mController.MainWindow(), SIGNAL(viewReady()), 
hgs
parents: 23
diff changeset
   356
			   this, SLOT(handleMainViewReady()));
51
hgs
parents: 45
diff changeset
   357
	
hgs
parents: 45
diff changeset
   358
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEMAINVIEWREADY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   359
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   362
// CalenViewManager::constructOtherViews
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   363
// Constructs the other views apart frm firstview and adds them to main window
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   367
void CalenViewManager::constructOtherViews()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   368
{
51
hgs
parents: 45
diff changeset
   369
    OstTraceFunctionEntry0( CALENVIEWMANAGER_CONSTRUCTOTHERVIEWS_ENTRY );
hgs
parents: 45
diff changeset
   370
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   371
	// Load all other views except mFirstView
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   372
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   373
	// NOTE: Right now, since Calendar has only two views, month view 
45
hgs
parents: 23
diff changeset
   374
	// and agenda view, when client launches agenda view, then there is no need
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   375
	// to construct the month view as per UI REQ., but tomorrow if new views
45
hgs
parents: 23
diff changeset
   376
	// come after agenda view, then we need to construct those views if they are
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   377
	// native views. Right now, there is a event viewer but its not a native
45
hgs
parents: 23
diff changeset
   378
	// view. Hence, if agenda view is launched, dont construct month view
hgs
parents: 23
diff changeset
   379
	if (mFirstView != ECalenAgendaView) // check if agenda view is not already loaded
hgs
parents: 23
diff changeset
   380
		{
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   381
		// Load all other views 
45
hgs
parents: 23
diff changeset
   382
		loadAgendaView();
hgs
parents: 23
diff changeset
   383
		
hgs
parents: 23
diff changeset
   384
		if (!mCalenDayView) {
55
hgs
parents: 51
diff changeset
   385
		    loadDayView();
45
hgs
parents: 23
diff changeset
   386
		}
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   387
	}
45
hgs
parents: 23
diff changeset
   388
	else //agenda view was launched as first view
hgs
parents: 23
diff changeset
   389
	    {
hgs
parents: 23
diff changeset
   390
		// No implementation yet. UI specs not clear
hgs
parents: 23
diff changeset
   391
		// to be commented in with some more code once UI specs is frozen
hgs
parents: 23
diff changeset
   392
		// for agenda view launching as first view after it was saved as activity
hgs
parents: 23
diff changeset
   393
		// when it was launched from month view
hgs
parents: 23
diff changeset
   394
        // loadMonthView();
hgs
parents: 23
diff changeset
   395
        // mCalenMonthView->doLazyLoading();
hgs
parents: 23
diff changeset
   396
	    }
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   397
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   398
	// Setup the settings view
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   399
	mSettingsView = new CalenSettingsView(mController.Services());
51
hgs
parents: 45
diff changeset
   400
	
hgs
parents: 45
diff changeset
   401
	OstTraceFunctionExit0( CALENVIEWMANAGER_CONSTRUCTOTHERVIEWS_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   402
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   405
// CalenViewManager::getFirstView
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   406
// Returns the first view
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   410
int CalenViewManager::getFirstView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   411
{
51
hgs
parents: 45
diff changeset
   412
    OstTraceFunctionEntry0( CALENVIEWMANAGER_GETFIRSTVIEW_ENTRY );
hgs
parents: 45
diff changeset
   413
    
hgs
parents: 45
diff changeset
   414
	OstTraceFunctionExit0( CALENVIEWMANAGER_GETFIRSTVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   415
	return mFirstView;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   416
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   419
// CalenViewManager::showNextDay
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   420
// other items were commented in a header
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   423
void CalenViewManager::showNextDay()
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
    OstTraceFunctionEntry0( CALENVIEWMANAGER_SHOWNEXTDAY_ENTRY );
hgs
parents: 45
diff changeset
   426
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   427
    // Set the context for the next day
45
hgs
parents: 23
diff changeset
   428
    QDateTime currentDay = mController.Services().Context().focusDateAndTime();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   429
    currentDay = currentDay.addDays(1);
45
hgs
parents: 23
diff changeset
   430
    mController.Services().Context().setFocusDate(currentDay);
hgs
parents: 23
diff changeset
   431
    mCurrentViewId = ECalenAgendaView;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   432
    // Check which is the currently activated view
45
hgs
parents: 23
diff changeset
   433
    if (mController.MainWindow().currentView() == mCalenAgendaView) {
hgs
parents: 23
diff changeset
   434
        mCalenAgendaView->disconnectAboutToQuitEvent(); // disconnect mCalenAgendaView to get aboutToQuit Events
hgs
parents: 23
diff changeset
   435
        HbEffect::add(mCalenAgendaView,
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   436
                      ":/fxml/view_hide",
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   437
                      "hide");
45
hgs
parents: 23
diff changeset
   438
        HbEffect::add(mCalenAgendaViewAlt,
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   439
                      ":/fxml/view_show",
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   440
                      "show");
45
hgs
parents: 23
diff changeset
   441
        // Set the other agenda view as the current view
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   442
        // and animate to provide illusion of swipe
45
hgs
parents: 23
diff changeset
   443
		// It would also connect for aboutToQuit events
hgs
parents: 23
diff changeset
   444
        mCalenAgendaViewAlt->doPopulation();
hgs
parents: 23
diff changeset
   445
        mController.MainWindow().setCurrentView(mCalenAgendaViewAlt, true, Hb::ViewSwitchUseNormalAnim);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   446
    } else {
45
hgs
parents: 23
diff changeset
   447
    mCalenAgendaViewAlt->disconnectAboutToQuitEvent(); // disconnect mCalenAgendaViewAlt to get aboutToQuit Events
hgs
parents: 23
diff changeset
   448
        HbEffect::add(mCalenAgendaViewAlt,
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   449
                      ":/fxml/view_hide",
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   450
                      "hide");
45
hgs
parents: 23
diff changeset
   451
        HbEffect::add(mCalenAgendaView,
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   452
                      ":/fxml/view_show",
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   453
                      "show");
45
hgs
parents: 23
diff changeset
   454
		// It would also connect for aboutToQuit events
hgs
parents: 23
diff changeset
   455
        mCalenAgendaView->doPopulation();
hgs
parents: 23
diff changeset
   456
        mController.MainWindow().setCurrentView(mCalenAgendaView, true, Hb::ViewSwitchUseNormalAnim);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
    }
51
hgs
parents: 45
diff changeset
   458
    OstTraceFunctionExit0( CALENVIEWMANAGER_SHOWNEXTDAY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   459
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   462
// CalenViewManager::showPrevDay
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   463
// other items were commented in a header
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   464
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   466
void CalenViewManager::showPrevDay()
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
    OstTraceFunctionEntry0( CALENVIEWMANAGER_SHOWPREVDAY_ENTRY );
hgs
parents: 45
diff changeset
   469
    
45
hgs
parents: 23
diff changeset
   470
    QDateTime currentDay = mController.Services().Context().focusDateAndTime();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   471
    currentDay = currentDay.addDays(-1);
45
hgs
parents: 23
diff changeset
   472
    mController.Services().Context().setFocusDate(currentDay);
hgs
parents: 23
diff changeset
   473
    mCurrentViewId = ECalenAgendaView;
hgs
parents: 23
diff changeset
   474
    if (mController.MainWindow().currentView() == mCalenAgendaView) {
hgs
parents: 23
diff changeset
   475
    mCalenAgendaView->disconnectAboutToQuitEvent(); // disconnect mCalenAgendaView to get aboutToQuit Events
hgs
parents: 23
diff changeset
   476
        HbEffect::add(mCalenAgendaView,
hgs
parents: 23
diff changeset
   477
                      ":/fxml/view_hide_back",
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   478
                      "hide");
45
hgs
parents: 23
diff changeset
   479
        HbEffect::add(mCalenAgendaViewAlt,
hgs
parents: 23
diff changeset
   480
                      ":/fxml/view_show_back",
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   481
                      "show");
45
hgs
parents: 23
diff changeset
   482
		// It would also connect for aboutToQuit events
hgs
parents: 23
diff changeset
   483
        mCalenAgendaViewAlt->doPopulation();
hgs
parents: 23
diff changeset
   484
        mController.MainWindow().setCurrentView(mCalenAgendaViewAlt, true, Hb::ViewSwitchUseNormalAnim);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   485
    } else {
45
hgs
parents: 23
diff changeset
   486
    mCalenAgendaViewAlt->disconnectAboutToQuitEvent(); // disconnect mCalenAgendaViewAlt to get aboutToQuit Events
hgs
parents: 23
diff changeset
   487
        HbEffect::add(mCalenAgendaViewAlt,
hgs
parents: 23
diff changeset
   488
                      ":/fxml/view_hide_back",
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   489
                      "hide");
45
hgs
parents: 23
diff changeset
   490
        HbEffect::add(mCalenAgendaView,
hgs
parents: 23
diff changeset
   491
                      ":/fxml/view_show_back",
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   492
                      "show");
45
hgs
parents: 23
diff changeset
   493
		// It would also connect for aboutToQuit events
hgs
parents: 23
diff changeset
   494
        mCalenAgendaView->doPopulation();
hgs
parents: 23
diff changeset
   495
        mController.MainWindow().setCurrentView(mCalenAgendaView, true, Hb::ViewSwitchUseNormalAnim);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
    }
51
hgs
parents: 45
diff changeset
   497
    
hgs
parents: 45
diff changeset
   498
    OstTraceFunctionExit0( CALENVIEWMANAGER_SHOWPREVDAY_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   499
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
// ----------------------------------------------------------------------------
45
hgs
parents: 23
diff changeset
   502
// CalenViewManager::removePreviousView
hgs
parents: 23
diff changeset
   503
// Remove the previous view from main window
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   504
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
//
45
hgs
parents: 23
diff changeset
   506
void CalenViewManager::removePreviousView()
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   507
{
51
hgs
parents: 45
diff changeset
   508
    OstTraceFunctionEntry0( CALENVIEWMANAGER_REMOVEPREVIOUSVIEW_ENTRY );
hgs
parents: 45
diff changeset
   509
    
45
hgs
parents: 23
diff changeset
   510
	if (ECalenAgendaView == mCurrentViewId) {
hgs
parents: 23
diff changeset
   511
		mCalenAgendaView->clearListModel();
hgs
parents: 23
diff changeset
   512
		mCalenAgendaViewAlt->clearListModel();
hgs
parents: 23
diff changeset
   513
		mController.MainWindow().removeView(mCalenAgendaView);
hgs
parents: 23
diff changeset
   514
		mController.MainWindow().removeView(mCalenAgendaViewAlt);
hgs
parents: 23
diff changeset
   515
	} else if (ECalenDayView == mCurrentViewId) {
hgs
parents: 23
diff changeset
   516
		mController.MainWindow().removeView(mCalenDayView);
hgs
parents: 23
diff changeset
   517
	} else {
hgs
parents: 23
diff changeset
   518
		if (ECalenMonthView == mCurrentViewId) {
hgs
parents: 23
diff changeset
   519
			mController.MainWindow().removeView(mCalenMonthView);
hgs
parents: 23
diff changeset
   520
		}
hgs
parents: 23
diff changeset
   521
	}
hgs
parents: 23
diff changeset
   522
51
hgs
parents: 45
diff changeset
   523
	OstTraceFunctionExit0( CALENVIEWMANAGER_REMOVEPREVIOUSVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   524
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   527
// CalenViewManager::~ActivateDefaultViewL
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   528
//  Activates the default view, as retrieved from settings.
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   532
void CalenViewManager::ActivateDefaultViewL(int defaultView)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   533
{
51
hgs
parents: 45
diff changeset
   534
    OstTraceFunctionEntry0( CALENVIEWMANAGER_ACTIVATEDEFAULTVIEWL_ENTRY );
hgs
parents: 45
diff changeset
   535
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   536
	mCurrentViewId = defaultView;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   537
	if (ECalenMonthView == defaultView) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   538
		mCalenMonthView->doPopulation();
45
hgs
parents: 23
diff changeset
   539
	} else if (ECalenAgendaView == defaultView) {
hgs
parents: 23
diff changeset
   540
		mCalenAgendaView->doPopulation();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   541
	}
51
hgs
parents: 45
diff changeset
   542
	OstTraceFunctionExit0( CALENVIEWMANAGER_ACTIVATEDEFAULTVIEWL_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   543
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   544
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   545
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   546
// Refresh current view.
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   549
void CalenViewManager::refreshCurrentViewL()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   550
{
51
hgs
parents: 45
diff changeset
   551
    OstTraceFunctionEntry0( CALENVIEWMANAGER_REFRESHCURRENTVIEWL_ENTRY );
hgs
parents: 45
diff changeset
   552
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   553
	activateCurrentView();
51
hgs
parents: 45
diff changeset
   554
	
hgs
parents: 45
diff changeset
   555
	OstTraceFunctionExit0( CALENVIEWMANAGER_REFRESHCURRENTVIEWL_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   556
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   557
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   559
// Activate current view.
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   562
void CalenViewManager::activateCurrentView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   563
{
51
hgs
parents: 45
diff changeset
   564
    OstTraceFunctionEntry0( CALENVIEWMANAGER_ACTIVATECURRENTVIEW_ENTRY );
hgs
parents: 45
diff changeset
   565
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   566
	switch (mCurrentViewId) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   567
		case ECalenMonthView:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   568
		    mCalenMonthView->doPopulation();
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   569
		    mController.MainWindow().setCurrentView(mCalenMonthView);
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   570
			break;
45
hgs
parents: 23
diff changeset
   571
		case ECalenAgendaView:
hgs
parents: 23
diff changeset
   572
		    if (mController.MainWindow().currentView() == mCalenAgendaView) {
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   573
		        // This happens when settings view or event viewer is opened
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   574
		        // from the agenda view. Simply repopulate the view
45
hgs
parents: 23
diff changeset
   575
		    	if (mCalenAgendaView) {
hgs
parents: 23
diff changeset
   576
		    		mCalenAgendaView->doPopulation();
hgs
parents: 23
diff changeset
   577
					mController.MainWindow().setCurrentView(mCalenAgendaView);
hgs
parents: 23
diff changeset
   578
		    	} 
hgs
parents: 23
diff changeset
   579
		    } else if (mController.MainWindow().currentView() == mCalenAgendaViewAlt){
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   580
		        // This happens when settings view or event viewer is opened
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   581
		        // from the agenda view. Simply repopulate the view
45
hgs
parents: 23
diff changeset
   582
		    	if (mCalenAgendaViewAlt) {
hgs
parents: 23
diff changeset
   583
		    		mCalenAgendaViewAlt->doPopulation();
hgs
parents: 23
diff changeset
   584
		    		mController.MainWindow().setCurrentView(mCalenAgendaViewAlt);
hgs
parents: 23
diff changeset
   585
		    	}
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   586
		    } else {
45
hgs
parents: 23
diff changeset
   587
		        // This is called whenever the agenda view is opened from the month
hgs
parents: 23
diff changeset
   588
		        // view. Since the agenda view is not added to the mainwindow,
hgs
parents: 23
diff changeset
   589
		        // add the agenda views to mainwindow and set any one of them as 
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   590
		        // current view
45
hgs
parents: 23
diff changeset
   591
		    	if (mCalenAgendaView) {
hgs
parents: 23
diff changeset
   592
		    		mCalenAgendaView->doPopulation();
hgs
parents: 23
diff changeset
   593
		    		mController.MainWindow().addView(mCalenAgendaView);
hgs
parents: 23
diff changeset
   594
		    		mController.MainWindow().setCurrentView(mCalenAgendaView);
hgs
parents: 23
diff changeset
   595
		    		mController.MainWindow().addView(mCalenAgendaViewAlt);
hgs
parents: 23
diff changeset
   596
		    	}
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   597
		    }
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   598
			break;
45
hgs
parents: 23
diff changeset
   599
		case ECalenShowSettings:
hgs
parents: 23
diff changeset
   600
		    mSettingsView->refreshView();
hgs
parents: 23
diff changeset
   601
			break;
hgs
parents: 23
diff changeset
   602
		case ECalenDayView:
hgs
parents: 23
diff changeset
   603
			mCalenDayView->doPopulation();
hgs
parents: 23
diff changeset
   604
			mController.MainWindow().setCurrentView(mCalenDayView);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   605
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   606
	}
51
hgs
parents: 45
diff changeset
   607
	
hgs
parents: 45
diff changeset
   608
	OstTraceFunctionExit0( CALENVIEWMANAGER_ACTIVATECURRENTVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   609
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   610
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   612
// CalenViewManager::launchEventView
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   613
// Launch event view.
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
// (other items were commented in a header).
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
// ----------------------------------------------------------------------------
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
//
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   617
void CalenViewManager::launchEventView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   618
{
51
hgs
parents: 45
diff changeset
   619
    OstTraceFunctionEntry0( CALENVIEWMANAGER_LAUNCHEVENTVIEW_ENTRY );
hgs
parents: 45
diff changeset
   620
    
45
hgs
parents: 23
diff changeset
   621
    // capture cureent view in case app closed/quits from AgendaEventViewer
hgs
parents: 23
diff changeset
   622
    if (mCalenMonthView) {
hgs
parents: 23
diff changeset
   623
    mCalenMonthView->captureScreenshot(true);
hgs
parents: 23
diff changeset
   624
    }
hgs
parents: 23
diff changeset
   625
    else if (mCalenAgendaView) {
hgs
parents: 23
diff changeset
   626
    	mCalenAgendaView->captureScreenshot(true);
hgs
parents: 23
diff changeset
   627
    }
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   628
	MCalenContext& context = mController.Services().Context();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   629
	AgendaEntry viewEntry= mController.Services().agendaInterface()->fetchById(
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   630
			context.instanceId().mEntryLocalUid );
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   631
	if (viewEntry.isRepeating() 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   632
			&& viewEntry.type() != AgendaEntry::TypeTodo) {
45
hgs
parents: 23
diff changeset
   633
		QDateTime startDateTime = context.focusDateAndTime();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   634
		viewEntry.setStartAndEndTime(startDateTime, 
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   635
		                     startDateTime.addSecs(viewEntry.durationInSecs()));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   636
	}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   637
	mCalenEventViewer = new AgendaEventViewer(
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   638
			mController.Services().agendaInterface(), this);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   639
	connect(mCalenEventViewer, SIGNAL(viewingCompleted(const QDate)),
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   640
	        this, SLOT(handleViewingCompleted(const QDate)));
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   641
	connect(mCalenEventViewer, SIGNAL(editingStarted()),
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   642
	        this, SLOT(handleEditingStarted()));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   643
	connect(mCalenEventViewer, SIGNAL(editingCompleted()),
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   644
	        this, SLOT(handleEditingCompleted()));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   645
	connect(mCalenEventViewer, SIGNAL(deletingStarted()),
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   646
		        this, SLOT(handleDeletingStarted()));
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   647
	connect(mCalenEventViewer, SIGNAL(deletingCompleted()),
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   648
			        this, SLOT(handleDeletingCompleted()));
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   649
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   651
	// Launch agenda event viewer
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   652
	mCalenEventViewer->view(viewEntry, AgendaEventViewer::ActionEditDelete);
51
hgs
parents: 45
diff changeset
   653
	OstTraceFunctionExit0( CALENVIEWMANAGER_LAUNCHEVENTVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   654
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
// ----------------------------------------------------------------------------
45
hgs
parents: 23
diff changeset
   657
// CalenViewManager::loadAlternateAgendaView
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   658
// other items were commented in a header
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   660
//
45
hgs
parents: 23
diff changeset
   661
void CalenViewManager::loadAlternateAgendaView()
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   662
{
51
hgs
parents: 45
diff changeset
   663
    OstTraceFunctionEntry0( CALENVIEWMANAGER_LOADALTERNATEAGENDAVIEW_ENTRY );
hgs
parents: 45
diff changeset
   664
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   665
    bool loadSuccess = false;
45
hgs
parents: 23
diff changeset
   666
    // Create the agenda view docloader object.
hgs
parents: 23
diff changeset
   667
    mAgendaViewAltDocLoader = new CalenDocLoader(mController);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   668
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   669
    // Load default section
45
hgs
parents: 23
diff changeset
   670
    mAgendaViewAltDocLoader->load(CALEN_AGENDAVIEW_XML_FILE, &loadSuccess);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   671
    if (!loadSuccess) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   672
        qFatal("calenviewmanager.cpp : Unable to load XML");
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   673
    }
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   674
45
hgs
parents: 23
diff changeset
   675
    // Get the calenagenda view from the loader
hgs
parents: 23
diff changeset
   676
    mCalenAgendaViewAlt = static_cast<CalenAgendaView *> (mAgendaViewAltDocLoader->findWidget(CALEN_AGENDAVIEW));
hgs
parents: 23
diff changeset
   677
    if (!mCalenAgendaViewAlt) {
hgs
parents: 23
diff changeset
   678
        qFatal("calenviewmanager.cpp : Unable to find alternate agenda view");
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   679
    }
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   680
45
hgs
parents: 23
diff changeset
   681
    // Setup the agenda view
hgs
parents: 23
diff changeset
   682
    mCalenAgendaViewAlt->setupView(mAgendaViewAltDocLoader);
51
hgs
parents: 45
diff changeset
   683
    OstTraceFunctionExit0( CALENVIEWMANAGER_LOADALTERNATEAGENDAVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   684
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   685
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   686
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   687
// CalenViewManager::HandleCommandL
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   688
// Handles view manager commands.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   689
// @return ETrue if command is handled, EFalse otherwise
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   690
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   691
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   692
TBool CalenViewManager::HandleCommandL(const TCalenCommand& command)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   693
{
51
hgs
parents: 45
diff changeset
   694
    OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLECOMMANDL_ENTRY );
hgs
parents: 45
diff changeset
   695
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   696
	TBool commandUsed(EFalse);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   697
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   698
	switch (command.Command()) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   699
		case ECalenMonthView:
45
hgs
parents: 23
diff changeset
   700
			// First remove the previous native view before 
hgs
parents: 23
diff changeset
   701
			// we set the mCurrentViewId with the current view
hgs
parents: 23
diff changeset
   702
			removePreviousView();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   703
			// Add month view to mainwindow.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   704
			mController.MainWindow().addView(mCalenMonthView);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   705
			mCurrentViewId = ECalenMonthView;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   706
			activateCurrentView();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   707
			break;
45
hgs
parents: 23
diff changeset
   708
		case ECalenAgendaView:
hgs
parents: 23
diff changeset
   709
			// First remove the previous native view before 
hgs
parents: 23
diff changeset
   710
			// we set the mCurrentViewId with the current view
hgs
parents: 23
diff changeset
   711
			removePreviousView();
hgs
parents: 23
diff changeset
   712
			mCurrentViewId = ECalenAgendaView;
hgs
parents: 23
diff changeset
   713
			activateCurrentView();
hgs
parents: 23
diff changeset
   714
			break;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   715
		case ECalenDayView:
45
hgs
parents: 23
diff changeset
   716
            {
55
hgs
parents: 51
diff changeset
   717
            // First add new view
45
hgs
parents: 23
diff changeset
   718
			mController.MainWindow().addView(mCalenDayView);
55
hgs
parents: 51
diff changeset
   719
			
hgs
parents: 51
diff changeset
   720
			// Removes current view
hgs
parents: 51
diff changeset
   721
		    // Notice: removing view should be done after new view is set as current to
hgs
parents: 51
diff changeset
   722
		    // avoid situation that there is no current view in application
hgs
parents: 51
diff changeset
   723
		    removePreviousView();
hgs
parents: 51
diff changeset
   724
    
hgs
parents: 51
diff changeset
   725
		    // Sets and activates day view
hgs
parents: 51
diff changeset
   726
		    mCurrentViewId = ECalenDayView;
hgs
parents: 51
diff changeset
   727
		    activateCurrentView();
45
hgs
parents: 23
diff changeset
   728
			}
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   729
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   730
		case ECalenEventView:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   731
			launchEventView();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   732
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   733
		case ECalenStartActiveStep:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   734
			activateCurrentView();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   735
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   736
		case ECalenShowNextDay:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   737
		    showNextDay();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   738
		    break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   739
		case ECalenShowPrevDay:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   740
            showPrevDay();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   741
		    break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   742
	}
51
hgs
parents: 45
diff changeset
   743
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLECOMMANDL_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   744
	return commandUsed;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   745
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   746
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   748
// CalenViewManager::HandleNotification
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   749
//  Handles notifications.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   750
// (other items were commented in a header).
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   752
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   753
void CalenViewManager::HandleNotification(
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   754
                                         const TCalenNotification notification)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   755
{
51
hgs
parents: 45
diff changeset
   756
    OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLENOTIFICATION_ENTRY );
hgs
parents: 45
diff changeset
   757
    
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   758
	switch (notification) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   759
		case ECalenNotifyExternalDatabaseChanged:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   760
		case ECalenNotifyDialogClosed:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   761
		case ECalenNotifyMultipleEntriesDeleted:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   762
		case ECalenNotifyEntrySaved:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   763
		case ECalenNotifyEntryDeleted:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   764
		case ECalenNotifyInstanceDeleted:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   765
		case ECalenNotifyEntryClosed:
45
hgs
parents: 23
diff changeset
   766
		case ECalenNotifySystemLocaleChanged:
55
hgs
parents: 51
diff changeset
   767
		case ECalenNotifySystemTimeChanged:
51
hgs
parents: 45
diff changeset
   768
		case ECalenNotifySystemLanguageChanged: {
55
hgs
parents: 51
diff changeset
   769
hgs
parents: 51
diff changeset
   770
			if (notification == ECalenNotifySystemTimeChanged) {
hgs
parents: 51
diff changeset
   771
				MCalenContext &context = mController.context();
hgs
parents: 51
diff changeset
   772
				QDateTime defaultTime = context.defaultCalTimeForViewsL();
hgs
parents: 51
diff changeset
   773
				context.setFocusDateAndTime(defaultTime);
hgs
parents: 51
diff changeset
   774
			}
hgs
parents: 51
diff changeset
   775
			activateCurrentView();
hgs
parents: 51
diff changeset
   776
			if (mCalenMonthView) {
hgs
parents: 51
diff changeset
   777
				mCalenMonthView->captureScreenshot();
hgs
parents: 51
diff changeset
   778
			} else if (mCalenAgendaView) {
hgs
parents: 51
diff changeset
   779
				mCalenAgendaView->captureScreenshot();
hgs
parents: 51
diff changeset
   780
			}
51
hgs
parents: 45
diff changeset
   781
		}
45
hgs
parents: 23
diff changeset
   782
		    break;
51
hgs
parents: 45
diff changeset
   783
		case ECalenNotifySettingsClosed: {
45
hgs
parents: 23
diff changeset
   784
		    //when setting view closed , switch to the previous view
hgs
parents: 23
diff changeset
   785
		    mCurrentViewId = mPreviousViewsId ;
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   786
			mController.Services().IssueCommandL(ECalenStartActiveStep);
45
hgs
parents: 23
diff changeset
   787
			
hgs
parents: 23
diff changeset
   788
			 // invalidate captured screenshots as either agenda view is activated now
hgs
parents: 23
diff changeset
   789
			if (mCalenMonthView) {
hgs
parents: 23
diff changeset
   790
			mCalenMonthView->captureScreenshot();
hgs
parents: 23
diff changeset
   791
			} else if (mCalenAgendaView) {
hgs
parents: 23
diff changeset
   792
				mCalenAgendaView->captureScreenshot();
hgs
parents: 23
diff changeset
   793
			}
hgs
parents: 23
diff changeset
   794
hgs
parents: 23
diff changeset
   795
		    }
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   796
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   797
		default:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   798
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   799
	}
51
hgs
parents: 45
diff changeset
   800
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLENOTIFICATION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   801
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   803
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   804
// CalenViewManager::settingsView
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   805
//  Returns the settings view
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   806
// (other items were commented in a header).
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   808
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   809
CalenSettingsView* CalenViewManager::settingsView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   810
{
51
hgs
parents: 45
diff changeset
   811
    OstTraceFunctionEntry0( CALENVIEWMANAGER_SETTINGSVIEW_ENTRY );
hgs
parents: 45
diff changeset
   812
    
hgs
parents: 45
diff changeset
   813
	OstTraceFunctionExit0( CALENVIEWMANAGER_SETTINGSVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   814
	return mSettingsView;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   815
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   816
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   817
// ----------------------------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   818
// CalenViewManager::handleViewingCompleted
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   819
//  Slot to handle signal viewingCompleted by the agenda event viewer
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   820
// (other items were commented in a header).
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   821
// ----------------------------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   822
//
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   823
void CalenViewManager::handleViewingCompleted(const QDate date)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   824
{
55
hgs
parents: 51
diff changeset
   825
	Q_UNUSED(date);
51
hgs
parents: 45
diff changeset
   826
	OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEVIEWINGCOMPLETED_ENTRY );
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   827
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   828
	// Cleanup.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   829
	mCalenEventViewer->deleteLater();
55
hgs
parents: 51
diff changeset
   830
	if (!date.isNull() && date.isValid()) {
hgs
parents: 51
diff changeset
   831
	    mController.Services().Context().setFocusDate(QDateTime(date));
hgs
parents: 51
diff changeset
   832
	}
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   833
	mController.Services().IssueNotificationL(ECalenNotifyEntryClosed);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   834
	
45
hgs
parents: 23
diff changeset
   835
	// invalidate captured screenshots as either agenda view is activated now
hgs
parents: 23
diff changeset
   836
	if (mCalenMonthView) {
hgs
parents: 23
diff changeset
   837
	mCalenMonthView->captureScreenshot();
hgs
parents: 23
diff changeset
   838
	} else if (mCalenAgendaView) {
hgs
parents: 23
diff changeset
   839
		mCalenAgendaView->captureScreenshot();
hgs
parents: 23
diff changeset
   840
	}
51
hgs
parents: 45
diff changeset
   841
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEVIEWINGCOMPLETED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   842
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   843
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   844
// ----------------------------------------------------------------------------
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   845
// CalenViewManager::handleEditingStarted
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   846
//  Slot to handle signal editingStarted by the agenda event viewer
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   847
// (other items were commented in a header).
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
// ----------------------------------------------------------------------------
18
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
void CalenViewManager::handleEditingStarted()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   851
{
51
hgs
parents: 45
diff changeset
   852
	OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEEDITINGSTARTED_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   853
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   854
	mController.IssueCommandL(ECalenEditEntryFromViewer);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   855
	
51
hgs
parents: 45
diff changeset
   856
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEEDITINGSTARTED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   857
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   858
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   859
// ----------------------------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   860
// CalenViewManager::handleEditingCompleted
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   861
//  Slot to handle signal editingCompleted by the agenda event viewer
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   862
// (other items were commented in a header).
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   863
// ----------------------------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   864
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   865
void CalenViewManager::handleEditingCompleted()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   866
{
51
hgs
parents: 45
diff changeset
   867
	OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEEDITINGCOMPLETED_ENTRY );
18
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
	mController.Services().IssueNotificationL(ECalenNotifyEditorClosedFromViewer);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   870
	
51
hgs
parents: 45
diff changeset
   871
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEEDITINGCOMPLETED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   872
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
18
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
// CalenViewManager::handleDeletingStarted
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   876
//  Slot to handle signal deletingStarted by the agenda event viewer
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   877
// (other items were commented in a header).
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   878
// ----------------------------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   879
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   880
void CalenViewManager::handleDeletingStarted()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   881
{
51
hgs
parents: 45
diff changeset
   882
	OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEDELETINGSTARTED_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   883
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   884
	mController.IssueCommandL(ECalenDeleteEntryFromViewer);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   885
	
51
hgs
parents: 45
diff changeset
   886
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEDELETINGSTARTED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   887
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   888
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   889
// ----------------------------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   890
// CalenViewManager::handleDeletingCompleted
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   891
//  Slot to handle signal deletingCompleted by the agenda event viewer
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   892
// (other items were commented in a header).
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   893
// ----------------------------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   894
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   895
void CalenViewManager::handleDeletingCompleted()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   896
{
51
hgs
parents: 45
diff changeset
   897
	OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEDELETINGCOMPLETED_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   898
	
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   899
	mController.Services().IssueNotificationL(ECalenNotifyEntryDeleted);
45
hgs
parents: 23
diff changeset
   900
hgs
parents: 23
diff changeset
   901
	// invalidate captured screenshots as either month view or agenda view is activated now
hgs
parents: 23
diff changeset
   902
    if (mCalenMonthView) {
hgs
parents: 23
diff changeset
   903
    mCalenMonthView->captureScreenshot();
hgs
parents: 23
diff changeset
   904
    } else if (mCalenAgendaView) {
hgs
parents: 23
diff changeset
   905
    	mCalenAgendaView->captureScreenshot();
hgs
parents: 23
diff changeset
   906
    }
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   907
	
51
hgs
parents: 45
diff changeset
   908
    OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEDELETINGCOMPLETED_EXIT );
45
hgs
parents: 23
diff changeset
   909
}
hgs
parents: 23
diff changeset
   910
hgs
parents: 23
diff changeset
   911
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   912
// CalenViewManager::handleInstanceViewCreation
hgs
parents: 23
diff changeset
   913
//  Slot to handle completion of instance view creation
hgs
parents: 23
diff changeset
   914
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   915
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   916
//
hgs
parents: 23
diff changeset
   917
void CalenViewManager::handleInstanceViewCreation(int status)
hgs
parents: 23
diff changeset
   918
{
51
hgs
parents: 45
diff changeset
   919
    OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEINSTANCEVIEWCREATION_ENTRY );
hgs
parents: 45
diff changeset
   920
    
45
hgs
parents: 23
diff changeset
   921
	Q_UNUSED(status);
hgs
parents: 23
diff changeset
   922
	// handleInstanceViewCreation function is called only once. Now that the instance
hgs
parents: 23
diff changeset
   923
	// view creation is successfull. Events need to be populated on screen
hgs
parents: 23
diff changeset
   924
	// Ideal colution should be to call a uniform function, e.g. PopulateEvents
hgs
parents: 23
diff changeset
   925
	// where PopulateEvents should be implemeted by all views. Since the current
hgs
parents: 23
diff changeset
   926
	// solution for the month view implements the construction in two phases so 
hgs
parents: 23
diff changeset
   927
	// it needs to be refactored and a common solution needs to be put here. So 
hgs
parents: 23
diff changeset
   928
	// that code doesn't break if another view is added tomorow
hgs
parents: 23
diff changeset
   929
	if (mCalenMonthView) {
hgs
parents: 23
diff changeset
   930
		mCalenMonthView->fetchEntriesAndUpdateModel();
hgs
parents: 23
diff changeset
   931
	}
hgs
parents: 23
diff changeset
   932
	else if (mCalenAgendaView) {
hgs
parents: 23
diff changeset
   933
		mCalenAgendaView->doPopulation();
hgs
parents: 23
diff changeset
   934
	}
55
hgs
parents: 51
diff changeset
   935
	// Calls the emitAppReady function of CalenController. Need to emit this
hgs
parents: 51
diff changeset
   936
	// signal after the view is fully constructed & populated
hgs
parents: 51
diff changeset
   937
	// with actual data and ready to be used. So entry view & instance view
hgs
parents: 51
diff changeset
   938
	// needs to be created so that a new entry can also be created. Finally
hgs
parents: 51
diff changeset
   939
	// NotesApplication object needs to emit applicationReady Signal.
hgs
parents: 51
diff changeset
   940
	mController.emitAppReady();
51
hgs
parents: 45
diff changeset
   941
	
hgs
parents: 45
diff changeset
   942
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEINSTANCEVIEWCREATION_EXIT );
45
hgs
parents: 23
diff changeset
   943
}
hgs
parents: 23
diff changeset
   944
hgs
parents: 23
diff changeset
   945
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   946
// CalenViewManager::handleDeletingCompleted
hgs
parents: 23
diff changeset
   947
//  Slot to handle completion of entry view creation
hgs
parents: 23
diff changeset
   948
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   949
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
   950
//
hgs
parents: 23
diff changeset
   951
void CalenViewManager::handleEntryViewCreation(int status)
hgs
parents: 23
diff changeset
   952
{
51
hgs
parents: 45
diff changeset
   953
    OstTraceFunctionEntry0( CALENVIEWMANAGER_HANDLEENTRYVIEWCREATION_ENTRY );
hgs
parents: 45
diff changeset
   954
    
45
hgs
parents: 23
diff changeset
   955
	// Nothing Yet
hgs
parents: 23
diff changeset
   956
	Q_UNUSED(status);
51
hgs
parents: 45
diff changeset
   957
hgs
parents: 45
diff changeset
   958
	OstTraceFunctionExit0( CALENVIEWMANAGER_HANDLEENTRYVIEWCREATION_EXIT );
45
hgs
parents: 23
diff changeset
   959
}
hgs
parents: 23
diff changeset
   960
hgs
parents: 23
diff changeset
   961
// ----------------------------------------------------------------------------
51
hgs
parents: 45
diff changeset
   962
// CalenViewManager::handleEntriesChanged
hgs
parents: 45
diff changeset
   963
// this function will be called when someone else has changed the database
hgs
parents: 45
diff changeset
   964
// ----------------------------------------------------------------------------
hgs
parents: 45
diff changeset
   965
//
hgs
parents: 45
diff changeset
   966
void CalenViewManager::handleEntriesChanged(QList<ulong> ids)
hgs
parents: 45
diff changeset
   967
{
55
hgs
parents: 51
diff changeset
   968
	Q_UNUSED(ids);
51
hgs
parents: 45
diff changeset
   969
	// Update and refresh the view.
hgs
parents: 45
diff changeset
   970
	activateCurrentView();
45
hgs
parents: 23
diff changeset
   971
}
hgs
parents: 23
diff changeset
   972
hgs
parents: 23
diff changeset
   973
// ----------------------------------------------------------------------------
55
hgs
parents: 51
diff changeset
   974
// CalenViewManager::handleEntryUpdation
hgs
parents: 51
diff changeset
   975
// this function will be called when any entry is updated or added into database
hgs
parents: 51
diff changeset
   976
// Here we need to set the context to the entry updated or added.
hgs
parents: 51
diff changeset
   977
// ----------------------------------------------------------------------------
hgs
parents: 51
diff changeset
   978
//
hgs
parents: 51
diff changeset
   979
void CalenViewManager::handleEntryUpdation(ulong id)
hgs
parents: 51
diff changeset
   980
{
hgs
parents: 51
diff changeset
   981
    AgendaEntry updatedEntry = mController.agendaInterface()->fetchById(id);
hgs
parents: 51
diff changeset
   982
hgs
parents: 51
diff changeset
   983
    // Agenda entry is not null then refresh the view else close event viewer
hgs
parents: 51
diff changeset
   984
    if (!updatedEntry.isNull()) {
hgs
parents: 51
diff changeset
   985
        if (AgendaEntry::TypeTodo != updatedEntry.type()) {
hgs
parents: 51
diff changeset
   986
            QDate date = updatedEntry.startTime().date();
hgs
parents: 51
diff changeset
   987
            if (!date.isNull() && date.isValid()) {
hgs
parents: 51
diff changeset
   988
                mController.Services().Context().setFocusDate(QDateTime(date));
hgs
parents: 51
diff changeset
   989
            }
hgs
parents: 51
diff changeset
   990
        }
hgs
parents: 51
diff changeset
   991
    }
hgs
parents: 51
diff changeset
   992
hgs
parents: 51
diff changeset
   993
}
hgs
parents: 51
diff changeset
   994
hgs
parents: 51
diff changeset
   995
// ----------------------------------------------------------------------------
45
hgs
parents: 23
diff changeset
   996
// CalenViewManager::launchSettingsView
hgs
parents: 23
diff changeset
   997
// Launches settings view
hgs
parents: 23
diff changeset
   998
// (other items were commented in a header).
hgs
parents: 23
diff changeset
   999
// ----------------------------------------------------------------------------
hgs
parents: 23
diff changeset
  1000
//
hgs
parents: 23
diff changeset
  1001
void CalenViewManager::launchSettingsView()
hgs
parents: 23
diff changeset
  1002
{
51
hgs
parents: 45
diff changeset
  1003
    OstTraceFunctionEntry0( CALENVIEWMANAGER_LAUNCHSETTINGSVIEW_ENTRY );
hgs
parents: 45
diff changeset
  1004
    
45
hgs
parents: 23
diff changeset
  1005
    mPreviousViewsId = mCurrentViewId ;  
hgs
parents: 23
diff changeset
  1006
    mCurrentViewId = ECalenShowSettings;
hgs
parents: 23
diff changeset
  1007
    mSettingsView->initializeForm();
hgs
parents: 23
diff changeset
  1008
    mController.Services().MainWindow().setCurrentView(mSettingsView);
hgs
parents: 23
diff changeset
  1009
    
hgs
parents: 23
diff changeset
  1010
    // capture cureent view in case app closed/quits from settings view
hgs
parents: 23
diff changeset
  1011
    if (mCalenMonthView){
hgs
parents: 23
diff changeset
  1012
    mCalenMonthView->captureScreenshot(true);
hgs
parents: 23
diff changeset
  1013
    } else if(mCalenAgendaView){
hgs
parents: 23
diff changeset
  1014
    	mCalenAgendaView->captureScreenshot(true);
hgs
parents: 23
diff changeset
  1015
    }
51
hgs
parents: 45
diff changeset
  1016
    
hgs
parents: 45
diff changeset
  1017
    OstTraceFunctionExit0( CALENVIEWMANAGER_LAUNCHSETTINGSVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1018
}
0
f979ecb2b13e Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1019
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
  1020
// End of file	--Don't remove this.