|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef AUDIOFETCHERDIALOG_H |
|
19 #define AUDIOFETCHERDIALOG_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <aknlists.h> |
|
24 #include <AknDialog.h> |
|
25 #include <coedef.h> |
|
26 #include <eikcmobs.h> |
|
27 #include <MediaFileTypes.hrh> |
|
28 |
|
29 #include "audiofetcherlisthandler.h" |
|
30 #include "audiofetcherfilehandler.h" |
|
31 #include "audiofetcherdialogutils.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class MMGFetchVerifier; |
|
35 class CAknInputBlock; |
|
36 |
|
37 /** |
|
38 * CAudioFetcherDialog |
|
39 * |
|
40 * CAudioFetcherDialog provides UI for selecting audio files. |
|
41 */ |
|
42 NONSHARABLE_CLASS ( CAudioFetcherDialog ) : public CAknDialog, |
|
43 public MEikListBoxObserver,/* |
|
44 public MCoeForegroundObserver,*/ |
|
45 public MEikCommandObserver, |
|
46 public MAudioFetcherListHandlerObserver, |
|
47 public MAudioFetcherFileHandlerObserver |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 * @param reference to an array where the selected files are set |
|
54 * @param selection verifier interface |
|
55 * @param the title for the dialog |
|
56 */ |
|
57 static CAudioFetcherDialog* NewL( |
|
58 CDesCArray& aSelectedFiles, |
|
59 MMGFetchVerifier* aVerifier, |
|
60 const TDesC& aTitle, |
|
61 TBool aMultiSelectionEnabled, |
|
62 TMediaFileType aMediaType ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CAudioFetcherDialog(); |
|
68 |
|
69 private: // Constructors |
|
70 |
|
71 /** |
|
72 * Symbian 2nd phase constructor |
|
73 */ |
|
74 void ConstructL(); |
|
75 |
|
76 /** |
|
77 * C++ default constructor. |
|
78 */ |
|
79 CAudioFetcherDialog( |
|
80 CDesCArray& aSelectedFiles, MMGFetchVerifier* aVerifier, const TDesC& aTitle, |
|
81 TBool aMultiSelectionEnabled, TMediaFileType aMediaType); |
|
82 |
|
83 private: |
|
84 |
|
85 /** |
|
86 * @ref CCoeControl::SizeChanged |
|
87 */ |
|
88 void SizeChanged(); |
|
89 |
|
90 /** |
|
91 * From the base class. |
|
92 * Handles menu events. |
|
93 * @param aCommandId Command id. |
|
94 * @return None. |
|
95 */ |
|
96 void ProcessCommandL( TInt aCommandId ); |
|
97 |
|
98 //void HandleGainingForeground() {}; |
|
99 //void HandleLosingForeground(){}; |
|
100 |
|
101 /** |
|
102 * From MEikListBoxObserver, called by framework. |
|
103 * @param aListBox. |
|
104 * @param aEventType. |
|
105 * @return None |
|
106 */ |
|
107 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
108 |
|
109 /** |
|
110 * Initializes the dialog's controls before the dialog is sized and |
|
111 * layed out. |
|
112 */ |
|
113 void PreLayoutDynInitL(); |
|
114 |
|
115 /** |
|
116 * Initializes the dialog's controls after the dialog has been sized |
|
117 * but before it has been activated. |
|
118 */ |
|
119 void PostLayoutDynInitL(); |
|
120 |
|
121 TInt CurrentItemListIndex(); |
|
122 |
|
123 void GetListItemText( TInt aListboxIndex, TDes& aText ); |
|
124 |
|
125 void SetIconsL(); |
|
126 |
|
127 void SetIconFileNameL( const TDesC& aName, TDes& aFullName ); |
|
128 |
|
129 TInt StorageTypeIcon( TInt aListboxIndex ); |
|
130 |
|
131 TInt MediaTypeIcon( TInt aListboxIndex ); |
|
132 |
|
133 CGulIcon* IconL(TAknsItemID aId, const TDesC& aFileName, |
|
134 TInt aFileIndex, TInt aFileMaskIndex); |
|
135 |
|
136 void UpdateListBoxL(); |
|
137 |
|
138 /** |
|
139 * From the base class. |
|
140 * Called by framework before exiting the dialog. |
|
141 * @param aButtonId Button id. |
|
142 * @return ETrue to exit\ EFalse to not to exit. |
|
143 */ |
|
144 TBool OkToExitL( TInt aButtonId ); |
|
145 |
|
146 /** |
|
147 * From the base class. |
|
148 * Called by framework when dialog is activated. |
|
149 * @param None. |
|
150 * @return None. |
|
151 */ |
|
152 void ActivateL(); |
|
153 |
|
154 /** |
|
155 * From the base class. |
|
156 * Called by framework before menu is shown. |
|
157 * @param aResourceId Menu resource id. |
|
158 * @param aMenuPane Pointer to the menu. |
|
159 * @return None. |
|
160 */ |
|
161 void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) ; |
|
162 |
|
163 /** |
|
164 * From the base class. |
|
165 * Called by framework for key event handling. |
|
166 * @param aKeyEvent. |
|
167 * @param aType. |
|
168 * @return Return code. |
|
169 */ |
|
170 TKeyResponse OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/); |
|
171 |
|
172 /** |
|
173 * From base class. |
|
174 * Called when UI layout changes. |
|
175 * @param aType. |
|
176 * @return None. |
|
177 */ |
|
178 void HandleResourceChange( TInt aType ); |
|
179 |
|
180 virtual CCoeControl* ComponentControl( TInt aIndex ) const; |
|
181 virtual TInt CountComponentControls() const; |
|
182 |
|
183 private: // from MAudioFetcherFileHandlerObserver |
|
184 |
|
185 void HandleFileEventL( TInt aEvent, TInt aError ); |
|
186 |
|
187 TPtrC ConstructListboxItem( TInt aListboxIndex ); |
|
188 TInt ListboxItemCount(); |
|
189 |
|
190 private: |
|
191 |
|
192 /** |
|
193 * Query audio files from MdS |
|
194 */ |
|
195 void QueryL(); |
|
196 TBool HandleListSelectionL(); |
|
197 static TInt CloseDialog( TAny *aObj ); |
|
198 void CloseDialogWithDelayL(); |
|
199 |
|
200 private: |
|
201 |
|
202 // listbox |
|
203 CAknSingleGraphicStyleListBox* iListBox; |
|
204 |
|
205 // long buffers for listbox items |
|
206 TBuf<128> iListboxItemText1; |
|
207 TBuf<256> iListboxItemText2; |
|
208 |
|
209 // long buffers for icon file names |
|
210 TFileName iIconFileName; |
|
211 |
|
212 // for title and icon handling |
|
213 CStatusPaneHandler* iStatusPaneHandler; |
|
214 TBuf<128> iDialogTitle; |
|
215 |
|
216 // metadata engine wrapper |
|
217 CAudioFetcherFileHandler* iFileHandler; |
|
218 |
|
219 CAudioFetcherListHandler* iListHandler; |
|
220 |
|
221 // Selected items array |
|
222 // Not Own. Owned by the client |
|
223 CDesCArray& iSelectedFiles; |
|
224 |
|
225 MMGFetchVerifier* iVerifier; |
|
226 |
|
227 // is metadata databse open |
|
228 TBool iDatabaseOpen; |
|
229 |
|
230 /// Ref: the title |
|
231 const TDesC& iTitle; |
|
232 |
|
233 HBufC* iEmptyListText; |
|
234 |
|
235 // Holds the status pane layout resource ID |
|
236 TInt iCurrentLayoutResId; |
|
237 TBool iMultiSelectionEnabled; |
|
238 |
|
239 // for closing dialog |
|
240 CIdle* iIdle; |
|
241 CAknInputBlock* iInputBlock; |
|
242 |
|
243 TMediaFileType iMediaType; |
|
244 }; |
|
245 |
|
246 #endif // AUDIOFETCHERDIALOG_H |
|
247 |
|
248 // End of File |
|
249 |