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 installation files |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "appmngr2packagescontainer.h" // CAppMngr2PackagesContainer |
|
20 #include "appmngr2packagesview.h" // CAppMngr2PackagesView |
|
21 #include "appmngr2model.h" // CAppMngr2Model |
|
22 #include <appmngr2packageinfo.h> // CAppMngr2PackageInfo |
|
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 // CAppMngr2PackagesContainer::NewL() |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 CAppMngr2PackagesContainer* CAppMngr2PackagesContainer::NewL( CAppMngr2PackagesView& aView ) |
|
37 { |
|
38 CAppMngr2PackagesContainer* self = new (ELeave) CAppMngr2PackagesContainer( aView ); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL( aView ); |
|
41 CleanupStack::Pop( self ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CAppMngr2PackagesContainer::~CAppMngr2PackagesContainer |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CAppMngr2PackagesContainer::~CAppMngr2PackagesContainer() |
|
50 { |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CAppMngr2PackagesContainer::OfferKeyEventL() |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 TKeyResponse CAppMngr2PackagesContainer::OfferKeyEventL( |
|
58 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
59 { |
|
60 TKeyResponse response = EKeyWasNotConsumed; |
|
61 switch( aKeyEvent.iCode ) |
|
62 { |
|
63 case EKeyOK: // Middle softkey |
|
64 HandleGenericCommandL( EAppMngr2CmdInstall ); |
|
65 break; |
|
66 |
|
67 case EKeyBackspace: |
|
68 HandleGenericCommandL( EAppMngr2CmdRemove ); |
|
69 break; |
|
70 |
|
71 default: |
|
72 response = CAppMngr2ListContainer::OfferKeyEventL( aKeyEvent, aType ); |
|
73 break; |
|
74 } |
|
75 return response; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CAppMngr2PackagesContainer::GetHelpContext() |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 void CAppMngr2PackagesContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
83 { |
|
84 const TUid KAppMngr2AppUid = { KAppMngr2AppUidValue }; |
|
85 aContext.iMajor = KAppMngr2AppUid; |
|
86 aContext.iContext = KAM_HLP_NOT_INSTALLED; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CAppMngr2PackagesContainer::HandleListBoxEventL() |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 void CAppMngr2PackagesContainer::HandleListBoxEventL( CEikListBox* aListBox, |
|
94 TListBoxEvent aEventType ) |
|
95 { |
|
96 switch( aEventType ) |
|
97 { |
|
98 case EEventItemSingleClicked: |
|
99 case EEventEnterKeyPressed: |
|
100 HandleGenericCommandL( EAppMngr2CmdInstall ); |
|
101 break; |
|
102 |
|
103 default: |
|
104 CAppMngr2ListContainer::HandleListBoxEventL( aListBox, aEventType ); |
|
105 break; |
|
106 } |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // CAppMngr2PackagesContainer::CurrentItem() |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 CAppMngr2InfoBase& CAppMngr2PackagesContainer::CurrentItem() const |
|
114 { |
|
115 // panics if list box is empty |
|
116 return Model().PackageInfo( iListBox->CurrentItemIndex() ); |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // CAppMngr2PackagesContainer::ListEmptyTextResourceId() |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 TInt CAppMngr2PackagesContainer::ListEmptyTextResourceId() const |
|
124 { |
|
125 return R_AM_PACKAGES_VIEW_EMPTY; |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------------------------- |
|
129 // CAppMngr2PackagesContainer::ItemCount() |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 TInt CAppMngr2PackagesContainer::ItemCount() const |
|
133 { |
|
134 return Model().PackageInfoCount(); |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // CAppMngr2PackagesContainer::ItemInfo() |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 CAppMngr2InfoBase& CAppMngr2PackagesContainer::ItemInfo( TInt aIndex ) |
|
142 { |
|
143 return Model().PackageInfo( aIndex ); |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CAppMngr2PackagesContainer::CAppMngr2PackagesContainer |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 CAppMngr2PackagesContainer::CAppMngr2PackagesContainer( CAppMngr2PackagesView& aView ) |
|
151 : CAppMngr2ListContainer( aView ) |
|
152 { |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CAppMngr2PackagesContainer::ConstructL() |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 void CAppMngr2PackagesContainer::ConstructL( CAppMngr2PackagesView& aView ) |
|
160 { |
|
161 SetMopParent( &aView ); |
|
162 CAppMngr2ListContainer::ConstructL( aView.ClientRect() ); |
|
163 } |
|
164 |
|