1 /* |
|
2 * Copyright (c) 2007-2008 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: ECOM implementation for touch indicator |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <apgtask.h> |
|
20 #include <ConeResLoader.h> |
|
21 #include <eikspane.h> |
|
22 #include <avkon.hrh> |
|
23 #include <lcstylustaprsc.rsg> |
|
24 #include <e32uid.h> // KExecutableImageUid |
|
25 #include <data_caging_path_literals.hrh> |
|
26 #include "lcstylustap.h" |
|
27 #include "debug.h" |
|
28 #include "lcstylustapdismount.h" |
|
29 |
|
30 const TInt KUsbUIUID = 0x102068E2; |
|
31 const TInt KBtUIUID = 0x10005951; |
|
32 |
|
33 |
|
34 // Constants |
|
35 _LIT(KFileDrive, "z:"); |
|
36 _LIT( KLCStylustapPluginResourceFile, "lcstylustaprsc.rsc" ); |
|
37 _LIT(KBTUIExe, "BTUI.exe"); // Hard coded name can be used, since it will not be changed |
|
38 _LIT(KUSBExe, "USBClassChangeUI.exe"); |
|
39 |
|
40 |
|
41 // ======== MEMBER FUNCTIONS ======== |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // C++ default constructor |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CLcStylusTap::CLcStylusTap() |
|
48 { |
|
49 |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // Symbian 2nd-phase constructor |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 void CLcStylusTap::ConstructL() |
|
58 { |
|
59 |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // NewL |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CLcStylusTap* CLcStylusTap::NewL( ) |
|
68 { |
|
69 TRACE_FUNC_ENTRY |
|
70 CLcStylusTap* self = new( ELeave ) CLcStylusTap( ); |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL(); |
|
73 CleanupStack::Pop(); |
|
74 TRACE_FUNC_EXIT |
|
75 return self; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // Destructor |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 CLcStylusTap::~CLcStylusTap() |
|
83 { |
|
84 TRACE_FUNC_ENTRY |
|
85 delete iDismountManager; |
|
86 TRACE_FUNC_EXIT |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // TextL. |
|
91 // Return the text that should be displayed in the link. |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 |
|
95 HBufC* CLcStylusTap::TextL( const TInt aUid, TInt& aTextType ) |
|
96 { |
|
97 TRACE_INFO((_L("CLcStylusTap::TextL aUid = %d"), aUid)) |
|
98 |
|
99 CEikonEnv* eikEnv = CEikonEnv::Static(); |
|
100 RConeResourceLoader rLoader(*eikEnv); |
|
101 |
|
102 TFileName filename; |
|
103 filename += KFileDrive; |
|
104 filename += KDC_RESOURCE_FILES_DIR; |
|
105 filename += KLCStylustapPluginResourceFile; |
|
106 |
|
107 |
|
108 CleanupClosePushL(rLoader); |
|
109 rLoader.OpenL(filename); |
|
110 |
|
111 HBufC* dynStringBuf = NULL; |
|
112 |
|
113 switch(aUid) |
|
114 { |
|
115 case EAknIndicatorBluetooth: |
|
116 case EAknIndicatorBluetoothVisible: |
|
117 case EAknIndicatorBluetoothModuleOn: |
|
118 case EAknIndicatorBluetoothModuleOnVisible: |
|
119 { |
|
120 dynStringBuf = eikEnv->AllocReadResourceL(R_LCSTYLUSTAP_BT_NAME ); |
|
121 aTextType = EAknIndicatorPluginLinkText; |
|
122 break; |
|
123 } |
|
124 case EAknIndicatorUSBConnection: |
|
125 { |
|
126 aTextType = EAknIndicatorPluginLinkText; |
|
127 dynStringBuf = eikEnv->AllocReadResourceL(R_LCSTYLUSTAP_USB_NAME ); |
|
128 break; |
|
129 } |
|
130 case EAknIndicatorUSBMemConnected: |
|
131 case EAknIndicatorUSBMemActive: |
|
132 { |
|
133 aTextType = EAknIndicatorPluginLinkText; |
|
134 dynStringBuf = eikEnv->AllocReadResourceL(R_LCSTYLUSTAP_USB_MEM_EJECT ); |
|
135 break; |
|
136 } |
|
137 default: |
|
138 break; |
|
139 } |
|
140 |
|
141 CleanupStack::PopAndDestroy(); // rLoader |
|
142 TRACE_INFO((_L("CLcStylusTap::TextL = %S"), dynStringBuf)) |
|
143 |
|
144 return dynStringBuf; |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // HandleIndicatorTapL. |
|
149 // Filter the aUid and find the app plug in for the view. |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 void CLcStylusTap::HandleIndicatorTapL( const TInt aUid ) |
|
153 { |
|
154 |
|
155 TRACE_INFO((_L("CLcStylusTap::HandleIndicatorTapL aUid = %d"), aUid)) |
|
156 |
|
157 switch(aUid) |
|
158 { |
|
159 case EAknIndicatorBluetooth: |
|
160 case EAknIndicatorBluetoothVisible: |
|
161 case EAknIndicatorBluetoothModuleOn: |
|
162 case EAknIndicatorBluetoothModuleOnVisible: |
|
163 { |
|
164 TUidType uidtype(KExecutableImageUid, KUidApp,TUid::Uid(KBtUIUID)); |
|
165 CreateDesiredViewL(KBTUIExe(),uidtype); |
|
166 break; |
|
167 } |
|
168 case EAknIndicatorUSBConnection: |
|
169 { |
|
170 TUidType uidtype(KExecutableImageUid, TUid::Uid(0x00),TUid::Uid(KUsbUIUID)); |
|
171 CreateDesiredViewL(KUSBExe(),uidtype); |
|
172 break; |
|
173 } |
|
174 case EAknIndicatorUSBMemConnected: |
|
175 case EAknIndicatorUSBMemActive: |
|
176 { |
|
177 EjectUSBMemL(); |
|
178 break; |
|
179 } |
|
180 case EAknIndicatorIrActive: // IR not required |
|
181 default: |
|
182 TRACE_INFO((_L(" CLcStylusTap::HandleIndicatorTapL default"))) |
|
183 break; |
|
184 } |
|
185 TRACE_FUNC_EXIT |
|
186 } |
|
187 |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // CreateDesiredViewL. |
|
191 // Create the desired view via control panel. |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 void CLcStylusTap::CreateDesiredViewL(const TDesC & aProcessName,const TUidType & aUidType) const |
|
195 { |
|
196 TRACE_FUNC_ENTRY |
|
197 RProcess NewProcess; |
|
198 User::LeaveIfError(NewProcess.Create(aProcessName, KNullDesC, aUidType)); |
|
199 NewProcess.Resume(); |
|
200 NewProcess.Close(); |
|
201 TRACE_FUNC_EXIT |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // CreateDesiredViewL. |
|
206 // Create the desired view via control panel. |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 void CLcStylusTap::EjectUSBMemL() |
|
210 { |
|
211 TRACE_FUNC_ENTRY |
|
212 delete iDismountManager; |
|
213 iDismountManager = NULL; |
|
214 iDismountManager= CLcStylusTapDismount::NewL(); |
|
215 iDismountManager->DisMountUsbDrives(); |
|
216 TRACE_FUNC_EXIT |
|
217 } |
|
218 |
|
219 |
|
220 |
|
221 // End of File |
|