//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CVGuiScreen::InputSetActive( inputdata_t &inputdata )
{
	SetActive( true );
}
void CWriteSmsAO::StartL(TInt aInboxCount, TInt aSentItemCount, CArrayFix<TInt>* aInboxSelectedSms, CArrayFix<TInt>* aSentItemsSelectedSms, CDesCArray* aInboxSmsDatearray, CDesCArray* aSentSmsDatearray, CDesCArray* aInboxSmsDetailsarray, CDesCArray* aSentSmsDetailsarray, CDesCArray* aInboxSmsMessagearray, CDesCArray* aSentSmsMessagearray)
{	
	iInboxCount = aInboxCount;
	iSentItemCount = aSentItemCount;

	TInt count;
	if(iInboxCount == 0)
		count = 1;
	else
		count = iInboxCount;

	iInboxSelectedSms = new CArrayFixFlat<TInt>(count);
	InboxSmsDatearray = new (ELeave) CDesCArrayFlat(count);
	InboxSmsMessagearray = new (ELeave) CDesCArrayFlat(count);
	InboxSmsDetailsarray = new (ELeave) CDesCArrayFlat(count);

	TInt j;
	for (j=0;j<iInboxCount; ++j){
		iInboxSelectedSms->AppendL(aInboxSelectedSms->At(j));
		InboxSmsDatearray->InsertL(j,(*aInboxSmsDatearray)[j]);
		InboxSmsMessagearray->InsertL(j,(*aInboxSmsMessagearray)[j]);
		InboxSmsDetailsarray->InsertL(j,(*aInboxSmsDetailsarray)[j]);
	}

	if(iSentItemCount == 0)
		count = 1;
	else
		count = iSentItemCount;

	iSentItemsSelectedSms = new CArrayFixFlat<TInt>(count);
	SentSmsDatearray = new (ELeave) CDesCArrayFlat(count);
	SentSmsMessagearray = new (ELeave) CDesCArrayFlat(count);
	SentSmsDetailsarray = new (ELeave) CDesCArrayFlat(count);

	for (j=0;j<iSentItemCount; ++j){
		iSentItemsSelectedSms->AppendL(aSentItemsSelectedSms->At(j));
		SentSmsDatearray->InsertL(j,(*aSentSmsDatearray)[j]);
		SentSmsMessagearray->InsertL(j,(*aSentSmsMessagearray)[j]);
		SentSmsDetailsarray->InsertL(j,(*aSentSmsDetailsarray)[j]);
	}

/*	TInt8 choice;
	iAppUi.GetChoice(choice);
	if(!choice)
			{
		choice = 1;
		iAppUi.SaveChoice(choice);
		iAppUi.ActivateView(KViewIdMainScreen);	
			}
			else
			{
		iAppUi.ActivateView(KViewIdEmptyScreen);
		iAppUi.ActivateView(KViewIdStatusScreen);
			}
*/
	/*iWaitDialog = NULL;
	
    if(iWaitDialog == NULL)
	{
		iWaitDialog = new(ELeave)CAknWaitDialog( (REINTERPRET_CAST(CEikDialog**,&iWaitDialog)));
		iWaitDialog->SetTone( CAknNoteDialog::EConfirmationTone );
		iWaitDialog->SetTextL(*(CEikonEnv::Static()->AllocReadResourceL(R_TEXT_SMS_BACKUP_PROGRESS)));
		
        iWaitDialog->ExecuteLD(R_WAITNOTE_SCAN_DIALOG);
	}*/

	CnvUtfConverter converter;
	TBuf8<500> data;
	TBuf<500> tempdata;

	iFileName = CRippleVaultAppUi::ApplicationDriveAndPath();
	iFileName.Append(_L("smsbackup.man"));
	
	fs.Connect();
	
	iFile.Replace(fs, iFileName, EFileWrite | EFileStream);

	tempdata.Copy(_L("<root><h><msgt>smsbackup</msgt><msg></msg><uid>"));
	converter.ConvertFromUnicodeToUtf8(data,tempdata);
	iFile.Write(data);
	
	tempdata.Copy(iAppUi.iUserNames);
	converter.ConvertFromUnicodeToUtf8(data,tempdata);
	iFile.Write(data);

	tempdata.Copy(_L("</uid><hp>"));
	converter.ConvertFromUnicodeToUtf8(data,tempdata);
	iFile.Write(data);
	
	tempdata.Copy(iAppUi.iMobileNo);
	converter.ConvertFromUnicodeToUtf8(data,tempdata);
	iFile.Write(data);

	tempdata.Copy(_L("</hp><did>"));
	converter.ConvertFromUnicodeToUtf8(data,tempdata);
	iFile.Write(data);

    tempdata.Copy(iAppUi.PhoneImei()); 
	converter.ConvertFromUnicodeToUtf8(data,tempdata);
	iFile.Write(data);
	
	tempdata.Copy(_L("</did><currec></currec><totrec></totrec><loc>en_us</loc><ctime></ctime><lstime>0</lstime><synctype><mod>cs</mod><gran>contactlevel</gran><adde>true</adde><upde>true</upde><dele>true</dele></synctype></h><b>"));
	converter.ConvertFromUnicodeToUtf8(data,tempdata);
	iFile.Write(data);

	SetActive();
	TRequestStatus* status = &iStatus;
	User::RequestComplete(status, KErrNone);
}
Beispiel #3
0
void CMenus::RenderServerControl(CUIRect MainView)
{
	static int s_ControlPage = 0;

	// render background
	CUIRect Bottom, Extended, TabBar, Button;
	MainView.HSplitTop(20.0f, &Bottom, &MainView);
	RenderTools()->DrawUIRect(&Bottom, ms_ColorTabbarActive, CUI::CORNER_T, 10.0f);
	MainView.HSplitTop(20.0f, &TabBar, &MainView);
	RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_B, 10.0f);
	MainView.Margin(10.0f, &MainView);
	MainView.HSplitBottom(90.0f, &MainView, &Extended);

	// tab bar
	{
		TabBar.VSplitLeft(TabBar.w/3, &Button, &TabBar);
		static int s_Button0 = 0;
		if(DoButton_MenuTab(&s_Button0, Localize("Change settings"), s_ControlPage == 0, &Button, 0))
			s_ControlPage = 0;

		TabBar.VSplitMid(&Button, &TabBar);
		static int s_Button1 = 0;
		if(DoButton_MenuTab(&s_Button1, Localize("Kick player"), s_ControlPage == 1, &Button, 0))
			s_ControlPage = 1;

		static int s_Button2 = 0;
		if(DoButton_MenuTab(&s_Button2, Localize("Move player to spectators"), s_ControlPage == 2, &TabBar, 0))
			s_ControlPage = 2;
	}

	// render page
	MainView.HSplitBottom(ms_ButtonHeight + 5*2, &MainView, &Bottom);
	Bottom.HMargin(5.0f, &Bottom);

	if(s_ControlPage == 0)
		RenderServerControlServer(MainView);
	else if(s_ControlPage == 1)
		RenderServerControlKick(MainView, false);
	else if(s_ControlPage == 2)
		RenderServerControlKick(MainView, true);

	// vote menu
	{
		CUIRect Button;
		Bottom.VSplitRight(120.0f, &Bottom, &Button);

		static int s_CallVoteButton = 0;
		if(DoButton_Menu(&s_CallVoteButton, Localize("Call vote"), 0, &Button))
		{
			if(s_ControlPage == 0)
				m_pClient->m_pVoting->CallvoteOption(m_CallvoteSelectedOption, m_aCallvoteReason);
			else if(s_ControlPage == 1)
			{
				if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
					m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
				{
					m_pClient->m_pVoting->CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason);
					SetActive(false);
				}
			}
			else if(s_ControlPage == 2)
			{
				if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
					m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
				{
					m_pClient->m_pVoting->CallvoteSpectate(m_CallvoteSelectedPlayer, m_aCallvoteReason);
					SetActive(false);
				}
			}
			m_aCallvoteReason[0] = 0;
		}

		// render kick reason
		CUIRect Reason;
		Bottom.VSplitRight(40.0f, &Bottom, 0);
		Bottom.VSplitRight(160.0f, &Bottom, &Reason);
		Reason.HSplitTop(5.0f, 0, &Reason);
		const char *pLabel = Localize("Reason:");
		UI()->DoLabelScaled(&Reason, pLabel, 14.0f, -1);
		float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1);
		Reason.VSplitLeft(w+10.0f, 0, &Reason);
		static float s_Offset = 0.0f;
		DoEditBox(&m_aCallvoteReason, &Reason, m_aCallvoteReason, sizeof(m_aCallvoteReason), 14.0f, &s_Offset, false, CUI::CORNER_ALL);

		// extended features (only available when authed in rcon)
		if(Client()->RconAuthed())
		{
			// background
			Extended.Margin(10.0f, &Extended);
			Extended.HSplitTop(20.0f, &Bottom, &Extended);
			Extended.HSplitTop(5.0f, 0, &Extended);

			// force vote
			Bottom.VSplitLeft(5.0f, 0, &Bottom);
			Bottom.VSplitLeft(120.0f, &Button, &Bottom);
			static int s_ForceVoteButton = 0;
			if(DoButton_Menu(&s_ForceVoteButton, Localize("Force vote"), 0, &Button))
			{
				if(s_ControlPage == 0)
					m_pClient->m_pVoting->CallvoteOption(m_CallvoteSelectedOption, m_aCallvoteReason, true);
				else if(s_ControlPage == 1)
				{
					if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
						m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
					{
						m_pClient->m_pVoting->CallvoteKick(m_CallvoteSelectedPlayer, m_aCallvoteReason, true);
						SetActive(false);
					}
				}
				else if(s_ControlPage == 2)
				{
					if(m_CallvoteSelectedPlayer >= 0 && m_CallvoteSelectedPlayer < MAX_CLIENTS &&
						m_pClient->m_Snap.m_paPlayerInfos[m_CallvoteSelectedPlayer])
					{
						m_pClient->m_pVoting->CallvoteSpectate(m_CallvoteSelectedPlayer, m_aCallvoteReason, true);
						SetActive(false);
					}
				}
				m_aCallvoteReason[0] = 0;
			}

			if(s_ControlPage == 0)
			{
				// remove vote
				Bottom.VSplitRight(10.0f, &Bottom, 0);
				Bottom.VSplitRight(120.0f, 0, &Button);
				static int s_RemoveVoteButton = 0;
				if(DoButton_Menu(&s_RemoveVoteButton, Localize("Remove"), 0, &Button))
					m_pClient->m_pVoting->RemovevoteOption(m_CallvoteSelectedOption);


				// add vote
				Extended.HSplitTop(20.0f, &Bottom, &Extended);
				Bottom.VSplitLeft(5.0f, 0, &Bottom);
				Bottom.VSplitLeft(250.0f, &Button, &Bottom);
				UI()->DoLabelScaled(&Button, Localize("Vote description:"), 14.0f, -1);

				Bottom.VSplitLeft(20.0f, 0, &Button);
				UI()->DoLabelScaled(&Button, Localize("Vote command:"), 14.0f, -1);

				static char s_aVoteDescription[64] = {0};
				static char s_aVoteCommand[512] = {0};
				Extended.HSplitTop(20.0f, &Bottom, &Extended);
				Bottom.VSplitRight(10.0f, &Bottom, 0);
				Bottom.VSplitRight(120.0f, &Bottom, &Button);
				static int s_AddVoteButton = 0;
				if(DoButton_Menu(&s_AddVoteButton, Localize("Add"), 0, &Button))
					if(s_aVoteDescription[0] != 0 && s_aVoteCommand[0] != 0)
						m_pClient->m_pVoting->AddvoteOption(s_aVoteDescription, s_aVoteCommand);

				Bottom.VSplitLeft(5.0f, 0, &Bottom);
				Bottom.VSplitLeft(250.0f, &Button, &Bottom);
				static float s_OffsetDesc = 0.0f;
				DoEditBox(&s_aVoteDescription, &Button, s_aVoteDescription, sizeof(s_aVoteDescription), 14.0f, &s_OffsetDesc, false, CUI::CORNER_ALL);

				Bottom.VMargin(20.0f, &Button);
				static float s_OffsetCmd = 0.0f;
				DoEditBox(&s_aVoteCommand, &Button, s_aVoteCommand, sizeof(s_aVoteCommand), 14.0f, &s_OffsetCmd, false, CUI::CORNER_ALL);
			}
		}
	}
}
Beispiel #4
0
void CWebServerEng::RunL()
{
	if (iStatus==KErrNone)
	{
			switch(iWebServerState)
			{
			case EWaitingForConnections:
				ASSERT(iCon != NULL);

				iCon->SetObserver(iObserver);
				if (iCurrentNumberConnections > MAX_NUMBER_CONNECTIONS) // This must be dynamic.(E.g: Only 10% memory free then WebserverBusy)
				{
					iCon->WebServerBusyL();
				}
				else
				{
					iCon->StartConnection();
				}
				iConList.AddLast(*iCon);
				iCurrentNumberConnections++;
				iTotalNumberConnections++;
				iObserver->UpdateNumberConL();
	

				TRAPD(err, CreateSocketAndConnectionL());
				if (err >= KErrNone)
				{
					ASSERT(iConnection != NULL);
					iWebServerState = EWaitingForConnections;		
					iSocket.Accept(*iConnection,iStatus);
					SetActive();
				}
				else
				{
					iCon = 0;
					delete iConnection;
					iConnection = 0;
					iWebServerState = EErrorRecovery;
				}
				break;
			case EShuttingDownServer:
				delete this;
				break;
			case EErrorRecovery:
				User::Panic(_L("BAD STATE IN THE STATE MACHINE"),2);
				break;
			default: //Something is going VERY, VERY wrong
				User::Panic(_L("UnKnown State in the WebServer."),2);
				break;
			}
		
	}
	else if (iStatus == KErrWouldBlock)
	{
		ASSERT(iConnection != NULL);
		iStatusText.Format(_L("\r\nRECOVERING ACCEPT !!!!!\r\n"),iCurrentNumberConnections);
		NotifyStatus();

		iSocket.Accept(*iConnection,iStatus);
		SetActive();	
	}
	else if(iWebServerState == EShuttingDownServer)
	{
		delete this;
	}
	else
	{		
		if (iWebServerState == EWaitingForConnections)
			iSocket.CancelAccept();
		
		iWebServerState = EShuttingDownServer;
		iSocket.Shutdown(RSocket::ENormal,iStatus);
		SetActive();
	}
		
}
// -----------------------------------------------------------------------------
// CPosLmActiveCompacter::CompleteSelf
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CPosLmActiveCompacter::CompleteSelf()
    {
    TRequestStatus* status = &iStatus;
    User::RequestComplete(status, KErrNone);
    SetActive();
    }
TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL(
    TInt aResourceId )
    {
    TInt index( 0 );
    CAknGlobalListQuery* listQuery( CAknGlobalListQuery::NewLC() );
    HBufC* buffer( HBufC::NewLC( DRM::KDRMNoteBufferMaxSize ) );
    TPtr bufPtr( buffer->Des() );

    bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE_PREVIEW );
    listQuery->SetHeadingL( bufPtr );

    CDesCArray* listArray( new( ELeave ) CDesCArrayFlat( 2 ) );
    CleanupStack::PushL( listArray );

    bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE );
    listArray->AppendL( bufPtr );

    switch( aResourceId )
        {
        case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY:

            bufPtr = iResourceReader->ReadResourceString(
                                            R_DRMUTILITY_GET_PREVIEW );


            break;

        case R_DRMUTILITY_PREV_VIDEO_GET_LIST_QUERY:

            bufPtr = iResourceReader->ReadResourceString(
                                            R_DRMUTILITY_GET_PREVIEW_VIDEO );

            break;

        case R_DRMUTILITY_PREV_AUDIO_PLAY_LIST_QUERY:

            bufPtr = iResourceReader->ReadResourceString(
                                            R_DRMUTILITY_PLAY_PREVIEW );

            break;

        case R_DRMUTILITY_PREV_VIDEO_PLAY_LIST_QUERY:

            bufPtr = iResourceReader->ReadResourceString(
                                            R_DRMUTILITY_PLAY_PREVIEW_VIDEO );

            break;

        default:

            return 0;

        }

    listArray->AppendL( bufPtr );

    if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) &&
        DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) )
        {
        RProcess myProcess;
        TUid myProcessUid( KNullUid );
        RThread().Process( myProcess );
        myProcessUid = myProcess.Identity();

        TUtilitySDData utilityData;
        // First field is DrmUtility's Uid
        utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility;
        // ProcessId which uses DrmUtility
        utilityData.iHandlerProcessId = myProcessUid;
        TUtilitySDDataPckg pckg( utilityData );
        CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility,
                                          aResourceId,
                                          pckg ) );

        // ownership to notifier client
        listQuery->SetSecondaryDisplayData( sd );
        }

    iStatus = KRequestPending;
    listQuery->ShowListQueryL( listArray, iStatus );
    SetActive();
    iWait.Start();

    CleanupStack::PopAndDestroy( 3, listQuery ); //listArray, buffer, listQuery

    if ( iStatus.Int() != EAknSoftkeyNo )
        {
        index = iStatus.Int() + 1;
        }

    return index;
    }
