/* Machine-made version of this file copyright (c) 2005 Somusar */ /* Derived from samples that are Copyright (c) 2004, Nokia. All rights reserved */ // INCLUDE FILES #include #include // for secret editor #include // for slider #include #include "ThreeFormsSaveForm.h" // ================= MEMBER FUNCTIONS ========================================= // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::NewL() // Two-phased constructor. // ---------------------------------------------------------------------------- // CThreeFormsSaveForm* CThreeFormsSaveForm::NewL() { CThreeFormsSaveForm* self = new ( ELeave ) CThreeFormsSaveForm(); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); return self; } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::~CThreeFormsSaveForm() // Destructor. // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::~CThreeFormsSaveForm() { } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::CThreeFormsSaveForm() // Default constructor. // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::CThreeFormsSaveForm() { } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::ConstructL() // Second-phase constructor. // ---------------------------------------------------------------------------- // void CThreeFormsSaveForm::ConstructL() { CAknForm::ConstructL(); } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::ExecuteLD() // // ---------------------------------------------------------------------------- // TInt CThreeFormsSaveForm::ExecuteLD( TInt aResourceId ) { iCurrentId = aResourceId; return CAknForm::ExecuteLD( aResourceId ); } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::PrepareLC( TInt aResourceId ) // // ---------------------------------------------------------------------------- // void CThreeFormsSaveForm::PrepareLC( TInt aResourceId ) { iCurrentId = aResourceId; CAknForm::PrepareLC( aResourceId ); } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::SaveFormDataL() // Save form data. // ---------------------------------------------------------------------------- // TBool CThreeFormsSaveForm::SaveFormDataL() { switch ( iCurrentId ) { case R_THREEFORMS_SAMPLE_EDITOR_DIALOG: { if ( ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorValue ) ) { iSampleEditorValueData = NumberEditorValue( EThreeFormsDlgCtrlIdSampleEditorValue ); TPtrC numberLabel = Line( EThreeFormsDlgCtrlIdSampleEditorValue )->GetFullCaptionText(); iSampleEditorValueLabel = numberLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorDate ) ) { iSampleEditorDateData = TTimeEditorValue( EThreeFormsDlgCtrlIdSampleEditorDate ); TPtrC timeLabel = Line( EThreeFormsDlgCtrlIdSampleEditorDate )->GetFullCaptionText(); iSampleEditorDateLabel = timeLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorTime ) ) { iSampleEditorTimeData = TTimeEditorValue( EThreeFormsDlgCtrlIdSampleEditorTime ); TPtrC timeLabel = Line( EThreeFormsDlgCtrlIdSampleEditorTime )->GetFullCaptionText(); iSampleEditorTimeLabel = timeLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorDuration ) ) { iSampleEditorDurationData = DurationEditorValue( EThreeFormsDlgCtrlIdSampleEditorDuration ); TPtrC timeLabel = Line( EThreeFormsDlgCtrlIdSampleEditorDuration )->GetFullCaptionText(); iSampleEditorDurationLabel = timeLabel; } CEikSecretEditor* secretEd = ( CEikSecretEditor* ) ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorPassword ); if ( secretEd ) { secretEd->GetText( iSampleEditorPasswordData ); TPtrC secretLabel = Line( EThreeFormsDlgCtrlIdSampleEditorPassword )->GetFullCaptionText(); iSampleEditorPasswordLabel = secretLabel; } break; } case R_THREEFORMS_BIZ_DIALOG: { if ( ControlOrNull( EThreeFormsDlgCtrlIdBizCompany ) ) { GetEdwinText( iBizCompanyData, EThreeFormsDlgCtrlIdBizCompany ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdBizCompany )->GetFullCaptionText(); iBizCompanyLabel = edwinLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizLastName ) ) { GetEdwinText( iBizLastNameData, EThreeFormsDlgCtrlIdBizLastName ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdBizLastName )->GetFullCaptionText(); iBizLastNameLabel = edwinLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizFirstName ) ) { GetEdwinText( iBizFirstNameData, EThreeFormsDlgCtrlIdBizFirstName ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdBizFirstName )->GetFullCaptionText(); iBizFirstNameLabel = edwinLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizAddress ) ) { GetEdwinText( iBizAddressData, EThreeFormsDlgCtrlIdBizAddress ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdBizAddress )->GetFullCaptionText(); iBizAddressLabel = edwinLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizCity ) ) { GetEdwinText( iBizCityData, EThreeFormsDlgCtrlIdBizCity ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdBizCity )->GetFullCaptionText(); iBizCityLabel = edwinLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizCountry ) ) { GetEdwinText( iBizCountryData, EThreeFormsDlgCtrlIdBizCountry ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdBizCountry )->GetFullCaptionText(); iBizCountryLabel = edwinLabel; } break; } case R_THREEFORMS_FRIEND_DIALOG: { if ( ControlOrNull( EThreeFormsDlgCtrlIdFriendFirstName ) ) { GetEdwinText( iFriendFirstNameData, EThreeFormsDlgCtrlIdFriendFirstName ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdFriendFirstName )->GetFullCaptionText(); iFriendFirstNameLabel = edwinLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdFriendLastName ) ) { GetEdwinText( iFriendLastNameData, EThreeFormsDlgCtrlIdFriendLastName ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdFriendLastName )->GetFullCaptionText(); iFriendLastNameLabel = edwinLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdFriendAddress ) ) { GetEdwinText( iFriendAddressData, EThreeFormsDlgCtrlIdFriendAddress ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdFriendAddress )->GetFullCaptionText(); iFriendAddressLabel = edwinLabel; } if ( ControlOrNull( EThreeFormsDlgCtrlIdFriendCity ) ) { GetEdwinText( iFriendCityData, EThreeFormsDlgCtrlIdFriendCity ); TPtrC edwinLabel = Line( EThreeFormsDlgCtrlIdFriendCity )->GetFullCaptionText(); iFriendCityLabel = edwinLabel; } break; } default: break; } return ETrue; } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::DoNotSaveFormDataL() // Does not save form data. // ---------------------------------------------------------------------------- // void CThreeFormsSaveForm::DoNotSaveFormDataL() { switch ( iCurrentId ) { case R_THREEFORMS_SAMPLE_EDITOR_DIALOG: { if ( ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorValue ) ) { SetNumberEditorValue( EThreeFormsDlgCtrlIdSampleEditorValue, iSampleEditorValueData ); Line( EThreeFormsDlgCtrlIdSampleEditorValue )->SetCaptionL( iSampleEditorValueLabel ); Line( EThreeFormsDlgCtrlIdSampleEditorValue )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorDate ) ) { SetTTimeEditorValue( EThreeFormsDlgCtrlIdSampleEditorDate, iSampleEditorDateData ); Line( EThreeFormsDlgCtrlIdSampleEditorDate )->SetCaptionL( iSampleEditorDateLabel ); Line( EThreeFormsDlgCtrlIdSampleEditorDate )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorTime ) ) { SetTTimeEditorValue( EThreeFormsDlgCtrlIdSampleEditorTime, iSampleEditorTimeData ); Line( EThreeFormsDlgCtrlIdSampleEditorTime )->SetCaptionL( iSampleEditorTimeLabel ); Line( EThreeFormsDlgCtrlIdSampleEditorTime )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorDuration ) ) { SetDurationEditorValue( EThreeFormsDlgCtrlIdSampleEditorDuration, iSampleEditorDurationData ); Line( EThreeFormsDlgCtrlIdSampleEditorDuration )->SetCaptionL( iSampleEditorDurationLabel ); Line( EThreeFormsDlgCtrlIdSampleEditorDuration )->iCaption->CropText(); } CEikSecretEditor* secretEd = ( CEikSecretEditor* ) ControlOrNull( EThreeFormsDlgCtrlIdSampleEditorPassword ); if ( secretEd ) { secretEd->SetText( iSampleEditorPasswordData ); Line( EThreeFormsDlgCtrlIdSampleEditorPassword )->SetCaptionL( iSampleEditorPasswordLabel ); Line( EThreeFormsDlgCtrlIdSampleEditorPassword )->iCaption->CropText(); } break; } case R_THREEFORMS_BIZ_DIALOG: { if ( ControlOrNull( EThreeFormsDlgCtrlIdBizCompany ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdBizCompany, &iBizCompanyData ); Line( EThreeFormsDlgCtrlIdBizCompany )->SetCaptionL( iBizCompanyLabel ); Line( EThreeFormsDlgCtrlIdBizCompany )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizLastName ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdBizLastName, &iBizLastNameData ); Line( EThreeFormsDlgCtrlIdBizLastName )->SetCaptionL( iBizLastNameLabel ); Line( EThreeFormsDlgCtrlIdBizLastName )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizFirstName ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdBizFirstName, &iBizFirstNameData ); Line( EThreeFormsDlgCtrlIdBizFirstName )->SetCaptionL( iBizFirstNameLabel ); Line( EThreeFormsDlgCtrlIdBizFirstName )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizAddress ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdBizAddress, &iBizAddressData ); Line( EThreeFormsDlgCtrlIdBizAddress )->SetCaptionL( iBizAddressLabel ); Line( EThreeFormsDlgCtrlIdBizAddress )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizCity ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdBizCity, &iBizCityData ); Line( EThreeFormsDlgCtrlIdBizCity )->SetCaptionL( iBizCityLabel ); Line( EThreeFormsDlgCtrlIdBizCity )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdBizCountry ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdBizCountry, &iBizCountryData ); Line( EThreeFormsDlgCtrlIdBizCountry )->SetCaptionL( iBizCountryLabel ); Line( EThreeFormsDlgCtrlIdBizCountry )->iCaption->CropText(); } break; } case R_THREEFORMS_FRIEND_DIALOG: { if ( ControlOrNull( EThreeFormsDlgCtrlIdFriendFirstName ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdFriendFirstName, &iFriendFirstNameData ); Line( EThreeFormsDlgCtrlIdFriendFirstName )->SetCaptionL( iFriendFirstNameLabel ); Line( EThreeFormsDlgCtrlIdFriendFirstName )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdFriendLastName ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdFriendLastName, &iFriendLastNameData ); Line( EThreeFormsDlgCtrlIdFriendLastName )->SetCaptionL( iFriendLastNameLabel ); Line( EThreeFormsDlgCtrlIdFriendLastName )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdFriendAddress ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdFriendAddress, &iFriendAddressData ); Line( EThreeFormsDlgCtrlIdFriendAddress )->SetCaptionL( iFriendAddressLabel ); Line( EThreeFormsDlgCtrlIdFriendAddress )->iCaption->CropText(); } if ( ControlOrNull( EThreeFormsDlgCtrlIdFriendCity ) ) { SetEdwinTextL( EThreeFormsDlgCtrlIdFriendCity, &iFriendCityData ); Line( EThreeFormsDlgCtrlIdFriendCity )->SetCaptionL( iFriendCityLabel ); Line( EThreeFormsDlgCtrlIdFriendCity )->iCaption->CropText(); } break; } default: break; } } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::PostLayoutDynInitL() // Set default field value to member data. // ---------------------------------------------------------------------------- // void CThreeFormsSaveForm::PostLayoutDynInitL() { CAknForm::PostLayoutDynInitL(); SaveFormDataL(); } // ---------------------------------------------------------------------------- // CThreeFormsSaveForm::QuerySaveChangesL() // Show save query. If user answers "No" to this query. // return field value to the value which is before editing. // This is called Back-softkey when edit mode. // ---------------------------------------------------------------------------- // TBool CThreeFormsSaveForm::QuerySaveChangesL() { TBool isAnsYes( CAknForm::QuerySaveChangesL() ); if ( isAnsYes ) { SaveFormDataL(); } else { // Case that answer "No" to query. DoNotSaveFormDataL(); } return isAnsYes; } // End of File