mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSRepeatDialog.cpp
changeset 0 b8ed18f6c07b
equal deleted inserted replaced
-1:000000000000 0:b8ed18f6c07b
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Part of the MVS Application for TechView
       
    15 //
       
    16 
       
    17 #include "MVSRepeatDialog.h"
       
    18 #include "MVSApp.hrh"
       
    19 
       
    20 
       
    21 void CMVSRepeatDialog::SetupDialogLD(TInt aNoRepeats, 
       
    22                                   TTimeIntervalMicroSeconds aTrailingSilence,
       
    23                                   CMVSAppUi* aAppUi)
       
    24 	{
       
    25     CMVSRepeatDialog* dialog = new (ELeave) CMVSRepeatDialog(aNoRepeats,
       
    26                                                        aTrailingSilence,
       
    27                                                        aAppUi);
       
    28     dialog->ExecuteLD(R_MVS_DIALOG_SETREPEATS);
       
    29     }
       
    30 
       
    31 
       
    32 void CMVSRepeatDialog::PreLayoutDynInitL()
       
    33     {
       
    34     // Get a downcasted pointer to the controls
       
    35     CEikNumberEditor* myRepeatControl = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetRepeats));
       
    36     CEikNumberEditor* myTrSilenceControl = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetTrailingSilence));
       
    37 	
       
    38     //Now seed the controls with appropriate values
       
    39     if(myRepeatControl)
       
    40     	{
       
    41     	myRepeatControl->SetNumber(iNoRepeats);	
       
    42     	}
       
    43     if(myTrSilenceControl)
       
    44     	{
       
    45     	myTrSilenceControl->SetNumber(I64INT(iTrailingSilence.Int64()/1000000));	
       
    46     	}
       
    47     }
       
    48 
       
    49 
       
    50 CMVSRepeatDialog::CMVSRepeatDialog(TInt aNoRepeats, 
       
    51                              TTimeIntervalMicroSeconds aTrailingSilence,
       
    52                              CMVSAppUi* aAppUi)
       
    53 : iNoRepeats(aNoRepeats), iAppUi(aAppUi)
       
    54     {
       
    55     iTrailingSilence = aTrailingSilence.Int64();
       
    56     }
       
    57 
       
    58 
       
    59 TBool CMVSRepeatDialog::OkToExitL(TInt aButtonId)
       
    60     {
       
    61     if(aButtonId == EMVSButtonCancel)
       
    62     	{
       
    63         return ETrue;
       
    64         }
       
    65 
       
    66     //Update number of repeats from the control.
       
    67     iNoRepeats = static_cast<CEikNumberEditor*>
       
    68                         (Control(EMVSCmdSetRepeats))->Number();
       
    69 
       
    70     //Update the trailing silence from the control.
       
    71     TInt64 silence64 = (static_cast<CEikNumberEditor*>
       
    72                         (Control(EMVSCmdSetTrailingSilence))->Number());  
       
    73     TInt silence = I64INT(silence64*1000000);
       
    74     TTimeIntervalMicroSeconds theSilence(silence);
       
    75     iAppUi->SetRepeats(iNoRepeats, theSilence);
       
    76     return ETrue;
       
    77     }