clock/clockui/clockviewmanager/src/clockviewmanager.cpp
author hgs
Tue, 05 Oct 2010 13:57:00 +0530
changeset 81 ce92091cbd61
parent 63 a3cb48f6c889
permissions -rw-r--r--
201039
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
c198609911f9 Revision: 201011
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".
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
* Definition file for class ClockViewManager.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
*/
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
// System includes
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <HbMainWindow>
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <HbInstance>
55
hgs
parents: 45
diff changeset
    22
#include <HbApplication>
hgs
parents: 45
diff changeset
    23
#include <HbActivityManager>
hgs
parents: 45
diff changeset
    24
#include <HbToolBar>
81
hgs
parents: 63
diff changeset
    25
#include <AfActivation.h>
hgs
parents: 63
diff changeset
    26
#include <AfActivityStorage.h>
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
// User includes
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include "clockviewmanager.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include "clockdocloader.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include "clockmainview.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include "clockcommon.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include "clockdatatypes.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include "clockworldview.h"
57
hgs
parents: 55
diff changeset
    35
#include "OstTraceDefinitions.h"
hgs
parents: 55
diff changeset
    36
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents: 55
diff changeset
    37
#include "clockviewmanagerTraces.h"
hgs
parents: 55
diff changeset
    38
#endif
hgs
parents: 55
diff changeset
    39
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
	\class ClockViewManager
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
	This is the heart of the clock application. This is responsible for
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
	managing the clock views.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
	Constructor.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
	\param controller A reference to the object of ClockAppController.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
ClockViewManager::ClockViewManager(
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
		ClockAppControllerIf &controllerIf, QObject *parent)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
:QObject(parent),
45
hgs
parents: 18
diff changeset
    56
 mAppControllerIf(controllerIf),
