// ---------------------------------------------------------
// CAppSoftkeysObserver::UpdateSoftkeyL
// ---------------------------------------------------------
//
void 
CAppSoftkeysObserver::UpdateSoftkeyL(TBrCtlKeySoftkey /*aKeySoftkey*/,
                                                const TDesC& /*aLabel*/,
                                                TUint32 /*aCommandId*/,
                                                TBrCtlSoftkeyChangeReason /*aBrCtlSoftkeyChangeReason*/) 
    {
    CBrCtlInterface* brCtl = iAppView->BrCtlInterface();

    TBrCtlDefs::TBrCtlElementType type = brCtl->FocusedElementType();

    CEikButtonGroupContainer* current = CEikButtonGroupContainer::Current();
    
    switch (type)
        {
    	case TBrCtlDefs::EElementActivatedObjectBox:
        case TBrCtlDefs::EElementActivatedInputBox:
            current->SetCommandSetL( R_AVKON_SOFTKEYS_CANCEL );
            break;
        
        default:
            current->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
            break;
        }
    current->DrawNow();
    }
// Activates this view, called by framework
void CAafAppFileBrowserView::ViewActivatedL(const TVwsViewId &/*aPrevViewId*/, TUid /*aCustomMessageId*/, const TDesC8 &/*aCustomMessage*/)
{
	// Set files to be displayed
	SetFileListL(iBrowserEngine->GetCurrentDirectory());

	// Set menubar and CBA
	CEikonEnv* eikonEnv = CEikonEnv::Static();
	MEikAppUiFactory* appUiFactory = eikonEnv->AppUiFactory();

	CEikMenuBar* menuBar = appUiFactory->MenuBar();
	CEikButtonGroupContainer* cba = appUiFactory->Cba();

	// If any menubar is displayed - stop displaying
	if (menuBar)
		menuBar->StopDisplayingMenuBar();

	menuBar->SetMenuTitleResourceId(R_AAF_FILEBROWSER_MENUBAR);

	cba->SetCommandSetL(R_AAF_CBA_STANDART);
	cba->DrawDeferred();

	// Bring this view to the top of windows stack
	Window().SetOrdinalPosition(0);

	// Restore listbox item selection (if it's not empty)
	if (iListBox->Model()->NumberOfItems())
		iListBox->SetCurrentItemIndex(iCurrentItemIndex);

	// Set view visible
	MakeVisible(ETrue);
}
/**
 *	Handles user actions during activation of the view, 
 *	such as initializing the content.
 */
void Csymbian_ua_guiSettingItemListView::DoActivateL(
		const TVwsViewId& aPrevViewId,
		TUid /*aCustomMessageId*/,
		const TDesC8& /*aCustomMessage*/ )
	{
	
	previousView = aPrevViewId.iViewUid;
	
	SetupStatusPaneL();
	
	CEikButtonGroupContainer* cba = AppUi()->Cba();
	if ( cba != NULL ) 
		{
		cba->MakeVisible( EFalse );
		}
	
	if ( iSymbian_ua_guiSettingItemList == NULL )
		{
		iSettings = TSymbian_ua_guiSettingItemListSettings::NewL();
		
		CVoIPDocument* doc = static_cast<CVoIPDocument*>(CEikonEnv::Static()->EikAppUi()->Document());
		doc->LoadSettingValuesL(*iSettings);
		
		iSymbian_ua_guiSettingItemList = new ( ELeave ) CSymbian_ua_guiSettingItemList( *iSettings, this );
		iSymbian_ua_guiSettingItemList->SetMopParent( this );
		iSymbian_ua_guiSettingItemList->ConstructFromResourceL( R_SYMBIAN_UA_GUI_SETTING_ITEM_LIST_SYMBIAN_UA_GUI_SETTING_ITEM_LIST );
		iSymbian_ua_guiSettingItemList->ActivateL();
		//iSymbian_ua_guiSettingItemList->LoadSettingValuesL();
		iSymbian_ua_guiSettingItemList->LoadSettingsL();
		AppUi()->AddToStackL( *this, iSymbian_ua_guiSettingItemList );
		} 
	// ]]] end generated region [Generated Contents]
	
	}
/**
 *	Handles user actions during activation of the view,
 *	such as initializing the content.
 */
