|
1 /* |
|
2 * Copyright (c) 2005-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: Declares USB UI Queries notifier. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef USBUINQUERIESNOTIFIER_H |
|
19 #define USBUINQUERIESNOTIFIER_H |
|
20 |
|
21 // INCLUDES |
|
22 |
|
23 #include "usbnotifier.h" // Base class |
|
24 #include <aknquerydialog.h> // AVKON component |
|
25 #include <aknmemorycarddialog.h> |
|
26 |
|
27 // CLASS DECLARATION |
|
28 |
|
29 /** |
|
30 * This class is used to show USB query dialogs. |
|
31 * |
|
32 * @lib |
|
33 */ |
|
34 NONSHARABLE_CLASS(CUSBUIQueriesNotifier) : public CUSBUINotifierBase, |
|
35 public MAknMemoryCardDialogObserver |
|
36 { |
|
37 public: |
|
38 // Constructors and destructor |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 */ |
|
43 static CUSBUIQueriesNotifier* NewL(); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 virtual ~CUSBUIQueriesNotifier(); |
|
49 |
|
50 public: |
|
51 // from MAknMemoryCardDialogObserver |
|
52 |
|
53 /** |
|
54 * To be notified when unlock completed |
|
55 * @param TInt aResult |
|
56 * @return void |
|
57 */ |
|
58 void UnlockComplete(TInt aResult); |
|
59 |
|
60 private: |
|
61 // Functions from base class |
|
62 |
|
63 /** |
|
64 * From CUSBUINotifierBase Called when a notifier is first loaded. |
|
65 * @param None. |
|
66 * @return A structure containing priority and channel info. |
|
67 */ |
|
68 TNotifierInfo RegisterL(); |
|
69 |
|
70 /** |
|
71 * From CUSBUINotifierBase The notifier has been deactivated |
|
72 * so resources can be freed and outstanding messages completed. |
|
73 * @param None. |
|
74 * @return None. |
|
75 */ |
|
76 void Cancel(); |
|
77 |
|
78 /** |
|
79 * From CUSBUINotifierBase Gets called when a request completes. |
|
80 * @param None. |
|
81 * @return None. |
|
82 */ |
|
83 void RunL(); |
|
84 |
|
85 /** |
|
86 * From CUSBUINotifierBase Used in asynchronous notifier launch to |
|
87 * store received parameters into members variables and |
|
88 * make needed initializations. |
|
89 * @param aBuffer A buffer containing received parameters |
|
90 * @param aReplySlot A reply slot. |
|
91 * @param aMessage Should be completed when the notifier is deactivated. |
|
92 * @return None. |
|
93 */ |
|
94 void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, |
|
95 const RMessagePtr2& aMessage); |
|
96 |
|
97 private: |
|
98 |
|
99 /** |
|
100 * C++ default constructor. |
|
101 */ |
|
102 CUSBUIQueriesNotifier(); |
|
103 |
|
104 private: |
|
105 // New functions |
|
106 |
|
107 /** |
|
108 * Unlock the locked memory card |
|
109 * First inform user that the memory card is locked and then show the |
|
110 * memory card dialog for unlocking. |
|
111 * @param aStringHolder The string for the query. |
|
112 * @param aCoverDialogId The dialog ID for the cover UI. |
|
113 * @return KErrNone - user accepted, KErrCancel - End call key pressed |
|
114 */ |
|
115 TInt UnlockMemoryCardL(const TDesC& aStringHolder, TInt aCoverDialogId); |
|
116 |
|
117 /** |
|
118 * Show query dialog |
|
119 * @param aStringHolder The string for the query. |
|
120 * @param aCoverDialogId The dialog ID for the cover UI. |
|
121 * @param aIsCancelKey Does the dialog show Cancel key. |
|
122 * @return KErrNone - accepted, KErrCancel - Cancel or End call key |
|
123 */ |
|
124 TInt QueryUserResponseL(const TDesC& aStringHolder, TInt aCoverDialogId, |
|
125 TBool aIsCancelKey); |
|
126 |
|
127 /** |
|
128 * Get attributes for the query dialog |
|
129 * The query type is idenfied by the member variable iQueryType. |
|
130 * The caller should pop and destroy the returned heap descriptor |
|
131 * when it is no longer needed. |
|
132 * @param aCoverDialogId Returned dialog ID for the cover UI. |
|
133 * @param aIsCancelKey Returned info about showing the Cancel key. |
|
134 * @return The string holder for the query. |
|
135 */ |
|
136 HBufC* GetQueryAttributesLC(TInt& aCoverDialogId, TBool& aIsCancelKey); |
|
137 |
|
138 private: |
|
139 // Data |
|
140 /** |
|
141 * Query |
|
142 * Not own, destroys self when lauched. |
|
143 */ |
|
144 CAknQueryDialog* iUSBQueryDlg; |
|
145 TUSBUIQueries iQueryType; // To store the type of the query |
|
146 TInt iDriveLetter; // For MMC locked case |
|
147 // Used for possible Cancel while the dialog is showing |
|
148 CAknMemoryCardDialog* iMemoryCardDialog; |
|
149 |
|
150 }; |
|
151 #endif // USBUINQUERIESNOTIFIER_H |