author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 10:48:20 +0300 | |
changeset 75 | 809df41c314e |
parent 38 | 218231f2b3b3 |
permissions | -rw-r--r-- |
35 | 1 |
/* |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
2 |
* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
35 | 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: Declares USB UI notifiers base class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// INCLUDE FILES |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
19 |
|
35 | 20 |
#include <bautils.h> // BAFL utils (for language file) |
21 |
#include <data_caging_path_literals.hrh> |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
22 |
#include <hb/hbcore/hbtextresolversymbian.h> |
35 | 23 |
|
24 |
#include "usbnotifier.h" // Own class |
|
25 |
#include "usbuinotifdebug.h" |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
26 |
|
35 | 27 |
// CONSTANTS |
28 |
||
29 |
// ================= MEMBER FUNCTIONS ========================================= |
|
30 |
||
31 |
// ---------------------------------------------------------------------------- |
|
32 |
// CUSBUINotifierBase::CBTNotifierBase |
|
33 |
// C++ default constructor can NOT contain any code, that |
|
34 |
// might leave. Sets the AOs priority and puts |
|
35 |
// itself to the active scheduler stack. |
|
36 |
// ---------------------------------------------------------------------------- |
|
37 |
// |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
38 |
CUSBUINotifierBase::CUSBUINotifierBase() |
35 | 39 |
{ |
40 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Default constructor()")); |
|
41 |
} |
|
42 |
||
43 |
// ---------------------------------------------------------------------------- |
|
44 |
// CUSBUINotifierBase::ConstructL |
|
45 |
// Symbian 2nd phase constructor can leave. |
|
46 |
// Create registry object and open resource file. |
|
47 |
// ---------------------------------------------------------------------------- |
|
48 |
// |
|
49 |
void CUSBUINotifierBase::ConstructL() |
|
50 |
{ |
|
51 |
iEikEnv = CEikonEnv::Static(); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
52 |
|
35 | 53 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ConstructL()")); |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
54 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
55 |
// use TLS as a boolean, set to EFalse |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
56 |
TBool initialized = EFalse; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
57 |
TInt error; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
58 |
error = Dll::SetTls((TAny* )initialized); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
59 |
error = error; // to suppress a compiler warning |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
60 |
FTRACE(FPrint(_L("[USBUINOTIF]\t Dll:SetTls returned %d"), error )); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
61 |
|
35 | 62 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::ConstructL() completed")); |
63 |
} |
|
64 |
||
65 |
// ---------------------------------------------------------------------------- |
|
66 |
// Destructor. |
|
67 |
// ---------------------------------------------------------------------------- |
|
68 |
// |
|
69 |
CUSBUINotifierBase::~CUSBUINotifierBase() |
|
70 |
{ |
|
71 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Destructor")); |
|
72 |
//Make sure that the request is completed. Note that inside the destructor, |
|
73 |
//this virtual function call is to the local CUSBUINotifierBase::Cancel, |
|
74 |
//not to any possibly derived class implementation. |
|
75 |
Cancel(); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
76 |
|
35 | 77 |
// Complete the RMessage2 if needed |
78 |
// |
|
79 |
CompleteMessage( KErrDied ); |
|
80 |
||
81 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Destructor completed")); |
|
82 |
} |
|
83 |
||
84 |
// ---------------------------------------------------------------------------- |
|
85 |
// CUSBUINotifierBase::Release |
|
86 |
// Release itself. Call to destructor. |
|
87 |
// ---------------------------------------------------------------------------- |
|
88 |
// |
|
89 |
void CUSBUINotifierBase::Release() |
|
90 |
{ |
|
91 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Release()")); |
|
92 |
delete this; |
|
93 |
} |
|
94 |
||
95 |
// ---------------------------------------------------------------------------- |
|
96 |
// CUSBUINotifierBase::Info |
|
97 |
// Return registered information. |
|
98 |
// ---------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
CUSBUINotifierBase::TNotifierInfo CUSBUINotifierBase::Info() const |
|
101 |
{ |
|
102 |
FTRACE(FPrint(_L("[USBUINOTIF]\t CUSBUINotifierBase::Info() id %d channel %d priority %d"), iInfo.iUid, iInfo.iChannel, iInfo.iPriority )); |
|
103 |
return iInfo; |
|
104 |
} |
|
105 |
||
106 |
// ---------------------------------------------------------------------------- |
|
107 |
// CUSBUINotifierBase::StartL |
|
108 |
// Synchronic notifier launch. Does nothing |
|
109 |
// ---------------------------------------------------------------------------- |
|
110 |
// |
|
111 |
TPtrC8 CUSBUINotifierBase::StartL(const TDesC8& /*aBuffer*/) |
|
112 |
{ |
|
113 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::StartL()")); |
|
114 |
||
115 |
TPtrC8 ret( KNullDesC8 ); |
|
116 |
return (ret); |
|
117 |
} |
|
118 |
||
119 |
// ---------------------------------------------------------------------------- |
|
120 |
// CUSBUINotifierBase::StartL |
|
121 |
// Asynchronic notifier launch. |
|
122 |
// ---------------------------------------------------------------------------- |
|
123 |
// |
|
124 |
void CUSBUINotifierBase::StartL(const TDesC8& aBuffer, TInt aReplySlot, |
|
125 |
const RMessagePtr2& aMessage) |
|
126 |
{ |
|
127 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::StartL()")); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
128 |
TRAPD( err, StartDialogL( aBuffer, aReplySlot, aMessage )); |
35 | 129 |
if (err) |
130 |
{ |
|
131 |
aMessage.Complete( err ); |
|
132 |
iNeedToCompleteMessage = EFalse; |
|
133 |
User::Leave( err ); |
|
134 |
} |
|
135 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::StartL completed()")); |
|
136 |
} |
|
137 |
||
138 |
// ---------------------------------------------------------------------------- |
|
139 |
// CUSBUINotifierBase::Cancel |
|
140 |
// Cancelling method. |
|
141 |
// ---------------------------------------------------------------------------- |
|
142 |
// |
|
143 |
void CUSBUINotifierBase::Cancel() |
|
144 |
{ |
|
145 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Cancel()")); |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
146 |
//The message box closed callback gets not run in subclass cancel calls. |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
147 |
CompleteMessage(KErrCancel); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
148 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::Cancel completed")); |
35 | 149 |
} |
150 |
||
151 |
// ---------------------------------------------------------------------------- |
|
152 |
// CUSBUINotifierBase::UpdateL |
|
153 |
// Notifier update. Not supported. |
|
154 |
// ---------------------------------------------------------------------------- |
|
155 |
// |
|
156 |
TPtrC8 CUSBUINotifierBase::UpdateL(const TDesC8& /*aBuffer*/) |
|
157 |
{ |
|
158 |
TPtrC8 ret( KNullDesC8 ); |
|
159 |
return (ret); |
|
160 |
} |
|
161 |
||
162 |
// ---------------------------------------------------------------------------- |
|
163 |
// CUSBUINotifierBase::CompleteMessage |
|
164 |
// Check if message needs to be completed and complete it. |
|
165 |
// ---------------------------------------------------------------------------- |
|
166 |
// |
|
167 |
void CUSBUINotifierBase::CompleteMessage(TInt aReason) |
|
168 |
{ |
|
169 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::CompleteMessage()")); |
|
170 |
if (iNeedToCompleteMessage) |
|
171 |
{ |
|
172 |
iMessage.Complete( aReason ); |
|
173 |
iNeedToCompleteMessage = EFalse; |
|
174 |
} |
|
175 |
iReplySlot = 0; |
|
176 |
FLOG(_L("[USBUINOTIF]\t CUSBUINotifierBase::CompleteMessage() completed")); |
|
177 |
} |
|
178 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
179 |
void CUSBUINotifierBase::InitializeTextResolver() |
35 | 180 |
{ |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
181 |
_LIT(KFileName, "usbdialogs_"); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
182 |
_LIT(KPath, "z:/resource/qt/translations/"); |
75
809df41c314e
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
38
diff
changeset
|
183 |
TInt error = KErrNone; |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
184 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
185 |
iTranslator = (TBool )Dll::Tls(); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
186 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
187 |
FTRACE(FPrint(_L("[USBUINOTIF]\t Dll:Tls returned %d"), iTranslator )); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
188 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
189 |
if (!iTranslator) |
35 | 190 |
{ |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
191 |
iTranslator = HbTextResolverSymbian::Init(KFileName, KPath); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
192 |
FTRACE(FPrint(_L("[USBUINOTIF]\t HbTextResolverSymbian::Init returned %d"), iTranslator )); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
193 |
if (iTranslator) |
35 | 194 |
{ |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
195 |
error = Dll::SetTls((TAny* )iTranslator); |
35 | 196 |
} |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
197 |
FTRACE(FPrint(_L("[USBUINOTIF]\t Dll:SetTls returned %d"), error )); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
198 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
199 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
200 |
error = error; // to suppress a compiler warning |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
201 |
FTRACE( FPrint( |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
202 |
_L( "[USBUINOTIF]\t CUSBUINotifierBase::InitializeTextResolver result = %d" ), |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
203 |
iTranslator ) ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
204 |
|
35 | 205 |
} |
206 |
||
207 |
||
208 |
// End of File |