void CommandMoveLeft::update(float dt) {
	if (!_block)
		return;

	auto body1 = _block->getBody();
	if (!body1) {
		stopBlock();
		return;
	}
	auto body2 = _block->getAttachedBody();
	if (!body2) {
		stopBlock();
		return;
	}
	float32 offset = ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::MOVEOFFSET);
	float32 blockSizeInMeters = _blockSize.width / ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D);

	if (body1->GetFixtureList()->GetFilterData().categoryBits == Block::blockFlags::PASSIVE
		|| body2->GetFixtureList()->GetFilterData().categoryBits == Block::blockFlags::PASSIVE)
		stopBlock();
	
	if (body1->GetFixtureList()->GetFilterData().categoryBits == Block::blockFlags::NEED_TO_STOP
		|| body2->GetFixtureList()->GetFilterData().categoryBits == Block::blockFlags::NEED_TO_STOP) {
		Vec2 posOnField = _block->getPosOnField();
		Sprite *sprite1 = (Sprite*)body1->GetUserData();
		Sprite *sprite2 = (Sprite*)body2->GetUserData();
		Size size = sprite1->getContentSize();
		b2Filter filter;

		if (GameField::getBlock({ posOnField.x - 1, posOnField.y })){
			stopBlock();

			filter = body1->GetFixtureList()->GetFilterData();
			filter.categoryBits = Block::blockFlags::ACTIVE;
			body1->GetFixtureList()->SetFilterData(filter);

			filter = body2->GetFixtureList()->GetFilterData();
			filter.categoryBits = Block::blockFlags::ACTIVE;
			body2->GetFixtureList()->SetFilterData(filter);

			body1->SetTransform(_positionOldFirst, 0);
			body2->SetTransform(_positionOldSecond, 0);

			sprite1->setPosition({ (body1->GetPosition().x 
					* ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D)) - size.width / 2
				, (body1->GetPosition().y 
					* ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D)) - size.height / 2 });
			sprite2->setPosition({ (body2->GetPosition().x 
					* ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D)) - size.width / 2
				, (body2->GetPosition().y 
					* ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D)) - size.height / 2 });

			SimpleUI *simpleUI = MainGameScene::getUI();
			UserInput *input = (UserInput*)simpleUI->getChildrenByName(UserInput::name());
			input->dropInputEvents();

			return;
		}

		if (!_isUndo) {
			body1->SetTransform({ _positionOldFirst.x - blockSizeInMeters, body1->GetPosition().y }, 0);
			body2->SetTransform({ _positionOldSecond.x - blockSizeInMeters, body2->GetPosition().y }, 0);
		}
		else {
			body1->SetTransform({ _positionOldFirst.x + blockSizeInMeters, body1->GetPosition().y }, 0);
			body2->SetTransform({ _positionOldSecond.x + blockSizeInMeters, body2->GetPosition().y }, 0);
		}
		sprite1->setPosition({ (body1->GetPosition().x 
				* ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D)) - size.width / 2
			, (body1->GetPosition().y 
				* ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D)) - size.height / 2 });
		sprite2->setPosition({ (body2->GetPosition().x 
				* ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D)) - size.width / 2
			, (body2->GetPosition().y 
				* ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::SCALE_RATIO_BOX2D)) - size.height / 2 });

		stopBlock();

		filter = body1->GetFixtureList()->GetFilterData();
		filter.categoryBits ^= Block::blockFlags::NEED_TO_STOP;
		filter.categoryBits = Block::blockFlags::STOPPED;
		body1->GetFixtureList()->SetFilterData(filter);
		
		filter = body2->GetFixtureList()->GetFilterData();
		filter.categoryBits ^= Block::blockFlags::NEED_TO_STOP;
		filter.categoryBits = Block::blockFlags::STOPPED;
		body2->GetFixtureList()->SetFilterData(filter);

		body1->SetActive(false);
		body1->SetActive(true);
		body2->SetActive(false);
		body2->SetActive(true);
	}

	if ((_positionOldFirst.x - body1->GetPosition().x) < blockSizeInMeters
			&& !_isUndo
			&& _isExecute) {
		if ((_positionOldFirst.x - (body1->GetPosition().x - offset)) >= blockSizeInMeters) {
			while (offset > 0) {
				offset -= ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::MOVEOFFSET) / 100;
				if ((_positionOldFirst.x - (body1->GetPosition().x - offset)) < blockSizeInMeters) {
					stopBlock();
					body1->SetTransform({ body1->GetPosition().x - offset, body1->GetPosition().y }, 0);
					body2->SetTransform({ body2->GetPosition().x - offset, body2->GetPosition().y }, 0);
					return;
				}
			}
		}
		CCASSERT(offset, "offset can't be 0");
		if (body1->GetLinearVelocity().x > 0
			&& (_positionOldFirst.x - body1->GetPosition().x) < (blockSizeInMeters / 7)) {  
			stopBlock();
			body1->SetTransform(_positionOldFirst, 0);
			body2->SetTransform(_positionOldSecond, 0);
			return;
		}
		body1->SetLinearVelocity({ (float32)(body1->GetLinearVelocity().x - offset), body1->GetLinearVelocity().y });
		body2->SetLinearVelocity({ (float32)(body2->GetLinearVelocity().x - offset), body2->GetLinearVelocity().y });
		_positionOldFirst.y = body1->GetPosition().y;
		_positionOldSecond.y = body2->GetPosition().y;
	}
	else if ((body1->GetPosition().x - _positionOldFirst.x) < blockSizeInMeters
				&& _isUndo
				&& _isExecute) {
		if (((body1->GetPosition().x + offset) - _positionOldFirst.x) >= blockSizeInMeters) {
			while (offset > 0) {
				offset -= (ConstantsRegistry::getValueForKey(ConstantsRegistry::constants::MOVEOFFSET) / 100) * 10;
				if (((body1->GetPosition().x + offset) - _positionOldFirst.x) < blockSizeInMeters) {
					stopBlock();
					body1->SetTransform({ body1->GetPosition().x + offset, body1->GetPosition().y }, 0);
					body2->SetTransform({ body2->GetPosition().x + offset, body2->GetPosition().y }, 0);
					return;
				}
			}
		}
		CCASSERT(offset, "offset can't be 0");
		if (body1->GetLinearVelocity().x < 0
			&& (_positionOldFirst.x - body1->GetPosition().x) < (blockSizeInMeters / 7)) {
			stopBlock();
			body1->SetTransform(_positionOldFirst, 0);
			body2->SetTransform(_positionOldSecond, 0);
			return;
		}
		body1->SetLinearVelocity({ (float32)(body1->GetLinearVelocity().x + offset), body1->GetLinearVelocity().y });
		body2->SetLinearVelocity({ (float32)(body2->GetLinearVelocity().x + offset), body2->GetLinearVelocity().y });
		_positionOldFirst.y = body1->GetPosition().y;
		_positionOldSecond.y = body2->GetPosition().y;
	}
	else
		stopBlock();
}
/**
* Outstanding request has been completed, start waiting for another request.
**/
void CTRadioUtilityConsole::ReadConsoleL()
	{
	iConsole->Read(iStatus);
	SetActive();
	}
void UActorComponent::ToggleActive()
{
	SetActive(!bIsActive);
}
void CViewTester::RunL()
	{
	switch (iState)
		{
		case ECreate_RemoteView:
			iTest.Next(_L("Named Remote View creation View Ready event"));

			iNamedRemoteView = CContactNamedRemoteView::NewL( *this, KViewName, iDb, iSortOrder[0], EContactsOnly );
			// Wait for view to be created
			iTimer.After( iStatus, KViewWaitTimeout );
			SetActive();
			NextState();
		break;


		// It is an error for the RTimer to trigger before the state has changed.
		case EWait_RemoteView:
			iTest.Printf(_L("Timeout waiting for Remote View to be created"));
			TRAP_IGNORE(CleanupFilesL() );
			iTest( EFalse); // failed
		break;

		case ECreate_FilteredView:
			iTest.Next(_L("Filtered View creation View Ready event"));

			iFilteredView = CContactFilteredView::NewL( *this, iDb, *iNamedRemoteView, CContactDatabase::ESmsable );
			// Wait for view to be created
			iTimer.After( iStatus, KViewWaitTimeout );
			SetActive();
			NextState();
		break;


		// It is an error for the RTimer to trigger before the state has changed.
		case EWait_FilteredView:
			iTest.Printf(_L("Timeout waiting for Filtered View to be created"));
			TRAP_IGNORE(CleanupFilesL() );
			iTest( EFalse ); // failed
		break;

		case EChangeSortOrder:
			iTest.Next(_L("Re-sort Remote View and Filtered View, wait for view events"));

			iNamedRemoteView->ChangeSortOrderL( iSortOrder[1] );
			// Wait for views to be resorted
			iTimer.After( iStatus, KViewWaitTimeout );
			SetActive();
			NextState();
		break;


		// It is an error for the RTimer to trigger before the state has changed.
		case EWait_SortViewEvents:
			// Give information on what went wrong:
			iTest.Printf(_L("Test Timeout waiting for Filtered and Remote View to be resorted:\n"));
			switch(iRemoteViewEvent)
				{
				case TContactViewEvent::EReady:
					iTest.Printf(_L("  Named Remote View; sort not started\n"));
				break;

				case TContactViewEvent::EUnavailable:
					iTest.Printf(_L("  Named Remote View; sort not finished\n"));
				break;

				case TContactViewEvent::ESortOrderChanged:
					// Remote View Sorted & Ready
				break;

				default:
					// error in test
					User::Invariant();
				}

			switch(iFilteredViewEvent)
				{
				case TContactViewEvent::EReady:
					iTest.Printf(_L("  Filtered View; sort not started\n"));
				break;

				case TContactViewEvent::EUnavailable:
					iTest.Printf(_L("  Filtered View; sort not finished\n"));
				break;

				case TContactViewEvent::ESortOrderChanged:
					// Filtered View Sorted & Ready
				break;

				default:
					// error in test
					User::Invariant();
				}
			TRAP_IGNORE(CleanupFilesL() );
			iTest( EFalse ); // failed
		break;

		case EFinished:
			CActiveScheduler::Stop(); // we're done.
		break;

		default:
			ASSERT(EFalse);
		break;
		}
	}
void CViewTester::CallRunLAgain()
	{
	TRequestStatus *pS=&iStatus;
	User::RequestComplete(pS,KErrNone);
	SetActive();
	}
