// ----------------------------------------------------------------------------- // CTestSDKLists::TestTXLBGetColorUseListL // ----------------------------------------------------------------------------- // TInt CTestSDKLists::TestTXLBGetColorUseListL( CStifItemParser& /*aItem*/ ) { // Print to UI _LIT( KTestModule, "EIKTXLBXTestModule" ); _LIT( KTestEIKTXLBX, "In TestTXLBGetColorUseListL" ); TestModuleIf().Printf( 0, KTestModule, KTestEIKTXLBX ); // Print to log file iLog->Log( KTestEIKTXLBX ); TInt flags = CEikListBox::EIncrementalMatching | EAknListBoxSelectionList | EAknListBoxViewerFlags; CDesCArray* textArray = iEikonEnvPointer->ReadDesCArrayResourceL( R_TESTLIST_ITEM_SETTING ); CleanupStack::PushL( textArray ); CEikTextListBox* list = new( ELeave ) CEikTextListBox(); CleanupStack::PushL( list ); list->ConstructL( iContainer, flags ); list->Model()->SetItemTextArray( textArray ); list->Model()->SetOwnershipType( ELbmOwnsItemArray ); iContainer->SetControlL( list ); CArrayFixFlat<TCoeColorUse>* colorUseList = new( ELeave ) CArrayFixFlat<TCoeColorUse>( KFour ); CleanupStack::PushL( colorUseList ); list->GetColorUseListL( *colorUseList ); colorUseList->Reset(); CleanupStack::PopAndDestroy( colorUseList ); iContainer->ResetControl(); CleanupStack::Pop( 2 ); return KErrNone; }
// ----------------------------------------------------------------------------- // CTestSDKLists::TestTXLBHandlePointerEventL // ----------------------------------------------------------------------------- // TInt CTestSDKLists::TestTXLBHandlePointerEventL( CStifItemParser& /*aItem*/ ) { // Print to UI _LIT( KTestModule, "EIKTXLBXTestModule" ); _LIT( KTestEIKTXLBX, "In TestTXLBHandlePointerEventL" ); TestModuleIf().Printf( 0, KTestModule, KTestEIKTXLBX ); // Print to log file iLog->Log( KTestEIKTXLBX ); TInt flags = CEikListBox::EIncrementalMatching | EAknListBoxSelectionList | EAknListBoxViewerFlags; CDesCArray* textArray = iEikonEnvPointer->ReadDesCArrayResourceL( R_TESTLIST_ITEM_SETTING ); CleanupStack::PushL( textArray ); CEikTextListBox* list = new( ELeave ) CEikTextListBox(); CleanupStack::PushL( list ); list->ConstructL( iContainer, flags ); list->Model()->SetItemTextArray( textArray ); list->Model()->SetOwnershipType( ELbmOwnsItemArray ); iContainer->SetControlL( list ); TPointerEvent event; event.iType = TPointerEvent::EButton1Down; event.iModifiers = 0; TPoint eventPos( 0, KNine ); event.iPosition = eventPos; event.iParentPosition = eventPos; list->HandlePointerEventL( event ); iContainer->ResetControl(); CleanupStack::Pop( 2 ); return KErrNone; }
void CProfileListDialog::PreLayoutDynInitL() { ButtonGroupContainer().SetDefaultCommand(ECmdProfileListConnect); iProfileArray = new (ELeave) CDesCArrayFlat(8); // Add default as the first profile iProfileArray->AppendL(KDefaultProfileName); // Find all profile files from the profile directory and add them to the // list RFs &fs = CEikonEnv::Static()->FsSession(); CDir *dir; User::LeaveIfError(fs.GetDir(iProfileDirectory, KEntryAttNormal, ESortByName, dir)); CleanupStack::PushL(dir); for ( TInt i = 0; i < dir->Count(); i++ ) { iProfileArray->AppendL((*dir)[i].iName); } CleanupStack::PopAndDestroy(); //dir // Set profiles to the listbox CEikTextListBox *lbox = ((CEikTextListBox*)Control(EProfileListDlgProfileList)); CTextListBoxModel *lbm = lbox->Model(); lbm->SetItemTextArray(iProfileArray); lbm->SetOwnershipType(ELbmDoesNotOwnItemArray); // Enable scroll bars CEikScrollBarFrame *sbf = lbox->CreateScrollBarFrameL(ETrue); sbf->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto); ButtonGroupContainer().SetDefaultCommand(ECmdProfileListConnect); }
void CDefaultNumbersPopupList::ConstructL() { CALLSTACKITEM_N(_CL("CDefaultNumbersPopupList"), _CL("ConstructL")); iListbox = new (ELeave) CAknDoublePopupMenuStyleListBox; iPhoneDefault =CEikonEnv::Static()->AllocReadResourceL(R_DEFAULT_PHONE); iSmsDefault =CEikonEnv::Static()->AllocReadResourceL(R_DEFAULT_SMS); iMmsDefault =CEikonEnv::Static()->AllocReadResourceL(R_DEFAULT_MMS); iEmailDefault =CEikonEnv::Static()->AllocReadResourceL(R_DEFAULT_EMAIL); iNoDefault =CEikonEnv::Static()->AllocReadResourceL(R_NO_DEFAULT); iDefault = CEikonEnv::Static()->AllocReadResourceL(R_DEFAULTS); iArrayItems = new CDesCArrayFlat(1); PopulateListbox(); // original contsructl CAknPopupList::ConstructL(iListbox, R_DEFAULT_POPUP_CBA, AknPopupLayouts::EMenuDoubleWindow); CAknPopupList::SetTitleL(*iDefault); iListbox->ConstructL(this, CEikListBox::ELeftDownInViewRect); iListbox->CreateScrollBarFrameL(ETrue); iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); CTextListBoxModel* model = iListbox->Model(); model->SetItemTextArray(iArrayItems); model->SetOwnershipType(ELbmDoesNotOwnItemArray); }
void CBTDevApContainer::ContentsChanged() { CALLSTACKITEM_N(_CL("CBTDevApContainer"), _CL("ContentsChanged")); CC_TRAPD(err, if (iListBox) iListBox->HandleItemRemovalL(); iListBox->SetCurrentItemIndexAndDraw(0); iListBox->DrawNow(););
void CDefaultNumbersPopupList::Refresh() { CALLSTACKITEM_N(_CL("CDefaultNumbersPopupList"), _CL("Refresh")); iArrayItems->Reset(); iArrayItems->Compress(); PopulateListbox(); iListbox->HandleItemRemovalL(); }
// ----------------------------------------------------------------------------- // CSecModUIModel::LoadTokenLabelsL(CEikTextListBox& aListBox) // ----------------------------------------------------------------------------- // void CSecModUIModel::LoadTokenLabelsL(CEikTextListBox& aListBox) { LOG_ENTERFN("CSecModUIModel::LoadTokenLabelsL()"); TInt keyStoreCount = iAOKeyStores.Count(); if (0 == keyStoreCount) { LOG_WRITE_FORMAT("keyStoreCount == %i",keyStoreCount); LOG_LEAVEFN("CSecModUIModel::LoadTokenLabelsL()"); //disable the scrollbar if no keystore aListBox.ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOff); return; } TBuf<KItemLength> item; TBuf<KItemLength> label; CDesCArray* itemArray = STATIC_CAST(CDesCArray*, aListBox.Model()->ItemTextArray()); for (TInt i = 0; i < keyStoreCount; i++) { if (iAOKeyStores[i]->Token().TokenType().Type().iUid == KTokenTypeFileKeystore) { AppendResourceL(label, R_QTN_KEYSTORE_LIST_TEXT_PHONE_KEYSTORE); } else { label = iAOKeyStores[i]->Token().Label(); } item += KTab; item += label; item += KTab; AppendLocationL(item, iAOKeyStores[i]->Token().TokenType().Type()); item.SetLength(item.Length() - 1); // Remove \n from the end itemArray->AppendL(item); label.Zero(); item.Zero(); } LOG_LEAVEFN("CSecModUIModel::LoadTokenLabelsL()"); }
// ----------------------------------------------------------------------------- // CTestSDKLists::TestTXLBConstructL // ----------------------------------------------------------------------------- // TInt CTestSDKLists::TestTXLBConstructL( CStifItemParser& /*aItem*/ ) { // Print to UI _LIT( KTestModule, "EIKTXLBXTestModule" ); _LIT( KTestEIKTXLBX, "In TestTXLBConstructL" ); TestModuleIf().Printf( 0, KTestModule, KTestEIKTXLBX ); // Print to log file iLog->Log( KTestEIKTXLBX ); TInt flags = CEikListBox::EIncrementalMatching | EAknListBoxSelectionList | EAknListBoxViewerFlags; CEikTextListBox* list = new( ELeave ) CEikTextListBox(); CleanupStack::PushL( list ); list->ConstructL( iContainer, flags ); CleanupStack::PopAndDestroy( list ); return KErrNone; }
// ----------------------------------------------------------------------------- // CTestSDKLists::TestTXLBConstructFromResourceL // ----------------------------------------------------------------------------- // TInt CTestSDKLists::TestTXLBConstructFromResourceL( CStifItemParser& /*aItem*/ ) { // Print to UI _LIT( KTestModule, "EIKTXLBXTestModule" ); _LIT( KTestEIKTXLBX, "In TestTXLBConstructFromResourceL" ); TestModuleIf().Printf( 0, KTestModule, KTestEIKTXLBX ); // Print to log file iLog->Log( KTestEIKTXLBX ); CEikTextListBox* textList = new( ELeave ) CEikTextListBox(); CleanupStack::PushL( textList ); textList->SetContainerWindowL( *iContainer ); TResourceReader textReader; iEikonEnvPointer->CreateResourceReaderLC( textReader, R_TESTLIST_SINGLE_1 ); textList->ConstructFromResourceL( textReader ); CleanupStack::PopAndDestroy(); CleanupStack::PopAndDestroy( textList ); return KErrNone; }
// ----------------------------------------------------------------------------- // CTestSDKQueries::TestLqdlgHandleListBoxEventL // ----------------------------------------------------------------------------- // TInt CTestSDKQueries::TestLqdlgHandleListBoxEventL( CStifItemParser& /*aItem*/ ) { TInt selectedOption( KZero ); CDesCArrayFlat* mArray = new (ELeave) CDesCArrayFlat( KTen ); CleanupStack::PushL( mArray ); TBuf< KTen > palabra; for (TInt num = KZero; num< KTen; num++) { palabra.Format(_L("option %d"), num); mArray->AppendL(palabra); } CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &selectedOption ); dlg->PrepareLC( R_UPDATE_QUERY_DIALOG ); dlg->SetItemTextArray( mArray ); dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); CEikTextListBox* listBox = new( ELeave ) CEikTextListBox; CleanupStack::PushL( listBox ); CAknPopupList* popupList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_OK_BACK ); CleanupStack::PushL( popupList ); listBox->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); dlg->HandleListBoxEventL( listBox, MEikListBoxObserver::EEventEnterKeyPressed ); dlg->HandleListBoxEventL( listBox, MEikListBoxObserver::EEventPenDownOnItem ); dlg->HandleListBoxEventL( listBox, MEikListBoxObserver::EEventItemDraggingActioned ); dlg->HandleListBoxEventL( listBox, MEikListBoxObserver::EEventItemClicked ); dlg->HandleListBoxEventL( listBox, MEikListBoxObserver::EEventEditingStarted ); CleanupStack::Pop( popupList ); CleanupStack::PopAndDestroy( listBox ); CleanupStack::PopAndDestroy( dlg ); CleanupStack::PopAndDestroy( mArray ); return KErrNone; }
TBool CProfileListDialog::OkToExitL(TInt aButtonId) { TBool okToExit = EFalse; CEikTextListBox *lbox = ((CEikTextListBox*)Control(EProfileListDlgProfileList)); // Buffers for current and new file names and a name HBufC *fileNameBuf = HBufC::NewLC(KMaxFileName); TPtr fileName = fileNameBuf->Des(); HBufC *nameBuf = HBufC::NewLC(KMaxFileName); TPtr name = nameBuf->Des(); switch ( aButtonId ) { case ECmdProfileListConnect: { // Connect to the selected profile TInt sel = lbox->CurrentItemIndex(); if ( sel == KDefaultProfileIndex ) { iProfileFile = iDefaultProfileFile; } else { iProfileFile = iProfileDirectory; iProfileFile.Append((*iProfileArray)[sel]); } okToExit = ETrue; break; } case ECmdProfileListEdit: { // Edit the selected profile TInt sel = lbox->CurrentItemIndex(); if ( sel == KDefaultProfileIndex ) { name = KDefaultProfileName; fileName = iDefaultProfileFile; } else { name = (*iProfileArray)[sel]; fileName = iProfileDirectory; fileName.Append(name); } // Edit settings iPutty->ReadConfigFileL(fileName); Config *cfg = iPutty->GetConfig(); CSettingsDialog *dlg = new (ELeave) CSettingsDialog(name, (sel == KDefaultProfileIndex), cfg, iPutty); switch ( dlg->ExecuteLD(R_SETTINGS_DIALOG) ) { case EEikBidOk: // Handle rename first if ( (sel != KDefaultProfileIndex) && (name.Compare((*iProfileArray)[sel]) != 0) ) { MakeNameLegal(name); // Delete current file so that we can rename to a file // that maps to the same name (e.g. changes in case) User::LeaveIfError( CEikonEnv::Static()->FsSession().Delete(fileName)); MakeNameUniqueL(name); fileName = iProfileDirectory; fileName.Append(name); // Update profile list and listbox iProfileArray->Delete(sel); iProfileArray->InsertL(sel, name); lbox->DrawNow(); } // Just write, the name can be an old one or a renamed one iPutty->WriteConfigFileL(fileName); break; case ECmdSettingsDelete: if ( sel != KDefaultProfileIndex ) { // Remove the profile from the list and update // listbox iProfileArray->Delete(sel); lbox->HandleItemRemovalL(); if ( sel >= iProfileArray->Count() ) { sel = iProfileArray->Count() - 1; } lbox->SetCurrentItemIndexAndDraw(sel); // Delete profile file User::LeaveIfError( CEikonEnv::Static()->FsSession().Delete(fileName)); } break; default: break; } okToExit = EFalse; break; } case ECmdProfileListNew: { // New profile -- start with defaults, but with a new name iPutty->ReadConfigFileL(iDefaultProfileFile); Config *cfg = iPutty->GetConfig(); name = KNewProfileName; MakeNameUniqueL(name); CSettingsDialog *dlg = new (ELeave) CSettingsDialog(name, EFalse, cfg, iPutty); if ( dlg->ExecuteLD(R_SETTINGS_DIALOG) == EEikBidOk ) { // Finalize name MakeNameLegal(name); MakeNameUniqueL(name); fileName = iProfileDirectory; fileName.Append(name); // Update the listbox iProfileArray->AppendL(name); lbox->HandleItemAdditionL(); lbox->SetCurrentItemIndexAndDraw(iProfileArray->Count() - 1); // Write out new settings iPutty->WriteConfigFileL(fileName); } okToExit = EFalse; break; } case ECmdProfileListClose: okToExit = ETrue; break; default: User::Invariant(); } CleanupStack::PopAndDestroy(2); //fileNameBuf, nameBuf return okToExit; }
void CDefaultNumbersPopupList::DisplaySelection() { CALLSTACKITEM_N(_CL("CDefaultNumbersPopupList"), _CL("DisplaySelection")); CPbkSelectFieldDlg * dlg = new CPbkSelectFieldDlg; CleanupStack::PushL(dlg); CPbkFieldArray& fields = aItem->CardFields(); //original CPbkFieldArray * to_display = new CPbkFieldArray(); // with selected CleanupStack::PushL(to_display); TInt idx = iListbox->CurrentItemIndex(); TInt focus = -1; switch (idx) { case 0: //default phone { for( int i=0; i<fields.Count();i++ ) { if ( (fields.At(i)).FieldInfo().IsPhoneNumberField() ) { to_display->AppendL(fields.At(i)); if ( (fields.At(i)).DefaultPhoneNumberField() ) { focus = (to_display->Count() -1); } } } TPbkContactItemField * field = dlg->ExecuteLD(*to_display, R_SELECT_NONE_CBA,KNullDesC,focus ); if (!field) { aItem->RemoveDefaultPhoneNumberField(); } else { aItem->SetDefaultPhoneNumberFieldL(field); } break; } case 1: // default sms { for( int i=0; i<fields.Count();i++ ) { if ( (fields.At(i)).FieldInfo().IsPhoneNumberField() ) { to_display->AppendL(fields.At(i)); if ( (fields.At(i)).DefaultSmsField() ) { focus = (to_display->Count() -1); } } } TPbkContactItemField * field = dlg->ExecuteLD(*to_display, R_SELECT_NONE_CBA,KNullDesC,focus ); if (!field) { aItem->RemoveDefaultSmsField(); } else { aItem->SetDefaultSmsFieldL(field); } break; } case 2: //default mms { for( int i=0; i<fields.Count();i++ ) { if ( (fields.At(i)).FieldInfo().IsMmsField() ) { to_display->AppendL(fields.At(i)); if ( (fields.At(i)).DefaultMmsField() ) { focus = (to_display->Count() -1); } } } TPbkContactItemField * field = dlg->ExecuteLD(*to_display, R_SELECT_NONE_CBA,KNullDesC,focus ); if (!field) { aItem->RemoveDefaultMmsField(); } else { aItem->SetDefaultMmsFieldL(field); } break; } case 3: // default email { for( int i=0; i<fields.Count();i++ ) { if ( (fields.At(i)).FieldInfo().IsMmsField() && !(fields.At(i)).FieldInfo().IsPhoneNumberField() ) { to_display->AppendL(fields.At(i)); if ( (fields.At(i)).DefaultEmailField() ) { focus = (to_display->Count() -1); } } } TPbkContactItemField * field = dlg->ExecuteLD(*to_display, R_SELECT_NONE_CBA,KNullDesC, focus ); if (!field) { aItem->RemoveDefaultEmailField(); } else { aItem->SetDefaultEmailFieldL(field); } break; } default: break; } CleanupStack::PopAndDestroy(); //to_display CleanupStack::Pop(); // dlg Refresh(); }
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 }