21
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2008 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: Navigation pane for file manager
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <coecntrl.h>
|
|
21 |
#include <avkon.rsg>
|
|
22 |
#include <aknconsts.h>
|
|
23 |
#include <StringLoader.h>
|
|
24 |
#include <bautils.h>
|
|
25 |
#include <featmgr.h>
|
|
26 |
#include <AknsSkinInstance.h>
|
|
27 |
#include <AknsUtils.h>
|
|
28 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
29 |
#include <filemanagerview.rsg>
|
|
30 |
#include <FileManagerEngine.hrh>
|
|
31 |
#include "Cfilemanagerfoldernavigationpane.h"
|
|
32 |
#include "MFileManagerFolderNaviObserver.h"
|
|
33 |
#ifdef RD_TACTILE_FEEDBACK
|
|
34 |
#include <touchfeedback.h>
|
|
35 |
#endif //RD_TACTILE_FEEDBACK
|
|
36 |
|
|
37 |
// CONSTANTS
|
|
38 |
const TUint KFmgrRoot = 0;
|
|
39 |
const TUint KFmgrFirstLevel = 1;
|
|
40 |
|
|
41 |
// needed because _LIT macro does not expand parameter, which is also macro
|
|
42 |
#define _CREATE_LIT( a, b ) _LIT( a, b )
|
|
43 |
|
|
44 |
_CREATE_LIT( KFileManagerMifFile, filemanager_mbm_file_location );
|
|
45 |
|
|
46 |
|
|
47 |
// -----------------------------------------------------------------------------
|
|
48 |
// CFileManagerFolderNavigationPane::TIndicatorSet::Compare
|
|
49 |
//
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
TBool CFileManagerFolderNavigationPane::TIndicatorSet::Compare(
|
|
53 |
const TIndicatorSet& aFirst,
|
|
54 |
const TIndicatorSet& aSecond )
|
|
55 |
{
|
|
56 |
return ( aFirst.iId == aSecond.iId );
|
|
57 |
}
|
|
58 |
|
|
59 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
60 |
|
|
61 |
// -----------------------------------------------------------------------------
|
|
62 |
// CFileManagerFolderNavigationPane::~CFileManagerFolderNavigationPane
|
|
63 |
//
|
|
64 |
// -----------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
EXPORT_C CFileManagerFolderNavigationPane::~CFileManagerFolderNavigationPane()
|
|
67 |
{
|
|
68 |
delete iLongTapDetector;
|
|
69 |
iIndicatorArray.Reset();
|
|
70 |
delete iFolderBitmap;
|
|
71 |
delete iFolderMask;
|
|
72 |
delete iRootBitmap;
|
|
73 |
delete iRootMask;
|
|
74 |
delete iSeparator;
|
|
75 |
delete iBmpFile;
|
|
76 |
delete iEndChar;
|
|
77 |
}
|
|
78 |
|
|
79 |
// -----------------------------------------------------------------------------
|
|
80 |
// CFileManagerFolderNavigationPane::CFileManagerFolderNavigationPane
|
|
81 |
//
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
CFileManagerFolderNavigationPane::CFileManagerFolderNavigationPane(
|
|
85 |
const TInt aRoot,
|
|
86 |
const TInt aDepth ) :
|
|
87 |
iRoot( aRoot ),
|
|
88 |
iMaxDepth( KFileManagerMaxFolderDepth - 1 ), // Exclude the root
|
|
89 |
iIndicatorArray( 1 )
|
|
90 |
{
|
|
91 |
// ensure that iDepth will be positive
|
|
92 |
if ( aDepth < 0 )
|
|
93 |
{
|
|
94 |
iDepth = 0;
|
|
95 |
}
|
|
96 |
else
|
|
97 |
{
|
|
98 |
iDepth = aDepth;
|
|
99 |
}
|
|
100 |
}
|
|
101 |
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
// CFileManagerFolderNavigationPane::ConstructL
|
|
104 |
//
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
void CFileManagerFolderNavigationPane::ConstructL( TResourceReader& aReader )
|
|
108 |
{
|
|
109 |
// Get File Manager mif drive from exe location
|
|
110 |
TFileName exeFileName( RProcess().FileName() );
|
|
111 |
|
|
112 |
iBmpFile = aReader.ReadHBufCL();
|
|
113 |
|
|
114 |
TPtr ptr( iBmpFile->Des() );
|
|
115 |
if ( !ptr.CompareF( KFileManagerMifFile ) )
|
|
116 |
{
|
|
117 |
// Set correct File Manager mif drive
|
|
118 |
ptr[ 0 ] = exeFileName[ 0 ];
|
|
119 |
}
|
|
120 |
|
|
121 |
iFolderIconId = aReader.ReadInt16();
|
|
122 |
iFolderMaskId = aReader.ReadInt16();
|
|
123 |
const TInt majorSkinId = static_cast< TInt >( aReader.ReadInt32() );
|
|
124 |
const TInt minorSkinId = static_cast< TInt >( aReader.ReadInt32() );
|
|
125 |
iSeparator = aReader.ReadHBufCL();
|
|
126 |
iEndChar = aReader.ReadHBufCL();
|
|
127 |
|
|
128 |
iAknsItemIdFolder.Set( majorSkinId, minorSkinId );
|
|
129 |
|
|
130 |
TInt count( aReader.ReadInt16() );
|
|
131 |
|
|
132 |
for ( TInt i( 0 ); i < count ; i++ )
|
|
133 |
{
|
|
134 |
TIndicatorSet set;
|
|
135 |
set.iId = aReader.ReadInt16() ;
|
|
136 |
|
|
137 |
HBufC* tmp = aReader.ReadHBufCL();
|
|
138 |
TPtr ptr( tmp->Des() );
|
|
139 |
if ( !ptr.CompareF( KFileManagerMifFile ) )
|
|
140 |
{
|
|
141 |
// Set correct File Manager mif drive
|
|
142 |
ptr[ 0 ] = exeFileName[ 0 ];
|
|
143 |
}
|
|
144 |
set.iBmpFile = *tmp;
|
|
145 |
delete tmp;
|
|
146 |
|
|
147 |
set.iIconId = aReader.ReadInt16();
|
|
148 |
set.iMaskId = aReader.ReadInt16();
|
|
149 |
const TInt majorSkinIdRoot = static_cast< TInt >( aReader.ReadInt32() );
|
|
150 |
const TInt minorSkinIdRoot = static_cast< TInt >( aReader.ReadInt32() );
|
|
151 |
set.iAknsItemIdRoot.Set( majorSkinIdRoot, minorSkinIdRoot );
|
|
152 |
|
|
153 |
iIndicatorArray.AppendL( set );
|
|
154 |
}
|
|
155 |
|
|
156 |
|
|
157 |
LoadFolderBitmapL();
|
|
158 |
|
|
159 |
// Set the default root bitmap
|
|
160 |
ChangeRootL( iRoot );
|
|
161 |
|
|
162 |
iLongTapDetector = CAknLongTapDetector::NewL( this );
|
|
163 |
}
|
|
164 |
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
// CFileManagerFolderNavigationPane::NewL
|
|
167 |
//
|
|
168 |
// -----------------------------------------------------------------------------
|
|
169 |
//
|
|
170 |
EXPORT_C CFileManagerFolderNavigationPane*
|
|
171 |
CFileManagerFolderNavigationPane::NewL( const TInt aRoot,
|
|
172 |
const TInt aDepth,
|
|
173 |
TResourceReader& aReader )
|
|
174 |
{
|
|
175 |
CFileManagerFolderNavigationPane* self =
|
|
176 |
new( ELeave ) CFileManagerFolderNavigationPane( aRoot, aDepth );
|
|
177 |
CleanupStack::PushL( self );
|
|
178 |
self->ConstructL( aReader );
|
|
179 |
CleanupStack::Pop( self );
|
|
180 |
return self;
|
|
181 |
}
|
|
182 |
|
|
183 |
// -----------------------------------------------------------------------------
|
|
184 |
// CFileManagerFolderNavigationPane::SetFolderDepth
|
|
185 |
//
|
|
186 |
// -----------------------------------------------------------------------------
|
|
187 |
//
|
|
188 |
EXPORT_C void CFileManagerFolderNavigationPane::SetFolderDepth( const TInt aDepth )
|
|
189 |
{
|
|
190 |
if ( aDepth < 0 )
|
|
191 |
{
|
|
192 |
iDepth = 0;
|
|
193 |
}
|
|
194 |
else
|
|
195 |
{
|
|
196 |
iDepth = aDepth;
|
|
197 |
}
|
|
198 |
|
|
199 |
// ReportChange() is used to notify CoeControl to redraw pane.
|
|
200 |
ReportChange();
|
|
201 |
}
|
|
202 |
|
|
203 |
// -----------------------------------------------------------------------------
|
|
204 |
// CFileManagerFolderNavigationPane::FolderDepth
|
|
205 |
//
|
|
206 |
// -----------------------------------------------------------------------------
|
|
207 |
//
|
|
208 |
EXPORT_C TInt CFileManagerFolderNavigationPane::FolderDepth() const
|
|
209 |
{
|
|
210 |
return iDepth;
|
|
211 |
}
|
|
212 |
|
|
213 |
// -----------------------------------------------------------------------------
|
|
214 |
// CFileManagerFolderNavigationPane::SizeChanged
|
|
215 |
//
|
|
216 |
// -----------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
void CFileManagerFolderNavigationPane::SizeChanged()
|
|
219 |
{
|
|
220 |
|
|
221 |
TSize size( TSize::EUninitialized );
|
|
222 |
AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::ENaviPane, size );
|
|
223 |
TRect parentRect( size );
|
|
224 |
// Get pane icon and text layouts
|
|
225 |
TAknWindowLineLayout paneIconLayout(
|
|
226 |
AknLayoutScalable_Avkon::navi_icon_text_pane_g1().LayoutLine() );
|
|
227 |
TAknTextLineLayout paneTextLayout(
|
|
228 |
AknLayoutScalable_Avkon::navi_icon_text_pane_t1().LayoutLine() );
|
|
229 |
TAknLayoutRect layoutRect;
|
|
230 |
TAknLayoutText layoutText;
|
|
231 |
layoutRect.LayoutRect( parentRect, paneIconLayout );
|
|
232 |
layoutText.LayoutText( parentRect, paneTextLayout );
|
|
233 |
// Setup pane items
|
|
234 |
TRect itemsRect( layoutRect.Rect() );
|
|
235 |
const CFont* font( layoutText.Font() ); // Not owned
|
|
236 |
TInt bsWidth( font->MeasureText( *iSeparator ) );
|
|
237 |
TInt dotsWidth( font->MeasureText( *iEndChar ) );
|
|
238 |
TInt textWidth( KFileManagerMaxFolderDepth * bsWidth + dotsWidth );
|
|
239 |
TInt iconWidth( ( itemsRect.Width() - textWidth )
|
|
240 |
/ KFileManagerMaxFolderDepth );
|
|
241 |
TInt i( 0 );
|
|
242 |
|
|
243 |
if ( AknLayoutUtils::LayoutMirrored() )
|
|
244 |
{
|
|
245 |
TInt offs( itemsRect.Width() );
|
|
246 |
for ( i = 0 ; i < KFileManagerMaxFolderDepth; i++ )
|
|
247 |
{
|
|
248 |
// Root and Folder Icons
|
|
249 |
offs -= iconWidth;
|
|
250 |
iBitmapLayout[ i ].LayoutRect(
|
|
251 |
parentRect,
|
|
252 |
paneIconLayout.iC,
|
|
253 |
paneIconLayout.il + offs,
|
|
254 |
paneIconLayout.it,
|
|
255 |
paneIconLayout.ir,
|
|
256 |
paneIconLayout.ib,
|
|
257 |
iconWidth,
|
|
258 |
paneIconLayout.iH
|
|
259 |
);
|
|
260 |
// Backslashes
|
|
261 |
offs -= bsWidth;
|
|
262 |
iTextLayout[ i ].LayoutText(
|
|
263 |
parentRect,
|
|
264 |
paneTextLayout.iFont,
|
|
265 |
paneTextLayout.iC,
|
|
266 |
paneTextLayout.il + offs,
|
|
267 |
paneTextLayout.ir,
|
|
268 |
paneTextLayout.iB,
|
|
269 |
paneTextLayout.iW,
|
|
270 |
paneTextLayout.iJ
|
|
271 |
);
|
|
272 |
}
|
|
273 |
// Dots
|
|
274 |
offs -= dotsWidth;
|
|
275 |
iTextLayout[ i ].LayoutText(
|
|
276 |
parentRect,
|
|
277 |
paneTextLayout.iFont,
|
|
278 |
paneTextLayout.iC,
|
|
279 |
paneTextLayout.il + offs,
|
|
280 |
paneTextLayout.ir,
|
|
281 |
paneTextLayout.iB,
|
|
282 |
paneTextLayout.iW,
|
|
283 |
paneTextLayout.iJ
|
|
284 |
);
|
|
285 |
}
|
|
286 |
else
|
|
287 |
{
|
|
288 |
TInt offs( 0 );
|
|
289 |
for ( i = 0 ; i < KFileManagerMaxFolderDepth; i++ )
|
|
290 |
{
|
|
291 |
// Root and Folder Icons
|
|
292 |
iBitmapLayout[ i ].LayoutRect(
|
|
293 |
parentRect,
|
|
294 |
paneIconLayout.iC,
|
|
295 |
paneIconLayout.il + offs,
|
|
296 |
paneIconLayout.it,
|
|
297 |
paneIconLayout.ir,
|
|
298 |
paneIconLayout.ib,
|
|
299 |
iconWidth,
|
|
300 |
paneIconLayout.iH
|
|
301 |
);
|
|
302 |
offs += iconWidth;
|
|
303 |
// Backslashes
|
|
304 |
iTextLayout[ i ].LayoutText(
|
|
305 |
parentRect,
|
|
306 |
paneTextLayout.iFont,
|
|
307 |
paneTextLayout.iC,
|
|
308 |
paneTextLayout.il + offs,
|
|
309 |
paneTextLayout.ir,
|
|
310 |
paneTextLayout.iB,
|
|
311 |
paneTextLayout.iW,
|
|
312 |
paneTextLayout.iJ
|
|
313 |
);
|
|
314 |
offs += bsWidth;
|
|
315 |
}
|
|
316 |
// Dots
|
|
317 |
iTextLayout[ i ].LayoutText(
|
|
318 |
parentRect,
|
|
319 |
paneTextLayout.iFont,
|
|
320 |
paneTextLayout.iC,
|
|
321 |
paneTextLayout.il + offs,
|
|
322 |
paneTextLayout.ir,
|
|
323 |
paneTextLayout.iB,
|
|
324 |
paneTextLayout.iW,
|
|
325 |
paneTextLayout.iJ
|
|
326 |
);
|
|
327 |
}
|
|
328 |
}
|
|
329 |
|
|
330 |
// -----------------------------------------------------------------------------
|
|
331 |
// CFileManagerFolderNavigationPane::Draw
|
|
332 |
//
|
|
333 |
// -----------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
void CFileManagerFolderNavigationPane::Draw( const TRect& /*aRect*/ ) const
|
|
336 |
{
|
|
337 |
|
|
338 |
CWindowGc& gc = SystemGc();
|
|
339 |
|
|
340 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
341 |
|
|
342 |
CFbsBitmap* bmp = NULL;
|
|
343 |
TRgb color( KRgbWhite ); // Default never used
|
|
344 |
bmp = AknsUtils::GetCachedBitmap( skin, KAknsIIDQsnComponentColorBmpCG2 );
|
|
345 |
AknsUtils::GetCachedColor( skin, color,
|
|
346 |
KAknsIIDQsnComponentColors, EAknsCIQsnComponentColorsCG2 );
|
|
347 |
|
|
348 |
AknIconUtils::SetSize( iRootMask, iBitmapLayout[ KFmgrRoot ].Rect().Size() );
|
|
349 |
if ( bmp )
|
|
350 |
{
|
|
351 |
iBitmapLayout[ KFmgrRoot ].DrawImage( gc, bmp, iRootMask );
|
|
352 |
}
|
|
353 |
else
|
|
354 |
{
|
|
355 |
AknIconUtils::SetSize( iRootBitmap, iBitmapLayout[ KFmgrRoot ].Rect().Size() );
|
|
356 |
iBitmapLayout[ KFmgrRoot ].DrawImage( gc, iRootBitmap, iRootMask );
|
|
357 |
}
|
|
358 |
|
|
359 |
if ( !bmp )
|
|
360 |
{
|
|
361 |
AknIconUtils::SetSize( iFolderBitmap, iBitmapLayout[ KFmgrFirstLevel ].Rect().Size() );
|
|
362 |
bmp = iFolderBitmap;
|
|
363 |
}
|
|
364 |
|
|
365 |
|
|
366 |
// draw folder bitmaps depending on current folderdepth
|
|
367 |
TInt count( iDepth > iMaxDepth ? iMaxDepth : iDepth );
|
|
368 |
AknIconUtils::SetSize( iFolderMask, iBitmapLayout[ KFmgrFirstLevel ].Rect().Size() );
|
|
369 |
for( TInt i( KFmgrFirstLevel ); i <= count; i++ )
|
|
370 |
{
|
|
371 |
iBitmapLayout[ i ].DrawImage( gc, bmp, iFolderMask );
|
|
372 |
}
|
|
373 |
|
|
374 |
// draw backslashes between folderbitmaps depending on current folderdepth
|
|
375 |
TInt tc( iDepth > ( iMaxDepth + 1 ) ? ( iMaxDepth + 1 ) : iDepth );
|
|
376 |
for( TInt j( 0 ); j < tc; j++ )
|
|
377 |
{
|
|
378 |
const CFont* font = iTextLayout[j].Font(); // Not owned
|
|
379 |
gc.UseFont( font );
|
|
380 |
gc.SetPenColor( color );
|
|
381 |
gc.DrawText( *iSeparator, iTextLayout[j].TextRect(),
|
|
382 |
font->AscentInPixels(), CGraphicsContext::ELeft, 0 );
|
|
383 |
}
|
|
384 |
|
|
385 |
// draw "..." at the end if necessary
|
|
386 |
if ( iDepth > iMaxDepth )
|
|
387 |
{
|
|
388 |
const CFont* font = iTextLayout[iMaxDepth+1].Font(); // Not owned
|
|
389 |
gc.UseFont( font );
|
|
390 |
gc.SetPenColor( color );
|
|
391 |
gc.DrawText( *iEndChar, iTextLayout[iMaxDepth+1].TextRect(),
|
|
392 |
font->AscentInPixels(), CGraphicsContext::ELeft, 0 );
|
|
393 |
}
|
|
394 |
}
|
|
395 |
|
|
396 |
// -----------------------------------------------------------------------------
|
|
397 |
// CFileManagerFolderNavigationPane::HandleResourceChangeL
|
|
398 |
// (other items were commented in a header).
|
|
399 |
// -----------------------------------------------------------------------------
|
|
400 |
//
|
|
401 |
EXPORT_C void CFileManagerFolderNavigationPane::HandleResourceChangeL( TInt aType )
|
|
402 |
{
|
|
403 |
// Skin has propably changed so load bitmaps again
|
|
404 |
if( aType == KAknsMessageSkinChange )
|
|
405 |
{
|
|
406 |
LoadFolderBitmapL();
|
|
407 |
|
|
408 |
// Delete old to make sure that bitmaps are reloaded
|
|
409 |
delete iRootBitmap;
|
|
410 |
iRootBitmap = NULL;
|
|
411 |
delete iRootMask;
|
|
412 |
iRootMask = NULL;
|
|
413 |
|
|
414 |
ChangeRootL( iRoot );
|
|
415 |
}
|
|
416 |
}
|
|
417 |
|
|
418 |
|
|
419 |
// -----------------------------------------------------------------------------
|
|
420 |
// CFileManagerFolderNavigationPane::ReportChange
|
|
421 |
//
|
|
422 |
// -----------------------------------------------------------------------------
|
|
423 |
//
|
|
424 |
void CFileManagerFolderNavigationPane::ReportChange()
|
|
425 |
{
|
|
426 |
// Leave is trapped because it's not critical to functionality.
|
|
427 |
// If leave occurs, navipane just may not be redrawn at that very moment.
|
|
428 |
TRAP_IGNORE( ReportEventL( MCoeControlObserver::EEventStateChanged ) );
|
|
429 |
}
|
|
430 |
|
|
431 |
// -----------------------------------------------------------------------------
|
|
432 |
// CFileManagerFolderNavigationPane::ChangeRootL
|
|
433 |
//
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
//
|
|
436 |
EXPORT_C void CFileManagerFolderNavigationPane::ChangeRootL( const TInt aRoot )
|
|
437 |
{
|
|
438 |
// Do not reload icon if correct one is already in use
|
|
439 |
if ( iRoot == aRoot && iRootBitmap && iRootMask )
|
|
440 |
{
|
|
441 |
return;
|
|
442 |
}
|
|
443 |
|
|
444 |
TIndicatorSet set;
|
|
445 |
set.iId = aRoot;
|
|
446 |
|
|
447 |
TInt index( iIndicatorArray.Find( set, TIndicatorSet::Compare ) );
|
|
448 |
|
|
449 |
if ( index >= 0 )
|
|
450 |
{
|
|
451 |
set = iIndicatorArray[ index ];
|
|
452 |
|
|
453 |
delete iRootBitmap;
|
|
454 |
iRootBitmap = NULL;
|
|
455 |
delete iRootMask;
|
|
456 |
iRootMask = NULL;
|
|
457 |
|
|
458 |
AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(),
|
|
459 |
set.iAknsItemIdRoot,
|
|
460 |
KAknsIIDQsnIconColors,
|
|
461 |
EAknsCIQsnIconColorsCG7,
|
|
462 |
iRootBitmap,
|
|
463 |
iRootMask,
|
|
464 |
set.iBmpFile,
|
|
465 |
set.iIconId,
|
|
466 |
set.iMaskId,
|
|
467 |
KRgbBlack );
|
|
468 |
iRoot = aRoot;
|
|
469 |
ReportChange();
|
|
470 |
}
|
|
471 |
|
|
472 |
}
|
|
473 |
|
|
474 |
// -----------------------------------------------------------------------------
|
|
475 |
// CFileManagerFolderNavigationPane::LoadFolderBitmapL
|
|
476 |
//
|
|
477 |
// -----------------------------------------------------------------------------
|
|
478 |
//
|
|
479 |
void CFileManagerFolderNavigationPane::LoadFolderBitmapL()
|
|
480 |
{
|
|
481 |
|
|
482 |
delete iFolderBitmap;
|
|
483 |
iFolderBitmap = NULL;
|
|
484 |
delete iFolderMask;
|
|
485 |
iFolderMask = NULL;
|
|
486 |
|
|
487 |
AknsUtils::CreateColorIconL( AknsUtils::SkinInstance(),
|
|
488 |
iAknsItemIdFolder,
|
|
489 |
KAknsIIDQsnIconColors,
|
|
490 |
EAknsCIQsnIconColorsCG7,
|
|
491 |
iFolderBitmap,
|
|
492 |
iFolderMask,
|
|
493 |
*iBmpFile,
|
|
494 |
iFolderIconId,
|
|
495 |
iFolderMaskId,
|
|
496 |
KRgbBlack );
|
|
497 |
}
|
|
498 |
|
|
499 |
// -----------------------------------------------------------------------------
|
|
500 |
// CFileManagerFolderNavigationPane::SetObserver
|
|
501 |
//
|
|
502 |
// -----------------------------------------------------------------------------
|
|
503 |
//
|
|
504 |
EXPORT_C void CFileManagerFolderNavigationPane::SetObserver(
|
|
505 |
MFileManagerFolderNaviObserver* aObserver )
|
|
506 |
{
|
|
507 |
iObserver = aObserver;
|
|
508 |
}
|
|
509 |
|
|
510 |
// -----------------------------------------------------------------------------
|
|
511 |
// CFileManagerFolderNavigationPane::CheckHitFolderLevel
|
|
512 |
//
|
|
513 |
// -----------------------------------------------------------------------------
|
|
514 |
//
|
|
515 |
TInt CFileManagerFolderNavigationPane::CheckHitFolderLevel(
|
|
516 |
const TPoint& aPos )
|
|
517 |
{
|
|
518 |
TInt ret( KErrNotFound );
|
|
519 |
TInt count( iDepth + 1 );
|
|
520 |
count = Min( KFileManagerMaxFolderDepth, count );
|
|
521 |
for ( TInt i( 0 ); i < count; ++i )
|
|
522 |
{
|
|
523 |
const TRect& bmpRect( iBitmapLayout[ i ].Rect() );
|
|
524 |
if ( bmpRect.Contains( aPos ) )
|
|
525 |
{
|
|
526 |
ret = i;
|
|
527 |
break;
|
|
528 |
}
|
|
529 |
}
|
|
530 |
return ret;
|
|
531 |
}
|
|
532 |
|
|
533 |
// -----------------------------------------------------------------------------
|
|
534 |
// CFileManagerFolderNavigationPane::HandlePointerEventL
|
|
535 |
//
|
|
536 |
// -----------------------------------------------------------------------------
|
|
537 |
//
|
|
538 |
void CFileManagerFolderNavigationPane::HandlePointerEventL(
|
|
539 |
const TPointerEvent& aPointerEvent )
|
|
540 |
{
|
|
541 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
542 |
{
|
|
543 |
return;
|
|
544 |
}
|
|
545 |
|
|
546 |
TInt level( KErrNotFound );
|
|
547 |
|
|
548 |
switch ( aPointerEvent.iType )
|
|
549 |
{
|
|
550 |
case TPointerEvent::EButton1Down:
|
|
551 |
{
|
|
552 |
level = CheckHitFolderLevel( aPointerEvent.iPosition );
|
|
553 |
if ( iObserver )
|
|
554 |
{
|
|
555 |
#ifdef RD_TACTILE_FEEDBACK
|
|
556 |
if (KErrNotFound != level)
|
|
557 |
{
|
|
558 |
MTouchFeedback* feedback = MTouchFeedback::Instance();
|
|
559 |
if ( feedback )
|
|
560 |
{
|
|
561 |
feedback->InstantFeedback( this, ETouchFeedbackBasic );
|
|
562 |
}
|
|
563 |
}
|
|
564 |
#endif //RD_TACTILE_FEEDBACK
|
|
565 |
|
|
566 |
iObserver->HandleFolderNaviEventL(
|
|
567 |
MFileManagerFolderNaviObserver::ENaviTapDown,
|
|
568 |
level );
|
|
569 |
}
|
|
570 |
iLongTap = EFalse;
|
|
571 |
break;
|
|
572 |
}
|
|
573 |
case TPointerEvent::EButton1Up:
|
|
574 |
{
|
|
575 |
level = CheckHitFolderLevel( aPointerEvent.iPosition );
|
|
576 |
if ( !iLongTap )
|
|
577 |
{
|
|
578 |
if ( iObserver )
|
|
579 |
{
|
|
580 |
iObserver->HandleFolderNaviEventL(
|
|
581 |
MFileManagerFolderNaviObserver::ENaviTapUp,
|
|
582 |
level );
|
|
583 |
}
|
|
584 |
}
|
|
585 |
else
|
|
586 |
{
|
|
587 |
iLongTap = EFalse;
|
|
588 |
}
|
|
589 |
break;
|
|
590 |
}
|
|
591 |
default:
|
|
592 |
{
|
|
593 |
break;
|
|
594 |
}
|
|
595 |
}
|
|
596 |
|
|
597 |
if ( iLongTapDetector && level != KErrNotFound )
|
|
598 |
{
|
|
599 |
iLongTapDetector->PointerEventL( aPointerEvent );
|
|
600 |
}
|
|
601 |
}
|
|
602 |
|
|
603 |
// -----------------------------------------------------------------------------
|
|
604 |
// CFileManagerFolderNavigationPane::HandleLongTapEventL
|
|
605 |
//
|
|
606 |
// -----------------------------------------------------------------------------
|
|
607 |
//
|
|
608 |
void CFileManagerFolderNavigationPane::HandleLongTapEventL(
|
|
609 |
const TPoint& aPenEventLocation,
|
|
610 |
const TPoint& /*aPenEventScreenLocation*/ )
|
|
611 |
{
|
|
612 |
if ( iObserver )
|
|
613 |
{
|
|
614 |
TInt level( CheckHitFolderLevel( aPenEventLocation ) );
|
|
615 |
iObserver->HandleFolderNaviEventL(
|
|
616 |
MFileManagerFolderNaviObserver::ENaviLongTap,
|
|
617 |
level );
|
|
618 |
}
|
|
619 |
iLongTap = ETrue;
|
|
620 |
}
|
|
621 |
|
|
622 |
// End of File
|