commonuis/CommonDialogs/src/CAknFileSelectionEventHandler.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
    22 #include <eikbtgpc.h> // CEikButtonGroupContainer
    22 #include <eikbtgpc.h> // CEikButtonGroupContainer
    23 #include <avkon.hrh>
    23 #include <avkon.hrh>
    24 
    24 
    25 #include "CAknFileSelectionModel.h"
    25 #include "CAknFileSelectionModel.h"
    26 #include "MAknFileSelectionObserver.h"
    26 #include "MAknFileSelectionObserver.h"
       
    27 #include "CAknCommonDialogsPopupList.h"
       
    28 #include "CAknCFDFileSystemEvent.h"
    27 #include "AknCFDUtility.h"
    29 #include "AknCFDUtility.h"
    28 
    30 
    29 
    31 
    30 
    32 
    31 // ============================ MEMBER FUNCTIONS ===============================
    33 // ============================ MEMBER FUNCTIONS ===============================
    91     }
    93     }
    92 
    94 
    93 // Destructor
    95 // Destructor
    94 CAknFileSelectionEventHandler::~CAknFileSelectionEventHandler()
    96 CAknFileSelectionEventHandler::~CAknFileSelectionEventHandler()
    95     {
    97     {
       
    98     if(iFSObserver)
       
    99         {
       
   100         iFSObserver->Cancel();
       
   101         delete iFSObserver;
       
   102         iFSObserver = NULL;
       
   103         }
    96     }
   104     }
    97 
   105 
    98 
   106 
    99 // -----------------------------------------------------------------------------
   107 // -----------------------------------------------------------------------------
   100 // CAknFileSelectionEventHandler::PushIndicesL
   108 // CAknFileSelectionEventHandler::PushIndicesL
   288         {
   296         {
   289         case ERightSoftkeyPress: // USER HAS HIT RIGHT SOFTKEY
   297         case ERightSoftkeyPress: // USER HAS HIT RIGHT SOFTKEY
   290             {
   298             {
   291             if( iModel->DirectoryLevel() > 0 ) // We are not in the root folder
   299             if( iModel->DirectoryLevel() > 0 ) // We are not in the root folder
   292                 {
   300                 {
   293                 while( ETrue ) // Find until existing contents
   301                 while( iModel->DirectoryLevel() > 0 ) // Find until existing contents
   294                     {
   302                     {
   295                     entries = iModel->GotoParentFolderL();
   303                     entries = iModel->GotoParentFolderL();
   296                     PopIndices( aTopItemIndex, aFocusedItemIndex );
   304                     PopIndices( aTopItemIndex, aFocusedItemIndex );
   297                     if( entries > 0 || entries < KErrNotFound )
   305                     if( entries > 0 || entries < KErrNotFound )
   298                         {
   306                         {
   305                         {
   313                         {
   306                         aFocusedItemIndex = entries - 1;
   314                         aFocusedItemIndex = entries - 1;
   307                         }
   315                         }
   308                     UpdateSoftkeysL( aFocusedItemIndex, aContainer );
   316                     UpdateSoftkeysL( aFocusedItemIndex, aContainer );
   309                     returnType = EItemsUpdated;
   317                     returnType = EItemsUpdated;
       
   318                     }
       
   319                 else
       
   320                     {
       
   321                     returnType = ETryingToExit;
   310                     }
   322                     }
   311                 }
   323                 }
   312             else // We are in the root folder
   324             else // We are in the root folder
   313                 {
   325                 {
   314                 returnType = ETryingToExit;
   326                 returnType = ETryingToExit;
   382             }
   394             }
   383         }
   395         }
   384     return returnType;
   396     return returnType;
   385     }
   397     }
   386 
   398 
       
   399 void CAknFileSelectionEventHandler::StartFileSystemNotifierL(CAknCommonDialogsPopupList* aPopupList)
       
   400     {
       
   401     iPopupList = aPopupList;
       
   402     TPath path;
       
   403     iModel->GetCurrentPath(path);
       
   404     iFSObserver = CAknCFDFileSystemEvent::NewL(iCoeEnv->FsSession(),*this,
       
   405             ENotifyEntry,path);
       
   406     }
       
   407 void CAknFileSelectionEventHandler::StopFileSystemNotifier()
       
   408     {
       
   409     iFSObserver->Cancel();
       
   410     }
       
   411 void CAknFileSelectionEventHandler::NotifyFileSystemChangedL()
       
   412     {
       
   413     iModel->UpdateItemListL();
       
   414     iPopupList->HandleFileSystemChangedL(iModel);
       
   415     iFSObserver->Setup();
       
   416     }
   387 // End of File
   417 // End of File