author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 14:38:00 +0300 | |
changeset 38 | 218231f2b3b3 |
parent 35 | 9d8b04ca6939 |
child 63 | ef2686f7597e |
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: USB UI queries notifier class. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// INCLUDE FILES |
|
19 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
20 |
#include <hb/hbwidgets/hbdevicemessageboxsymbian.h> |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
21 |
#include <hb/hbcore/hbtextresolversymbian.h> |
35 | 22 |
#include <usbuinotif.h> // pck |
23 |
#include "usbuinqueriesnotifiermdrv.h" // Own class definition |
|
24 |
#include "usbuinotifdebug.h" // Debugging macros |
|
25 |
||
26 |
// ================= MEMBER FUNCTIONS ========================================= |
|
27 |
||
28 |
// ---------------------------------------------------------------------------- |
|
29 |
// CUSBUIQueriesNotifier::NewL |
|
30 |
// Two-phased constructor. |
|
31 |
// ---------------------------------------------------------------------------- |
|
32 |
// |
|
33 |
CUSBUIQueriesNotifier* CUSBUIQueriesNotifier::NewL() |
|
34 |
{ |
|
35 |
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::NewL")); |
|
36 |
CUSBUIQueriesNotifier* self = new (ELeave) CUSBUIQueriesNotifier(); |
|
37 |
CleanupStack::PushL( self ); |
|
38 |
self->ConstructL(); |
|
39 |
CleanupStack::Pop( self ); |
|
40 |
return self; |
|
41 |
} |
|
42 |
||
43 |
// ---------------------------------------------------------------------------- |
|
44 |
// CUSBUIQueriesNotifier::CUSBUIQueriesNotifier |
|
45 |
// C++ default constructor can NOT contain any code, that |
|
46 |
// might leave. |
|
47 |
// ---------------------------------------------------------------------------- |
|
48 |
// |
|
49 |
CUSBUIQueriesNotifier::CUSBUIQueriesNotifier() |
|
50 |
{ |
|
51 |
} |
|
52 |
||
53 |
// ---------------------------------------------------------------------------- |
|
54 |
// Destructor |
|
55 |
// ---------------------------------------------------------------------------- |
|
56 |
// |
|
57 |
CUSBUIQueriesNotifier::~CUSBUIQueriesNotifier() |
|
58 |
{ |
|
59 |
//Make sure that the request is completed. Note that inside the destructor, |
|
60 |
//this virtual function call is to local CUSBUIQueriesNotifier::Cancel, |
|
61 |
//not to any possibly derived class implementation. |
|
62 |
Cancel(); |
|
63 |
} |
|
64 |
||
65 |
// ---------------------------------------------------------------------------- |
|
66 |
// CUSBUIQueriesNotifier::RegisterL |
|
67 |
// Register notifier. |
|
68 |
// ---------------------------------------------------------------------------- |
|
69 |
// |
|
70 |
CUSBUIQueriesNotifier::TNotifierInfo CUSBUIQueriesNotifier::RegisterL() |
|
71 |
{ |
|
72 |
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::RegisterL")); |
|
73 |
iInfo.iUid = KQueriesNotifier; |
|
74 |
iInfo.iChannel = KQueriesNotifier; |
|
75 |
iInfo.iPriority = ENotifierPriorityVHigh; // must be higher than the one |
|
76 |
// in cableconnected notifier |
|
77 |
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::RegisterL completed")); |
|
78 |
return iInfo; |
|
79 |
} |
|
80 |
||
81 |
||
82 |
// ---------------------------------------------------------------------------- |
|
83 |
// CUSBUIQueriesNotifier::GetParamsL |
|
84 |
// ---------------------------------------------------------------------------- |
|
85 |
// |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
86 |
void CUSBUIQueriesNotifier::StartDialogL(const TDesC8& aBuffer, |
35 | 87 |
TInt aReplySlot, const RMessagePtr2& aMessage) |
88 |
{ |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
89 |
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartDialogL")); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
90 |
if ( iReplySlot != 0 || iNeedToCompleteMessage) |
35 | 91 |
{ |
92 |
User::Leave( KErrInUse ); |
|
93 |
} |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
94 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
95 |
InitializeTextResolver(); |
35 | 96 |
|
97 |
iMessage = aMessage; |
|
98 |
iNeedToCompleteMessage = ETrue; |
|
99 |
iReplySlot = aReplySlot; |
|
100 |
||
101 |
// Get parameters |
|
102 |
// |
|
103 |
TUSBQueriesNotiferParams params; //stores parameters from aBuffer |
|
104 |
TPckgC<TUSBQueriesNotiferParams> pckg( params ); |
|
105 |
pckg.Set( aBuffer ); |
|
106 |
// Save the type of the query for later use (dialog selection) |
|
107 |
// |
|
108 |
iQueryType = pckg().iQuery; |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
109 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
110 |
if (iUSBQueryDlg) |
35 | 111 |
{ |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
112 |
delete iUSBQueryDlg; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
113 |
iUSBQueryDlg = NULL; |
35 | 114 |
} |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
115 |
iUSBQueryDlg = CHbDeviceMessageBoxSymbian::NewL( |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
116 |
CHbDeviceMessageBoxSymbian::EWarning, this); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
117 |
iUSBQueryDlg->SetTimeout(0); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
118 |
HBufC* stringHolder = NULL; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
119 |
switch (iQueryType) |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
120 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
121 |
case EUSBStorageMediaFailure: |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
122 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
123 |
_LIT(KMassStorageFail, "txt_usb_info_unable_to_show_a_memory_to_other_devi"); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
124 |
stringHolder = HbTextResolverSymbian::LoadLC( KMassStorageFail ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
125 |
break; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
126 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
127 |
case EUSBDiskFull: |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
128 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
129 |
_LIT(KDiskFull, "txt_usb_info_disk_full_remove_some_files_and_try"); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
130 |
stringHolder = HbTextResolverSymbian::LoadLC( KDiskFull ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
131 |
break; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
132 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
133 |
case EUSBNotEnoughRam: |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
134 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
135 |
_LIT(KNotEnoughMemory, "txt_usb_info_memory_full_close_some_applications"); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
136 |
stringHolder = HbTextResolverSymbian::LoadLC( KNotEnoughMemory ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
137 |
break; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
138 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
139 |
default: |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
140 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
141 |
FTRACE( FPrint( _L( "[USBUINOTIF]\t CUSBUIQueriesNotifier::ERROR! Unknown query type: %d" ),iQueryType ) ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
142 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
143 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
144 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
145 |
if (stringHolder) |
35 | 146 |
{ |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
147 |
iUSBQueryDlg->SetTextL(*stringHolder); |
35 | 148 |
} |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
149 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
150 |
iUSBQueryDlg->ShowL(); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
151 |
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartDialogL() ShowL returned")); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
152 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
153 |
CleanupStack::PopAndDestroy( stringHolder ); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
154 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
155 |
|
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
156 |
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::StartDialogL completed")); |
35 | 157 |
} |
158 |
||
159 |
// ---------------------------------------------------------------------------- |
|
160 |
// CUSBUIQueriesNotifier::Cancel |
|
161 |
// Release all own resources (member variables) |
|
162 |
// ---------------------------------------------------------------------------- |
|
163 |
// |
|
164 |
void CUSBUIQueriesNotifier::Cancel() |
|
165 |
{ |
|
166 |
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::Cancel")); |
|
167 |
if (iUSBQueryDlg) |
|
168 |
{ |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
169 |
iUSBQueryDlg->Close(); |
35 | 170 |
delete iUSBQueryDlg; |
171 |
iUSBQueryDlg = NULL; |
|
172 |
} |
|
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
173 |
|
35 | 174 |
CUSBUINotifierBase::Cancel(); |
175 |
FLOG(_L("[USBUINOTIF]\t CUSBUIQueriesNotifier::Cancel() completed")); |
|
176 |
} |
|
177 |
||
178 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
179 |
void CUSBUIQueriesNotifier::MessageBoxClosed( |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
180 |
const CHbDeviceMessageBoxSymbian* /*aMessageBox*/, |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
181 |
CHbDeviceMessageBoxSymbian::TButtonId aButton) |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
182 |
{ |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
183 |
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed")); |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
184 |
int returnValue = KErrNone; |
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 |
//iQuery will be deleted in Cancel. If Cancel is not called, it will be |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
187 |
//deleted next time the query is shown. |
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 (aButton == CHbDeviceMessageBoxSymbian::EAcceptButton) |
35 | 190 |
{ |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
191 |
returnValue = KErrNone; |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
192 |
} |
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
193 |
else |
35 | 194 |
{ |
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
195 |
returnValue = KErrCancel; |
35 | 196 |
} |
197 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
198 |
CompleteMessage( returnValue ); |
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 |
FLOG(_L("[USBUINOTIF]\t CUsbUiNotifMSMMError::MessageBoxClosed completed")); |
35 | 201 |
} |
202 |
||
38
218231f2b3b3
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
203 |
|
35 | 204 |
|
205 |
// End of File |