|
1 /* |
|
2 * Copyright (c) 2005-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 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 user's list of feeds. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <avkon.rsg> |
|
21 |
|
22 #include <aknviewappui.h> |
|
23 #include <aknutils.h> |
|
24 #include <AknToolbar.h> |
|
25 #include <eikmenup.h> |
|
26 #include <hlplch.h> |
|
27 #include <s32mem.h> |
|
28 |
|
29 #include "Browser.hrh" |
|
30 #include <BrowserNG.rsg> |
|
31 |
|
32 #include "BrowserAppUi.h" |
|
33 #include "CommonConstants.h" |
|
34 #include <FeedAttributes.h> |
|
35 #include <FolderAttributes.h> |
|
36 #include "FeedsFolderContainer.h" |
|
37 #include "FeedsFolderView.h" |
|
38 #include "Display.h" |
|
39 |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CFeedsFolderView::NewL |
|
43 // |
|
44 // Two-phased constructor. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CFeedsFolderView* CFeedsFolderView::NewL( MApiProvider& aApiProvider, TRect& aRect ) |
|
48 { |
|
49 CFeedsFolderView* self = new (ELeave) CFeedsFolderView(aApiProvider); |
|
50 |
|
51 CleanupStack::PushL(self); |
|
52 self->ConstructL(aRect); |
|
53 CleanupStack::Pop(); |
|
54 |
|
55 return self; |
|
56 } |
|
57 |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CFeedsFolderView::CFeedsFolderView |
|
61 // |
|
62 // C++ default constructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CFeedsFolderView::CFeedsFolderView(MApiProvider& aApiProvider): |
|
66 CBrowserViewBase( aApiProvider ),iPenEnabled(EFalse) |
|
67 { |
|
68 iPenEnabled = AknLayoutUtils::PenEnabled(); |
|
69 } |
|
70 |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CFeedsFolderView::ConstructL |
|
74 // |
|
75 // Symbian 2nd phase constructor can leave. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CFeedsFolderView::ConstructL(TRect& aRect) |
|
79 { |
|
80 BaseConstructL(R_FEEDS_FOLDER_VIEW); |
|
81 |
|
82 iContainer = CFeedsFolderContainer::NewL( this, ApiProvider(), aRect ); |
|
83 iContainer->MakeVisible(EFalse); |
|
84 |
|
85 if(iPenEnabled) |
|
86 { |
|
87 Toolbar()->SetToolbarObserver(this); |
|
88 } |
|
89 } |
|
90 |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CFeedsFolderView::~CFeedsFolderView |
|
94 // |
|
95 // Deconstructor. |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 CFeedsFolderView::~CFeedsFolderView() |
|
99 { |
|
100 DoDeactivate(); |
|
101 |
|
102 delete iContainer; |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // CFeedsFolderView::Id |
|
107 // |
|
108 // Returns the id of the view. |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 TUid CFeedsFolderView::Id() const |
|
112 { |
|
113 return KUidBrowserFeedsFolderViewId; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CFeedsFolderView::HandleCommandL |
|
118 // |
|
119 // Processes commands. |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 void CFeedsFolderView::HandleCommandL(TInt aCommand) |
|
123 { |
|
124 TBool handled = EFalse; |
|
125 |
|
126 // Handle softkeys and some standard commands first. |
|
127 switch (aCommand) |
|
128 { |
|
129 case EAknSoftkeyBack: |
|
130 if (!iContainer->HandleShowParentFolderL()) |
|
131 { |
|
132 // If we are in embedded mode (perhaps someone imported a feed from the messaging app) |
|
133 // then we want to close the browser vs. returning to the bookmark view |
|
134 if (iApiProvider.IsEmbeddedModeOn()) |
|
135 { |
|
136 AppUi()->HandleCommandL( EWmlCmdCloseBrowser ); |
|
137 } |
|
138 // Go back to content view only if we came from there. Note that ContentView can be |
|
139 // on the history if another application launched a URL. |
|
140 else if(((ApiProvider().GetPreviousViewFromViewHistory() == KUidBrowserContentViewId) |
|
141 && (ApiProvider().FeedsClientUtilities().CalledFromView() == KUidBrowserContentViewId)) |
|
142 ||(ApiProvider().GetPreviousViewFromViewHistory() == KUidBrowserFeedsTopicViewId) |
|
143 && (ApiProvider().FeedsClientUtilities().CalledFromView() != KUidBrowserBookmarksViewId)) |
|
144 { |
|
145 iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserContentViewId ); |
|
146 } |
|
147 else |
|
148 { |
|
149 iApiProvider.SetViewToBeActivatedIfNeededL( KUidBrowserBookmarksViewId ); |
|
150 } |
|
151 } |
|
152 handled = ETrue; |
|
153 break; |
|
154 case EAknSoftkeyOk: |
|
155 iContainer->HandleOkL(); |
|
156 handled = ETrue; |
|
157 break; |
|
158 |
|
159 case EAknSoftkeyCancel: |
|
160 iContainer->HandleCancelL(); |
|
161 handled = ETrue; |
|
162 break; |
|
163 |
|
164 case EAknCmdMark: |
|
165 case EAknCmdUnmark: |
|
166 case EAknMarkAll: |
|
167 case EAknUnmarkAll: |
|
168 iContainer->HandleMarkL(aCommand); |
|
169 handled = ETrue; |
|
170 iContainer->UpdateCbaL(); |
|
171 iContainer->UpdateToolbarButtonsState(); |
|
172 break; |
|
173 |
|
174 #ifdef __SERIES60_HELP |
|
175 case EAknCmdHelp: |
|
176 { |
|
177 iApiProvider.SetLastActiveViewId(Id()); |
|
178 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), |
|
179 AppUi()->AppHelpContextL()); |
|
180 handled = ETrue; |
|
181 break; |
|
182 } |
|
183 #endif //__SERIES60_HELP |
|
184 |
|
185 |
|
186 case EEikCmdExit: |
|
187 case EAknSoftkeyExit: |
|
188 AppUi()->HandleCommandL(aCommand); |
|
189 handled = ETrue; |
|
190 break; |
|
191 } |
|
192 |
|
193 if (handled) |
|
194 { |
|
195 return; |
|
196 } |
|
197 |
|
198 // Handle menu commands. |
|
199 switch (aCommand) |
|
200 { |
|
201 case EFeedsOpen: |
|
202 case EFeedsActivate: |
|
203 iContainer->HandleSelectionL(); |
|
204 break; |
|
205 |
|
206 case EFeedsUpdate: |
|
207 iContainer->HandleUpdateFeedL(); |
|
208 break; |
|
209 |
|
210 case EFeedsUpdateAll: |
|
211 iContainer->HandleUpdateFeedL(ETrue); |
|
212 break; |
|
213 |
|
214 case EFeedsNewFeed: |
|
215 iContainer->HandleNewFeedL(); |
|
216 iContainer->UpdateToolbarButtonsState(); |
|
217 break; |
|
218 |
|
219 case EFeedsNewFolder: |
|
220 iContainer->HandleNewFolderL(); |
|
221 iContainer->UpdateToolbarButtonsState(); |
|
222 break; |
|
223 |
|
224 case EFeedsEdit: |
|
225 case EFeedsRename: |
|
226 iContainer->HandleEditL(); |
|
227 iContainer->UpdateToolbarButtonsState(); |
|
228 break; |
|
229 |
|
230 case EFeedsDelete: |
|
231 iContainer->HandleDeleteL(); |
|
232 break; |
|
233 |
|
234 case EFeedsMove: |
|
235 iContainer->HandleMoveL(); |
|
236 break; |
|
237 |
|
238 case EFeedsMoveToFolder: |
|
239 iContainer->HandleMoveToFolderL(); |
|
240 break; |
|
241 |
|
242 case EFeedsExport: |
|
243 iContainer->HandleExportL(); |
|
244 break; |
|
245 |
|
246 case EWmlCmdDownloads: |
|
247 ApiProvider().BrCtlInterface().HandleCommandL( |
|
248 (TInt)TBrCtlDefs::ECommandShowDownloads + |
|
249 (TInt)TBrCtlDefs::ECommandIdBase ); |
|
250 break; |
|
251 |
|
252 default: |
|
253 iApiProvider.FeedsClientUtilities().HandleCommandL(Id(),aCommand); |
|
254 break; |
|
255 } |
|
256 } |
|
257 |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CFeedsFolderView::DoActivateL |
|
261 // |
|
262 // Called when the view is activated. |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 void CFeedsFolderView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, |
|
266 TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) |
|
267 { |
|
268 StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
269 StatusPane()->MakeVisible( ETrue ); |
|
270 ApiProvider().Display().ClearMessageInfo(); |
|
271 |
|
272 if (!iContainer) |
|
273 { |
|
274 iContainer = CFeedsFolderContainer::NewL( this, ApiProvider(), ClientRect() ); |
|
275 |
|
276 // Set the root folder. |
|
277 if (iRootFolder != NULL) |
|
278 { |
|
279 iContainer->RootFolderChangedL(*iRootFolder); |
|
280 } |
|
281 } |
|
282 |
|
283 if (!iContainerOnStack) |
|
284 { |
|
285 AppUi()->AddToViewStackL(*this, iContainer); |
|
286 iContainer->SetRect(ClientRect()); |
|
287 iContainer->MakeVisible(ETrue); |
|
288 iContainerOnStack = ETrue; |
|
289 // resize screen after calling SetRect. This way looks better |
|
290 iContainer->HandleResourceChange(KEikDynamicLayoutVariantSwitch); |
|
291 } |
|
292 |
|
293 iApiProvider.SetLastActiveViewId(Id()); |
|
294 iContainer->UpdateTitleL(); |
|
295 iContainer->UpdateListBoxL(iInitialItem); |
|
296 |
|
297 iContainer->UpdateCbaL(); |
|
298 |
|
299 } |
|
300 |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // CFeedsFolderView::DoDeactivate |
|
304 // |
|
305 // Called when the view is deactivated. |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 void CFeedsFolderView::DoDeactivate() |
|
309 { |
|
310 if (iContainerOnStack) |
|
311 { |
|
312 AppUi()->RemoveFromViewStack(*this, iContainer); |
|
313 iContainer->MakeVisible(EFalse); |
|
314 iContainer->ClearNavigationPane(); |
|
315 iContainerOnStack = EFalse; |
|
316 |
|
317 iInitialItem = iContainer->CurrentItemIndex(); |
|
318 } |
|
319 } |
|
320 |
|
321 |
|
322 // ----------------------------------------------------------------------------- |
|
323 // CFeedsFolderView::DynInitMenuPaneL |
|
324 // |
|
325 // Disables unrelated menu options. |
|
326 // ----------------------------------------------------------------------------- |
|
327 // |
|
328 void CFeedsFolderView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
329 { |
|
330 const CFeedsEntity* item = NULL; |
|
331 |
|
332 // Get the current item. |
|
333 item = iContainer->CurrentItem(); |
|
334 |
|
335 // Handle the main menu. |
|
336 if (aResourceId == R_FEEDS_FOLDER_VIEW_MENU) |
|
337 { |
|
338 // Dynamically build the menu. |
|
339 |
|
340 // Downloads (only if download menu not empty (ie, ongoing downloads) |
|
341 if (ApiProvider().BrCtlInterface().BrowserSettingL( TBrCtlDefs::ESettingsNumOfDownloads )) |
|
342 { |
|
343 iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EWmlCmdDownloads, R_FEEDS_OPTIONS_GO_DOWNLOADS); |
|
344 } |
|
345 |
|
346 iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsGoto, |
|
347 R_FEEDS_OPTIONS_GOTO, R_FEEDS_OPTIONS_GOTO_SUBMENU); |
|
348 |
|
349 iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsFeedsActions, |
|
350 R_FEEDS_OPTIONS_FEEDSACTIONS, R_FEEDS_OPTIONS_FEEDSACTIONS_SUBMENU); |
|
351 |
|
352 iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsEdit, |
|
353 R_FEEDS_OPTIONS_EDIT, R_FEEDS_OPTIONS_EDIT_SUBMENU); |
|
354 |
|
355 // these items only visible for non-empty folder |
|
356 if (item != NULL) |
|
357 { |
|
358 // Mark/Unmark submenu - only for non-empty folder |
|
359 iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsMarkUnmark, |
|
360 R_FEEDS_OPTIONS_MARKUNMARK, R_FEEDS_OPTIONS_MARKUNMARK_SUBMENU); |
|
361 } |
|
362 |
|
363 // ie, privacy submenu |
|
364 //iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsClear, |
|
365 // R_FEEDS_OPTIONS_CLEAR, R_FEEDS_OPTIONS_CLEAR_SUBMENU); |
|
366 |
|
367 iApiProvider.FeedsClientUtilities().AddCascadeL(*aMenuPane,EFeedsOptionsClear, |
|
368 R_FEEDS_OPTIONS_CLEAR, R_CLEAR_SUBMENU); |
|
369 } |
|
370 else if(aResourceId == R_FEEDS_OPTIONS_GOTO_SUBMENU) |
|
371 { |
|
372 // Back to Page (if page loaded) |
|
373 if ( iApiProvider.IsPageLoaded() ) |
|
374 { |
|
375 iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EWmlCmdBackToPage, R_BROWSER_MENU_ITEM_BACK_TO_PAGE ); |
|
376 } |
|
377 |
|
378 // Bookmarks view (if browser wasn't launched directly into feeds) |
|
379 if ( !iApiProvider.BrowserWasLaunchedIntoFeeds() ) |
|
380 { |
|
381 iApiProvider.FeedsClientUtilities().AddItemL( *aMenuPane, EWmlCmdFavourites, R_BROWSER_MENU_ITEM_FAVOURITES ); |
|
382 } |
|
383 } |
|
384 else if(aResourceId == R_FEEDS_OPTIONS_FEEDSACTIONS_SUBMENU) |
|
385 { |
|
386 if(iContainer && |
|
387 iContainer->iCurrentFolder && |
|
388 iContainer->iCurrentFolder->GetChildren().Count() > 0) |
|
389 { |
|
390 if (!(item->GetType() == EFolder) && !iContainer->IsMarkedItemFolder()) |
|
391 { |
|
392 // Update (only if feed has focus) |
|
393 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsUpdate, R_FEEDS_UPDATE); |
|
394 } |
|
395 |
|
396 // Update All (only for non-empty views/folders) |
|
397 if(iContainer->SearchForFeedL(iRootFolder)) |
|
398 { |
|
399 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsUpdateAll, R_FEEDS_UPDATE_ALL); |
|
400 } |
|
401 |
|
402 |
|
403 // Send (only for non-empty views/folders) |
|
404 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsExport, R_OPTIONS_EXPORT_FEEDS); |
|
405 } |
|
406 |
|
407 // Import Feeds |
|
408 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsImport, R_OPTIONS_IMPORT_FEEDS); |
|
409 |
|
410 // Create Feed |
|
411 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsNewFeed, R_FEEDS_NEW_FEED); |
|
412 } |
|
413 else if(aResourceId == R_FEEDS_OPTIONS_EDIT_SUBMENU) |
|
414 { |
|
415 if (item != NULL) |
|
416 { |
|
417 TInt markedcount = (iContainer && iContainer->MarkedItems()) ? iContainer->MarkedItems()->Count() : 0; |
|
418 |
|
419 // "Edit Feed" or "Rename Folder" depending upon which has focus |
|
420 if (markedcount < 1)// don't allow edit/rename if feed(s)/folder(s) are marked |
|
421 { |
|
422 if (item->GetType() == EFolder) |
|
423 { |
|
424 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsRename, R_FLDR_RENAME); |
|
425 } |
|
426 else |
|
427 { |
|
428 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsEdit, R_FEEDS_EDIT); |
|
429 } |
|
430 } |
|
431 |
|
432 // Delete (only if editable item has focus) |
|
433 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsDelete, R_FEEDS_DELETE); |
|
434 |
|
435 // move |
|
436 if ( iContainer && |
|
437 iContainer->iCurrentFolder && |
|
438 iContainer->iCurrentFolder->GetChildren().Count() >= 2 ) |
|
439 { |
|
440 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsMove, R_OPTIONS_ORG_MOVE); |
|
441 } |
|
442 |
|
443 // move to folder only if a feed has focus and there are folders available |
|
444 if (!(item->GetType() == EFolder)) |
|
445 { |
|
446 TInt folderCount = 0; |
|
447 iContainer->CountFolderFolders(iContainer->iRootFolder, folderCount); |
|
448 |
|
449 if(iContainer && (folderCount> 0) && !iContainer->IsMarkedItemFolder()) |
|
450 { |
|
451 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsMoveToFolder, R_OPTIONS_ORG_MOVE_TO_FOLDER); |
|
452 } |
|
453 } |
|
454 } |
|
455 |
|
456 // Create Folder |
|
457 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EFeedsNewFolder, R_OPTIONS_ORG_NEW_FOLDER); |
|
458 } |
|
459 else if(aResourceId == R_FEEDS_OPTIONS_MARKUNMARK_SUBMENU) |
|
460 { |
|
461 // Mark (or unmark) |
|
462 if(IsCurrentItemMarked()) |
|
463 { |
|
464 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EAknCmdUnmark, R_OPTIONS_LIST_UNMARK_ONE); |
|
465 } |
|
466 else |
|
467 { |
|
468 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EAknCmdMark, R_OPTIONS_LIST_MARK_ONE); |
|
469 } |
|
470 |
|
471 // Mark All |
|
472 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EAknMarkAll, R_OPTIONS_LIST_MARK_ALL); |
|
473 |
|
474 // Unmark ALL |
|
475 if (AnyMarkedItems()) |
|
476 { |
|
477 iApiProvider.FeedsClientUtilities().AddItemL(*aMenuPane, EAknUnmarkAll, R_OPTIONS_LIST_UNMARK_ALL); |
|
478 } |
|
479 } |
|
480 else if(aResourceId == R_FEEDS_OPTIONS_CLEAR_SUBMENU) |
|
481 { |
|
482 |
|
483 |
|
484 } |
|
485 iApiProvider.FeedsClientUtilities().DynInitMenuPaneL(aResourceId, aMenuPane ); |
|
486 } |
|
487 |
|
488 |
|
489 // ----------------------------------------------------------------------------- |
|
490 // CFeedsFolderView::UpdateCbaL |
|
491 // |
|
492 // Updates the options softkey to reflect the command set. |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 void CFeedsFolderView::UpdateCbaL(TInt aCommandSet) |
|
496 { |
|
497 if (Cba()) |
|
498 { |
|
499 Cba()->SetCommandSetL(aCommandSet); |
|
500 Cba()->DrawDeferred(); |
|
501 } |
|
502 } |
|
503 |
|
504 // ----------------------------------------------------------------------------- |
|
505 // CFeedsFolderView::RootFolderChangedL |
|
506 // |
|
507 // Called to notify the view the that root folder has changed. |
|
508 // ----------------------------------------------------------------------------- |
|
509 // |
|
510 void CFeedsFolderView::RootFolderChangedL(const CFeedsEntity& aRootFolder) |
|
511 { |
|
512 iRootFolder = &aRootFolder; |
|
513 |
|
514 if (iContainer != NULL) |
|
515 { |
|
516 iContainer->RootFolderChangedL(aRootFolder); |
|
517 iContainer->UpdateToolbarButtonsState(); |
|
518 } |
|
519 } |
|
520 |
|
521 |
|
522 // ----------------------------------------------------------------------------- |
|
523 // CFeedsFolderView::SetCurrentFolder |
|
524 // |
|
525 // Changes the current folder. |
|
526 // ----------------------------------------------------------------------------- |
|
527 // |
|
528 void CFeedsFolderView::SetCurrentFolder(const CFeedsEntity& aFolder, TBool aResetSelection) |
|
529 { |
|
530 if (iContainer != NULL) |
|
531 { |
|
532 iContainer->SetCurrentFolder(&aFolder, aResetSelection); |
|
533 } |
|
534 |
|
535 if (aResetSelection) |
|
536 { |
|
537 iInitialItem = 0; |
|
538 } |
|
539 } |
|
540 |
|
541 // --------------------------------------------------------------------------- |
|
542 // CFeedsFolderView::CommandSetResourceIdL |
|
543 // --------------------------------------------------------------------------- |
|
544 TInt CFeedsFolderView::CommandSetResourceIdL() |
|
545 { |
|
546 // It is never called, but this function have to be implemented |
|
547 return KWmlEmptyResourceId; |
|
548 } |
|
549 |
|
550 // --------------------------------------------------------- |
|
551 // CFeedsFolderView::HandleClientRectChange |
|
552 // --------------------------------------------------------- |
|
553 // |
|
554 void CFeedsFolderView::HandleClientRectChange() |
|
555 { |
|
556 if( iContainer ) |
|
557 { |
|
558 iContainer->SetRect( ClientRect() ); |
|
559 } |
|
560 } |
|
561 |
|
562 // ----------------------------------------------------------------------------- |
|
563 // CFeedsFolderView::UnreadCountChangedL |
|
564 // |
|
565 // Calculate the unread count based on delta, return the calculated value. |
|
566 // ----------------------------------------------------------------------------- |
|
567 // |
|
568 TInt CFeedsFolderView::UnreadCountChangedL( TInt aUnreadCountDelta ) |
|
569 { |
|
570 TInt unreadCount = 0; |
|
571 |
|
572 if (iContainer != NULL) |
|
573 { |
|
574 unreadCount = iContainer->UnreadCountChangedL( aUnreadCountDelta ); |
|
575 } |
|
576 |
|
577 return unreadCount; |
|
578 } |
|
579 |
|
580 // ----------------------------------------------------------------------------- |
|
581 // CFeedsFolderView::SetUnreadCount |
|
582 // |
|
583 // Set the unread count. |
|
584 // ----------------------------------------------------------------------------- |
|
585 // |
|
586 void CFeedsFolderView::SetUnreadCountL( TInt aUnreadCount ) |
|
587 { |
|
588 if (iContainer != NULL) |
|
589 { |
|
590 iContainer->SetUnreadCountL( aUnreadCount ); |
|
591 } |
|
592 } |
|
593 |
|
594 |
|
595 // ----------------------------------------------------------------------------- |
|
596 // CFeedsFolderView::AnyFoldersMarked |
|
597 // |
|
598 // returns ETrue if any Feeds folders are marked otherwise returns EFalse |
|
599 // ----------------------------------------------------------------------------- |
|
600 // |
|
601 TBool CFeedsFolderView::AnyFoldersMarked() |
|
602 { |
|
603 const CArrayFix<TInt>* markedIndexes = iContainer->MarkedItems(); |
|
604 const CFeedsEntity* markedItem = NULL; |
|
605 TInt i; |
|
606 |
|
607 for ( i = 0; i < markedIndexes->Count(); i++ ) |
|
608 { |
|
609 // Get the item. |
|
610 markedItem = iContainer->iCurrentFolder->GetChildren()[(*markedIndexes)[i]]; |
|
611 if ( markedItem != NULL && markedItem->GetType() == EFolder ) |
|
612 { |
|
613 return ETrue; |
|
614 } |
|
615 } |
|
616 |
|
617 return EFalse; |
|
618 } |
|
619 |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // CFeedsFolderView::AnyMarkedItems |
|
623 // |
|
624 // returns ETrue anything is marked otherwise returns EFalse |
|
625 // ----------------------------------------------------------------------------- |
|
626 // |
|
627 TBool CFeedsFolderView::AnyMarkedItems() |
|
628 { |
|
629 const CArrayFix<TInt>* markedIndexes = iContainer->MarkedItems(); |
|
630 |
|
631 if (markedIndexes->Count() > 0 ) |
|
632 { |
|
633 return ETrue; |
|
634 } |
|
635 else |
|
636 { |
|
637 return EFalse; |
|
638 } |
|
639 } |
|
640 |
|
641 // ----------------------------------------------------------------------------- |
|
642 // CFeedsFolderView::IsItemMarked |
|
643 // |
|
644 // returns ETrue if item is marked, otherwise returns EFalse |
|
645 // ----------------------------------------------------------------------------- |
|
646 // |
|
647 |
|
648 TBool CFeedsFolderView::IsCurrentItemMarked() |
|
649 { |
|
650 // Get the current item's index |
|
651 TInt currIndex = iContainer->CurrentItemIndex(); |
|
652 const CArrayFix<TInt>* markedIndexes = iContainer->MarkedItems(); |
|
653 |
|
654 if (markedIndexes->Count() > 0) |
|
655 { |
|
656 TKeyArrayFix key(0, ECmpTInt); |
|
657 TInt pos = 0; |
|
658 TInt retVal = markedIndexes->Find(currIndex,key,pos); |
|
659 if( retVal == KErrNone) |
|
660 { |
|
661 return ETrue; |
|
662 } |
|
663 } |
|
664 return EFalse; |
|
665 } |