void Csymbian_ua_guiSettingItemListView::DoActivateL (
    const TVwsViewId& /*aPrevViewId*/,
    TUid /*aCustomMessageId*/,
    const TDesC8& /*aCustomMessage*/)
{
    // [[[ begin generated region: do not modify [Generated Contents]
    SetupStatusPaneL();

    CEikButtonGroupContainer* cba = AppUi()->Cba();

    if (cba != NULL) {
        cba->MakeVisible (EFalse);
    }

    if (iSymbian_ua_guiSettingItemList == NULL) {
        iSettings = TSymbian_ua_guiSettingItemListSettings::NewL();
        iSymbian_ua_guiSettingItemList = new (ELeave) CSymbian_ua_guiSettingItemList (*iSettings, this);
        iSymbian_ua_guiSettingItemList->SetMopParent (this);
        iSymbian_ua_guiSettingItemList->ConstructFromResourceL (R_SYMBIAN_UA_GUI_SETTING_ITEM_LIST_SYMBIAN_UA_GUI_SETTING_ITEM_LIST);
        iSymbian_ua_guiSettingItemList->ActivateL();
        iSymbian_ua_guiSettingItemList->LoadSettingValuesL();
        iSymbian_ua_guiSettingItemList->LoadSettingsL();
        AppUi()->AddToStackL (*this, iSymbian_ua_guiSettingItemList);
    }

    // ]]] end generated region [Generated Contents]

}
Exemple #5
0
QT_BEGIN_NAMESPACE

/*!
  \class QS60MainAppUi
  \since 4.6
  \brief The QS60MainAppUi class is a helper class for S60 migration.

  \warning This class is provided only to get access to S60 specific
  functionality in the application framework classes. It is not
  portable. We strongly recommend against using it in new applications.

  The QS60MainAppUi provides a helper class for use in migrating from
  existing S60 based applications to Qt based applications. It is used
  in the exact same way as the \c CAknAppUi class from Symbian, but
  internally provides extensions used by Qt.

  When modifying old S60 applications that rely on implementing
  functions in \c CAknAppUi, the class should be modified to inherit
  from this class instead of \c CAknAppUi. Then the application can
  choose to override only certain functions.

  For more information on \c CAknAppUi, please see the S60
  documentation.

  Unlike other Qt classes, QS60MainAppUi behaves like an S60 class,
  and can throw Symbian leaves.

  \sa QS60MainDocument, QS60MainApplication
 */

/*!
 * \brief Second phase Symbian constructor.
 *
 * Constructs all the elements of the class that can cause a leave to happen.
 *
 * If you override this function, you should call the base class implementation as well.
 */
void QS60MainAppUi::ConstructL()
{
    // Cone's heap and handle checks on app destruction are not suitable for Qt apps, as many
    // objects can still exist in static data at that point. Instead we will print relevant information
    // so that comparative checks may be made for memory leaks, using ~SPrintExitInfo in corelib.
    iEikonEnv->DisableExitChecks(ETrue);

    // Initialise app UI with standard value.
    // ENoAppResourceFile and ENonStandardResourceFile makes UI to work without
    // resource files in most SDKs. S60 3rd FP1 public seems to require resource file
    // even these flags are defined
    TInt flags = CAknAppUi::EAknEnableSkin;
    if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)) {
        flags |= CAknAppUi::ENoScreenFurniture | CAknAppUi::ENonStandardResourceFile;
    }
    BaseConstructL(flags);

    if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)) {
        CEikButtonGroupContainer* nativeContainer = Cba();
        nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
    }
}
void CZXingBarcodeReaderAppUi::UseOptionsBackCbaL()
    {
    CEikButtonGroupContainer* cba = Cba();
    if (cba)
        {
        cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
        cba->DrawNow();
        }
    }
