00001 /* 00002 * ============================================================================ 00003 * Name : CTaskManagerConnForm from TaskManagerConnForm.cpp 00004 * Part of : TaskManager 00005 * Created : 15/03/2006 by Forum Nokia 00006 * Version : 1.2 00007 * Copyright: Nokia Corporation 00008 * ============================================================================ 00009 */ 00010 00011 // INCLUDE FILES 00012 #include "TaskManagerConnForm.h" 00013 #include "TaskManagerConnInfo.h" 00014 00015 #include <SocketTaskManager.rsg> 00016 #include <avkon.hrh> // EAknSoftkeyOk 00017 #include <eikedwin.h> // CEikEdwin 00018 #include <aknnumedwin.h> // CAknIntegerEdwin 00019 #include <eikseced.h> // CEikSecretEditor 00020 00021 00022 // ================= MEMBER FUNCTIONS ======================= 00023 00024 // constructor 00025 CTaskManagerConnForm::CTaskManagerConnForm( TTaskManagerConnInfo& aConnInfo ): iConnInfo( aConnInfo ) 00026 { 00027 } 00028 00029 // ---------------------------------------------------------- 00030 // CTaskManagerConnForm::RunDlgLD() 00031 // Runs this form. 00032 // ---------------------------------------------------------- 00033 // 00034 TBool CTaskManagerConnForm::RunDlgLD( TTaskManagerConnInfo& aConnInfo ) 00035 { 00036 CTaskManagerConnForm* self = new (ELeave) CTaskManagerConnForm( aConnInfo ); 00037 return self->ExecuteLD( R_TASKMANAGER_CONNFORM_DIALOG ); 00038 } 00039 00040 // ---------------------------------------------------------- 00041 // CTaskManagerConnForm::PreLayoutDynInitL() 00042 // This function is called by the dialog framework before 00043 // the dialog is sized and laid out. 00044 // ---------------------------------------------------------- 00045 // 00046 void CTaskManagerConnForm::PreLayoutDynInitL() 00047 { 00048 CEikEdwin* editor; 00049 00050 // set server name 00051 editor = static_cast< CEikEdwin* >( ControlOrNull( ETaskManagerIdServer ) ); 00052 if( editor ) 00053 { 00054 TPtrC ptr(iConnInfo.ServerAddress()); 00055 editor->SetTextL(&ptr); 00056 } 00057 00058 // set port number 00059 CAknIntegerEdwin* portEditor = 00060 static_cast< CAknIntegerEdwin* >( ControlOrNull( ETaskManagerIdPort ) ); 00061 if( portEditor ) 00062 { 00063 portEditor->SetValueL(iConnInfo.Port()); 00064 } 00065 00066 // set username 00067 editor = static_cast< CEikEdwin* >( ControlOrNull( ETaskManagerIdUsername ) ); 00068 if( editor ) 00069 { 00070 TPtrC ptr(iConnInfo.Username()); 00071 editor->SetTextL(&ptr); 00072 } 00073 00074 // set password 00075 CEikSecretEditor* secretEditor = 00076 static_cast< CEikSecretEditor* >( ControlOrNull( ETaskManagerIdPassword ) ); 00077 if (secretEditor) 00078 { 00079 TPtrC ptr(iConnInfo.Password()); 00080 secretEditor->SetText(ptr); 00081 } 00082 } 00083 00084 // ---------------------------------------------------------- 00085 // CTaskManagerConnForm::OkToExitL() 00086 // This function is invoked when the user presses a button in 00087 // the button panel. It is not called if the Cancel button is 00088 // activated. 00089 // ---------------------------------------------------------- 00090 // 00091 TBool CTaskManagerConnForm::OkToExitL( TInt aButtonId ) 00092 { 00093 if ( aButtonId == EAknSoftkeyOk ) 00094 { 00095 CEikEdwin* editor; 00096 00097 // save server name 00098 editor = static_cast< CEikEdwin* >( ControlOrNull( ETaskManagerIdServer ) ); 00099 if( editor ) 00100 { 00101 TBuf< KMaxServerNameLength > server; 00102 editor->GetText( server ); 00103 iConnInfo.SetServerAddress( server ); 00104 } 00105 00106 // save port number 00107 CAknIntegerEdwin* portEditor = 00108 static_cast< CAknIntegerEdwin* >( ControlOrNull( ETaskManagerIdPort ) ); 00109 if( portEditor ) 00110 { 00111 TInt port; 00112 portEditor->GetTextAsInteger( port ); 00113 iConnInfo.SetPort( port ); 00114 } 00115 00116 // save username 00117 editor = static_cast< CEikEdwin* >( ControlOrNull( ETaskManagerIdUsername ) ); 00118 if( editor ) 00119 { 00120 TBuf< KMaxUsernameLength > username; 00121 editor->GetText( username ); 00122 iConnInfo.SetUsername( username ); 00123 } 00124 00125 // save password 00126 CEikSecretEditor* secretEditor = 00127 static_cast< CEikSecretEditor* >( ControlOrNull( ETaskManagerIdPassword ) ); 00128 if( secretEditor ) 00129 { 00130 TBuf< KMaxPasswordLength > password; 00131 secretEditor->GetText( password ); 00132 iConnInfo.SetPassword( password ); 00133 } 00134 } 00135 00136 return ETrue; 00137 } 00138 00139 // End of file
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.