homesync/contentmanager/mediaservant/inc/msmaincontainer.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:  Definition for MediaServant main container class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_MSMAINCONTAINER_H
       
    20 #define C_MSMAINCONTAINER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <aknlists.h>
       
    24 #include <eiklbo.h>             // listbox observer
       
    25 #include "cmcommon.h"           // service types
       
    26 #include "msengineobserver.h"
       
    27 #include "msbasecontainer.h"
       
    28 #include "mspropertywatcher.h"
       
    29 #include "msmemorycardmonitor.h" //mmc event observer
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CAknIconArray;
       
    33 class CMSAppUi;
       
    34 class CMSEngine;
       
    35 class MMSEngineObserver;
       
    36 class CMSMainView;
       
    37 
       
    38 
       
    39 /**
       
    40  * CMSMainContainer class
       
    41  *  @since S60 5.1
       
    42  */
       
    43 NONSHARABLE_CLASS( CMSMainContainer ): public CMSBaseContainer,
       
    44                          public MEikListBoxObserver,
       
    45                          public MMSEngineObserver,
       
    46                          public MMSPropertyObserver,
       
    47                          public MMSMemoryCardObserver
       
    48     {
       
    49     // Icon enumerations
       
    50     enum TMSListBoxIcons
       
    51         {
       
    52         EIconSync = 0,
       
    53         EIconSyncStop,
       
    54         EIconToHome,
       
    55         EIconToHomeInactive,
       
    56         EIconFromHome,
       
    57         EIconFromHomeInactive,
       
    58         EIconCount
       
    59         };
       
    60     // Synchronization states
       
    61     enum TMSSyncState
       
    62         {
       
    63         ESyncNotRunning = 0,
       
    64         ESyncRunning,
       
    65         ESyncWaiting
       
    66         };
       
    67     
       
    68     // Update steps
       
    69     enum TMSUpdateStep
       
    70         {
       
    71         EFirstStep = 0,
       
    72         ESecondStep,
       
    73         EThirdStep,
       
    74         EForthStep,
       
    75         EEndStep
       
    76         };
       
    77         
       
    78     public:
       
    79         /**
       
    80          * Constructor.
       
    81          */
       
    82         CMSMainContainer( CMSAppUi& aAppUi,
       
    83                           CMSMainView& aView );
       
    84 
       
    85         /**
       
    86          * Symbian default constructor.
       
    87          */
       
    88         void ConstructL( TRect aRect );
       
    89 
       
    90         /**
       
    91          * Destructor.
       
    92          */
       
    93         virtual ~CMSMainContainer();    
       
    94 
       
    95         /**
       
    96          * sets manual wizard execution info
       
    97          * @param appWizardRun, wizard executed
       
    98          * @since S60 5.1
       
    99          */
       
   100         void SetManualWizardInfo( TBool aAppWizardRun );
       
   101 
       
   102         /**
       
   103          * Shows refresh indiction on navi pane
       
   104          * @since S60 5.1
       
   105          */
       
   106         void ShowRefreshIndicationL();
       
   107 
       
   108         /**
       
   109          * sets refresh state
       
   110          * @since S60 5.1
       
   111          */
       
   112         void StopRefreshL();
       
   113 
       
   114         /**
       
   115          * return highlighted item index
       
   116          * @since S60 5.1
       
   117          */
       
   118         TInt SelectedItemIndex();
       
   119 
       
   120         /**
       
   121          * Opens the selected listbox item
       
   122          * @since S60 5.1
       
   123          */
       
   124         void OpenSelectedListboxItemL();
       
   125 
       
   126         /**
       
   127          * Starts asynchronous metadata delete
       
   128          * @since S60 5.1
       
   129          */
       
   130         void StartMetadataDeleteL();
       
   131     
       
   132         void RunHarvest();
       
   133         // From base class MMSMemoryCardObserver
       
   134                 
       
   135                 /**
       
   136                  * From MMSMemoryCardObserver
       
   137                  * See base class definition
       
   138                  */
       
   139                  void MemoryCardChangedL( TMemoryCardEvent aEvent );        
       
   140     protected:
       
   141     
       
   142 // From base class CCoeControl    
       
   143 
       
   144         /**
       
   145          * From CCoeControl
       
   146          * See base class definition
       
   147          */
       
   148         void GetHelpContext(TCoeHelpContext& aContext) const;    
       
   149 
       
   150         /**
       
   151          * From CCoeControl
       
   152          * See base class definition
       
   153          */
       
   154         CCoeControl* ComponentControl(TInt aIndex) const;
       
   155 
       
   156         /**
       
   157          * From CCoeControl
       
   158          * See base class definition
       
   159          */
       
   160         TInt CountComponentControls() const;
       
   161 
       
   162         /**
       
   163          * From CCoeControl
       
   164          * See base class definition
       
   165          */
       
   166         void SizeChanged();
       
   167 
       
   168         /**
       
   169          * From CCoeControl
       
   170          * See base class definition
       
   171          */
       
   172         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   173                                      TEventCode aType );
       
   174 
       
   175         /**
       
   176          * From CCoeControl
       
   177          * See base class definition
       
   178          */
       
   179         void HandleResourceChange( TInt aType );
       
   180 
       
   181 // From base class MEikListBoxObserver
       
   182 
       
   183         /**
       
   184          * From MEikListBoxObserver
       
   185          * See base class definition
       
   186          */
       
   187         void HandleListBoxEventL( CEikListBox* aListBox,
       
   188                                   TListBoxEvent aEventType );
       
   189 
       
   190 // From base class MMSEngineObserver
       
   191 
       
   192         /**
       
   193          * From MMSEngineObserver
       
   194          * See base class definition
       
   195          */
       
   196         void ReadyL( TCmService aService, TInt aError );
       
   197 
       
   198 // From base class MMSPropertyObserver
       
   199 
       
   200         /**
       
   201          * From MMSPropertyObserver
       
   202          * See base class definition
       
   203          */
       
   204         void PropertyChangedL( TCmService aService,
       
   205                                TInt aTotalItems,
       
   206                                TInt aProcessedItems,
       
   207                                TInt /*aItemsToBeProcessed*/ );
       
   208                                
       
   209          
       
   210     private:
       
   211 
       
   212         /**
       
   213          * Updates listbox data
       
   214          * @since S60 5.1
       
   215          */
       
   216         void UpdateListBoxDataL();
       
   217 
       
   218         /**
       
   219          * Starts sync operation
       
   220          * @since S60 5.1
       
   221          */
       
   222         void StartSyncL();
       
   223 
       
   224         /**
       
   225          * Shows error note
       
   226          * @since S60 5.1
       
   227          * @param aTextResource, error text resource
       
   228          */
       
   229         void ShowErrorNoteL( TInt aTextResource );
       
   230 
       
   231         /**
       
   232          * Shows last synchronization time on navi pane
       
   233          * @since S60 5.1
       
   234          */
       
   235         void SetNaviTextLastSyncL();
       
   236 
       
   237         /**
       
   238          * Callback for periodic timer
       
   239          * @since S60 5.1
       
   240          * @param TAny, callback observer
       
   241          */
       
   242         static TInt TimerCallbackL(TAny* aObject);
       
   243 
       
   244         /**
       
   245          * Callback for navi pane timer
       
   246          * @since S60 5.1
       
   247          * @param TAny, callback observer
       
   248          */
       
   249         static TInt NaviTimerCallbackL(TAny* aObject);        
       
   250         
       
   251         /**
       
   252          * Static callback method for update list box data
       
   253          * @since S60 5.1
       
   254          * @param TAny, callback observer
       
   255          * @return
       
   256          */
       
   257         static TInt BackgroundUpdateListL( TAny* aObject );
       
   258         
       
   259         /**
       
   260          * Supdate list box data step by step
       
   261          * @since S60 5.1
       
   262          * @return
       
   263          */
       
   264         TInt UpdateListByStepL();
       
   265         
       
   266         /**
       
   267          * Checks if fill list is selected
       
   268          *
       
   269          * @since S60 5.1
       
   270          * @param None
       
   271          * @return TBool, ETrue if list is selected, EFalse otherwise
       
   272          */
       
   273         TBool CheckIfFillListSelected();
       
   274 
       
   275         /**
       
   276          * Shows 'refresh completed' text in navi pane
       
   277          *
       
   278          * @since S60 5.1
       
   279          * @param None
       
   280          * @return None
       
   281          */        
       
   282         void ShowRefreshCompleteTextL();
       
   283 
       
   284     private:
       
   285 
       
   286         /**
       
   287          * Listbox control
       
   288          */
       
   289         CEikFormattedCellListBox*               iListBox;       // owned
       
   290 
       
   291         /**
       
   292          * pointer to AppUi object
       
   293          */
       
   294         CMSAppUi*                               iAppUi;         // not owned
       
   295 
       
   296         /**
       
   297          * active refresh operation indicator
       
   298          */
       
   299         TBool                                   iRefreshRunning;
       
   300 
       
   301         /**
       
   302          * active sync operation indicator
       
   303          */
       
   304         TMSSyncState                            iSyncRunning;
       
   305 
       
   306         /**
       
   307          * active preprocess operation indicator
       
   308          */
       
   309         TBool                                   iPreprocessRunning;
       
   310 
       
   311         /**
       
   312          * containers view
       
   313          */
       
   314         CMSMainView*                            iView;           // not owned
       
   315 
       
   316         /**
       
   317          * Transfer time
       
   318          */
       
   319         TInt                                    iTransferTime;
       
   320         /**
       
   321          * Count of items to be stored
       
   322          */
       
   323         TInt                                    iItemsToBeStored;
       
   324         /**
       
   325          * Count of items to be filled
       
   326          */
       
   327         TInt                                    iItemsToBeFilled;
       
   328         /**
       
   329          * Progress watcher
       
   330          */
       
   331         CMSPropertyWatcher*                     iMSPropertyWatcher; // owned
       
   332         
       
   333         /**
       
   334          * MemoryCard monitor
       
   335          */
       
   336         CMSMemoryCardMonitor*                   iMemoryCardMonitor; // owned
       
   337 
       
   338         /**
       
   339          * Wizard execution flag
       
   340          */
       
   341         TBool                                   iAppWizardRun;
       
   342         
       
   343         /**
       
   344          * Last sync timer
       
   345          */
       
   346         CPeriodic*                              iPeriodic;          // Owned
       
   347         
       
   348         /**
       
   349          * Navi pane text timer
       
   350          */
       
   351         CPeriodic*                              iNaviTimer;         // Owned        
       
   352         
       
   353         /**
       
   354          * Idle time active object, Owend
       
   355          */
       
   356         CIdle*                                  iUpdateList;        // Owned
       
   357         
       
   358         /**
       
   359          *  the count of requests for refresh UI
       
   360          */
       
   361         TInt                                    iRequestCt;
       
   362         
       
   363         /**
       
   364          * current step of update list box
       
   365          */
       
   366         TMSUpdateStep                           iCurStep;
       
   367         
       
   368         /**
       
   369          * Fill list selection status
       
   370          */
       
   371         TBool                                   iFillListSelected;
       
   372     };
       
   373 
       
   374 #endif // C_MSMAINCONTAINER_H