|
1 /* |
|
2 * Copyright (c) 2007 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: Singleton |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include <msvapi.h> // CMsvSession |
|
23 #include <mtclreg.h> // CClientMtmRegistry |
|
24 #include <mtuireg.h> // CMtmUiRegistry |
|
25 #include <mtudreg.h> // CMtmUiDataRegistry |
|
26 |
|
27 #include <senduisingleton.h> |
|
28 |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS =============================== |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CSendUiSingleton::CSendUiSingleton |
|
36 // C++ default constructor can NOT contain any code, that |
|
37 // might leave. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CSendUiSingleton::CSendUiSingleton() |
|
41 { |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CSendUiSingleton::ConstructL |
|
46 // Symbian 2nd phase constructor can leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 void CSendUiSingleton::ConstructL() |
|
50 { |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CSendUiSingleton::NewL |
|
55 // Two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 EXPORT_C CSendUiSingleton* CSendUiSingleton::NewL() |
|
59 { |
|
60 CSendUiSingleton* self = new (ELeave) CSendUiSingleton; |
|
61 CleanupStack::PushL( self ); |
|
62 self->ConstructL(); |
|
63 CleanupStack::Pop( self ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CSendUiSingleton::~CSendUiSingleton |
|
69 // Destructor |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CSendUiSingleton::~CSendUiSingleton() |
|
73 { |
|
74 // Deletion order is significant. |
|
75 delete iMtmUiDataRegistry; |
|
76 delete iMtmUiRegistry; |
|
77 delete iClientMtmRegistry; |
|
78 delete iMsvSession; |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CSendUiSingleton::MsvSessionL |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 EXPORT_C CMsvSession& CSendUiSingleton::MsvSessionL() |
|
86 { |
|
87 if ( !iMsvSession ) |
|
88 { |
|
89 iMsvSession = CMsvSession::OpenSyncL( *this ); |
|
90 } |
|
91 return *iMsvSession; |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CSendUiSingleton::ClientMtmRegistryL |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 EXPORT_C CClientMtmRegistry& CSendUiSingleton::ClientMtmRegistryL() |
|
99 { |
|
100 if ( !iClientMtmRegistry ) |
|
101 { |
|
102 iClientMtmRegistry = CClientMtmRegistry::NewL( MsvSessionL() ); |
|
103 } |
|
104 return *iClientMtmRegistry; |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CSendUiSingleton::MtmUiRegistryL |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 EXPORT_C CMtmUiRegistry& CSendUiSingleton::MtmUiRegistryL() |
|
112 { |
|
113 if ( !iMtmUiRegistry ) |
|
114 { |
|
115 iMtmUiRegistry = CMtmUiRegistry::NewL( MsvSessionL() ); |
|
116 } |
|
117 return *iMtmUiRegistry; |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CSendUiSingleton::MtmUiDataRegistryL |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C CMtmUiDataRegistry& CSendUiSingleton::MtmUiDataRegistryL() |
|
125 { |
|
126 if ( !iMtmUiDataRegistry ) |
|
127 { |
|
128 iMtmUiDataRegistry = CMtmUiDataRegistry::NewL( MsvSessionL() ); |
|
129 } |
|
130 return *iMtmUiDataRegistry; |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CSendUiSingleton::MsvSessionL |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 void CSendUiSingleton::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) |
|
138 { |
|
139 } |
|
140 |
|
141 |
|
142 // End of File |