|
1 /* |
|
2 * Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 * |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of the License "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * EmbedDev AB - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef PODCASTSHOWSVIEWH |
|
20 #define PODCASTSHOWSVIEWH |
|
21 |
|
22 #include <aknview.h> |
|
23 #include <aknlists.h> |
|
24 #include <eiklbo.h> |
|
25 #include <AknToolbarObserver.h> |
|
26 #include <AknToolbar.h> |
|
27 #include "ShowEngine.h" |
|
28 #include "FeedEngine.h" |
|
29 #include "PodcastModel.h" |
|
30 #include "Podcast.hrh" |
|
31 #include "PodcastListView.h" |
|
32 #include "Imagehandler.h" |
|
33 |
|
34 class CImageHandler; |
|
35 |
|
36 class CPodcastShowsView : public CPodcastListView, public MEikListBoxObserver, |
|
37 public MFeedEngineObserver, public MShowEngineObserver, public MImageHandlerCallback |
|
38 { |
|
39 public: |
|
40 static CPodcastShowsView* NewL(CPodcastModel& aPodcastModel); |
|
41 static CPodcastShowsView* NewLC(CPodcastModel& aPodcastModel); |
|
42 ~CPodcastShowsView(); |
|
43 protected: |
|
44 void ConstructL(); |
|
45 CPodcastShowsView(CPodcastModel& aPodcastModel); |
|
46 |
|
47 /** |
|
48 * Returns views id, intended for overriding by sub classes. |
|
49 * @return id for this view. |
|
50 */ |
|
51 TUid Id() const; |
|
52 |
|
53 /** |
|
54 * Handles a view activation and passes the message of type |
|
55 * @c aCustomMessageId. This function is intended for overriding by |
|
56 * sub classes. This function is called by @c AknViewActivatedL(). |
|
57 * @param aPrevViewId Specifies the view previously active. |
|
58 * @param aCustomMessageId Specifies the message type. |
|
59 * @param aCustomMessage The activation message. |
|
60 */ |
|
61 void DoActivateL(const TVwsViewId& aPrevViewId, |
|
62 TUid aCustomMessageId, |
|
63 const TDesC8& aCustomMessage); |
|
64 |
|
65 /** |
|
66 * View deactivation function intended for overriding by sub classes. |
|
67 * This function is called by @c AknViewDeactivated(). |
|
68 */ |
|
69 void DoDeactivate(); |
|
70 |
|
71 void UpdateListboxItemsL(); |
|
72 |
|
73 // From // MEikListBoxObserverClass |
|
74 void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
75 // From showengine observer |
|
76 void ShowListUpdatedL(); |
|
77 void ShowDownloadUpdatedL(TInt aBytesOfCurrentDownload, TInt aBytesTotal); |
|
78 void DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows); |
|
79 void ShowDownloadFinishedL(TUint aShowUid, TInt aError) ; |
|
80 // from MFeedEngineObserver |
|
81 void FeedDownloadStartedL(TFeedState aState,TUint aFeedUid); |
|
82 void FeedDownloadFinishedL(TFeedState aState,TUint aFeedUid, TInt aError); |
|
83 void FeedUpdateAllCompleteL(TFeedState aState); |
|
84 void OpmlParsingComplete(TUint /*aNumFeedsImported*/) {} |
|
85 |
|
86 /** |
|
87 * Command handling function intended for overriding by sub classes. |
|
88 * Default implementation is empty. |
|
89 * @param aCommand ID of the command to respond to. |
|
90 */ |
|
91 void HandleCommandL(TInt aCommand); |
|
92 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
93 |
|
94 void UpdateFeedUpdateStateL(); |
|
95 void UpdateShowItemL(TUint aUid, TInt aSizeDownloaded); |
|
96 void UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded = KErrNotFound); |
|
97 void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); |
|
98 void FormatShowInfoListBoxItemL(CShowInfo& aShowInfo, TInt aSizeDownloaded = 0); |
|
99 |
|
100 void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation); |
|
101 |
|
102 private: |
|
103 void GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex); |
|
104 void UpdateToolbar(); |
|
105 void DisplayShowInfoDialogL(); |
|
106 /* |
|
107 * Called by CImageHandler when an image has been loaded. |
|
108 * @param aError Error code given by the CImageHandler or 0 (zero) if the |
|
109 * image was loaded successfully. |
|
110 */ |
|
111 virtual void ImageOperationCompleteL(TInt aError); |
|
112 void SetShowPlayed(TBool aPlayed); |
|
113 void DeleteShow(); |
|
114 void UpdateViewTitleL(); |
|
115 void CreateIconsL(); |
|
116 void GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode); |
|
117 |
|
118 private: |
|
119 |
|
120 CPodcastModel& iPodcastModel; |
|
121 TBool iProgressAdded; |
|
122 TInt iLastImageHandlerError; |
|
123 TBool iSetTitlebarImage; |
|
124 }; |
|
125 |
|
126 #endif // PODCASTSHOWSVIEWH |
|
127 |
|
128 |