application/inc/PodcastListView.h
author teknolog
Tue, 27 Apr 2010 19:26:48 +0100
changeset 60 4d230e702aa3
parent 26 71493655568a
child 65 bcd88ba95046
permissions -rw-r--r--
Moved development branch from MCL to FCL
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
* All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
* This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
* under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
* which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
* Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
* EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
* Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
* Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#ifndef PODCASTLISTVIEWH
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#define PODCASTLISTVIEWH 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include <aknview.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include <aknlists.h> 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include <eiklbo.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include <aknsbasicbackgroundcontrolcontext.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include <AknToolbarObserver.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <AknToolbar.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include <aknlongtapdetector.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include <aknstyluspopupmenu.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include <aknprogressdialog.h> 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include <aknwaitdialog.h> 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#include "PodcastModel.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
class CAknDoubleLargeStyleListBox;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
class CEikFormattedCellListBox;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
class MKeyEventListener {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
public:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
class MPointerListener {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
public:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
virtual void PointerEventL(const TPointerEvent& aPointerEvent) = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
class CPodcastListContainer : public CCoeControl
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
    public: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
		CPodcastListContainer();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
		~CPodcastListContainer();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
		void ConstructL( const TRect& aRect, TInt aListboxFlags );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
		void SizeChanged();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
        TInt CountComponentControls() const;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
        CCoeControl* ComponentControl( TInt aIndex ) const;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
		void HandleResourceChange(TInt aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
		virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
		void SetKeyEventListener(MKeyEventListener *aKeyEventListener);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
		void SetPointerListener(MPointerListener *aPointerListener);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
		CEikFormattedCellListBox* Listbox();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
		void ScrollToVisible();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
    	void Draw(const TRect& aRect) const;
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 2
diff changeset
    65
    	
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 26
diff changeset
    66
    	void SetLongTapDetectedL(TBool aLongTapDetected);
26
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 13
diff changeset
    67
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 13
diff changeset
    68
    	CEikFormattedCellListBox * iListbox;		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
	protected:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
		TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
		virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
	private:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
		MKeyEventListener* iKeyEventListener;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
		MPointerListener* iPointerListener;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
        CAknsBasicBackgroundControlContext* iBgContext;
26
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 13
diff changeset
    78
		 TBool iLongTapDetected;
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 13
diff changeset
    79
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
class CPodcastListView : public CAknView, public MAknToolbarObserver,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
public MPointerListener, public MAknLongTapDetectorCallBack, 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
public MProgressDialogCallback, public MKeyEventListener
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
    public: 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
        ~CPodcastListView();
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 2
diff changeset
    89
		virtual void UpdateToolbar(TBool aVisible=ETrue) = 0;
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 26
diff changeset
    90
		TBool IsVisible();
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 26
diff changeset
    91
		
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
	protected:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
	    void ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
		CPodcastListView();	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
		/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
		 * Handles a view activation and passes the message of type 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
		 * @c aCustomMessageId. This function is intended for overriding by 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
		 * sub classes. This function is called by @c AknViewActivatedL().
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
		 * @param aPrevViewId Specifies the view previously active.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
		 * @param aCustomMessageId Specifies the message type.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
		 * @param aCustomMessage The activation message.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
		 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
		void DoActivateL(const TVwsViewId& aPrevViewId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
	                                  TUid aCustomMessageId,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
	                                  const TDesC8& aCustomMessage);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
	    /** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
		 * View deactivation function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
		 * This function is called by @c AknViewDeactivated().
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
		 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
		void DoDeactivate();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
		void HandleViewRectChange();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
		/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
		* Event handler for status pane size changes.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
		* @c CAknView provides an empty implementation for sub classes that do 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
		* not want to handle this event.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
		*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
		void HandleStatusPaneSizeChange();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
				
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
		/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
		* Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
		* Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
		* @param aCommand ID of the command to respond to. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
		*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
		void HandleCommandL(TInt aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
		void OfferToolbarEventL(TInt aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
		void DynInitToolbarL (TInt aResourceId, CAknToolbar *aToolbar);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
		virtual void UpdateListboxItemsL() = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
        void RunAboutDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
        void SetEmptyTextL(TInt aResourceId);
60
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 26
diff changeset
   137
        void ShowOkMessageL(TDesC &aText);
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 26
diff changeset
   138
        void ShowErrorMessageL(TDesC &aText);
4d230e702aa3 Moved development branch from MCL to FCL
teknolog
parents: 26
diff changeset
   139
        TInt ShowQueryMessageL(TDesC &aText);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
		void CloseToolbarExtension();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
		void ShowWaitDialogL(TDesC &aWaitText);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
		void CloseWaitDialog();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
		// From MAknLongTapDetectorCallBack
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
		virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
		// from MProgressDialogCallback		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
		void DialogDismissedL(TInt /*aButtonId*/) {}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
		// from MKeyEventListener
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
		virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
		// from MPointerListener
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
		void PointerEventL(const TPointerEvent& aPointerEvent);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
	protected:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
		 CPodcastListContainer* iListContainer;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
		 /** Previous activated view */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
		 TVwsViewId iPreviousView;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
		 /** Listbox flags which the listbox is created with*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
		 TInt iListboxFlags;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
		 CDesCArray* iItemArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
		 RArray<TUint> iItemIdArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
		 TBuf<1024> iListboxFormatbuffer;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
		 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
		 CAknToolbar *iToolbar;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
		 CAknStylusPopUpMenu* iStylusPopupMenu;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
		 CAknLongTapDetector* iLongTapDetector;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
		 CAknWaitDialog *iWaitDialog;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
    };
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
#endif // PODCASTBASEVIEWH
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176