loadgen/src/loadgen_editors.cpp
branchRCL_3
changeset 21 b3cee849fa46
parent 20 48060abbbeaf
child 22 fad26422216a
equal deleted inserted replaced
20:48060abbbeaf 21:b3cee849fa46
     1 /*
       
     2 * Copyright (c) 2009 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "loadgen_editors.h"
       
    21 #include "loadgen_loadattributes.h"
       
    22 #include "loadgen.hrh"
       
    23 #include <loadgen.rsg>
       
    24 
       
    25 #include <AknForm.h> 
       
    26 #include <eikedwin.h> 
       
    27 #include <eikmfne.h>
       
    28 #include <AknPopupFieldText.h>
       
    29 #include <AknQueryValueText.h>
       
    30 #include <eikspane.h> 
       
    31 #include <akntitle.h> 
       
    32 #include <eikcapc.h>
       
    33 #include <e32hal.h> 
       
    34 
       
    35 // ===================================== MEMBER FUNCTIONS =====================================
       
    36 
       
    37 // --------------------------------------------------------------------------------------------
       
    38 
       
    39 CLoadGenLoadTypeEditorBase::CLoadGenLoadTypeEditorBase(TBool aEditingExisting):
       
    40     iEditingExisting(aEditingExisting)
       
    41     {
       
    42     }
       
    43 
       
    44 // --------------------------------------------------------------------------------------------
       
    45 
       
    46 void CLoadGenLoadTypeEditorBase::ConstructL(const TDesC& aTitleText)
       
    47     {
       
    48     CAknForm::ConstructL();
       
    49 
       
    50     // set title text
       
    51     CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
       
    52     CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
       
    53     tp->SetTextL( aTitleText );
       
    54     }
       
    55 
       
    56 // --------------------------------------------------------------------------------------------
       
    57 
       
    58 void CLoadGenLoadTypeEditorBase::PreLayoutDynInitL()
       
    59     {
       
    60     CAknForm::PreLayoutDynInitL();
       
    61     }
       
    62 
       
    63 // --------------------------------------------------------------------------------------------
       
    64 
       
    65 TBool CLoadGenLoadTypeEditorBase::OkToExitL(TInt /*aButtonId*/)
       
    66     {
       
    67     return ETrue;
       
    68     }
       
    69 
       
    70 // --------------------------------------------------------------------------------------------
       
    71 
       
    72 void CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(TInt aControlId)
       
    73     {
       
    74     CAknForm::HandleControlStateChangeL(aControlId);
       
    75     }
       
    76     
       
    77 // --------------------------------------------------------------------------------------------
       
    78 
       
    79 TBool CLoadGenLoadTypeEditorBase::RunQueryLD()
       
    80     {
       
    81     User::Panic(_L("Unk.form"), 222);
       
    82     
       
    83     return ETrue;
       
    84     }
       
    85                
       
    86 // --------------------------------------------------------------------------------------------
       
    87 
       
    88 TBool CLoadGenLoadTypeEditorBase::DoRunQueryLD(TInt aResource)
       
    89     {
       
    90     return ExecuteLD(aResource);
       
    91     }
       
    92 
       
    93 // --------------------------------------------------------------------------------------------
       
    94 
       
    95 void CLoadGenLoadTypeEditorBase::InsertFieldAfterL(TInt aResourceId, TInt aControlId, TInt aPrevControlId)
       
    96     {
       
    97     CCoeControl* prevControl = Control(aPrevControlId);
       
    98     __ASSERT_DEBUG(prevControl, User::Panic(_L("Form.Ctrl.Null"), 111));
       
    99     TInt pos = FindLineIndex(*prevControl);
       
   100     pos = pos + 1;
       
   101     InsertLineL(pos, aResourceId);
       
   102     Line(aControlId)->ActivateL();
       
   103     }
       
   104 
       
   105 // --------------------------------------------------------------------------------------------
       
   106 
       
   107 void CLoadGenLoadTypeEditorBase::UpdateFormL()
       
   108     {
       
   109     UpdatePageL(ETrue);
       
   110     }
       
   111                
       
   112 // --------------------------------------------------------------------------------------------
       
   113 // --------------------------------------------------------------------------------------------
       
   114 
       
   115 CLoadGenCPULoadEditor* CLoadGenCPULoadEditor::NewL(TCPULoadAttributes& aAttributes, TBool aEditingExisting)
       
   116     {
       
   117     CLoadGenCPULoadEditor* self = new(ELeave) CLoadGenCPULoadEditor(aAttributes, aEditingExisting);
       
   118     CleanupStack::PushL(self);
       
   119     self->ConstructL();
       
   120     CleanupStack::Pop(self);
       
   121     return self;    
       
   122     }
       
   123 
       
   124 // --------------------------------------------------------------------------------------------
       
   125 
       
   126 CLoadGenCPULoadEditor::~CLoadGenCPULoadEditor()
       
   127     {
       
   128     delete iCpuQueryValText;
       
   129     delete iCpuTextArray;
       
   130     delete iCPUsArray;
       
   131     }
       
   132 
       
   133 // --------------------------------------------------------------------------------------------
       
   134 
       
   135 CLoadGenCPULoadEditor::CLoadGenCPULoadEditor(TCPULoadAttributes& aAttributes, TBool aEditingExisting) :
       
   136     CLoadGenLoadTypeEditorBase(aEditingExisting), iAttributes(aAttributes)
       
   137     {
       
   138     }
       
   139 
       
   140 // --------------------------------------------------------------------------------------------
       
   141 
       
   142 void CLoadGenCPULoadEditor::ConstructL()
       
   143     {
       
   144     CLoadGenLoadTypeEditorBase::ConstructL(_L("CPU load"));
       
   145     }
       
   146 
       
   147 // --------------------------------------------------------------------------------------------
       
   148 
       
   149 void CLoadGenCPULoadEditor::PreLayoutDynInitL()
       
   150     {
       
   151     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
   152 
       
   153     // load values to static editors
       
   154     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenCPULoadQueryPriority));
       
   155     CAknPopupFieldText* edMode = static_cast<CAknPopupFieldText*>(Control(ELoadGenCPULoadQueryMode));
       
   156     CAknPopupFieldText* edType = static_cast<CAknPopupFieldText*>(Control(ELoadGenCPULoadQueryType));
       
   157     edPriority->SetCurrentValueIndex(iAttributes.iPriority);
       
   158     edMode->SetCurrentValueIndex(iAttributes.iMode);
       
   159     edType->SetCurrentValueIndex(iAttributes.iType);
       
   160     
       
   161     LoadCPUsL();
       
   162 
       
   163     UpdateVisibilitiesOfFieldsL(ETrue);
       
   164     }
       
   165 
       
   166 // --------------------------------------------------------------------------------------------
       
   167 
       
   168 void CLoadGenCPULoadEditor::LoadCPUsL()
       
   169     {
       
   170     // if we are running in SMP environment
       
   171     if (iAttributes.iCpuCount > 1)
       
   172         {
       
   173         // insert possibility to select which cpu the load is generated to
       
   174         InsertFieldAfterL(R_CPULOAD_DLG_LINE_CPU, ELoadGenCPULoadQueryCpu, ELoadGenCPULoadQueryType);
       
   175 
       
   176         iCPUsArray = new (ELeave) CDesCArrayFlat( 5 );
       
   177         
       
   178         // "Free scheduling" means that no specific cpu is selected. Scheduler desides
       
   179         // which CPUu runs load thread at which time.
       
   180         iCPUsArray->AppendL(_L("Free scheduling"));
       
   181         
       
   182         // add CPUs
       
   183         for (int i = 0; i < iAttributes.iCpuCount; i++) 
       
   184             {
       
   185             TBuf<10> cpu;
       
   186             _LIT(KCPU, "CPU%d");
       
   187             cpu.Format(KCPU, i);
       
   188             iCPUsArray->AppendL(cpu);
       
   189             }
       
   190         
       
   191         // "All CPUs" means that one thread is started for each CPU.
       
   192         iCPUsArray->AppendL(_L("All CPUs"));
       
   193     
       
   194         iCpuTextArray = CAknQueryValueTextArray::NewL();
       
   195         iCpuTextArray->SetArray( *iCPUsArray );  
       
   196         iCpuQueryValText = CAknQueryValueText::NewL();    
       
   197         iCpuQueryValText->SetArrayL( iCpuTextArray );
       
   198         // CPU is not defined, set "Free scheduling" as default selection in query list
       
   199         if (iAttributes.iCpu < 0)
       
   200             {
       
   201             iCpuQueryValText->SetCurrentValueIndex(0);
       
   202             }
       
   203         // "All CPUs" selected. It is last choise in the selection list.
       
   204         else if (iAttributes.iCpu == KCPUSelection_AllCPUs)
       
   205             {
       
   206             iCpuQueryValText->SetCurrentValueIndex(iCpuTextArray->MdcaCount()-1);
       
   207             }
       
   208         // CPU is defined, set the correct CPU as default selection in query list
       
   209         else
       
   210             {
       
   211             // iCpu starts from zero (i.e. CPU0 is first CPU), but index zero
       
   212             // in iCpuQueryValText is "Free scheduling", hence iCpu+1.
       
   213             iCpuQueryValText->SetCurrentValueIndex(iAttributes.iCpu+1);
       
   214             }
       
   215 
       
   216         CAknPopupField* popup = static_cast<CAknPopupField*>(Control( ELoadGenCPULoadQueryCpu)); 
       
   217         popup->SetQueryValueL( iCpuQueryValText );
       
   218         }
       
   219     }
       
   220 
       
   221 // --------------------------------------------------------------------------------------------
       
   222 
       
   223 TBool CLoadGenCPULoadEditor::OkToExitL(TInt aButtonId)
       
   224     {
       
   225     if (aButtonId == EAknSoftkeyOk)
       
   226         {
       
   227         // store values from editors
       
   228         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenCPULoadQueryPriority));
       
   229         CAknPopupFieldText* edMode = static_cast<CAknPopupFieldText*>(Control(ELoadGenCPULoadQueryMode));
       
   230         CAknPopupFieldText* edType = static_cast<CAknPopupFieldText*>(Control(ELoadGenCPULoadQueryType));
       
   231         CEikNumberEditor* edPeak = static_cast<CEikNumberEditor*>(ControlOrNull(ELoadGenCPULoadQueryLength));
       
   232         CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(ControlOrNull(ELoadGenCPULoadQueryIdle));
       
   233         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(ControlOrNull(ELoadGenCPULoadQueryVariance));
       
   234         
       
   235         // we are running in SMP environment
       
   236         if (iAttributes.iCpuCount > 1)
       
   237             {
       
   238             TInt currentValueIndex = iCpuQueryValText->CurrentValueIndex();
       
   239             // user selected a specific CPU in which the load thread should be run in.
       
   240             if (currentValueIndex == 0)
       
   241                 {
       
   242                 // User selected "Free scheduling"
       
   243                 iAttributes.iCpu = KCPUSelection_FreeScheduling;
       
   244                 }            
       
   245             else if( currentValueIndex == iCpuTextArray->MdcaCount()-1 )
       
   246                 {
       
   247                 // User selected "All CPUs", which is the last item in the selection list
       
   248                 iAttributes.iCpu = KCPUSelection_AllCPUs;
       
   249                 }
       
   250             else
       
   251                 {                
       
   252                 // iCpu should start from zero (CPU0 is the first cpu)
       
   253                 // but zero in currentValueIndex means "Free scheduling". CPU0 in
       
   254                 // currentValueIndex is at index 1, hence -1.
       
   255                 iAttributes.iCpu = currentValueIndex - 1;
       
   256                 }
       
   257             }
       
   258 
       
   259         iAttributes.iPriority = edPriority->CurrentValueIndex();
       
   260         iAttributes.iMode = edMode->CurrentValueIndex();
       
   261         iAttributes.iType = edType->CurrentValueIndex();
       
   262         if (edPeak) iAttributes.iLength = edPeak->Number();
       
   263         if (edIdle) iAttributes.iIdle = edIdle->Number();
       
   264         if (edVariance) iAttributes.iRandomVariance = edVariance->Number();
       
   265         }
       
   266     
       
   267     return ETrue;
       
   268     }       
       
   269 
       
   270 // --------------------------------------------------------------------------------------------
       
   271 
       
   272 void CLoadGenCPULoadEditor::UpdateVisibilitiesOfFieldsL(TBool aFormInit)
       
   273     {
       
   274     // filter based on selected cpu load type
       
   275     CAknPopupFieldText* edType = static_cast<CAknPopupFieldText*>( Control( ELoadGenCPULoadQueryType ) );
       
   276 
       
   277     if ( !aFormInit && edType->CurrentValueIndex() == ECpuLoadTypeContinuous )
       
   278         {
       
   279         // save values before deleting the items
       
   280         CCoeControl* control = ControlOrNull( ELoadGenCPULoadQueryLength );
       
   281         if ( control )
       
   282             {
       
   283             CEikNumberEditor* edPeak = static_cast<CEikNumberEditor*>( control );
       
   284             iAttributes.iLength = edPeak->Number();
       
   285             DeleteLine( ELoadGenCPULoadQueryLength );
       
   286             control = NULL;
       
   287             }
       
   288         control = ControlOrNull( ELoadGenCPULoadQueryIdle );
       
   289         if ( control )
       
   290             {
       
   291             CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>( control );
       
   292             iAttributes.iIdle = edIdle->Number();
       
   293             DeleteLine( ELoadGenCPULoadQueryIdle );
       
   294             control = NULL;
       
   295             }
       
   296         control = ControlOrNull( ELoadGenCPULoadQueryVariance );
       
   297         if ( control )
       
   298             {
       
   299             CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>( control );
       
   300             iAttributes.iRandomVariance = edVariance->Number();
       
   301             DeleteLine( ELoadGenCPULoadQueryVariance );
       
   302             }
       
   303         }
       
   304     else if ( edType->CurrentValueIndex() == ECpuLoadTypePeriodic )
       
   305         {
       
   306         // insert new fields
       
   307         InsertFieldAfterL(R_CPULOAD_DLG_LINE_PERIODIC_LENGTH, ELoadGenCPULoadQueryLength, ELoadGenCPULoadQueryType);
       
   308         InsertFieldAfterL(R_CPULOAD_DLG_LINE_PERIODIC_IDLE, ELoadGenCPULoadQueryIdle, ELoadGenCPULoadQueryLength);
       
   309         InsertFieldAfterL(R_CPULOAD_DLG_LINE_PERIODIC_VARIANCE, ELoadGenCPULoadQueryVariance, ELoadGenCPULoadQueryIdle);
       
   310         
       
   311         // load values to just created editors
       
   312         CEikNumberEditor* edPeak = static_cast<CEikNumberEditor*>(Control(ELoadGenCPULoadQueryLength));
       
   313         CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenCPULoadQueryIdle));
       
   314         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenCPULoadQueryVariance));
       
   315         edPeak->SetNumber(iAttributes.iLength);
       
   316         edIdle->SetNumber(iAttributes.iIdle);
       
   317         edVariance->SetNumber(iAttributes.iRandomVariance);
       
   318         }
       
   319 
       
   320     UpdateFormL();
       
   321     }
       
   322 
       
   323 // --------------------------------------------------------------------------------------------
       
   324 
       
   325 void CLoadGenCPULoadEditor::HandleControlStateChangeL(TInt aControlId)
       
   326     {
       
   327     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(aControlId);
       
   328 
       
   329     // update visibilities of fields    
       
   330     if (aControlId == ELoadGenCPULoadQueryType)
       
   331         {
       
   332         UpdateVisibilitiesOfFieldsL();
       
   333         }
       
   334     }
       
   335     
       
   336 // --------------------------------------------------------------------------------------------
       
   337 
       
   338 TBool CLoadGenCPULoadEditor::RunQueryLD()
       
   339     {
       
   340     return CLoadGenLoadTypeEditorBase::DoRunQueryLD(R_CPULOAD_FORM_DIALOG);
       
   341     }
       
   342        
       
   343 // --------------------------------------------------------------------------------------------
       
   344 // --------------------------------------------------------------------------------------------
       
   345 
       
   346 CLoadGenMemoryEatEditor* CLoadGenMemoryEatEditor::NewL(TMemoryEatAttributes& aAttributes, TBool aEditingExisting)
       
   347     {
       
   348     CLoadGenMemoryEatEditor* self = new(ELeave) CLoadGenMemoryEatEditor(aAttributes, aEditingExisting);
       
   349     CleanupStack::PushL(self);
       
   350     self->ConstructL();
       
   351     CleanupStack::Pop(self);
       
   352     return self;    
       
   353     }
       
   354 
       
   355 // --------------------------------------------------------------------------------------------
       
   356 
       
   357 CLoadGenMemoryEatEditor::~CLoadGenMemoryEatEditor()
       
   358     {
       
   359     }
       
   360 
       
   361 // --------------------------------------------------------------------------------------------
       
   362 
       
   363 CLoadGenMemoryEatEditor::CLoadGenMemoryEatEditor(TMemoryEatAttributes& aAttributes, TBool aEditingExisting) :
       
   364     CLoadGenLoadTypeEditorBase(aEditingExisting), iAttributes(aAttributes)
       
   365     {
       
   366     }
       
   367 
       
   368 // --------------------------------------------------------------------------------------------
       
   369 
       
   370 void CLoadGenMemoryEatEditor::ConstructL()
       
   371     {
       
   372     CLoadGenLoadTypeEditorBase::ConstructL(_L("Memory eat"));
       
   373     
       
   374     // convert int64 vals to descs
       
   375     iAttributes.iAmountDes.Copy(KNullDesC);
       
   376     iAttributes.iRandomMinDes.Copy(KNullDesC);
       
   377     iAttributes.iRandomMaxDes.Copy(KNullDesC);
       
   378     
       
   379     iAttributes.iAmountDes.AppendNum(iAttributes.iAmount);
       
   380     iAttributes.iRandomMinDes.AppendNum(iAttributes.iRandomMin);
       
   381     iAttributes.iRandomMaxDes.AppendNum(iAttributes.iRandomMax);
       
   382     }
       
   383 
       
   384 // --------------------------------------------------------------------------------------------
       
   385 
       
   386 void CLoadGenMemoryEatEditor::PreLayoutDynInitL()
       
   387     {
       
   388     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
   389 
       
   390     // load values to static editors
       
   391     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenMemoryEatQueryPriority));
       
   392     CAknPopupFieldText* edSource = static_cast<CAknPopupFieldText*>(Control(ELoadGenMemoryEatQuerySource));
       
   393     CAknPopupFieldText* edType = static_cast<CAknPopupFieldText*>(Control(ELoadGenMemoryEatQueryType));
       
   394     CEikNumberEditor* edBuffer = static_cast<CEikNumberEditor*>(Control(ELoadGenMemoryEatQueryBuffer));
       
   395     CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenMemoryEatQueryIdle));
       
   396     CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenMemoryEatQueryVariance));
       
   397 
       
   398     edPriority->SetCurrentValueIndex(iAttributes.iPriority);
       
   399     edSource->SetCurrentValueIndex(iAttributes.iSource);
       
   400     edType->SetCurrentValueIndex(iAttributes.iType);
       
   401     edBuffer->SetNumber(iAttributes.iBuffer);
       
   402     edIdle->SetNumber(iAttributes.iIdle);
       
   403     edVariance->SetNumber(iAttributes.iRandomVariance);
       
   404             
       
   405     UpdateVisibilitiesOfFieldsL(ETrue);
       
   406     UpdateAvailableMemoryL();
       
   407     
       
   408     // set source as dimmed if editing existing item
       
   409     if (iEditingExisting)
       
   410         {
       
   411         SetLineDimmedNow(ELoadGenMemoryEatQuerySource, ETrue); 
       
   412         }
       
   413     }
       
   414 
       
   415 // --------------------------------------------------------------------------------------------
       
   416 
       
   417 TBool CLoadGenMemoryEatEditor::OkToExitL(TInt aButtonId)
       
   418     {
       
   419     if (aButtonId == EAknSoftkeyOk)
       
   420         {
       
   421         // store values from editors
       
   422         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenMemoryEatQueryPriority));
       
   423         CAknPopupFieldText* edSource = static_cast<CAknPopupFieldText*>(Control(ELoadGenMemoryEatQuerySource));
       
   424         CAknPopupFieldText* edType = static_cast<CAknPopupFieldText*>(Control(ELoadGenMemoryEatQueryType));
       
   425         CEikNumberEditor* edBuffer = static_cast<CEikNumberEditor*>(Control(ELoadGenMemoryEatQueryBuffer));
       
   426         CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenMemoryEatQueryIdle));
       
   427         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenMemoryEatQueryVariance));
       
   428 
       
   429         iAttributes.iPriority = edPriority->CurrentValueIndex();
       
   430         iAttributes.iSource = edSource->CurrentValueIndex();
       
   431         iAttributes.iType = edType->CurrentValueIndex();
       
   432         iAttributes.iBuffer = edBuffer->Number();
       
   433         iAttributes.iIdle = edIdle->Number();
       
   434         iAttributes.iRandomVariance = edVariance->Number();
       
   435 
       
   436 
       
   437         CEikEdwin* edAmount = static_cast<CEikEdwin*>(ControlOrNull(ELoadGenMemoryEatQueryAmount));
       
   438         CEikEdwin* edRandomMin = static_cast<CEikEdwin*>(ControlOrNull(ELoadGenMemoryEatQueryRandomMin));
       
   439         CEikEdwin* edRandomMax = static_cast<CEikEdwin*>(ControlOrNull(ELoadGenMemoryEatQueryRandomMax));
       
   440 
       
   441         // get desc values and convert to int64
       
   442         if (edAmount)
       
   443             {
       
   444             edAmount->GetText(iAttributes.iAmountDes);
       
   445 
       
   446             TLex converter;
       
   447             converter.Assign(iAttributes.iAmountDes);
       
   448             User::LeaveIfError(converter.Val(iAttributes.iAmount));
       
   449             }
       
   450 
       
   451         if (edRandomMin)
       
   452             {
       
   453             edRandomMin->GetText(iAttributes.iRandomMinDes);
       
   454 
       
   455             TLex converter;
       
   456             converter.Assign(iAttributes.iRandomMinDes);
       
   457             User::LeaveIfError(converter.Val(iAttributes.iRandomMin));
       
   458             }
       
   459 
       
   460         if (edRandomMax)
       
   461             {
       
   462             edRandomMax->GetText(iAttributes.iRandomMaxDes);
       
   463 
       
   464             TLex converter;
       
   465             converter.Assign(iAttributes.iRandomMaxDes);
       
   466             User::LeaveIfError(converter.Val(iAttributes.iRandomMax));
       
   467             
       
   468             // swap min max values if they in wrong order
       
   469             if (iAttributes.iRandomMin > iAttributes.iRandomMax)
       
   470                 {
       
   471                 TInt64 temp(iAttributes.iRandomMin);
       
   472                 iAttributes.iRandomMin = iAttributes.iRandomMax;
       
   473                 iAttributes.iRandomMax = temp; 
       
   474                 }
       
   475             
       
   476             }                        
       
   477         }
       
   478     
       
   479     return ETrue;
       
   480     }       
       
   481 
       
   482 // --------------------------------------------------------------------------------------------
       
   483 
       
   484 void CLoadGenMemoryEatEditor::UpdateVisibilitiesOfFieldsL(TBool aFormInit)
       
   485     {
       
   486     // filter based on selected memory eat type
       
   487     CAknPopupFieldText* edType = static_cast<CAknPopupFieldText*>(Control(ELoadGenMemoryEatQueryType));
       
   488 
       
   489     if (!aFormInit && (edType->CurrentValueIndex() == EMemoryEatTypeMemoryToEat || edType->CurrentValueIndex() == EMemoryEatTypeMemoryToBeLeft))
       
   490         {
       
   491         // no need for changes if amount field is already active
       
   492         CEikNumberEditor* edAmount = static_cast<CEikNumberEditor*>(ControlOrNull(ELoadGenMemoryEatQueryAmount));
       
   493         if (edAmount) return;
       
   494         
       
   495         // save values before deleting the items
       
   496         CEikEdwin* edRandomMin = static_cast<CEikEdwin*>(Control(ELoadGenMemoryEatQueryRandomMin));
       
   497         CEikEdwin* edRandomMax = static_cast<CEikEdwin*>(Control(ELoadGenMemoryEatQueryRandomMax));
       
   498         edRandomMin->GetText(iAttributes.iRandomMinDes);
       
   499         edRandomMax->GetText(iAttributes.iRandomMaxDes);
       
   500         
       
   501         DeleteLine(ELoadGenMemoryEatQueryRandomMin);
       
   502         DeleteLine(ELoadGenMemoryEatQueryRandomMax);
       
   503         }
       
   504     else if (!aFormInit && edType->CurrentValueIndex() == EMemoryEatTypeWavy)
       
   505         {
       
   506         // save values before deleting the items
       
   507         CEikEdwin* edAmount = static_cast<CEikEdwin*>(Control(ELoadGenMemoryEatQueryAmount));
       
   508         edAmount->GetText(iAttributes.iAmountDes);
       
   509         
       
   510         DeleteLine(ELoadGenMemoryEatQueryAmount);
       
   511         }
       
   512     
       
   513     if (edType->CurrentValueIndex() == EMemoryEatTypeMemoryToEat || edType->CurrentValueIndex() == EMemoryEatTypeMemoryToBeLeft)
       
   514         {
       
   515         // insert new fields
       
   516         InsertFieldAfterL(R_MEMORYEAT_DLG_LINE_AMOUNT, ELoadGenMemoryEatQueryAmount, ELoadGenMemoryEatQueryType);
       
   517         
       
   518         // load values to just created editors
       
   519         CEikEdwin* edAmount = static_cast<CEikEdwin*>(Control(ELoadGenMemoryEatQueryAmount));
       
   520         edAmount->SetTextL(&iAttributes.iAmountDes);
       
   521         }
       
   522     else if (edType->CurrentValueIndex() == EMemoryEatTypeWavy)
       
   523         {
       
   524         // insert new fields
       
   525         InsertFieldAfterL(R_MEMORYEAT_DLG_LINE_RANDOM_MIN, ELoadGenMemoryEatQueryRandomMin, ELoadGenMemoryEatQueryType);
       
   526         InsertFieldAfterL(R_MEMORYEAT_DLG_LINE_RANDOM_MAX, ELoadGenMemoryEatQueryRandomMax, ELoadGenMemoryEatQueryRandomMin);
       
   527         
       
   528         // load values to just created editors
       
   529         CEikEdwin* edRandomMin = static_cast<CEikEdwin*>(Control(ELoadGenMemoryEatQueryRandomMin));
       
   530         CEikEdwin* edRandomMax = static_cast<CEikEdwin*>(Control(ELoadGenMemoryEatQueryRandomMax));
       
   531         edRandomMin->SetTextL(&iAttributes.iRandomMinDes);
       
   532         edRandomMax->SetTextL(&iAttributes.iRandomMaxDes);
       
   533         }
       
   534     
       
   535     UpdateFormL();
       
   536     }
       
   537 
       
   538 // --------------------------------------------------------------------------------------------
       
   539 
       
   540 void CLoadGenMemoryEatEditor::UpdateAvailableMemoryL()
       
   541     {
       
   542     // this feature is used only when not editing existing load
       
   543     if (!iEditingExisting)
       
   544         {
       
   545         CAknPopupFieldText* edSource = static_cast<CAknPopupFieldText*>(ControlOrNull(ELoadGenMemoryEatQuerySource));
       
   546         CEikEdwin* edAmount = static_cast<CEikEdwin*>(ControlOrNull(ELoadGenMemoryEatQueryAmount));
       
   547         
       
   548         if (edAmount && edSource)
       
   549             {
       
   550             iAttributes.iAmountDes.Copy(KNullDesC);
       
   551 
       
   552             if (edSource->CurrentValueIndex() == EMemoryEatSourceTypeRAM)
       
   553                 {
       
   554                 // RAM
       
   555                 TMemoryInfoV1Buf ramMemory;
       
   556                 UserHal::MemoryInfo(ramMemory);
       
   557                 
       
   558                 iAttributes.iAmountDes.AppendNum(ramMemory().iFreeRamInBytes);
       
   559                 }
       
   560             else
       
   561                 {
       
   562                 // get drive
       
   563                 TVolumeInfo volumeInfo;
       
   564                 if (CEikonEnv::Static()->FsSession().Volume(volumeInfo, edSource->CurrentValueIndex()+1) == KErrNone)
       
   565                     {
       
   566                     iAttributes.iAmountDes.AppendNum(volumeInfo.iFree);
       
   567                     }
       
   568                 else
       
   569                     {
       
   570                     iAttributes.iAmountDes.AppendNum(0);
       
   571                     }
       
   572                 }
       
   573 
       
   574             edAmount->SetTextL(&iAttributes.iAmountDes);
       
   575             }        
       
   576         }
       
   577     }
       
   578         
       
   579 // --------------------------------------------------------------------------------------------
       
   580 
       
   581 void CLoadGenMemoryEatEditor::HandleControlStateChangeL(TInt aControlId)
       
   582     {
       
   583     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(aControlId);
       
   584     
       
   585     // update visibilities of fields    
       
   586     if (aControlId == ELoadGenMemoryEatQueryType)
       
   587         {
       
   588         UpdateVisibilitiesOfFieldsL();
       
   589         }
       
   590     
       
   591     // update memory when source changes
       
   592     else if (aControlId == ELoadGenMemoryEatQuerySource)
       
   593         {
       
   594         UpdateAvailableMemoryL();
       
   595         }
       
   596     }
       
   597     
       
   598 // --------------------------------------------------------------------------------------------
       
   599 
       
   600 TBool CLoadGenMemoryEatEditor::RunQueryLD()
       
   601     {
       
   602     return CLoadGenLoadTypeEditorBase::DoRunQueryLD(R_MEMORYEAT_FORM_DIALOG);
       
   603     }
       
   604 
       
   605 
       
   606 // --------------------------------------------------------------------------------------------
       
   607 // --------------------------------------------------------------------------------------------
       
   608 
       
   609 CLoadGenPhoneCallEditor* CLoadGenPhoneCallEditor::NewL(TPhoneCallAttributes& aAttributes, TBool aEditingExisting)
       
   610     {
       
   611     CLoadGenPhoneCallEditor* self = new(ELeave) CLoadGenPhoneCallEditor(aAttributes, aEditingExisting);
       
   612     CleanupStack::PushL(self);
       
   613     self->ConstructL();
       
   614     CleanupStack::Pop(self);
       
   615     return self;    
       
   616     }
       
   617 
       
   618 // --------------------------------------------------------------------------------------------
       
   619 
       
   620 CLoadGenPhoneCallEditor::~CLoadGenPhoneCallEditor()
       
   621     {
       
   622     }
       
   623 
       
   624 // --------------------------------------------------------------------------------------------
       
   625 
       
   626 CLoadGenPhoneCallEditor::CLoadGenPhoneCallEditor(TPhoneCallAttributes& aAttributes, TBool aEditingExisting) :
       
   627     CLoadGenLoadTypeEditorBase(aEditingExisting), iAttributes(aAttributes)
       
   628     {
       
   629     }
       
   630 
       
   631 // --------------------------------------------------------------------------------------------
       
   632 
       
   633 void CLoadGenPhoneCallEditor::ConstructL()
       
   634     {
       
   635     CLoadGenLoadTypeEditorBase::ConstructL(_L("Phone calls"));
       
   636     }
       
   637 
       
   638 // --------------------------------------------------------------------------------------------
       
   639 
       
   640 void CLoadGenPhoneCallEditor::PreLayoutDynInitL()
       
   641     {
       
   642     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
   643     
       
   644     // load values to static editors
       
   645     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenPhoneCallQueryPriority));
       
   646     CEikEdwin* edDestination = static_cast<CEikEdwin*>(Control(ELoadGenPhoneCallQueryDestination));
       
   647     CEikNumberEditor* edLength = static_cast<CEikNumberEditor*>(Control(ELoadGenPhoneCallQueryLength));
       
   648     CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenPhoneCallQueryIdle));
       
   649     CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenPhoneCallQueryVariance));
       
   650 
       
   651     edPriority->SetCurrentValueIndex(iAttributes.iPriority);
       
   652     edDestination->SetTextL(&iAttributes.iDestination);   
       
   653     edLength->SetNumber(iAttributes.iLength);   
       
   654     edIdle->SetNumber(iAttributes.iIdle);   
       
   655     edVariance->SetNumber(iAttributes.iRandomVariance);   
       
   656     
       
   657     UpdateVisibilitiesOfFieldsL(ETrue);
       
   658     }
       
   659 
       
   660 // --------------------------------------------------------------------------------------------
       
   661 
       
   662 TBool CLoadGenPhoneCallEditor::OkToExitL(TInt aButtonId)
       
   663     {
       
   664     if (aButtonId == EAknSoftkeyOk)
       
   665         {
       
   666         // store values from editors
       
   667         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenPhoneCallQueryPriority));
       
   668         CEikEdwin* edDestination = static_cast<CEikEdwin*>(Control(ELoadGenPhoneCallQueryDestination));
       
   669         CEikNumberEditor* edLength = static_cast<CEikNumberEditor*>(Control(ELoadGenPhoneCallQueryLength));
       
   670         CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenPhoneCallQueryIdle));
       
   671         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenPhoneCallQueryVariance));
       
   672 
       
   673         iAttributes.iPriority = edPriority->CurrentValueIndex();
       
   674         edDestination->GetText(iAttributes.iDestination);
       
   675         iAttributes.iLength = edLength->Number();
       
   676         iAttributes.iIdle = edIdle->Number();
       
   677         iAttributes.iRandomVariance = edVariance->Number();
       
   678         }
       
   679     
       
   680     return ETrue;
       
   681     }       
       
   682 
       
   683 // --------------------------------------------------------------------------------------------
       
   684 
       
   685 void CLoadGenPhoneCallEditor::UpdateVisibilitiesOfFieldsL(TBool /*aFormInit*/)
       
   686     {
       
   687     UpdateFormL();
       
   688     }
       
   689 
       
   690 // --------------------------------------------------------------------------------------------
       
   691 
       
   692 void CLoadGenPhoneCallEditor::HandleControlStateChangeL(TInt aControlId)
       
   693     {
       
   694     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(aControlId);
       
   695     }
       
   696     
       
   697 // --------------------------------------------------------------------------------------------
       
   698 
       
   699 TBool CLoadGenPhoneCallEditor::RunQueryLD()
       
   700     {
       
   701     return CLoadGenLoadTypeEditorBase::DoRunQueryLD(R_PHONECALL_FORM_DIALOG);
       
   702     }
       
   703 
       
   704 // --------------------------------------------------------------------------------------------
       
   705 // --------------------------------------------------------------------------------------------
       
   706 
       
   707 CLoadGenNetConnEditor* CLoadGenNetConnEditor::NewL(TNetConnAttributes& aAttributes, TBool aEditingExisting)
       
   708     {
       
   709     CLoadGenNetConnEditor* self = new(ELeave) CLoadGenNetConnEditor(aAttributes, aEditingExisting);
       
   710     CleanupStack::PushL(self);
       
   711     self->ConstructL();
       
   712     CleanupStack::Pop(self);
       
   713     return self;    
       
   714     }
       
   715 
       
   716 // --------------------------------------------------------------------------------------------
       
   717 
       
   718 CLoadGenNetConnEditor::~CLoadGenNetConnEditor()
       
   719     {
       
   720     }
       
   721 
       
   722 // --------------------------------------------------------------------------------------------
       
   723 
       
   724 CLoadGenNetConnEditor::CLoadGenNetConnEditor(TNetConnAttributes& aAttributes, TBool aEditingExisting) :
       
   725     CLoadGenLoadTypeEditorBase(aEditingExisting), iAttributes(aAttributes)
       
   726     {
       
   727     }
       
   728 
       
   729 // --------------------------------------------------------------------------------------------
       
   730 
       
   731 void CLoadGenNetConnEditor::ConstructL()
       
   732     {
       
   733     CLoadGenLoadTypeEditorBase::ConstructL(_L("Network conn."));
       
   734     }
       
   735 
       
   736 // --------------------------------------------------------------------------------------------
       
   737 
       
   738 void CLoadGenNetConnEditor::PreLayoutDynInitL()
       
   739     {
       
   740     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
   741     
       
   742     // load values to static editors
       
   743     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenNetConnQueryPriority));
       
   744     CEikEdwin* edDestination = static_cast<CEikEdwin*>(Control(ELoadGenNetConnQueryDestination));
       
   745     CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenNetConnQueryIdle));
       
   746     CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenNetConnQueryVariance));
       
   747 
       
   748     edPriority->SetCurrentValueIndex(iAttributes.iPriority);
       
   749     edDestination->SetTextL(&iAttributes.iDestination);   
       
   750     edIdle->SetNumber(iAttributes.iIdle);   
       
   751     edVariance->SetNumber(iAttributes.iRandomVariance);
       
   752        
       
   753     UpdateVisibilitiesOfFieldsL(ETrue);
       
   754     }
       
   755 
       
   756 // --------------------------------------------------------------------------------------------
       
   757 
       
   758 TBool CLoadGenNetConnEditor::OkToExitL(TInt aButtonId)
       
   759     {
       
   760     if (aButtonId == EAknSoftkeyOk)
       
   761         {
       
   762         // store values from editors
       
   763         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenNetConnQueryPriority));
       
   764         CEikEdwin* edDestination = static_cast<CEikEdwin*>(Control(ELoadGenNetConnQueryDestination));
       
   765         CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenNetConnQueryIdle));
       
   766         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenNetConnQueryVariance));
       
   767 
       
   768         iAttributes.iPriority = edPriority->CurrentValueIndex();
       
   769         edDestination->GetText(iAttributes.iDestination);
       
   770         iAttributes.iIdle = edIdle->Number();
       
   771         iAttributes.iRandomVariance = edVariance->Number();
       
   772         }
       
   773     
       
   774     return ETrue;
       
   775     }       
       
   776 
       
   777 // --------------------------------------------------------------------------------------------
       
   778 
       
   779 void CLoadGenNetConnEditor::UpdateVisibilitiesOfFieldsL(TBool /*aFormInit*/)
       
   780     {
       
   781     UpdateFormL();
       
   782     }
       
   783 
       
   784 // --------------------------------------------------------------------------------------------
       
   785 
       
   786 void CLoadGenNetConnEditor::HandleControlStateChangeL(TInt aControlId)
       
   787     {
       
   788     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(aControlId);
       
   789     }
       
   790     
       
   791 // --------------------------------------------------------------------------------------------
       
   792 
       
   793 TBool CLoadGenNetConnEditor::RunQueryLD()
       
   794     {
       
   795     return CLoadGenLoadTypeEditorBase::DoRunQueryLD(R_NETCONN_FORM_DIALOG);
       
   796     }
       
   797 
       
   798 // --------------------------------------------------------------------------------------------
       
   799        
       
   800 // --------------------------------------------------------------------------------------------
       
   801 // --------------------------------------------------------------------------------------------
       
   802 
       
   803 CLoadGenKeyPressEditor* CLoadGenKeyPressEditor::NewL(TKeyPressAttributes& aAttributes, TBool aEditingExisting)
       
   804     {
       
   805     CLoadGenKeyPressEditor* self = new(ELeave) CLoadGenKeyPressEditor(aAttributes, aEditingExisting);
       
   806     CleanupStack::PushL(self);
       
   807     self->ConstructL();
       
   808     CleanupStack::Pop(self);
       
   809     return self;
       
   810     }
       
   811 
       
   812 // --------------------------------------------------------------------------------------------
       
   813 
       
   814 CLoadGenKeyPressEditor::~CLoadGenKeyPressEditor()
       
   815     {
       
   816     }
       
   817 
       
   818 // --------------------------------------------------------------------------------------------
       
   819 
       
   820 CLoadGenKeyPressEditor::CLoadGenKeyPressEditor(TKeyPressAttributes& aAttributes, TBool aEditingExisting) :
       
   821     CLoadGenLoadTypeEditorBase(aEditingExisting), iAttributes(aAttributes)
       
   822     {
       
   823     }
       
   824 
       
   825 // --------------------------------------------------------------------------------------------
       
   826 
       
   827 void CLoadGenKeyPressEditor::ConstructL()
       
   828     {
       
   829     CLoadGenLoadTypeEditorBase::ConstructL(_L("Key presses"));
       
   830     }
       
   831 
       
   832 // --------------------------------------------------------------------------------------------
       
   833 
       
   834 void CLoadGenKeyPressEditor::PreLayoutDynInitL()
       
   835     {
       
   836     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
   837 
       
   838     // load values to static editors
       
   839     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenKeyPressQueryPriority));
       
   840     CEikNumberEditor* edHeartBeat = static_cast<CEikNumberEditor*>(Control(ELoadGenKeyPressQueryHeartBeat));
       
   841     CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenKeyPressQueryVariance));
       
   842 
       
   843     edPriority->SetCurrentValueIndex(iAttributes.iPriority);
       
   844     edHeartBeat->SetNumber(iAttributes.iHeartBeat);
       
   845     edVariance->SetNumber(iAttributes.iRandomVariance);
       
   846 
       
   847     UpdateVisibilitiesOfFieldsL(ETrue);
       
   848     }
       
   849 
       
   850 // --------------------------------------------------------------------------------------------
       
   851 
       
   852 TBool CLoadGenKeyPressEditor::OkToExitL(TInt aButtonId)
       
   853     {
       
   854     if (aButtonId == EAknSoftkeyOk)
       
   855         {
       
   856         // store values from editors
       
   857         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenKeyPressQueryPriority));
       
   858         CEikNumberEditor* edHeartBeat = static_cast<CEikNumberEditor*>(Control(ELoadGenKeyPressQueryHeartBeat));
       
   859         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenKeyPressQueryVariance));
       
   860 
       
   861         iAttributes.iPriority = edPriority->CurrentValueIndex();
       
   862         iAttributes.iHeartBeat = edHeartBeat->Number();
       
   863         iAttributes.iRandomVariance = edVariance->Number();
       
   864         }
       
   865     
       
   866     return ETrue;
       
   867     }       
       
   868 
       
   869 // --------------------------------------------------------------------------------------------
       
   870 
       
   871 void CLoadGenKeyPressEditor::UpdateVisibilitiesOfFieldsL(TBool /*aFormInit*/)
       
   872     {
       
   873     UpdateFormL();
       
   874     }
       
   875 
       
   876 // --------------------------------------------------------------------------------------------
       
   877 
       
   878 void CLoadGenKeyPressEditor::HandleControlStateChangeL(TInt aControlId)
       
   879     {
       
   880     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(aControlId);
       
   881     }
       
   882     
       
   883 // --------------------------------------------------------------------------------------------
       
   884 
       
   885 TBool CLoadGenKeyPressEditor::RunQueryLD()
       
   886     {
       
   887     return CLoadGenLoadTypeEditorBase::DoRunQueryLD(R_KEYPRESS_FORM_DIALOG);
       
   888     }
       
   889 
       
   890 // --------------------------------------------------------------------------------------------
       
   891 // --------------------------------------------------------------------------------------------
       
   892 
       
   893 CLoadGenMessagesEditor* CLoadGenMessagesEditor::NewL( TMessageAttributes& aAttributes, 
       
   894                                                       TBool aEditingExisting )
       
   895     {
       
   896     CLoadGenMessagesEditor* self = new(ELeave) CLoadGenMessagesEditor( aAttributes, 
       
   897                                                                         aEditingExisting );
       
   898     CleanupStack::PushL( self );
       
   899     self->ConstructL();
       
   900     CleanupStack::Pop( self );
       
   901     return self;    
       
   902     }
       
   903 
       
   904 // --------------------------------------------------------------------------------------------
       
   905 
       
   906 CLoadGenMessagesEditor::~CLoadGenMessagesEditor()
       
   907     {
       
   908     }
       
   909 
       
   910 // --------------------------------------------------------------------------------------------
       
   911 
       
   912 CLoadGenMessagesEditor::CLoadGenMessagesEditor( TMessageAttributes& aAttributes, 
       
   913                                                 TBool aEditingExisting ) :
       
   914                                             CLoadGenLoadTypeEditorBase( aEditingExisting ), 
       
   915                                             iAttributes( aAttributes )
       
   916     {
       
   917     }
       
   918 
       
   919 // --------------------------------------------------------------------------------------------
       
   920 
       
   921 void CLoadGenMessagesEditor::ConstructL()
       
   922     {
       
   923     CLoadGenLoadTypeEditorBase::ConstructL( _L("Messages") );
       
   924     }
       
   925 
       
   926 // --------------------------------------------------------------------------------------------
       
   927 
       
   928 void CLoadGenMessagesEditor::PreLayoutDynInitL()
       
   929     {
       
   930     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
   931     
       
   932     // load values to static editors
       
   933     CAknPopupFieldText* edPriority = 
       
   934                     static_cast<CAknPopupFieldText*>( Control( ELoadGenMessagesQueryPriority ) );
       
   935     CAknPopupFieldText* edType = 
       
   936                     static_cast<CAknPopupFieldText*>( Control( ELoadGenMessagesQueryType ) );                    
       
   937     CEikEdwin* edDestination = 
       
   938                     static_cast<CEikEdwin*>( Control( ELoadGenMessagesQueryDestination ) );
       
   939     CEikNumberEditor* edAmount = 
       
   940                     static_cast<CEikNumberEditor*>( Control( ELoadGenMessagesQueryAmount ) );                
       
   941     CEikNumberEditor* edLength = 
       
   942                     static_cast<CEikNumberEditor*>( Control( ELoadGenMessagesQueryLength ) );
       
   943     CEikNumberEditor* edIdle = 
       
   944                     static_cast<CEikNumberEditor*>( Control( ELoadGenMessagesQueryIdle ) );
       
   945     CEikNumberEditor* edVariance = 
       
   946                     static_cast<CEikNumberEditor*>( Control( ELoadGenMessagesQueryVariance ) );
       
   947 
       
   948     edPriority->SetCurrentValueIndex( iAttributes.iPriority );
       
   949     edType->SetCurrentValueIndex( iAttributes.iMessageType );
       
   950     edDestination->SetTextL( &iAttributes.iDestination );
       
   951     edAmount->SetNumber( iAttributes.iAmount );
       
   952     edLength->SetNumber( iAttributes.iLength );   
       
   953     edIdle->SetNumber( iAttributes.iIdle );   
       
   954     edVariance->SetNumber( iAttributes.iRandomVariance );   
       
   955        
       
   956     UpdateVisibilitiesOfFieldsL( ETrue );
       
   957     // set type selection as dimmed if editing existing item
       
   958     if (iEditingExisting)
       
   959         {
       
   960         SetLineDimmedNow(ELoadGenMessagesQueryType, ETrue); 
       
   961         }
       
   962     
       
   963     }
       
   964 
       
   965 // --------------------------------------------------------------------------------------------
       
   966 
       
   967 TBool CLoadGenMessagesEditor::OkToExitL( TInt aButtonId )
       
   968     {
       
   969     if ( aButtonId == EAknSoftkeyOk )
       
   970         {
       
   971         // store values from editors
       
   972         CAknPopupFieldText* edPriority = 
       
   973                 static_cast<CAknPopupFieldText*>( Control( ELoadGenMessagesQueryPriority ) );
       
   974         CAknPopupFieldText* edType = 
       
   975                 static_cast<CAknPopupFieldText*>( Control( ELoadGenMessagesQueryType ) );                
       
   976         CEikEdwin* edDestination = 
       
   977                 static_cast<CEikEdwin*>( Control( ELoadGenMessagesQueryDestination ) );
       
   978         CEikNumberEditor* edLength = 
       
   979                 static_cast<CEikNumberEditor*>( Control( ELoadGenMessagesQueryLength ) );
       
   980         CEikNumberEditor* edAmount = 
       
   981                 static_cast<CEikNumberEditor*>( Control( ELoadGenMessagesQueryAmount ) );                
       
   982         CEikNumberEditor* edIdle = 
       
   983                 static_cast<CEikNumberEditor*>( Control( ELoadGenMessagesQueryIdle ) );
       
   984         CEikNumberEditor* edVariance =
       
   985                 static_cast<CEikNumberEditor*>( Control( ELoadGenMessagesQueryVariance ) );
       
   986 
       
   987         iAttributes.iPriority = edPriority->CurrentValueIndex();
       
   988         iAttributes.iMessageType = edType->CurrentValueIndex();
       
   989         edDestination->GetText( iAttributes.iDestination );
       
   990         iAttributes.iAmount = edAmount->Number();
       
   991         iAttributes.iLength = edLength->Number();
       
   992         iAttributes.iIdle = edIdle->Number();
       
   993         iAttributes.iRandomVariance = edVariance->Number();
       
   994         }
       
   995     
       
   996     return ETrue;
       
   997     }       
       
   998 
       
   999 // --------------------------------------------------------------------------------------------
       
  1000 
       
  1001 void CLoadGenMessagesEditor::UpdateVisibilitiesOfFieldsL( TBool /*aFormInit*/ )
       
  1002     {
       
  1003     UpdateFormL();
       
  1004     }
       
  1005 
       
  1006 // --------------------------------------------------------------------------------------------
       
  1007 
       
  1008 void CLoadGenMessagesEditor::HandleControlStateChangeL( TInt aControlId )
       
  1009     {
       
  1010     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL( aControlId );
       
  1011     }
       
  1012     
       
  1013 // --------------------------------------------------------------------------------------------
       
  1014 
       
  1015 TBool CLoadGenMessagesEditor::RunQueryLD()
       
  1016     {
       
  1017     return CLoadGenLoadTypeEditorBase::DoRunQueryLD( R_MESSAGES_FORM_DIALOG );
       
  1018     }
       
  1019 
       
  1020 // --------------------------------------------------------------------------------------------
       
  1021 // --------------------------------------------------------------------------------------------
       
  1022 
       
  1023 CLoadGenApplicationsEditor* CLoadGenApplicationsEditor::NewL( TApplicationsAttributes& aAttributes, 
       
  1024                                                       TBool aEditingExisting )
       
  1025     {
       
  1026     CLoadGenApplicationsEditor* self = new(ELeave) CLoadGenApplicationsEditor( aAttributes, 
       
  1027                                                                         aEditingExisting );
       
  1028     CleanupStack::PushL( self );
       
  1029     self->ConstructL();
       
  1030     CleanupStack::Pop( self );
       
  1031     return self;    
       
  1032     }
       
  1033 
       
  1034 // --------------------------------------------------------------------------------------------
       
  1035 
       
  1036 CLoadGenApplicationsEditor::~CLoadGenApplicationsEditor()
       
  1037     {
       
  1038     }
       
  1039 
       
  1040 // --------------------------------------------------------------------------------------------
       
  1041 
       
  1042 CLoadGenApplicationsEditor::CLoadGenApplicationsEditor( TApplicationsAttributes& aAttributes, 
       
  1043                                                 TBool aEditingExisting ) :
       
  1044                                             CLoadGenLoadTypeEditorBase( aEditingExisting ), 
       
  1045                                             iAttributes( aAttributes )
       
  1046     {
       
  1047     }
       
  1048 
       
  1049 // --------------------------------------------------------------------------------------------
       
  1050 
       
  1051 void CLoadGenApplicationsEditor::ConstructL()
       
  1052     {
       
  1053     CLoadGenLoadTypeEditorBase::ConstructL( _L("Applications") );
       
  1054     }
       
  1055 
       
  1056 // --------------------------------------------------------------------------------------------
       
  1057 
       
  1058 void CLoadGenApplicationsEditor::PreLayoutDynInitL()
       
  1059     {
       
  1060     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
  1061 
       
  1062     // load values to static editors
       
  1063     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenApplicationsQueryPriority));
       
  1064     CEikNumberEditor* edLaunchingInterval = static_cast<CEikNumberEditor*>(Control(ELoadGenApplicationsLaunchingInterval));
       
  1065     CAknPopupFieldText* edKeyPressType = static_cast<CAknPopupFieldText*>(Control(ELoadGenApplicationsKeyPressType));
       
  1066     CEikNumberEditor* edMaxOpen = static_cast<CEikNumberEditor*>(Control(ELoadGenApplicationsMaxOpen));
       
  1067     CEikNumberEditor* edHeartBeat = static_cast<CEikNumberEditor*>(Control(ELoadGenApplicationsKeyPressQueryHeartBeat));
       
  1068     CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenApplicationsQueryVariance));
       
  1069 
       
  1070     edPriority->SetCurrentValueIndex( iAttributes.iPriority );
       
  1071     edLaunchingInterval->SetNumber( iAttributes.iLaunchingInterval );
       
  1072     edKeyPressType->SetCurrentValueIndex( iAttributes.iKeyPressType );
       
  1073     edMaxOpen->SetNumber( iAttributes.iMaxOpen );
       
  1074     edHeartBeat->SetNumber( iAttributes.iHeartBeat );
       
  1075     edVariance->SetNumber( iAttributes.iRandomVariance );
       
  1076 
       
  1077     UpdateVisibilitiesOfFieldsL(ETrue);
       
  1078     }
       
  1079 
       
  1080 // --------------------------------------------------------------------------------------------
       
  1081 
       
  1082 TBool CLoadGenApplicationsEditor::OkToExitL(TInt aButtonId)
       
  1083     {
       
  1084     if (aButtonId == EAknSoftkeyOk)
       
  1085         {
       
  1086         // store values from editors
       
  1087         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenApplicationsQueryPriority));
       
  1088         CEikNumberEditor* edLaunchingInterval = static_cast<CEikNumberEditor*>(Control(ELoadGenApplicationsLaunchingInterval));
       
  1089         CAknPopupFieldText* edKeyPressType = static_cast<CAknPopupFieldText*>(Control(ELoadGenApplicationsKeyPressType));
       
  1090         CEikNumberEditor* edMaxOpen = static_cast<CEikNumberEditor*>(Control(ELoadGenApplicationsMaxOpen));
       
  1091         CEikNumberEditor* edHeartBeat = static_cast<CEikNumberEditor*>(Control(ELoadGenApplicationsKeyPressQueryHeartBeat));
       
  1092         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenApplicationsQueryVariance));
       
  1093 
       
  1094         iAttributes.iPriority = edPriority->CurrentValueIndex();
       
  1095         iAttributes.iLaunchingInterval = edLaunchingInterval->Number();
       
  1096         iAttributes.iKeyPressType = edKeyPressType->CurrentValueIndex();
       
  1097         iAttributes.iMaxOpen = edMaxOpen->Number();
       
  1098         iAttributes.iHeartBeat = edHeartBeat->Number();
       
  1099         iAttributes.iRandomVariance = edVariance->Number();
       
  1100         }
       
  1101     
       
  1102     return ETrue;
       
  1103     }       
       
  1104     
       
  1105 // --------------------------------------------------------------------------------------------
       
  1106 
       
  1107 void CLoadGenApplicationsEditor::UpdateVisibilitiesOfFieldsL( TBool /*aFormInit*/ )
       
  1108     {
       
  1109     UpdateFormL();
       
  1110     }
       
  1111 
       
  1112 // --------------------------------------------------------------------------------------------
       
  1113 
       
  1114 void CLoadGenApplicationsEditor::HandleControlStateChangeL( TInt aControlId )
       
  1115     {
       
  1116     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL( aControlId );
       
  1117     }
       
  1118     
       
  1119 // --------------------------------------------------------------------------------------------
       
  1120 
       
  1121 TBool CLoadGenApplicationsEditor::RunQueryLD()
       
  1122     {
       
  1123     return CLoadGenLoadTypeEditorBase::DoRunQueryLD( R_APPLICATIONS_FORM_DIALOG );
       
  1124     }
       
  1125 
       
  1126 // --------------------------------------------------------------------------------------------
       
  1127 
       
  1128 // --------------------------------------------------------------------------------------------
       
  1129 
       
  1130 CLoadGenPhotoCaptureEditor* CLoadGenPhotoCaptureEditor::NewL(TPhotoCaptureAttributes& aAttributes, TBool aEditingExisting)
       
  1131     {
       
  1132     CLoadGenPhotoCaptureEditor* self = new(ELeave) CLoadGenPhotoCaptureEditor(aAttributes, aEditingExisting);
       
  1133     CleanupStack::PushL(self);
       
  1134     self->ConstructL();
       
  1135     CleanupStack::Pop(self);
       
  1136     return self;    
       
  1137     }
       
  1138 
       
  1139 // --------------------------------------------------------------------------------------------
       
  1140 
       
  1141 CLoadGenPhotoCaptureEditor::~CLoadGenPhotoCaptureEditor()
       
  1142     {
       
  1143     }
       
  1144 
       
  1145 // --------------------------------------------------------------------------------------------
       
  1146 
       
  1147 CLoadGenPhotoCaptureEditor::CLoadGenPhotoCaptureEditor(TPhotoCaptureAttributes& aAttributes, TBool aEditingExisting) :
       
  1148     CLoadGenLoadTypeEditorBase(aEditingExisting), iAttributes(aAttributes)
       
  1149     {
       
  1150     }
       
  1151 
       
  1152 // --------------------------------------------------------------------------------------------
       
  1153 
       
  1154 void CLoadGenPhotoCaptureEditor::ConstructL()
       
  1155     {
       
  1156     CLoadGenLoadTypeEditorBase::ConstructL(_L("Photo captures"));
       
  1157     }
       
  1158 
       
  1159 // --------------------------------------------------------------------------------------------
       
  1160 
       
  1161 void CLoadGenPhotoCaptureEditor::PreLayoutDynInitL()
       
  1162     {
       
  1163     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
  1164     
       
  1165     // load values to static editors
       
  1166     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenPhotoCaptureQueryPriority));
       
  1167     //CAknPopupFieldText* edDevice = static_cast<CAknPopupFieldText*>(Control(ELoadGenPhotoCaptureQueryDevice));    
       
  1168     CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenPhotoCaptureQueryIdle));
       
  1169     CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenPhotoCaptureQueryVariance));
       
  1170 
       
  1171     edPriority->SetCurrentValueIndex(iAttributes.iPriority);
       
  1172     //edDevice->SetCurrentValueIndex(0);
       
  1173     edIdle->SetNumber(iAttributes.iIdle);   
       
  1174     edVariance->SetNumber(iAttributes.iRandomVariance);
       
  1175     
       
  1176     LoadCamerasL();
       
  1177     
       
  1178     UpdateVisibilitiesOfFieldsL(ETrue);
       
  1179     }
       
  1180 
       
  1181 void CLoadGenPhotoCaptureEditor::LoadCamerasL()
       
  1182     {    
       
  1183     if (iAttributes.iCameraCount > 0)
       
  1184         {
       
  1185         // insert possibility to select which cpu the load is generated to
       
  1186         InsertFieldAfterL(R_PHOTOCAPTURE_DLG_LINE_DEVICE, ELoadGenPhotoCaptureQueryDevice, ELoadGenPhotoCaptureQueryPriority);
       
  1187         
       
  1188         iCamerasArray = new (ELeave) CDesCArrayFlat( iAttributes.iCameraCount );   
       
  1189         
       
  1190         // add Cameras
       
  1191         for (int i = 0; i < iAttributes.iCameraCount; i++) 
       
  1192             {
       
  1193             TBuf<16> cam;
       
  1194             _LIT(KCam, "Camera %d");
       
  1195             cam.Format(KCam, i);
       
  1196             iCamerasArray->AppendL(cam);
       
  1197             }    
       
  1198        
       
  1199         iCameraTextArray = CAknQueryValueTextArray::NewL();
       
  1200         iCameraTextArray->SetArray( *iCamerasArray );  
       
  1201         iCameraQueryValText = CAknQueryValueText::NewL();    
       
  1202         iCameraQueryValText->SetArrayL( iCameraTextArray );
       
  1203         if( iAttributes.iCameraCount > 0 )
       
  1204             {
       
  1205             iCameraQueryValText->SetCurrentValueIndex(iAttributes.iCamera);
       
  1206             }
       
  1207         CAknPopupField* popup = static_cast<CAknPopupField*>(Control( ELoadGenPhotoCaptureQueryDevice)); 
       
  1208         popup->SetQueryValueL( iCameraQueryValText );        
       
  1209         }    
       
  1210     }
       
  1211 
       
  1212 // --------------------------------------------------------------------------------------------
       
  1213 
       
  1214 TBool CLoadGenPhotoCaptureEditor::OkToExitL(TInt aButtonId)
       
  1215     {
       
  1216     if (aButtonId == EAknSoftkeyOk)
       
  1217         {
       
  1218         // store values from editors
       
  1219         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenPhotoCaptureQueryPriority));        
       
  1220         CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenPhotoCaptureQueryIdle));
       
  1221         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenPhotoCaptureQueryVariance));
       
  1222 
       
  1223         iAttributes.iPriority = edPriority->CurrentValueIndex();        
       
  1224         iAttributes.iIdle = edIdle->Number();
       
  1225         iAttributes.iRandomVariance = edVariance->Number();
       
  1226         
       
  1227         if (iAttributes.iCameraCount > 1)
       
  1228             {
       
  1229             iAttributes.iCamera = iCameraQueryValText->CurrentValueIndex();
       
  1230             }
       
  1231         }
       
  1232     
       
  1233     return ETrue;
       
  1234     }       
       
  1235 
       
  1236 // --------------------------------------------------------------------------------------------
       
  1237 
       
  1238 void CLoadGenPhotoCaptureEditor::UpdateVisibilitiesOfFieldsL(TBool /*aFormInit*/)
       
  1239     {
       
  1240     UpdateFormL();
       
  1241     }
       
  1242 
       
  1243 // --------------------------------------------------------------------------------------------
       
  1244 
       
  1245 void CLoadGenPhotoCaptureEditor::HandleControlStateChangeL(TInt aControlId)
       
  1246     {
       
  1247     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(aControlId);
       
  1248     }
       
  1249     
       
  1250 // --------------------------------------------------------------------------------------------
       
  1251 
       
  1252 TBool CLoadGenPhotoCaptureEditor::RunQueryLD()
       
  1253     {
       
  1254     return CLoadGenLoadTypeEditorBase::DoRunQueryLD(R_PHOTOCAPTURE_FORM_DIALOG);
       
  1255     }
       
  1256 
       
  1257 
       
  1258 // --------------------------------------------------------------------------------------------
       
  1259 
       
  1260 CLoadGenBluetoothEditor* CLoadGenBluetoothEditor::NewL(TBluetoothAttributes& aAttributes, TBool aEditingExisting)
       
  1261     {
       
  1262     CLoadGenBluetoothEditor* self = new(ELeave) CLoadGenBluetoothEditor(aAttributes, aEditingExisting);
       
  1263     CleanupStack::PushL(self);
       
  1264     self->ConstructL();
       
  1265     CleanupStack::Pop(self);
       
  1266     return self;    
       
  1267     }
       
  1268 
       
  1269 // --------------------------------------------------------------------------------------------
       
  1270 
       
  1271 CLoadGenBluetoothEditor::~CLoadGenBluetoothEditor()
       
  1272     {
       
  1273     }
       
  1274 
       
  1275 // --------------------------------------------------------------------------------------------
       
  1276 
       
  1277 CLoadGenBluetoothEditor::CLoadGenBluetoothEditor(TBluetoothAttributes& aAttributes, TBool aEditingExisting) :
       
  1278     CLoadGenLoadTypeEditorBase(aEditingExisting), iAttributes(aAttributes)
       
  1279     {
       
  1280     }
       
  1281 
       
  1282 // --------------------------------------------------------------------------------------------
       
  1283 
       
  1284 void CLoadGenBluetoothEditor::ConstructL()
       
  1285     {
       
  1286     CLoadGenLoadTypeEditorBase::ConstructL(_L("Bluetooth"));
       
  1287     }
       
  1288 
       
  1289 // --------------------------------------------------------------------------------------------
       
  1290 
       
  1291 void CLoadGenBluetoothEditor::PreLayoutDynInitL()
       
  1292     {
       
  1293     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
  1294     
       
  1295     // load values to static editors
       
  1296     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenBluetoothQueryPriority));        
       
  1297     CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenBluetoothQueryIdle));
       
  1298     CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenBluetoothQueryVariance));
       
  1299 
       
  1300     edPriority->SetCurrentValueIndex(iAttributes.iPriority);    
       
  1301     edIdle->SetNumber(iAttributes.iIdle);   
       
  1302     edVariance->SetNumber(iAttributes.iRandomVariance);
       
  1303         
       
  1304     UpdateVisibilitiesOfFieldsL(ETrue);
       
  1305     }
       
  1306 
       
  1307 // --------------------------------------------------------------------------------------------
       
  1308 
       
  1309 TBool CLoadGenBluetoothEditor::OkToExitL(TInt aButtonId)
       
  1310     {
       
  1311     if (aButtonId == EAknSoftkeyOk)
       
  1312         {
       
  1313         // store values from editors
       
  1314         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenBluetoothQueryPriority));        
       
  1315         CEikNumberEditor* edIdle = static_cast<CEikNumberEditor*>(Control(ELoadGenBluetoothQueryIdle));
       
  1316         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenBluetoothQueryVariance));
       
  1317 
       
  1318         iAttributes.iPriority = edPriority->CurrentValueIndex();        
       
  1319         iAttributes.iIdle = edIdle->Number();
       
  1320         iAttributes.iRandomVariance = edVariance->Number();                
       
  1321         }
       
  1322     
       
  1323     return ETrue;
       
  1324     }       
       
  1325 
       
  1326 // --------------------------------------------------------------------------------------------
       
  1327 
       
  1328 void CLoadGenBluetoothEditor::UpdateVisibilitiesOfFieldsL(TBool /*aFormInit*/)
       
  1329     {
       
  1330     UpdateFormL();
       
  1331     }
       
  1332 
       
  1333 // --------------------------------------------------------------------------------------------
       
  1334 
       
  1335 void CLoadGenBluetoothEditor::HandleControlStateChangeL(TInt aControlId)
       
  1336     {
       
  1337     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(aControlId);
       
  1338     }
       
  1339     
       
  1340 // --------------------------------------------------------------------------------------------
       
  1341 
       
  1342 TBool CLoadGenBluetoothEditor::RunQueryLD()
       
  1343     {
       
  1344     return CLoadGenLoadTypeEditorBase::DoRunQueryLD(R_BLUETOOTH_FORM_DIALOG);
       
  1345     }
       
  1346 
       
  1347 // --------------------------------------------------------------------------------------------
       
  1348 // --------------------------------------------------------------------------------------------
       
  1349 
       
  1350 CLoadGenPointerEventEditor* CLoadGenPointerEventEditor::NewL(TPointerEventAttributes& aAttributes, TBool aEditingExisting)
       
  1351     {
       
  1352     CLoadGenPointerEventEditor* self = new(ELeave) CLoadGenPointerEventEditor(aAttributes, aEditingExisting);
       
  1353     CleanupStack::PushL(self);
       
  1354     self->ConstructL();
       
  1355     CleanupStack::Pop(self);
       
  1356     return self;
       
  1357     }
       
  1358 
       
  1359 // --------------------------------------------------------------------------------------------
       
  1360 
       
  1361 CLoadGenPointerEventEditor::~CLoadGenPointerEventEditor()
       
  1362     {
       
  1363     }
       
  1364 
       
  1365 // --------------------------------------------------------------------------------------------
       
  1366 
       
  1367 CLoadGenPointerEventEditor::CLoadGenPointerEventEditor(TPointerEventAttributes& aAttributes, TBool aEditingExisting) :
       
  1368     CLoadGenLoadTypeEditorBase(aEditingExisting), iAttributes(aAttributes)
       
  1369     {
       
  1370     }
       
  1371 
       
  1372 // --------------------------------------------------------------------------------------------
       
  1373 
       
  1374 void CLoadGenPointerEventEditor::ConstructL()
       
  1375     {
       
  1376     CLoadGenLoadTypeEditorBase::ConstructL(_L("Pointer events"));
       
  1377     }
       
  1378 
       
  1379 // --------------------------------------------------------------------------------------------
       
  1380 
       
  1381 void CLoadGenPointerEventEditor::PreLayoutDynInitL()
       
  1382     {
       
  1383     CLoadGenLoadTypeEditorBase::PreLayoutDynInitL();
       
  1384 
       
  1385     // load values to static editors
       
  1386     CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenPointerEventQueryPriority));
       
  1387     CEikNumberEditor* edHeartBeat = static_cast<CEikNumberEditor*>(Control(ELoadGenPointerEventQueryHeartBeat));
       
  1388     CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenPointerEventQueryVariance));
       
  1389 
       
  1390     edPriority->SetCurrentValueIndex(iAttributes.iPriority);
       
  1391     edHeartBeat->SetNumber(iAttributes.iHeartBeat);
       
  1392     edVariance->SetNumber(iAttributes.iRandomVariance);
       
  1393 
       
  1394     UpdateVisibilitiesOfFieldsL(ETrue);
       
  1395     }
       
  1396 
       
  1397 // --------------------------------------------------------------------------------------------
       
  1398 
       
  1399 TBool CLoadGenPointerEventEditor::OkToExitL(TInt aButtonId)
       
  1400     {
       
  1401     if (aButtonId == EAknSoftkeyOk)
       
  1402         {
       
  1403         // store values from editors
       
  1404         CAknPopupFieldText* edPriority = static_cast<CAknPopupFieldText*>(Control(ELoadGenPointerEventQueryPriority));
       
  1405         CEikNumberEditor* edHeartBeat = static_cast<CEikNumberEditor*>(Control(ELoadGenPointerEventQueryHeartBeat));
       
  1406         CEikNumberEditor* edVariance = static_cast<CEikNumberEditor*>(Control(ELoadGenPointerEventQueryVariance));
       
  1407 
       
  1408         iAttributes.iPriority = edPriority->CurrentValueIndex();
       
  1409         iAttributes.iHeartBeat = edHeartBeat->Number();
       
  1410         iAttributes.iRandomVariance = edVariance->Number();
       
  1411         }
       
  1412     
       
  1413     return ETrue;
       
  1414     }       
       
  1415 
       
  1416 // --------------------------------------------------------------------------------------------
       
  1417 
       
  1418 void CLoadGenPointerEventEditor::UpdateVisibilitiesOfFieldsL(TBool /*aFormInit*/)
       
  1419     {
       
  1420     UpdateFormL();
       
  1421     }
       
  1422 
       
  1423 // --------------------------------------------------------------------------------------------
       
  1424 
       
  1425 void CLoadGenPointerEventEditor::HandleControlStateChangeL(TInt aControlId)
       
  1426     {
       
  1427     CLoadGenLoadTypeEditorBase::HandleControlStateChangeL(aControlId);
       
  1428     }
       
  1429     
       
  1430 // --------------------------------------------------------------------------------------------
       
  1431 
       
  1432 TBool CLoadGenPointerEventEditor::RunQueryLD()
       
  1433     {
       
  1434     return CLoadGenLoadTypeEditorBase::DoRunQueryLD(R_POINTEREVENT_FORM_DIALOG);
       
  1435     }
       
  1436 
       
  1437 // End of File