Beispiel #1
0
void CMyServer::ClipboardChanged()
	{
	__LOGSTR("CMyServer::ClipboardChanged");
	Cancel();
    iClipboard = CClipboard::NewForReadingL(iFs);
    _CPUSH(iClipboard);
    iClipboard->StreamDictionary().At(KClipboardUidTypePlainText);
    iTextPlain->DeleteL(0,iTextPlain->DocumentLength());
	iTextPlain->PasteFromStoreL(iClipboard->Store(),iClipboard->StreamDictionary(),0);
	//iDrawTextNew.Delete(0,iDrawTextNew.Length());
	iTextPlain->Extract(iDrawTextNew,0);
	_CPOPD(iClipboard);

	if( iDrawTextNew != iDrawTextOld)
		{
		__LOGSTR("Compare success");
		__LOGSTR2("BEFORE COPY:::::: iDrawTextNew: %S,iDrawTextOld: %S",&iDrawTextNew,&iDrawTextOld);
		iDrawTextOld = iDrawTextNew;
		if(iDrawTextOld.Left(2) == _L("+7") || iDrawTextOld.Left(1) == _L("8"))
		    {
			iTitle = _L("Вызвать");
			iTypeEvent = ETypeCall;
		    }else{
		    	iTitle = _L("Искать");
		    	iTypeEvent = ETypeSearch;
		    }
		__LOGSTR2("AFTER COPY:::::: iDrawTextNew: %S,iDrawTextOld: %S",&iDrawTextNew,&iDrawTextOld);
		Draw(iDrawTextOld);
		iTimer->StartTimer(5);
		WaitWgEvent();
		}
	}
Beispiel #2
0
void CMyServer::ConstructL()
    {
    __LOGSTR("Construct");
    CActiveScheduler::Add(this);
    iWs = RWsSession();
    iFs.Connect();

    iTextPlain = CPlainText::NewL();

    ReadConf();
    __LOGSTR("ReadConfComplete");
	iOldName = _L("ClipboardChanged");

    iWs.Connect(iFs);
    iTaskList = new(ELeave) TApaTaskList(iWs);

    iScreen = new(ELeave) CWsScreenDevice(iWs);
    CleanupStack::PushL(iScreen);
    iScreen->Construct();
    CleanupStack::Pop(iScreen);

    iChangeTrap = CChangeTrap::NewL();
    iChangeTrap->SetObserver(this);
    iTimer = CPTimer::NewL();
    iTimer->SetObserver(this);
    iCaller = CCaller::NewL();

    iWg = RWindowGroup(iWs);
    iWg.Construct((TUint32)&iWg,EFalse);
    iWg.SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
    iWg.EnableReceiptOfFocus(EFalse);
    iScreen->CreateContext(iGc);
    iWindow = RWindow(iWs);
    iWindow.Construct(iWg,(TUint32)&iWg+1);

    iWindow.Activate();
    iWindow.SetExtent(TPoint(0,0),TSize(1,1));
    iWindow.SetRequiredDisplayMode(EColor16MA);
	iWindow.SetOrdinalPosition(5555,ECoeWinPriorityAlwaysAtFront);
    TRgb backgroundColour = KRgbBlack;
    //if(KErrNone == iWindow.SetTransparencyAlphaChannel())
   // 	{
    //	backgroundColour.SetAlpha(0);
    //	}
    iWindow.SetBackgroundColor(backgroundColour);


    GetFontSize();

    iWindow.SetSize(iSize);
    __LOGSTR2("iSize1: %d,iSize2: %d",iSize.iWidth,iSize.iHeight);
    iPos=TPoint(iConfig.iX,iConfig.iY);
	iWindow.SetVisible(EFalse);


    iWs.Flush();
    //Draw(iOldName);
    }
Beispiel #3
0
void CMyServer::RunL()
    {
    #ifdef __DEBUG
    __LOGSTR("RunL");
    #endif
	GetWgEvent();
    }
Beispiel #4
0
void CButton::RunL()
    {
    #ifdef __DEBUG
    __LOGSTR("RunL");
    #endif
	GetWgEvent();
    }
