|
1 /* |
|
2 * Copyright (c) 2008 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: CMSBrowseView class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <mediaservant.rsg> |
|
21 #include <StringLoader.h> |
|
22 #include <hlplch.h> |
|
23 |
|
24 #include "msbrowsecontainer.h" |
|
25 #include "msconstants.h" |
|
26 #include "msbrowseview.h" |
|
27 #include "msappui.h" |
|
28 #include "msdebug.h" |
|
29 |
|
30 // -------------------------------------------------------------------------- |
|
31 // CMSBrowseView::CMSBrowseView() |
|
32 // -------------------------------------------------------------------------- |
|
33 // |
|
34 CMSBrowseView::CMSBrowseView( CMSAppUi& aAppUi ) |
|
35 { |
|
36 LOG(_L("[MediaServant]\t CMSBrowseView::CMSBrowseView")); |
|
37 |
|
38 iAppUi = &aAppUi; |
|
39 } |
|
40 |
|
41 // -------------------------------------------------------------------------- |
|
42 // CMSBrowseView::ConstructL() |
|
43 // -------------------------------------------------------------------------- |
|
44 // |
|
45 void CMSBrowseView::ConstructL() |
|
46 { |
|
47 LOG(_L("[MediaServant]\t CMSBrowseView::ConstructL")); |
|
48 |
|
49 BaseConstructL( R_MS_BROWSE_VIEW ); |
|
50 } |
|
51 |
|
52 // -------------------------------------------------------------------------- |
|
53 // CMSBrowseView::~CMSBrowseView() |
|
54 // -------------------------------------------------------------------------- |
|
55 // |
|
56 CMSBrowseView::~CMSBrowseView() |
|
57 { |
|
58 LOG(_L("[MediaServant]\t CMSBrowseView::~CMSBrowseView")); |
|
59 |
|
60 DoDeactivate(); |
|
61 } |
|
62 // -------------------------------------------------------------------------- |
|
63 // TUid CMSBrowseView::Id() |
|
64 // -------------------------------------------------------------------------- |
|
65 // |
|
66 TUid CMSBrowseView::Id() const |
|
67 { |
|
68 LOG(_L("[MediaServant]\t CMSBrowseView::Id")); |
|
69 |
|
70 return KMSBrowseViewId; |
|
71 } |
|
72 |
|
73 // -------------------------------------------------------------------------- |
|
74 // CMSBrowseView::HandleCommandL(TInt aCommand) |
|
75 // -------------------------------------------------------------------------- |
|
76 // |
|
77 void CMSBrowseView::HandleCommandL( TInt aCommand ) |
|
78 { |
|
79 LOG(_L("[MediaServant]\t CMSBrowseView::HandleCommandL")); |
|
80 |
|
81 switch ( aCommand ) |
|
82 { |
|
83 case EAknSoftkeyBack: |
|
84 { |
|
85 // back to store view |
|
86 iAppUi->ChangeViewL( KMSBrowseViewId, KMSStoreListViewId ); |
|
87 break; |
|
88 } |
|
89 |
|
90 case EAknCmdHelp : |
|
91 { |
|
92 TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( |
|
93 iEikonEnv->WsSession(), |
|
94 iEikonEnv->EikAppUi()->AppHelpContextL() )); |
|
95 break; |
|
96 } |
|
97 |
|
98 default: |
|
99 { |
|
100 AppUi()->HandleCommandL( aCommand ); |
|
101 break; |
|
102 } |
|
103 } |
|
104 } |
|
105 |
|
106 |
|
107 |
|
108 // -------------------------------------------------------------------------- |
|
109 // CMSBrowseView::DoActivateL() |
|
110 // -------------------------------------------------------------------------- |
|
111 // |
|
112 void CMSBrowseView::DoActivateL( |
|
113 const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, |
|
114 const TDesC8& /*aCustomMessage*/) |
|
115 { |
|
116 LOG(_L("[MediaServant]\t CMSBrowseView::DoActivateL")); |
|
117 |
|
118 // Set title pane text to default |
|
119 CMSBaseView::SetTitlePaneTextL( KMSDefaultTitleId ); |
|
120 |
|
121 if ( !iContainer ) |
|
122 { |
|
123 iContainer = new (ELeave) CMSBrowseContainer( *iAppUi, *this ); |
|
124 iContainer->ConstructL( ClientRect() ); |
|
125 iContainer->SetMopParent( this ); |
|
126 AppUi()->AddToViewStackL( *this, iContainer ); |
|
127 iContainer->ActivateL(); |
|
128 } |
|
129 } |
|
130 |
|
131 // -------------------------------------------------------------------------- |
|
132 // CMSBrowseView::DoDeactivate() |
|
133 // -------------------------------------------------------------------------- |
|
134 // |
|
135 void CMSBrowseView::DoDeactivate() |
|
136 { |
|
137 LOG(_L("[MediaServant]\t CMSBrowseView::DoDeactivate")); |
|
138 |
|
139 if ( iContainer ) |
|
140 { |
|
141 AppUi()->RemoveFromStack( iContainer ); |
|
142 } |
|
143 |
|
144 delete iContainer; // Deletes the container class object. |
|
145 iContainer = NULL; |
|
146 |
|
147 ClearCurrentNaviPaneText(); |
|
148 } |
|
149 |
|
150 // -------------------------------------------------------------------------- |
|
151 // CMSBrowseView::SetTitlePaneTextL() |
|
152 // -------------------------------------------------------------------------- |
|
153 // |
|
154 void CMSBrowseView::SetTitlePaneTextL( TCmMediaType aMediaType ) |
|
155 { |
|
156 LOG(_L("[MediaServant]\t CMSBrowseView::SetTitlePaneTextL")); |
|
157 |
|
158 TInt resourceId(0); |
|
159 |
|
160 switch ( aMediaType ) |
|
161 { |
|
162 case ECmImage: |
|
163 { |
|
164 resourceId = R_MS_STORE_TITLE_PHONE_IMAGES; |
|
165 break; |
|
166 } |
|
167 case ECmOtherImage: |
|
168 { |
|
169 resourceId = R_MS_STORE_TITLE_IMAGES; |
|
170 break; |
|
171 } |
|
172 case ECmVideo: |
|
173 { |
|
174 resourceId = R_MS_STORE_TITLE_PHONE_VIDEOS; |
|
175 break; |
|
176 } |
|
177 case ECmOtherVideo: |
|
178 { |
|
179 resourceId = R_MS_STORE_TITLE_VIDEOS; |
|
180 break; |
|
181 } |
|
182 case ECmAudio: |
|
183 { |
|
184 resourceId = R_MS_STORE_TITLE_MUSIC; |
|
185 break; |
|
186 } |
|
187 default: |
|
188 { |
|
189 LOG(_L("[MediaServant]\t CMSBrowseView::SetTitlePaneTextL \ |
|
190 mediatype not found")); |
|
191 break; |
|
192 } |
|
193 } |
|
194 |
|
195 if ( resourceId ) |
|
196 { |
|
197 HBufC* titleText = StringLoader::LoadLC( resourceId ); |
|
198 CMSBaseView::SetTitlePaneTextL( *titleText ); |
|
199 CleanupStack::PopAndDestroy( titleText ); |
|
200 } |
|
201 } |
|
202 |
|
203 // End of File |
|
204 |