notes/notesui/notesappcontroller/src/notesappcontroller.cpp
branchRCL_3
changeset 65 12af337248b1
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: This is the Definition file for NotesAppController class.
       
    15 *
       
    16 */
       
    17 
       
    18 // User includes
       
    19 #include "notesappcontroller.h"
       
    20 #include "notesappcontrollerifimpl.h"
       
    21 #include "notesviewmanager.h"
       
    22 #include "notesmodelhandler.h"
       
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "notesappcontrollerTraces.h"
       
    26 #endif
       
    27 
       
    28 
       
    29 /*!
       
    30 	\class NotesAppController
       
    31 
       
    32 	This is the heart of notes application. It constructs and owns the
       
    33 	NotesViewManager and NotesModelHandler objects.
       
    34  */
       
    35 
       
    36 /*!
       
    37 	Default constructor.
       
    38  */
       
    39 NotesAppController::NotesAppController(QObject *parent)
       
    40 :QObject(parent),
       
    41  mViewManager(0),
       
    42  mNotesModelHandler(0),
       
    43  mIfImpl(0)
       
    44 {
       
    45 	OstTraceFunctionEntry0( NOTESAPPCONTROLLER_NOTESAPPCONTROLLER_ENTRY );
       
    46 	// Construct the interface implementation.
       
    47 	mIfImpl = new NotesAppControllerIfImpl(this);
       
    48 
       
    49 	// Construct the model handler.
       
    50 	mNotesModelHandler = new NotesModelHandler(this);
       
    51 	Q_ASSERT_X(
       
    52 			mNotesModelHandler, "notesappcontroller.cpp",
       
    53 			"NotesModelHandler is 0");
       
    54 
       
    55 	// Construct the view manager.
       
    56 	mViewManager = new NotesViewManager(*mIfImpl, this);
       
    57 	Q_ASSERT_X(
       
    58 			mViewManager, "notesappcontroller.cpp",
       
    59 			"NotesViewManager is 0");
       
    60 	connect(mViewManager, SIGNAL(appReady()), this, SLOT(handleAppReady()));
       
    61 	OstTraceFunctionExit0( NOTESAPPCONTROLLER_NOTESAPPCONTROLLER_EXIT );
       
    62 }
       
    63 
       
    64 /*!
       
    65 	Destructor.
       
    66  */
       
    67 NotesAppController::~NotesAppController()
       
    68 {
       
    69 	OstTraceFunctionEntry0( DUP1_NOTESAPPCONTROLLER_NOTESAPPCONTROLLER_ENTRY );
       
    70 	if (mViewManager) {
       
    71 		delete mViewManager;
       
    72 		mViewManager = 0;
       
    73 	}
       
    74 	if (mNotesModelHandler) {
       
    75 		delete mNotesModelHandler;
       
    76 		mNotesModelHandler = 0;
       
    77 	}
       
    78 	if (mIfImpl) {
       
    79 		delete mIfImpl;
       
    80 		mIfImpl = 0;
       
    81 	}
       
    82 	OstTraceFunctionExit0( DUP1_NOTESAPPCONTROLLER_NOTESAPPCONTROLLER_EXIT );
       
    83 }
       
    84 
       
    85 /*!
       
    86 	Emits the appReday signal.
       
    87  */
       
    88 void NotesAppController::handleAppReady()
       
    89 {
       
    90 	OstTraceFunctionEntry0( NOTESAPPCONTROLLER_HANDLEAPPREADY_ENTRY );
       
    91 	emit appReady();
       
    92 	disconnect(mViewManager, SIGNAL(appReady()), this, SLOT(handleAppReady()));
       
    93 	OstTraceFunctionExit0( NOTESAPPCONTROLLER_HANDLEAPPREADY_EXIT );
       
    94 }
       
    95 
       
    96 // End of file	--Don't remove this.