sipplugins/sippsipsettingsui/src/SIPSettIntegerSetPage.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 13:04:58 +0300
branchRCL_3
changeset 20 a7d1e54a7332
parent 0 307788aac0a8
child 43 b5e99d8877c7
permissions -rw-r--r--
Revision: 201019 Kit: 2010121

/*
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  SIP Settings view controller
*
*/

// INCLUDE FILES


#include    <aknnotewrappers.h>
#include    <eikedwin.h>
#include    <avkon.rsg>
#include    <gssipsettingspluginrsc.rsg> //GUI Resource
#include    "SIPSettIntegerSetPage.h"
#include    "tsipsettingsdata.h"
#include    "gssippluginlogger.h"

_LIT( NULLString,"" );
// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CSIPSettIntegerSetPage::CSIPSettIntegerSetPage
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
CSIPSettIntegerSetPage::CSIPSettIntegerSetPage(
    TInt aResourceID, 
    TInt& aInteger, 
    TInt aTextSettingPageFlags ) :
    CAknIntegerSettingPage( aResourceID, aInteger, aTextSettingPageFlags )
    {
    __GSLOGSTRING("CSIPSettIntegerSetPage::CSIPSettIntegerSetPage" )
    iValue = aInteger;
    }
    
// Destructor
    CSIPSettIntegerSetPage::~CSIPSettIntegerSetPage()
    {    
    __GSLOGSTRING("CSIPSettIntegerSetPage::~CSIPSettIntegerSetPage" )
    }

// -----------------------------------------------------------------------------
// CSIPSettIntegerSetPage::OkToExitL
// Called to validate input before closing the page
// -----------------------------------------------------------------------------
//
TBool CSIPSettIntegerSetPage::OkToExitL( TBool aAccept )
    {
    __GSLOGSTRING("CSIPSettIntegerSetPage::OkToExitL " )
    TBool ret( ETrue );
    TLex16 lex;
    TInt value;
    TBuf<KMaxServerPortLength> intText; 
    if ( !aAccept )
        {
        // User pressed cancel - return back to original text and go away
        RestoreOriginalSettingL();
        return ETrue;
        }
       TextControl()->GetText( intText );
       lex.Assign( intText.Ptr() );
       lex.Val( value );   	   
       if( intText == NULLString )
	       {
           TextControl()->SetTextL(&NULLString);
	       }
       UpdateSettingL();  
            
       // Everything OK, save setting and exit page
       AcceptSettingL();	   
	   ret = ETrue;
    	   
      
        
        return ret;    
    }
// -----------------------------------------------------------------------------
// CSIPSettIntegerSetPage::DynamicInitL
// Called to the Setpage initialize complete
// -----------------------------------------------------------------------------
//
void  CSIPSettIntegerSetPage::DynamicInitL ()
	{
	CAknIntegerSettingPage::DynamicInitL();
	iNULLString.Copy(NULLString);
	if( iValue == -1 )
	    {
	    TextControl()->SetTextL(&iNULLString);
	    } 
	
	}

//  End of File