1 /* |
|
2 * Copyright (c) 2008-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: Container for list view that shows installed applications |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "appmngr2installedcontainer.h" // CAppMngr2InstalledContainer |
|
20 #include "appmngr2installedview.h" // CAppMngr2InstalledView |
|
21 #include "appmngr2model.h" // CAppMngr2Model |
|
22 #include <appmngr2appinfo.h> // CAppMngr2AppInfo |
|
23 #include <appmngr2common.hrh> // Command IDs |
|
24 #include <eiktxlbm.h> // CTextListBoxModel |
|
25 #include <aknlists.h> // CAknDoubleLargeStyleListBox |
|
26 #include <appmngr2.rsg> // Resource IDs |
|
27 #include <csxhelp/am.hlp.hrh> // Help contexts |
|
28 |
|
29 |
|
30 // ======== MEMBER FUNCTIONS ======== |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // CAppMngr2InstalledContainer::NewL() |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 CAppMngr2InstalledContainer* CAppMngr2InstalledContainer::NewL( |
|
37 CAppMngr2InstalledView& aView ) |
|
38 { |
|
39 CAppMngr2InstalledContainer* self = new (ELeave) CAppMngr2InstalledContainer( aView ); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL( aView ); |
|
42 CleanupStack::Pop( self ); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CAppMngr2InstalledContainer::~CAppMngr2InstalledContainer() |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CAppMngr2InstalledContainer::~CAppMngr2InstalledContainer() |
|
51 { |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CAppMngr2InstalledContainer::OfferKeyEventL() |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 TKeyResponse CAppMngr2InstalledContainer::OfferKeyEventL( |
|
59 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
60 { |
|
61 TKeyResponse response = EKeyWasNotConsumed; |
|
62 switch( aKeyEvent.iCode ) |
|
63 { |
|
64 case EKeyOK: // Middle softkey |
|
65 HandleGenericCommandL( EAppMngr2CmdViewDetails ); |
|
66 break; |
|
67 |
|
68 case EKeyBackspace: |
|
69 HandleGenericCommandL( EAppMngr2CmdUninstall ); |
|
70 break; |
|
71 |
|
72 default: |
|
73 response = CAppMngr2ListContainer::OfferKeyEventL( aKeyEvent, aType ); |
|
74 break; |
|
75 } |
|
76 return response; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CAppMngr2InstalledContainer::GetHelpContext() |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CAppMngr2InstalledContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
84 { |
|
85 const TUid KAppMngr2AppUid = { KAppMngr2AppUidValue }; |
|
86 aContext.iMajor = KAppMngr2AppUid; |
|
87 aContext.iContext = KAM_HLP_INSTALLED; |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CAppMngr2InstalledContainer::HandleListBoxEventL() |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CAppMngr2InstalledContainer::HandleListBoxEventL( CEikListBox* aListBox, |
|
95 TListBoxEvent aEventType ) |
|
96 { |
|
97 switch( aEventType ) |
|
98 { |
|
99 case EEventItemSingleClicked: |
|
100 case EEventEnterKeyPressed: |
|
101 HandleGenericCommandL( EAppMngr2CmdViewDetails ); |
|
102 break; |
|
103 |
|
104 default: |
|
105 CAppMngr2ListContainer::HandleListBoxEventL( aListBox, aEventType ); |
|
106 break; |
|
107 } |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // CAppMngr2InstalledContainer::CurrentItem() |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 CAppMngr2InfoBase& CAppMngr2InstalledContainer::CurrentItem() const |
|
115 { |
|
116 // panics if list box is empty |
|
117 return Model().AppInfo( iListBox->CurrentItemIndex() ); |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // CAppMngr2InstalledContainer::ListEmptyTextResourceId() |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 TInt CAppMngr2InstalledContainer::ListEmptyTextResourceId() const |
|
125 { |
|
126 return R_AM_INSTALLED_VIEW_EMPTY; |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CAppMngr2InstalledContainer::ItemCount() |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 TInt CAppMngr2InstalledContainer::ItemCount() const |
|
134 { |
|
135 return Model().AppInfoCount(); |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // CAppMngr2InstalledContainer::ItemInfo() |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 CAppMngr2InfoBase& CAppMngr2InstalledContainer::ItemInfo( TInt aIndex ) |
|
143 { |
|
144 return Model().AppInfo( aIndex ); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CAppMngr2InstalledContainer::CAppMngr2InstalledContainer() |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 CAppMngr2InstalledContainer::CAppMngr2InstalledContainer( CAppMngr2InstalledView& aView ) |
|
152 : CAppMngr2ListContainer( aView ) |
|
153 { |
|
154 } |
|
155 |
|
156 // --------------------------------------------------------------------------- |
|
157 // CAppMngr2InstalledContainer::ConstructL() |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 void CAppMngr2InstalledContainer::ConstructL( CAppMngr2InstalledView& aView ) |
|
161 { |
|
162 SetMopParent( &aView ); |
|
163 CAppMngr2ListContainer::ConstructL( aView.ClientRect() ); |
|
164 } |
|
165 |
|