// -----------------------------------------------------------------------------
// CbsUtils::FindAndOpenDefaultResourceFileLC
// Searches and opens the DLL default resource file.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CbsUtils::FindAndOpenDefaultResourceFileLC(
    RFs& aFs,
    RResourceFile& aResFile )
{
    // default resource file path

    _LIT(KDirAndFile,"z:CbsServer.rsc");

    TParse* fp = new(ELeave) TParse();
    fp->Set(KDirAndFile, &KDC_RESOURCE_FILES_DIR, NULL);

    static const TInt KDefResFileSignature = 4;

    // Find the resource file
    TFileName fileName( fp->FullName() );
    BaflUtils::NearestLanguageFile( aFs, fileName );

    // Open the resource file
    aResFile.OpenL( aFs, fileName );
    // Push close operation in tbe cleanup stack
    CleanupClosePushL( aResFile );

    aResFile.ConfirmSignatureL( KDefResFileSignature );

    delete fp;
}
Exemple #2
0
LOCAL_C void CheckDefaultTemplate(CContactDatabase* aDb, RFs& aFs, TContactItemId aSystemTemplateId)
	{
	test.Next(_L("System template"));
	
    _LIT(KCntSystemTemplate,"z:\\resource\\cntmodel\\customisedcntmodel.rsc");
	
	TFileName fileName(KCntSystemTemplate);
	BaflUtils::NearestLanguageFile(aFs,fileName);
//
	RResourceFile resourceFile;
	resourceFile.OpenL(CntTest->Fs(),fileName);
	CleanupClosePushL(resourceFile);
	resourceFile.ConfirmSignatureL(4);
	TResourceReader resReader;
	resReader.SetBuffer(resourceFile.AllocReadLC(R_CNTUI_NEW_FIELD_DEFNS));
//
	CContactTemplate *testTemplate=CContactTemplate::NewLC();
	TInt count=resReader.ReadInt16(); // num fields
	while(count--)
		{
		TStorageType storageType=resReader.ReadInt32();
		TUid contactFieldUid=TUid::Uid(resReader.ReadInt32());
		TUid vCardMappingUid=TUid::Uid(resReader.ReadInt32());
//
		CContactItemField* field=CContactItemField::NewLC(storageType);
//
		field->SetMapping(vCardMappingUid);
		if (contactFieldUid!=KUidContactFieldNone)
			field->AddFieldTypeL(contactFieldUid);
//
		TInt mappingCount;
		if((mappingCount=resReader.ReadInt16())!=0)
			{
			while(mappingCount--)
				field->AddFieldTypeL(TUid::Uid(resReader.ReadInt32()));
			}
		field->SetUserFlags(resReader.ReadInt32());
		field->SetLabel(resReader.ReadHBufCL());
		TUint flags=resReader.ReadInt32();
		if (flags&EContactFieldFlagHidden)
			field->SetHidden(ETrue);
		if (flags&EContactFieldFlagReadOnly)
			field->SetReadOnly(ETrue);
		if (flags&EContactFieldFlagSynchronize)
			field->SetSynchronize(ETrue);
		if (flags&EContactFieldFlagDisabled)
			field->SetDisabled(ETrue);
//
		testTemplate->AddFieldL(*field);
		CleanupStack::Pop();
		}
	doTestTemplate(aDb,aSystemTemplateId,testTemplate,ETrue);
	CleanupStack::PopAndDestroy(3);	// testTemplate,resourceFile close, resBuffer
	}
