|
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: Command for Login/Logout/Exit |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CCALoginCmd.h" |
|
21 #include "MCALoginPC.h" |
|
22 #include "MCAProcessManager.h" |
|
23 #include "CCASessionHandlerCmd.h" |
|
24 #include "MCAUiLoginCmdCB.h" |
|
25 #include "CCAEngine.h" |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // Destructor |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CCALoginCmd::~CCALoginCmd() |
|
35 { |
|
36 |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // C++ constructor |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 CCALoginCmd::CCALoginCmd( MCAProcessManager& aProcessManager, |
|
44 CCASessionHandlerCmd& aSessionHandlerCmd, |
|
45 MCAUiLoginCmdCB& aUiLoginCmdCB ) |
|
46 : iProcessManager( aProcessManager ), |
|
47 iSessionHandlerCmd( aSessionHandlerCmd ), |
|
48 iUiLoginCmdCB( aUiLoginCmdCB ) |
|
49 { |
|
50 |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CCALoginCmd::NewL |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CCALoginCmd* CCALoginCmd::NewL( MCAProcessManager& aProcessManager, |
|
59 MCAUiLoginCmdCB& aUiLoginCmdCB, |
|
60 CCASessionHandlerCmd& aSessionHandlerCmd ) |
|
61 { |
|
62 CCALoginCmd* self = CCALoginCmd::NewLC( aProcessManager, |
|
63 aUiLoginCmdCB, |
|
64 aSessionHandlerCmd ); |
|
65 CleanupStack::Pop( self ); |
|
66 return self; |
|
67 } |
|
68 |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CCALoginCmd::NewLC |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CCALoginCmd* CCALoginCmd::NewLC( MCAProcessManager& aProcessManager, |
|
75 MCAUiLoginCmdCB& aUiLoginCmdCB, |
|
76 CCASessionHandlerCmd& aSessionHandlerCmd ) |
|
77 { |
|
78 CCALoginCmd* self = new( ELeave ) CCALoginCmd( aProcessManager, |
|
79 aSessionHandlerCmd, |
|
80 aUiLoginCmdCB ); |
|
81 CleanupStack::PushL( self ); |
|
82 return self; |
|
83 } |
|
84 |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CCALoginCmd::SetObserver |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CCALoginCmd::SetObserver( MCACommandObserver& aObserver ) |
|
91 { |
|
92 iObserver = &aObserver; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CCALoginCmd::CompletedL |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void CCALoginCmd::CompletedL( TInt aError ) |
|
100 { |
|
101 if ( iObserver ) |
|
102 { |
|
103 iObserver->CommandCompletedL( aError ); |
|
104 } |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CCALoginCmd::CancelCommand |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 void CCALoginCmd::CancelCommand() |
|
112 { |
|
113 |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CCALoginCmd::ExecuteCommandL |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CCALoginCmd::ExecuteCommandL() |
|
121 { |
|
122 |
|
123 MCAUiLoginCmdCB::TLoginParams params; |
|
124 |
|
125 iUiLoginCmdCB.GetParameters( params ); |
|
126 |
|
127 switch ( params ) |
|
128 { |
|
129 case MCAUiLoginCmdCB::ELogin: |
|
130 { |
|
131 iSessionHandlerCmd.LoginL( EFalse ); |
|
132 break; |
|
133 } |
|
134 case MCAUiLoginCmdCB::ELogout: |
|
135 { |
|
136 iSessionHandlerCmd.LogoutL(); |
|
137 break; |
|
138 } |
|
139 case MCAUiLoginCmdCB::EQueryLogin: |
|
140 { |
|
141 iSessionHandlerCmd.LoginL( ETrue ); |
|
142 break; |
|
143 } |
|
144 |
|
145 case MCAUiLoginCmdCB::EExit: |
|
146 { |
|
147 iSessionHandlerCmd.DoApplicationExitL(); |
|
148 break; |
|
149 } |
|
150 |
|
151 default: |
|
152 { |
|
153 break; |
|
154 } |
|
155 |
|
156 } |
|
157 |
|
158 |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CCALoginCmd::IsAsynchronous |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 TBool CCALoginCmd::IsAsynchronous() |
|
166 { |
|
167 return ETrue; |
|
168 } |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |