--- a/application/inc/PodcastListView.h Sun Oct 31 12:32:39 2010 +0000
+++ b/application/inc/PodcastListView.h Sun Oct 31 13:17:32 2010 +0000
@@ -62,25 +62,21 @@
CEikColumnListBox* Listbox();
void SetListboxIcons(CArrayPtr< CGulIcon >* aIcons);
CArrayPtr<CGulIcon>* ListboxIcons();
- void SetTextArray(CDesCArray* aArray);
+ void SetListboxTextArrays(CDesCArray* aPortraitArray, CDesCArray* aLandscapeArray);
+ void SetEmptyText(const TDesC &aText);
void ScrollToVisible();
void Draw(const TRect& aRect) const;
- TBool IsLandscape();
-
- public:
- CAknSingleLargeStyleListBox * iListboxLandscape;
- CAknDoubleLargeStyleListBox * iListboxPortrait;
protected:
TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
private:
+ CAknSingleLargeStyleListBox * iListboxLandscape;
+ CAknDoubleLargeStyleListBox * iListboxPortrait;
MContainerListener* iContainerListener;
CAknsBasicBackgroundControlContext* iBgContext;
-
CEikColumnListBox * iListbox;
TBool iLandscape;
- CDesCArray* iItemArrayShort;
};
@@ -162,14 +158,15 @@
TInt iListboxFlags;
CDesCArray* iItemArray;
+ CDesCArray* iItemArrayShort;
RArray<TUint> iItemIdArray;
-
+
TBuf<1024> iListboxFormatbuffer;
+ TBuf<1024> iListboxFormatbufferShort;
CAknToolbar *iToolbar;
CAknWaitDialog *iWaitDialog;
TBool flipFlop;
- CArrayPtr< CGulIcon >* iIconArray;
};
#endif // PODCASTBASEVIEWH
--- a/application/src/PodcastFeedView.cpp Sun Oct 31 12:32:39 2010 +0000
+++ b/application/src/PodcastFeedView.cpp Sun Oct 31 13:17:32 2010 +0000
@@ -74,9 +74,7 @@
void CPodcastFeedView::LoadIcons()
{
iFeedIdForIconArray.Reset();
- iItemArray->Reset();
-
- DP("before icons");
+
CFbsBitmap* bitmap = NULL;
CFbsBitmap* mask = NULL;
_LIT(KAsterisk, "*");
@@ -84,8 +82,8 @@
TFileName fname;
fname.Copy(KAsterisk);
TParsePtr parser(fname);
- iIconArray= new(ELeave) CArrayPtrFlat< CGulIcon >(1);
- CleanupStack::PushL( iIconArray );
+ CArrayPtrFlat< CGulIcon > *iconArray= new(ELeave) CArrayPtrFlat< CGulIcon >(1);
+ CleanupStack::PushL( iconArray );
// Load svg.-image and mask with a single call
AknIconUtils::CreateIconL(bitmap,
@@ -101,10 +99,10 @@
//mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );
CleanupStack::PushL( mask );
// Append the feed icon to icon array
- iIconArray->AppendL( CGulIcon::NewL( bitmap, mask ) );
+ iconArray->AppendL( CGulIcon::NewL( bitmap, mask ) );
CleanupStack::Pop(2); // bitmap, mask
- iListContainer->SetListboxIcons(iIconArray);
- CleanupStack::Pop(iIconArray); // icons
+ iListContainer->SetListboxIcons(iconArray);
+ CleanupStack::Pop(iconArray); // icons
}
CPodcastFeedView::CPodcastFeedView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel)
@@ -163,7 +161,9 @@
itemProps.SetDimmed(EFalse);
iItemArray->Delete(aIndex);
iItemArray->InsertL(aIndex, iListboxFormatbuffer);
- iListContainer->SetTextArray(iItemArray);
+ iItemArrayShort->Delete(aIndex);
+ iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
+
iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
// If item is visible, redraw it
if (iListContainer->Listbox()->TopItemIndex() <= aIndex
@@ -291,6 +291,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
@@ -324,7 +325,8 @@
iItemIdArray.InsertL(aFeedUid, feedsIdx);
iItemArray->Delete(listboxIdx);
iItemArray->InsertL(feedsIdx, KNullDesC);
- iListContainer->SetTextArray(iItemArray);
+ iItemArrayShort->Delete(listboxIdx);
+ iItemArrayShort->InsertL(feedsIdx, KNullDesC);
iListContainer->Listbox()->HandleItemAdditionL();
}
// Update the listbox info
@@ -338,11 +340,12 @@
{
iListContainer->Listbox()->DrawItem(k);
}
+ DP("CPodcastFeedView::UpdateFeedInfoStatusL END");
}
void CPodcastFeedView::FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating)
{
- DP("CPodcastFeedView::FormatFeedInfoListBoxItemL");
+ DP("CPodcastFeedView::FormatFeedInfoListBoxItemL BEGIN");
TBuf<KMaxShortDateFormatSpec*2> updatedDate;
TBuf<KMaxUnplayedFeedsLength> unplayedShows;
TUint unplayedCount = 0;
@@ -403,11 +406,13 @@
CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bmpCopy);
bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle());
- iIconArray->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL));
+ CArrayPtr<CGulIcon>* icons = iListContainer->ListboxIcons();
+
+ icons->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL));
iFeedIdForIconArray.Append(aFeedInfo.Uid());
CleanupStack::Pop(bmpCopy);
- iconIndex = iIconArray->Count()-1;
+ iconIndex = icons->Count()-1;
}
else
{
@@ -419,6 +424,8 @@
}
iListboxFormatbuffer.Format(KFeedFormatPortrait(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
+ iListboxFormatbufferShort.Format(KFeedFormatLandscape(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
+ DP("CPodcastFeedView::FormatFeedInfoListBoxItemL END");
}
void CPodcastFeedView::ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& /*aPodcastModel*/)
@@ -438,13 +445,16 @@
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);
@@ -477,12 +487,14 @@
while (iItemArray->Count() < nbrItems)
{
iItemArray->AppendL(KNullDesC);
+ iItemArrayShort->AppendL(KNullDesC);
TListItemProperties 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);
@@ -493,6 +505,7 @@
TBuf<KMaxFeedNameLength> itemName;
iEikonEnv->ReadResourceL(itemName, R_PODCAST_FEEDS_NO_FEEDS);
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
TListItemProperties itemProps;
@@ -500,7 +513,6 @@
itemProps.SetHiddenSelection(ETrue);
iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
}
- iListContainer->SetTextArray(iItemArray);
iListContainer->Listbox()->HandleItemAdditionL();
DP("CPodcastFeedView::UpdateListboxItemsL END");
}
@@ -785,6 +797,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 Sun Oct 31 12:32:39 2010 +0000
+++ b/application/src/PodcastListView.cpp Sun Oct 31 13:17:32 2010 +0000
@@ -65,8 +65,6 @@
aRect,
ETrue );
- iItemArrayShort = new (ELeave)CDesCArrayFlat(KDefaultGran);
-
iListboxLandscape = new (ELeave) CAknSingleLargeStyleListBox;
iListboxLandscape->ConstructL(this, aListboxFlags);
iListboxLandscape->SetMopParent( this );
@@ -143,11 +141,6 @@
}
}
-TBool CPodcastListContainer::IsLandscape()
- {
- return iLandscape;
- }
-
void CPodcastListContainer::SizeChanged()
{
DP2("CPodcastListContainer::SizeChanged() BEGIN, width=%d, height=%d",Size().iWidth, Size().iHeight);
@@ -162,26 +155,22 @@
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;
- iListboxLandscape->SetMopParent( this );
- iListboxLandscape->SetContainerWindowL(*this);
- iListboxLandscape->CreateScrollBarFrameL(ETrue);
- iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
}
else
{
iListboxLandscape->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
iListboxLandscape->UpdateScrollBarsL();
+ iListboxLandscape->MakeVisible(EFalse);
+
+ iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
iListboxPortrait->MakeVisible(ETrue);
- iListboxLandscape->MakeVisible(EFalse);
iListboxPortrait->SetFocus(ETrue, EDrawNow);
iListbox = (CEikColumnListBox*) iListboxPortrait;
- iListboxPortrait->SetMopParent( this );
- iListboxPortrait->SetContainerWindowL(*this);
- iListboxPortrait->CreateScrollBarFrameL(ETrue);
- iListboxPortrait->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
}
iListbox->SetSize(Size());
@@ -210,40 +199,24 @@
return iListboxPortrait->ItemDrawer()->FormattedCellData()->IconArray();
}
-void CPodcastListContainer::SetTextArray(CDesCArray* aArray)
+void CPodcastListContainer::SetListboxTextArrays(CDesCArray* aPortraitArray, CDesCArray* aLandscapeArray)
{
- DP1("SetTextArray, aArray.Count=%d", aArray->Count());
- iItemArrayShort->Reset();
- for (int i=0;i<aArray->Count();i++)
- {
- TBuf<1024> line;
- line.Copy((*aArray)[i]);
- TInt tpos = line.LocateReverse('\t');
- if (tpos != -1)
- {
- line = line.Left(tpos);
- }
-
- //DP1("line: %S", line);
- iItemArrayShort->AppendL(line);
- }
-
iListboxLandscape->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
- iListboxLandscape->Model()->SetItemTextArray(iItemArrayShort);
+ iListboxLandscape->Model()->SetItemTextArray(aLandscapeArray);
iListboxPortrait->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
- iListboxPortrait->Model()->SetItemTextArray(aArray);
+ iListboxPortrait->Model()->SetItemTextArray(aPortraitArray);
}
CPodcastListContainer::~CPodcastListContainer()
{
delete iListbox;
delete iBgContext;
- delete iItemArrayShort;
}
-void CPodcastListView::SwitchListbox()
+void CPodcastListContainer::SetEmptyText(const TDesC &aText)
{
- HandleViewRectChange();
+ iListboxPortrait->View()->SetListEmptyTextL(aText);
+ iListboxLandscape->View()->SetListEmptyTextL(aText);
}
void CPodcastListContainer::Draw(const TRect& aRect) const
@@ -273,7 +246,18 @@
{
DP("CPodcastListView::ConstructL BEGIN");
- ResetContainer();
+ iListContainer = new (ELeave) CPodcastListContainer;
+ TRect rect = ClientRect();
+
+ iListContainer->ConstructL(rect, iListboxFlags);
+ iListContainer->SetMopParent(this);
+ iListContainer->ActivateL();
+
+ iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran);
+ iItemArrayShort = new (ELeave)CDesCArrayFlat(KDefaultGran);
+
+ iListContainer->SetListboxTextArrays(iItemArray, iItemArrayShort);
+ iListContainer->SetContainerListener(this);
if (Toolbar()) {
iToolbar = Toolbar();
@@ -284,56 +268,10 @@
DP("CPodcastListView::ConstructL END");
}
-void CPodcastListView::ResetContainer()
- {
- DP("CPodcastListView::ResetContainer BEGIN");
-
- if(iListContainer)
- {
- AppUi()->RemoveFromStack(iListContainer);
- delete iListContainer;
- }
-
- iListContainer = new (ELeave) CPodcastListContainer;
- TRect rect = ClientRect();
-
-// flipFlop = !flipFlop;
-//
-// if (!flipFlop)
-// {
-// TUint w = rect.Width();
-// rect.SetWidth(rect.Height());
-// rect.SetHeight(w);
-// }
-
- iListContainer->ConstructL(rect, iListboxFlags);
- iListContainer->SetMopParent(this);
- iListContainer->ActivateL();
- iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran);
- iListContainer->SetTextArray(iItemArray);
- iListContainer->SetContainerListener(this);
-
- DP("CPodcastListView::ResetContainer END");
- }
-
void CPodcastListView::HandleViewRectChange()
{
TBool wasVisible = iListContainer->IsVisible();
-// if (wasVisible)
-// {
-// AppUi()->ActivateLocalViewL(KUidPodcastSearchViewID, TUid::Uid(0), KNullDesC8);
-//
-// DoDeactivate();
-// }
-//
-// ResetContainer();
-//
-// if (wasVisible)
-// {
-// AppUi()->ActivateLocalViewL(ViewId().iViewUid, TUid::Uid(0), KNullDesC8);
-// }
-
if ( iListContainer )
{
iListContainer->SetRect( ClientRect() );
@@ -357,6 +295,7 @@
}
delete iItemArray;
+ delete iItemArrayShort;
iItemIdArray.Close();
}
@@ -441,8 +380,7 @@
void CPodcastListView::SetEmptyTextL(TInt aResourceId)
{
HBufC* emptyText = iEikonEnv->AllocReadResourceLC(aResourceId);
- iListContainer->iListboxPortrait->View()->SetListEmptyTextL(*emptyText);
- iListContainer->iListboxLandscape->View()->SetListEmptyTextL(*emptyText);
+ iListContainer->SetEmptyText(*emptyText);
CleanupStack::PopAndDestroy(emptyText);
}
--- a/application/src/PodcastQueueView.cpp Sun Oct 31 12:32:39 2010 +0000
+++ b/application/src/PodcastQueueView.cpp Sun Oct 31 13:17:32 2010 +0000
@@ -189,6 +189,7 @@
iListContainer->Listbox()->Reset();
iItemIdArray.Reset();
iItemArray->Reset();
+ iItemArrayShort->Reset();
if (len > 0)
{
@@ -198,17 +199,18 @@
FormatShowInfoListBoxItemL(*si);
iItemIdArray.Append(si->Uid());
iItemArray->AppendL(iListboxFormatbuffer);
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
}
}
else
{
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
itemProps.SetDimmed(ETrue);
itemProps.SetHiddenSelection(ETrue);
}
- iListContainer->SetTextArray(iItemArray);
iListContainer->Listbox()->HandleItemAdditionL();
}
}
--- a/application/src/PodcastSearchView.cpp Sun Oct 31 12:32:39 2010 +0000
+++ b/application/src/PodcastSearchView.cpp Sun Oct 31 13:17:32 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)
{
@@ -185,6 +186,8 @@
PodcastUtils::RemoveAllFormatting(descr);
iListboxFormatbuffer.Format(KSearchResultFormat(), iconIndex, &fi->Title(), &descr);
iItemArray->AppendL(iListboxFormatbuffer);
+ iListboxFormatbufferShort.Format(KSearchResultFormatLandscape(), iconIndex, &fi->Title(), &descr);
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(i, itemProps);
}
}
@@ -193,6 +196,7 @@
TBuf<KMaxFeedNameLength> itemName;
iEikonEnv->ReadResourceL(itemName, R_PODCAST_NO_SEARCH_RESULTS);
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
TListItemProperties itemProps;
@@ -200,7 +204,6 @@
itemProps.SetHiddenSelection(ETrue);
iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
}
- iListContainer->SetTextArray(iItemArray);
iListContainer->Listbox()->HandleItemAdditionL();
DP("CPodcastSearchView::UpdateListboxItemsL END");
}
--- a/application/src/PodcastShowsView.cpp Sun Oct 31 12:32:39 2010 +0000
+++ b/application/src/PodcastShowsView.cpp Sun Oct 31 13:17:32 2010 +0000
@@ -38,6 +38,7 @@
_LIT(KShowsSizeFormatS60, "%.1f MB");
_LIT(KShowFormat, "%d\t%S\t%S%S");
+_LIT(KShowFormatLandscape, "%d\t%S");
// these must correspond with TShowsIconIndex
@@ -459,6 +460,7 @@
}
iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
+ iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
}
void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
@@ -470,16 +472,18 @@
{
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);
}
-
- iListContainer->SetTextArray(iItemArray);
}
void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
@@ -542,7 +546,8 @@
iListContainer->Listbox()->Reset();
iItemIdArray.Reset();
iItemArray->Reset();
-
+ iItemArrayShort->Reset();
+
if (len > 0)
{
for (TInt i=0; i<len; i++)
@@ -551,17 +556,19 @@
FormatShowInfoListBoxItemL(*si);
iItemIdArray.Append(si->Uid());
iItemArray->AppendL(iListboxFormatbuffer);
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
+
}
}
else
{
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
itemProps.SetDimmed(ETrue);
itemProps.SetHiddenSelection(ETrue);
}
- iListContainer->SetTextArray(iItemArray);
iListContainer->Listbox()->HandleItemAdditionL();
}
}