Beispiel #5
0
void CButton::ConstructL()
    {
    #ifdef __DEBUG
    __LOGSTR("Construct");
    #endif
    CActiveScheduler::Add(this);
    iColor = KRgbRed;
    iWs = RWsSession();
    iFs.Connect();
    iWs.Connect(iFs);
    iWg = RWindowGroup(iWs);
    iWg.Construct((TUint32)&iWg,EFalse);
    iWg.SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
    iWg.EnableReceiptOfFocus(ETrue);

    iWindow = RWindow(iWs);
    iWindow.Construct(iWg,(TUint32)&iWg+1);
    iWindow.Activate();
    iWindow.SetNonFading(ETrue);
    //
    iWindow.SetBackgroundColor(KRgbBlack);

    iScreen=new (ELeave) CWsScreenDevice(iWs);
    User::LeaveIfError(iScreen->Construct());
    User::LeaveIfError(iScreen->CreateContext(iGc));
    GetFontSize();
    iScreenSize.iY = iScreen->GetCurrentScreenModeAttributes().iScreenSize.iHeight;
    iScreenSize.iX = iScreen->GetCurrentScreenModeAttributes().iScreenSize.iWidth;
    iWindow.SetExtent(TPoint(0,iScreenSize.iY-60),TSize(iScreenSize.iX,60));
    iWs.Flush();
    Draw();
    iWs.Flush();
    }
Beispiel #6
0
void SetPriority()
	{
	RProcess processHandle;
	__LOGSTR("Set process priority");
	processHandle.SetPriority(EPriorityHigh);
	processHandle.Close();
	}
Beispiel #7
0
void CMyServer::HideWindow()
	{
	__LOGSTR("CMyServer::HideWindow");
	Cancel();
	iTimer->StopTimer();
	iWindow.SetVisible(EFalse);
	iWs.Flush();
	}
Beispiel #8
0
void CMyObserverClass::ConstructL()
{
#ifdef __DEBUG
		__LOGSTR("CMyObserverClass::ConstructL()");
#endif
	CActiveScheduler::Add(this);
	iTelephony = CTelephony::NewL();
}
Beispiel #9
0
void CButton::GetWgEvent()
    {
    #ifdef __DEBUG
    __LOGSTR1("GetWgEvent,iStatus: %d",iStatus.Int());
    #endif
   if(iStatus == KErrNone)
	{
    TWsEvent e;
    iWs.GetEvent(e);
    #ifdef __DEBUG
    __LOGSTR1("event: %d",e.Type());
    #endif
    switch(e.Type())
    	{
    	case EEventPointer:
    	case EEventPointerEnter:
    	case EEventDragDrop:
    	{
    	__LOGSTR("SendClose");
    	iMconnect->SendClose();
    	break;
    	}
    	case EEventFocusGained:
    		__LOGSTR("Focus gained");
    		iIsFocus = ETrue;
    		//iColor = KRgbGreen;
    		break;
    	case EEventFocusLost:
    		__LOGSTR("Focus lost");
    		iIsFocus = EFalse;
    		//iColor = KRgbRed;
    		break;
    	case EEventKeyDown:
    		__LOGSTR2("EEventKeyDown,iIsFocus: %d,iScanCode: %d",iIsFocus,e.Key()->iScanCode);
    		if(iIsFocus && e.Key()->iScanCode == 167)
    			{
    			iMconnect->SendClose();
    			}
    		break;
    	}
	}
	Draw();
	iWs.Flush();
    WaitWgEvent();
    }
Beispiel #10
0
void CMyServer::Hide()
    {
	__LOGSTR("Hide");
	iIsVisible=EFalse;
	iMember.iBitmap=NULL; // bitmap is NULL -> sprite is hidden
	iMember.iMaskBitmap=NULL;
	iSprite->SetPosition(iPos);
	iSprite->UpdateMember(0,iMember);
	iWs.Flush();
    }
Beispiel #11
0
void CButton::WaitWgEvent()
    {
    iWg.EnableFocusChangeEvents();
    iWg.EnableGroupListChangeEvents();
    #ifdef __DEBUG
    __LOGSTR("WaitWgEvent");
    #endif
    iWs.EventReady(&iStatus);
    SetActive();
    }
Beispiel #12
0
void CMyServer::WaitWgEvent()
    {
    iWg.EnableFocusChangeEvents();
    //iWg->EnableGroupChangeEvents();
    iWg.EnableGroupListChangeEvents();
    //iWg->EnableScreenChangeEvents();
    __LOGSTR("WaitWgEvent");
    iWs.EventReady(&iStatus);
    SetActive();
    }
