homesync/contentmanager/cmserver/cmfillmanager/inc/cmfmmdeduplicatedetector.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:  Handles duplicate detection for images and videos
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CMFMMDEDUPLICATEDETECTOR_H
       
    21 #define __CMFMMDEDUPLICATEDETECTOR_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <mdequery.h>
       
    25 
       
    26 
       
    27 // Forward declarations
       
    28 class CCmFillListItem;
       
    29 class MCmFmItemHandlerObserver;
       
    30 class CMdESession;
       
    31 class CMdENamespaceDef;
       
    32 class CMdEObjectDef;
       
    33 class CMdEObjectQuery;
       
    34 class CMdEPropertyDef;
       
    35 
       
    36 // Class declarations
       
    37 
       
    38 /**
       
    39  *  CCmFmMdEDuplicateDetector class
       
    40  *  Part of Fill manager. CCmFmMdEDuplicateDetector manages
       
    41  *  duplicate detection for images and videos
       
    42  *
       
    43  *  @lib cmfillmanager.lib
       
    44  *
       
    45  *  @since S60 5.1
       
    46  */
       
    47 NONSHARABLE_CLASS( CCmFmMdEDuplicateDetector ) : public CBase,
       
    48                                   public MMdEQueryObserver
       
    49     {
       
    50 
       
    51 public:    
       
    52 
       
    53     /**
       
    54      * Two-phased constructor.
       
    55      *
       
    56      * @since S60 5.1
       
    57      * @param aObserver, observer class
       
    58      * @param aSession, mde session
       
    59      * @return  pointer to CCmFmMdEDuplicateDetector class
       
    60      */
       
    61     static CCmFmMdEDuplicateDetector* NewL( 
       
    62         MCmFmItemHandlerObserver& aObserver, CMdESession& aSession );
       
    63     
       
    64     /**
       
    65      * Two-phased constructor.
       
    66      *
       
    67      * @since S60 5.1
       
    68      * @param aObserver, observer class  
       
    69      * @param aSession, mde session   
       
    70      * @return  pointer to CCmFmMdEDuplicateDetector class
       
    71      */
       
    72     static CCmFmMdEDuplicateDetector* NewLC( 
       
    73         MCmFmItemHandlerObserver& aObserver, CMdESession& aSession );
       
    74 
       
    75     /**
       
    76      * Destructor.
       
    77      */
       
    78     virtual ~CCmFmMdEDuplicateDetector();
       
    79     
       
    80 public:
       
    81 
       
    82     /**
       
    83      * Check if file is duplicate.
       
    84      *
       
    85      * @since S60 5.1     
       
    86      * @param aItem, item to be checked
       
    87      * @return None
       
    88      */
       
    89     void CheckImageOrVideoL( const CCmFillListItem& aItem );
       
    90 
       
    91     /**
       
    92      * Add to items array for duplicated check
       
    93      * @param aItem, item to be append
       
    94      * @return None
       
    95      */
       
    96     void AppendToArrayL( const CCmFillListItem& aItem );
       
    97 
       
    98     /**
       
    99      * reset the duplicator check array
       
   100      * @param None
       
   101      * @return None
       
   102      */
       
   103     void ResetArray();
       
   104 
       
   105 
       
   106 protected: 
       
   107 
       
   108 // From base class MMdEQueryObserver  
       
   109 
       
   110     /**
       
   111      * From MMdEQueryObserver
       
   112      * See base class definition
       
   113      */
       
   114     void HandleQueryNewResults( CMdEQuery& aQuery,
       
   115                                 TInt aFirstNewItemIndex,
       
   116                                 TInt aNewItemCount );
       
   117           
       
   118     /**
       
   119      * From MMdEQueryObserver
       
   120      * See base class definition
       
   121      */
       
   122     void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); 
       
   123 	
       
   124 private:
       
   125     
       
   126     /**
       
   127      * Set logic condition for image and video item query
       
   128      *
       
   129      * @since S60 5.1        
       
   130      * @param aItem, item to be checked
       
   131      * @return None
       
   132      */    
       
   133     void SetLogicConditionL( const CCmFillListItem& aItem );    
       
   134 
       
   135     /**
       
   136      * Check if file is duplicate by compareing with array.
       
   137      * @param aItem, item to be checked
       
   138      * @return None
       
   139      */
       
   140     void CheckImageOrVideoLIfDuplicated( const CCmFillListItem& aItem );
       
   141 
       
   142 private:
       
   143 
       
   144     /**
       
   145      * Performs the first phase of two phase construction.
       
   146      *
       
   147      * @since S60 5.1
       
   148      * @param aObserver, item handler observer
       
   149      * @param aSession, mde session
       
   150      */
       
   151     CCmFmMdEDuplicateDetector( MCmFmItemHandlerObserver& aObserver, 
       
   152         CMdESession& aSession );
       
   153 
       
   154     /**
       
   155      * Performs the second phase construction.
       
   156      */
       
   157     void ConstructL( );
       
   158     
       
   159 
       
   160 private:
       
   161 
       
   162     /**
       
   163      * Observer class
       
   164      */
       
   165     MCmFmItemHandlerObserver& iObserver;
       
   166  
       
   167      /**
       
   168       * MdE session
       
   169       */
       
   170     CMdESession& iSession;
       
   171        
       
   172     /**
       
   173      * mde namespace
       
   174      */
       
   175     CMdENamespaceDef* iNamespace;               // owned
       
   176     
       
   177     /**
       
   178      * Object definition ( Image/Video )
       
   179      */
       
   180     CMdEObjectDef* iObjectDef;                  // owned
       
   181 
       
   182     /**
       
   183      * Object definition ( Image/Video )
       
   184      */
       
   185     CMdEObjectDef* iMediaTypeDef; // owned
       
   186 
       
   187     /**
       
   188      * Object query
       
   189      */
       
   190     CMdEObjectQuery* iQuery;                    // owned
       
   191         
       
   192     /**
       
   193      * Queried property
       
   194      */
       
   195     CMdEPropertyDef* iTitle;                    // owned
       
   196     
       
   197     /**
       
   198      * Queried property
       
   199      */
       
   200     CMdEPropertyDef* iSize;                     // owned
       
   201     
       
   202     /**
       
   203      * Queried property
       
   204      */
       
   205     CMdEPropertyDef* iDate;                     // owned
       
   206 
       
   207     /**
       
   208      * Item to be checked
       
   209      */
       
   210     CCmFillListItem* iCheckItem;
       
   211 
       
   212     /**
       
   213      * Array of fill list items
       
   214      */
       
   215     RPointerArray<CCmFillListItem> iExistFiles; // Owned
       
   216 
       
   217     /**
       
   218      * current download media type
       
   219      */
       
   220     TCmMediaType iCurrentMediaType;
       
   221 
       
   222     };
       
   223 
       
   224 #endif //  __CMFMMDEDUPLICATEDETECTOR_H