sdkcreationmw/sdkruntimes/MIDP/DebugAgent/src/JavaDebugAgentSettingsScreen.cpp
author rajpuroh
Mon, 08 Mar 2010 12:09:11 +0530
changeset 0 b26acd06ea60
permissions -rw-r--r--
First Contribution of SDK components
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#include "JavaDebugAgent.hrh"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#include "JavaDebugAgentRes.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
#include "JavaDebugAgentSettings.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
#include "JavaDebugAgentSettingsScreen.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
// ---------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
//
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
//  List box
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
//
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
// ---------------------------------------------------------------------------
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
#define SUPER CAknSettingItemList
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
CJavaDebugAgentSettingsScreen* 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
CJavaDebugAgentSettingsScreen::NewL(CJavaDebugAgentSettings* aSettings, 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
                                    TInt aListResId)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
    CJavaDebugAgentSettingsScreen* self;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
    self = new(ELeave)CJavaDebugAgentSettingsScreen(aSettings);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
    CleanupStack::PushL(self);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
    self->ConstructL(aListResId);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
    CleanupStack::Pop(self);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
    return self;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
CJavaDebugAgentSettingsScreen::CJavaDebugAgentSettingsScreen(
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
    CJavaDebugAgentSettings* aSettings) :
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
    iSettings(aSettings)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
CJavaDebugAgentSettingsScreen::~CJavaDebugAgentSettingsScreen()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
void CJavaDebugAgentSettingsScreen::ConstructL(TInt aListResId)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
    ConstructFromResourceL(aListResId);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
CAknSettingItem* CJavaDebugAgentSettingsScreen::CreateSettingItemL(TInt aSetId)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
    CJavaDebugAgentSettings::TParam* param = iSettings->FindParam(aSetId);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
    if (!param) User::Leave(KErrArgument);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
    CAknSettingItem* item = param->CreateSettingItemL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
    switch (aSetId)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
    case EJavaDebugAgentAutoCleanItem:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
        delete iAutoCleanItem;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
        iAutoCleanItem = (CJavaDebugAgentSettingsBooleanItem*)item;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
        item = iAutoCleanItem;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
    case EJavaDebugAgentFileLogItem:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
        delete iFileLogItem;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
        iFileLogItem = (CJavaDebugAgentSettingsBooleanItem*)item;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
    return item;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    80
TBool CJavaDebugAgentSettingsScreen::ChangeValueL(TInt aSettingId)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    81
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    82
    CJavaDebugAgentSettingsBooleanItem* changeItem = NULL;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    83
    switch (aSettingId)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    84
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    85
    case EJavaDebugAgentAutoCleanItem:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    86
        changeItem = iAutoCleanItem;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    87
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    88
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    89
    case EJavaDebugAgentFileLogItem:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    90
        changeItem = iFileLogItem;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    91
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    92
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    93
    default:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    94
        return EFalse;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    95
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    96
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    97
    changeItem->ChangeValueL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    98
    changeItem->StoreL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    99
    changeItem->LoadL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   100
    changeItem->UpdateListBoxTextL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   101
    ListBox()->DrawDeferred();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   102
    return ETrue;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   103
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   104
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   105
void CJavaDebugAgentSettingsScreen::HandleListBoxEventL(
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   106
    CEikListBox* aListBox, TListBoxEvent aEventType)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   107
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   108
    TInt index;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   109
    switch(aEventType) {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   110
    case EEventEnterKeyPressed:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   111
    case EEventItemDoubleClicked:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   112
        index = aListBox->CurrentItemIndex();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   113
        if (index >= 0 && index < ListBox()->Model()->NumberOfItems())
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   114
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   115
            CAknSettingItem* item = SettingItemArray()->At(index);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   116
            if (ChangeValueL(item->Identifier()))
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   117
            {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   118
                // Event has been handled
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   119
                return;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   120
            }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   121
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   122
        // NO BREAK
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   123
    default:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   124
        SUPER::HandleListBoxEventL(aListBox, aEventType);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   125
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   126
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   127
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   128
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   129
// CCoeControl
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   130
void CJavaDebugAgentSettingsScreen::SizeChanged()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   131
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   132
    ListBox()->SetRect(Rect());
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   133
    SUPER::SizeChanged();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   134
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   135
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   136
/**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   137
 * Local Variables:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   138
 * c-basic-offset: 4
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   139
 * indent-tabs-mode: nil
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   140
 * End:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   141
 */