sipplugins/sippsipsettingsui/src/sipsettlistsipregsetview.cpp
changeset 0 307788aac0a8
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 registrar view controller
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include    "sipsettlistsipregsetview.h"
       
    22 #include    "viewid.h"
       
    23 #include    "mgssipprofilehandler.h"
       
    24 #include    "sipsettlistsipsrvsetmodel.h"
       
    25 #include    <aknViewAppUi.h>
       
    26 #include    <gssipsettingspluginrsc.rsg> //GUI Resource
       
    27 #include    "gssippluginlogger.h"
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CSIPSettListSIPRegSetView::CSIPSettListSIPRegSetView
       
    33 // C++ default constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CSIPSettListSIPRegSetView::CSIPSettListSIPRegSetView(
       
    38     MGSSIPProfileHandler* aHandler )
       
    39     : CSIPSettListSIPSrvSetView( R_QTN_REGISTRAR_TITLE_PANE_LABEL ),
       
    40     iHandler( aHandler )
       
    41     {
       
    42     __GSLOGSTRING("CSIPSettListSIPRegSetView::CSIPSettListSIPRegSetView" )
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CSIPSettListSIPRegSetView::ConstructL
       
    47 // Symbian 2nd phase constructor can leave.
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 void CSIPSettListSIPRegSetView::ConstructL()
       
    51     {
       
    52     __GSLOGSTRING("CSIPSettListSIPRegSetView::ConstructL" )
       
    53     BaseConstructL( R_GS_SIP_SERVER_SETTING_VIEW );    
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CSIPSettListSIPRegSetView::NewLC
       
    58 // Two-phased constructor.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CSIPSettListSIPRegSetView* CSIPSettListSIPRegSetView::NewLC(
       
    62     MGSSIPProfileHandler* aHandler )
       
    63     {
       
    64     __GSLOGSTRING("CSIPSettListSIPRegSetView::NewLC" )
       
    65     CSIPSettListSIPRegSetView* self = 
       
    66         new ( ELeave ) CSIPSettListSIPRegSetView( aHandler );
       
    67     
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL();    
       
    70 
       
    71     return self;
       
    72     }
       
    73     
       
    74 // Destructor
       
    75 CSIPSettListSIPRegSetView::~CSIPSettListSIPRegSetView()
       
    76     {
       
    77     __GSLOGSTRING("CSIPSettListSIPRegSetView::~CSIPSettListSIPRegSetView" )
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CSIPSettListSIPRegSetView::Id
       
    82 // Returns the UID of the view
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 TUid CSIPSettListSIPRegSetView::Id() const
       
    86     {    
       
    87     return KSettListSIPRegistrarServerView;
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CSIPSettListSIPRegSetView::DataStruct
       
    92 // Returns the used data structure
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 TGSSIPServerData* CSIPSettListSIPRegSetView::DataStruct()
       
    96     {  
       
    97     __GSLOGSTRING("CSIPSettListSIPRegSetView::DataStruct" )
       
    98     TGSSIPServerData* data = &( iHandler->ProfileData()->iRegistrar );
       
    99     // Set loose routing to be always off
       
   100     data->iLooseRouting = EGSLooseRoutingOff;
       
   101 
       
   102     return data;
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CSIPSettListSIPRegSetView::DataStruct
       
   107 // Returns the used data structure
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 TInt CSIPSettListSIPRegSetView::ResourceID()
       
   111     {
       
   112     return R_SIP_REGISTRAR_SETTING_VIEW_ITEM_LIST;
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CGSSettListSIPRegSetView::ProfileType
       
   117 // Returns the used profile type
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 TSIPProfileTypeInfo::TSIPProfileClass CSIPSettListSIPRegSetView::ProfileType()
       
   121     { 
       
   122     __GSLOGSTRING("CSIPSettListSIPRegSetView::ProfileType" )
       
   123     const TSIPSettingsData* data = iHandler->ProfileData();
       
   124     // Set loose routing to be always off
       
   125     return data->iServiceProfile.iSIPProfileClass;
       
   126     }
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // CSIPSettListSIPRegSetView::ProfileLocked
       
   130 // Checks is currently shown profile locked.
       
   131 // -----------------------------------------------------------------------------
       
   132 //    
       
   133 TBool CSIPSettListSIPRegSetView::ProfileLocked()
       
   134     {
       
   135     __GSLOGSTRING("CSIPSettListSIPRegSetView::ProfileLocked" )
       
   136     TBool locked( EFalse );
       
   137     
       
   138     // Find right profile from SIP profile array.
       
   139     const TSIPSettingsData* data = iHandler->ProfileData();
       
   140     CArrayPtr<CSIPManagedProfile>* list = iHandler->ProfileArray();
       
   141     for ( TInt i = 0; i < list->Count(); i++ )
       
   142         {
       
   143         TUint32 profileId ( KErrNone );
       
   144         list->At( i )->GetParameter( KSIPProfileId, profileId );
       
   145         if ( profileId == data->iID )
       
   146             {
       
   147             // Get SIP profile lock information.
       
   148             list->At( i )->GetParameter( KSIPProfileLocked, locked );
       
   149             }
       
   150         }
       
   151     
       
   152     return locked;
       
   153     }
       
   154     
       
   155 //  End of File