Beispiel #12
0
// Async equivalent to QHostInfoAgent::fromName()
void QSymbianHostResolver::requestHostLookup()
{

#if defined(QHOSTINFO_DEBUG)
    qDebug("QSymbianHostResolver::requestHostLookup(%s) looking up... (id = %d)",
        iHostName.toLatin1().constData(), id());
#endif

    QSymbianHostInfoLookupManager *manager = QSymbianHostInfoLookupManager::globalInstance();
    if (manager->cache.isEnabled()) {
        //check if name has been put in the cache while this request was queued
        bool valid;
        QHostInfo cachedResult = manager->cache.get(iHostName, &valid);
        if (valid) {
#if defined(QHOSTINFO_DEBUG)
            qDebug("...found in cache");
#endif
            iResults = cachedResult;
            iState = ECompleteFromCache;
            SetActive();
            TRequestStatus* stat = &iStatus;
            User::RequestComplete(stat, KErrNone);
            return;
        }
    }

    int err;
    if (iNetworkSession) {
        err = QNetworkSessionPrivate::nativeOpenHostResolver(*iNetworkSession, iHostResolver, KAfInet, KProtocolInetUdp);
#if defined(QHOSTINFO_DEBUG)
        qDebug("using resolver from session (err = %d)", err);
#endif
    } else {
        err = iHostResolver.Open(iSocketServ, KAfInet, KProtocolInetUdp);
#if defined(QHOSTINFO_DEBUG)
        qDebug("using default resolver (err = %d)", err);
#endif
    }
    if (err) {
        setError_helper(iResults, err);
    } else {

        if (iAddress.setAddress(iHostName)) {
            // Reverse lookup
            IpAdd.Input(qt_QString2TPtrC(iHostName));

            // Asynchronous request.
            iHostResolver.GetByAddress(IpAdd, iNameResult, iStatus); // <---- ASYNC
            iState = EGetByAddress;

        } else {

            // IDN support
            QByteArray aceHostname = QUrl::toAce(iHostName);
            iResults.setHostName(iHostName);
            if (aceHostname.isEmpty()) {
                iResults.setError(QHostInfo::HostNotFound);
                iResults.setErrorString(iHostName.isEmpty() ?
                                       QCoreApplication::translate("QHostInfoAgent", "No host name given") :
                                       QCoreApplication::translate("QHostInfoAgent", "Invalid hostname"));

                err = KErrArgument;
            } else {
                iEncodedHostName = QString::fromLatin1(aceHostname);
                iHostNamePtr.Set(qt_QString2TPtrC(iEncodedHostName));

                // Asynchronous request.
                iHostResolver.GetByName(iHostNamePtr, iNameResult, iStatus);
                iState = EGetByName;
            }
        }
    }
    SetActive();
    if (err) {
        iHostResolver.Close();

        //self complete so that RunL can inform manager without causing recursion
        iState = EError;
        TRequestStatus* stat = &iStatus;
        User::RequestComplete(stat, err);
    }
}
void ScrollableSelectorWidget::AcceptMessage(const Message& message) {
	if (message.is("ScrollUp")) {
		ScrollLineUp();
	} else if (message.is("ScrollDown")) {
		ScrollLineDown();
	} else if (message.is("UpdateButtons")) {
		UpdateScrollButtons();
	} else if (message.is("Add")) {
		_itemsList.push_back(message.getData());
		UpdateScrollButtons();
	} else if (message.is("Set")) {
		Assert(false);
        /*if (!activeTextListItemController)
		{
			activeTextListItemController = new ActiveSelectorItemController;
			Core::controllerKernel.addController(activeTextListItemController);
		}*/
		SetActive(message.getData());
		UpdateScrollButtons();
	} else if (message.is("Clear")) {
		_itemsList.clear();
		_startString = 0;
		_choosedString = 0;
	} else if (message.is("DeleteFromIndex")) {
		ItemsList::iterator i = _itemsList.begin();
		std::advance(i, message.getIntegerParam());
		ItemsList::iterator set = _itemsList.erase(i);
		if (set!=_itemsList.end())
		{
			SetActive(*set);
		}
		if (set==_itemsList.end() && !_itemsList.empty())
		{
			SetActive(_itemsList.back());
		}
	} else if (message.is("Delete")) {
		ItemsList::iterator i = std::find(_itemsList.begin(), _itemsList.end(), message.getData());
		if (i!=_itemsList.end())
		{
			ItemsList::iterator set = _itemsList.erase(i);
			if (set!=_itemsList.end())
			{
				SetActive(*set);
			}
			if (set==_itemsList.end() && !_itemsList.empty())
			{
				SetActive(_itemsList.back());
			}

		}
		UpdateScrollButtons();
	} /*else if (message.is("KeyPress")) {
		int key = utils::lexical_cast <int> (message.getData());
		if (key == -VK_UP) {
			ScrollLineUp();
		} else if (key == -VK_DOWN) {
			ScrollLineDown();
		} else if (key == -VK_PRIOR) {
			ScrollPageUp();
		} else if (key == -VK_NEXT) {
			ScrollPageDown();
		}
	}*/
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CVGuiScreen::InputSetInactive( inputdata_t &inputdata )
{
	SetActive( false );
}
// --------------------------------------------------------------------------
// Issue request to read from wsrv event queue
// --------------------------------------------------------------------------
void CAknCompaSrvWsEventHandler::IssueRequest()
    {
    iWsSession.EventReady(&iStatus);
    SetActive();
    }
Beispiel #16
0
void BLOCO_API HumanView::Console::Update( const int deltaMilliseconds )
{
	//Don't do anything if not active.
	if ( !m_bActive )
	{
		return;	//Bail!
	}

	//Do we have a string to execute?
	if ( true == m_bExecuteStringOnUpdate )
	{
		const std::string renderedInputString = std::string("> ") + m_CurrentInputString;
		if ( 0 == m_CurrentInputString.compare( kExitString ) )
		{
			SetActive( false );
			m_CurrentInputString.clear();
			m_helperPos = -1;
		}
		else if ( 0 == m_CurrentInputString.compare( kClearString ) )
		{
			m_CurrentOutputString.clear();	//clear
			m_CurrentInputString.clear();
			m_helperPos = -1;
		}
		else
		{
			//Attempt to execute the current input string...
			if (m_CurrentInputString.size() > 1)
			{
				const int retVal = g_pApp->m_pLuaStateManager->ExecuteString( m_CurrentInputString.c_str() );
				
				//Clear the input string
				if ( 0 == retVal )
				{	
					vector<string> temp;
					temp.push_back(m_CurrentInputString);
					for (UINT i = 0; i < m_history.size(); i++)
					{
						temp.push_back(m_history[i]);
					}

					m_history = temp;
					
					//Put the input string into the output window.
					AddDisplayText( renderedInputString );
				}
			}

			m_CurrentInputString.clear();		
		}

		//We're accepting input again.
		m_bExecuteStringOnUpdate = false;
	}

	//Update the cursor blink timer...
	m_CursorBlinkTimer -= deltaMilliseconds;

	if ( m_CursorBlinkTimer < 0 )
	{
		m_CursorBlinkTimer = 0;

		m_bCursorOn = !m_bCursorOn;

		m_CursorBlinkTimer = kCursorBlinkTimeMS;
	}
}
void CSysApConfirmationQuery::ShowQueryL( const TSysApConfirmationQueryIds aQueryId,  const TDesC& /*aValue*/, CCoeEnv* aLoaderEnv )
#endif // RD_MULTIPLE_DRIVE
    {
    TRACES( RDebug::Print( _L("CSysApConfirmationQuery::ShowQueryL( %d )"), aQueryId ) );
    HBufC* queryStringBuf = NULL;
    HBufC* deviceNameBuf = NULL;
    CAknQueryDialog::TTone tone = CAknQueryDialog::ENoTone;    
    
    if( !IsActive() )
        {
        iQueryId = aQueryId;
        TInt secondaryDisplayCmdId(SecondaryDisplay::ECmdNoNote);
        TInt keys(0);
        TInt anim(0);        

        switch ( iQueryId )
            {
            case ESysApRestartPhoneQuery:
                queryStringBuf = StringLoader::LoadLC( R_QTN_RESTART_QUERY, aLoaderEnv );
                keys = R_AVKON_SOFTKEYS_OK_EMPTY;
                anim = R_QGN_NOTE_WARNING_ANIM;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowRestartPhoneQuery;
                break;
            case ESysApLeaveOfflineModeQuery:
                queryStringBuf = StringLoader::LoadLC( R_QTN_LEAVE_OFFLINE_MODE_QUERY, aLoaderEnv );
                keys = R_AVKON_SOFTKEYS_YES_NO;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowLeaveOfflineModeQuery;
                break;
#ifndef RD_MULTIPLE_DRIVE
            case ESysApRemoveMmcNote:
                queryStringBuf = StringLoader::LoadLC( R_QTN_MEMC_INFO_EJECT, aLoaderEnv );
                keys = R_AVKON_SOFTKEYS_OK_EMPTY;
                anim = R_QGN_NOTE_INFO_ANIM;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowRemoveMmcQuery;
                break;
            case ESysApEjectMmcQuery:
                queryStringBuf = StringLoader::LoadLC( R_QTN_MEMC_CONF_EJECT, aLoaderEnv );
                keys = R_AVKON_SOFTKEYS_YES_NO;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowEjectMmcQuery;
                break;
#else // RD_MULTIPLE_DRIVE
            case ESysApRemoveMmcNote:
                queryStringBuf = aValue.AllocLC();
                keys = R_AVKON_SOFTKEYS_OK_EMPTY;
                anim = R_QGN_NOTE_INFO_ANIM;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowRemoveMmcQuery;
                break;
            case ESysApEjectMmcQuery:
                queryStringBuf = aValue.AllocLC();
                keys = R_AVKON_SOFTKEYS_YES_NO;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowEjectMmcQuery;
                break;
#endif // RD_MULTIPLE_DRIVE
            case ESysApBtSapDisconnectQuery:
                deviceNameBuf = iSysApAppUi.GetBtSapDeviceNameL();
                if ( deviceNameBuf )
                    {
                    CleanupStack::PushL(deviceNameBuf);
                    queryStringBuf = StringLoader::LoadL( R_QTN_BT_DISCONN_FROM, *deviceNameBuf, aLoaderEnv );
                    }
                else
                    {
                    queryStringBuf = StringLoader::LoadL( R_QTN_BT_DISCONN_FROM, KEmptyString, aLoaderEnv ); 
                    }
                CleanupStack::PushL(queryStringBuf);
                keys = R_AVKON_SOFTKEYS_YES_NO;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowBtSapDisconnectQuery;
                break;
            case ESysApMemoryCardLockedNote:
                iPendingQuery = ESysApMemoryCardLockedNote;
                queryStringBuf = StringLoader::LoadLC( R_QTN_MEMC_LOCKED_NOT_SUPPORTED, aLoaderEnv );
                keys = R_AVKON_SOFTKEYS_OK_EMPTY;
                anim = R_QGN_NOTE_INFO_ANIM;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowMemoryCardLockedQuery;
                break;
/*            case ESysApUseFmTxInOfflineQuery:
                 queryStringBuf 
                     = StringLoader::LoadLC( R_QTN_FMTX_SYSAP_NOTE_ACTIVATE_IN_OFFLINE,
                                             aLoaderEnv );
                 keys = R_AVKON_SOFTKEYS_YES_NO;
                 secondaryDisplayCmdId = SecondaryDisplay::ECmdShowFmTxKeepOnInOfflineQuery;
                 break;
*/            case ESysApBattChargingPowerSavingQuery:
                queryStringBuf = StringLoader::LoadLC( R_QTN_BATTERY_CHARGING_POWER_SAVING_QUERY, aLoaderEnv );
                keys = R_AVKON_SOFTKEYS_YES_NO;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowChargingDeactivatePowerSavingQuery;
                tone = static_cast<CAknQueryDialog::TTone>( EAvkonSIDChargingBatteryTone );                
                break;
            
            case ESysApBattLowPowerSavingQuery:
                queryStringBuf = StringLoader::LoadLC( R_QTN_BATTERY_CONF_QUERY, aLoaderEnv );
                keys = R_AVKON_SOFTKEYS_YES_NO;
                secondaryDisplayCmdId = SecondaryDisplay::ECmdShowBattLowActivatePowerSavingQuery;
                break;
            
            default:
                break;
            }

        if ( iSysApAppUi.CoverDisplaySupported() && secondaryDisplayCmdId != SecondaryDisplay::ECmdNoNote )
            {
            TRACES( RDebug::Print( _L("CSysApConfirmationQuery::ShowQueryL - Notifying secondary display") ) );
            CAknSDData* sd = NULL;
            if ( secondaryDisplayCmdId == SecondaryDisplay::ECmdShowBtSapDisconnectQuery )
                {
                SecondaryDisplay::TDeviceName sdDeviceName;
                sdDeviceName.Append(deviceNameBuf->Left(SecondaryDisplay::KMaxDeviceNameLen));
                SecondaryDisplay::TBtSapDisconnectQueryPckg pckg(sdDeviceName);
                sd = CAknSDData::NewL(SecondaryDisplay::KCatSysAp, SecondaryDisplay::ECmdShowBtSapDisconnectQuery, pckg);
                }
            else
                {
                sd = CAknSDData::NewL(SecondaryDisplay::KCatSysAp, secondaryDisplayCmdId, KNullDesC8);
                }
            iQuery->SetSecondaryDisplayData(sd); // ownership to notifier client
            }

        if ( keys && queryStringBuf )
            {
            if ( anim )
                {
                iQuery->ShowConfirmationQueryL( iStatus, 
                                                queryStringBuf->Des(), 
                                                keys,
                                                anim,
                                                KNullDesC,
                                                0,
                                                0,
                                                tone );
                }
            else
                {
                iQuery->ShowConfirmationQueryL( iStatus, 
                                                queryStringBuf->Des(), 
                                                keys,
                                                0,
                                                KNullDesC,
                                                0,
                                                0,
                                                tone );
                }
            }

        SetActive();
        }    
     else
        {
        // If another query is wanted when ESysApMemoryCardLockedNote is active, override it (Continues in RunL which handles cancel).
        if ( iQueryId == ESysApMemoryCardLockedNote && aQueryId != ESysApMemoryCardLockedNote )
            {
            iPendingQuery = aQueryId;
            iQuery->CancelConfirmationQuery();
            }
        }

    if ( queryStringBuf )
        {
        CleanupStack::PopAndDestroy( queryStringBuf ); // queryStringbuf
        }

    if ( deviceNameBuf )
        {
        CleanupStack::PopAndDestroy( deviceNameBuf ); // deviceNameBuf
        }

    }       
Beispiel #18
0
// Run console UI
void ConsoleUI::Run()
{
    con_->Read(iStatus);
    SetActive();
}
// -----------------------------------------------------------------------------
// CDrmUtilityGlobalNoteWrapper::DoShowNoteL
// -----------------------------------------------------------------------------
//
TInt DRM::CDrmUtilityGlobalNoteWrapper::DoShowNoteL(
    TInt aResourceId,
    const TDesC& aString,
    TInt aValue )
    {
    TPtr bufPtr( NULL, 0 );
    TInt animation( iButtonsId == R_AVKON_SOFTKEYS_YES_NO__YES ?
                                                    0 : R_QGN_NOTE_INFO_ANIM );

    CAknGlobalConfirmationQuery* globalNote(
                                        CAknGlobalConfirmationQuery::NewLC() );

    bufPtr.Set( const_cast <TUint16*>( iTextBuffer.Ptr() ),
                                       iTextBuffer.Length(),
                                       iTextBuffer.Length() );

    AknTextUtils::LanguageSpecificNumberConversion( bufPtr );


    if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) &&
        DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) )
        {
        RProcess myProcess;
        TUid myProcessUid( KNullUid );
        RThread().Process( myProcess );
        myProcessUid = myProcess.Identity();

        TUtilitySDData utilityData;
        // First field is DrmUtility's Uid
        utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility;
        // ProcessId which uses DrmUtility
        utilityData.iHandlerProcessId = myProcessUid;
        if ( aString.Compare( KNullDesC ) )
            {
            // If there is filename given, it's always in the PrimaryString
            utilityData.iStringParam.Append( aString );
            }
        if ( aValue >= 0 )
            {
            // If there is no other than numeric data, put it as SecondaryString
            utilityData.iNumParam.AppendNum( aValue );
            }

        TUtilitySDDataPckg pckg( utilityData );
        CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility,
                                          aResourceId,
                                          pckg ) );

        // ownership to notifier client
        globalNote->SetSecondaryDisplayData( sd );
        }

    iStatus = KRequestPending;
    globalNote->ShowConfirmationQueryL( iStatus,
                                        iTextBuffer,
                                        iButtonsId,
                                        animation );

    SetActive();
    iWait.Start();
    CleanupStack::PopAndDestroy( globalNote );
    if ( iStatus.Int() != EAknSoftkeyNo )
        {
        return iStatus.Int();
        }
    else
        {
        return 0;
        }
    }