// ---------------------------------------------------------------------------
// 
// ---------------------------------------------------------------------------
//
void CCapabilityManager::GetPhoneConfigL()
    {
    FLOG(_L("[IMAGEPRINTUI]>>> :CCapabilityManager, GetPhoneConfigL BEGIN"));
    
        
    TBuf<KResource> resourceFile(PathInfo::RomRootPath());
    TBuf<KResource> length(KPhoneCapability);    
    resourceFile.SetLength(KDriver + length.Length());
    resourceFile.Replace(KDriver, length.Length(), KPhoneCapability);
    
    RResourceFile resource;
    resource.OpenL(CCoeEnv::Static()->FsSession(),  resourceFile);
    FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, Resource open"));
    
    CleanupClosePushL(resource);
    resource.ConfirmSignatureL(KPhoneCapabilityVersion);
    
    HBufC8* id = resource.AllocReadLC(PHONECAPABILITY_CONFIG);
    
    TResourceReader reader;
    reader.SetBuffer(id);   
    
    TInt qualityCount = reader.ReadUint8();
    TInt papersizeCount = reader.ReadUint8();
    TInt layoutCount  = reader.ReadUint8();
      
       
    for (TInt i = 0; i < qualityCount; i++)
    	{
    	iPhoneSuppQuality.AppendL(reader.ReadUint16());
    	}
    FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, quality readed"));
    	
    for (TInt i = 0; i < papersizeCount; i++)
    	{
       	iPhoneSuppPaperSize.AppendL(reader.ReadUint16());
    	}		
    
    FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, papersize readed"));
    for (TInt i = 0; i < layoutCount; i++)
    	{
    	iPhoneSuppLayout.AppendL(reader.ReadUint16());
    	}
    FLOG(_L("[IMAGEPRINTUI]>>> CImagePrintUi:CCapabilityManager, layout readed"));
    	
    CleanupStack::PopAndDestroy(id);
    CleanupStack::PopAndDestroy(&resource);
    FLOG(_L("[IMAGEPRINTUI]<<< CImagePrintUi:CCapabilityManager GetPhoneConfigL END "));
    }
// -----------------------------------------------------------------------------
// PIMLocalizationUtils::OpenResourceFileLC
// -----------------------------------------------------------------------------
//
void PIMLocalizationUtils::OpenResourceFileLC(
    RFs& aRfs,
    RResourceFile& aResourceFile,
    const TDesC& aFileName)
{
    // Get nearest language file
    TFileName langFile =
        java::util::S60CommonUtils::ResourceLanguageFileNameL(aFileName);

    // Open the requested resource file
    aResourceFile.OpenL(aRfs, langFile),
    CleanupClosePushL(aResourceFile);

    // Confirm signature
    aResourceFile.ConfirmSignatureL();
}
// -----------------------------------------------------------------------------
// CAknKeyRotatorImpl::LoadHwStateRotationsL
// Reads the HW states from the AknPriv.rsc to an array.
// -----------------------------------------------------------------------------
//
void CAknKeyRotatorImpl::LoadHwStateRotationsL()
    {
    // Find the language specific resource file and then load it.
    RResourceFile resourceFile;
    RFs fsSession;
    User::LeaveIfError( fsSession.Connect() );
    CleanupClosePushL( fsSession );
    
    TFileName resourceFileName (KAknPrivRscFilePath);
    BaflUtils::NearestLanguageFile( fsSession, resourceFileName );
    resourceFile.OpenL(fsSession, resourceFileName);

    CleanupClosePushL( resourceFile );
    resourceFile.ConfirmSignatureL(0);
    
    // Read resources to a buffer. The resource definition for the target and
    // emulator are a bit different.
    HBufC8* res;
#ifdef __WINS__
    res = resourceFile.AllocReadLC( R_AKNPRIV_HARDWARE_STATE_SCREEN_MAP_EMUL );
#else
    res = resourceFile.AllocReadLC( R_AKNPRIV_HARDWARE_STATE_SCREEN_MAP );
#endif
    
    TResourceReader reader;
    reader.SetBuffer(res);
    
    // Read the entires. We are only interrested about the hwRotation.
    TInt count = reader.ReadInt16();
    for (TInt ii=0; ii<count; ii++)
        {
        /*TInt state =*/ reader.ReadInt16(); // Assumption (state == ii)
        /*TInt width =*/ reader.ReadInt16();
        /*TInt height =*/ reader.ReadInt16();
        CFbsBitGc::TGraphicsOrientation hwRotation = 
            static_cast<CFbsBitGc::TGraphicsOrientation>(reader.ReadInt16());
        /*CFbsBitGc::TGraphicsOrientation altRotation =*/ 
            static_cast<CFbsBitGc::TGraphicsOrientation>(reader.ReadInt16());
        
        User::LeaveIfError( iHwRotations.Append( hwRotation ) );
        }
    
    CleanupStack::PopAndDestroy(res);
    CleanupStack::PopAndDestroy(&resourceFile); // resourceFile.Close();  
    CleanupStack::PopAndDestroy(&fsSession); // fsSession.Close();
    }