hgs
parents: 18
diff changeset
    57
 mWorldClockView(0)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
{
57
hgs
parents: 55
diff changeset
    59
    OstTraceFunctionEntry0( CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_ENTRY );
45
hgs
parents: 18
diff changeset
    60
    // Activity Reason from Activity Manager
81
hgs
parents: 63
diff changeset
    61
    AfActivation *activation = new AfActivation();
hgs
parents: 63
diff changeset
    62
hgs
parents: 63
diff changeset
    63
    if (Af::ActivationReasonActivity == activation->reason()) {
45
hgs
parents: 18
diff changeset
    64
        // Application is started from an activity
hgs
parents: 18
diff changeset
    65
		// extract activity data
81
hgs
parents: 63
diff changeset
    66
        AfActivityStorage *activitystorage = new AfActivityStorage();
hgs
parents: 63
diff changeset
    67
        QVariant data = activitystorage->activityData(activation->name());
hgs
parents: 63
diff changeset
    68
        delete activitystorage;
45
hgs
parents: 18
diff changeset
    69
        // restore state from activity data
hgs
parents: 18
diff changeset
    70
        QByteArray serializedModel = data.toByteArray();
hgs
parents: 18
diff changeset
    71
        QDataStream stream(&serializedModel, QIODevice::ReadOnly);
hgs
parents: 18
diff changeset
    72
        int activityId;
hgs
parents: 18
diff changeset
    73
        stream >> activityId;
hgs
parents: 18
diff changeset
    74
        
hgs
parents: 18
diff changeset
    75
        if (MainView == activityId) {
hgs
parents: 18
diff changeset
    76
            // Load the main view at the start up.
hgs
parents: 18
diff changeset
    77
            loadMainView();
hgs
parents: 18
diff changeset
    78
			// Delay loading of other views till main view is loaded.
hgs
parents: 18
diff changeset
    79
        	HbMainWindow *window = hbInstance->allMainWindows().first();
hgs
parents: 18
diff changeset
    80
        	connect(
hgs
parents: 18
diff changeset
    81
                window, SIGNAL(viewReady()),
hgs
parents: 18
diff changeset
    82
                this, SLOT(loadOtherViews()));
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
45
hgs
parents: 18
diff changeset
    84
        }
hgs
parents: 18
diff changeset
    85
        else if (WorldClock == activityId) {
hgs
parents: 18
diff changeset
    86
            //no implentation yet, UI specs are not clear
hgs
parents: 18
diff changeset
    87
        }
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
45
hgs
parents: 18
diff changeset
    89
    }
hgs
parents: 18
diff changeset
    90
    else {
hgs
parents: 18
diff changeset
    91
        // Load the main view at the start up.
hgs
parents: 18
diff changeset
    92
        loadMainView();
hgs
parents: 18
diff changeset
    93
        // Delay loading of other views till main view is loaded.
hgs
parents: 18
diff changeset
    94
        HbMainWindow *window = hbInstance->allMainWindows().first();
hgs
parents: 18
diff changeset
    95
        connect(
hgs
parents: 18
diff changeset
    96
                window, SIGNAL(viewReady()),
hgs
parents: 18
diff changeset
    97
                this, SLOT(loadOtherViews()));
hgs
parents: 18
diff changeset
    98
    }
81
hgs
parents: 63
diff changeset
    99
delete activation;
57
hgs
parents: 55
diff changeset
   100
OstTraceFunctionExit0( CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
	Destructor.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
ClockViewManager::~ClockViewManager()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
{
57
hgs
parents: 55
diff changeset
   108
	OstTraceFunctionEntry0( DUP1_CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
	// No implementation yet.
57
hgs
parents: 55
diff changeset
   110
OstTraceFunctionExit0( DUP1_CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
	Switches to view specified by view.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
	\param view View Id.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
void ClockViewManager::showView(ClockViews view)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
{
57
hgs
parents: 55
diff changeset
   120
	OstTraceFunctionEntry0( CLOCKVIEWMANAGER_SHOWVIEW_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
	HbMainWindow *window = hbInstance->allMainWindows().first();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
	switch (view) {
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
		case MainView:
45
hgs
parents: 18
diff changeset
   125
		    // set captured screenshot as invalid as main view 
hgs
parents: 18
diff changeset
   126
			// is the current view
hgs
parents: 18
diff changeset
   127
		    mMainView->captureScreenShot(false);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
			window->removeView(window->currentView());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
			window->addView(mMainView);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
			window->setCurrentView(mMainView);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
		case WorldClock:
45
hgs
parents: 18
diff changeset
   134
		    if (mMainView) {
hgs
parents: 18
diff changeset
   135
				// capture main view as the screenshot for future use 
hgs
parents: 18
diff changeset
   136
				// to save the main view as an activity, if application is 
hgs
parents: 18
diff changeset
   137
				// exited/Quit from world view
hgs
parents: 18
diff changeset
   138
                mMainView->captureScreenShot(true);
hgs
parents: 18
diff changeset
   139
		    }
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
			window->removeView(window->currentView());
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
			window->addView(mWorldClockView);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
			window->setCurrentView(mWorldClockView);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
		default:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
			break;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
	}
57
hgs
parents: 55
diff changeset
   148
OstTraceFunctionExit0( CLOCKVIEWMANAGER_SHOWVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
	Loads the clock main view.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
void ClockViewManager::loadMainView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
{
57
hgs
parents: 55
diff changeset
   156
	OstTraceFunctionEntry0( CLOCKVIEWMANAGER_LOADMAINVIEW_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
	bool loadSuccess;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
	// Construct the document loader instance
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
	ClockDocLoader *docLoader = new ClockDocLoader();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
	// Load the application xml.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
	docLoader->load(CLOCK_MAIN_VIEW_DOCML, &loadSuccess);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
	// Find the main view.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
	mMainView = static_cast<ClockMainView *> (
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
			docLoader->findWidget(CLOCK_MAIN_VIEW));
63
hgs
parents: 57
diff changeset
   168
	mMainView->setParent(this);
55
hgs
parents: 45
diff changeset
   169
	
hgs
parents: 45
diff changeset
   170
	// Disable animation effect on toolbar.
hgs
parents: 45
diff changeset
   171
	HbEffect::disable(mMainView->toolBar()->graphicsItem());
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
	// Setup the view.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
	mMainView->setupView(mAppControllerIf, docLoader);
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
45
hgs
parents: 18
diff changeset
   176
	// Set the main view to the window
hgs
parents: 18
diff changeset
   177
	hbInstance->allMainWindows().first()->addView(mMainView);
57
hgs
parents: 55
diff changeset
   178
OstTraceFunctionExit0( CLOCKVIEWMANAGER_LOADMAINVIEW_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
/*!
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
	Loads the world clock view.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
 */
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
void ClockViewManager::loadWorldClockView()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
{
57
hgs
parents: 55
diff changeset
   186
	OstTraceFunctionEntry0( CLOCKVIEWMANAGER_LOADWORLDCLOCKVIEW_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
	// Construct the document loader instance
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
	ClockDocLoader *docLoader = new ClockDocLoader();
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
	bool loadSuccess;
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
	// Construct the world list view from doc loader.
45
hgs
parents: 18
diff changeset
   193
	docLoader->load(CLOCK_WORLD_VIEW_DOCML, &loadSuccess);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
	// Get the world list view.
45
hgs
parents: 18
diff changeset
   196
	mWorldClockView = static_cast<ClockWorldView *> (
hgs
parents: 18
diff changeset
   197
			docLoader->findWidget(CLOCK_WORLD_VIEW));
63
hgs
parents: 57
diff changeset
   198
	mWorldClockView->setParent(this);
55
hgs
parents: 45
diff changeset
   199
	
hgs
parents: 45
diff changeset
   200
	// Disable animation effect on toolbar.
hgs
parents: 45
diff changeset
   201
	HbEffect::disable(mWorldClockView->toolBar()->graphicsItem());
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
	mWorldClockView->setupView(mAppControllerIf, docLoader);
57
hgs
parents: 55
diff changeset
   204
OstTraceFunctionExit0( CLOCKVIEWMANAGER_LOADWORLDCLOCKVIEW_EXIT );
45
hgs
parents: 18
diff changeset
   205
}
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
45
hgs
parents: 18
diff changeset
   207
/*!
hgs
parents: 18
diff changeset
   208
	Load other views
hgs
parents: 18
diff changeset
   209
 */
hgs
parents: 18
diff changeset
   210
void ClockViewManager::loadOtherViews()
hgs
parents: 18
diff changeset
   211
{
57
hgs
parents: 55
diff changeset
   212
	OstTraceFunctionEntry0( CLOCKVIEWMANAGER_LOADOTHERVIEWS_ENTRY );
45
hgs
parents: 18
diff changeset
   213
	mMainView->setupAfterViewReady();
hgs
parents: 18
diff changeset
   214
	
hgs
parents: 18
diff changeset
   215
	// Load world clock view
hgs
parents: 18
diff changeset
   216
	loadWorldClockView();
hgs
parents: 18
diff changeset
   217
hgs
parents: 18
diff changeset
   218
	// Disconnect the signal viewReady as all the views are loaded.
hgs
parents: 18
diff changeset
   219
	HbMainWindow *window = hbInstance->allMainWindows().first();
hgs
parents: 18
diff changeset
   220
	disconnect(
hgs
parents: 18
diff changeset
   221
			window, SIGNAL(viewReady()),
hgs
parents: 18
diff changeset
   222
			this, SLOT(loadOtherViews()));
55
hgs
parents: 45
diff changeset
   223
	
hgs
parents: 45
diff changeset
   224
	// Need to emit this signal after the view is fully constructed & populated
hgs
parents: 45
diff changeset
   225
	// with actual data and ready to be used. So entry view & instance view
hgs
parents: 45
diff changeset
   226
	// needs to be created so that a new entry can also be created. Finally
hgs
parents: 45
diff changeset
   227
	// NotesApplication object needs to emit applicationReady Signal.
hgs
parents: 45
diff changeset
   228
	emit appReady();
57
hgs
parents: 55
diff changeset
   229
OstTraceFunctionExit0( CLOCKVIEWMANAGER_LOADOTHERVIEWS_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
// End of file	--Don't remove this.