Beispiel #13
0
void CMyObserverClass::CallRinging()
{
#ifdef __DEBUG
	__LOGSTR("Call Ringing");
#endif

	//Open line
	iTelephony->AnswerIncomingCall(iStatus, iCallID);
	SetActive();
}
Beispiel #14
0
void CPhoneReceiver::OpenIncommingCall()
{
#ifdef __DEBUG
	__LOGSTR("OpenIncommingCall");
#endif

	//Answer incoming call (Required Network services capability)
	iTelephony->AnswerIncomingCall(iStatus, iCallID);
	SetActive();
}
Beispiel #15
0
void ShowNoteL(const TDesC& aNote)
	{
	__LOGSTR("ShowNote");
	__LOGSTR1("ShowGlobalNote: %S",&aNote);

	CAknGlobalNote* note = CAknGlobalNote::NewLC();
	TInt NoteId;
	NoteId = note->ShowNoteL(EAknGlobalInformationNote,aNote);
	User::After(5000000);
	note->CancelNoteL(NoteId);
	__CPOPD(note);
	}
Beispiel #16
0
void CPhoneReceiver::RunL()
{
#ifdef __DEBUG
	__LOGSTR1("CPhoneReceiver::RunL(),iCurrentStatusPckg: %d",iCurrentStatusPckg().iStatus);
#endif
	/*if(iNumms > 2)
		return ;*/
	if(iStatus.Int() == KErrNone)
	{
		//Get call status
		iCallStatus = iCurrentStatusPckg().iStatus;
		switch(iCallStatus)
		{
		case CTelephony::EStatusRinging:
			//++iNumms;
			iPhoneReceiverObserver.CallRinging();
			break;

		case CTelephony::EStatusAnswering:
			iPhoneReceiverObserver.CallAnswered();
			break;
		default:
#ifdef __DEBUG
			__LOGSTR("default");
#endif
			break;
		}
#ifdef __DEBUG
		__LOGSTR("Run startL");
#endif
	//StartL();
	}
	else
	{
#ifdef __DEBUG
		__LOGSTR1("Error In status,iStatus: %d",iStatus.Int());
#endif
	}
	StartL();
}
Beispiel #17
0
void CPhoneReceiver::StartL()
{
#ifdef __DEBUG
	__LOGSTR("CPhoneReceiver::StartL()");
#endif
	Cancel();	// Cancel any request, just to be sure

	//Notify of change in telephone line
	iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange,
								iCurrentStatusPckg );

	SetActive();	// Tell scheduler a request is active
}
Beispiel #18
0
void CMyServer::GetWgEvent()
    {
    #ifdef __DEBUG
    __LOGSTR1("GetWgEvent,iStatus: %d",iStatus.Int());
    #endif
   if(iStatus == KErrNone)
	{
    TWsEvent e;
    iWs.GetEvent(e);
    #ifdef __DEBUG
    __LOGSTR1("event: %d",e.Type());
    #endif
	}
    TInt WgId = iWs.GetFocusWindowGroup();
    CApaWindowGroupName* gn = CApaWindowGroupName::NewLC(iWs, WgId);
    #ifdef __DEBUG
    __LOGSTR2("focused app with uid: 0x%x,config uid: 0x%x",gn->AppUid(),iConfig.iUid);
    #endif
    if(gn->AppUid() == iConfig.iUid)
	{

    	Show();
	//Draw();
    //iWindow.SetVisible(ETrue);
    //iWs.Flush();
    #ifdef __DEBUG
	__LOGSTR("UIDs ==");
    #endif
	}else{
	//iWindow.SetVisible(EFalse);
		Hide();
	iWs.Flush();
    #ifdef __DEBUG
	__LOGSTR("UIDs !=");
    #endif
	}
    WaitWgEvent();
    }
Beispiel #19
0
void CmyPlay::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration)
    {
    __LOGSTR("MapcInitComplete");
    iState = aError ? ENotReady : EReady;
    __LOGSTR1("after MapcInitComplete max vol: %d",iPlayer->MaxVolume());
    if(iNeedToSetVolume)
        {
            iPlayer->SetVolume(iNewVolume);
            iNeedToSetVolume = EFalse;
        }
    if(iAllow)
        iPlayer->Play();
    __LOGSTR1("iState: %d",iState);
    }
Beispiel #20
0
TInt Copy(const TDesC& aOld,const TDesC& aNew)
	{
	__LOGSTR("Copy");
	TInt err;
	RFs session;
	__CH__(session.Connect());
	__CPUSHC(session);
	CFileMan* manager = CFileMan::NewL(session);
	__CPUSH(manager);
	err = manager->Copy(aOld,aNew,CFileMan::ERecurse | CFileMan::EOverWrite);

	__LOGSTR1("Copy returned value: %d",err);
	__CPOPD(manager);
	__CPOPD(&session);
	return err;
	}
