/* 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 "AknExFormSaveForm.h" // ================= MEMBER FUNCTIONS ========================================= // ---------------------------------------------------------------------------- // CAknExFormSaveForm::NewL() // Two-phased constructor. // ---------------------------------------------------------------------------- // CAknExFormSaveForm* CAknExFormSaveForm::NewL() { CAknExFormSaveForm* self = new ( ELeave ) CAknExFormSaveForm(); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop(); return self; } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::~CAknExFormSaveForm() // Destructor. // ---------------------------------------------------------------------------- // CAknExFormSaveForm::~CAknExFormSaveForm() { } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::CAknExFormSaveForm() // Default constructor. // ---------------------------------------------------------------------------- // CAknExFormSaveForm::CAknExFormSaveForm() { } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::ConstructL() // Second-phase constructor. // ---------------------------------------------------------------------------- // void CAknExFormSaveForm::ConstructL() { CAknForm::ConstructL(); } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::ExecuteLD() // // ---------------------------------------------------------------------------- // TInt CAknExFormSaveForm::ExecuteLD( TInt aResourceId ) { iCurrentId = aResourceId; return CAknForm::ExecuteLD( aResourceId ); } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::PrepareLC( TInt aResourceId ) // // ---------------------------------------------------------------------------- // void CAknExFormSaveForm::PrepareLC( TInt aResourceId ) { iCurrentId = aResourceId; CAknForm::PrepareLC( aResourceId ); } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::SaveFormDataL() // Save form data. // ---------------------------------------------------------------------------- // TBool CAknExFormSaveForm::SaveFormDataL() { switch ( iCurrentId ) { case R_AKNEXFORM_ALL_EDITORS_DIALOG: { if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsText ) ) { GetEdwinText( iAllEditorsTextData, EAknExFormDlgCtrlIdAllEditorsText ); TPtrC edwinLabel = Line( EAknExFormDlgCtrlIdAllEditorsText )->GetFullCaptionText(); iAllEditorsTextLabel = edwinLabel; } if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsNumber ) ) { iAllEditorsNumberData = NumberEditorValue( EAknExFormDlgCtrlIdAllEditorsNumber ); TPtrC numberLabel = Line( EAknExFormDlgCtrlIdAllEditorsNumber )->GetFullCaptionText(); iAllEditorsNumberLabel = numberLabel; } if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsDate ) ) { iAllEditorsDateData = TTimeEditorValue( EAknExFormDlgCtrlIdAllEditorsDate ); TPtrC timeLabel = Line( EAknExFormDlgCtrlIdAllEditorsDate )->GetFullCaptionText(); iAllEditorsDateLabel = timeLabel; } if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsTime ) ) { iAllEditorsTimeData = TTimeEditorValue( EAknExFormDlgCtrlIdAllEditorsTime ); TPtrC timeLabel = Line( EAknExFormDlgCtrlIdAllEditorsTime )->GetFullCaptionText(); iAllEditorsTimeLabel = timeLabel; } if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsDuration ) ) { iAllEditorsDurationData = DurationEditorValue( EAknExFormDlgCtrlIdAllEditorsDuration ); TPtrC timeLabel = Line( EAknExFormDlgCtrlIdAllEditorsDuration )->GetFullCaptionText(); iAllEditorsDurationLabel = timeLabel; } CEikSecretEditor* secretEd = ( CEikSecretEditor* ) ControlOrNull( EAknExFormDlgCtrlIdAllEditorsPassword ); if ( secretEd ) { secretEd->GetText( iAllEditorsPasswordData ); TPtrC secretLabel = Line( EAknExFormDlgCtrlIdAllEditorsPassword )->GetFullCaptionText(); iAllEditorsPasswordLabel = secretLabel; } break; } default: break; } return ETrue; } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::DoNotSaveFormDataL() // Does not save form data. // ---------------------------------------------------------------------------- // void CAknExFormSaveForm::DoNotSaveFormDataL() { switch ( iCurrentId ) { case R_AKNEXFORM_ALL_EDITORS_DIALOG: { if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsText ) ) { SetEdwinTextL( EAknExFormDlgCtrlIdAllEditorsText, &iAllEditorsTextData ); Line( EAknExFormDlgCtrlIdAllEditorsText )->SetCaptionL( iAllEditorsTextLabel ); Line( EAknExFormDlgCtrlIdAllEditorsText )->iCaption->CropText(); } if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsNumber ) ) { SetNumberEditorValue( EAknExFormDlgCtrlIdAllEditorsNumber, iAllEditorsNumberData ); Line( EAknExFormDlgCtrlIdAllEditorsNumber )->SetCaptionL( iAllEditorsNumberLabel ); Line( EAknExFormDlgCtrlIdAllEditorsNumber )->iCaption->CropText(); } if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsDate ) ) { SetTTimeEditorValue( EAknExFormDlgCtrlIdAllEditorsDate, iAllEditorsDateData ); Line( EAknExFormDlgCtrlIdAllEditorsDate )->SetCaptionL( iAllEditorsDateLabel ); Line( EAknExFormDlgCtrlIdAllEditorsDate )->iCaption->CropText(); } if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsTime ) ) { SetTTimeEditorValue( EAknExFormDlgCtrlIdAllEditorsTime, iAllEditorsTimeData ); Line( EAknExFormDlgCtrlIdAllEditorsTime )->SetCaptionL( iAllEditorsTimeLabel ); Line( EAknExFormDlgCtrlIdAllEditorsTime )->iCaption->CropText(); } if ( ControlOrNull( EAknExFormDlgCtrlIdAllEditorsDuration ) ) { SetDurationEditorValue( EAknExFormDlgCtrlIdAllEditorsDuration, iAllEditorsDurationData ); Line( EAknExFormDlgCtrlIdAllEditorsDuration )->SetCaptionL( iAllEditorsDurationLabel ); Line( EAknExFormDlgCtrlIdAllEditorsDuration )->iCaption->CropText(); } CEikSecretEditor* secretEd = ( CEikSecretEditor* ) ControlOrNull( EAknExFormDlgCtrlIdAllEditorsPassword ); if ( secretEd ) { secretEd->SetText( iAllEditorsPasswordData ); Line( EAknExFormDlgCtrlIdAllEditorsPassword )->SetCaptionL( iAllEditorsPasswordLabel ); Line( EAknExFormDlgCtrlIdAllEditorsPassword )->iCaption->CropText(); } break; } default: break; } } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::PostLayoutDynInitL() // Set default field value to member data. // ---------------------------------------------------------------------------- // void CAknExFormSaveForm::PostLayoutDynInitL() { CAknForm::PostLayoutDynInitL(); SaveFormDataL(); } // ---------------------------------------------------------------------------- // CAknExFormSaveForm::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 CAknExFormSaveForm::QuerySaveChangesL() { TBool isAnsYes( CAknForm::QuerySaveChangesL() ); if ( isAnsYes ) { SaveFormDataL(); } else { // Case that answer "No" to query. DoNotSaveFormDataL(); } return isAnsYes; } // End of File