sipplugins/sippsipsettingsui/inc/sipsettingsmodel.h
changeset 0 307788aac0a8
child 1 dd3853b8dc3f
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005 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:  The model of SIP Settings view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SIP_SETTINGS_MODEL_H
       
    20 #define SIP_SETTINGS_MODEL_H
       
    21 
       
    22 //  INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <bamdesca.h>       // MDesCArray
       
    26 #include <aknutils.h>       // KMaxColumnDataLength
       
    27 #include "tsipsettingsdata.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 class CGSSIPModel;
       
    32 class MGSSIPProfileHandler;
       
    33 class CGSSIPModel;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  CSIPSettingsModel model class
       
    39 *  @since 3.1
       
    40 *  model class for SIP Settings view
       
    41 */
       
    42 class CSIPSettingsModel 
       
    43     : public CBase,
       
    44       public MDesCArray
       
    45     {
       
    46     public:  // Constructors and destructor
       
    47         
       
    48         /**
       
    49         * Two-phased constructor.
       
    50         * (@param aHandler Pointer to profile manipulator)
       
    51         */
       
    52         static CSIPSettingsModel* NewL( MGSSIPProfileHandler* aHandler );
       
    53         
       
    54         /**
       
    55         * Destructor.
       
    56         */
       
    57         virtual ~CSIPSettingsModel();
       
    58 
       
    59     public: // New functions
       
    60 
       
    61         /**
       
    62         * Returns the index of the default profile
       
    63         * @return The index of the default profile
       
    64         */
       
    65         TInt DefaultProfileIndex();
       
    66 
       
    67         /**
       
    68         * Sets new default profile
       
    69         * @param aIndex The index of the (new) default profile
       
    70         */
       
    71         void SetDefaultProfileL( TInt aIndex );
       
    72 
       
    73         /**
       
    74         * Returns the array containing the profile names.
       
    75         * NOTE! The ownership of the array is on the caller
       
    76         * @return Array consisting of the names of the profiles
       
    77         */
       
    78         CDesCArray* ListOfProfileNamesL();
       
    79         
       
    80         /**
       
    81         * Returns the name of a profile
       
    82         * NOTE! The returning buffers ownership changes to the caller
       
    83         * @param aIndex Index to the queried profile        
       
    84         * @return Buffer containing the name of the queried profile
       
    85         */
       
    86         HBufC* ProfileNameLC( TInt aIndex );
       
    87 
       
    88         /**
       
    89         * Returns the number of profiles
       
    90         * @return Number of profiles
       
    91         */
       
    92         TInt NumOfProfiles();
       
    93 
       
    94         /**
       
    95         * Creates a new profile and prepares it for editing
       
    96         * @param aIndex Index to the profile that is used as a basis
       
    97         */
       
    98         void CreateNewProfileL( TInt aIndex );
       
    99 
       
   100         /**
       
   101         * Marks a profile for editing it
       
   102         * @param aIndex Index to the edited profile
       
   103         * @return Ok to move to next view?
       
   104         */
       
   105         TBool EditProfileL( TInt aIndex );
       
   106 
       
   107         /**
       
   108         * Deletes a profile
       
   109         * @param aIndex Index to the deleted profile
       
   110         */
       
   111         void DeleteProfileL( TInt aIndex );
       
   112 
       
   113         /**
       
   114         * Checks if profile can be deleted.
       
   115         * @param aIndex Index to the deleted profile
       
   116         * @param aIsUse ETrue if profile is in use
       
   117         * @param aDefault ETrue if profile is default profile 
       
   118         * @param aLocked ETrue if profile is locked 
       
   119         */
       
   120         void CheckProfileForDeleteL( 
       
   121             TInt aIndex, TBool& aIsUse, TBool& aDefault, TBool& aLocked );
       
   122         
       
   123     protected:  // Functions from base classes
       
   124         
       
   125         /**
       
   126         * From MDesC16Array returns the number of the elements
       
   127         */	
       
   128         TInt MdcaCount() const;
       
   129 	
       
   130         /**
       
   131         * From MDesC16Array Returns a list item
       
   132         */
       
   133         TPtrC16 MdcaPoint(TInt aIndex) const;
       
   134         
       
   135     private:
       
   136 
       
   137         /**
       
   138         * C++ default constructor.
       
   139         * @param aHandler Pointer to profile manipulator
       
   140         */
       
   141         CSIPSettingsModel( MGSSIPProfileHandler* aHandler );
       
   142 
       
   143         /**
       
   144         * By default Symbian 2nd phase constructor is private.
       
   145         */
       
   146         void ConstructL();
       
   147 
       
   148     private:    // Data
       
   149     
       
   150         // The buffer that is returned on MdcaPoint() call
       
   151         //mutable TBuf<KMaxColumnDataLength> iBuf;   
       
   152         mutable TBuf<KMaxSIPProviderNameLength*3> iBuf;
       
   153         
       
   154         // Pointer to profile handler
       
   155         MGSSIPProfileHandler* iHandler;
       
   156 
       
   157         // "Registered"/"Not registered"/"Error in registration" texts
       
   158         HBufC* iRegisteredTxt;
       
   159         HBufC* iNotRegisteredTxt;
       
   160         HBufC* iErrorInReg;                
       
   161     };
       
   162 
       
   163 #endif      // SIP_SETTINGS_MODEL_H   
       
   164             
       
   165 // End of File