homesync/contentmanager/cmserver/cmstoremanager/inc/cmsmvideoandimagemngr.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 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:  store file manager for images and videos
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CMSMVIDEOANDIMAGEMNGR_H
       
    21 #define __CMSMVIDEOANDIMAGEMNGR_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <badesca.h>
       
    25 #include <mdequery.h>
       
    26 #include "cmcommontypes.h"
       
    27 #include "cmcommon.h"
       
    28 #include "cmsmcommon.h"
       
    29 
       
    30 // Forward declarations
       
    31 class CMdESession;
       
    32 class CMdENamespaceDef;
       
    33 class CMdEObjectDef;
       
    34 class CMdEObjectQuery;
       
    35 class CMdEPropertyDef;
       
    36 class CCmStoreListItem;
       
    37 class CCmSmFileMngr;
       
    38 class CMdEObject;
       
    39 class MCmSmVideoAndImageMngrObserver;
       
    40 
       
    41 // CLASS DECLARATION 
       
    42     
       
    43  /**
       
    44   *  Video and Image manager class definition
       
    45   *
       
    46   *  @lib cmstoremanager.lib
       
    47   *
       
    48   *  @since S60 5.1
       
    49   */
       
    50 NONSHARABLE_CLASS( CCmSmVideoAndImageMngr ): public CActive,
       
    51                                public MMdEQueryObserver
       
    52     {      
       
    53          
       
    54 public:
       
    55 
       
    56     /**
       
    57      * Two-phased constructor.
       
    58      *
       
    59      * @since S60 5.1     
       
    60      * @param aObserver, observer class
       
    61      * @param aFileMngr, file manager
       
    62      * @param aSession, mde session
       
    63      * @param aItems, store list items
       
    64      * @return  pointer to CCmSmVideoAndImageMngr class
       
    65      */
       
    66     static CCmSmVideoAndImageMngr* NewL( 
       
    67         MCmSmVideoAndImageMngrObserver& aObserver,
       
    68         CCmSmFileMngr& aFileMngr, CMdESession& aSession, 
       
    69         RPointerArray<CCmStoreListItem>& aItems );
       
    70     
       
    71     /**
       
    72      * Two-phased constructor.
       
    73      *
       
    74      * @since S60 5.1     
       
    75      * @param aObserver, observer class
       
    76      * @param aFileMngr, file manager
       
    77      * @param aSession, mde session
       
    78      * @param aItems, store list items     
       
    79      * @return  pointer to CCmSmVideoAndImageMngr class
       
    80      */
       
    81     static CCmSmVideoAndImageMngr* NewLC(  
       
    82         MCmSmVideoAndImageMngrObserver& aObserver,
       
    83         CCmSmFileMngr& aFileMngr, CMdESession& aSession,
       
    84         RPointerArray<CCmStoreListItem>& aItems );
       
    85 
       
    86     /**
       
    87      * Destructor.
       
    88      */
       
    89     virtual ~CCmSmVideoAndImageMngr();
       
    90 
       
    91 public: 
       
    92 
       
    93     /**
       
    94      * Starts video/image list processing
       
    95      *
       
    96      * @since S60 5.1
       
    97      * @param aType, media type to be processed
       
    98      * @return None
       
    99      */
       
   100     void ProcessMedia( TCmMediaType aType );  
       
   101         
       
   102     /**
       
   103      * Canceling file processing
       
   104      *
       
   105      * @since S60 5.1
       
   106      * @param None
       
   107      * @return None
       
   108      */    
       
   109     void CancelOperation();
       
   110 
       
   111     /**
       
   112      * Canceling clf refress
       
   113      *
       
   114      * @since S60 5.1
       
   115      * @param None
       
   116      * @return None
       
   117      */        
       
   118     void CancelListRefresh();                    
       
   119     
       
   120     /**
       
   121      * Filters files from the clf lists
       
   122      *
       
   123      * @since S60 5.1
       
   124      * @param None
       
   125      * @return None
       
   126      */        
       
   127     void FilterItems();
       
   128 
       
   129     /**
       
   130      * Filters defined media files from the clf lists
       
   131      *
       
   132      * @since S60 5.1
       
   133      * @param aDeviceIds, devices
       
   134      * @param aType, media type
       
   135      * @return None
       
   136      */        
       
   137     void FilterNewItemsL( RArray<TInt>aDeviceIds, 
       
   138     TCmMediaType aType );
       
   139 
       
   140 protected:
       
   141 
       
   142 // From base class MMdEQueryObserver
       
   143 
       
   144     /**
       
   145      * From MMdEQueryObserver
       
   146      * See base class definition
       
   147      */
       
   148     void HandleQueryNewResults(CMdEQuery& aQuery,
       
   149                                        TInt aFirstNewItemIndex,
       
   150                                        TInt aNewItemCount);
       
   151           
       
   152     /**
       
   153      * From MMdEQueryObserver
       
   154      * See base class definition
       
   155      */
       
   156     void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);  
       
   157 
       
   158 // From base class CActive
       
   159 
       
   160     /**
       
   161      * From CActive
       
   162      * See base class definition
       
   163      */
       
   164     void RunL();
       
   165 
       
   166     /**
       
   167      * From CActive
       
   168      * See base class definition
       
   169      */
       
   170     void DoCancel();
       
   171     
       
   172     /**
       
   173      * From CActive
       
   174      * See base class definition
       
   175      */  
       
   176     TInt RunError( TInt aError );        
       
   177     
       
   178 private:
       
   179 
       
   180    /**
       
   181      * Creates query for defined media type
       
   182      *
       
   183      * @since S60 5.1
       
   184      * @param aType, media type
       
   185      * @return None
       
   186      */ 
       
   187     void SetQueryAndStartFindL( TCmMediaType aType );
       
   188     
       
   189    /**
       
   190      * Sets property filters
       
   191      *
       
   192      * @since S60 5.1
       
   193      * @param None
       
   194      * @return None
       
   195      */ 
       
   196     void SetPropertyFiltersL( );
       
   197     
       
   198    /**
       
   199      * Sets logic condition
       
   200      *
       
   201      * @since S60 5.1
       
   202      * @param aType, media type ( phone or other )
       
   203      * @return None
       
   204      */
       
   205     void SetLogicConditionL( TCmMediaType aType );
       
   206 
       
   207    /**
       
   208      * Resets mde query
       
   209      *
       
   210      * @since S60 5.1
       
   211      * @param None
       
   212      * @return None
       
   213      */     
       
   214     void ResetQuery();
       
   215     
       
   216    /**
       
   217      * Completes request
       
   218      *
       
   219      * @since S60 5.1
       
   220      * @param aStatus, defined id for the completing 
       
   221      * @return None
       
   222      */     
       
   223     void CompleteRequest( TCmSmFileProcessingStatus aStatus );
       
   224 
       
   225    /**
       
   226      * Collects item info from mde objects
       
   227      *
       
   228      * @since S60 5.1
       
   229      * @param aType, media type
       
   230      * @return TCmListItemStatus, list status value
       
   231      */     
       
   232     TCmListItemStatus CollectItemDataL( TCmMediaType aType );            
       
   233             
       
   234     /**
       
   235      * Performs the first phase of two phase construction.
       
   236      *
       
   237      * @since S60 5.1
       
   238      * @param aObserver, video and image manager observer
       
   239      * @param aFileMngr, file manager
       
   240      * @param aSession, Mde session
       
   241      * @param aItems, Store items
       
   242      * @return None
       
   243      */
       
   244     CCmSmVideoAndImageMngr(  
       
   245         MCmSmVideoAndImageMngrObserver& aObserver,
       
   246         CCmSmFileMngr& aFileMngr, CMdESession& aSession,
       
   247         RPointerArray<CCmStoreListItem>& aItems );
       
   248 
       
   249     /**
       
   250      * Performs the second phase construction.
       
   251      */
       
   252     void ConstructL();
       
   253 
       
   254 private: 
       
   255 
       
   256     /**
       
   257      * Observer
       
   258      */
       
   259     MCmSmVideoAndImageMngrObserver& iObserver;
       
   260     
       
   261     /**
       
   262      * Reference to main file manager
       
   263      */
       
   264     CCmSmFileMngr& iFileMngr;
       
   265     
       
   266     /**
       
   267      * MdE session
       
   268      */
       
   269     CMdESession& iSession;                                
       
   270         
       
   271     /**
       
   272      * Reference to store list items
       
   273      */
       
   274     RPointerArray<CCmStoreListItem>& iItems;
       
   275     
       
   276     /**
       
   277      * mde namespace
       
   278      */
       
   279     CMdENamespaceDef* iNamespace;                           // owned
       
   280     
       
   281     /**
       
   282      * Object definition ( Image/Video )
       
   283      */
       
   284     CMdEObjectDef* iObjectDef;                              // owned
       
   285         
       
   286     /**
       
   287      * Object definition ( Image/Video )
       
   288      */
       
   289     CMdEObjectDef* iMediaTypeDef;                           // owned
       
   290     
       
   291     /**
       
   292      * Object query
       
   293      */
       
   294     CMdEObjectQuery* iQuery;                                // owned
       
   295     
       
   296     /**
       
   297      * Queried property
       
   298      */
       
   299     CMdEPropertyDef* iTitleDef;                             // owned
       
   300     
       
   301     /**
       
   302      * Queried property
       
   303      */
       
   304     CMdEPropertyDef* iSizeDef;                              // owned
       
   305     
       
   306     /**
       
   307      * Queried property
       
   308      */
       
   309     CMdEPropertyDef* iDateDef;                              // owned
       
   310     
       
   311     /**
       
   312      * Metadata object array
       
   313      */
       
   314     RPointerArray<CMdEObject> iObjects;                     // Owned
       
   315     
       
   316     /**
       
   317      * Defines which media query is active
       
   318      */
       
   319     TCmMediaType iQueriedMedia;
       
   320     
       
   321     };
       
   322 
       
   323 #endif //  __CMSMVIDEOANDIMAGEMNGR_H
       
   324