|
1 /* |
|
2 * Copyright (c) 2006 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: Document class of chat application |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CCADocument.h" |
|
21 #include "CCAAppUi.h" |
|
22 #include "CCAEngine.h" |
|
23 #include "ChatDebugPrint.h" |
|
24 #include "MCAProcessManager.h" |
|
25 #include "CCAProcessManagerFactory.h" |
|
26 |
|
27 #include <bautils.h> |
|
28 #include <ErrorUI.h> |
|
29 |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ======================= |
|
32 |
|
33 // Two-phased constructor. |
|
34 CCADocument* CCADocument::NewL( |
|
35 CEikApplication& aApp ) // CChatClientApp reference |
|
36 { |
|
37 CHAT_DP_FUNC_ENTER( "NewL" ); |
|
38 CCADocument* self = new ( ELeave ) CCADocument( aApp ); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop( self ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // destructor |
|
46 CCADocument::~CCADocument() |
|
47 { |
|
48 CHAT_DP_TXT( "Application engine destruction starting" ); |
|
49 CCAProcessManagerFactory::ReleaseResources(); |
|
50 CHAT_DP_TXT( "Application engine destruction done" ); |
|
51 } |
|
52 |
|
53 // Symbian OS default constructor can leave. |
|
54 void CCADocument::ConstructL() |
|
55 { |
|
56 CHAT_DP_TXT( "Application engine construction starting" ); |
|
57 |
|
58 TRAPD( err, iProcessManager = CCAProcessManagerFactory::InstanceL()->GetProcessManager() ); |
|
59 if ( err ) |
|
60 { |
|
61 // Framework is not capable of showing the errornote if user leaves. |
|
62 // Using CErrorUI, which matches the errorcode passed with coreesponding error string |
|
63 // and displays the note. |
|
64 |
|
65 CErrorUI* errorUI = CErrorUI::NewLC( ); |
|
66 errorUI->ShowGlobalErrorNoteL( err ); |
|
67 CleanupStack::PopAndDestroy( errorUI ); |
|
68 User::Leave( err ); |
|
69 } |
|
70 |
|
71 iEngine = iProcessManager->GetEngine(); |
|
72 CHAT_DP_TXT( "Application engine construction done" ); |
|
73 } |
|
74 |
|
75 // ---------------------------------------------------- |
|
76 // CCADocument::CreateAppUiL() |
|
77 // constructs CChatClientAppUi |
|
78 // ---------------------------------------------------- |
|
79 // |
|
80 CEikAppUi* CCADocument::CreateAppUiL() |
|
81 { |
|
82 return new ( ELeave ) CCAAppUi( *iEngine, *iProcessManager ); |
|
83 } |
|
84 |
|
85 // End of File |