author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:57:31 +0300 | |
branch | RCL_3 |
changeset 42 | f5c50b8af68c |
parent 39 | 65326cf895ed |
child 52 | 40fb776cbfb3 |
permissions | -rw-r--r-- |
39 | 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() |
|
42
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
93 |
{ |
39 | 94 |
FUNC_LOG |
95 |
||
96 |
RefreshTitleL(); |
|
97 |
||
42
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
98 |
if ( !iContainer ) |
39 | 99 |
{ |
42
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
100 |
return; |
39 | 101 |
} |
42
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
102 |
// Get current drive's drive info cache. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
103 |
TFileManagerDriveInfo& drvInfo( DriveInfo() ); |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
104 |
// Ensure drive info is updated. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
105 |
iEngine.GetDriveInfoL( drvInfo.iDrive, drvInfo ); |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
106 |
// Manually deactivate marking mode if current drive |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
107 |
// is not available. |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
108 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveInUse || |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
109 |
!( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ) |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
110 |
{ |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
111 |
if (iContainer->IsMarkingModeActivated() ) |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
112 |
{ |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
113 |
iContainer->SetMarkingMode( EFalse ); |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
114 |
} |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
115 |
} |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
116 |
|
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
117 |
iContainer->RefreshListL( iIndex ); |
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
118 |
UpdateCbaL(); |
39 | 119 |
} |
42
f5c50b8af68c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
120 |
|
39 | 121 |
// ----------------------------------------------------------------------------- |
122 |
// CFileManagerSearchResultsView::Id |
|
123 |
// |
|
124 |
// ----------------------------------------------------------------------------- |
|
125 |
// |
|
126 |
TUid CFileManagerSearchResultsView::Id() const |
|
127 |
{ |
|
128 |
return CFileManagerAppUi::KFileManagerSearchResultsViewId; |
|
129 |
} |
|
130 |
||
131 |
// ----------------------------------------------------------------------------- |
|
132 |
// CFileManagerSearchResultsView::CreateContainerL |
|
133 |
// |
|
134 |
// ----------------------------------------------------------------------------- |
|
135 |
// |
|
136 |
CFileManagerContainerBase* CFileManagerSearchResultsView::CreateContainerL() |
|
137 |
{ |
|
138 |
return CFileManagerFileListContainer::NewL( |
|
139 |
ClientRect(), |
|
140 |
iIndex, |
|
141 |
CFileManagerFileListContainer::EListFolder, |
|
142 |
R_QTN_FMGR_SEARCH_NOT_FOUND, |
|
143 |
KFMGR_HLP_SEARCH_RESULTS ); |
|
144 |
} |
|
145 |
||
146 |
// ----------------------------------------------------------------------------- |
|
147 |
// CFileManagerSearchResultsView::DoActivateL |
|
148 |
// |
|
149 |
// ----------------------------------------------------------------------------- |
|
150 |
// |
|
151 |
void CFileManagerSearchResultsView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
152 |
TUid aCustomMessageId, |
|
153 |
const TDesC8& aCustomMessage ) |
|
154 |
{ |
|
155 |
FUNC_LOG |
|
156 |
||
157 |
CFileManagerViewBase::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
158 |
||
159 |
iEngine.SetState( CFileManagerEngine::ESearch ); |
|
160 |
iNaviPane->PushDefaultL( ETrue ); |
|
161 |
iNaviDecorator = iNaviPane->Top(); |
|
162 |
iEngine.SetObserver( this ); |
|
163 |
||
164 |
if ( !aCustomMessage.Compare( KFileManagerSearchViewRefreshMsg ) ) |
|
165 |
{ |
|
166 |
// Start new search only if explicitly requested |
|
167 |
iIndex = 0; |
|
168 |
RefreshTitleL(); |
|
169 |
iEngine.RefreshDirectory(); |
|
170 |
} |
|
171 |
else |
|
172 |
{ |
|
173 |
// Update list without new search |
|
174 |
DirectoryChangedL(); |
|
175 |
} |
|
176 |
} |
|
177 |
||
178 |
// ----------------------------------------------------------------------------- |
|
179 |
// CFileManagerSearchResultsView::DoDeactivate |
|
180 |
// |
|
181 |
// ----------------------------------------------------------------------------- |
|
182 |
// |
|
183 |
void CFileManagerSearchResultsView::DoDeactivate() |
|
184 |
{ |
|
185 |
FUNC_LOG |
|
186 |
||
187 |
CFileManagerViewBase::DoDeactivate(); |
|
188 |
||
189 |
iNaviPane->Pop( iNaviDecorator ); |
|
190 |
} |
|
191 |
||
192 |
// ----------------------------------------------------------------------------- |
|
193 |
// CFileManagerSearchResultsView::HandleCommandL |
|
194 |
// |
|
195 |
// ----------------------------------------------------------------------------- |
|
196 |
// |
|
197 |
void CFileManagerSearchResultsView::HandleCommandL( TInt aCommand ) |
|
198 |
{ |
|
199 |
switch( aCommand ) |
|
200 |
{ |
|
201 |
case EFileManagerOpen: |
|
202 |
{ |
|
203 |
StoreIndex(); |
|
204 |
CFileManagerViewBase::CmdOpenL(); |
|
205 |
break; |
|
206 |
} |
|
207 |
case EAknSoftkeyBack: |
|
208 |
{ |
|
209 |
CmdBackL(); |
|
210 |
break; |
|
211 |
} |
|
212 |
default: |
|
213 |
{ |
|
214 |
CFileManagerViewBase::HandleCommandL( aCommand ); |
|
215 |
break; |
|
216 |
} |
|
217 |
} |
|
218 |
} |
|
219 |
||
220 |
// ------------------------------------------------------------------------------ |
|
221 |
// CFileManagerSearchResultsView::UpdateCbaL |
|
222 |
// |
|
223 |
// ------------------------------------------------------------------------------ |
|
224 |
// |
|
225 |
void CFileManagerSearchResultsView::UpdateCbaL() |
|
226 |
{ |
|
227 |
UpdateCommonCbaL(); |
|
228 |
} |
|
229 |
||
230 |
// ---------------------------------------------------------------------------- |
|
231 |
// CFileManagerSearchResultsView::CmdBackL |
|
232 |
// ---------------------------------------------------------------------------- |
|
233 |
// |
|
234 |
void CFileManagerSearchResultsView::CmdBackL() |
|
235 |
{ |
|
236 |
if ( iActiveProcess != ENoProcess ) |
|
237 |
{ |
|
238 |
return; // Ignore to avoid container mess up |
|
239 |
} |
|
240 |
iIndex = 0; |
|
241 |
static_cast< CFileManagerAppUi* >( AppUi() )->CloseSearchResultsViewL(); |
|
242 |
} |
|
243 |
||
244 |
// ----------------------------------------------------------------------------- |
|
245 |
// CFileManagerSearchResultsView::RefreshTitleL |
|
246 |
// |
|
247 |
// ----------------------------------------------------------------------------- |
|
248 |
// |
|
249 |
void CFileManagerSearchResultsView::RefreshTitleL() |
|
250 |
{ |
|
251 |
static_cast< CFileManagerAppUi* >( AppUi() )->SetTitleL( |
|
252 |
iEngine.SearchString() ); |
|
253 |
iNaviPane->DrawDeferred(); |
|
254 |
} |
|
255 |
||
256 |
// End of File |