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