// ---------------------------------------------------------------------------
// CBCTestMix50Case::TestCEikCbaCaseL()
// ( menu item -6.1- )
// ---------------------------------------------------------------------------
//
void CBCTestMix50Case::TestCEikCbaCaseL()
{
    CEikButtonGroupContainer* btnGroupContainer =
                                 CEikButtonGroupContainer::Current();
    

    CEikCba *eikcba = static_cast<CEikCba*>( btnGroupContainer->ButtonGroup() );
    eikcba->HandleControlEventL(eikcba, MCoeControlObserver::EEventStateChanged);
    _LIT(KHandleControlEvent, "CCoeControl::HandleControlEventL");
    AssertTrueL(ETrue, KHandleControlEvent);

}
TBool CZXingBarcodeReaderAppUi::IsBackCBA()
    {
    CEikButtonGroupContainer* cba = Cba();
    // NOTE: There should be EAknSoftkeyBack in the application because
    // we use R_AVKON_SOFTKEYS_SELECT_BACK, but it seems that there is EAknSoftkeyCancel
    CCoeControl* back = cba->ControlOrNull(EAknSoftkeyBack);
    CCoeControl* cancel = cba->ControlOrNull(EAknSoftkeyCancel);
    if (back || cancel)
        return ETrue;
    else
        return EFalse;
    }