Beispiel #21
0
void CMyServer::Show()
    {
	__LOGSTR("Show");
	iNewName = iEngine->ActiveProfileL()->ProfileName().Name();
	if(iNewName != iOldName)
	{
		Draw(iNewName);
		iOldName = iNewName;
		return;
	}
	iIsVisible=ETrue;
	//iMember.iBitmap=iBitmap; //bitmap isn't NULL -> sprite is shown
//	iMember.iMaskBitmap=iMask;
	iMember.iBitmap=iMask; //bitmap isn't NULL -> sprite is shown
	iMember.iMaskBitmap=iBitmap;
	iSprite->UpdateMember(0,iMember);
	iSprite->SetPosition(iPos);
	iWs.Flush();
    }
Beispiel #22
0
LOCAL_C void Work()
	{
	    __LOGSTR("Work");
	    RProcess proc;
	    TInt val;
	    TBuf<5> buf2;
	    TLex lex;
	    buf2.Copy(proc.FullName().Right(1));
	    lex.Assign(buf2);
	    lex.Val(val);

	    if(val > 1)
		{
		}else{
            CPhoneReceiver* res = CPhoneReceiver::NewLC();
            CActiveScheduler::Start();
            _CPOPD(res);
		}
    }
Beispiel #23
0
void CMyServer::Draw(const TDesC& aText)
    {
	__LOGSTR("Draw()");
	//TBuf<256> text(iEngine->ActiveProfileL()->ProfileName().Name());
	//__LOGSTR1("iText: %S",&text);
	TRgb color(iConfig.iColor);
		//draw
		iBitGc->SetBrushColor(color);
		iBitGc->SetBrushStyle(CFbsBitGc::ESolidBrush);
		iBitGc->SetPenColor(color);
		iBitGc->DrawRect(TRect(-1,-1,iSize.iWidth+1,iSize.iHeight+1));
		iBitGc->SetBrushColor(color);
		iBitGc->SetBrushStyle(CFbsBitGc::ENullBrush);
		iBitGc->SetPenColor(color);
		iBitGc->UseFont(iFont);
		iBitGc->DrawText(aText,TRect(0,0,iFont->TextWidthInPixels(aText),iFont->HeightInPixels()),iFont->AscentInPixels(),CFbsBitGc::ELeft,0);
		//iBitGc->DrawText(arr->MdcaPoint(1),TRect(0,3+iFont->HeightInPixels(),iFont->TextWidthInPixels(arr->MdcaPoint(1)),3+2*iFont->HeightInPixels()),iFont->AscentInPixels(),CFbsBitGc::ELeft,0);

		TRgb TransColor(0,0,0);
		iMaskGc->SetBrushColor(KRgbWhite);
		iMaskGc->SetBrushStyle(CFbsBitGc::ESolidBrush);
		iMaskGc->SetPenColor(KRgbWhite);
		iMaskGc->DrawRect(TRect(-1,-1,iSize.iWidth+1,iSize.iHeight+1));
		iMaskGc->SetPenColor(TransColor);
		iMaskGc->SetBrushColor(TransColor);
		iMaskGc->SetBrushStyle(CFbsBitGc::ENullBrush);
		iMaskGc->UseFont(iFont);
		iMaskGc->DrawText(aText,TRect(0,0,iFont->TextWidthInPixels(aText),iFont->HeightInPixels()),iFont->AscentInPixels(),CFbsBitGc::ELeft,0);
		//iMaskGc->DrawText(arr->MdcaPoint(1),TRect(0,3+iFont->HeightInPixels(),iFont->TextWidthInPixels(arr->MdcaPoint(1)),3+2*iFont->HeightInPixels()),iFont->AscentInPixels(),CFbsBitGc::ELeft,0);
		//CEikonEnv::Static()->InfoMsg(iText->Des());
	//update image (if needed)
		if (iIsVisible)
			{
			iMember.iBitmap=iBitmap;
			iMember.iMaskBitmap=iMask;
			}

		iSprite->UpdateMember(0,iMember);
		iSprite->SetPosition(iPos);
		iWs.Flush();
    }
