65
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 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 the License "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: A view to browse a feed's topics.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include <AknNavi.h>
|
|
21 |
#include <AknNaviDe.h>
|
|
22 |
#include <AknNaviLabel.h>
|
|
23 |
#include <AknTabGrp.h>
|
|
24 |
#include <AknViewAppUi.h>
|
|
25 |
#include <akniconarray.h>
|
|
26 |
#include <aknconsts.h>
|
|
27 |
#include <aknsconstants.h>
|
|
28 |
#include <aknlists.h>
|
|
29 |
#include <aknsutils.h>
|
|
30 |
#include <data_caging_path_literals.hrh>
|
|
31 |
#include <eikclbd.h>
|
|
32 |
#include <gulicon.h>
|
|
33 |
#ifdef __SERIES60_HELP
|
|
34 |
// Context-Sensitve Help File
|
|
35 |
#include <csxhelp/browser.hlp.hrh>
|
|
36 |
#include "BrowserApplication.h"
|
|
37 |
#endif // __SERIES60_HELP
|
|
38 |
|
|
39 |
#include <browser.mbg>
|
|
40 |
#include "Browser.hrh"
|
|
41 |
#include <BrowserNG.rsg>
|
|
42 |
#include <feedattributes.h>
|
|
43 |
#include <folderattributes.h>
|
|
44 |
#include <feedsentity.h>
|
|
45 |
#include "FeedsTopicContainer.h"
|
|
46 |
#include "FeedsTopicView.h"
|
|
47 |
|
|
48 |
#include "ApiProvider.h"
|
|
49 |
#include "Display.h"
|
|
50 |
|
|
51 |
|
|
52 |
const TInt KDateSize = 30; // Size of Date strings
|
|
53 |
const TInt KTimeSize = 30; // Size of Time strings
|
|
54 |
|
|
55 |
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
// CFeedsTopicContainer::NewL
|
|
58 |
//
|
|
59 |
// Two-phased constructor.
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
CFeedsTopicContainer* CFeedsTopicContainer::NewL(CFeedsTopicView* aView,
|
|
63 |
MApiProvider& aApiProvider, const TRect& aRect)
|
|
64 |
{
|
|
65 |
CFeedsTopicContainer* self = new (ELeave) CFeedsTopicContainer(aView, aApiProvider);
|
|
66 |
|
|
67 |
CleanupStack::PushL(self);
|
|
68 |
self->ConstructL(aRect);
|
|
69 |
CleanupStack::Pop();
|
|
70 |
|
|
71 |
return self;
|
|
72 |
}
|
|
73 |
|
|
74 |
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
// CFeedsTopicContainer::CFeedsTopicContainer
|
|
77 |
//
|
|
78 |
// C++ default constructor.
|
|
79 |
// -----------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
CFeedsTopicContainer::CFeedsTopicContainer(CFeedsTopicView* aView,
|
|
82 |
MApiProvider& aApiProvider ) :
|
|
83 |
iView( aView ),
|
|
84 |
iApiProvider( aApiProvider )
|
|
85 |
{
|
|
86 |
}
|
|
87 |
|
|
88 |
|
|
89 |
// -----------------------------------------------------------------------------
|
|
90 |
// CFeedsTopicContainer::ConstructL
|
|
91 |
//
|
|
92 |
// Symbian 2nd phase constructor can leave.
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
//
|
|
95 |
void CFeedsTopicContainer::ConstructL(const TRect& aRect)
|
|
96 |
{
|
|
97 |
CreateWindowL();
|
|
98 |
SetMopParent( iView );
|
|
99 |
InitContainerL(aRect);
|
|
100 |
ActivateL();
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
// -----------------------------------------------------------------------------
|
|
105 |
// CFeedsTopicContainer::~CFeedsTopicContainer
|
|
106 |
//
|
|
107 |
// Deconstructor.
|
|
108 |
// -----------------------------------------------------------------------------
|
|
109 |
//
|
|
110 |
CFeedsTopicContainer::~CFeedsTopicContainer()
|
|
111 |
{
|
|
112 |
delete iListBox;
|
|
113 |
delete iListBoxRows;
|
|
114 |
delete iNaviDecorator;
|
|
115 |
}
|
|
116 |
|
|
117 |
|
|
118 |
// -----------------------------------------------------------------------------
|
|
119 |
// CFeedsTopicContainer::OfferKeyEventL
|
|
120 |
//
|
|
121 |
// Handles key event.
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
TKeyResponse CFeedsTopicContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
|
|
125 |
{
|
|
126 |
if (aType != EEventKey)
|
|
127 |
{
|
|
128 |
return EKeyWasNotConsumed;
|
|
129 |
}
|
|
130 |
|
|
131 |
if (( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter ) &&
|
|
132 |
( aKeyEvent.iModifiers & EModifierShift ) )
|
|
133 |
{
|
|
134 |
return EKeyWasConsumed;
|
|
135 |
}
|
|
136 |
|
|
137 |
return iListBox->OfferKeyEventL(aKeyEvent, aType);
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
// -----------------------------------------------------------------------------
|
|
142 |
// CFeedsTopicContainer::GetHelpContext
|
|
143 |
//
|
|
144 |
// Get help context for the control.
|
|
145 |
// -----------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
#ifdef __SERIES60_HELP
|
|
148 |
void CFeedsTopicContainer::GetHelpContext(TCoeHelpContext& aContext) const
|
|
149 |
{
|
|
150 |
// This must be the Browser's uid becasue the help texts are under Browser topics.
|
|
151 |
aContext.iMajor = KUidBrowserApplication;
|
|
152 |
aContext.iContext = KOSS_HLP_RSS_ARTICLELST;
|
|
153 |
}
|
|
154 |
#endif // __SERIES60_HELP
|
|
155 |
|
|
156 |
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
// CFeedsTopicContainer::SizeChanged
|
|
159 |
//
|
|
160 |
// Called by framework when the view size is changed.
|
|
161 |
// -----------------------------------------------------------------------------
|
|
162 |
//
|
|
163 |
void CFeedsTopicContainer::SizeChanged()
|
|
164 |
{
|
|
165 |
iListBox->SetRect(Rect());
|
|
166 |
}
|
|
167 |
|
|
168 |
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
// CFeedsTopicContainer::HandleResourceChange
|
|
171 |
//
|
|
172 |
// Called by the framework when a display resource changes (i.e. skin or layout).
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
//
|
|
175 |
void CFeedsTopicContainer::HandleResourceChange(TInt aType)
|
|
176 |
{
|
|
177 |
CCoeControl::HandleResourceChange(aType);
|
|
178 |
iListBox->HandleResourceChange(aType);
|
|
179 |
|
|
180 |
if (aType == KEikDynamicLayoutVariantSwitch)
|
|
181 |
{
|
|
182 |
TRect rect;
|
|
183 |
|
|
184 |
if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect))
|
|
185 |
{
|
|
186 |
SetRect(rect);
|
|
187 |
}
|
|
188 |
}
|
|
189 |
}
|
|
190 |
|
|
191 |
|
|
192 |
// -----------------------------------------------------------------------------
|
|
193 |
// CFeedsTopicContainer::CountComponentControls
|
|
194 |
//
|
|
195 |
// Returns number of components.
|
|
196 |
// -----------------------------------------------------------------------------
|
|
197 |
//
|
|
198 |
TInt CFeedsTopicContainer::CountComponentControls() const
|
|
199 |
{
|
|
200 |
return 1;
|
|
201 |
}
|
|
202 |
|
|
203 |
|
|
204 |
// -----------------------------------------------------------------------------
|
|
205 |
// CFeedsTopicContainer::ComponentControl
|
|
206 |
//
|
|
207 |
// Returns pointer to particular component.
|
|
208 |
// -----------------------------------------------------------------------------
|
|
209 |
//
|
|
210 |
CCoeControl* CFeedsTopicContainer::ComponentControl(TInt aIndex) const
|
|
211 |
{
|
|
212 |
switch (aIndex)
|
|
213 |
{
|
|
214 |
case 0:
|
|
215 |
return iListBox;
|
|
216 |
|
|
217 |
default:
|
|
218 |
return NULL;
|
|
219 |
}
|
|
220 |
}
|
|
221 |
|
|
222 |
|
|
223 |
// -----------------------------------------------------------------------------
|
|
224 |
// CFeedsTopicContainer::HandleListBoxEventL
|
|
225 |
//
|
|
226 |
// Processes key events from the listbox.
|
|
227 |
// -----------------------------------------------------------------------------
|
|
228 |
//
|
|
229 |
void CFeedsTopicContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
|
|
230 |
{
|
|
231 |
// An item was selected.
|
|
232 |
if ((aEventType == MEikListBoxObserver::EEventEnterKeyPressed) ||
|
|
233 |
(aEventType == MEikListBoxObserver::EEventItemDoubleClicked)
|
|
234 |
#ifdef BRDO_SINGLE_CLICK_ENABLED_FF
|
|
235 |
|| (aEventType == MEikListBoxObserver::EEventItemSingleClicked)
|
|
236 |
#endif
|
|
237 |
)
|
|
238 |
{
|
|
239 |
HandleOpenL();
|
|
240 |
}
|
|
241 |
}
|
|
242 |
|
|
243 |
|
|
244 |
// -----------------------------------------------------------------------------
|
|
245 |
// CFeedsTopicContainer::SetCurrentFeedL
|
|
246 |
//
|
|
247 |
// Sets the current feed
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
//
|
|
250 |
void CFeedsTopicContainer::SetCurrentFeedL(const CFeedsEntity& aFeed, TInt aIndex)
|
|
251 |
{
|
|
252 |
// If the feed changes ignore aIndex.
|
|
253 |
if (iFeed != &aFeed)
|
|
254 |
{
|
|
255 |
aIndex = 0;
|
|
256 |
}
|
|
257 |
|
|
258 |
iFeed = &aFeed;
|
|
259 |
|
|
260 |
// Update the view.
|
|
261 |
UpdateTitleL();
|
|
262 |
UpdateListBoxL();
|
|
263 |
UpdateNavigationPaneL();
|
|
264 |
|
|
265 |
iListBox->SetCurrentItemIndex(aIndex);
|
|
266 |
iListBox->DrawDeferred();
|
|
267 |
}
|
|
268 |
|
|
269 |
|
|
270 |
// -----------------------------------------------------------------------------
|
|
271 |
// CFeedsTopicContainer::CurrentIndex
|
|
272 |
//
|
|
273 |
// Returns the current item.
|
|
274 |
// -----------------------------------------------------------------------------
|
|
275 |
TInt CFeedsTopicContainer::CurrentIndex() const
|
|
276 |
{
|
|
277 |
return iListBox->CurrentItemIndex();
|
|
278 |
}
|
|
279 |
|
|
280 |
|
|
281 |
// -----------------------------------------------------------------------------
|
|
282 |
// CFeedsTopicContainer::ItemCount
|
|
283 |
//
|
|
284 |
// Returns the number of items.
|
|
285 |
// -----------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
TInt CFeedsTopicContainer::ItemCount() const
|
|
288 |
{
|
|
289 |
return iFeed->GetChildren().Count();
|
|
290 |
}
|
|
291 |
|
|
292 |
|
|
293 |
// -----------------------------------------------------------------------------
|
|
294 |
// CFeedsTopicContainer::UpdateTitleL
|
|
295 |
//
|
|
296 |
// Update the view's title.
|
|
297 |
// -----------------------------------------------------------------------------
|
|
298 |
//
|
|
299 |
void CFeedsTopicContainer::UpdateTitleL()
|
|
300 |
{
|
|
301 |
|
|
302 |
// Set the view's title
|
|
303 |
TPtrC title;
|
|
304 |
iFeed->GetStringValue(EFeedAttributeTitle,title);
|
|
305 |
iApiProvider.Display().SetTitleL(title);
|
|
306 |
}
|
|
307 |
|
|
308 |
|
|
309 |
// -----------------------------------------------------------------------------
|
|
310 |
// CFeedsTopicContainer::HandleOpenL
|
|
311 |
//
|
|
312 |
// Handle the open command.
|
|
313 |
// -----------------------------------------------------------------------------
|
|
314 |
//
|
|
315 |
void CFeedsTopicContainer::HandleOpenL()
|
|
316 |
{
|
|
317 |
TInt index;
|
|
318 |
|
|
319 |
// Get the index of the item to show.
|
|
320 |
index = iListBox->CurrentItemIndex();
|
|
321 |
|
|
322 |
// Show the FeedView.
|
|
323 |
iApiProvider.FeedsClientUtilities().ShowFeedViewLocalL(index);
|
|
324 |
}
|
|
325 |
|
|
326 |
|
|
327 |
// -----------------------------------------------------------------------------
|
|
328 |
// CFeedsTopicContainer::HandleUpdateFeedL
|
|
329 |
//
|
|
330 |
// Handles updating the current Feed.
|
|
331 |
// -----------------------------------------------------------------------------
|
|
332 |
//
|
|
333 |
void CFeedsTopicContainer::HandleUpdateFeedL(void)
|
|
334 |
{
|
|
335 |
iApiProvider.FeedsClientUtilities().UpdateFeedL(*iFeed);
|
|
336 |
}
|
|
337 |
|
|
338 |
|
|
339 |
// -----------------------------------------------------------------------------
|
|
340 |
// CFeedsTopicContainer::InitContainerL
|
|
341 |
//
|
|
342 |
// Inits the container.
|
|
343 |
// -----------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
void CFeedsTopicContainer::InitContainerL(const TRect& aRect)
|
|
346 |
{
|
|
347 |
iListBox = new (ELeave) CAknSingleGraphicStyleListBox;
|
|
348 |
//iListBox = new (ELeave) CAknDoubleGraphicStyleListBox;
|
|
349 |
//iListBox = new (ELeave) CAknSingleStyleListBox;
|
|
350 |
|
|
351 |
// below flags equals EAknListBoxMarkableList without the EAknListBoxShiftEnterMarks
|
|
352 |
// so the shift key press is not handled by avkon
|
|
353 |
iListBox->ConstructL(this, (EAknGenericListBoxFlags | EAknListBoxMultipleSelection));
|
|
354 |
iListBox->SetContainerWindowL(*this);
|
|
355 |
iListBox->SetRect(aRect.Size());
|
|
356 |
iListBox->SetListBoxObserver(this);
|
|
357 |
|
|
358 |
iListBoxRows = new (ELeave) CDesCArraySeg(10);
|
|
359 |
iListBox->Model()->SetItemTextArray(iListBoxRows);
|
|
360 |
iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
|
|
361 |
|
|
362 |
iListBox->ActivateL();
|
|
363 |
iListBox->CreateScrollBarFrameL(ETrue);
|
|
364 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
|
|
365 |
|
|
366 |
// Add the needed icons.
|
|
367 |
InitIconArrayL();
|
|
368 |
|
|
369 |
// Enable marquee.
|
|
370 |
iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
|
|
371 |
}
|
|
372 |
|
|
373 |
|
|
374 |
// -----------------------------------------------------------------------------
|
|
375 |
// CFeedsTopicContainer::InitIconArrayL
|
|
376 |
//
|
|
377 |
// Inits the array of needed icons.
|
|
378 |
// -----------------------------------------------------------------------------
|
|
379 |
//
|
|
380 |
void CFeedsTopicContainer::InitIconArrayL()
|
|
381 |
{
|
|
382 |
_LIT(KDirAndFile,"z:browser.mbm");
|
|
383 |
|
|
384 |
TParse* fp = NULL;
|
|
385 |
CArrayPtr<CGulIcon>* icons = NULL;
|
|
386 |
|
|
387 |
// Build the path to the feeds resource file.
|
|
388 |
fp = new (ELeave) TParse();
|
|
389 |
CleanupStack::PushL(fp);
|
|
390 |
|
|
391 |
User::LeaveIfError(fp->Set(KDirAndFile, &KDC_APP_BITMAP_DIR, NULL));
|
|
392 |
TBuf<KMaxFileName> iconFile= fp->FullName();
|
|
393 |
CleanupStack::PopAndDestroy(fp);
|
|
394 |
|
|
395 |
// Create the icon array.
|
|
396 |
icons = new (ELeave) CAknIconArray(1);
|
|
397 |
CleanupStack::PushL(icons);
|
|
398 |
|
|
399 |
// Add the unread icon
|
|
400 |
AppendIconL(icons, KAknsIIDQgnPropFileRssUnread, iconFile,
|
|
401 |
EMbmBrowserQgn_prop_file_rss_unread, EMbmBrowserQgn_prop_file_rss_unread_mask);
|
|
402 |
|
|
403 |
// Add the read icon
|
|
404 |
AppendIconL(icons, KAknsIIDQgnPropFileRssRead, iconFile,
|
|
405 |
EMbmBrowserQgn_prop_file_rss_read, EMbmBrowserQgn_prop_file_rss_read_mask);
|
|
406 |
|
|
407 |
// Set the icons and cleanup
|
|
408 |
iListBox->ItemDrawer()->ColumnData()->SetIconArray(icons);
|
|
409 |
CleanupStack::Pop(icons);
|
|
410 |
}
|
|
411 |
|
|
412 |
|
|
413 |
// -----------------------------------------------------------------------------
|
|
414 |
// CFeedsTopicContainer::AppendIconL
|
|
415 |
//
|
|
416 |
// Loads and appends an icon to the icon array.
|
|
417 |
// -----------------------------------------------------------------------------
|
|
418 |
//
|
|
419 |
void CFeedsTopicContainer::AppendIconL(CArrayPtr<CGulIcon>* aIcons,
|
|
420 |
const TAknsItemID& aID, const TDesC& aFilename, const TInt aFileBitmapId,
|
|
421 |
const TInt aFileMaskId)
|
|
422 |
{
|
|
423 |
CGulIcon* newIcon;
|
|
424 |
CFbsBitmap* newIconBmp;
|
|
425 |
CFbsBitmap* newIconMaskBmp;
|
|
426 |
|
|
427 |
// Create the bitmaps: the bitmaps are left on the cleanup stack.
|
|
428 |
AknsUtils::CreateIconL(AknsUtils::SkinInstance(), aID, newIconBmp,
|
|
429 |
newIconMaskBmp, aFilename, aFileBitmapId, aFileMaskId);
|
|
430 |
|
|
431 |
CleanupStack::PushL(newIconBmp);
|
|
432 |
CleanupStack::PushL(newIconMaskBmp);
|
|
433 |
|
|
434 |
newIcon = CGulIcon::NewL(newIconBmp, newIconMaskBmp);
|
|
435 |
CleanupStack::Pop(newIconMaskBmp);
|
|
436 |
CleanupStack::Pop(newIconBmp);
|
|
437 |
CleanupStack::PushL(newIcon);
|
|
438 |
|
|
439 |
aIcons->AppendL(newIcon);
|
|
440 |
CleanupStack::Pop(newIcon);
|
|
441 |
}
|
|
442 |
|
|
443 |
|
|
444 |
// -----------------------------------------------------------------------------
|
|
445 |
// CFeedsTopicContainer::UpdateListBoxL
|
|
446 |
//
|
|
447 |
// Sets the list-box's values.
|
|
448 |
// -----------------------------------------------------------------------------
|
|
449 |
//
|
|
450 |
void CFeedsTopicContainer::UpdateListBoxL()
|
|
451 |
{
|
|
452 |
TBuf<255> listBoxtxt;
|
|
453 |
|
|
454 |
// Clear the list.
|
|
455 |
iListBoxRows->Reset();
|
|
456 |
|
|
457 |
if (iFeed == NULL)
|
|
458 |
{
|
|
459 |
return;
|
|
460 |
}
|
|
461 |
|
|
462 |
// Add the items.
|
|
463 |
for (int i = 0; i < iFeed->GetChildren().Count(); i++)
|
|
464 |
{
|
|
465 |
CFeedsEntity* item = iFeed->GetChildren()[i];
|
|
466 |
TPtrC title;
|
|
467 |
TPtrC desc;
|
|
468 |
TDesC* itemName;
|
|
469 |
TInt status;
|
|
470 |
|
|
471 |
item->GetStringValue(EItemAttributeTitle,title);
|
|
472 |
item->GetStringValue(EItemAttributeDescription,desc);
|
|
473 |
item->GetIntegerValue(EItemAttributeStatus,status);
|
|
474 |
// Get the title.
|
|
475 |
itemName = &(title);
|
|
476 |
|
|
477 |
// If the title is missing use the description instead.
|
|
478 |
if (itemName->Length() == 0)
|
|
479 |
{
|
|
480 |
itemName = &(desc);
|
|
481 |
}
|
|
482 |
|
|
483 |
// Ensure the title isn't too long.
|
|
484 |
TInt len = itemName->Length();
|
|
485 |
if (len > 253)
|
|
486 |
{
|
|
487 |
len = 253;
|
|
488 |
}
|
|
489 |
|
|
490 |
// Format: icon-index\t\1st Line of text\t2nd Line of text\t0
|
|
491 |
listBoxtxt.Zero();
|
|
492 |
|
|
493 |
switch (status)
|
|
494 |
{
|
|
495 |
// unread and new item all share the same unread icon
|
|
496 |
case EItemStatusNew:
|
|
497 |
listBoxtxt.Append(_L("0\t"));
|
|
498 |
break;
|
|
499 |
|
|
500 |
case EItemStatusUnread:
|
|
501 |
listBoxtxt.Append(_L("0\t"));
|
|
502 |
break;
|
|
503 |
|
|
504 |
default:
|
|
505 |
listBoxtxt.Append(_L("1\t"));
|
|
506 |
break;
|
|
507 |
}
|
|
508 |
|
|
509 |
listBoxtxt.Append(itemName->Ptr(), len);
|
|
510 |
listBoxtxt.Append(KNullDesC());
|
|
511 |
|
|
512 |
iListBoxRows->AppendL(listBoxtxt);
|
|
513 |
}
|
|
514 |
|
|
515 |
iListBox->SetCurrentItemIndex(0);
|
|
516 |
iListBox->HandleItemAdditionL();
|
|
517 |
}
|
|
518 |
|
|
519 |
|
|
520 |
// -----------------------------------------------------------------------------
|
|
521 |
// CFeedsTopicContainer::Clear
|
|
522 |
//
|
|
523 |
// Clears the navigation pane.
|
|
524 |
// -----------------------------------------------------------------------------
|
|
525 |
//
|
|
526 |
void CFeedsTopicContainer::ClearNavigationPane()
|
|
527 |
{
|
|
528 |
delete iNaviDecorator;
|
|
529 |
iNaviDecorator = NULL;
|
|
530 |
}
|
|
531 |
|
|
532 |
|
|
533 |
// -----------------------------------------------------------------------------
|
|
534 |
// CFeedsTopicContainer::UpdateNavigationPaneL
|
|
535 |
//
|
|
536 |
// Handles the changes needed to the Navigation Pane.
|
|
537 |
// -----------------------------------------------------------------------------
|
|
538 |
//
|
|
539 |
void CFeedsTopicContainer::UpdateNavigationPaneL()
|
|
540 |
{
|
|
541 |
CAknNavigationControlContainer* naviPane = NULL;
|
|
542 |
|
|
543 |
if (!iFeed)
|
|
544 |
{
|
|
545 |
return;
|
|
546 |
}
|
|
547 |
|
|
548 |
// Convert the feed's timestamp into a localized string.
|
|
549 |
TBuf<KDateSize + KTimeSize + 1> timestamp;
|
|
550 |
TBuf<KTimeSize> temp;
|
|
551 |
TTime date;
|
|
552 |
iFeed->GetTimeValue(EFeedAttributeTimestamp,date);
|
|
553 |
|
|
554 |
// Translate from UTC to local time.
|
|
555 |
TTime local;
|
|
556 |
TTime utc;
|
|
557 |
TTimeIntervalSeconds delta;
|
|
558 |
|
|
559 |
local.HomeTime();
|
|
560 |
utc.UniversalTime();
|
|
561 |
utc.SecondsFrom(local, delta);
|
|
562 |
date -= delta;
|
|
563 |
|
|
564 |
//Set time
|
|
565 |
HBufC* timeFormat = iEikonEnv->AllocReadResourceLC( R_QTN_TIME_USUAL_WITH_ZERO );
|
|
566 |
date.FormatL( timestamp, *timeFormat );
|
|
567 |
CleanupStack::PopAndDestroy( timeFormat );//timeFormat
|
|
568 |
//
|
|
569 |
timestamp.Append(_L(" "));
|
|
570 |
//Set date
|
|
571 |
HBufC* dateFormat = iEikonEnv->AllocReadResourceLC( R_QTN_DATE_USUAL_WITH_ZERO );
|
|
572 |
date.FormatL( temp, *dateFormat );
|
|
573 |
CleanupStack::PopAndDestroy( dateFormat );//dateFormat
|
|
574 |
//
|
|
575 |
timestamp.Append(temp);
|
|
576 |
AknTextUtils::LanguageSpecificNumberConversion(timestamp);
|
|
577 |
|
|
578 |
// Get the navigation sub-pane.
|
|
579 |
CAknViewAppUi* appUi;
|
|
580 |
TUid uid;
|
|
581 |
|
|
582 |
// Get the title sub-pane.
|
|
583 |
appUi = static_cast<CAknViewAppUi*>(CCoeEnv::Static()->AppUi());
|
|
584 |
|
|
585 |
uid.iUid = EEikStatusPaneUidNavi;
|
|
586 |
|
|
587 |
CEikStatusPaneBase::TPaneCapabilities subPane = appUi->StatusPane()->
|
|
588 |
PaneCapabilities(uid);
|
|
589 |
|
|
590 |
// Set the title if the pane belongs to the app.
|
|
591 |
if (subPane.IsPresent() && subPane.IsAppOwned())
|
|
592 |
{
|
|
593 |
naviPane = (CAknNavigationControlContainer*) appUi->StatusPane()->ControlL(uid);
|
|
594 |
}
|
|
595 |
else
|
|
596 |
{
|
|
597 |
User::Leave(KErrNotSupported);
|
|
598 |
}
|
|
599 |
|
|
600 |
// Ensure the NaviDecorator was created.
|
|
601 |
if (!iNaviDecorator)
|
|
602 |
{
|
|
603 |
iNaviDecorator = naviPane->CreateNavigationLabelL( timestamp );
|
|
604 |
}
|
|
605 |
else
|
|
606 |
{
|
|
607 |
CAknNaviLabel* naviLabel = static_cast<CAknNaviLabel*>(iNaviDecorator->DecoratedControl());
|
|
608 |
if(naviLabel)
|
|
609 |
{
|
|
610 |
naviLabel->SetTextL(timestamp);
|
|
611 |
}
|
|
612 |
}
|
|
613 |
|
|
614 |
|
|
615 |
// If not yet pushed, this will do the push; if already there, this brings
|
|
616 |
// it to top and draws.
|
|
617 |
naviPane->PushL(*iNaviDecorator);
|
|
618 |
}
|
|
619 |
|
|
620 |
|
|
621 |
|
|
622 |
|