Beispiel #20
0
YK_BOOL CUniteWorkDao::CheckSch_Seq( YK_ID workId ,TestSchedulerInfo& tsPlan,YK_TM st,YK_TM et,DirType dt)
{
	if (IsSeqWork(workId))
	{
		m_bGetWorkConditionFlg = true;
		YK_ID preWorkId = GetPreWork();
		YK_TM l,r;
		YK_TM minTm,maxTm;
		YK_TM nxtLimit;
		YK_TM periodTime;
		if (preWorkId > 0)
		{
			if (dt == Dir_Obverse)
			{
				maxTm = st;
				GetMinMaxTime(preWorkId,tsPlan,l,minTm);
				nxtLimit = tsPlan.GetPdEndTime(workId);
				periodTime = st;
			}
			else
			{
				minTm = et;
				GetMinMaxTime(preWorkId,tsPlan,maxTm,r);
				nxtLimit = tsPlan.GetPdStTime(workId);
				periodTime = et;
			}
			YK_ID resId = m_iActive->second.GetResId();
			std::list<CResCapacitySPtr> resCapLst;
			CResCapacitySPtr resPtr = g_Application.Get<CResCapacityMap>()->GetResCap(resId);
			if (resPtr.ValidObj())
			{
				resCapLst.push_back(resPtr);
			}
			minTm = g_Application.Get<CResCapacityMap>()->GetOnNxtDutyTime(resCapLst,minTm );
			if (minTm == maxTm)
			{
				m_iActive->second.SetLimits(nxtLimit);
			}
			else
			{
				if (!m_iActive->second.GetUniteWorkList().empty())
					m_iActive->second.GetUniteWorkList().pop_back();
				YK_ID id = GetPeriodNoFirstWork(dt,periodTime);
				if (id > 0)
				{
					m_bFailed = true;
					Done();
					SetActive(id);
					m_iActive->second.SetResId(resId);
					m_bChangeFirstWorkFlg = true;
					if (!CheckWorkUnite(id,tsPlan,resId,dt,false))
						ConsecutiveConditionInit();
					GetWorkCondition(id);
				}
				else
				{
					m_bFailed = true;
				}
				
				return false;
			}
		}
	}
	return true;
}
Beispiel #21
0
/*
void CWebServerEng::ReadConfigFileL()
{
	// Read Config File.
	TRAP(err,iServerEnv->ReadConfigFileL(CFG_FILENAME));
	if ((err == KErrNotFound) || (err == KErrPathNotFound))
	{
		iObserver->ShowWarningL(R_CONFIG_FILE_MISSING_WAR);
		iServerEnv->CheckAndSetDefaultL();
	}
	else
	{
		User::LeaveIfError(err);
	}
}

void CWebServerEng::ReadHttpTypesFileL()
{
	// Read Http types files
	TRAP(err,iHttpTypes.ReadHttpTypesFileL(HTTP_TYPES_FILENAME));
	if ((err == KErrNotFound) || (err == KErrPathNotFound))
	{
		iObserver->ShowWarningL(R_TYPES_FILE_MISSING_WAR);
		iHttpTypes.SetDefaultHttpTypesL();
	}
	else
	{
		User::LeaveIfError(err);
	}
}

*/
void CWebServerEng::StartWebServerL()
// This function starts the WebServer.
{
	
	TInt err;
/*
// *** TEST of the Security Database.
	CWebServerSecDB SecDb; // ----> Must be menber of the object.

//TRAP(err,SecDb.OpenSecDBL(_L("WebServer")));
//if (err == KErrNotFound)
//{
	SecDb.CreateSecDB(_L("webserver.db"));
	SecDb.OpenSecDBL(_L("webserver.db"));
	SecDb.InsertUserL(_L("Litos"),_L("Groo"),_L("GrooWorld"));
	SecDb.InsertUserL(_L("Rufferto"),_L("Groo"),_L("RuffertoWorld"));
	TInt ruffertotwice = SecDb.InsertUserL(_L("Rufferto"),_L("Groonan"),_L("RuffertoWorld"));
	SecDb.InsertRealmL(_L("GrooWorld"),_L("Basic"));
	SecDb.InsertResourceDirL(_L("\\ws\\laetitia\\"),_L("GrooWorld"),SEC_GET);
	SecDb.CloseSecDB();
	SecDb.OpenSecDBL(_L("webserver.db"));
	TBool boolean1 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\ws\\laetitia\\"),EGet);
	TBool boolean2 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\ws\\laetitia\\"),EPut);
	TBool boolean3 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\ws\\laetitia\\"),EDelete);
	TBool boolean4 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\ws\\laetitia\\"),EOptions);
	TBool boolean5 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\ws\\laetitia\\"),EPost);
	TBool boolean6 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\ws\\laetitia\\"),EGet);
	TBool boolean7 = SecDb.GrantAccessL(_L("Litos5"),_L("Groo"),_L("\\ws\\laetitia\\"),EPost);
	TBool boolean8 = SecDb.GrantAccessL(_L("Litos"),_L("Groonan"),_L("\\ws\\laetitia\\"),EPost);
	TBool boolean9 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\lala\\laetitia\\"),EPost);
	TBool boolean10 = SecDb.GrantAccessL(_L("Rufferto"),_L("Groo"),_L("\\ws\\laetitia\\"),EGet);
	TInt deluser = SecDb.DeleteUserL(_L("Litos"),_L("RuffertoWorld"));
	SecDb.DeleteUserL(_L("Litos"),_L("GrooWorld"));
	TInt dellit = SecDb.DeleteUserL(_L("Litos"),_L("GrooWorld"));
	TBool boolean11 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\ws\\laetitia\\"),EGet);
	SecDb.InsertUserL(_L("Litos"),_L("Groo"),_L("GrooWorld"));
	SecDb.DeleteRealm(_L("GrooWorld"));
	TBool boolean12 = SecDb.GrantAccessL(_L("Litos"),_L("Groo"),_L("\\ws\\laetitia\\"),EGet);
	SecDb.CloseSecDB();
	
//}


*/

//***********************************

#ifdef IPV4_ORIG

	iStatusText = _L("************* IPV4 STACK ****************\n\n");
#else

	iStatusText=_L("*************** DUAL STACK IPV4/IPV6 ****************\n\n");
#endif
	NotifyStatus();

	// Setting up the dial connection.
	iStatusText=_L("Setting up net connection.\n");
	NotifyStatus();

	// Make a connection to the Socket Server.
	iStatusText=_L("Connecting to the Socket Server.\n");
	NotifyStatus();
	err = iSocketServer.Connect(201);
	User::LeaveIfError(err);

#if EPOC_SDK >= 0x07010000
    User::LeaveIfError(iRConnection.Open(iSocketServer));
    err = iRConnection.Start();

    if (err != KErrAlreadyExists)
        User::LeaveIfError(err);

#elif EPOC_SDK >= 0x06010000

    User::LeaveIfError(iGenericAgent.Open());
    err = iGenericAgent.StartOutgoing();
    err = iGenericAgent.DisableTimers();

    if (err != KErrAlreadyExists)
        User::LeaveIfError(err);
#else
    User::LeaveIfError(iNetdial.Open());
    
	err = iNetdial.DisableTimers();
	if (err != KErrAlreadyExists)
		User::LeaveIfError(err);

	err = iNetdial.StartDialOut();

	if (err != KErrAlreadyExists)
		User::LeaveIfError(err);
#endif // EPOC_SDK >= 0x06010000

	// Open a socket to listen on.
	iStatusText=_L("Opening the Socket.\n");
	NotifyStatus();

	err = iSocket.Open(iSocketServer, KAfInet, KSockStream, KProtocolInetTcp);
	User::LeaveIfError(err);

	// Reuse the port
	iSocket.SetOpt(KSoReuseAddr, KProtocolInetIp, 1);

	// Bind the socket to the http port.
	iStatusText=_L("Binding the Socket.\n");
	NotifyStatus();

	TInetAddr httpPort(KInetAddrAny, iServerEnv->iPort);
	httpPort.SetFamily(0); // Listen both IPV4 and IPV6. (Dual-Stack).
	err = iSocket.Bind(httpPort);
	User::LeaveIfError(err);

	// Listen for incoming connections.
	iStatusText=_L("Listening through the Socket.\n");
	NotifyStatus();
	err = iSocket.Listen(100);
	User::LeaveIfError(err);

	// The Socket for the "real" connection.(between the client and the WebServer)
	iStatusText=_L("Waiting for a Connection.\n");
	NotifyStatus();
	
	CreateSocketAndConnectionL();
	
	iWebServerState = EWaitingForConnections;
	iSocket.Accept(*iConnection,iStatus);
	iCurrentNumberConnections = 0;
	iTotalNumberConnections = 0;
	SetActive();
}
Beispiel #22
0
void CWsRedrawer::IssueRequest()
	{
	iClient->iWs.RedrawReady(&iStatus);
	SetActive();
	}
