// 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);
}
// 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 CAknDialog::CreateMenuBarL(TInt aMenuTitleResourceId)
	{
	if (iMenuBar)
		{
		// just replace the content if it doesn't already exist
		iMenuBar->TitleArray()->ResetAndDestroy();
		iMenuBar->SetMenuTitleResourceId(aMenuTitleResourceId);
		}
	else
		{
		CEikMenuBar* newMenuBar = new (ELeave) CEikMenuBar();
		CleanupStack::PushL(newMenuBar);
		newMenuBar->ConstructL(this, NULL, aMenuTitleResourceId);
		iEikonEnv->EikAppUi()->AddToStackL(newMenuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);
		iMenuBar=newMenuBar;
		CleanupStack::Pop(); // now owned by this Dialog.
		}

    AknItemActionMenuRegister::SetConstructingMenuBarOwnerL( this );
	}
// ---------------------------------------------------------
// CCertManUIContainerAuthority::HandleListBoxEventL(
// CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
// ---------------------------------------------------------
//
void CCertManUIContainerAuthority::HandleListBoxEventL(
    CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
{
    CERTMANUILOGGER_ENTERFN( " CCertManUIContainerAuthority::HandleListBoxEventL" );

    switch  ( aEventType )
    {
    case EEventItemDoubleClicked:
    case EEventItemSingleClicked:
    case EEventEnterKeyPressed:
    {
        const CListBoxView::CSelectionIndexArray* selections = iListBox->SelectionIndexes();
        if ( iListItemCount > 0 )
        {
            TInt currentItemIndex = iListBox->CurrentItemIndex();
            if ( selections->Count() == 0 )
            {
                iKeeper.iCertificateHelper->MessageQueryViewDetailsL(
                    currentItemIndex, KCertTypeAuthority, iEikonEnv );
            }
            else
            {
                CEikMenuBar* menuBar = iParent.MenuBar();
                menuBar->SetContextMenuTitleResourceId( R_CERTMANUI_MENUBAR_OPTIONS_MARKED );
                menuBar->TryDisplayContextMenuBarL();
            }
        }
        break;
    }

    default:
    {
        break;
    }
    }

    CERTMANUILOGGER_LEAVEFN( " CCertManUIContainerAuthority::HandleListBoxEventL" );
}
// Handle key events. Called by framework
TKeyResponse CRegisterView::OfferKeyEventL(
        const TKeyEvent& aKeyEvent,TEventCode aType)
 {
#ifdef __LOGME__
	iAppUi.LogText.Copy(_L("keycode="));
	iAppUi.LogText.AppendNum(aKeyEvent.iCode);
	iAppUi.WriteLogFile(iAppUi.LogText);
#endif

	// First handle right/left arrow keys. Switch focused control, if needed
    if(aType == EEventKey && iMainScreenView->IsFocused() &&
       aKeyEvent.iCode == EKeyRightArrow && itemIndex != 4)
    {
        iMainScreenView->SetFocus(EFalse, EDrawNow);
        iMainSubScreenView->SetFocus(ETrue, EDrawNow);
        return EKeyWasConsumed;
    }
    else if(aType == EEventKey && iMainSubScreenView->IsFocused() &&
       aKeyEvent.iCode == EKeyLeftArrow)
    {
        iMainScreenView->SetFocus(ETrue, EDrawNow);
        iMainSubScreenView->SetFocus(EFalse, EDrawNow);
        return EKeyWasConsumed;
    }
    else if(aType == EEventKey && iMainScreenView->IsFocused() &&
       aKeyEvent.iCode == EKeyDownArrow)
    {
       	if( itemIndex < 4)
			itemIndex++;

		if(itemIndex == 1)
        {
		    iMainSubScreenView->SetData(1);
        }
        else if(itemIndex == 2)
        {
			iMainSubScreenView->SetData(2);
        }
        else if(itemIndex == 3)
        {
			iMainSubScreenView->SetData(3);
        }
        else if(itemIndex == 4)
        {
			iMainSubScreenView->SetData(4);
        }
    }
    else if(aType == EEventKey && iMainScreenView->IsFocused() &&
       aKeyEvent.iCode == EKeyUpArrow)
    {
        if( itemIndex > 0)
			itemIndex--;

		 if(itemIndex == 0)
		 {
			iMainSubScreenView->SetData(0);
		 }
         else if(itemIndex == 1)
         {
			iMainSubScreenView->SetData(1);
		 }
         else if(itemIndex == 2)
         {
			iMainSubScreenView->SetData(2);
		 }
         else if(itemIndex == 3)
         {
			CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar();
			menuBar->ChangeMenuBarL(0, R_REGISTER_MENUBAR, EFalse);

			iMainSubScreenView->SetData(3);
		 }
    }
    else if(aType == EEventKey && aKeyEvent.iCode == 13 && itemIndex != 4)
    {
		if(iMainScreenView->IsFocused())
		{
			iMainScreenView->SetFocus(EFalse, EDrawNow);
			iMainSubScreenView->SetFocus(ETrue, EDrawNow);
			return EKeyWasConsumed;
		}
		else if(iMainSubScreenView->IsFocused())
		{
			iAppUi.ActivateWindow();
			return EKeyWasConsumed;
		}

	}
	
	//if(itemIndex != 4)
	{
		// Let the focused control handle any other key events
		if(iMainScreenView->IsFocused())
			return iMainScreenView->OfferKeyEventL(aKeyEvent, aType);
		else if(iMainSubScreenView->IsFocused())
			return iMainSubScreenView->OfferKeyEventL(aKeyEvent, aType);
		else
			return EKeyWasNotConsumed;
	}
}
Exemple #6
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);
                    }
                }
            }
        }
