|
1 /* |
|
2 * Copyright (c) 2006-2007 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: View for search results |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <CFileManagerEngine.h> |
|
22 #include <FileManager.rsg> |
|
23 #include <aknlists.h> |
|
24 #include <aknnavi.h> |
|
25 #include <akntitle.h> |
|
26 #include <csxhelp/fmgr.hlp.hrh> |
|
27 #include <FileManagerDebug.h> |
|
28 #include "Cfilemanagersearchresultsview.h" |
|
29 #include "CFileManagerAppUi.h" |
|
30 #include "CFileManagerFileListContainer.h" |
|
31 #include "CFileManagerAppUi.h" |
|
32 #include "CFileManagerDocument.h" |
|
33 #include "FileManager.hrh" |
|
34 |
|
35 |
|
36 // ============================ MEMBER FUNCTIONS =============================== |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CFileManagerSearchResultsView::CFileManagerSearchResultsView |
|
40 // C++ default constructor can NOT contain any code, that |
|
41 // might leave. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CFileManagerSearchResultsView::CFileManagerSearchResultsView() |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CFileManagerSearchResultsView::ConstructL |
|
50 // Symbian 2nd phase constructor can leave. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 void CFileManagerSearchResultsView::ConstructL() |
|
54 { |
|
55 CFileManagerViewBase::ConstructL( R_FILEMANAGER_FOLDERS_VIEW ); |
|
56 |
|
57 CEikStatusPane* sp = StatusPane(); |
|
58 iNaviPane = static_cast< CAknNavigationControlContainer* > |
|
59 ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CFileManagerSearchResultsView::NewLC |
|
64 // Two-phased constructor. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CFileManagerSearchResultsView* CFileManagerSearchResultsView::NewLC() |
|
68 { |
|
69 CFileManagerSearchResultsView* self = |
|
70 new( ELeave ) CFileManagerSearchResultsView; |
|
71 |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructL(); |
|
74 |
|
75 return self; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CFileManagerSearchResultsView::~CFileManagerSearchResultsView |
|
80 // Destructor |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 CFileManagerSearchResultsView::~CFileManagerSearchResultsView() |
|
84 { |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CFileManagerSearchResultsView::DirectoryChangedL |
|
89 // |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CFileManagerSearchResultsView::DirectoryChangedL() |
|
93 { |
|
94 FUNC_LOG |
|
95 |
|
96 RefreshTitleL(); |
|
97 |
|
98 if ( iContainer ) |
|
99 { |
|
100 iContainer->RefreshListL( iIndex ); |
|
101 UpdateCbaL(); |
|
102 } |
|
103 } |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CFileManagerSearchResultsView::Id |
|
106 // |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 TUid CFileManagerSearchResultsView::Id() const |
|
110 { |
|
111 return CFileManagerAppUi::KFileManagerSearchResultsViewId; |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CFileManagerSearchResultsView::CreateContainerL |
|
116 // |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 CFileManagerContainerBase* CFileManagerSearchResultsView::CreateContainerL() |
|
120 { |
|
121 return CFileManagerFileListContainer::NewL( |
|
122 ClientRect(), |
|
123 iIndex, |
|
124 CFileManagerFileListContainer::EListFolder, |
|
125 R_QTN_FMGR_SEARCH_NOT_FOUND, |
|
126 KFMGR_HLP_SEARCH_RESULTS ); |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // CFileManagerSearchResultsView::DoActivateL |
|
131 // |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 void CFileManagerSearchResultsView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
135 TUid aCustomMessageId, |
|
136 const TDesC8& aCustomMessage ) |
|
137 { |
|
138 FUNC_LOG |
|
139 |
|
140 CFileManagerViewBase::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
141 |
|
142 iEngine.SetState( CFileManagerEngine::ESearch ); |
|
143 iNaviPane->PushDefaultL( ETrue ); |
|
144 iNaviDecorator = iNaviPane->Top(); |
|
145 iEngine.SetObserver( this ); |
|
146 |
|
147 if ( !aCustomMessage.Compare( KFileManagerSearchViewRefreshMsg ) ) |
|
148 { |
|
149 // Start new search only if explicitly requested |
|
150 iIndex = 0; |
|
151 RefreshTitleL(); |
|
152 iEngine.RefreshDirectory(); |
|
153 } |
|
154 else |
|
155 { |
|
156 // Update list without new search |
|
157 DirectoryChangedL(); |
|
158 } |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CFileManagerSearchResultsView::DoDeactivate |
|
163 // |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 void CFileManagerSearchResultsView::DoDeactivate() |
|
167 { |
|
168 FUNC_LOG |
|
169 |
|
170 CFileManagerViewBase::DoDeactivate(); |
|
171 |
|
172 iNaviPane->Pop( iNaviDecorator ); |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CFileManagerSearchResultsView::HandleCommandL |
|
177 // |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 void CFileManagerSearchResultsView::HandleCommandL( TInt aCommand ) |
|
181 { |
|
182 switch( aCommand ) |
|
183 { |
|
184 case EFileManagerOpen: |
|
185 { |
|
186 StoreIndex(); |
|
187 CFileManagerViewBase::CmdOpenL(); |
|
188 break; |
|
189 } |
|
190 case EAknSoftkeyBack: |
|
191 { |
|
192 CmdBackL(); |
|
193 break; |
|
194 } |
|
195 default: |
|
196 { |
|
197 CFileManagerViewBase::HandleCommandL( aCommand ); |
|
198 break; |
|
199 } |
|
200 } |
|
201 } |
|
202 |
|
203 // ------------------------------------------------------------------------------ |
|
204 // CFileManagerSearchResultsView::UpdateCbaL |
|
205 // |
|
206 // ------------------------------------------------------------------------------ |
|
207 // |
|
208 void CFileManagerSearchResultsView::UpdateCbaL() |
|
209 { |
|
210 UpdateCommonCbaL(); |
|
211 } |
|
212 |
|
213 // ---------------------------------------------------------------------------- |
|
214 // CFileManagerSearchResultsView::CmdBackL |
|
215 // ---------------------------------------------------------------------------- |
|
216 // |
|
217 void CFileManagerSearchResultsView::CmdBackL() |
|
218 { |
|
219 if ( iActiveProcess != ENoProcess ) |
|
220 { |
|
221 return; // Ignore to avoid container mess up |
|
222 } |
|
223 iIndex = 0; |
|
224 static_cast< CFileManagerAppUi* >( AppUi() )->CloseSearchResultsViewL(); |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CFileManagerSearchResultsView::RefreshTitleL |
|
229 // |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 void CFileManagerSearchResultsView::RefreshTitleL() |
|
233 { |
|
234 static_cast< CFileManagerAppUi* >( AppUi() )->SetTitleL( |
|
235 iEngine.SearchString() ); |
|
236 iNaviPane->DrawDeferred(); |
|
237 } |
|
238 |
|
239 // End of File |