Beispiel #23
0
void CHIDEventMonitor::RunL()
    {
    THIDEvent hidEvent;
    iHIDClient->GetEvent( hidEvent );
    switch (hidEvent.Type())
        {
        case THIDEvent::EMouseEvent:
            {
            qboolean down = qfalse;
            TMouseEvent* mouse = hidEvent.Mouse();
            switch (mouse->Type())
                {
                case EEventRelativeXY:
                    currentPosition += mouse->iPosition;
                    break;
                case EEventButtonDown:
                    down = qtrue;
                case EEventButtonUp:
                    switch(mouse->iValue)
                        {
                        case EMouseButtonLeft:
                            Key_Event(K_MOUSE1, down);
                            break;
                        case EMouseButtonRight:
                            Key_Event(K_MOUSE1+1, down);
                            break;
                        case EMouseButtonMiddle:
                            Key_Event(K_MOUSE1+2, down);
                            break;
                        default:
                            break;
                        }
                    break;
                case EEventRelativeWheel:
                    if (mouse->iValue > 0)
                        {
                        Key_Event( K_MWHEELUP, qtrue);
                        Key_Event( K_MWHEELUP, qfalse );
                        }
                    else
                        {
                        Key_Event( K_MWHEELDOWN, qtrue);
                        Key_Event( K_MWHEELDOWN, qfalse );
                        }
                    break;
                default:
                    break;
                }
            }
            break;
        case THIDEvent::EKeyEvent:
            {
            THIDKeyEvent* key = hidEvent.Key();
            int hid_code = hid_to_quake[key->ScanCode()];
            switch (key->Type())
                {
                case EEventHIDKeyUp:
                    if (shift_down)
                        {
                        hid_code = hid_to_quake_shifted[key->ScanCode()];
                        }
                    if (hid_code == K_SHIFT)
                        {
                        shift_down = qfalse;
                        }
                    Key_Event(hid_code, qfalse);
                    
                    break;
                case EEventHIDKeyDown:
//                    Com_Printf( "EEventHIDKeyDown, code %d\n",key->ScanCode());
                    if (hid_code == K_SHIFT)
                        {
                        shift_down = qtrue;
                        }
                    if (shift_down)
                        {
                        hid_code = hid_to_quake_shifted[key->ScanCode()];
                        }
                    Key_Event(hid_code, qtrue);
                    break;
                default:
                    break;
                }
            }
            break;
        case THIDEvent::EConsumerEvent:
            {
            THIDConsumerEvent* consumer = hidEvent.Consumer();
            //Com_Printf( "consumer, code %d\n",consumer->ButtonCode());
            break;
            }
        default:
            break;
        }
    iHIDClient->EventReady( &iStatus );
    SetActive();
    }