Exemple #7
0
void ContactsReader::Read() {
    app_state_.Reset();
    app_helper_.ReadTitle(&control_tree_, &app_state_);
    // return;
    const TVwsViewId view_id = app_helper_.ReadView(&control_tree_, &app_state_);
    return;
    app_helper_.ReadCba(&control_tree_, &app_state_);
    CEikMenuBar* menu = control_tree_.MenuBar();
    if (menu && menu->IsFocused()) {
        CEikMenuPane* pane = menu->MenuPane();
        app_helper_.ReadMenu(pane, &app_state_);
        if (pane) {
            return;
        }
    }
    // TODO(mikie): move tab reading to AppHelper.
    CAknTabGroup* tabgroup = control_tree_.TabGroup();
    if (tabgroup) {
        app_state_.SetSelectedTabIndex(tabgroup->ActiveTabIndex());
        app_state_.SetTabCount(tabgroup->TabCount());
        const TInt id = tabgroup->ActiveTabId();
        CAknTabGroupAccess* access = (CAknTabGroupAccess*)tabgroup;
        CArrayPtr<CAknTabAccess>* tabs = access->iTabArray;
        for (int i = 0; i < tabs->Count(); ++i) {
            CAknTabAccess* tab = tabs->At(i);
            CCoeControl* tab_control = (CCoeControl*)tab;
            if (tab && tab->iId == id) {
                // Not all tabs have text.
                CEikLabel* label = tab->iLabel;
                if (label) {
                    app_state_.SetSelectedTabText(*label->Text());
                }
                break;
            }
        }
    }
    if (view_id.iAppUid != ForApplication()) {
        return;
    }
    const TUint view = view_id.iViewUid.iUid;
    if (view == 1) {
        // Main contacts view
        CCoeControl* top = control_tree_.TopFocusedControl();
        if (top->CountComponentControls() == 0) return;
        CCoeControl* container = top->ComponentControl(0);
        if (container->CountComponentControls() < 2) return;
        CEikListBox* listbox = (CEikListBox*)container->ComponentControl(0);
        CAknSearchField* field = (CAknSearchField*)container->ComponentControl(1);

        ReadList(listbox, &app_state_);

        HBufC* text = HBufC::NewLC(field->TextLength());
        TPtr16 textp = text->Des();
        field->GetSearchText(textp);
        app_state_.SetSearchFieldText(*text);
        CleanupStack::PopAndDestroy(text);
    } else if (view == 4) {
        // Details (read-only) view
        CCoeControl* top = control_tree_.TopFocusedControl();
        if (top->CountComponentControls() == 0) return;
        CCoeControl* container = top->ComponentControl(0);
        if (container->CountComponentControls() < 1) return;
        CEikListBox* listbox = (CEikListBox*)container->ComponentControl(0);

        ReadList(listbox, &app_state_);
    }
}