Beispiel #24
0
TInt ParseCopy(const TDesC& aString)
	{
	__LOGSTR("ParseCopy");
	TBuf<256> aOld;
	TBuf<256> aNew;
	TInt found;
	TInt err = -1;
	found = aString.Find(KParseCopyString);

	__LOGSTR1("found parsered statement: %d",found);

	if(found != KErrNotFound)
		{
	aOld = aString.Left(found);
	aNew = aString.Right(aString.Length()-(found+3));

	__LOGSTR1("aOld:%S",&aOld);
	__LOGSTR1("aNew:%S",&aNew);

	err = Copy(aOld,aNew);
		}
	return err;
	}
Beispiel #25
0
void CMyServer::Draw(const TDesC& aText)
    {
	__LOGSTR("CMyServer::Draw");
	__LOGSTR1("Draw text: %S",&aText);
	GetFontSize();
	iWindow.SetSize(iSize);
	iWindow.SetPosition(TPoint(0,0)/*iPos*/);
	iWindow.SetVisible(ETrue);
	iGc->Activate(iWindow);
	//TRect Drw(iPos,iSize);
	iRect = TRect(iPos,iSize);
	iWindow.Invalidate(iRect);
	iWindow.BeginRedraw();
	iGc->Clear();
	iGc->SetPenColor(iConfig.iColor);
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	iGc->UseFont(iFont);
	iGc->DrawText(iTitle,TRect(0,0, iRect.Width(),iRect.Height()),iFont->FontMaxAscent(), CGraphicsContext::ELeft, 0);
	iGc->DrawText(aText,TRect(0,iSize.iHeight/2, iRect.Width(),iRect.Height()),iFont->FontMaxAscent(), CGraphicsContext::ECenter, 0);
    iWindow.EndRedraw();
    iGc->Deactivate();
    iWs.Flush();
    }
Beispiel #26
0
void CMyServer::LaunchStandardBrowser()
	{
	__LOGSTR("CMyServer::LaunchBrowser");
	TBuf<512> url;
	url.Format(KUrlSearchStandard,&iDrawTextOld);
	TBuf8<512> url8;
	url8.Copy(url);
    TUid UID_Browser_91;
    UID_Browser_91.iUid = 0x1020724D;
    TUid UID_Browser_92;
    UID_Browser_92.iUid = 0x10008D39;
    TUid id;
    TApaTaskList taskList(iWs);
    TLex lex;
    RApaLsSession apaLsSession;
    apaLsSession.Connect();
    OsVersion ver;
    GetOsVersion(ver);
    __LOGSTR2("Major: %D, Minor: %D",ver.iMajor,ver.iMinor);
    if(ver.iMajor == 3 && ver.iMinor == 0)
	{
	//9.1
	__LOGSTR("9.1");
	id = UID_Browser_91;
	}else{
	//greather
	__LOGSTR("9.2 or high");
	id = UID_Browser_92;
	}
    TApaTask task = taskList.FindApp(id);

    if(task.Exists())
        {
        task.BringToForeground();
        task.SendMessage(TUid::Uid(0), url8); // UID not used
        }
    else
        {
        //if(!apaLsSession.Handle())
          //{
          //User::LeaveIfError(apaLsSession.Connect());
          //}
    	TApaAppInfo appInfo;
    	TInt retVal=apaLsSession.GetAppInfo(appInfo,id);
    	if(KErrNone == retVal)
    		{
    		CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
    		cmdLine->SetExecutableNameL(appInfo.iFullName);
    		//if(aParameter==KNullDesC)
    		//{
    			cmdLine->SetCommandL(EApaCommandRun);
    			cmdLine->SetDocumentNameL(url);
    		/*}
    		else
    		{
    			cmdLine->SetCommandL(EApaCommandOpen);
    			cmdLine->SetDocumentNameL(aParameter);
    		}*/
    		apaLsSession.StartApp(*cmdLine);

    		_CPOPD(cmdLine);
            task.BringToForeground();
            task.SendMessage(TUid::Uid(0), url8); // UID not used
    		}
        }
	}
Beispiel #27
0
void CMyServer::HideRequest()
	{
	__LOGSTR("CMyServer::HideRequest");
	HideWindow();
	}
Beispiel #28
0
void CmyPlay::MapcPlayComplete(TInt aError)
    {
    __LOGSTR("MapsPlayComplete");
    iState = aError ? ENotReady : EReady;
    CActiveScheduler::Stop();
    }
Beispiel #29
0
void CMyServer::StartManagement()
	{
	__LOGSTR("CMyServer::StartManagement");
	iChangeTrap->StartMonitoring();
	}
Beispiel #30
0
CmyPlay::~CmyPlay()
    {
    __LOGSTR("Destructor");
    }