commsconfig/cscapplicationui/inc/cscservicecontainer.h
branchRCL_3
changeset 22 d38647835c2e
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2007-2010 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:  CSC Application service view´s container
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CSCSERVICECONTAINER_H
       
    20 #define C_CSCSERVICECONTAINER_H
       
    21 
       
    22 #include <eikmobs.h>
       
    23 
       
    24 class MCSCServiceContainerObserver;
       
    25 class CCSCEngCCHHandler;
       
    26 class CCSCEngServiceHandler;
       
    27 class CCSCEngBrandingHandler;
       
    28 class CCSCEngServicePluginHandler;
       
    29 class CCSCEngUiExtensionPluginHandler;
       
    30 
       
    31 
       
    32 const TUint KBrandIdMaxLength = 512;
       
    33 
       
    34 /**
       
    35  *  TListBoxItem class
       
    36  *
       
    37  *  For identifying list box item types
       
    38  *
       
    39  *  @lib
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 NONSHARABLE_CLASS( TListBoxItem )
       
    43     {
       
    44     public:
       
    45     
       
    46         /**  Enumeration for listbox item type */
       
    47         enum TItemType
       
    48             {
       
    49             EGeneralService = 0,
       
    50             EServicePlugin,
       
    51             EUiExtension
       
    52             };
       
    53         
       
    54         /**
       
    55          * Constructor.
       
    56          *
       
    57          * @since S60 3.2
       
    58          */
       
    59         TListBoxItem()
       
    60             : iItemType( EGeneralService ),
       
    61               iPluginUid( KNullUid ),
       
    62               iServiceId( KErrNone )
       
    63             {}
       
    64 
       
    65     public: // data
       
    66     
       
    67         /**
       
    68          * Listbox item type
       
    69          */
       
    70         TItemType iItemType;
       
    71                 
       
    72         /**
       
    73          * Plug-in UID for Listbox item type EServicePlugin and EUiExtension
       
    74          */
       
    75         TUid iPluginUid;
       
    76         
       
    77         /*
       
    78          * Service id ( used only with EGeneralService and EServicePlugin)
       
    79          */
       
    80         TUint iServiceId;
       
    81     };
       
    82 
       
    83 
       
    84 
       
    85 /**
       
    86  *  CCSCServiceContainer class
       
    87  *  CSC Applications Service view container class.
       
    88  *
       
    89  *  @lib
       
    90  *  @since S60 v3.2
       
    91  */
       
    92 NONSHARABLE_CLASS( CCSCServiceContainer ) : public CCoeControl,
       
    93                                             public MEikMenuObserver
       
    94     {
       
    95     public:
       
    96         
       
    97         /**
       
    98          * Two-phased constructor.
       
    99          *
       
   100          * @param aView pointer to calling view
       
   101          * @param aRect rect
       
   102          * @param aServicePluginHandler reference to servicepluginhandler
       
   103          * @param aUiExtensionPluginHandler reference to uiextensionhandler
       
   104          * @param aServiceHandler reference to service handler
       
   105          * @param aBrandingHandler reference to branding handler
       
   106          * @param aCCHHandler reference to cch handler
       
   107          */
       
   108         static CCSCServiceContainer* NewL(
       
   109             const TRect& aRect,
       
   110             MCSCServiceContainerObserver& aContainerObserver,
       
   111             CCSCEngServicePluginHandler& aServicePluginHandler,
       
   112             CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
       
   113             CCSCEngServiceHandler& aServiceHandler,
       
   114             CCSCEngBrandingHandler& aBrandingHandler,
       
   115             CCSCEngCCHHandler& aCCHHandler );
       
   116         
       
   117         
       
   118         /**
       
   119          * Destructor.
       
   120          */
       
   121         virtual ~CCSCServiceContainer();
       
   122         
       
   123                 
       
   124         /**
       
   125          * Update service view
       
   126          *
       
   127          * @since S60 v3.2
       
   128          */
       
   129         void UpdateServiceViewL();
       
   130         
       
   131         
       
   132         /**
       
   133          * Update listbox
       
   134          *
       
   135          * @since S60 v3.2
       
   136          */
       
   137         void UpdateListboxL();
       
   138         
       
   139         
       
   140         /**
       
   141          * Return current listbox item index
       
   142          *
       
   143          * @since S60 v3.2
       
   144          * @return current item index
       
   145          */
       
   146         TInt CurrentItemIndex() const;
       
   147         
       
   148         
       
   149         /**
       
   150          * Return current listbox item
       
   151          *
       
   152          * @since S60 v3.2
       
   153          * @return current listbox item
       
   154          */
       
   155         TListBoxItem ListBoxItem();
       
   156         
       
   157         
       
   158         /**
       
   159          * Return reference to listbox
       
   160          *
       
   161          * @since S60 v5.2
       
   162          * @return reference to listbox
       
   163          */
       
   164         CAknDouble2LargeStyleListBox& ListBox();
       
   165         
       
   166         
       
   167         /**
       
   168          * Return pen down point
       
   169          *
       
   170          * @since S60 v5.2
       
   171          * @return pen down point
       
   172          */
       
   173         TPoint PenDownPoint();
       
   174         
       
   175         
       
   176         /**
       
   177          * Return service count
       
   178          *
       
   179          * @since S60 v3.2
       
   180          * @return service count
       
   181          */
       
   182         TInt ServiceCount();
       
   183 
       
   184         
       
   185         /**
       
   186          * Set current item index
       
   187          *
       
   188          * @since S60 v3.2
       
   189          * @param current item index
       
   190          */
       
   191         void SetCurrentIndex( TInt aIndex );
       
   192         
       
   193         
       
   194         /**
       
   195          * Delete service
       
   196          *
       
   197          * @since S60 v3.2
       
   198          */
       
   199         void DeleteServiceL();
       
   200         
       
   201         
       
   202         /**
       
   203          * Handle service plugin removation.
       
   204          *
       
   205          * @since S60 v5.0
       
   206          * @param aUid plugin uid.
       
   207          */
       
   208         void HandleServicePluginRemovationL( const TUid& aUid );
       
   209         
       
   210         
       
   211         /**
       
   212          * Updates container data because of layout change
       
   213          *
       
   214          * @since S60 v3.2
       
   215          * @param aType for layout change type
       
   216          */ 
       
   217         void HandleResourceChange( TInt aType );
       
   218         
       
   219         
       
   220         /**
       
   221          * Sets listbox observer.
       
   222          *
       
   223          * @since S60 v3.2
       
   224          * @param aObserver listbox observer
       
   225          */ 
       
   226         void SetListBoxObserver( MEikListBoxObserver* aObserver );
       
   227         
       
   228                 
       
   229         /**
       
   230          * Hides dialog wait note
       
   231          *
       
   232          * @since S60 v3.2
       
   233          * @param aIndex index of plugin
       
   234          */ 
       
   235         void HideDialogWaitNote();
       
   236 
       
   237 
       
   238         /**
       
   239          * Launches cleanup plugin to remove settings.
       
   240          *
       
   241          * @since S60 v3.2
       
   242          * @param aServiceId for service to be removed.
       
   243          */ 
       
   244         void LaunchCleanupPluginL( TUint aServiceId ) const;
       
   245         
       
   246         
       
   247         /**
       
   248          * Resolve service id from service plugin uid
       
   249          *
       
   250          * @since S60 v3.2
       
   251          * @param aUid service plugin uid
       
   252          * @param aServiceId service id stored here
       
   253          */ 
       
   254         void ResolveServiceIdL( const TUid& aUid, TUint& aServiceId );
       
   255         
       
   256         
       
   257         // from base class CCoeControl
       
   258 
       
   259         /**
       
   260          * From CCoeControl
       
   261          * Offer key events for controls.
       
   262          *
       
   263          * @since S60 v3.0
       
   264          * @param aKeyEvent for pressed key
       
   265          * @param aType for type of press
       
   266          * @return ETrue if consumed
       
   267          */
       
   268         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   269                                      TEventCode aType );
       
   270 
       
   271         /**
       
   272          * From CCoeControl
       
   273          * Returns component controls.
       
   274          *
       
   275          * @since S60 v3.0
       
   276          * @param aIndex for index
       
   277          * @return control of the component
       
   278          */
       
   279         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   280         
       
   281         
       
   282         /**
       
   283          * From CCoeControl
       
   284          * Handle pointer event.
       
   285          *
       
   286          * @since S60 v3.0
       
   287          * @param aPointerEvent pointer event
       
   288          */
       
   289         void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   290         
       
   291         
       
   292         // from base class MCSCEngCCHObserver
       
   293 
       
   294         /**
       
   295          * From MCSCEngCCHObserver.
       
   296          */
       
   297         void ServiceStatusChanged(
       
   298             TUint aServiceId, 
       
   299             TCCHSubserviceType aType, 
       
   300             const TCchServiceStatus& aServiceStatus );
       
   301 
       
   302         
       
   303     protected: 
       
   304         
       
   305         // from base class CCoeControl
       
   306           
       
   307         /**
       
   308          * From CCoeControl
       
   309          * Handles controls size changes
       
   310          *
       
   311          * @since S60 v3.0
       
   312          */
       
   313         void SizeChanged();
       
   314         
       
   315         
       
   316         /**
       
   317          * From CoeControl
       
   318          * Handles focus changes
       
   319          *
       
   320          * @since S60 v3.0
       
   321          * @param aDrawNow for drawing event
       
   322          */        
       
   323         virtual void FocusChanged( TDrawNow aDrawNow );
       
   324         
       
   325         
       
   326         /**
       
   327          * From CoeControl
       
   328          * Counts components controls
       
   329          *
       
   330          * @since S60 v3.0
       
   331          * @return returns number of controls
       
   332          */
       
   333         TInt CountComponentControls() const;
       
   334         
       
   335         
       
   336         /**
       
   337          * From CCoeControl
       
   338          * For getting help context
       
   339          *
       
   340          * @since S60 v3.0
       
   341          * @param aContext
       
   342          */
       
   343         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   344         
       
   345         
       
   346         /**
       
   347          * From MEikMenuObserver
       
   348          */
       
   349         void SetEmphasis( CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ ){};
       
   350       
       
   351         
       
   352         /**
       
   353          * From MEikMenuObserver
       
   354          */
       
   355         void ProcessCommandL( TInt /*aCommandId*/ ){};
       
   356 
       
   357     private:
       
   358         
       
   359         CCSCServiceContainer( 
       
   360             MCSCServiceContainerObserver& aContainerObserver,
       
   361             CCSCEngServicePluginHandler& aServicePluginHandler,
       
   362             CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
       
   363             CCSCEngServiceHandler& aServiceHandler,
       
   364             CCSCEngBrandingHandler& aBrandingHandler,
       
   365             CCSCEngCCHHandler& aCCHHandler );
       
   366             
       
   367             
       
   368         void ConstructL( const TRect& aRect );
       
   369         
       
   370         
       
   371         /**
       
   372          * Sets icons for listbox items.
       
   373          *
       
   374          * @since S60 v3.2
       
   375          * @param aListBoxItem lisbox item
       
   376          * @param aIconArray icon array
       
   377          * @param aIconSize icon size in pixels
       
   378          */
       
   379         void SetIconL( const TListBoxItem& aListBoxItem,
       
   380             CArrayPtr<CGulIcon>* aIconArray, TInt aIconSize );
       
   381         
       
   382         
       
   383        /**
       
   384         * Cleanup RImplInfoPtrArray
       
   385         * @since S60 3.2
       
   386         * @param aArray Which to be destroyed
       
   387         */
       
   388         static void ResetAndDestroy( TAny* aArray );
       
   389             
       
   390 
       
   391     private: // data
       
   392     
       
   393         /**
       
   394          * Reference to MCSCServiceContainerObserver
       
   395          */
       
   396         MCSCServiceContainerObserver& iContainerObserver;
       
   397                         
       
   398         /**
       
   399          *  Reference to CCSCServicePluginHandler
       
   400          */         
       
   401         CCSCEngServicePluginHandler& iServicePluginHandler;
       
   402         
       
   403         /*
       
   404          * Reference to CCSCUiExtensionPluginHandler
       
   405          */
       
   406         CCSCEngUiExtensionPluginHandler& iUiExtensionPluginHandler;
       
   407         
       
   408         /*
       
   409          * Reference to CCSCEngServiceHandler
       
   410          */
       
   411         CCSCEngServiceHandler& iServiceHandler;
       
   412         
       
   413         /**
       
   414          * Reference to CCSCEngBrandingHandler
       
   415          */         
       
   416         CCSCEngBrandingHandler& iBrandingHandler;
       
   417         
       
   418         /**
       
   419          * Reference to CCSCEngCCHHandler
       
   420          */         
       
   421         CCSCEngCCHHandler& iCCHHandler;
       
   422                         
       
   423         /*
       
   424          * Pointer to listbox
       
   425          * Own.
       
   426          */
       
   427         CAknDouble2LargeStyleListBox* iListBox;
       
   428         
       
   429         /*
       
   430          * Pointer to listbox item array
       
   431          * Own.
       
   432          */
       
   433         CDesCArrayFlat* iArray;
       
   434         
       
   435         /*
       
   436          * Pointer to listbox item array
       
   437          * Own.
       
   438          */
       
   439         CDesCArray* iListBoxItems;
       
   440         
       
   441         /**
       
   442          * A Global wait note for removing service.
       
   443          */
       
   444         CCSCDialog* iDialog;
       
   445         
       
   446         /**
       
   447          * Menubar.
       
   448          * Own.
       
   449          */
       
   450         CEikMenuBar* iEikMenuBar;
       
   451         
       
   452         /*
       
   453          * Array for identifying different type listbox items
       
   454          */
       
   455         RArray<TListBoxItem> iListBoxItemArray;
       
   456         
       
   457         /**
       
   458          * Ui extension plug-in count
       
   459          */
       
   460         TUint iUiExtensionCount;
       
   461         
       
   462         /**
       
   463          * Pen down point
       
   464          */
       
   465         TPoint iPenDownPoint;
       
   466         
       
   467 	    /**
       
   468          * Holds current listbox item height
       
   469          */
       
   470         TInt iListBoxItemHeight;
       
   471 
       
   472 #ifdef _DEBUG
       
   473     friend class UT_CSC;
       
   474 #endif    
       
   475 
       
   476 };
       
   477 
       
   478 #endif // C_CSCSERVICECONTAINER_H