TInt CMainView::PopupMenu(TDes& aTxt,TInt aDef,CDesCArray* itemList) { _LIT(KListItemFormat, "%S"); CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(list); CAknPopupList* popupList = CAknPopupList::NewL(list, R_AVKON_SOFTKEYS_OK_BACK, AknPopupLayouts::EMenuWindow); CleanupStack::PushL(popupList); list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); list->Model()->SetItemTextArray(itemList); list->Model()->SetOwnershipType(ELbmOwnsItemArray); list->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue ); popupList->SetTitleL(aTxt); CleanupStack::Pop(); // popuplist CleanupStack::Pop(); //list TBool popupOk = popupList->ExecuteLD(); if (!popupOk) { return -1; } else { TInt current=list->CurrentItemIndex(); return current; } }
// --------------------------------------------------------------------------- // CCodConfirm::ShowDownloadConfirmationL // --------------------------------------------------------------------------- // TBool CCodConfirm::ShowDownloadConfirmationL(TInt aCbaResource, const CCodData& aData, TBool aCod ) { HBufC* itemText = NULL; // a buffer holding the text for each list item CEikFormattedCellListBox* listBox = new ( ELeave ) CAknDoublePopupMenuStyleListBox; CleanupStack::PushL( listBox ); // If supported show OK & Cancel buttons, otherwise just CANCEL CAknPopupList* popupList = CAknPopupList::NewL ( listBox, aCbaResource, AknPopupLayouts::EMenuDoubleWindow ); CleanupStack::PushL( popupList ); TInt flags = CEikListBox::EDisableHighlight; listBox->ConstructL( popupList, flags ); listBox->CreateScrollBarFrameL( ETrue ); listBox->ScrollBarFrame()->SetScrollBarVisibilityL ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); MDesCArray* itemList = listBox->Model()->ItemTextArray(); CDesCArray* itemArray = (CDesCArray*)itemList; //------------------------------------------- // Header HBufC* header = StringLoader::LoadLC( R_QTN_CD_TITLE ); popupList->SetTitleL( *header ); CleanupStack::PopAndDestroy( header ); // header header = NULL; // make description of buf HBufC* buf; //------------------------------------------- // Name // HBufC* popHeader = StringLoader::LoadLC( R_QTN_CD_DETAIL_NAME ); // If media count more than one, show album name if present itemText = FormatListBoxItemLC( *popHeader, aData.Count() > 1 && aData.Name().Length()? aData.Name() : (*aData[aData.ActiveDownload()]).Name() ); itemArray->AppendL( *itemText ); CleanupStack::PopAndDestroy( 2, popHeader ); // itemText,popHeader itemText = NULL; popHeader = NULL; //------------------------------------------- // Content Size // HBufC* sizeHeader = StringLoader::LoadLC( R_QTN_CD_DETAIL_SIZE ); TInt size = aData.Size(); if( size >= KCodKbyte ) { // Round up. buf = StringLoader::LoadLC ( R_QTN_SIZE_KB, (size - 1) / KCodKbyte + 1, iCoeEnv ); } else { buf = StringLoader::LoadLC( R_QTN_SIZE_B, size, iCoeEnv ); } buf->Des().Trim(); itemText = FormatListBoxItemLC( *sizeHeader, *buf ); itemArray->AppendL( *itemText ); CleanupStack::PopAndDestroy( 3, sizeHeader ); // itemText, sizeHeader itemText = NULL; sizeHeader = NULL; //------------------------------------------- // Type // popHeader = StringLoader::LoadLC( R_QTN_CD_DETAIL_TYPE ); buf = AllocTypeNameL( DisplayType(aData)); CleanupStack::PushL(buf); itemText = FormatListBoxItemLC( *popHeader, *buf ); itemArray->AppendL( *itemText ); CleanupStack::PopAndDestroy( 3, popHeader ); // itemText, nameHeader itemText = NULL; popHeader = NULL; //------------------------------------------- // Price: only if it's aCod // if ( aCod ) { popHeader = StringLoader::LoadLC( R_QTN_CD_DETAIL_PRICE ); itemText = FormatListBoxItemLC( *popHeader, aData.Price() ); itemArray->AppendL( *itemText ); CleanupStack::PopAndDestroy( 2, popHeader ); // itemText, nameHeader itemText = NULL; popHeader = NULL; } //------------------------------------------- // Detail Description // popHeader = StringLoader::LoadLC( R_QTN_CD_DETAIL_DESCRIPT ); HBufC* popValue = StringLoader::LoadLC(R_QTN_CD_VALUE_UNDEFINED ); if (aData.Description().Length()) { itemText = FormatListBoxItemLC( *popHeader, aData.Description() ); } else { itemText = FormatListBoxItemLC( *popHeader, *popValue ); } itemArray->AppendL( *itemText ); CleanupStack::PopAndDestroy( 3, popHeader ); // itemText, popValue itemText = NULL; popHeader = NULL; //------------------------------------------- // Vendor Information // popHeader = StringLoader::LoadLC( R_QTN_CD_DETAIL_VENDOR ); popValue = StringLoader::LoadLC(R_QTN_CD_VALUE_UNDEFINED ); if (aData.Vendor().Length()) itemText = FormatListBoxItemLC( *popHeader, aData.Vendor() ); else itemText = FormatListBoxItemLC( *popHeader, *popValue ); itemArray->AppendL( *itemText ); CleanupStack::PopAndDestroy( 3, popHeader ); // itemText, popValue itemText = NULL; popHeader = NULL; TInt popupOk = popupList->ExecuteLD(); // cleanup CleanupStack::Pop( popupList ); CleanupStack::PopAndDestroy( listBox ); // listBox return popupOk; }
TInt CConnectionManager::SelectIAP() { CArrayFixFlat<TIapData>* iEApList=new (ELeave) CArrayFixFlat<TIapData>(2) ; TInt stack=0; // Make listitems. and PUSH it CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(list); stack++; // Create popup list and PUSH it. CAknPopupList* popupList = CAknPopupList::NewL(list, R_AVKON_SOFTKEYS_OK_CANCEL, AknPopupLayouts::EMenuWindow); CleanupStack::PushL(popupList);stack++; CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat(5); CleanupStack::PushL(items);stack++; // initialize listbox. list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); TBuf<52> iapfromtable; TInt err = KErrNone; CCommsDatabase* iCommsDB=CCommsDatabase::NewL(EDatabaseTypeIAP); CleanupStack::PushL(iCommsDB);stack++; #ifdef __SERIES60_3X__ CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC( iBearerFilter == EApBearerTypeWLAN ? ECommDbBearerWLAN : ECommDbBearerGPRS|ECommDbBearerWLAN|ECommDbBearerVirtual, ECommDbConnectionDirectionOutgoing); #else CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC( ECommDbBearerGPRS|ECommDbBearerVirtual, ECommDbConnectionDirectionOutgoing); #endif User::LeaveIfError(gprsTable->GotoFirstRecord()); TInt i=0; TUint32 id; TIapData eap; TInt cur =0; //current value do { gprsTable->ReadTextL(TPtrC(COMMDB_NAME), iapfromtable); gprsTable->ReadUintL(TPtrC(COMMDB_ID), id); items->AppendL(iapfromtable); eap.iIap = id; eap.iName.Copy(iapfromtable); iEApList->AppendL(eap); err = gprsTable->GotoNextRecord(); i++; } while (err == KErrNone); CleanupStack::PopAndDestroy(2); stack--; // Set listitems. CTextListBoxModel* model = list->Model(); model->SetItemTextArray(items); model->SetOwnershipType(ELbmOwnsItemArray); CleanupStack::Pop(); popupList->SetTitleL(_L("Access Point")); list->SetListBoxObserver(popupList); TInt popupOk = popupList->ExecuteLD(); CleanupStack::Pop(); TInt iap=0; if (popupOk) { TInt index = list->CurrentItemIndex(); iap=(*iEApList)[index].iIap; } CleanupStack::PopAndDestroy(); iEApList->Reset(); delete iEApList; return iap; }
/* ----------------------------------------------------------------------------- ---------------------------------------------------------------------------- */ void CAknSettingsListListbox::SelectCommandSCL(TInt aSC) { CAknSinglePopupMenuStyleListBox * list = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(list); CAknPopupList* popupList = CAknPopupList::NewL(list, R_AVKON_SOFTKEYS_SELECT_BACK); CleanupStack::PushL(popupList); list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto); CDesCArrayFlat* SelectArrray = new(ELeave)CDesCArrayFlat(20); CleanupStack::PushL(SelectArrray); TBuf<60> Hjelpper; StringLoader::Load(Hjelpper,R_MNU_COPY); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_CUT); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_PASTE); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_DELETE); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_RENAME); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_PROPERTIES); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_ATTRIBUTES); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_SHOWNAME); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_SEND); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_NEWFILE); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_NEWFOLDER); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_SETTINGS); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_SHOWSC); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_SETSC); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_SETSEARCHON); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_REFRESH); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_MARKALL); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_UNMARKALL); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_OPEN); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_OPENWITH); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_PASTESHOW); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_CLEARPASTE); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_SEARCHFLES); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_PAGEUP); SelectArrray->AppendL(Hjelpper); StringLoader::Load(Hjelpper,R_MNU_PAGEDOWN); SelectArrray->AppendL(Hjelpper); CleanupStack::Pop();//SelectArrray list->Model()->SetItemTextArray(SelectArrray); list->Model()->SetOwnershipType(ELbmOwnsItemArray); StringLoader::Load(Hjelpper,R_MNU_SELCOMMAND); popupList->SetTitleL(Hjelpper); if (popupList->ExecuteLD()) { TInt Selected = list->CurrentItemIndex(); TInt SelCommand(-1); TBuf<30> SelComBuf; switch(Selected) { case 0: SelCommand = EEditCopy; StringLoader::Load(SelComBuf,R_MNU_COPY); break; case 1: SelCommand = EEditCut; StringLoader::Load(SelComBuf,R_MNU_CUT); break; case 2: SelCommand = EEditPaste; StringLoader::Load(SelComBuf,R_MNU_PASTE); break; case 3: SelCommand = EFileDelete; StringLoader::Load(SelComBuf,R_MNU_DELETE); break; case 4: SelCommand = EFileRename; StringLoader::Load(SelComBuf,R_MNU_RENAME); break; case 5: SelCommand = EFileDetails; StringLoader::Load(SelComBuf,R_MNU_PROPERTIES); break; case 6: SelCommand = EFileAttributes; StringLoader::Load(SelComBuf,R_MNU_ATTRIBUTES); break; case 7: SelCommand = EFileShowName; StringLoader::Load(SelComBuf,R_MNU_SHOWNAME); break; case 8: SelCommand = ESendFiles; StringLoader::Load(SelComBuf,R_MNU_SEND); break; case 9: SelCommand = EFileNewFile; StringLoader::Load(SelComBuf,R_MNU_NEWFILE); break; case 10: SelCommand = EFileNewFolder; StringLoader::Load(SelComBuf,R_MNU_NEWFOLDER); break; case 11: SelCommand = ESettings; StringLoader::Load(SelComBuf,R_MNU_SETTINGS); break; case 12: SelCommand = EExtrasShowShortCut; StringLoader::Load(SelComBuf,R_MNU_SHOWSC); break; case 13: SelCommand = EExtrasSetShortCut; StringLoader::Load(SelComBuf,R_MNU_SETSC); break; case 14: SelCommand = EExtrasSearchOn; StringLoader::Load(SelComBuf,R_MNU_SETSEARCHON); break; case 15: SelCommand = EExtrasRefresh; StringLoader::Load(SelComBuf,R_MNU_REFRESH); break; case 16: SelCommand = EFolderViewMarkAll; StringLoader::Load(SelComBuf,R_MNU_MARKALL); break; case 17: SelCommand = EFolderViewUnMarkAll; StringLoader::Load(SelComBuf,R_MNU_UNMARKALL); break; case 18: SelCommand = EVBOpenFile; StringLoader::Load(SelComBuf,R_MNU_OPEN); break; case 19: SelCommand = EOpenWithViewer; StringLoader::Load(SelComBuf,R_MNU_OPENWITH); break; case 20: SelCommand = EEditShowPaste; StringLoader::Load(SelComBuf,R_MNU_PASTESHOW); break; case 21: SelCommand = EEditClearPaste; StringLoader::Load(SelComBuf,R_MNU_CLEARPASTE); break; case 22: SelCommand = ESearchFiles; StringLoader::Load(SelComBuf,R_MNU_SEARCHFLES); break; case 23: SelCommand = EMovePageUp; StringLoader::Load(SelComBuf,R_MNU_PAGEUP); break; case 24: SelCommand = EMovePageDown; StringLoader::Load(SelComBuf,R_MNU_PAGEDOWN); break; default: break; } if(SelCommand > 0) { switch(aSC) { case 0: iCommand0 = SelCommand; iCommandTxt0.Copy(SelComBuf); break; case 1: iCommand1 = SelCommand; iCommandTxt1.Copy(SelComBuf); break; case 2: iCommand2 = SelCommand; iCommandTxt2.Copy(SelComBuf); break; case 3: iCommand3 = SelCommand; iCommandTxt3.Copy(SelComBuf); break; case 4: iCommand4 = SelCommand; iCommandTxt4.Copy(SelComBuf); break; case 5: iCommand5 = SelCommand; iCommandTxt5.Copy(SelComBuf); break; case 6: iCommand6 = SelCommand; iCommandTxt6.Copy(SelComBuf); break; case 7: iCommand7 = SelCommand; iCommandTxt7.Copy(SelComBuf); break; case 8: iCommand8 = SelCommand; iCommandTxt8.Copy(SelComBuf); break; case 9: iCommand9 = SelCommand; iCommandTxt9.Copy(SelComBuf); break; default: break; } } LoadSettingsL(); ListBox()->DrawNow(); } CleanupStack::Pop(); // popuplist CleanupStack::PopAndDestroy(1); // list }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CMCETestUISessionViewContainer::DoShowMenuL() { if ( iContextMenuAlreadyShown ) { iContextMenuAlreadyShown = EFalse; return; } // Get command provider MMCETestUIEngineCmdProvider& cmdProvider = iListBoxModel->CmdProvider( iListBox->CurrentItemIndex() ); // Get commands const RPointerArray<TMCETestUIEngineCmdBase>& commands = cmdProvider.GetCommandsL(); // Generate list CAknSinglePopupMenuStyleListBox* listBox = new (ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL( listBox ); CAknPopupList* popup = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_MENU_LIST, AknPopupLayouts::EPopupSNotePopupWindow ); CleanupStack::PushL( popup ); popup->SetTitleL( _L("Available commands") ); listBox->ConstructL( popup, EAknListBoxSelectionList | EAknListBoxLoopScrolling); listBox->CreateScrollBarFrameL( ETrue ); listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); CDesCArray* array = new (ELeave) CDesCArrayFlat( 1 ); CleanupStack::PushL( array ); for ( TInt i = 0; i < commands.Count(); ++i ) { TInt itemLength = commands[i]->Caption().Length() + KTab().Length(); HBufC* item = HBufC::NewLC( itemLength ); TPtr itemPtr = item->Des(); itemPtr.Append( commands[i]->Caption() ); itemPtr.Append( KTab ); array->AppendL( *item ); CleanupStack::PopAndDestroy( item ); item = NULL; } CleanupStack::Pop( array ); listBox->Model()->SetItemTextArray( array ); CleanupStack::Pop( popup ); TInt selectedCommand = -1; if ( popup->ExecuteLD() ) { selectedCommand = listBox->CurrentItemIndex(); } CleanupStack::PopAndDestroy( listBox ); if ( selectedCommand != -1 ) { // This will not work... TRAPD( err, commands[ selectedCommand ]->ExecuteL() ); if ( err != KErrNone ) { CEikonEnv* eikonEnv = CEikonEnv::Static(); CMCETestUIAppUi* tempUiPtr = (CMCETestUIAppUi*)eikonEnv->AppUi(); TInt errorLength = KLeaveMessage().Length() + 10; HBufC* error = HBufC::NewL( errorLength ); TPtr errorPtr = error->Des(); errorPtr.Append( KLeaveMessage ); errorPtr.AppendNum( err ); // User::InfoPrint( *error ); tempUiPtr->NotifyUser(*error); delete error; } } }
// --------------------------------------------------------------------------- // CBCTestPopupCase::TestPopupL // --------------------------------------------------------------------------- // void CBCTestPopupCase::TestPopupL() { CEikFormattedCellListBox* listBox = new( ELeave ) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL( listBox ); CAknPopupList* popupList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_SELECT_BACK, AknPopupLayouts::EPopupSNotePopupWindow ); CleanupStack::PushL( popupList ); AssertNotNullL( popupList, KAknPopupList ); listBox->ConstructL( popupList, EAknListBoxMenuList ); // Invoke CAknPopupList's SetTitleL() popupList->SetTitleL( KTitle ); AssertTrueL( ETrue, KSetTitleL ); // Invoke CAknPopupList's Heading() popupList->Heading(); AssertTrueL( ETrue, KHeading ); // Invoke CAknPopupList's ButtonGroupContainer() popupList->ButtonGroupContainer(); AssertTrueL( ETrue, KButtonGroupContainer ); // Invoke CAknPopupList's EnableFind() popupList->EnableFind( EFalse ); popupList->EnableFind( ETrue ); AssertTrueL( ETrue, KEnableFind ); // Invoke CAknPopupList's ListBox() popupList->ListBox(); AssertTrueL( ETrue, KListBox ); // Invoke CAknPopupList's FindBox() popupList->FindBox(); AssertTrueL( ETrue, KFindBox ); // Invoke CAknPopupList's HandlePointerEventL() TPointerEvent pointEvent; pointEvent.iType = TPointerEvent::EButton1Down; popupList->HandlePointerEventL( pointEvent ); AssertTrueL( ETrue, KHandlePointerEventL ); // Invoke CAknPopupList's SetMaximumHeight() popupList->SetMaximumHeight( KMaximumHeight ); AssertTrueL( ETrue, KSetMaximumHeight ); CleanupStack::Pop( popupList ); // Invoke CAknPopupList's ExecuteLD() popupList->ExecuteLD(); AssertTrueL( ETrue, KExecuteLD ); // Invoke CAknPopupList's MinimumSize() CCoeControl* pList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_SELECT_BACK, AknPopupLayouts::EPopupSNotePopupWindow ); CleanupStack::PushL( pList ); pList->MinimumSize(); AssertTrueL( ETrue, KMinimumSize ); // Invoke CAknPopupList's OfferKeyEventL() TKeyEvent keyEvent; keyEvent.iCode = EKeyCBA1; pList->OfferKeyEventL( keyEvent, EEventKey ); AssertTrueL( ETrue, KOfferKeyEventL ); CleanupStack::PopAndDestroy( pList ); CleanupStack::PopAndDestroy( listBox ); }
void CEmTubeSearchView::HandleCommandL( TInt aCommand ) { TInt which = CurrentToActual(); switch(aCommand) { case EMTVSendViaBluetoothCommand: { CSendUi* sendUi = CSendUi::NewLC(); CMessageData* mdata = CMessageData::NewLC(); mdata->AppendAttachmentL( iAppUi->SearchEntries()[ which ]->SavedFileName() ); sendUi->CreateAndSendMessageL( KSenduiMtmBtUid, mdata ); CleanupStack::PopAndDestroy( mdata ); CleanupStack::PopAndDestroy( sendUi ); } break; case EMTVSearchViewDownloadCommand: { // iAppUi->CancelDownloadImageL(); iContainer->DownloadL( ); } break; case EMTVAddToPlaylistCommand: { RArray<TInt> indices; CleanupClosePushL( indices ); CAknSinglePopupMenuStyleListBox* plist = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(plist); CAknPopupList* popupList = CAknPopupList::NewL( plist, R_AVKON_SOFTKEYS_MENU_LIST, AknPopupLayouts::EPopupSNotePopupWindow); CleanupStack::PushL(popupList); plist->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); plist->CreateScrollBarFrameL(ETrue); plist->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); MDesCArray* itemList = plist->Model()->ItemTextArray(); CDesCArray* items = (CDesCArray*) itemList; popupList->SetTitleL( KNullDesC() ); HBufC* txt = StringLoader::LoadLC( R_PLAYLIST_CREATE_NEW_TXT ); indices.Append( -1 ); items->AppendL( *txt ); CleanupStack::PopAndDestroy( txt ); TInt count = iManager->PlaylistsCount(); for(TInt i=0;i<count;i++) { CEmTubePlaylist* pl = iManager->Playlist( i ); if( pl->Editable() ) { indices.Append( i ); items->AppendL( pl->Name() ); } } TInt popupOk = popupList->ExecuteLD(); if(popupOk) { TInt idx = indices[ plist->CurrentItemIndex() ]; if( idx == -1 ) { TBuf<64> name; CAknTextQueryDialog* dlg = new(ELeave)CAknTextQueryDialog( name, CAknQueryDialog::ENoTone ); dlg->SetPredictiveTextInputPermitted( ETrue ); TInt ret = dlg->ExecuteLD( R_EMTV_ADD_PLAYLIST_DIALOG ); if( ret ) { iManager->AddPlaylistL( name, CEmTubePlaylist::EPlaylistUserDefined ); idx = iManager->PlaylistsCount() - 1; } } if( idx >= 0 ) { CEmTubePlaylist* pl = iManager->Playlist( idx ); CVideoEntry* e = iAppUi->SearchEntries()[ which ]; if( iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplaySearchEntries || iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplayFavEntries ) pl->AddEntryL( e->Url(), e->MediaTitle(), CEmTubePlaylistEntry::EPlaylistEntryRemote ); else pl->AddEntryL( e->SavedFileName(), e->MediaTitle(), CEmTubePlaylistEntry::EPlaylistEntryLocal ); } } CleanupStack::Pop( popupList ); CleanupStack::PopAndDestroy( plist ); CleanupStack::PopAndDestroy( &indices ); } break; case EMTVSearchViewAddToFCommand: { iContainer->AddCurrentItemToFavsL(); } break; case EMTVSearchViewRemoveFromFCommand: { iContainer->RemoveCurrentItemFromFavsL(); } break; case EMTVSearchCommand: { if( iAppUi->SearchDialogL() ) { // TODO: when displaying featured (for example), new search (from menu) - change navi pane text // if(no tabs, one plugin) // iContainer->SetNaviPaneTextL(); StartProgressBarL( EFalse ); } } break; case EMTVSearchViewPlayCommand: { if( which != KErrNotFound ) { iAppUi->CancelDownloadImageL(); if( iAppUi->SearchDisplayMode() == CEmTubeAppUi::ESearchDisplaySavedEntries ) iAppUi->OpenFileL( iAppUi->SearchEntries()[ which ]->SavedFileName(), iAppUi->SearchEntries()[ which ]->MediaTitle() ); else iAppUi->OpenFileL( iAppUi->SearchEntries()[ which ] ); } } break; case EMTVDeleteClipCommand: { iContainer->DeleteSavedClipL(); } break; case EMTVRenameClipCommand: { iContainer->RenameSavedClipL(); } break; case EMTVShowRelatedCommand: { if( which != KErrNotFound ) { iAppUi->CancelDownloadImageL(); CVideoEntry* e = iAppUi->SearchEntries()[ which ]; iAppUi->SearchString().Copy( e->RelatedUrl() ); StartProgressBarL( EFalse ); iAppUi->ClearSearchResults(); iAppUi->SearchL( ERelatedClips, ERelevance, EPeriodIrrelevant ); } } break; case EMTVShowUserCommand: { if( which != KErrNotFound ) { iAppUi->CancelDownloadImageL(); CVideoEntry* e = iAppUi->SearchEntries()[ which ]; iAppUi->SearchString().Copy( e->AuthorVideosUrl() ); StartProgressBarL( EFalse ); iAppUi->ClearSearchResults(); iAppUi->SearchL( EUserClips, EUpdated, EPeriodIrrelevant ); } } break; case EMTVSearchViewDetailsCommand: { iContainer->ShowToolbar( EFalse ); CEmTubeDetailsDialog::RunDialogL( iAppUi->SearchEntries()[ which ] ); iContainer->ShowToolbar( ETrue ); } break; case EMTVSearchViewBackCommand: { iContainer->ClearToolbar(); iAppUi->CancelDownloadImageL(); iAppUi->HandleCommandL( EMTVActivateMainViewCommand ); } break; case EMTVProgressDialogCancel: { iAppUi->CancelDownloadImageL(); if( iAppUi->SearchEntries().Count() ) iContainer->CancelProgressL(); else iAppUi->HandleCommandL( EMTVActivateMainViewCommand ); } break; default: { iAppUi->HandleCommandL(aCommand); } break; } }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TBool CMainContainer::HandlePopUpMenuSelectionL(TInt& aCommand) { TBool ret(EFalse); TBool isEnable(EFalse),isDisable(EFalse),isRemove(EFalse),isaPreview(EFalse); ShowMenuItemsL(isEnable,isDisable,isRemove,isaPreview); if(!isRemove && !isaPreview){ ret = ETrue; aCommand = EProfModify; }else{ TBuf<100> hjelpper; CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(list); CAknPopupList* popupList = CAknPopupList::NewL(list,R_AVKON_SOFTKEYS_OK_CANCEL); CleanupStack::PushL(popupList); list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto); CArrayFixFlat<TInt>* cmdArray = new (ELeave) CArrayFixFlat<TInt>(5); CleanupStack::PushL(cmdArray); CDesCArrayFlat* Array = new (ELeave) CDesCArrayFlat(5); CleanupStack::PushL(Array); if(isEnable){ StringLoader::Load(hjelpper,R_CMD_ENABLE); Array->AppendL(hjelpper); cmdArray->AppendL(EProfEnable); }else if(isDisable){ StringLoader::Load(hjelpper,R_CMD_DISABLE); Array->AppendL(hjelpper); cmdArray->AppendL(EProfDisable); } if(isaPreview && !iDimPreview){ StringLoader::Load(hjelpper,R_CMD_MODIFY); Array->AppendL(hjelpper); cmdArray->AppendL(EProfModify); StringLoader::Load(hjelpper,R_CMD_PREVIEW); Array->AppendL(hjelpper); cmdArray->AppendL(EProfTest); } if(isRemove){ StringLoader::Load(hjelpper,R_CMD_DELETE); Array->AppendL(hjelpper); cmdArray->AppendL(EProfRemove); } list->Model()->SetItemTextArray(Array); CleanupStack::Pop();//Array list->Model()->SetOwnershipType(ELbmOwnsItemArray); if (popupList->ExecuteLD()) { TInt Selected = list->CurrentItemIndex(); if(Selected >= 0 && Selected < cmdArray->Count()) { ret = ETrue; aCommand = cmdArray->At(Selected); } } CleanupStack::PopAndDestroy(1); // cmdArray CleanupStack::Pop(); // popuplist CleanupStack::PopAndDestroy(1); // list } return ret; }
void CPhotoListView::GetFolder() { TInt PopValue; //TBuf<150> msg; TInt count=0; CDesCArray* items = iPhotosAppUi->GetFolderList(); CDesCArray* foldernames = iPhotosAppUi->ReturnText(); if (items == NULL) { Count = 0; items = new (ELeave) CDesCArrayFlat(1); items->AppendL(foldernames->MdcaPoint(0)); } else { Count = items->MdcaCount(); items->AppendL(foldernames->MdcaPoint(0)); } foldernames->Reset(); CEikTextListBox* list = new( ELeave ) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL( list ); CAknPopupList* popupList = CAknPopupList::NewL( list, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow); CleanupStack::PushL( popupList ); popupList->SetMaximumHeight(2); list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); list->CreateScrollBarFrameL( ETrue ); list->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); CTextListBoxModel* model = list->Model(); model->SetItemTextArray( items ); model->SetOwnershipType( ELbmOwnsItemArray ); count = GetPhotoCount(); // TInt price; // TLex lex(iPhotosAppUi->iCharge); // lex.Val(price); // count = count * price; // TBuf<30> temp; // temp.AppendNum(count); // msg.Copy(_L("Charge ")); // msg.Append(temp); // msg.Append(_L(" pesos")); //msg.Copy(_L("Select Album:")); //msg.Copy(*(iEikonEnv->AllocReadResourceL(R_IMAGES_SELECT_ALBUM))); /*count = count / 3; temp.Copy(_L("")); temp.AppendNum(count); path = iPhotosAppUi->ImageFolderPath(); if(path == 0 || path == 1) msg.Append(_L(" Photos)")); else if(path == 2 || path == 3) msg.Append(_L(" Videos)"));*/ popupList->SetTitleL(*(iEikonEnv->AllocReadResourceL(R_IMAGES_SELECT_ALBUM))); PopValue = popupList->ExecuteLD(); if(PopValue==0) { iFolderStatus=-1; } else if(PopValue==1) { PopValue=list->CurrentItemIndex(); iFolderStatus=PopValue; TPtrC ptr1(items->MdcaPoint(PopValue)); comment.Copy(ptr1); } items->Reset(); CleanupStack::Pop(); // popupList CleanupStack::PopAndDestroy(); // list }