示例#1
0
/*
-------------------------------------------------------------------------
This will be called when this file shandler is preraped to be used for, 
opening or constructing a file. The open/new etc. functions are called
strait after calling this function.
-------------------------------------------------------------------------
*/
void CCrashContainer::ConstructL(CEikButtonGroupContainer* aCba)
{
	iCba = aCba;
	
 	CreateWindowL();
 	
 	iServerIsOn = IsServerOn();
 	iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,TRect(0,0,1,1), ETrue);
	
 	iResId = -1;
 	TFindFile AppFile(CCoeEnv::Static()->FsSession());
	if(KErrNone == AppFile.FindByDir(KCrashResourceFileName, KNullDesC))
	{
 		TFileName resourceName(AppFile.File());
		BaflUtils::NearestLanguageFile(CEikonEnv::Static()->FsSession(), resourceName);
		iResId = CEikonEnv::Static()->AddResourceFileL(resourceName);
	}
	
	SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect()); 	
	
	
	ActivateL();
	SetMenuL();
	DrawNow();
	
	ChangeIconAndNameL();
}
示例#2
0
bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
{
  u32 apploader_size;
  u32 trailer_size;
  const u32 header_size = 0x20;
  if (!m_rVolume->ReadSwapped(0x2440 + 0x14, &apploader_size, m_Wii) ||
      !m_rVolume->ReadSwapped(0x2440 + 0x18, &trailer_size, m_Wii))
    return false;
  apploader_size += trailer_size + header_size;
  DEBUG_LOG(DISCIO, "Apploader size -> %x", apploader_size);

  std::vector<u8> buffer(apploader_size);
  if (m_rVolume->Read(0x2440, apploader_size, buffer.data(), m_Wii))
  {
    std::string exportName(_rExportFolder + "/apploader.img");

    File::IOFile AppFile(exportName, "wb");
    if (AppFile)
    {
      AppFile.WriteBytes(buffer.data(), apploader_size);
      return true;
    }
  }

  return false;
}
示例#3
0
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CCrashContainer::ChangeIconAndNameL(void)
{	
 	CEikStatusPane*		sp = ((CAknAppUi*)iEikonEnv->EikAppUi())->StatusPane();
	if(sp)
	{
		CAknTitlePane* TitlePane = STATIC_CAST(CAknTitlePane*,sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
		TitlePane->SetTextL(KCrashApplicationName);
			
    	CAknContextPane* 	ContextPane = (CAknContextPane *)sp->ControlL(TUid::Uid(EEikStatusPaneUidContext));
		if(ContextPane)
		{
			TFindFile AppFile(CCoeEnv::Static()->FsSession());
			if(KErrNone == AppFile.FindByDir(KCrashIconsFileName, KNullDesC))
			{
				TInt BgIndex(0),BgMask(1);
				
				if(iServerIsOn)
				{
					BgIndex = 2;
					BgMask = 3;
				}
				
				if(AknIconUtils::IsMifFile(AppFile.File()))
				{
					AknIconUtils::ValidateLogicalAppIconId(AppFile.File(), BgIndex,BgMask); 
				}
			
				ContextPane->SetPictureFromFileL(AppFile.File(),BgIndex,BgMask);  
			}
		}				
	}	
}
void CSupSplashScreen::ConstructL(void)
{

	CreateWindowL();

	TFindFile AppFile(CCoeEnv::Static()->FsSession());

	if(KErrNone == AppFile.FindByDir(KSupMbm, KNullDesC))
	{			
		iBackgroundPic = new (ELeave) CFbsBitmap();
		TRect clientRect = CEikonEnv::Static()->EikAppUi()->ApplicationRect();

		// Load commerce logo image depends on the current screen width
		switch(clientRect.Width())
		{
		case SCREEN_WIDTH_1:
		case SCREEN_WIDTH_1_2:
			{
				User::LeaveIfError(iBackgroundPic->Load(AppFile.File(), EMbmSupN2f_commercelogo_1));
			}
			break;
		case SCREEN_WIDTH_2:
		case SCREEN_WIDTH_2_2:
			{
				User::LeaveIfError(iBackgroundPic->Load(AppFile.File(), EMbmSupN2f_commercelogo_2));
			}
			break;
		case SCREEN_WIDTH_3:
		case SCREEN_WIDTH_3_2:
			{
				User::LeaveIfError(iBackgroundPic->Load(AppFile.File(), EMbmSupN2f_commercelogo_3));
			}
			break;
		default:
			{
				User::LeaveIfError(iBackgroundPic->Load(AppFile.File(), EMbmSupN2f_commercelogo_1));
			}
			break;
		}

		// Place image right in the screen center
		TSize iconSize = iBackgroundPic->SizeInPixels();

		// Set client rect
		TInt cX = clientRect.Width()/2 - iconSize.iWidth/2;
		TInt cY = clientRect.Height()/2 - iconSize.iHeight/2;

		// Set client rect == bitmaps rect
		SetRect(TRect(TPoint(cX, cY), iconSize));
	}
	else
	{

		SetRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
	}

	ActivateL();
	DrawNow();
}
示例#5
0
文件: mark.c 项目: mingpen/OpenNT
/*** WriteMarks - Write Marks back out to the markfile.
*
* Purpose:
*
*   To update the markfile if any marks have changed
*
* Input:
*   pFile - owner of the marks
*
* Output: None.
*
*************************************************************************/
void
WriteMarks (
    PFILE pFile
    ) {

    REGISTER MARK UNALIGNED * pm;
    char            szMark[BUFLEN];
    char            szFile[BUFLEN];
    linebuf         lbuf;
    LINE            yMark, l;
    COL             xMark;

    if (pFileMark == NULL || TESTFLAG(FLAGS(pFile), FAKE)) {
        return;
    }

    if (!fCacheMarks (pFile)) {
        return;
    }

    // First, we read the whole file looking for marks for
    // this file.  When we find one, we look it up in the
    // cache to find the new value and write it back
    // out.  Unchanged marks are not re-written.
    //
    for (l = 0L; l < pFileMark->cLines; l++) {
        GetLine (l, lbuf, pFileMark);
        if (sscanf (lbuf, " %[^ ] %[^ ] %ld %d ", szMark, szFile, &yMark, &xMark) >= 3) {
            if (!_stricmp (szFile, pFile->pName)) {
                if (pm = FindLocalMark (szMark, TRUE)) {
                    sprintf (lbuf, "%s %s %ld %d", szMark, szFile, pm->fl.lin+1, pm->fl.col+1);
                    PutLine (l, lbuf, pFileMark);
                    RSETFLAG (pm->flags, MF_DIRTY);
                }
            }
        }
    }

    // Now we read through the cache to find any new marks.  These
    // will be appended to the markfile.
    //
    for (   pm = pfmCache->marks;
            !TESTFLAG(pm->flags, MF_DUMMY);
            (char *)pm += pm->cb) {

        if (TESTFLAG (pm->flags, MF_DIRTY)) {
            sprintf (lbuf, "%s %s %ld %d", pm->szName,
                                          pFile->pName,
                                          pm->fl.lin + 1,
                                          pm->fl.col + 1);
            AppFile (lbuf, pFileMark);
        }
    }
}
示例#6
0
/*
-------------------------------------------------------------------------
This will be called when this file shandler is paped to be used for, 
opening or constructing a file. The open/new etc. functions are called
strait after calling this function.
-------------------------------------------------------------------------
*/
void CTraceContainer::ConstructL(CEikButtonGroupContainer* aCba)
{
	iCba = aCba;
	
	TMemoryInfoV1Buf   memInfoBuf;
	UserHal::MemoryInfo(memInfoBuf);
	iTotalRamInBytes = (memInfoBuf().iTotalRamInBytes / 1000);
	
 	CreateWindowL();
 	
 	iServerIsOn = IsServerOn();
 	iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue);
	
 	iResId = -1;
 	TFindFile AppFile(CCoeEnv::Static()->FsSession());
	if(KErrNone == AppFile.FindByDir(KTraceResourceFileName, KNullDesC))
	{
 		TFileName resourceName(AppFile.File());
		BaflUtils::NearestLanguageFile(CEikonEnv::Static()->FsSession(), resourceName);
		iResId = CEikonEnv::Static()->AddResourceFileL(resourceName);
	}
	
	SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect()); 	
	
	TFindFile ImgFile(CCoeEnv::Static()->FsSession());
	if(KErrNone == ImgFile.FindByDir(KTraceIconsFileName, KNullDesC))
	{
		TRect ThisRect(Rect());
		ThisRect.Shrink(4,4);
		TInt HeightMe = (ThisRect.Height() / 2);
		TSize MskImgSiz(ThisRect.Width(),HeightMe);
		
		iMaskImg= LoadImageL(ImgFile.File(), 4, 5,MskImgSiz,EAspectRatioNotPreserved);
	}
		
	ActivateL();
	SetMenuL();
	DrawNow();
	
	iTimeOutTimer = CTimeOutTimer::NewL(EPriorityNormal,*this);
	
	ChangeIconAndNameL();
	
	if(iServerIsOn)
	{
		ForegroundChangedL(ETrue);
	}
}
/*
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
*/
void CProfileSettings::SaveValuesL(void)
{
	if(!iListBox)
		return;

	iListBox->StoreSettingsL();

	TFileName DefaultFile;
	TFindFile AppFile(CCoeEnv::Static()->FsSession());
	if(KErrNone == AppFile.FindByDir(KTraceSetFileName, KNullDesC))
	{
		DefaultFile.Copy(AppFile.File());
	}
	else
	{
		TFindFile AppFile2(CCoeEnv::Static()->FsSession());
		if(KErrNone == AppFile2.FindByDir(KTraceIconsFileName, KNullDesC))
		{
			TParsePtrC Hejlp(AppFile2.File());
			DefaultFile.Copy(Hejlp.Drive());
			DefaultFile.Append(KTraceSetFileName);
		}
	}
		
	if(DefaultFile.Length())
	{
		User::LeaveIfError(CCoeEnv::Static()->FsSession().Delete(DefaultFile));

		CDictionaryFileStore* MyDStore = CDictionaryFileStore::OpenLC(CCoeEnv::Static()->FsSession(),DefaultFile, TUid::Uid(0x102013AD));
				
		if(iListBox->iEnabledOn)
			SaveValuesL(MyDStore,0x7777,0x100);	
		else
			SaveValuesL(MyDStore,0x7777,0x000);

		SaveValuesL(MyDStore,0x5555,iListBox->iDrawStyle);		
					
		SaveValuesL(MyDStore,0x8877,iListBox->iHorSlider);

		SaveValuesL(MyDStore,0x7788,iListBox->iVerSlider);
		
		SaveValuesL(MyDStore,0x6666,iListBox->iFontSize);		
		
		MyDStore->CommitL();
		CleanupStack::PopAndDestroy(1);// Store
	}
}
示例#8
0
/*
-------------------------------------------------------------------------
This will be called when this file shandler is preraped to be used for, 
opening or constructing a file. The open/new etc. functions are called
strait after calling this function.
-------------------------------------------------------------------------
*/
void CYBrowserFileHandler1::ConstructL()
{
 	CreateWindowL();
 	
 	TFindFile AppFile(CCoeEnv::Static()->FsSession());
	if(KErrNone == AppFile.FindByDir(KMyResourceFileName, KNullDesC))
	{
 		TFileName resourceName(AppFile.File());
		BaflUtils::NearestLanguageFile(CEikonEnv::Static()->FsSession(), resourceName);
		iResId = CEikonEnv::Static()->AddResourceFileL(resourceName);
	}
	
	SetRect(CEikonEnv::Static()->EikAppUi()->ClientRect()); 	
	
 	ActivateL();
	SetMenuL();
}
示例#9
0
/*
-------------------------------------------------------------------------------
icons used for the file type in Y-Browser 
-------------------------------------------------------------------------------
*/
CGulIcon* CYBRecognizer1::GetIconL(TInt aIndex, TSize aSize)
{
	CGulIcon* RetIcon(NULL);
	
	TFindFile AppFile(CCoeEnv::Static()->FsSession());
	if(KErrNone == AppFile.FindByDir(KtxIconsFileName, KNullDesC))
	{
		switch(aIndex)
		{
		case 0:
			RetIcon = GetListIconL(AppFile.File(),EMbmIconsZip,EMbmIconsZip_m,aSize);
			break;
		};
	}
	
	return RetIcon;
}
示例#10
0
bool CFileSystemGCWii::ExportApploader(const std::string& _rExportFolder) const
{
	u32 AppSize = m_rVolume->Read32(0x2440 + 0x14, m_Wii); // apploader size
	AppSize    += m_rVolume->Read32(0x2440 + 0x18, m_Wii); // + trailer size
	AppSize    += 0x20;                                    // + header size
	DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize);

	std::vector<u8> buffer(AppSize);
	if (m_rVolume->Read(0x2440, AppSize, &buffer[0], m_Wii))
	{
		std::string exportName(_rExportFolder + "/apploader.img");

		File::IOFile AppFile(exportName, "wb");
		if (AppFile)
		{
			AppFile.WriteBytes(&buffer[0], AppSize);
			return true;
		}
	}

	return false;
}
示例#11
0
/*
-----------------------------------------------------------------------
-----------------------------------------------------------------------
*/
TBool CMgAppUi::ShowDisclaimerL(void)
{
	TBool OkToContinue(EFalse);

	if(KAppIsTrial){
        TFindFile AppFile(CCoeEnv::Static()->FsSession());
        if(KErrNone != AppFile.FindByDir(KtxDisclaimerFileName, KNullDesC))
        {
            HBufC* Abbout = KtxDisclaimer().AllocLC();
            TPtr Pointter(Abbout->Des());
            CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter);
            dlg->PrepareLC(R_DDD_HEADING_PANE);
            dlg->SetHeaderTextL(KtxDisclaimerTitle);  
            if(dlg->RunLD())
            {
                TFileName ShortFil;
                if(KErrNone ==CCoeEnv::Static()->FsSession().PrivatePath(ShortFil))
                {
                    TFindFile privFile(CCoeEnv::Static()->FsSession());
                    if(KErrNone == privFile.FindByDir(ShortFil, KNullDesC))
                    {
                        TParsePtrC hjelp(privFile.File());
                        ShortFil.Copy(hjelp.Drive());
                        ShortFil.Append(KtxDisclaimerFileName);
                    }
                }
    
            
                BaflUtils::EnsurePathExistsL(CCoeEnv::Static()->FsSession(),ShortFil);
            
                RFile MyFile;
                if(KErrNone == MyFile.Create(CCoeEnv::Static()->FsSession(),ShortFil,EFileWrite))
                {
                    TTime NowTime;
                    NowTime.HomeTime();
                    
                    TBuf8<255> InfoLine;
                    InfoLine.Copy(_L8("Accepted on Date\t"));
                        
                    InfoLine.AppendNum(NowTime.DateTime().Day() + 1);
                    InfoLine.Append(_L8("."));
                    InfoLine.AppendNum((NowTime.DateTime().Month() + 1));
                    InfoLine.Append(_L8("."));
                    InfoLine.AppendNum(NowTime.DateTime().Year());
                    InfoLine.Append(_L8(" "));
                    InfoLine.Append(_L8("--"));
                    InfoLine.AppendNum(NowTime.DateTime().Hour());
                    InfoLine.Append(_L8(":"));		
                    TInt HelperInt = NowTime.DateTime().Minute();
                    if(HelperInt < 10)
                        InfoLine.AppendNum(0);
                    InfoLine.AppendNum(HelperInt);
                    InfoLine.Append(_L8(":"));
                    HelperInt = NowTime.DateTime().Second();
                    if(HelperInt < 10)
                        InfoLine.AppendNum(0);
                    InfoLine.AppendNum(HelperInt);
                    InfoLine.Append(_L8(" "));
                    
                    MyFile.Write(InfoLine);
                    MyFile.Close();
                }
                
                OkToContinue = ETrue;
            }
            
            CleanupStack::PopAndDestroy(Abbout);
        }
        else
        {
            OkToContinue = ETrue;
        }
	}
    else
    {
        OkToContinue = ETrue;
    }
	
	return OkToContinue;
}
示例#12
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CProfileSettings::GetValuesFromStoreL(void)
{	
	if(!iListBox)
		return;
	
	TFileName DefaultFile;
	TFindFile AppFile(CCoeEnv::Static()->FsSession());
	if(KErrNone == AppFile.FindByDir(KTraceSetFileName, KNullDesC))
	{
		DefaultFile.Copy(AppFile.File());
	}
	else
	{
		TFindFile AppFile2(CCoeEnv::Static()->FsSession());
		if(KErrNone == AppFile2.FindByDir(KTraceIconsFileName, KNullDesC))
		{
			TParsePtrC Hejlp(AppFile2.File());
			DefaultFile.Copy(Hejlp.Drive());
			DefaultFile.Append(KTraceSetFileName);
		}
	}
		
	if(DefaultFile.Length())
	{
		CDictionaryFileStore* MyDStore = CDictionaryFileStore::OpenLC(CCoeEnv::Static()->FsSession(),DefaultFile, TUid::Uid(0x102013AD));

		TInt32 TmpValue(-1);

		GetValuesL(MyDStore,0x7777,TmpValue);
		
		if(TmpValue > 50)
			iListBox->iEnabledOn = ETrue;
		else 
			iListBox->iEnabledOn  = EFalse;
		
		TmpValue = -1;		
		GetValuesL(MyDStore,0x5555,TmpValue);
		
		if(TmpValue < 0 || TmpValue > 2)
		{
			TmpValue = 0;
		}
	
		iListBox->iDrawStyle = TmpValue;
		
		
		TmpValue = -1;
		GetValuesL(MyDStore,0x8877,TmpValue);
		
		iListBox->iHorSlider = TmpValue;
		
		if(iListBox->iHorSlider < 0)
			iListBox->iHorSlider = 0;
		else if(iListBox->iHorSlider > 100)
			iListBox->iHorSlider = 100;

		TmpValue = -1;
		GetValuesL(MyDStore,0x7788,TmpValue);
		
		iListBox->iVerSlider = TmpValue;
		
		if(iListBox->iVerSlider < 0)
			iListBox->iVerSlider = 0;
		else if(iListBox->iVerSlider > 100)
			iListBox->iVerSlider = 100;
		
		TmpValue = -1;
		GetValuesL(MyDStore,0x6666,TmpValue);
		
		iListBox->iFontSize = TmpValue;
		
		if(iListBox->iFontSize < 10)
			iListBox->iFontSize = 10;
		else if(iListBox->iFontSize > 150)
			iListBox->iFontSize = 150;	
	
		CleanupStack::PopAndDestroy(1);// Store
	}
}