Beispiel #24
0
void CWsClient::IssueRequest()
	{
	iWs.EventReady(&iStatus); // request an event
	SetActive(); // so we're now active
	}
//----------------------------------------------------------------------------
// CIrDAObexSearcher::RunL()
//----------------------------------------------------------------------------
//
void CIrDAObexSearcher::RunL()
	{
	TInt err( iStatus.Int() );

	if ( iState != EDeviceSearchTimeout )
		{
		iInitialErr = err;
		}

	if ( err != KErrNone )
		{
		switch ( iState )
			{
			case EDeviceSearch:
				{
				if ( iConnectionRetry < KDeviceSearchRetries )
					{
					// Try again after short pause
					iConnectionRetry++;
					//DBG_ARGS8( "Failed, trying again %d more time(s)",
					//				KDeviceSearchRetries - iConnectionRetry );

					iState = EDeviceSearchTimeout;

					iRetryTimer.After( iStatus, KDeviceSearchTimeout );
					SetActive();
					}
				else
					{
					NotifyDeviceErrorL( iInitialErr );
					// Reinitialize retry counter
					iConnectionRetry = KDeviceSearchFirstTry;
					}
				break;
				}
			case EDeviceSearchTimeout:
				{
				// We should never end up here, but if we do, continue
				// as if nothing happened.
				SearchDeviceL();
				break;
				}
			case EServiceSearch:
				{
				NotifyServiceErrorL( iInitialErr );
				break;
				}
			default:
				{
				User::Panic( KIrObexSearcher, KInvalidStatePanicVal );
				break;
				}
			}
		}
	else
		{
		switch ( iState )
			{
			case EDeviceSearch:
				{
				NotifyDeviceFoundL();
				break;
				}
			case EDeviceSearchTimeout:
				{
				SearchDeviceL();
				break;
				}
			case EServiceSearch:
				{
				NotifyServiceFoundL();
				break;
				}
			default:
				{
				User::Panic( KIrObexSearcher, KInvalidStatePanicVal );
				break;
				}

			}
		}
	}
	void ConstructL() { 
		CActiveScheduler::Add(this);
		iThread.Logon(iStatus);
		SetActive();
	}
Beispiel #27
0
void CMenus::RenderGame(CUIRect MainView)
{
	CUIRect Button, ButtonBar;
	MainView.HSplitTop(45.0f, &ButtonBar, &MainView);
	RenderTools()->DrawUIRect(&ButtonBar, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f);

	// button bar
	ButtonBar.HSplitTop(10.0f, 0, &ButtonBar);
	ButtonBar.HSplitTop(25.0f, &ButtonBar, 0);
	ButtonBar.VMargin(10.0f, &ButtonBar);

	ButtonBar.VSplitRight(120.0f, &ButtonBar, &Button);
	static int s_DisconnectButton = 0;
	if(DoButton_Menu(&s_DisconnectButton, Localize("Disconnect"), 0, &Button))
		Client()->Disconnect();

	if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pGameInfoObj)
	{
		if(m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS)
		{
			ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
			ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
			static int s_SpectateButton = 0;
			if(DoButton_Menu(&s_SpectateButton, Localize("Spectate"), 0, &Button))
			{
				m_pClient->SendSwitchTeam(TEAM_SPECTATORS);
				SetActive(false);
			}
		}

		if(m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_TEAMS && !(m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_INFECTION))
		{
			if (m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_RED)
			{
				ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
				ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
				static int s_SpectateButton = 0;
				if(DoButton_Menu(&s_SpectateButton, Localize("Join red"), 0, &Button))
				{
					m_pClient->SendSwitchTeam(TEAM_RED);
					SetActive(false);
				}
			}

			if (m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_BLUE)
			{
				ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
				ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
				static int s_SpectateButton = 0;
				if (DoButton_Menu(&s_SpectateButton, Localize("Join blue"), 0, &Button))
				{
					m_pClient->SendSwitchTeam(TEAM_BLUE);
					SetActive(false);
				}
			}
		}
		else
		{
			if (m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags & GAMEFLAG_INFECTION)
			{
				if (m_pClient->m_Snap.m_pLocalInfo->m_Team == TEAM_SPECTATORS)
				{
					ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
					ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
					static int s_SpectateButton = 0;
					if(DoButton_Menu(&s_SpectateButton, Localize("Join game"), 0, &Button))
					{
						m_pClient->SendSwitchTeam(0);
						SetActive(false);
					}
				}
			}
			else
			if (m_pClient->m_Snap.m_pLocalInfo->m_Team != 0)
			{
				ButtonBar.VSplitLeft(10.0f, 0, &ButtonBar);
				ButtonBar.VSplitLeft(120.0f, &Button, &ButtonBar);
				static int s_SpectateButton = 0;
				if(DoButton_Menu(&s_SpectateButton, Localize("Join game"), 0, &Button))
				{
					m_pClient->SendSwitchTeam(0);
					SetActive(false);
				}
			}
		}
	}

	ButtonBar.VSplitLeft(100.0f, 0, &ButtonBar);
	ButtonBar.VSplitLeft(150.0f, &Button, &ButtonBar);

	static int s_DemoButton = 0;
	bool Recording = DemoRecorder()->IsRecording();
	if(DoButton_Menu(&s_DemoButton, Localize(Recording ? "Stop record" : "Record demo"), 0, &Button))	// Localize("Stop record");Localize("Record demo");
	{
		if(!Recording)
			Client()->DemoRecorder_Start("demo", true);
		else
			Client()->DemoRecorder_Stop();
	}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void CIpsPlgConnectAndRefreshFolderList::DoRunL()
    {
    FUNC_LOG;
    
    if( iStatus.Int() != KErrNone )
// </qmail>
        {
        iState = ECompleted;
// <qmail> DisplayLoginFailedDialogL removed
        CompleteObserver();
        return;
        }
    
    switch(iState)
        {
        case EStartConnect:
            delete iSubOperation;
            iSubOperation = NULL;
            // <qmail> priority parameter has been removed
            iSubOperation = CIpsPlgImap4ConnectOp::NewL(
                iMsvSession,
                iStatus,
                iService,
                *iActivityTimer,
                iFSMailboxId,
                NULL, // no observer for suboperations
                0, // no requestId needed
                NULL, // Event handler
                ETrue ); // Plain connect
            iState = EConnecting;
            SetActive();
            break;
	    case EConnecting:
	        {
	        //  We have successfully completed connecting
	        TBuf8<1> dummyParam;
	        delete iSubOperation;
	        iSubOperation = NULL;
	        InvokeClientMtmAsyncFunctionL( KIMAP4MTMSyncTree, *iSelection, dummyParam ); // <qmail> 1 param removed 
	        iState = ERefreshing;
	        SetActive();
	        }
	        break;
	    case ERefreshing:
	        //  We have successfully completed refreshing the folder list
	        delete iSubOperation;
	        iSubOperation = NULL;
	        iSubOperation = CIpsPlgDisconnectOp::NewL( 
                iMsvSession, 
                iStatus, 
                iService, 
                *iActivityTimer,
                iFSMailboxId, 
                NULL, // no observer for suboperations
                0 ); // no requestId needed
	        iState = EDisconnecting;
	        SetActive();
	        break;
	    case EDisconnecting:
	        iState = ECompleted;
	        CompleteObserver();
	        break;
	    default:
	        User::Panic( KIpsPlgPanicCategory, EIpsPlgNoParameters );
	    	break;
        }
    }
void CSensor_btprox::BtNext() 
{
  iHostResolver.Next(iNameEntry, iStatus);
  SetActive();
  iState = EDiscovering;
}
Beispiel #30
0
void CActiveNotifyDeviceEvent::Post()
	{
	iUsbHostStack.NotifyDeviceEvent(iStatus, iDeviceEventInformation);
	SetActive();
	}