Exemple #9
0
void CCSMainView::DoDeactivate()
{
    CEikButtonGroupContainer* cba = AppUi()->Cba();
    if ( cba != NULL ) {
        cba->MakeVisible( ETrue );
        cba->DrawDeferred();
    }

    if ( iContainer != NULL ) {
        AppUi()->RemoveFromStack( iContainer );
        delete iContainer;
        iContainer = NULL;
    }
}
Exemple #10
0
void CPingAppUi::ShowSettingViewL()
{
    iAppView->MakeVisible( EFalse );
    AppViewFromStack();
    SettingViewToStackL();
    iSettingView->MakeVisible( ETrue );
    iSettingView->DrawNow();

    CEikButtonGroupContainer *cba = ((CAknAppUi*)CEikonEnv::Static()->EikAppUi())->Cba();
    cba->SetCommandSetL(R_SETTINGS_CBA);
    cba->DrawDeferred();

    // Make sure that scroll bars are shown if needed
    iSettingView->ListBox()->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOn, CEikScrollBarFrame::EAuto);
    iSettingView->ListBox()->UpdateScrollBarsL();
}
Exemple #11
0
void CPingAppUi::ShowAppViewL()
{
    iSettingView->MakeVisible( EFalse );
    SettingViewFromStack();
    AppViewToStackL();
    iAppView->MakeVisible( ETrue );
    iAppView->DrawNow();

    CEikButtonGroupContainer *cba = ((CAknAppUi*)CEikonEnv::Static()->EikAppUi())->Cba();
    cba->SetCommandSetL(R_PING_CBA);
    cba->DrawDeferred();

    // Make sure that setting view's scroll indicators are not shown in the app view
    iSettingView->ListBox()->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff);
    iSettingView->ListBox()->UpdateScrollBarsL();
}
Exemple #12
0
void CCSMainView::DoActivateL( const TVwsViewId& aPrevViewId,
                               TUid aCustomMessageId,
                               const TDesC8& aCustomMessage )
{
    CViewBase::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage);

    // Explicitly hide the arrows in navipane since on s60v5 they tend to
    // show up in some views otherwise.
    iWayfinderAppUi->setNaviPane(EFalse);

    HBufC* titleText = StringLoader::LoadLC(R_TITLEPANE_SEARCH_TEXT);
    iWayfinderAppUi->setTitleText(titleText->Des());
    CleanupStack::PopAndDestroy(titleText);
    iSavedData.iUseFromGps = (iSavedData.iUseFromGps && IsGpsConnectedOrCellidAvailable() );
    iSavedData.iCountryId = iSavedData.iSavedCountryId;
    InitToolbarL();

    CEikButtonGroupContainer* cba = AppUi()->Cba();
    if ( cba != NULL ) {
        cba->MakeVisible( EFalse );
    }

    if ( iContainer == NULL ) {
        if (iSavedData.iCountry.Length() == 0)
        {
            TInt countryID = iWayfinderAppUi->GetCellCountry();
            if (countryID >= 0) {
                CDataHolder* dataHolder = iWayfinderAppUi->GetDataHolder();
                iSavedData.iCountryId = countryID;
                iSavedData.iSavedCountryId = countryID;
                iSavedData.iCountry.Copy(*dataHolder->GetCountryFromId(countryID));
            }
            if (!(countryID >= 0 || IsGpsConnected()))
            {
                iSavedData.iUseFromGps = 0;
            }
        }

        CCSMainContainer* form = CCSMainContainer::NewL( this, *this, iSavedData );
        form->SetUpdate(ETrue);
        form->SetMopParent( this );
        form->ExecuteLD( R_WAYFINDER_CS_SEARCH_FORM );
        AppUi()->AddToStackL( *this, form );
        iContainer = form;
    }
}
// Activates this view, called by framework
void CAafAppCameraView::ViewActivatedL(const TVwsViewId &aPrevViewId, TUid aCustomMessageId, const TDesC8 &aCustomMessage)
{
	__LOGSTR_TOFILE("CAafAppCameraView::ViewActivatedL() ends");

	if (!iContainer)
	{
		__LOGSTR_TOFILE("CAafAppCameraView::ViewActivatedL() iContainer initialization begins");

		iContainer = CAafCameraContainer::NewL( Rect() );
		iContainer->SetContainerWindowL( *this );
		
		iContainer->ActivateL();
		__LOGSTR_TOFILE("CAafAppCameraView::ViewActivatedL() iContainer initialization ends");
	}
	else
	{
		iContainer->ActivateL();
		iContainer->InitCameraL();
	}

	// Set menubar and CBA
	CEikonEnv* eikonEnv = CEikonEnv::Static();
	MEikAppUiFactory* appUiFactory = eikonEnv->AppUiFactory();


	CEikMenuBar* menuBar = appUiFactory->MenuBar();
	CEikButtonGroupContainer* cba = appUiFactory->Cba();

	// If any menubar is displayed - stop displaying
	if (menuBar)
		menuBar->StopDisplayingMenuBar();

	menuBar->SetMenuTitleResourceId(R_AAF_CAMERA_VIEW_MENUBAR);

	cba->SetCommandSetL(R_AAF_CBA_STANDART);
	cba->DrawDeferred();

	// Bring this view to the top of windows stack
	Window().SetOrdinalPosition(0);

	MakeVisible(ETrue);

	__LOGSTR_TOFILE("CAafAppCameraView::ViewActivatedL() ends");
}
void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonGroupContainer &cba)
{
    RDrawableWindow *cbaWindow = cba.DrawableWindow();
    Q_ASSERT_X(cbaWindow, Q_FUNC_INFO, "Native CBA does not have window!");
    // CBA comes on top of new option menu
    int pos = 0;
   
    if(cba.ButtonGroupType()== SLafButtonGroupContainer::ECba)
        pos = 1;
    
    cbaWindow->SetOrdinalPosition(pos);
    // Qt shares same CBA instance between top-level widgets,
    // make sure we are not faded by underlying window.
    cbaWindow->SetFaded(EFalse, RWindowTreeNode::EFadeIncludeChildren);
    // Modal dialogs capture pointer events, but shared cba instance
    // shall stay responsive. Raise pointer capture priority to keep
    // softkeys responsive in modal dialogs
    cbaWindow->SetPointerCapturePriority(1);
}
// ---------------------------------------------------------
// CBrCtlSampleAppSoftkeysObserver::UpdateSoftkeyL
// ---------------------------------------------------------
//
void 
CBrCtlSampleAppSoftkeysObserver::UpdateSoftkeyL(TBrCtlKeySoftkey /*aKeySoftkey*/,
                                                const TDesC& /*aLabel*/,
                                                TUint32 /*aCommandId*/,
                                                TBrCtlSoftkeyChangeReason /*aBrCtlSoftkeyChangeReason*/) 
    {
    CBrCtlInterface* brCtl = iContainer->BrCtlInterface();

    TBrCtlDefs::TBrCtlElementType type = brCtl->FocusedElementType();

    CEikButtonGroupContainer* current = CEikButtonGroupContainer::Current();
    switch (type)
        {
        case TBrCtlDefs::EElementInputBox:
//            current->SetCommandSetL( R_INPUT_ELEMENT_BUTTONS );
            break;
        
        default:
//            current->SetCommandSetL( R_BROWSER_DEFAULT_BUTTONS );
            break;
        }
    current->DrawNow();
    }
