0
|
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 |
// INCLUDE FILES
|
|
19 |
#include <AknGlobalNote.h>
|
|
20 |
#include <trkapp_200170bb.rsg>
|
|
21 |
|
|
22 |
#include "TrkAppUi.h"
|
|
23 |
#include "TrkSettingsData.h"
|
|
24 |
#include "TrkSettingsList.h"
|
|
25 |
#include "TrkSettingsContainer.h"
|
|
26 |
|
|
27 |
|
|
28 |
// ========================= MEMBER FUNCTIONS ================================
|
|
29 |
|
|
30 |
// ---------------------------------------------------------------------------
|
|
31 |
// CTrkSettingsContainer::CTrkSettingsContainer
|
|
32 |
// C++ constructor
|
|
33 |
// ---------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
CTrkSettingsContainer::CTrkSettingsContainer(CTrkSettingsData* aSettingsData)
|
|
36 |
: iSettingsData(aSettingsData)
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
|
|
41 |
// ---------------------------------------------------------------------------
|
|
42 |
// CTrkSettingsContainer::ConstructL
|
|
43 |
// Symbian OS 2nd phase constructor
|
|
44 |
// ---------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
void CTrkSettingsContainer::ConstructL(const TRect& aRect)
|
|
47 |
{
|
|
48 |
SetRect(aRect);
|
|
49 |
|
|
50 |
iSettingsList = new ( ELeave ) CTrkConnSettingsList(iSettingsData);
|
|
51 |
iSettingsList->SetContainerWindowL(*this);
|
|
52 |
iSettingsList->ConstructFromResourceL(R_TRK_CONNECTION_SETTINGS_LIST);
|
|
53 |
iSettingsList->SetRect(aRect);
|
|
54 |
iSettingsList->ControlStateChangedAfterL(0);
|
|
55 |
}
|
|
56 |
|
|
57 |
|
|
58 |
// Destructor
|
|
59 |
CTrkSettingsContainer::~CTrkSettingsContainer()
|
|
60 |
{
|
|
61 |
delete iSettingsList;
|
|
62 |
}
|
|
63 |
|
|
64 |
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
// CTrkSettingsContainer::CountComponentControls
|
|
67 |
// From CCoeControl return the number of controls owned
|
|
68 |
// ---------------------------------------------------------------------------
|
|
69 |
//
|
|
70 |
TInt CTrkSettingsContainer::CountComponentControls() const
|
|
71 |
{
|
|
72 |
return 1;
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CTrkSettingsContainer::ComponentControl
|
|
78 |
// From CCoeControl returns a control
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
CCoeControl* CTrkSettingsContainer::ComponentControl(TInt /* aIndex */ ) const
|
|
82 |
{
|
|
83 |
return iSettingsList;
|
|
84 |
}
|
|
85 |
|
|
86 |
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
// CTrkSettingsContainer::EditCurrentL
|
|
89 |
// Open setting page for currently selected setting item.
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
//
|
|
92 |
void CTrkSettingsContainer::EditCurrentL()
|
|
93 |
{
|
|
94 |
TInt index = iSettingsList->ListBox()->CurrentItemIndex();
|
|
95 |
|
|
96 |
iSettingsList->EditItemL(index, ETrue);
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
// ---------------------------------------------------------------------------
|
|
101 |
// CTrkSettingsContainer::SaveSettingsL
|
|
102 |
// Save all settings.
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
void CTrkSettingsContainer::SaveSettingsL()
|
|
106 |
{
|
|
107 |
TRAPD(err, iSettingsList->StoreSettingsL());
|
|
108 |
if (!err)
|
|
109 |
{
|
|
110 |
err = iSettingsData->SaveSettings();
|
|
111 |
}
|
|
112 |
|
|
113 |
if (err!= KErrNone)
|
|
114 |
{
|
|
115 |
_LIT(KUnableToSave, "Unable to save the specified settings");
|
|
116 |
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
|
|
117 |
globalNote->ShowNoteL(EAknGlobalErrorNote, KUnableToSave);
|
|
118 |
CleanupStack::PopAndDestroy(globalNote);
|
|
119 |
}
|
|
120 |
}
|
|
121 |
|
|
122 |
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
// CTrkSettingsContainer::OfferKeyEventL
|
|
125 |
// Key event handling
|
|
126 |
// ---------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
TKeyResponse CTrkSettingsContainer::OfferKeyEventL(
|
|
129 |
const TKeyEvent& aKeyEvent,
|
|
130 |
TEventCode aType )
|
|
131 |
{
|
|
132 |
if ( aKeyEvent.iCode == EKeyLeftArrow ||
|
|
133 |
aKeyEvent.iCode == EKeyRightArrow )
|
|
134 |
{
|
|
135 |
// Listbox takes all events even if it doesn't use them
|
|
136 |
return EKeyWasNotConsumed;
|
|
137 |
}
|
|
138 |
|
|
139 |
return iSettingsList->OfferKeyEventL( aKeyEvent, aType );
|
|
140 |
}
|
|
141 |
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
// CTrkSettingsContainer::SizeChanged
|
|
144 |
// Set the size and position of component controls.
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
void CTrkSettingsContainer::SizeChanged()
|
|
148 |
{
|
|
149 |
if (iSettingsList)
|
|
150 |
{
|
|
151 |
iSettingsList->SetRect(Rect());
|
|
152 |
|
|
153 |
}
|
|
154 |
}
|
|
155 |
// End of File
|