application/src/PodcastListView.cpp
author teknolog
Fri, 12 Mar 2010 00:20:10 +0000
changeset 49 43e204e6ae2e
parent 48 f8fd68d71cfd
child 50 e7b10d6d7ba3
permissions -rw-r--r--
Fix for accidental merge regressions. Text fixes for tool tip and settings.
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
#include "PodcastListView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#include "Podcast.hrh"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
#include "PodcastAppUi.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include "constants.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include <podcast.rsg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include <aknlists.h> 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include <aknviewappui.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include <aknnotedialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <aknsbasicbackgroundcontrolcontext.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include <akntabgrp.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include <akntoolbarextension.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include <aknquerydialog.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include <barsread.h>
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 48
diff changeset
    32
#include <akntitle.h>
2
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
const TInt KDefaultGran = 5;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
CPodcastListContainer::CPodcastListContainer()
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
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
void CPodcastListContainer::SetKeyEventListener(MKeyEventListener *aKeyEventListener)
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
	iKeyEventListener = aKeyEventListener;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
TKeyResponse CPodcastListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
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
	TKeyResponse response = iListbox->OfferKeyEventL(aKeyEvent, aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
	if (iKeyEventListener)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
		iKeyEventListener->OfferKeyEventL(aKeyEvent, aType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
	return response;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
void CPodcastListContainer::ConstructL( const TRect& aRect, TInt aListboxFlags )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
	CreateWindowL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
	iBgContext = 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
		    CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
		                                              aRect, 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
		                                              ETrue );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
	 // Set the windows size
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
    SetRect( aRect );    
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
    iListbox =static_cast<CEikFormattedCellListBox*>( new (ELeave) CAknDoubleLargeStyleListBox);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
    iListbox->ConstructL(this, aListboxFlags);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
    iListbox->SetMopParent( this );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
	iListbox->SetContainerWindowL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
	iListbox->CreateScrollBarFrameL(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
	iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
	iListbox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
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
	iListbox->SetSize(aRect.Size());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
	iListbox->MakeVisible(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
    MakeVisible(EFalse);
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 13
diff changeset
    77
    
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 13
diff changeset
    78
//#ifndef SYMBIAN1_UI
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 13
diff changeset
    79
//	TInt flags = iListbox->View()->ItemDrawer()->Flags();
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 13
diff changeset
    80
//	flags |= CListItemDrawer::EDisableHighlight;
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 13
diff changeset
    81
//	iListbox->ItemDrawer()->SetFlags(flags);
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 13
diff changeset
    82
//#endif
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
	// Activate the window, which makes it ready to be drawn
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
    ActivateL();   
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
TInt CPodcastListContainer::CountComponentControls() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
    return 1; // return number of controls inside this container
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
CCoeControl* CPodcastListContainer::ComponentControl(TInt aIndex) const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
    switch ( aIndex )
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
        case 0:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
            return iListbox;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
        default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
            return NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
        }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
26
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   104
void CPodcastListContainer::SetLongTapDetected(TBool aLongTapDetected)
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   105
	{
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   106
	iLongTapDetected = aLongTapDetected;
27
f21a29fc4769 Fix to remove focus after popup menu
teknolog
parents: 26
diff changeset
   107
	
f21a29fc4769 Fix to remove focus after popup menu
teknolog
parents: 26
diff changeset
   108
	if (aLongTapDetected == EFalse)
f21a29fc4769 Fix to remove focus after popup menu
teknolog
parents: 26
diff changeset
   109
		{
f21a29fc4769 Fix to remove focus after popup menu
teknolog
parents: 26
diff changeset
   110
		TPointerEvent event;
f21a29fc4769 Fix to remove focus after popup menu
teknolog
parents: 26
diff changeset
   111
		event.iType = TPointerEvent::EButton1Up;
f21a29fc4769 Fix to remove focus after popup menu
teknolog
parents: 26
diff changeset
   112
		CCoeControl::HandlePointerEventL(event);
f21a29fc4769 Fix to remove focus after popup menu
teknolog
parents: 26
diff changeset
   113
		}
26
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   114
	}
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   115
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
void CPodcastListContainer::HandleResourceChange(TInt aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
	switch( aType )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
    	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
	    case KEikDynamicLayoutVariantSwitch:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
		    SetRect(iEikonEnv->EikAppUi()->ClientRect());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
		    break;
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
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
void CPodcastListContainer::ScrollToVisible() {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
	if (iListbox != NULL) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
		iListbox->ScrollToMakeItemVisible(iListbox->CurrentItemIndex());
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
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
void CPodcastListContainer::SizeChanged()
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
	DP2("CPodcastListContainer::SizeChanged(), width=%d, height=%d",Size().iWidth, Size().iHeight);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
	if(iListbox != NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
		iListbox->SetSize(Size());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
CEikFormattedCellListBox* CPodcastListContainer::Listbox()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
	return iListbox;
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
CPodcastListContainer::~CPodcastListContainer()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
	delete iListbox;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
	delete iBgContext;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
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
void CPodcastListContainer::Draw(const TRect& aRect) const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
	CWindowGc& gc = SystemGc();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
	gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
	MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
	AknsDrawUtils::Background(skin, cc, (CCoeControl*) this, gc, aRect);
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
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
TTypeUid::Ptr CPodcastListContainer::MopSupplyObject( TTypeUid aId )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
    if (iBgContext )
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
      return MAknsControlContext::SupplyMopObject( aId, iBgContext );
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
    return CCoeControl::MopSupplyObject(aId);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
void CPodcastListContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
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
	if (iPointerListener)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
		iPointerListener->PointerEventL(aPointerEvent);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
26
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   177
	// Call base class HandlePointerEventL() if not a long tap
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   178
	if (!iLongTapDetected)
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   179
		{
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   180
		CCoeControl::HandlePointerEventL(aPointerEvent);
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   181
		}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
void CPodcastListContainer::SetPointerListener(MPointerListener *aPointerListener)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
	iPointerListener = aPointerListener;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
CPodcastListView::CPodcastListView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
void CPodcastListView::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
	DP("CPodcastListView::ConstructL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
	iListContainer = new (ELeave) CPodcastListContainer;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
	iListContainer->ConstructL(ClientRect(), iListboxFlags);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
	iListContainer->SetMopParent(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
	iListContainer->ActivateL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
	iItemArray = new (ELeave)CDesCArrayFlat(KDefaultGran);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
	iListContainer->Listbox()->Model()->SetItemTextArray(iItemArray);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
	iListContainer->Listbox()->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
	if (Toolbar()) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
		iToolbar = Toolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
		iToolbar->SetToolbarObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
	iLongTapDetector = CAknLongTapDetector::NewL(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
	iListContainer->SetPointerListener(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
	iListContainer->SetKeyEventListener(this);
23
cf4b850bbffb Added macro SYMBIAN1_UI that toggles between single and double tap UI
teknolog
parents: 13
diff changeset
   214
        
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
	DP("CPodcastListView::ConstructL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
void CPodcastListView::HandleViewRectChange()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
    if ( iListContainer )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
        iListContainer->SetRect( ClientRect() );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
void CPodcastListView::HandleStatusPaneSizeChange()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
	DP2("CPodcastListView::HandleStatusPaneSizeChange(), width=%d, height=%d", ClientRect().Width(), ClientRect().Height());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
	if ( iListContainer )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
        iListContainer->SetRect( ClientRect() );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   234
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
    
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
CPodcastListView::~CPodcastListView()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   239
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
    if(iListContainer)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
    	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
    	AppUi()->RemoveFromStack(iListContainer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   243
    	delete iListContainer;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   244
    	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   245
         
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   246
    delete iItemArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   247
    delete iLongTapDetector;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   248
    iItemIdArray.Close();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   249
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   250
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   251
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   252
void CPodcastListView::DoActivateL(const TVwsViewId& /*aPrevViewId */,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   253
	                                  TUid /*aCustomMessageId */,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   254
									  const TDesC8& /* aCustomMessage */)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   255
{	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   256
	DP("CPodcastListView::DoActivateL() BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   257
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   258
	if(iListContainer)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   259
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   260
		iListContainer->SetSize(ClientRect().Size());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   261
		iListContainer->SetMopParent(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   262
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   263
		AppUi()->AddToStackL(*this, iListContainer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   264
		iListContainer->MakeVisible(ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   265
	}
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 48
diff changeset
   266
	
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 48
diff changeset
   267
	CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 48
diff changeset
   268
		      ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 48
diff changeset
   269
	titlePane->SetTextToDefaultL();
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 48
diff changeset
   270
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   271
	DP("CPodcastListView::DoActivateL() END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   272
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   273
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   274
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   275
void CPodcastListView::DoDeactivate()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   276
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   277
	DP("CPodcastListView::DoDeactivate() BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   278
	if ( iListContainer )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   279
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   280
		AppUi()->RemoveFromViewStack( *this, iListContainer);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   281
		iListContainer->MakeVisible(EFalse);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   282
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   283
	DP("CPodcastListView::DoDeactivate() END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   284
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   285
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   286
/** 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   287
* Command handling function intended for overriding by sub classes. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   288
* Default implementation is empty.  
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   289
* @param aCommand ID of the command to respond to. 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   290
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   291
void CPodcastListView::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   292
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   293
	DP1("CPodcastListView::HandleCommandL=%d", aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   294
	switch(aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   295
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   296
	case EAknSoftkeyExit:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   297
	case EEikCmdExit:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   298
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   299
            AppUi()->Exit();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   300
            break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   301
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   302
	case EAknSoftkeyBack:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   303
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   304
		AppUi()->ActivateViewL(iPreviousView);
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 48
diff changeset
   305
		((CPodcastAppUi*)AppUi())->SetActiveTab(KTabIdFeeds);
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   306
		}
49
43e204e6ae2e Fix for accidental merge regressions. Text fixes for tool tip and settings.
teknolog
parents: 48
diff changeset
   307
		break;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   308
	case EPodcastSettings:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   309
		AppUi()->ActivateLocalViewL(KUidPodcastSettingsViewID);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   310
		break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   311
	case EPodcastAbout:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   312
		RunAboutDialogL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   313
		break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   314
	default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   315
		AppUi()->HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   316
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   317
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   318
48
f8fd68d71cfd Fixed context sensitive help. Ticket #2089
teknolog
parents: 33
diff changeset
   319
TBool CPodcastListView::IsVisible()
f8fd68d71cfd Fixed context sensitive help. Ticket #2089
teknolog
parents: 33
diff changeset
   320
	{
f8fd68d71cfd Fixed context sensitive help. Ticket #2089
teknolog
parents: 33
diff changeset
   321
	return iListContainer->IsVisible();
f8fd68d71cfd Fixed context sensitive help. Ticket #2089
teknolog
parents: 33
diff changeset
   322
	}
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   323
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   324
void CPodcastListView::RunAboutDialogL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   325
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   326
	CAknNoteDialog* dlg = new(ELeave) CAknNoteDialog();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   327
	dlg->ExecuteLD(R_DLG_ABOUT);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   328
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   329
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   330
void CPodcastListView::SetEmptyTextL(TInt aResourceId)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   331
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   332
	HBufC* emptyText =  iEikonEnv->AllocReadResourceLC(aResourceId);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   333
	iListContainer->Listbox()->View()->SetListEmptyTextL(*emptyText);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   334
	CleanupStack::PopAndDestroy(emptyText);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   335
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   336
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   337
void CPodcastListView::ShowOkMessage(TDesC &aText)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   338
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   339
	CAknNoteDialog* dlg= new(ELeave) CAknNoteDialog();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   340
	CleanupStack::PushL(dlg);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   341
	dlg->SetTextL(aText);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   342
	CleanupStack::Pop(dlg);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   343
	dlg->ExecuteLD(R_MESSAGEDLG_OK);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   344
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   345
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   346
void CPodcastListView::ShowErrorMessage(TDesC &aText)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   347
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   348
	CAknNoteDialog* dlg= new(ELeave) CAknNoteDialog();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   349
	CleanupStack::PushL(dlg);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   350
	dlg->SetTextL(aText);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   351
	CleanupStack::Pop(dlg);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   352
	dlg->ExecuteLD(R_ERRORDLG_OK);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   353
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   354
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   355
TInt CPodcastListView::ShowQueryMessage(TDesC &aText)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   356
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   357
	CAknQueryDialog* dlg= new(ELeave) CAknQueryDialog();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   358
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   359
	CleanupStack::PushL(dlg);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   360
	dlg->SetPromptL(aText);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   361
	CleanupStack::Pop(dlg);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   362
	return dlg->ExecuteLD(R_QUERYDLG);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   363
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   364
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   365
void CPodcastListView::CloseToolbarExtension()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   366
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   367
	CAknToolbar* toolbar = Toolbar();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   368
	if (toolbar) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   369
		CAknToolbarExtension* toolbarExtension = toolbar->ToolbarExtension();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   370
		if (toolbarExtension) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   371
		toolbarExtension->SetShown( EFalse );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   372
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   373
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   374
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   375
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   376
void CPodcastListView::PointerEventL(const TPointerEvent& aPointerEvent)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   377
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   378
	//DP1("CPodcastListView::PointerEventL, iType=%d", aPointerEvent.iType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   379
	// Pass the pointer event to Long tap detector component
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   380
	iLongTapDetector->PointerEventL(aPointerEvent);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   381
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   382
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   383
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   384
void CPodcastListView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   385
{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   386
	DP("CPodcastListView::HandleLongTapEventL BEGIN");
26
71493655568a Workaround for long tap on selected item issue
teknolog
parents: 24
diff changeset
   387
	iListContainer->SetLongTapDetected(ETrue);
4
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 2
diff changeset
   388
	const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 2
diff changeset
   389
	TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems(
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 2
diff changeset
   390
			iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight;
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 2
diff changeset
   391
be243543a361 Added primitive detection if long tap is on a listbox item or not. Could use a better version of this going forward.
teknolog
parents: 2
diff changeset
   392
    if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   393
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   394
		iStylusPopupMenu->ShowMenu();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   395
		iStylusPopupMenu->SetPosition(aPenEventLocation);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   396
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   397
	DP("CPodcastListView::HandleLongTapEventL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   398
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   399
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   400
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   401
void CPodcastListView::DynInitToolbarL (TInt /*aResourceId*/, CAknToolbar * /*aToolbar*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   402
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   403
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   404
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   405
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   406
void CPodcastListView::OfferToolbarEventL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   407
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   408
	HandleCommandL(aCommand);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   409
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   410
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   411
void CPodcastListView::ShowWaitDialogL(TDesC &aWaitText)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   412
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   413
	DP("CPodcastListView::ShowWaitDialogL BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   414
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   415
	if (iWaitDialog) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   416
		User::Leave(KErrInUse);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   417
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   418
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   419
	iWaitDialog=new(ELeave) CAknWaitDialog(reinterpret_cast<CEikDialog**>(&iWaitDialog), EFalse);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   420
	iWaitDialog->SetCallback(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   421
	iWaitDialog->ExecuteLD(R_WAITDLG);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   422
	iWaitDialog->SetTextL(aWaitText);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   423
	DP("CPodcastListView::ShowWaitDialogL END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   424
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   425
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   426
TKeyResponse CPodcastListView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   427
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   428
	if (aType==EEventKey)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   429
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   430
		switch (aKeyEvent.iCode)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   431
			{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   432
			case EKeyRightArrow:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   433
				((CPodcastAppUi*)AppUi())->TabRight();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   434
				return EKeyWasConsumed;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   435
			case EKeyLeftArrow:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   436
				((CPodcastAppUi*)AppUi())->TabLeft();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   437
				return EKeyWasConsumed;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   438
			}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   439
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   440
	return EKeyWasNotConsumed;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   441
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   442