Exemple #6
0
void HlpLauncher::DoLaunchHelpApplicationL(RWsSession& aWsSession, const TDesC8& aCmdLine)
	{
	TApaTaskList taskList(aWsSession);
	TApaTask task = taskList.FindApp(KHlpAppUid);
	if (task.Exists())
		{
		task.SendMessage (KHlpAppWsMsg, aCmdLine); 
		task.BringToForeground();
		}
	else
		{
		CApaCommandLine* cmdLine=CApaCommandLine::NewLC();

		// INC057477 fix
		// Get and open the resource file
		RFs f;
		CleanupClosePushL(f);

		User::LeaveIfError(f.Connect());
		RResourceFile r;

		r.OpenL(f, KHelpLauncherResource);
		CleanupClosePushL(r);
		
		// Read the path of the help application from the resource file
		r.ConfirmSignatureL();
		TResourceReader resReader;
		resReader.SetBuffer(r.AllocReadLC(R_HELP_PATH));
		TPtrC16 helpPath = resReader.ReadTPtrC16();
		cmdLine->SetExecutableNameL(helpPath);
		CleanupStack::PopAndDestroy(); // AllocReadLC
		CleanupStack::PopAndDestroy(); // close r
		CleanupStack::PopAndDestroy(); // close f
		
		cmdLine->SetCommandL(EApaCommandOpen);
		cmdLine->SetTailEndL(aCmdLine);
		//EikDll::StartAppL(*cmdLine);
		RApaLsSession lsSession;
  		User::LeaveIfError(lsSession.Connect());
  		CleanupClosePushL(lsSession);
  		User::LeaveIfError(lsSession.StartApp(*cmdLine));
  		CleanupStack::PopAndDestroy(&lsSession);
		CleanupStack::PopAndDestroy(); //cmdLine
		}
	}
// ----------------------------------------------------------------------------
// CATCmdPluginEcom::::LoadResourcesL
// Load resources
// (may leave)
// Status : Approved
// ----------------------------------------------------------------------------
//
void CATCmdPluginEcom::LoadResourcesL()
    {
    TRACE_FUNC_ENTRY

    RFs fs;
    CleanupClosePushL( fs );

    TFileName fileName;
    fileName.Copy( KFileName );
    User::LeaveIfError( fs.Connect() );
    BaflUtils::NearestLanguageFile( fs, fileName );

    RResourceFile resourceFile;
    CleanupClosePushL( resourceFile );
    resourceFile.OpenL( fs, fileName );
    resourceFile.ConfirmSignatureL();

    HBufC8* buf8 = resourceFile.AllocReadLC( R_ATCMDPLUGIN_TRANSLATIONTABLE );
    
    TResourceReader reader;
    reader.SetBuffer( buf8 );
    
    TInt count = reader.ReadInt16(); // array count
    iTranslations = new ( ELeave ) CArrayPtrFlat<CATCmdTranslation>( count );

    while ( count-- )
        {
        const TInt code = reader.ReadInt32(); 

        HBufC8* param = reader.ReadHBufC8L(); 
        CleanupStack::PushL( param );
        CATCmdTranslation* t = new (ELeave) CATCmdTranslation( *param, code );
        CleanupStack::Pop( param ); // transfer ownership

        CleanupStack::PushL( t );
        iTranslations->AppendL( t );
        CleanupStack::Pop( t ); // transfer ownership
        }

    CleanupStack::PopAndDestroy( 3 ); // resourceFile, fs, buf8

    TRACE_FUNC_EXIT
    }