sipplugins/sippsipsettingsui/src/SIPSettIntegerSetPage.cpp
changeset 0 307788aac0a8
child 20 a7d1e54a7332
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:  SIP Settings view controller
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 
       
    20 
       
    21 #include    <aknnotewrappers.h>
       
    22 #include    <eikedwin.h>
       
    23 #include    <avkon.rsg>
       
    24 #include    <gssipsettingspluginrsc.rsg> //GUI Resource
       
    25 #include    "SIPSettIntegerSetPage.h"
       
    26 #include    "tsipsettingsdata.h"
       
    27 #include    "gssippluginlogger.h"
       
    28 
       
    29 _LIT( NULLString,"" );
       
    30 _LIT16( ZeroString,"-1" );
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CSIPSettIntegerSetPage::CSIPSettIntegerSetPage
       
    35 // C++ default constructor can NOT contain any code, that
       
    36 // might leave.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CSIPSettIntegerSetPage::CSIPSettIntegerSetPage(
       
    40     TInt aResourceID, 
       
    41     TInt& aInteger, 
       
    42     TInt aTextSettingPageFlags ) :
       
    43     CAknIntegerSettingPage( aResourceID, aInteger, aTextSettingPageFlags )
       
    44     {
       
    45     __GSLOGSTRING("CSIPSettIntegerSetPage::CSIPSettIntegerSetPage" )
       
    46     iValue = aInteger;
       
    47     }
       
    48     
       
    49 // Destructor
       
    50     CSIPSettIntegerSetPage::~CSIPSettIntegerSetPage()
       
    51     {    
       
    52     __GSLOGSTRING("CSIPSettIntegerSetPage::~CSIPSettIntegerSetPage" )
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CSIPSettIntegerSetPage::OkToExitL
       
    57 // Called to validate input before closing the page
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 TBool CSIPSettIntegerSetPage::OkToExitL( TBool aAccept )
       
    61     {
       
    62     __GSLOGSTRING("CSIPSettIntegerSetPage::OkToExitL " )
       
    63     TBool ret( ETrue );
       
    64     TLex16 lex;
       
    65     TInt value;
       
    66     TBuf<KMaxServerPortLength> intText; 
       
    67     if ( !aAccept )
       
    68         {
       
    69         // User pressed cancel - return back to original text and go away
       
    70         RestoreOriginalSettingL();
       
    71         return ETrue;
       
    72         }
       
    73        TextControl()->GetText( intText );
       
    74        lex.Assign( intText.Ptr() );
       
    75        lex.Val( value );
       
    76        if( value >= 0 && value <= 65535 || intText == NULLString )
       
    77     	   {
       
    78            if( intText == NULLString )
       
    79     	       {
       
    80                TextControl()->SetTextL(&ZeroString);
       
    81     	       }
       
    82            UpdateSettingL();  
       
    83             
       
    84            // Everything OK, save setting and exit page
       
    85            AcceptSettingL();	   
       
    86     	   ret = ETrue;
       
    87     	   }
       
    88        else
       
    89     	   {
       
    90     	   ret = EFalse;
       
    91     	   }
       
    92         
       
    93         return ret;    
       
    94     }
       
    95 // -----------------------------------------------------------------------------
       
    96 // CSIPSettIntegerSetPage::DynamicInitL
       
    97 // Called to the Setpage initialize complete
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 void  CSIPSettIntegerSetPage::DynamicInitL ()
       
   101 	{
       
   102 	CAknIntegerSettingPage::DynamicInitL();
       
   103 	iNULLString.Copy(NULLString);
       
   104 	if( iValue == -1 )
       
   105 	    {
       
   106 	    TextControl()->SetTextL(&iNULLString);
       
   107 	    } 
       
   108 	
       
   109 	}
       
   110 
       
   111 //  End of File  
       
   112