void Csymbian_ua_guiSettingItemListView::DoDeactivate()
	{
	// [[[ begin generated region: do not modify [Generated Contents]
	CleanupStatusPane();
	
	CEikButtonGroupContainer* cba = AppUi()->Cba();
	if ( cba != NULL ) 
		{
		cba->MakeVisible( ETrue );
		cba->DrawDeferred();
		}
	
	if ( iSymbian_ua_guiSettingItemList != NULL )
		{
		AppUi()->RemoveFromStack( iSymbian_ua_guiSettingItemList );
		delete iSymbian_ua_guiSettingItemList;
		iSymbian_ua_guiSettingItemList = NULL;
		delete iSettings;
		iSettings = NULL;
		}
	// ]]] end generated region [Generated Contents]
	
	}
// ---------------------------------------------------------------------------
// CBCTestMix50Case::TestCEikButtonGroupContainerCaseL()
// ( menu item -6- )
// ---------------------------------------------------------------------------
//
void CBCTestMix50Case::TestCEikButtonGroupContainerCaseL()
    {
    TInt pos = 0;
    TBCTestCommandObserver cmdObserver;
    CEikButtonGroupContainer* btnGroupContainer =
                                 CEikButtonGroupContainer::Current();

    btnGroupContainer->UpdateCommandObserverL( pos, cmdObserver );
    _LIT( KTxtUpdateCommandObserverL,
         "CEikButtonGroupContainer::UpdateCommandObserverL" );
    AssertTrueL( ETrue,  KTxtUpdateCommandObserverL );

    btnGroupContainer->UpdatedCommandObserverExists(
                           CEikButtonGroupContainer::ELeftSoftkeyPosition );
    _LIT( KTxtUpdatedCommandObserverExists,
         "CEikButtonGroupContainer::UpdatedCommandObserverExists" );
    AssertTrueL( ETrue, KTxtUpdatedCommandObserverExists );

    btnGroupContainer->RemoveCommandObserver( pos );
    _LIT( KTxtRemoveCommandObserver,
         "CEikButtonGroupContainer::RemoveCommandObserver" );
    AssertTrueL( ETrue, KTxtRemoveCommandObserver );
    
    }
Exemple #18
0
void QWidgetPrivate::show_sys()
{
    Q_Q(QWidget);

    if (q->testAttribute(Qt::WA_OutsideWSRange))
        return;

    Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));

    q->setAttribute(Qt::WA_Mapped);

    if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
        invalidateBuffer(q->rect());
        return;
    }

    if (q->internalWinId()) {
        if (!extra->activated)
             activateSymbianWindow();

         QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
         const bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
         const TBool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint;

#ifdef Q_WS_S60
        // Lazily initialize the S60 screen furniture when the first window is shown.
        if (q->isWindow() && !QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
                && !S60->buttonGroupContainer() && !S60->statusPane()) {

            if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {

                // Create the status pane and CBA here
                CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi());
                MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory();

                QT_TRAP_THROWING(
                    factory->CreateResourceIndependentFurnitureL(ui);

                    TRect boundingRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();

                    CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba,
                        CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
                    if (isFullscreen && !cbaRequested)
                        cba->MakeVisible(false);

                    CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba);
                    Q_ASSERT(!oldCba);
                    S60->setButtonGroupContainer(cba);

                    // If the creation of the first widget is delayed, for example by doing it
                    // inside the event loop, S60 somehow "forgets" to set the visibility of the
                    // toolbar (the three middle softkeys) when you flip the phone over, so we
                    // need to do it ourselves to avoid a "hole" in the application, even though
                    // Qt itself does not use the toolbar directly..
                    CAknAppUi *appui = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
                    if (appui) {
                        CAknToolbar *toolbar = appui->PopupToolbar();
                        if (toolbar && !toolbar->IsVisible())
                            toolbar->SetToolbarVisibility(ETrue);
                    }

                    CEikMenuBar *menuBar = new(ELeave) CEikMenuBar;
                    menuBar->ConstructL(ui, 0, R_AVKON_MENUPANE_EMPTY);
                    menuBar->SetMenuType(CEikMenuBar::EMenuOptions);
                    S60->appUi()->AddToStackL(menuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);

                    CEikMenuBar *oldMenu = factory->SwapMenuBar(menuBar);
                    Q_ASSERT(!oldMenu);
                )

                if (S60->statusPane()) {
                    // Use QDesktopWidget as the status pane observer to proxy for the AppUi.
                    // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver.
                    QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId());
                    S60->statusPane()->SetObserver(desktopControl);
                    if (isFullscreen) {
                        const bool cbaVisible = S60->buttonGroupContainer() && S60->buttonGroupContainer()->IsVisible();
                        S60->setStatusPaneAndButtonGroupVisibility(false, cbaVisible);
                    }
                }
            }
        }
