Esempio n. 1
0
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 CMnrpNaviControl::CreateListBoxL()
    {
    // Create a control to display a list of descriptors
    iListBox = new (ELeave) CAknSingleHeadingStyleListBox();
    iListBox->SetContainerWindowL( *this );
    iListBox->ConstructL(this, CEikListBox::EViewerFlag );

    // Create scrollbars
    CEikScrollBarFrame* scrollBar = iListBox->CreateScrollBarFrameL();
    scrollBar->SetScrollBarVisibilityL(
                CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    }