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