// ---------------------------------------------------------------------------
// CAknMemorySelectionDialogMultiDrive::ExecuteL
// ---------------------------------------------------------------------------
//
EXPORT_C CAknCommonDialogsBase::TReturnKey
    CAknMemorySelectionDialogMultiDrive::ExecuteL(
        TDriveNumber& aSelectedDrive, TDes* aRootPath, TDes* aDefaultFolder )
    {
    __ASSERT_DEBUG( iTitle && iLeftSoftkey && iRightSoftkey,
        User::Panic( KCFDPanicText, ECFDPanicTitleOrSoftkeyNotSet ) );

    iModel->UpdateItemsL();
    TBool doubleStyle( AknCFDUtility::DirectoriesOnly( iDialogType ) );
    CEikFormattedCellListBox* listBox = NULL;
    if( doubleStyle )
        {
        listBox = new( ELeave ) CAknDoubleLargeGraphicPopupMenuStyleListBox();
        }
    else
        {
        listBox = new( ELeave ) CAknSingleGraphicPopupMenuStyleListBox();
        }
    CleanupStack::PushL( listBox );

    AknPopupLayouts::TAknPopupLayouts layout( doubleStyle ?
        AknPopupLayouts::EMenuDoubleLargeGraphicWindow :
        AknPopupLayouts::EMenuGraphicWindow );
    TBool isEndKeyPress = EFalse;
    CAknCommonDialogsPopupList* popupList =
        CAknCommonDialogsPopupList::NewL(
            *iEventHandler, listBox, layout, isEndKeyPress );
    CleanupStack::PushL( popupList );

    listBox->ConstructL( popupList, 0 );
    listBox->CreateScrollBarFrameL( ETrue ); // Create scroll indicator
    listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );

    listBox->Model()->SetItemTextArray( iModel );
    // Set model ownership type
    listBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );

    // Icons:
    // Granularity, 5 icons
    CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 5 );
    CleanupStack::PushL( iconArray );
    LoadIconsL( iconArray, doubleStyle );
    listBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( iconArray );
    CleanupStack::Pop(); // iconArray

    popupList->SetTitleL( *iTitle ); // Set title
    CEikButtonGroupContainer* cba = popupList->ButtonGroupContainer();
    MEikButtonGroup* buttonGroup = cba->ButtonGroup();
    cba->SetCommandL( buttonGroup->CommandId( 0 ), *iLeftSoftkey );
    cba->SetCommandL( buttonGroup->CommandId( 2 ), *iRightSoftkey );

    // Set listener for popuplist anytime.
    TBool hasRemoteDrive =
        ( iIncludedMedias & AknCommonDialogsDynMem::EMemoryTypeRemote );
    iEventHandler->StartNotifyDisk( popupList, hasRemoteDrive );

    TInt selectedIndex = FindIndexByDrive( aSelectedDrive );
    if( selectedIndex == KErrNotFound )
        {
        selectedIndex = 0; // The first index
        }
        
    listBox->View()->SetCurrentItemIndex( selectedIndex );

    // Update CAB show.
    iEventHandler->HandleEventL(
    		MAknCommonDialogsEventObserver::EFocusChange,
    		selectedIndex,
    		selectedIndex,
    		popupList->ButtonGroupContainer() );
    
    CleanupStack::Pop(); // popupList (deleted in ExecuteLD)
    // Execute the popup dialog
    TBool returnValue = EFalse;
    TRAPD( err, returnValue = popupList->ExecuteLD() );
    
    if ( iEventHandler )
        {        
        iEventHandler->StopNotifyDisk();
        }
    
    if( returnValue )
        {
        selectedIndex = listBox->CurrentItemIndex();
        GetDrivePaths( selectedIndex, aRootPath, aDefaultFolder );
        aSelectedDrive = FindDriveByIndex( selectedIndex );
        }
    else if ( err )
        {
        User::Leave( err );
        }
    
    CleanupStack::PopAndDestroy(); // listBox
    return TReturnKey( returnValue );
    }