1 /* |
|
2 * Copyright (c) 2006 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: CCSXHGenericView class definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CSXHGenericView.h" |
|
20 #include "CSXHGenericContainer.h" |
|
21 #include "CSXHAppUi.h" |
|
22 #include "CSXHDocument.h" |
|
23 #include <cshelp.rsg> |
|
24 #include "CsHelp.hrh" |
|
25 |
|
26 #include "CSXHHelpContentBase.h" |
|
27 #include "CSXHViewIDs.h" |
|
28 #include "CSXHHelpDataBase.h" |
|
29 |
|
30 #include <akntitle.h> |
|
31 #include <coemain.h> |
|
32 #include <eikmenup.h> |
|
33 #include <eikbtgpc.h> |
|
34 |
|
35 #ifdef FF_HELP_TUTORIAL_MERGE |
|
36 |
|
37 #include <AiwMenu.h> |
|
38 #include <AiwCommon.h> |
|
39 #include <AiwServiceHandler.h> |
|
40 #include <AknGlobalNote.h> |
|
41 |
|
42 #endif // FF_HELP_TUTORIAL_MERGE |
|
43 |
|
44 CCSXHGenericView* CCSXHGenericView::NewL(const TUid& aUid, |
|
45 const TInt& aFlags) |
|
46 { |
|
47 CCSXHGenericView* self = new(ELeave) CCSXHGenericView(aUid,aFlags); |
|
48 CleanupStack::PushL(self); |
|
49 self->ConstructL(); |
|
50 CleanupStack::Pop(self); |
|
51 return self; |
|
52 } |
|
53 |
|
54 CCSXHGenericView::CCSXHGenericView(const TUid& aUid, const TInt& aFlags) |
|
55 :iResetContainerInActivate(EFalse),iUid(aUid),iAppFlags(aFlags) |
|
56 {//No Implementation required |
|
57 } |
|
58 |
|
59 void CCSXHGenericView::ConstructL() |
|
60 { |
|
61 BaseConstructL(iAppFlags); |
|
62 |
|
63 } |
|
64 |
|
65 CCSXHGenericView::~CCSXHGenericView() |
|
66 { |
|
67 if(iContainer) |
|
68 { |
|
69 AppUi()->RemoveFromStack(iContainer); |
|
70 delete iContainer; |
|
71 } |
|
72 } |
|
73 |
|
74 TUid CCSXHGenericView::Id() const |
|
75 { |
|
76 return iUid; |
|
77 } |
|
78 |
|
79 // -------------------------------- |
|
80 // Message Handler |
|
81 // -------------------------------- |
|
82 void CCSXHGenericView::HandleCommandL(TInt aCommand) |
|
83 { |
|
84 switch(aCommand) |
|
85 { |
|
86 case EAknSoftkeyBack: |
|
87 { |
|
88 CCSXHDocument* doc = static_cast<CCSXHDocument*>(AppUi()->Document()); |
|
89 if(iUid == KCSXHToc2ViewID) |
|
90 { |
|
91 doc->SetDisplayAndPrevTopic(doc->GetHelpDataBase()->GetMainTopics()); |
|
92 } |
|
93 else if(iUid == KCSXHKywdToc2ViewID) |
|
94 { |
|
95 doc->SetDisplayAndPrevTopic(doc->GetHelpDataBase()->GetKywdTopics()); |
|
96 } |
|
97 else if ( iUid == KCSXHToc1AppHelpsViewID ) |
|
98 { |
|
99 doc->SetDisplayAndPrevTopic( doc->GetHelpDataBase()->GetMainTopics() ); |
|
100 } |
|
101 else if ( iUid == KCSXHToc2AppHelpsViewID ) |
|
102 { |
|
103 doc->SetDisplayAndPrevTopic( doc->GetHelpDataBase()->GetAppHelpsTopics() ); |
|
104 } |
|
105 else if ( iUid == KCSXHKywdToc1ViewID ) |
|
106 { |
|
107 doc->SetDisplayAndPrevTopic( doc->GetHelpDataBase()->GetMainTopics() ); |
|
108 } |
|
109 |
|
110 |
|
111 AppUi()->HandleCommandL(ECSXHOpenItem); |
|
112 } |
|
113 break; |
|
114 case ECSXHOpenItemPropagated: //Will be called for AppUi |
|
115 iContainer->SetDisplayTopicL(); |
|
116 break; |
|
117 case ECSXHTOC1ListView: |
|
118 { |
|
119 CCSXHDocument* doc = static_cast<CCSXHDocument*>(AppUi()->Document()); |
|
120 doc->SetDisplayAndPrevTopic(doc->GetHelpDataBase()->GetMainTopics()); |
|
121 AppUi()->HandleCommandL(ECSXHOpenItem); |
|
122 } |
|
123 break; |
|
124 case ECSXHOpenItem: |
|
125 case ECSXHOpenTopicText: |
|
126 #ifdef FF_HELP_TUTORIAL_MERGE |
|
127 |
|
128 if(iContainer->IsShowTutorialItemSelectedL()) |
|
129 { |
|
130 if(CCSXHAppUi::GetInstance()->IsApplicationPresentInTutorialL()) |
|
131 { |
|
132 CCSXHAppUi::GetInstance()->CallTutorialAiwProviderL(); |
|
133 } |
|
134 else |
|
135 { |
|
136 HBufC* ErrorMessage = iCoeEnv->AllocReadResourceLC( |
|
137 R_TYPE_NO_HELP_TOPICS); |
|
138 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
|
139 note->ShowNoteL(EAknGlobalInformationNote, *ErrorMessage); |
|
140 |
|
141 CleanupStack::PopAndDestroy(note); |
|
142 CleanupStack::PopAndDestroy(ErrorMessage); |
|
143 } |
|
144 } |
|
145 else |
|
146 |
|
147 #endif // FF_HELP_TUTORIAL_MERGE |
|
148 { |
|
149 iContainer->SetDisplayTopicL(); |
|
150 AppUi()->HandleCommandL(aCommand); |
|
151 } |
|
152 break; |
|
153 default: |
|
154 AppUi()->HandleCommandL(aCommand); |
|
155 break; |
|
156 } |
|
157 } |
|
158 // -------------------------------------------------------------------------- |
|
159 // Handler for view activation. If required the container object will be |
|
160 // recreated. The recreation can be due to 1) Resetting the search pane |
|
161 // 2) Changing the selection of the items in the list box 3) Repopulating the |
|
162 // contents of the list box |
|
163 // -------------------------------------------------------------------------- |
|
164 void CCSXHGenericView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,TUid,const TDesC8& ) |
|
165 { |
|
166 CCSXHDocument* doc = static_cast<CCSXHDocument*>(AppUi()->Document()); |
|
167 if(iResetContainerInActivate) |
|
168 { |
|
169 delete iContainer; |
|
170 iContainer = NULL; |
|
171 iResetContainerInActivate = EFalse; |
|
172 } |
|
173 if(!iContainer) |
|
174 { |
|
175 if(iUid == KCSXHKywdToc2ViewID) |
|
176 doc->InitProgressBarL(); |
|
177 |
|
178 #ifdef FF_HELP_TUTORIAL_MERGE |
|
179 iContainer = CCSXHGenericContainer::NewL(ClientRect(),*doc,this); |
|
180 #else // !FF_HELP_TUTORIAL_MERGE |
|
181 iContainer = CCSXHGenericContainer::NewL(ClientRect(),*doc); |
|
182 #endif // FF_HELP_TUTORIAL_MERGE |
|
183 |
|
184 /*if(iUid == KCSXHKywdToc2ViewID) |
|
185 doc->FreeProgressBarL();*/ |
|
186 } |
|
187 iContainer->HightLightItemL(); |
|
188 iContainer->MakeVisible(ETrue); |
|
189 iContainer->DrawNow(); |
|
190 iContainer->SetMopParent(this); |
|
191 //iContainer->SetRect(ClientRect()); |
|
192 iContainer->SetCurrentView(this); |
|
193 AppUi()->AddToStackL(*this, iContainer); |
|
194 |
|
195 if(iUid == KCSXHToc1ViewID || |
|
196 iUid == KCSXHKywdToc1ViewID) |
|
197 { |
|
198 doc->GetHelpDataBase()->ClearAllTOC1Contents(); |
|
199 doc->ClearPrevTopic(); |
|
200 } |
|
201 |
|
202 iContainer->CheckForMSK(); |
|
203 |
|
204 //Set the title of the view |
|
205 CEikStatusPane* sp = StatusPane(); |
|
206 CAknTitlePane* title = STATIC_CAST(CAknTitlePane*, |
|
207 sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle))); |
|
208 title->SetTextL(doc->GetDisplayTopic()->GetName()); |
|
209 } |
|
210 |
|
211 void CCSXHGenericView::DoDeactivate() |
|
212 { |
|
213 if(iContainer) |
|
214 { |
|
215 iContainer->MakeVisible(EFalse); |
|
216 AppUi()->RemoveFromStack(iContainer); |
|
217 } |
|
218 } |
|
219 |
|
220 void CCSXHGenericView::ResetContainer() |
|
221 { |
|
222 iResetContainerInActivate = ETrue; |
|
223 } |
|
224 // -------------------------------------------------------------------------- |
|
225 // Dynamically changing the items in the Options Menu |
|
226 // -------------------------------------------------------------------------- |
|
227 |
|
228 void CCSXHGenericView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
229 { |
|
230 if ( aResourceId == R_CSXH_MENU_TOPICLIST && |
|
231 iContainer->GetNumberOfListItems()== 0 ) |
|
232 { |
|
233 aMenuPane->DeleteMenuItem(ECSXHOpenTopicText); |
|
234 } |
|
235 |
|
236 if ( aResourceId == R_CSXH_MENU_KYWDTOC1LIST && |
|
237 iContainer->GetNumberOfListItems()== 0 ) |
|
238 { |
|
239 aMenuPane->DeleteMenuItem(ECSXHOpenTopicText); |
|
240 } |
|
241 |
|
242 if ( aResourceId == R_CSXH_MENU && |
|
243 iContainer->GetNumberOfListItems()== 0 ) |
|
244 { |
|
245 aMenuPane->DeleteMenuItem(ECSXHOpenItem); |
|
246 } |
|
247 |
|
248 if ( aResourceId == R_CSXH_MENU_KYWDTOC2LIST && |
|
249 iContainer->GetNumberOfListItems()== 0 ) |
|
250 { |
|
251 aMenuPane->DeleteMenuItem(ECSXHOpenTopicText); |
|
252 } |
|
253 } |
|
254 // -------------------------------------------------------------------------- |
|
255 // MSK Handler Handling |
|
256 // -------------------------------------------------------------------------- |
|
257 void CCSXHGenericView::SetMiddleSoftKey(TBool aValue) |
|
258 { |
|
259 Cba()->MakeCommandVisible(ECSXHOpenTopicText,aValue); |
|
260 Cba()->DrawDeferred(); |
|
261 } |
|
262 void CCSXHGenericView::ResourceChangeHdl(TInt aType) |
|
263 { |
|
264 if(iContainer) |
|
265 iContainer->HandleResourceChangeImpl(aType); |
|
266 } |
|
267 |
|
268 |
|