mmshplugins/mmshsettingsuiplugin/inc/mussipprofilemodel.h
changeset 2 b31261fd4e04
parent 0 f0cf47e981f9
child 13 a184f3d659e6
equal deleted inserted replaced
1:065f1826587f 2:b31261fd4e04
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Class implementing SIP profile model.
    14 * Description:  Class implementing SIP profile model.
    15 *  Version     : %version: 5.1.6 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: 7 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
    20 
    22 #define C_MUSSIPPROFILEMODEL_H
    22 #define C_MUSSIPPROFILEMODEL_H
    23 
    23 
    24 
    24 
    25 #include "mmussipprofilehandler.h"
    25 #include "mmussipprofilehandler.h"
    26 #include <e32base.h>
    26 #include <e32base.h>
    27 #include <sipmanagedprofile.h>
       
    28 #include <gsplugininterface.h>
       
    29 #include <sipprofileregistryobserver.h>
    27 #include <sipprofileregistryobserver.h>
    30 
    28 
    31 
    29 
    32 class CSIPManagedProfileRegistry;
    30 class CSIPManagedProfileRegistry;
       
    31 class CMusSettingsModel;
    33 
    32 
    34 
    33 
    35 /**
    34 /**
    36  *  CMusSIPProfileModel model class.
    35  *  CMusSIPProfileModel model class.
    37  *  Model class implementing SIP profile model.
    36  *  Model class implementing SIP profile model.
    38  *
       
    39  *  @since S60 v3.2
       
    40  */
    37  */
    41 class CMusSIPProfileModel
    38 class CMusSIPProfileModel
    42     :public CBase,
    39     :public CBase,
    43      public MSIPProfileRegistryObserver,
    40      public MSIPProfileRegistryObserver,
    44 	 public MMusSIPProfileHandler
    41 	 public MMusSIPProfileHandler
   105      */
   102      */
   106     virtual TUint32 ProfileIdByIndex( TUint aIndex );
   103     virtual TUint32 ProfileIdByIndex( TUint aIndex );
   107 
   104 
   108     /**
   105     /**
   109      * From MMusSIPProfileHandler.
   106      * From MMusSIPProfileHandler.
   110      * Returns pointer to the SIP profile array, does not change ownership.
   107      * Returns a reference to the SIP profile array.
   111      * Note that previously returned value goes out of scope after a new
   108      * Note that previously returned value goes out of scope after a new
   112      * call to ProfileArrayL. So it is not advised to store return value
   109      * call to ProfileArrayL. So it is not advised to store return value
   113      * in long persistent variable, but rather to be used like stack
   110      * in long persistent variable, but rather to be used like stack
   114      * variables for safety.
   111      * variables for safety.
   115      *
   112      *
   116      * @return Pointer to internally cached SIP profile array.
   113      * @return Reference to internally cached SIP profile array.
   117      */
   114      */
   118     virtual CArrayPtr<CSIPManagedProfile>* ProfileArrayL();
   115     virtual RPointerArray<CSIPProfile>& ProfileArrayL();
   119 
   116 
   120 public: // From base class MSIPProfileRegistryObserver.
   117 public: // From base class MSIPProfileRegistryObserver.
   121 
   118 
   122     /**
   119     /**
   123      * From MSIPProfileRegistryObserver.
   120      * From MSIPProfileRegistryObserver.
   136 	 * @param aError An error code.
   133 	 * @param aError An error code.
   137 	 */
   134 	 */
   138 	virtual void ProfileRegistryErrorOccurred(
   135 	virtual void ProfileRegistryErrorOccurred(
   139 	    TUint32 aSIPProfileId,
   136 	    TUint32 aSIPProfileId,
   140 	    TInt aError );
   137 	    TInt aError );
       
   138 	
       
   139 	
       
   140 	
       
   141     /**
       
   142      * Set CMusSettingsModel to handle ProfileRegistry Event.
       
   143      * @param aCMusSettingsModel the CMusSettingsModel to handle ProfileRegistry Event
       
   144      */		
       
   145 	void SetCMusSettingsModel(CMusSettingsModel* aCMusSettingsModel);
   141 
   146 
   142 protected:
   147 protected:
   143 
       
   144     /**
       
   145      * Reads the profile array from SIP Profile Client.
       
   146      */
       
   147     void ReadArrayFromEngineL();
       
   148 
   148 
   149     /**
   149     /**
   150      * Sorts internal array of SIP profiles by id.
   150      * Sorts internal array of SIP profiles by id.
   151      */
   151      */
   152     void SortProfilesL();
   152     void SortProfilesL();
   153 
   153 
   154     /**
       
   155      * Deletes internally cached profiles.
       
   156      */
       
   157     void DeleteProfiles();
       
   158 
       
   159     /**
       
   160      * Reads profile list from the engine; if reading fails,
       
   161      * keeps the old list safe.
       
   162      */
       
   163     void ReadProfileListFromEngineSafeL();
       
   164 
   154 
   165 private:
   155 private:
   166 
   156 
   167     CMusSIPProfileModel();
   157     CMusSIPProfileModel();
   168 
   158 
   169     void ConstructL();
   159     void ConstructL();
   170 
   160     
   171     /**
       
   172      * For deleting RPointerArray in case of leave.
       
   173      */
       
   174     static void ResetAndDestroy( TAny* aPointerArray );
       
   175 
   161 
   176 private: // data
   162 private: // data
   177 
   163 
   178     /**
   164     /**
   179      * Instance of the SIP profile registry engine for managing SIP profiles.
   165      * Instance of the SIP profile registry engine for managing SIP profiles.
   181      */
   167      */
   182     CSIPManagedProfileRegistry* iEngine;
   168     CSIPManagedProfileRegistry* iEngine;
   183 
   169 
   184     /**
   170     /**
   185      * Locally cached array of SIP profiles.
   171      * Locally cached array of SIP profiles.
   186      * Own.
       
   187      */
   172      */
   188     CArrayPtrFlat<CSIPManagedProfile>* iProfiles;
   173     RPointerArray<CSIPProfile> iProfiles;
       
   174     
       
   175     /**
       
   176       * CMusSettingsModel to handle ProfileRegistry 
       
   177       * Event
       
   178       */
       
   179     CMusSettingsModel* iCMusSettingsModel;
   189 
   180 
   190     };
   181     };
   191 
   182 
   192 #endif // C_MUSSIPPROFILEMODEL_H
   183 #endif // C_MUSSIPPROFILEMODEL_H