/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TBool CExPolicy_Server::LockScreenLockedUnLocked(TBool aSetOn) { if(aSetOn) { TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive { TParsePtrC Hjelppp(PrivFolder.File()); TFileName FilNammm; FilNammm.Copy(Hjelppp.Drive()); FilNammm.Append(KtxLockScreenInfName); RFile DonewFil; if(KErrNone == DonewFil.Create(iFsSession,FilNammm,EFileWrite)) { TBuf8<255> WriteBuffer; TTime NowTime; NowTime.HomeTime(); WriteBuffer.Copy(iImsi); WriteBuffer.Append(_L8(": ")); WriteBuffer.AppendNum(NowTime.DateTime().Day()); WriteBuffer.Append(_L8("/ ")); WriteBuffer.AppendNum(NowTime.DateTime().Month()); WriteBuffer.Append(_L8("/ ")); WriteBuffer.AppendNum(NowTime.DateTime().Year()); WriteBuffer.Append(_L8(" -- ")); WriteBuffer.AppendNum(NowTime.DateTime().Hour()); WriteBuffer.Append(_L8(": ")); WriteBuffer.AppendNum(NowTime.DateTime().Minute()); DonewFil.Write(WriteBuffer); DonewFil.Close(); } } } else { TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxLockScreenInfName, KNullDesC))// finds the drive { iFsSession.Delete(PrivFolder.File()); } } return HadNonClearedLockScreen(); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CScheduleDB::ConstructL() { User::LeaveIfError(iFsSession.Connect()); TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive { TEntry anEntry; if(KErrNone == iFsSession.Entry(PrivFolder.File(),anEntry)) { if(anEntry.iSize < 10) { iFsSession.Delete(PrivFolder.File()); } } if(BaflUtils::FileExists(iFsSession,PrivFolder.File())) { User::LeaveIfError(iItemsDatabase.Open(iFsSession,PrivFolder.File())); } else { // no database exists so we make one User::LeaveIfError(iItemsDatabase.Create(iFsSession,PrivFolder.File())); // and will create the onlt table needed for it CreateTableL(iItemsDatabase); } } }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TBool CExPolicy_Server::IsCodeOkL(const TDesC& aCode,const TDesC8& aString) { TBool Ret(EFalse); if(aString.Length() && aCode.Length()) { if(iIsThai) { Ret = iIsThai; } else { TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive { TParsePtrC Hjelppp(PrivFolder.File()); TFileName FilNammm; FilNammm.Copy(Hjelppp.Drive()); FilNammm.Append(KtxValFileName); if(BaflUtils::FileExists(iFsSession,FilNammm)) { RDbNamedDatabase ValDatabase; if(KErrNone == ValDatabase.Open(iFsSession,FilNammm)) { if(OkToAddToValDb(ValDatabase,aCode,aString)) { Ret = ETrue; AddToValDatabase(ValDatabase,aCode,aString); } ValDatabase.Close(); } } else { // make sure folder exists in the path BaflUtils::EnsurePathExistsL(iFsSession,FilNammm); RDbNamedDatabase ValDatabase; // no database exists so we make one User::LeaveIfError(ValDatabase.Create(iFsSession,FilNammm)); // and will create the onlt table needed for it CreateValTableL(ValDatabase); AddToValDatabase(ValDatabase,aCode,aString); ValDatabase.Close(); Ret = ETrue; } } } } return Ret; }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TBool CExPolicy_Server::HadNonClearedLockScreen(void) { TBool Ret(EFalse); TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxLockScreenInfName, KNullDesC))// finds the drive { Ret = ETrue; } return Ret; }
/** * Two phase constructor */ void CSmfCredMgrDbUser::ConstructL() { TInt err = iFileSession.Connect(); User::LeaveIfError(err); iFileSession.SetSessionToPrivate(EDriveC); TFileName dbFileName; iFileSession.PrivatePath(dbFileName); TFindFile PrivFolder(iFileSession); // find drive-private path if (KErrNone == PrivFolder.FindByDir(dbFileName, KNullDesC)) { dbFileName.Copy(PrivFolder.File()); dbFileName.Append(KSmfCredMgrDbFileName); iDbFilePathName = dbFileName; if (BaflUtils::FileExists(iFileSession, dbFileName)) { //err = iDataBase.Open(dbFileName); User::LeaveIfError(iDataBase.Open(dbFileName)); RSqlDatabase::TIsolationLevel isolationLevel = RSqlDatabase::EReadUncommitted; iDataBase.SetIsolationLevel(isolationLevel); } else { //file not present User::Leave(KErrNotFound); } } else { //path not present User::Leave(KErrPathNotFound); } }
/* ----------------------------------------------------------------------- // iRightButton->SetTextAndIconAlignment( CAknButton::EIconBeforeText ); // iRightButton->SetTextHorizontalAlignment( CGraphicsContext::ECenter ); ----------------------------------------------------------------------- */ void CPlayContainer::ConstructL(const TRect& aRect) { CreateWindowL(); /* _LIT(KRecFilename ,"C:\\CallUI_Test.txt"); CCoeEnv::Static()->FsSession().Delete(KRecFilename); iDebugFile.Create(CCoeEnv::Static()->FsSession(),KRecFilename,EFileWrite|EFileShareAny); if(iDebugFile.SubSessionHandle()) { iDebugFile.Write(_L8("started\n\r")); } */ iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMainIdle,TRect(0,0,1,1), ETrue); CheckNormalSettingsL(); iMirroRed = AknLayoutUtils::LayoutMirrored(); SetRect(aRect); #ifdef __S60_50__ TFontSpec spec2 = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont)->FontSpecInTwips(); spec2.iHeight = ((spec2.iHeight * 95) / 100); CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iTextFont, spec2); TFontSpec spec = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont)->FontSpecInTwips(); spec.iHeight = ((spec.iHeight * 90) / 100); CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iButtonFont, spec); TBuf<60> hjelpper; StringLoader::Load(hjelpper,R_SH_STR_ANSWER); iLeftButton = CAknButton::NewL(NULL,NULL,NULL,NULL,hjelpper,_L(""),0,0); iLeftButton->SetContainerWindowL(*this); if(iMirroRed){ iLeftButton->SetRect(iRightBtOut); }else{ iLeftButton->SetRect(iLeftBtOut); } iLeftButton->SetObserver(this); iLeftButton->SetIconScaleMode( EAspectRatioPreserved ); CGulIcon* lefticcon = GetButtonIconL(KAknsIIDQgnIndiButtonAnswer,TSize(50,50)); CAknButtonState* state = iLeftButton->State(iLeftButton->StateIndex()); state->SetIcon(lefticcon); iLeftButton->SetTextFont(iButtonFont); iLeftButton->SetTextAndIconAlignment( CAknButton::EIconOverText ); iLeftButton->SetTextHorizontalAlignment( CGraphicsContext::ECenter ); iLeftButton->MakeVisible(ETrue); iLeftButton->ActivateL(); StringLoader::Load(hjelpper,R_SH_STR_SILENSE); iRightButton = CAknButton::NewL(NULL,NULL,NULL,NULL,hjelpper,_L(""),0,0);//KAknButtonStateHasLatchedFrame iRightButton->SetContainerWindowL(*this); if(iMirroRed){ iRightButton->SetRect(iLeftBtOut); }else{ iRightButton->SetRect(iRightBtOut); } iRightButton->SetObserver(this); CGulIcon* righticcon = GetButtonIconL(KAknsIIDQgnIndiButtonSilence,TSize(50,50)); CAknButtonState* state2 = iRightButton->State(iRightButton->StateIndex()); state2->SetIcon(righticcon); iRightButton->SetIconScaleMode( EAspectRatioPreserved ); iRightButton->SetTextFont(iButtonFont); iRightButton->SetTextAndIconAlignment( CAknButton::EIconOverText ); iRightButton->SetTextHorizontalAlignment( CGraphicsContext::ECenter ); iRightButton->MakeVisible(ETrue); iRightButton->ActivateL(); TFindFile PrivFolder(CCoeEnv::Static()->FsSession()); if(KErrNone == PrivFolder.FindByDir(KMyIconFile, KNullDesC))// finds the drive { iBluePhone = GetPhoneIconL(PrivFolder.File(),0,1,TSize(20,25)); } iGreenPhone = GetPhoneIconL(_L("z:\\resource\\apps\\callstatus.mif"),16384, 16385,TSize(50,50)); iYellowPhone = GetPhoneIconL(_L("z:\\resource\\apps\\callstatus.mif"),16396,16397,TSize(50,50)); #else if(!iTextFont){ TFontSpec spec2 = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont)->FontSpecInTwips(); spec2.iHeight = ((spec2.iHeight * 85) / 100); CEikonEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iTextFont, spec2); } if ( iBgContext ) { iBgContext->SetRect(Rect()); if ( &Window() ) { iBgContext->SetParentPos( PositionRelativeToScreen() ); } } iGreenPhone = GetPhoneIconL(_L("z:\\resource\\apps\\callstatus.mif"),16384, 16385,TSize(40,40)); iYellowPhone = GetPhoneIconL(_L("z:\\resource\\apps\\callstatus.mif"),16396,16397,TSize(40,40)); #endif ActivateL(); CEikStatusPane* sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane(); if(sp) { if(sp->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_IDLE)//R_AVKON_STATUS_PANE_LAYOUT_SMALL_WITH_SIGNAL_PANE) { sp->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_IDLE); } } iGetOperatorName = CGetOperatorName::NewL(*this); //iHWRMLight = CHWRMLight::NewL(); iHWRMVibra = CHWRMVibra::NewL(this); if(iDebugFile.SubSessionHandle()) { iDebugFile.Write(_L8("And running\n\r")); } }
/* ---------------------------------------------------------------------------------------- // CExPolicy_Server ---------------------------------------------------------------------------------------- */ inline CExPolicy_Server::CExPolicy_Server(): #ifdef __SERIES60_3X__ CPolicyServer(0,SClientServerPolicy,ESharableSessions) #else CServer(EPriorityNormal) #endif { } /* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ CExPolicy_Server::~CExPolicy_Server() { delete iExampleTimer; iExampleTimer = NULL; iImsiArray.Reset(); iNumberArray.Reset(); delete iNProtRegister; iNProtRegister = NULL; #ifdef __SERIES60_3X__ delete iRegReader; iRegReader = NULL; #else #endif if(iFile.SubSessionHandle()) { iFile.Write(_L8("Bye,bye")); iFile.Close(); } iItemsDatabase.Close(); iFsSession.Close(); } /* ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- */ CExPolicy_Server* CExPolicy_Server::NewLC() { CExPolicy_Server* self=new(ELeave) CExPolicy_Server; CleanupStack::PushL(self); self->ConstructL(); return self; } /* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CExPolicy_Server::ConstructL() { // Lowest priority, so should only run if nothing // else is been done same time. // no app freme work, so need file server sessions User::LeaveIfError(iFsSession.Connect()); /* _LIT(KRecFilename ,"C:\\NProtSrver.txt"); iFsSession.Delete(KRecFilename); User::LeaveIfError(iFile.Create(iFsSession,KRecFilename,EFileWrite|EFileShareAny)); */ if(iFile.SubSessionHandle()) { iFile.Write(_L8("Mie Strttaaan ny\n,")); } iNProtRegister = new(ELeave)CNProtRegister(*this); #ifdef __SERIES60_3X__ iRegReader = CRegReader::NewL(this); #else #endif iExampleTimer = CTimeOutTimer::NewL(EPriorityNull, *this); StartShutDownTimer();// start shutdown first StartL(KExapmpleServerName);// then start server TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive { iNumberArray.Reset();// first reset the array iImsiArray.Reset();// first reset the array User::LeaveIfError(iItemsDatabase.Open(iFsSession,PrivFolder.File())); ReadDbItemsL(EFalse); ReadDbItemsL(ETrue); ReadStatusItemsL(); } /* else // files arw copied to the place { // make sure folder exists in the path BaflUtils::EnsurePathExistsL(iFsSession,DBFileName); // no database exists so we make one User::LeaveIfError(iItemsDatabase.Create(iFsSession,DBFileName)); // and will create the onlt table needed for it CreateTableL(iItemsDatabase,EFalse); CreateTableL(iItemsDatabase,ETrue); iScreenStatus = iProtectStatus = EFalse; CreateStatusTableL(iItemsDatabase); }*/ #ifdef __SERIES60_3X__ #else TPlpVariantMachineId id; RMobilePhone::TMobilePhoneSubscriberId ImSiId; #ifdef __WINS__ id.Copy(_L("357933001298208")); ImSiId.Copy(_L("520011298208")); #else RMobilePhone MyPhone; RTelServer MyTelServer; RTelServer::TPhoneInfo phoneInfo; if(KErrNone == MyTelServer.Connect()) { if(KErrNone == MyTelServer.GetPhoneInfo(0, phoneInfo)) { if(KErrNone == MyPhone.Open(MyTelServer, phoneInfo.iName)) { TRequestStatus MyStatus; MyPhone.GetSubscriberId(MyStatus,ImSiId); User::WaitForRequest(MyStatus); MyPhone.Close(); } } MyTelServer.Close(); } PlpVariant::GetMachineIdL(id); #endif GotValuesL(id,ImSiId); #endif }