homesync/contentmanager/homesyncwizard/inc/cmsappwizard.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:  Header file for the Setup wizard class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CMSAPPWIZARD
       
    22 #define CMSAPPWIZARD
       
    23 
       
    24 // INCLUDES
       
    25 #include <aknmessagequerydialog.h>
       
    26 #include <AknWaitDialog.h>
       
    27 #include "upnpavdeviceobserver.h"
       
    28 
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CCmMediaServerFull;
       
    32 class CMSEngine;
       
    33 class CMSSelectionStorage;
       
    34 class CMSMultiselectionPopup;
       
    35 class MUPnPAVController;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40   * CMSAppWizard class
       
    41   * Class implementing the functionality of the setup wizard
       
    42   *
       
    43   * @since S60 5.1
       
    44   *
       
    45   * @lib msappwizard.lib
       
    46   */
       
    47 NONSHARABLE_CLASS( CMSAppWizard ) : public CBase,
       
    48                                     public MUPnPAVDeviceObserver,
       
    49                                     public MProgressDialogCallback
       
    50     {
       
    51 
       
    52     // Wizard steps
       
    53     enum TWizardStep
       
    54         {
       
    55         EStep1 = 0,
       
    56         EStep2,
       
    57         EStep3,
       
    58         EStep4,
       
    59         EStep5,
       
    60         EStep6,
       
    61         EStep7,
       
    62         EStep8,
       
    63         EStep9,
       
    64         EStep10,
       
    65         EStep11,
       
    66         EStep12,
       
    67         ELastStep,
       
    68         EWizardEnd,
       
    69         ECancelWizard
       
    70         };
       
    71 
       
    72     public:     // Constructors and destructor
       
    73 
       
    74         /**
       
    75          * Two-phased constructor.
       
    76          *
       
    77          * @since S60 5.1
       
    78          * @param aMSEngine, application engine
       
    79          * @return CMSAppWizard pointer
       
    80          */
       
    81         IMPORT_C static CMSAppWizard* NewL( CMSEngine& aMSEngine );
       
    82 
       
    83         /**
       
    84          * Two-phased constructor.
       
    85          *
       
    86          * @since S60 5.1
       
    87          * @param aMSEngine, application engine
       
    88          * @return CMSAppWizard pointer
       
    89          */
       
    90         IMPORT_C static CMSAppWizard* NewLC( CMSEngine& aMSEngine );        
       
    91 
       
    92         /**
       
    93          * Destructor.
       
    94          */
       
    95         virtual ~CMSAppWizard();
       
    96 
       
    97 
       
    98     public:
       
    99 
       
   100         /**
       
   101          * Starts wizard
       
   102          * @since S60 5.1
       
   103          * @return TInt, sk button, 0 if cancelled
       
   104          */
       
   105         IMPORT_C TInt StartL();
       
   106 
       
   107 
       
   108 
       
   109     public: // Methods from MProgressDialogCallback
       
   110 
       
   111         /**
       
   112          * Handles the situation when the dialog
       
   113          * is dismissed.
       
   114          *
       
   115          * @since S60 5.1
       
   116          * @param aButtonId The identifier of the button, with which the
       
   117          *                  dialog was dismissed.
       
   118          * @return None
       
   119          */
       
   120         void DialogDismissedL( TInt aButtonId );
       
   121 
       
   122 
       
   123     private:
       
   124 
       
   125         /**
       
   126          * Show the information note with OK BACK buttons
       
   127          *
       
   128          * @since S60 5.1
       
   129          * @param aMain, resource ID
       
   130          * @param aHeading, heading text
       
   131          * @return keycode of the button user has pressed.
       
   132          */
       
   133         TInt ShowInfoStepL( TInt aMain, TPtr aHeading );
       
   134 
       
   135         /**
       
   136          * Show the UI dialog with selection list
       
   137          *
       
   138          * @since S60 5.1
       
   139          * @param aMain, resource ID
       
   140          * @param aHeading, heading text
       
   141          * @return keycode of the button user has pressed.
       
   142          */
       
   143         TInt ShowListStepL( TInt aMain, TPtr aHeading );
       
   144 
       
   145         /**
       
   146          * Shows the step for setting shared content
       
   147          *
       
   148          * @since S60 5.1
       
   149          * @param aItemArray, item array
       
   150          * @param aResultArray, selected indexes
       
   151          * @param aHeading, heading text
       
   152          * @return keycode of the button user has pressed.
       
   153          */
       
   154         TInt ShowMultiselectionStepL( CDesCArrayFlat& aItemArray,
       
   155                                       CArrayFix<TInt>& aResultArray,
       
   156                                       TPtr aHeading );
       
   157 
       
   158         /**
       
   159          * Determines the next wizard step
       
   160          *
       
   161          * @since S60 5.1
       
   162          * @param aSelection, forward / backward
       
   163          */
       
   164         void SetNextStep( const TInt aDirection );
       
   165 
       
   166         /**
       
   167          * Cancels device search operation.
       
   168          *
       
   169          * @since S60 5.1
       
   170          * @param None
       
   171          * @return None
       
   172          */
       
   173         void CancelDeviceSearch();
       
   174 
       
   175         /**
       
   176          * Creates AV controller.
       
   177          *
       
   178          * @since S60 5.1
       
   179          * @param None
       
   180          * @return operation success. KErrNone if succesfull
       
   181          */
       
   182         TInt CreateAvControllerL();
       
   183 
       
   184         /**
       
   185          * Updates multiselection dialog content.
       
   186          *
       
   187          * @since S60 5.1
       
   188          * @param None
       
   189          * @return None
       
   190          */
       
   191         void UpdateDevicePopupDlgL();
       
   192 
       
   193         /**
       
   194          * Show the UI dialog with selection list
       
   195          *
       
   196          * @since S60 5.1
       
   197          * @param aServer, server name
       
   198          * @param aServerIndex, server array index
       
   199          * @return comparison result.
       
   200          */
       
   201         TInt MatchFoundServer( TDesC8& aServer, TInt &aServerIndex );
       
   202 
       
   203         /**
       
   204          * Sets server state to deleted if needed
       
   205          * And updates server name
       
   206          *
       
   207          * @since S60 5.1
       
   208          * @param None
       
   209          * @return None         
       
   210          */
       
   211         void CheckAndSetServerStateL();
       
   212 
       
   213         /**
       
   214          * Fetches devices from AVController and calls 
       
   215          * DeviceDiscovered-callback for each of them.
       
   216          *
       
   217          * @since S60 5.1
       
   218          * @param None
       
   219          * @return None         
       
   220          */
       
   221         void FetchAlreadyDiscoveredDevicesL();
       
   222         
       
   223         /**
       
   224          * Close wait dialog
       
   225          *
       
   226          * @since S60 5.1
       
   227          * @param None
       
   228          * @return None         
       
   229          */
       
   230         void CloseWaitDialog();
       
   231         
       
   232         /**
       
   233          * Creates multiselection store list items according
       
   234          * to default store rule
       
   235          *
       
   236          * @since S60 5.1
       
   237          * @param None
       
   238          * @return CDesCArrayFlat, item array
       
   239          */
       
   240         CDesCArrayFlat* CreateMultiselectionStoreListItemsLC();
       
   241 
       
   242         /**
       
   243          * Creates multiselection store list items according
       
   244          * to UI spec string
       
   245          *
       
   246          * @since S60 5.1
       
   247          * @param None
       
   248          * @return CDesCArrayFlat, item array
       
   249          */
       
   250         CDesCArrayFlat* CreateMultiselectionUIStoreListStringLC();
       
   251 
       
   252 
       
   253         /**
       
   254          * Creates server name list for device selection dialog
       
   255          *
       
   256          * @since S60 5.1
       
   257          * @param aServerArray, server list
       
   258          * @return None
       
   259          */        
       
   260         void CreateServerNameListL(
       
   261                     RPointerArray<CCmMediaServerFull>& aServerArray);
       
   262 
       
   263         /**
       
   264          * Creates multiselection fill list items
       
   265          *
       
   266          * @since S60 5.1
       
   267          * @param None
       
   268          * @return CDesCArrayFlat, item array
       
   269          */        
       
   270         CDesCArrayFlat* CreateMultiselectionFillListItemsLC();
       
   271 
       
   272         /**
       
   273          * Shows wait note until first device appears
       
   274          *
       
   275          * @since S60 5.1
       
   276          * @param None
       
   277          * @return None
       
   278          */        
       
   279         TInt ShowWaitNoteL();
       
   280 
       
   281         /**
       
   282          * Shows info note
       
   283          *
       
   284          * @since S60 5.1
       
   285          * @param None
       
   286          * @return None         
       
   287          */
       
   288         void ShowInfoNoteL( TInt aBodyTextResource );
       
   289         
       
   290         /**
       
   291          * Adds device name to device name list
       
   292          *
       
   293          * @since S60 5.1
       
   294          * @param aDevice, upnp device
       
   295          * @return None         
       
   296          */
       
   297         void AddDeviceNameL( const CUpnpAVDevice& aDevice );
       
   298 
       
   299     public: // Functions from base classes
       
   300 
       
   301         /**
       
   302          * Notifies that a new UPnP device was discovered.
       
   303          *
       
   304          * @since S60 5.1
       
   305          * @param aDevice, upnp device
       
   306          * @return None
       
   307          */
       
   308         void UPnPDeviceDiscovered( const CUpnpAVDevice& aDevice );
       
   309 
       
   310         /**
       
   311          * Notifies that a new UPnP device was discovered.
       
   312          *
       
   313          * @since S60 5.1
       
   314          * @param aDevice, upnp device
       
   315          * @return None
       
   316          */     
       
   317         void UPnPDeviceDiscoveredL( const CUpnpAVDevice& aDevice );
       
   318 
       
   319         /**
       
   320          * Notifies that a UPnP device was dissapeared.
       
   321          *
       
   322          * @since S60 5.1
       
   323          * @param aDevice, upnp device
       
   324          * @return None
       
   325          */
       
   326         void UPnPDeviceDisappeared( const CUpnpAVDevice& aDevice );
       
   327 
       
   328                 /**
       
   329          * Notifies that a UPnP device was dissapeared.
       
   330          *
       
   331          * @since S60 5.1
       
   332          * @param aDevice, upnp device
       
   333          * @return None
       
   334          */
       
   335         void UPnPDeviceDisappearedL( const CUpnpAVDevice& aDevice );
       
   336 
       
   337         /**
       
   338          * Notifies lost in WLAN connection
       
   339          *
       
   340          * @since S60 5.1
       
   341          * @param None
       
   342          * @return None
       
   343          */
       
   344         void WLANConnectionLost();
       
   345 
       
   346         /**
       
   347          * Sets system update id to zero
       
   348          * @since S60 5.1
       
   349          * @param None
       
   350          * @return None         
       
   351          */
       
   352         void ClearServersSystemUpdateId();
       
   353 
       
   354     private:
       
   355 
       
   356         /**
       
   357          * Performs the second phase construction.
       
   358          */
       
   359         void ConstructL();
       
   360 
       
   361         /**
       
   362          * Performs the first phase of two phase construction.
       
   363          *
       
   364          * @since S60 5.1
       
   365          * @param aMSEngine, application engine
       
   366          * @return None
       
   367          */
       
   368         CMSAppWizard( CMSEngine& aMSEngine );
       
   369 
       
   370     private:
       
   371 
       
   372         /**
       
   373          * Resource file offset
       
   374          */
       
   375         TInt                                    iResFileOffset;
       
   376         /**
       
   377          * Control environment for file server access
       
   378          */
       
   379         CEikonEnv*                              iCoeEnv;
       
   380         /**
       
   381          * The position of the wizard
       
   382          */
       
   383         TInt                                    iStep;
       
   384         /**
       
   385          * Flag for indicating device search cancel
       
   386          */
       
   387         TBool                                   iUserCancelledSearch;
       
   388         /**
       
   389          * selection popup for category and device selection
       
   390          */
       
   391         CMSMultiselectionPopup*                 iMultiSelectionDlg; // owned
       
   392         /**
       
   393          * wait dialog
       
   394          */
       
   395         CAknWaitDialog*                         iWaitDialog;        // owned
       
   396         /**
       
   397          * wait sheduler
       
   398          */
       
   399         CActiveSchedulerWait                    iWait;              // owned
       
   400         /**
       
   401          * list of new servers
       
   402          */
       
   403         RPointerArray<CCmMediaServerFull>       iMediaServers;      // owned
       
   404         /**
       
   405          * list of previously stored servers
       
   406          */
       
   407         RPointerArray<CCmMediaServerFull>*      iOriginalServers;   // owned
       
   408         /**
       
   409          * list of upload capable servers
       
   410          */
       
   411         RPointerArray<CCmMediaServerFull>       iStoreServers;      // owned        
       
   412         /**
       
   413          * List of server names
       
   414          */
       
   415         CDesCArrayFlat*                         iDeviceNameArray;   // owned
       
   416         /**
       
   417          * The storage for the user selections
       
   418          */
       
   419         CMSSelectionStorage*                    iSelections;        // owned        
       
   420         /**
       
   421          * application engine
       
   422          */
       
   423         CMSEngine*                              iMSEngine;      // not owned  
       
   424         /**
       
   425          * Step count
       
   426          */
       
   427         TInt                                    iMaxSteps;
       
   428         /**
       
   429          * AV controller
       
   430          */
       
   431         MUPnPAVController*                      iAvController;      // owned
       
   432         /**
       
   433          * File server session
       
   434          */
       
   435         RFs                                     iFileSession;
       
   436         /**
       
   437          * found drives
       
   438          */
       
   439         RPointerArray<CCmDriveInfo>             iDriveArray;        // owned
       
   440         /**
       
   441          * Selected drives indexes
       
   442          */
       
   443         RArray<TInt>                            iDriveIndexes;
       
   444         /**
       
   445          * Flag for wlan lost 
       
   446          */
       
   447         TBool                                   iWLanLost;
       
   448         /**
       
   449          * Upload capable server found -flag
       
   450          */
       
   451         TBool                                   iUploadServerFound;
       
   452     };
       
   453 
       
   454 #endif  // CMSAPPWIZARD
       
   455 
       
   456 // End of File