--- a/application/inc/PodcastFeedView.h Sat Oct 30 14:28:25 2010 +0100
+++ b/application/inc/PodcastFeedView.h Sun Oct 31 14:03:27 2010 +0000
@@ -100,7 +100,6 @@
// from MImageHandlerCallback
void ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& aPodcastModel);
-
private:
void FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating = EFalse);
void HandleAddFeedL();
@@ -113,7 +112,7 @@
void HandleUpdateFeedL();
void GetFeedErrorText(TDes &aErrorMessage, TInt aErrorCode);
void OpmlParsingCompleteL(TInt aError, TUint aNumFeedsImported);
-
+ void LoadIcons();
private:
CPodcastModel& iPodcastModel;
TUint iFeedUpdating;
--- a/application/inc/PodcastListView.h Sat Oct 30 14:28:25 2010 +0100
+++ b/application/inc/PodcastListView.h Sun Oct 31 14:03:27 2010 +0000
@@ -35,9 +35,10 @@
class CEikFormattedCellListBox;
-class MKeyEventListener {
+class MContainerListener {
public:
virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) = 0;
+virtual void SizeChanged() = 0;
};
class MPointerListener {
@@ -56,33 +57,41 @@
CCoeControl* ComponentControl( TInt aIndex ) const;
void HandleResourceChange(TInt aType);
virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
- void SetKeyEventListener(MKeyEventListener *aKeyEventListener);
+ void SetContainerListener(MContainerListener *aContainerListener);
+ void SetListboxObserver(MEikListBoxObserver *aObserver);
- CEikFormattedCellListBox* Listbox();
+ CEikColumnListBox* Listbox();
+ void SetListboxIcons(CArrayPtr< CGulIcon >* aIcons);
+ CArrayPtr<CGulIcon>* ListboxIcons();
+ void SetListboxTextArrays(CDesCArray* aPortraitArray, CDesCArray* aLandscapeArray);
+ void SetEmptyText(const TDesC &aText);
void ScrollToVisible();
- void Draw(const TRect& aRect) const;
-
- CEikFormattedCellListBox * iListbox;
+ void Draw(const TRect& aRect) const;
- protected:
+ protected:
TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
private:
- MKeyEventListener* iKeyEventListener;
+ CAknSingleLargeStyleListBox * iListboxLandscape;
+ CAknDoubleLargeStyleListBox * iListboxPortrait;
+ MContainerListener* iContainerListener;
CAknsBasicBackgroundControlContext* iBgContext;
+ CEikColumnListBox * iListbox;
+ TBool iLandscape;
};
class CPodcastListView : public CAknView, public MAknToolbarObserver,
-public MProgressDialogCallback, public MKeyEventListener
+public MProgressDialogCallback, public MContainerListener, MEikListBoxObserver
{
public:
~CPodcastListView();
virtual void UpdateToolbar(TBool aVisible=ETrue) = 0;
TBool IsVisible();
-
+
protected:
- void ConstructL();
+ void SwitchListbox();
+ void ConstructL();
CPodcastListView();
/**
@@ -136,9 +145,12 @@
// from MProgressDialogCallback
void DialogDismissedL(TInt /*aButtonId*/) {}
- // from MKeyEventListener
+ // from MContainerListener
virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
-
+ virtual void SizeChanged() {};
+ void ResetContainer();
+
+ virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)=0;
protected:
CPodcastListContainer* iListContainer;
/** Previous activated view */
@@ -148,12 +160,15 @@
TInt iListboxFlags;
CDesCArray* iItemArray;
+ CDesCArray* iItemArrayShort;
RArray<TUint> iItemIdArray;
-
+
TBuf<1024> iListboxFormatbuffer;
+ TBuf<1024> iListboxFormatbufferShort;
CAknToolbar *iToolbar;
CAknWaitDialog *iWaitDialog;
+ TBool flipFlop;
};
#endif // PODCASTBASEVIEWH
--- a/application/inc/PodcastSearchView.h Sat Oct 30 14:28:25 2010 +0100
+++ b/application/inc/PodcastSearchView.h Sun Oct 31 14:03:27 2010 +0000
@@ -78,7 +78,7 @@
* @param aCommand ID of the command to respond to.
*/
void HandleCommandL(TInt aCommand);
-
+
private:
CPodcastModel& iPodcastModel;
TBool iSearchRunning;
--- a/application/inc/PodcastShowsView.h Sat Oct 30 14:28:25 2010 +0100
+++ b/application/inc/PodcastShowsView.h Sun Oct 31 14:03:27 2010 +0000
@@ -108,7 +108,7 @@
void HandleDeleteShow();
void UpdateViewTitleL();
void GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode);
-
+
protected:
CPodcastModel& iPodcastModel;
--- a/application/src/PodcastFeedView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastFeedView.cpp Sun Oct 31 14:03:27 2010 +0000
@@ -40,7 +40,9 @@
#define KMaxMessageLength 200
#define KMaxTitleLength 100
-_LIT(KFeedFormat, "%d\t%S\t%S%S");
+_LIT(KFeedFormatPortrait, "%d\t%S\t%S%S");
+//_LIT(KFeedFormatPortrait, "%d\t%S");
+_LIT(KFeedFormatLandscape, "%d\t%S");
enum
{
EFeedIcon
@@ -61,6 +63,40 @@
return self;
}
+void CPodcastFeedView::LoadIcons()
+ {
+ iFeedIdForIconArray.Reset();
+
+ CFbsBitmap* bitmap = NULL;
+ CFbsBitmap* mask = NULL;
+ _LIT(KAsterisk, "*");
+ // Load the bitmap for empty icon
+ TFileName fname;
+ fname.Copy(KAsterisk);
+ TParsePtr parser(fname);
+ CArrayPtrFlat< CGulIcon > *iconArray= new(ELeave) CArrayPtrFlat< CGulIcon >(1);
+ CleanupStack::PushL( iconArray );
+
+ // Load svg.-image and mask with a single call
+ AknIconUtils::CreateIconL(bitmap,
+ mask,
+ iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
+ EMbmPodcastFeed,
+ EMbmPodcastFeed_mask);
+
+ /*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40);
+ * */
+ CleanupStack::PushL( bitmap );
+ // Load the mask for feed icon
+ //mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );
+ CleanupStack::PushL( mask );
+ // Append the feed icon to icon array
+ iconArray->AppendL( CGulIcon::NewL( bitmap, mask ) );
+ CleanupStack::Pop(2); // bitmap, mask
+ iListContainer->SetListboxIcons(iconArray);
+ CleanupStack::Pop(iconArray); // icons
+ }
+
CPodcastFeedView::CPodcastFeedView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel)
{
iFirstActivateAfterLaunch = ETrue;
@@ -75,37 +111,9 @@
iFeedsFormat = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_STATUS_FORMAT);
CPodcastListView::ConstructL();
iPodcastModel.FeedEngine().AddObserver(this);
- CArrayPtr< CGulIcon >* icons = new(ELeave) CArrayPtrFlat< CGulIcon >(1);
- CleanupStack::PushL( icons );
-
- CFbsBitmap* bitmap = NULL;
- CFbsBitmap* mask = NULL;
- // Load the bitmap for empty icon
- TFileName fname = KAsterisk;
- TParsePtr parser(fname);
+ SetEmptyTextL(R_PODCAST_NO_FEEDS);
- SetEmptyTextL(R_PODCAST_NO_FEEDS);
-
- // Load svg.-image and mask with a single call
- AknIconUtils::CreateIconL(bitmap,
- mask,
- iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
- EMbmPodcastFeed,
- EMbmPodcastFeed_mask);
-
- /*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40);
- * */
- CleanupStack::PushL( bitmap );
- // Load the mask for feed icon
- //mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );
- CleanupStack::PushL( mask );
- // Append the feed icon to icon array
- icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
- CleanupStack::Pop(2); // bitmap, mask
- iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
- CleanupStack::Pop(icons); // icons
-
- iListContainer->Listbox()->SetListBoxObserver(this);
+ LoadIcons();
iUpdater = CPodcastFeedViewUpdater::NewL(*this);
DP("CPodcastFeedView::ConstructL END");
@@ -145,7 +153,10 @@
itemProps.SetDimmed(EFalse);
iItemArray->Delete(aIndex);
iItemArray->InsertL(aIndex, iListboxFormatbuffer);
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
+ iItemArrayShort->Delete(aIndex);
+ iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
+
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
// If item is visible, redraw it
if (iListContainer->Listbox()->TopItemIndex() <= aIndex
&& iListContainer->Listbox()->BottomItemIndex() >= aIndex)
@@ -207,7 +218,7 @@
void CPodcastFeedView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType)
{
- DP("CPodcastFeedView::HandleListBoxEventL BEGIN");
+// DP("CPodcastFeedView::HandleListBoxEventL BEGIN");
switch(aEventType)
{
@@ -231,7 +242,7 @@
default:
break;
}
- DP("CPodcastFeedView::HandleListBoxEventL END");
+// DP("CPodcastFeedView::HandleListBoxEventL END");
}
void CPodcastFeedView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
@@ -272,6 +283,7 @@
void CPodcastFeedView::UpdateFeedInfoStatusL(TUint aFeedUid, TBool aIsUpdating)
{
+ DP("CPodcastFeedView::UpdateFeedInfoStatusL BEGIN");
const RFeedInfoArray& feeds = iPodcastModel.FeedEngine().GetSortedFeeds();
// Find the index for the feed i both the feed-array and the listbox
@@ -305,6 +317,8 @@
iItemIdArray.InsertL(aFeedUid, feedsIdx);
iItemArray->Delete(listboxIdx);
iItemArray->InsertL(feedsIdx, KNullDesC);
+ iItemArrayShort->Delete(listboxIdx);
+ iItemArrayShort->InsertL(feedsIdx, KNullDesC);
iListContainer->Listbox()->HandleItemAdditionL();
}
// Update the listbox info
@@ -318,10 +332,12 @@
{
iListContainer->Listbox()->DrawItem(k);
}
+ DP("CPodcastFeedView::UpdateFeedInfoStatusL END");
}
void CPodcastFeedView::FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating)
{
+ DP("CPodcastFeedView::FormatFeedInfoListBoxItemL BEGIN");
TBuf<KMaxShortDateFormatSpec*2> updatedDate;
TBuf<KMaxUnplayedFeedsLength> unplayedShows;
TUint unplayedCount = 0;
@@ -371,7 +387,7 @@
updatedDate.Zero();
}
}
- CArrayPtr<CGulIcon>* icons = iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->IconArray();
+
iconIndex = iFeedIdForIconArray.Find(aFeedInfo.Uid());
if(iconIndex == KErrNotFound && aFeedInfo.FeedIcon() != NULL && aFeedInfo.ImageFileName().Length() > 0 &&
aFeedInfo.FeedIcon()->SizeInPixels().iHeight > 0 &&
@@ -382,6 +398,8 @@
CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bmpCopy);
bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle());
+ CArrayPtr<CGulIcon>* icons = iListContainer->ListboxIcons();
+
icons->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL));
iFeedIdForIconArray.Append(aFeedInfo.Uid());
@@ -396,8 +414,10 @@
if (unplayedShows.Length() > 0 && updatedDate.Length() > 0) {
unplayedShows.Insert(0,_L(", "));
}
-
- iListboxFormatbuffer.Format(KFeedFormat(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
+
+ iListboxFormatbuffer.Format(KFeedFormatPortrait(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
+ iListboxFormatbufferShort.Format(KFeedFormatLandscape(), iconIndex, &(aFeedInfo.Title()));
+ DP("CPodcastFeedView::FormatFeedInfoListBoxItemL END");
}
void CPodcastFeedView::ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& /*aPodcastModel*/)
@@ -408,7 +428,8 @@
}
void CPodcastFeedView::UpdateFeedInfoDataL(CFeedInfo* aFeedInfo, TInt aIndex, TBool aIsUpdating )
- {
+ {
+ DP("CPodcastFeedView::UpdateFeedInfoDataL BEGIN");
TListItemProperties itemProps;
itemProps.SetDimmed(aIsUpdating);
FormatFeedInfoListBoxItemL(*aFeedInfo, aIsUpdating);
@@ -417,16 +438,20 @@
if (iListboxFormatbuffer.Compare(compareTo) != 0) {
iItemArray->Delete(aIndex);
+ iItemArrayShort->Delete(aIndex);
if(aIndex>= iItemArray->MdcaCount())
{
iItemArray->AppendL(iListboxFormatbuffer);
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
}
else
{
iItemArray->InsertL(aIndex, iListboxFormatbuffer);
+ iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
}
}
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
+ DP("CPodcastFeedView::UpdateFeedInfoDataL END");
}
@@ -456,13 +481,16 @@
while (iItemArray->Count() < nbrItems)
{
iItemArray->AppendL(KNullDesC);
+ iItemArrayShort->AppendL(KNullDesC);
TListItemProperties itemProps;
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(iItemArray->Count() - 1, itemProps);
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(iItemArray->Count() - 1, itemProps);
}
while (iItemArray->Count() > nbrItems)
{
iItemArray->Delete(iItemArray->Count() - 1);
+ iItemArrayShort->Delete(iItemArray->Count() - 1);
}
+ //iListContainer->Listbox()->
iUpdater->StartUpdate(nbrItems);
}
else
@@ -471,12 +499,13 @@
TBuf<KMaxFeedNameLength> itemName;
iEikonEnv->ReadResourceL(itemName, R_PODCAST_FEEDS_NO_FEEDS);
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
TListItemProperties itemProps;
itemProps.SetDimmed(ETrue);
itemProps.SetHiddenSelection(ETrue);
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
}
iListContainer->Listbox()->HandleItemAdditionL();
DP("CPodcastFeedView::UpdateListboxItemsL END");
@@ -762,6 +791,7 @@
{
iPodcastModel.FeedEngine().RemoveFeedL(iItemIdArray[index]);
iItemArray->Delete(index);
+ iItemArrayShort->Delete(index);
iItemIdArray.Remove(index);
iListContainer->Listbox()->HandleItemRemovalL();
iListContainer->Listbox()->DrawNow();
--- a/application/src/PodcastListView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastListView.cpp Sun Oct 31 14:03:27 2010 +0000
@@ -30,6 +30,8 @@
#include <aknquerydialog.h>
#include <barsread.h>
#include <akntitle.h>
+#include <akniconarray.h>
+#include <EIKCLBD.H>
#include "buildno.h"
@@ -39,46 +41,69 @@
{
}
-void CPodcastListContainer::SetKeyEventListener(MKeyEventListener *aKeyEventListener)
+void CPodcastListContainer::SetContainerListener(MContainerListener *aContainerListener)
{
- iKeyEventListener = aKeyEventListener;
+ iContainerListener = aContainerListener;
}
TKeyResponse CPodcastListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
TKeyResponse response = iListbox->OfferKeyEventL(aKeyEvent, aType);
- if (iKeyEventListener)
- iKeyEventListener->OfferKeyEventL(aKeyEvent, aType);
+ if (iContainerListener)
+ iContainerListener->OfferKeyEventL(aKeyEvent, aType);
return response;
}
void CPodcastListContainer::ConstructL( const TRect& aRect, TInt aListboxFlags )
{
+ DP("CPodcastListContainer::ConstructL BEGIN");
CreateWindowL();
iBgContext =
CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain,
aRect,
ETrue );
-
+
+ iListboxLandscape = new (ELeave) CAknSingleLargeStyleListBox;
+ iListboxLandscape->ConstructL(this, aListboxFlags);
+ iListboxLandscape->SetMopParent( this );
+ iListboxLandscape->SetContainerWindowL(*this);
+ iListboxLandscape->CreateScrollBarFrameL(ETrue);
+ iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
+ iListboxLandscape->SetSize(aRect.Size());
+ iListboxLandscape->MakeVisible(EFalse);
+
+ iListboxPortrait = new (ELeave) CAknDoubleLargeStyleListBox;
+ iListboxPortrait->ConstructL(this, aListboxFlags);
+ iListboxPortrait->SetMopParent( this );
+ iListboxPortrait->SetContainerWindowL(*this);
+ iListboxPortrait->CreateScrollBarFrameL(ETrue);
+ iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
+ iListboxPortrait->SetSize(aRect.Size());
+ iListboxPortrait->MakeVisible(EFalse);
+
+ if (aRect.Width() > aRect.Height())
+ {
+ iLandscape = ETrue;
+ iListbox = iListboxLandscape;
+ iListboxLandscape->MakeVisible(ETrue);
+ }
+ else
+ {
+ iLandscape = EFalse;
+ iListboxPortrait->MakeVisible(ETrue);
+ iListbox = (CEikColumnListBox*) iListboxPortrait;
+ }
+
+ MakeVisible(EFalse);
+
// Set the windows size
- SetRect( aRect );
- iListbox =static_cast<CEikFormattedCellListBox*>( new (ELeave) CAknDoubleLargeStyleListBox);
- iListbox->ConstructL(this, aListboxFlags);
- iListbox->SetMopParent( this );
- iListbox->SetContainerWindowL(*this);
- iListbox->CreateScrollBarFrameL(ETrue);
- iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
-
- iListbox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
+ SetRect( aRect );
- iListbox->SetSize(aRect.Size());
- iListbox->MakeVisible(ETrue);
- MakeVisible(EFalse);
-
// Activate the window, which makes it ready to be drawn
ActivateL();
+ DP("CPodcastListContainer::ConstructL END");
}
TInt CPodcastListContainer::CountComponentControls() const
@@ -91,7 +116,10 @@
switch ( aIndex )
{
case 0:
- return iListbox;
+ if (iLandscape)
+ return iListboxLandscape;
+ else
+ return iListboxPortrait;
default:
return NULL;
}
@@ -112,20 +140,77 @@
iListbox->ScrollToMakeItemVisible(iListbox->CurrentItemIndex());
}
}
+
void CPodcastListContainer::SizeChanged()
{
- DP2("CPodcastListContainer::SizeChanged(), width=%d, height=%d",Size().iWidth, Size().iHeight);
- if(iListbox != NULL)
- {
- iListbox->SetSize(Size());
- }
+ DP2("CPodcastListContainer::SizeChanged() BEGIN, width=%d, height=%d",Size().iWidth, Size().iHeight);
+
+ iLandscape = Size().iWidth > Size().iHeight;
+
+ if (iContainerListener)
+ iContainerListener->SizeChanged();
+
+ if (iLandscape)
+ {
+ iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
+ iListboxPortrait->UpdateScrollBarsL();
+ iListboxPortrait->MakeVisible(EFalse);
+
+ iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
+ iListboxLandscape->MakeVisible(ETrue);
+ iListboxLandscape->SetFocus(ETrue, EDrawNow);
+ iListbox = iListboxLandscape;
+ }
+ else
+ {
+ iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
+ iListboxLandscape->UpdateScrollBarsL();
+ iListboxLandscape->MakeVisible(EFalse);
+
+ iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
+ iListboxPortrait->MakeVisible(ETrue);
+ iListboxPortrait->SetFocus(ETrue, EDrawNow);
+ iListbox = (CEikColumnListBox*) iListboxPortrait;
+ }
+
+ iListbox->SetSize(Size());
+ ActivateL();
+ DrawNow();
+ DP("CPodcastListContainer::SizeChanged END");
}
-CEikFormattedCellListBox* CPodcastListContainer::Listbox()
+CEikColumnListBox* CPodcastListContainer::Listbox()
{
return iListbox;
}
+void CPodcastListContainer::SetListboxObserver(MEikListBoxObserver *aObserver)
+ {
+ iListboxLandscape->SetListBoxObserver(aObserver);
+ iListboxPortrait->SetListBoxObserver(aObserver);
+ }
+
+void CPodcastListContainer::SetListboxIcons(CArrayPtr< CGulIcon >* aIcons)
+{
+ iListboxLandscape->ItemDrawer()->ColumnData()->SetIconArray(aIcons);
+ iListboxPortrait->ItemDrawer()->FormattedCellData()->SetIconArrayL(aIcons);
+}
+
+CArrayPtr<CGulIcon>* CPodcastListContainer::ListboxIcons()
+ {
+ if (iListboxLandscape == iListbox)
+ return iListboxLandscape->ItemDrawer()->ColumnData()->IconArray();
+ else
+ return iListboxPortrait->ItemDrawer()->FormattedCellData()->IconArray();
+ }
+
+void CPodcastListContainer::SetListboxTextArrays(CDesCArray* aPortraitArray, CDesCArray* aLandscapeArray)
+ {
+ iListboxLandscape->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
+ iListboxLandscape->Model()->SetItemTextArray(aLandscapeArray);
+ iListboxPortrait->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
+ iListboxPortrait->Model()->SetItemTextArray(aPortraitArray);
+ }
CPodcastListContainer::~CPodcastListContainer()
{
@@ -133,6 +218,11 @@
delete iBgContext;
}
+void CPodcastListContainer::SetEmptyText(const TDesC &aText)
+ {
+ iListboxPortrait->View()->SetListEmptyTextL(aText);
+ iListboxLandscape->View()->SetListEmptyTextL(aText);
+ }
void CPodcastListContainer::Draw(const TRect& aRect) const
{
@@ -160,27 +250,35 @@
void CPodcastListView::ConstructL()
{
DP("CPodcastListView::ConstructL BEGIN");
+
iListContainer = new (ELeave) CPodcastListContainer;
- iListContainer->ConstructL(ClientRect(), iListboxFlags);
+ TRect rect = ClientRect();
+
+ iListContainer->ConstructL(rect, iListboxFlags);
iListContainer->SetMopParent(this);
iListContainer->ActivateL();
+
iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran);
- iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray);
- iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
-
+ iItemArrayShort = new (ELeave)CDesCArrayFlat(KDefaultGran);
+
+ iListContainer->SetListboxTextArrays(iItemArray, iItemArrayShort);
+ iListContainer->SetContainerListener(this);
+ iListContainer->SetListboxObserver(this);
+
if (Toolbar()) {
iToolbar = Toolbar();
iToolbar->SetToolbarObserver(this);
}
- iListContainer->SetKeyEventListener(this);
DP("CPodcastListView::ConstructL END");
}
void CPodcastListView::HandleViewRectChange()
-{
- if ( iListContainer )
+{
+ TBool wasVisible = iListContainer->IsVisible();
+
+ if ( iListContainer )
{
iListContainer->SetRect( ClientRect() );
}
@@ -190,11 +288,7 @@
{
DP2("CPodcastListView::HandleStatusPaneSizeChange(), width=%d, height=%d", ClientRect().Width(), ClientRect().Height());
- if ( iListContainer )
- {
- iListContainer->SetRect( ClientRect() );
- }
-
+ HandleViewRectChange();
}
@@ -207,6 +301,7 @@
}
delete iItemArray;
+ delete iItemArrayShort;
iItemIdArray.Close();
}
@@ -291,7 +386,7 @@
void CPodcastListView::SetEmptyTextL(TInt aResourceId)
{
HBufC* emptyText = iEikonEnv->AllocReadResourceLC(aResourceId);
- iListContainer->Listbox()->View()->SetListEmptyTextL(*emptyText);
+ iListContainer->SetEmptyText(*emptyText);
CleanupStack::PopAndDestroy(emptyText);
}
@@ -375,4 +470,3 @@
}
return EKeyWasNotConsumed;
}
-
--- a/application/src/PodcastQueueView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastQueueView.cpp Sun Oct 31 14:03:27 2010 +0000
@@ -61,8 +61,6 @@
CPodcastListView::ConstructL();
CreateIconsL();
-
- iListContainer->Listbox()->SetListBoxObserver(this);
iPodcastModel.FeedEngine().AddObserver(this);
iPodcastModel.ShowEngine().AddObserver(this);
@@ -185,10 +183,11 @@
}
else
{
- iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
+ //iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
iListContainer->Listbox()->Reset();
iItemIdArray.Reset();
iItemArray->Reset();
+ iItemArrayShort->Reset();
if (len > 0)
{
@@ -198,11 +197,13 @@
FormatShowInfoListBoxItemL(*si);
iItemIdArray.Append(si->Uid());
iItemArray->AppendL(iListboxFormatbuffer);
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
}
}
else
{
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
itemProps.SetDimmed(ETrue);
--- a/application/src/PodcastSearchView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastSearchView.cpp Sun Oct 31 14:03:27 2010 +0000
@@ -43,6 +43,7 @@
#define KMaxMessageLength 200
#define KMaxTitleLength 100
_LIT(KSearchResultFormat, "%d\t%S\t%S");
+_LIT(KSearchResultFormatLandscape, "%d\t%S");
CPodcastSearchView* CPodcastSearchView::NewL(CPodcastModel& aPodcastModel)
{
@@ -84,10 +85,8 @@
icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
CleanupStack::Pop(2); // bitmap, mask
- iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
+ iListContainer->SetListboxIcons(icons);
CleanupStack::Pop(icons); // icons
-
- iListContainer->Listbox()->SetListBoxObserver(this);
SetEmptyTextL(R_PODCAST_EMPTY_SEARCH);
}
@@ -163,7 +162,7 @@
TInt len = searchItems->Count();
TListItemProperties itemProps;
iListContainer->Listbox()->Reset();
- iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
+ //iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
iItemIdArray.Reset();
iItemArray->Reset();
@@ -180,7 +179,9 @@
PodcastUtils::RemoveAllFormatting(descr);
iListboxFormatbuffer.Format(KSearchResultFormat(), iconIndex, &fi->Title(), &descr);
iItemArray->AppendL(iListboxFormatbuffer);
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(i, itemProps);
+ iListboxFormatbufferShort.Format(KSearchResultFormatLandscape(), iconIndex, &fi->Title());
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(i, itemProps);
}
}
else
@@ -188,12 +189,13 @@
TBuf<KMaxFeedNameLength> itemName;
iEikonEnv->ReadResourceL(itemName, R_PODCAST_NO_SEARCH_RESULTS);
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
TListItemProperties itemProps;
itemProps.SetDimmed(ETrue);
itemProps.SetHiddenSelection(ETrue);
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
}
iListContainer->Listbox()->HandleItemAdditionL();
DP("CPodcastSearchView::UpdateListboxItemsL END");
--- a/application/src/PodcastShowsView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastShowsView.cpp Sun Oct 31 14:03:27 2010 +0000
@@ -37,7 +37,8 @@
_LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
_LIT(KShowsSizeFormatS60, "%.1f MB");
-_LIT(KShowFormat, "%d\t%S\t%S%S\t");
+_LIT(KShowFormat, "%d\t%S\t%S%S");
+_LIT(KShowFormatLandscape, "%d\t%S");
// these must correspond with TShowsIconIndex
@@ -109,9 +110,7 @@
CPodcastListView::ConstructL();
CreateIconsL();
-
- iListContainer->Listbox()->SetListBoxObserver(this);
-
+
iPodcastModel.FeedEngine().AddObserver(this);
iPodcastModel.ShowEngine().AddObserver(this);
}
@@ -140,7 +139,8 @@
pos+=2;
}
- iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
+ //iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
+ iListContainer->SetListboxIcons(icons);
CleanupStack::Pop(icons); // icons
}
@@ -452,6 +452,7 @@
}
iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
+ iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title());
}
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
@@ -463,13 +464,17 @@
{
FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
iItemArray->Delete(aIndex);
+ iItemArrayShort->Delete(aIndex);
+
if(aIndex>= iItemArray->MdcaCount())
{
iItemArray->AppendL(iListboxFormatbuffer);
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
}
else
{
iItemArray->InsertL(aIndex, iListboxFormatbuffer);
+ iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
}
}
@@ -529,11 +534,12 @@
}
else
{
- iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
+ //iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
iListContainer->Listbox()->Reset();
iItemIdArray.Reset();
iItemArray->Reset();
-
+ iItemArrayShort->Reset();
+
if (len > 0)
{
for (TInt i=0; i<len; i++)
@@ -542,11 +548,14 @@
FormatShowInfoListBoxItemL(*si);
iItemIdArray.Append(si->Uid());
iItemArray->AppendL(iListboxFormatbuffer);
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
+
}
}
else
{
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
itemProps.SetDimmed(ETrue);