ui/viewmanagement/statehandler/src/glxstatemanager.cpp
changeset 70 a91aa46552be
parent 55 fb37077c270f
equal deleted inserted replaced
67:199e6e1e0b54 70:a91aa46552be
    60       mImageviewerMediaModel( NULL ), 
    60       mImageviewerMediaModel( NULL ), 
    61       mCurrentModel( NULL ), 
    61       mCurrentModel( NULL ), 
    62       mCurrentState( NULL ), 
    62       mCurrentState( NULL ), 
    63       mActionHandler( NULL ),
    63       mActionHandler( NULL ),
    64       mTNObserver ( NULL ),
    64       mTNObserver ( NULL ),
    65       isProgressbarRunning ( false )
    65       isProgressbarRunning ( false ),
       
    66       mFetcherFilterType ( EGlxFetcherFilterNone )
    66 {
    67 {
    67     qDebug("GlxStateManager::GlxStateManager");
    68     qDebug("GlxStateManager::GlxStateManager");
    68     PERFORMANCE_ADV ( d1, "view manager creation time") {
    69     PERFORMANCE_ADV ( d1, "view manager creation time") {
    69         mViewManager = new GlxViewManager();
    70         mViewManager = new GlxViewManager();
    70     }
    71     }
   119         mTNObserver->stopTNMDaemon();
   120         mTNObserver->stopTNMDaemon();
   120     }
   121     }
   121     return QObject::eventFilter(obj, event);
   122     return QObject::eventFilter(obj, event);
   122 }
   123 }
   123 
   124 
   124 void GlxStateManager::launchFetcher()
   125 void GlxStateManager::launchFetcher(int fetcherFilterType)
   125 {
   126 {
   126     qDebug("GlxStateManager::launchFetcher");
   127     qDebug("GlxStateManager::launchFetcher");
   127     mCurrentState = createState(GLX_GRIDVIEW_ID);
   128     mCurrentState = createState(GLX_GRIDVIEW_ID);
   128     mCurrentState->setState(FETCHER_ITEM_S);
   129     mCurrentState->setState(FETCHER_ITEM_S);
   129     
   130 	mFetcherFilterType = (GlxFetcherFilterType)fetcherFilterType;
   130     createModel(GLX_GRIDVIEW_ID);
   131     createModel(GLX_GRIDVIEW_ID);
   131     mViewManager->launchApplication( GLX_GRIDVIEW_ID, mCurrentModel);
   132     mViewManager->launchApplication( GLX_GRIDVIEW_ID, mCurrentModel);
   132 }
   133 }
   133 
   134 
   134 void GlxStateManager::launchApplication()
   135 void GlxStateManager::launchApplication()
   576 
   577 
   577 void GlxStateManager::createGridModel(int internalState, NavigationDir dir)
   578 void GlxStateManager::createGridModel(int internalState, NavigationDir dir)
   578 {
   579 {
   579     GlxModelParm modelParm;
   580     GlxModelParm modelParm;
   580     GlxContextMode mode;
   581     GlxContextMode mode;
   581     
   582     modelParm.setFilterType(EGlxFilterImage);
   582     if ( mViewManager->orientation() == Qt::Horizontal ) {
   583     if ( mViewManager->orientation() == Qt::Horizontal ) {
   583         mode = GlxContextLsGrid ;
   584         mode = GlxContextLsGrid ;
   584     }
   585     }
   585     else {
   586     else {
   586         mode = GlxContextPtGrid ;
   587         mode = GlxContextPtGrid ;
   587     }
   588     }
   588     
   589     
   589     switch( internalState) {
   590     switch( internalState) {
   590     case ALL_ITEM_S :
   591     case ALL_ITEM_S :
   591 	case FETCHER_ITEM_S:
       
   592         if ( mAllMediaModel == NULL ) {
   592         if ( mAllMediaModel == NULL ) {
   593             modelParm.setCollection( KGlxCollectionPluginAllImplementationUid );
   593             modelParm.setCollection( KGlxCollectionPluginAllImplementationUid );
   594             modelParm.setDepth(0);
   594             modelParm.setDepth(0);
   595             modelParm.setContextMode( mode ) ;
   595             modelParm.setContextMode( mode ) ;
   596             mAllMediaModel = new GlxMediaModel( modelParm );
   596             mAllMediaModel = new GlxMediaModel( modelParm );
   597         }
   597         }
   598         mCollectionId = KGlxCollectionPluginAllImplementationUid;
   598         mCollectionId = KGlxCollectionPluginAllImplementationUid;
   599         mCurrentModel = mAllMediaModel;
   599         mCurrentModel = mAllMediaModel;
   600         mViewManager->updateToolBarIcon(GLX_ALL_ACTION_ID);
   600         mViewManager->updateToolBarIcon(GLX_ALL_ACTION_ID);
   601         break;
   601         break;
       
   602 
       
   603     case FETCHER_ITEM_S:
       
   604         if ( mAllMediaModel == NULL ) {
       
   605             modelParm.setCollection( KGlxCollectionPluginAllImplementationUid );
       
   606             modelParm.setDepth(0); 
       
   607             if(EGlxFetcherFilterNone != mFetcherFilterType ){
       
   608                 modelParm.setFilterType(EGlxFilterFetcherMimeType);
       
   609                 modelParm.setFetcherFiterType(mFetcherFilterType);
       
   610             }
       
   611             modelParm.setContextMode( mode ) ;
       
   612             mAllMediaModel = new GlxMediaModel( modelParm );
       
   613         }
       
   614         mCollectionId = KGlxCollectionPluginAllImplementationUid;
       
   615         mCurrentModel = mAllMediaModel;
       
   616         mViewManager->updateToolBarIcon(GLX_ALL_ACTION_ID);
       
   617         break;
   602         
   618         
   603     case ALBUM_ITEM_S :
   619     case ALBUM_ITEM_S :
   604     case FETCHER_ALBUM_ITEM_S :    
       
   605         if ( dir != BACKWARD_DIR ) { 
   620         if ( dir != BACKWARD_DIR ) { 
   606             modelParm.setCollection( KGlxAlbumsMediaId );
   621             modelParm.setCollection( KGlxAlbumsMediaId );
   607             modelParm.setDepth(0);
   622             modelParm.setDepth(0);
   608             modelParm.setContextMode( mode ) ;
   623             modelParm.setContextMode( mode ) ;
   609             mAlbumGridMediaModel = new GlxMediaModel( modelParm );
   624             mAlbumGridMediaModel = new GlxMediaModel( modelParm );
   610         }               
   625         }               
   611         mCollectionId = KGlxAlbumsMediaId;
   626         mCollectionId = KGlxAlbumsMediaId;
   612         mCurrentModel = mAlbumGridMediaModel ;
   627         mCurrentModel = mAlbumGridMediaModel ;
   613         mViewManager->updateToolBarIcon(NO_ACTION_ID);
   628         break;
       
   629 
       
   630     case FETCHER_ALBUM_ITEM_S :    
       
   631         if ( dir != BACKWARD_DIR ) { 
       
   632             modelParm.setCollection( KGlxAlbumsMediaId );
       
   633             modelParm.setDepth(0);
       
   634             if(EGlxFetcherFilterNone != mFetcherFilterType){
       
   635                 modelParm.setFilterType(EGlxFilterFetcherMimeType);
       
   636                 modelParm.setFetcherFiterType(mFetcherFilterType);
       
   637             }
       
   638             modelParm.setContextMode( mode ) ;
       
   639             mAlbumGridMediaModel = new GlxMediaModel( modelParm );
       
   640         }               
       
   641         mCollectionId = KGlxAlbumsMediaId;
       
   642         mCurrentModel = mAlbumGridMediaModel ;
   614         break;
   643         break;
   615     
   644     
   616     default :
   645     default :
   617         break;
   646         break;
   618     }
   647     }