|
1 /* |
|
2 * Copyright (c) 2007, 2009 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: USB UI notes notifier class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <eikenv.h> // Eikon environment |
|
21 #include <AknNoteDialog.h> |
|
22 #include <bautils.h> // BAFL utils (for language file) |
|
23 #include <stringloader.h> // Localisation stringloader |
|
24 #include <aknmediatorfacade.h> // for cover display support |
|
25 #include <USBUINotif.rsg> // Own resources |
|
26 #include "usbuinotifotgwarning.h" // Own class definition |
|
27 #include "usbuinotifdebug.h" // Debugging macros |
|
28 #include "USBUINotifSecondaryDisplay.h" // Dialog index for cover UI |
|
29 // ================= MEMBER FUNCTIONS ========================================= |
|
30 |
|
31 // ---------------------------------------------------------------------------- |
|
32 // CUsbUiNotifOtgWarning::NewL |
|
33 // Two-phased constructor. |
|
34 // ---------------------------------------------------------------------------- |
|
35 // |
|
36 CUsbUiNotifOtgWarning* CUsbUiNotifOtgWarning::NewL() |
|
37 { |
|
38 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::NewL()")); |
|
39 CUsbUiNotifOtgWarning* self = new (ELeave) CUsbUiNotifOtgWarning(); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL(); |
|
42 CleanupStack::Pop( self ); |
|
43 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::NewL completed()")); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // ---------------------------------------------------------------------------- |
|
48 // CUsbUiNotifOtgWarning::CUsbUiNotifOtgWarning |
|
49 // C++ default constructor can NOT contain any code, that |
|
50 // might leave. |
|
51 // ---------------------------------------------------------------------------- |
|
52 // |
|
53 CUsbUiNotifOtgWarning::CUsbUiNotifOtgWarning() : |
|
54 iStringIds( KUsbUiNotifOtgGeneralNoteGranularity), iNote( NULL) |
|
55 { |
|
56 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::constructor()")); |
|
57 } |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // Destructor |
|
61 // ---------------------------------------------------------------------------- |
|
62 // |
|
63 CUsbUiNotifOtgWarning::~CUsbUiNotifOtgWarning() |
|
64 { |
|
65 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::destructor()")); |
|
66 //Make sure that the request is completed. Note that inside the destructor, |
|
67 //this virtual function call is to local CUsbUiNotifOtgWarning::Cancel, |
|
68 //not to any possibly derived class implementation. |
|
69 Cancel(); |
|
70 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::destructor completed()")); |
|
71 } |
|
72 |
|
73 void CUsbUiNotifOtgWarning::ConstructL() |
|
74 { |
|
75 CUSBUINotifierBase::ConstructL(); |
|
76 iStringIds.AppendL( R_USB_OTG_WARNING_PARTIAL_SUPPORTED); |
|
77 } |
|
78 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // CUsbUiNotifOtgWarning::RegisterL |
|
81 // Register notifier. |
|
82 // ---------------------------------------------------------------------------- |
|
83 // |
|
84 CUsbUiNotifOtgWarning::TNotifierInfo CUsbUiNotifOtgWarning::RegisterL() |
|
85 { |
|
86 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::RegisterL")); |
|
87 iInfo.iUid = KUsbUiNotifOtgWarning; |
|
88 iInfo.iChannel = KUsbUiNotifOtgWarning; |
|
89 iInfo.iPriority = ENotifierPriorityVHigh; |
|
90 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::RegisterL completed()")); |
|
91 return iInfo; |
|
92 } |
|
93 |
|
94 // ---------------------------------------------------------------------------- |
|
95 // CUsbUiNotifOtgWarning::Cancel |
|
96 // Release all own resources (member variables) |
|
97 // ---------------------------------------------------------------------------- |
|
98 // |
|
99 void CUsbUiNotifOtgWarning::Cancel() |
|
100 { |
|
101 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::Cancel")); |
|
102 if (iNote) |
|
103 { |
|
104 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::Cancel - delete iNote")); |
|
105 delete iNote; |
|
106 iNote = NULL; |
|
107 } |
|
108 CompleteMessage( KErrNone ); |
|
109 |
|
110 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::Cancel() completed")); |
|
111 } |
|
112 |
|
113 // ---------------------------------------------------------------------------- |
|
114 // CUsbUiNotifOtgWarning::GetParamsL |
|
115 // Mandatory for USB UI Notifiers when using asynchronous launch. |
|
116 // This notifier is synchronous so this function is not used. |
|
117 // ---------------------------------------------------------------------------- |
|
118 // |
|
119 void CUsbUiNotifOtgWarning::GetParamsL(const TDesC8& aBuffer, |
|
120 TInt aReplySlot, const RMessagePtr2& aMessage) |
|
121 { |
|
122 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL")); |
|
123 if (iNote || iReplySlot != 0 || iNeedToCompleteMessage) |
|
124 { |
|
125 User::Leave( KErrInUse ); |
|
126 } |
|
127 |
|
128 iMessage = aMessage; |
|
129 iNeedToCompleteMessage = ETrue; |
|
130 iReplySlot = aReplySlot; |
|
131 |
|
132 // Get parameters |
|
133 // |
|
134 TPckgC<TInt> pckg( iNoteId ); |
|
135 pckg.Set( aBuffer ); |
|
136 iNoteId = pckg(); |
|
137 |
|
138 SetActive(); |
|
139 iStatus = KRequestPending; |
|
140 TRequestStatus* stat = &iStatus; |
|
141 User::RequestComplete( stat, KErrNone ); |
|
142 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::GetParamsL() completed")); |
|
143 } |
|
144 |
|
145 // ---------------------------------------------------------------------------- |
|
146 // CUsbUiNotifOtgWarning::RunL |
|
147 // Mandatory for Active Objects. This notifier is synchronous |
|
148 // so this function is not used. |
|
149 // ---------------------------------------------------------------------------- |
|
150 // |
|
151 void CUsbUiNotifOtgWarning::RunL() |
|
152 { |
|
153 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::RunL")); |
|
154 |
|
155 // Create confirmation note |
|
156 // |
|
157 HBufC* str = StringLoader::LoadL( iStringIds[iNoteId] ); |
|
158 CleanupStack::PushL( str ); |
|
159 iNote = new (ELeave) CAknWarningNote( ETrue ); |
|
160 |
|
161 iNote->SetTimeout( CAknNoteDialog::ENoTimeout ); |
|
162 |
|
163 if (iCoverDisplaySupported) |
|
164 { |
|
165 iNote->PublishDialogL( iNoteId, KUsbUiNotifOtgWarning ); |
|
166 } |
|
167 |
|
168 TInt t = iNote->ExecuteLD( *str ); |
|
169 iNote = NULL; |
|
170 CleanupStack::PopAndDestroy( str ); |
|
171 |
|
172 CompleteMessage( KErrNone ); |
|
173 FLOG(_L("[USBUINOTIF]\t CUsbUiNotifOtgWarning::RunL() completed")); |
|
174 } |
|
175 |
|
176 // End of File |