Exemplo n.º 1
0
void CPodcastModel::ResetDB()
	{
	DP("CPodcastModel::ResetDB BEGIN");
	
	DropDB();
	
	TFileName dbFileName;
	dbFileName.Copy(iSettingsEngine->PrivatePath());
	dbFileName.Append(KDBFileName);

	// remove the old DB file
	if (BaflUtils::FileExists(iFsSession, dbFileName))
		{
		BaflUtils::DeleteFile(iFsSession, dbFileName);
		}

	// copy template to new DB
	TFileName dbTemplate;
	TFileName temp;
	dbTemplate.Copy(_L("z:"));
	temp.Copy(iSettingsEngine->PrivatePath());
	dbTemplate.Append(temp);
	dbTemplate.Append(KDBTemplateFileName);
	
	DP1("Copy template DB from: %S", &dbTemplate);
	DP1("Copy template DB to: %S", &dbFileName);
	
	BaflUtils::CopyFile(iFsSession, dbTemplate,dbFileName);
	iIsFirstStartup = ETrue;
	DP("CPodcastModel::ResetDB END");
	}
Exemplo n.º 2
0
// ==========================================================================
// METHOD:  Initialize
//
// DESIGN:  
// ==========================================================================
TBool CDebugLogTlsData::Initialize()
    {
    TInt returnValue = ( iFs.Connect() == KErrNone );
    
    if( returnValue )
        {
        // Request notification of directory adds/deletes in the logs directory.
        iFs.NotifyChange( ENotifyDir, iStatus, KDebugLogsBaseDirectory );        
        SetActive();
        
    	// Dynamically create the name of the log files based on the application name
    	// and thread ID.  This will eliminate multiple processes/thread usage of
    	// this debug logging infrastructure from scribbling each others traces.
	    RProcess thisProcess;
   	    RThread  thisThread;

	    // The file name is the process name followed by the thread ID.
    	TParsePtrC fileNameParser( thisProcess.FileName() );
    	iFileName.Copy( fileNameParser.Name() );
    	iFileName.Append( KUnderscore );
    	iFileName.Append( thisThread.Name() );    	    	
    	iFileName.Append( KDebugLogFileExt );    	       
        
        } // end if
        
    return returnValue;        

    } // END Initialize
TInt CSimulateMessageServerSession::ClearRemoved()
	{
	RFs rfs;
	User::LeaveIfError(rfs.Connect());

	TFileName filename;
	//	GetAppPath(filename);
//	rfs.PrivatePath(filename);
	filename.Append(iServer.iPath);
	filename.Append(KRemovedDataFile);

	RFile file;
	TInt err = file.Replace(rfs, filename, EFileWrite);
	if (KErrNone != err)
		{
		return err;
		}

	CleanupClosePushL(file);
	
	file.Write(KNullDesC8);

	CleanupStack::PopAndDestroy(); // file
	rfs.Close();

	return KErrNone;
	}
TInt CSimulateMessageServerSession::WriteDataToFile(
		const RSimMsgDataArray& aArray)
	{
	RFs rfs;
	User::LeaveIfError(rfs.Connect());

	TFileName filename;
	//	GetAppPath(filename);
	filename.Append(iServer.iPath);
//	rfs.PrivatePath(filename);
	filename.Append(KDataFile);

	
	RFile file;
	TInt err = file.Replace(rfs, filename, EFileWrite);
	if (KErrNone != err)
		{
		return err;
		}

	CleanupClosePushL(file);

	for (TInt i = 0; i < aArray.Count(); i++)
		{
		SimMsgData* task = aArray[i];
		WriteData(file, *task);
		}

	CleanupStack::PopAndDestroy(); // file
	rfs.Close();

	return KErrNone;
	}
void CSimulateMessageServerSession::QueryRemovedData(const RMessage2& aMessage)
	{
	RFs rfs;
	User::LeaveIfError(rfs.Connect());

	TFileName filename;
//	rfs.PrivatePath(filename);
	filename.Append(iServer.iPath);
	filename.Append(KRemovedDataFile);

	RFile file;
	TInt err = file.Open(rfs, filename, EFileRead);

	if (KErrNone == err)
		{
		CleanupClosePushL(file);

		//꾸鱗
		TInt size;
		file.Size(size);

		HBufC8* buffer = HBufC8::NewL(size);
		TPtr8 ptr = buffer->Des();
		file.Read(ptr);

		CleanupStack::PopAndDestroy();
		
		aMessage.Write(0,ptr);
		
		delete buffer;
		}
	rfs.Close();

	}
void CSimulateMessageServerSession::QueryRemovedLength(const RMessage2& aMessage)
	{
	RFs rfs;
	User::LeaveIfError(rfs.Connect());

	TFileName filename;
//	rfs.PrivatePath(filename);
	filename.Append(iServer.iPath);
	filename.Append(KRemovedDataFile);

	RFile file;
	TInt size = 0;
	TInt err = file.Open(rfs, filename, EFileRead);

	if (KErrNone == err)
		{
		CleanupClosePushL(file);

		//꾸鱗
		
		file.Size(size);

		CleanupStack::PopAndDestroy();
		}
	rfs.Close();
	
	TBuf8<16> total;
	total.AppendNum(size);
	aMessage.WriteL(0, total);
	}
/**
Executes the supported operations specified in the given database 
configuration file and updates the settings table to store the 
version of this configuration file.

@param aFileData The database file data
@param aMatchingConfigFile The configuration file that is to be processed
@param aDbConfigFileVersion The configuration file version
@param aDbName Logical database name: "main" for the main database or attached database name

@leave KErrNoMemory, if an out of memory condition occurs.
       One of the other system-wide error codes if the configuration
       file fails to be opened or read.
       One of the SQL errors of ESqlDbError type if the update to the
       database settings table fails

@panic SqlDb 2 In _DEBUG mode if iDbHandle is NULL (uninitialized TSqlDbSysSettings object).
*/
void TSqlDbSysSettings::ExecuteConfigurationUpdateL(const TSqlSrvFileData& aFileData, 
													const TDesC& aMatchingConfigFile,
													TInt aDbConfigFileVersion,
													const TDesC& aDbName)
	{
	__ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj));
														
	//Execute the specified database config file operations that are supported
#ifdef SYSLIBS_TEST
	TDriveUnit drive = EDriveC;
#else
	TDriveUnit drive = EDriveZ;
#endif			
	TFileName configFilePath;
	TDriveName drvName = drive.Name();
	configFilePath.Append(drvName);
	configFilePath.Append(aFileData.PrivatePath());
	configFilePath.Append(aMatchingConfigFile);
	//If this method leaves then either the config file could not be 
	//opened or read or an out of memory condition occured. Either way
	//another attempt will be made to process the config file when the
	//database is next opened
	DoExecuteDbConfigFileOpsL(aFileData.Fs(), configFilePath, aDbName);
												
	//Now update the settings table to store the current version of the database config file.
	//If this fails then another attempt will be made to process the config file and update
	//the settings table when the database is next opened
	TBuf<sizeof(KUpdateFileVersionSettingsSql) + KMaxFileName + 10> buf;
	buf.Format(KUpdateFileVersionSettingsSql(), &aDbName, aDbConfigFileVersion);
	__SQLLEAVE_IF_ERROR(::DbExecStmt16(iDbHandle, buf));
	}
void CSenServiceDispatcher::ConstructL(TInt aConnectionID)
    {
    iConnectionID = aConnectionID;
    
    ipTransactionsMap = new (ELeave) RTransactionsMap(ETrue, ETrue);

    User::LeaveIfError(iCsMessageQueue.CreateLocal());
    User::LeaveIfError(iCsSynchronizer.CreateLocal());
    User::LeaveIfError(iCsTransctnsMap.CreateLocal());
       
    
    RProcess process;
    TFileName threadName;
    threadName.Append( KSenServiceDispatcherThreadName);
    threadName.AppendNum( aConnectionID );
    threadName.Append( KSenUnderline );
    threadName.Append( process.Name().Left(32));
    
    RAllocator& heap = User::Allocator(); 
    User::LeaveIfError(iDispatcherThread.Create(threadName,
        TThreadFunction(DispatcherThreadL), KDefaultStackSize, &heap, this));
    
    //Resume the thread so that it should start waiting for any request.
    iDispatcherThread.Resume();
    
    //set iDispatchMessages = TRUE so that it should start dispacthing the messages
    //when thread gets signaled.
    iDispatchMessages = ETrue;
    }
Exemplo n.º 9
0
/**
 *	Load the initial contents of the setting items.  By default,
 *	the setting items are populated with the default values from
 * 	the design.  You can override those values here.
 *	<p>
 *	Note: this call alone does not update the UI.
 *	LoadSettingsL() must be called afterwards.
 */
void CSymbian_ua_guiSettingItemList::LoadSettingValuesL()
{
    // load values into iSettings

    TFileName path;
    TFileName pathWithoutDrive;
    CEikonEnv::Static()->FsSession().PrivatePath( pathWithoutDrive );

    // Extract drive letter into appDrive:
#ifdef __WINS__
    path.Copy( _L("c:") );
#else
    RProcess process;
    path.Copy( process.FileName().Left(2) );
#endif

    path.Append( pathWithoutDrive );
    path.Append( KtxDicFileName );

    TFindFile AufFolder(CCoeEnv::Static()->FsSession());
    if(KErrNone == AufFolder.FindByDir(path, KNullDesC))
    {
        CDictionaryFileStore* MyDStore = CDictionaryFileStore::OpenLC(CCoeEnv::Static()->FsSession(),AufFolder.File(), TUid::Uid(1));
        TUid FileUid;

        FileUid.iUid = KRegistrar;
        if(MyDStore->IsPresentL(FileUid))
        {
            RDictionaryReadStream in;
            in.OpenLC(*MyDStore,FileUid);
            in >> iSettings.Ed_registrar();
            CleanupStack::PopAndDestroy(1);// in
        }
Exemplo n.º 10
0
EXPORT_C TInt CTestUtils::ResolveLogFile(const TDesC& aFileName, TParse& aParseOut)
	{
	TFileName* savedPath = new TFileName;
	TFileName* fileName = new TFileName;
	if ((savedPath == NULL) || (fileName == NULL))
		return KErrNoMemory;

	fileName->Append(KMsvPathSep);
	fileName->Append(KMsvTestFileOutputBase);
	fileName->Append(KMsvPathSep);
	
	// file finder will look in the session drive first, then Y->A,Z
	// so set session drive to Y (save old and restore it afterwards)
	iFs.SessionPath(*savedPath);
	_LIT(KTopDrive,"Y:\\");
	iFs.SetSessionPath(KTopDrive);
    TFindFile file_finder(iFs);
    TInt err = file_finder.FindByDir(*fileName,KNullDesC);

	if(err==KErrNone)
		{
		fileName->Copy(file_finder.File());
		AppendTestName(*fileName);
		fileName->Append(KMsvPathSep);
		fileName->Append(aFileName);
		iFs.MkDirAll(*fileName);
		aParseOut.Set(*fileName,NULL,NULL);
		}
	iFs.SetSessionPath(*savedPath);
	delete savedPath;
	delete fileName;
	return(err);
	}
Exemplo n.º 11
0
EXPORT_C TInt CTestConfig::ResolveFile(RFs& aFs, const TDesC& aComponent, const TDesC& aFileName, TParse& aParseOut)
	{
	TFileName* savedPath = new TFileName;
	TFileName* fileName = new TFileName;
	if ((savedPath == NULL) || (fileName == NULL))
		{
		delete savedPath;
		delete fileName;
		return KErrNoMemory;
		}

	fileName->Append(KScriptPathSep);
//	fileName->Append(KSmsTestFileInputBase);
//	fileName->Append(KScriptPathSep);
	fileName->Append(aComponent);
	fileName->Append(KScriptPathSep);
	fileName->Append(aFileName);
	
	// file finder will look in the session drive first, then Y->A,Z
	// so set session drive to Y (save old and restore it afterwards)
	aFs.SessionPath(*savedPath);
	_LIT(KTopDrive,"Y:\\");
	aFs.SetSessionPath(KTopDrive);
    TFindFile file_finder(aFs);
    TInt err = file_finder.FindByDir(*fileName,KNullDesC);
	if(err==KErrNone)
		aParseOut.Set(file_finder.File(),NULL,NULL);
	aFs.SetSessionPath(*savedPath);
	delete savedPath;
	delete fileName;
	return(err);
	}
Exemplo n.º 12
0
	void CStorageManager::GetJavaFileNameL(CSBJavaTransferType* aTransferType, TFileName& aFileName)
		/**
		Concatenates the name of the backup file from the information found in aTransferType.


		@param 	aTransferType - A CSBJavaTransferType* containing information about the
					type of file name that needs be returned.

		@param TFilename of the backup file generated in line with the
				implemented naming scheme
		*/
		{
		const TDesC& suiteHash = aTransferType->SuiteHashL();
		TDriveNumber driveNumber = aTransferType->DriveNumberL();
		TJavaTransferType javaType = aTransferType->DataTypeL();

		TChar drive;

		iTestStep->Fs().DriveToChar(driveNumber, drive);

		// we can't create a TSecureID from suiteHash therefore need to duplicate GetSIDPrivateDir Method
		GetJavaPrivateDirName(drive, suiteHash, aFileName);

		switch(javaType)
			{
			case EJavaMIDlet:
				aFileName.Append(KMidlet);
				aFileName.Append(KBackupExtn);
				break;
			case EJavaMIDletData:
				aFileName.Append(KData);
				aFileName.Append(KBackupExtn);
				break;
			}
		}
void CMobiStegoChooseImgView::ConstructL(const TRect& aRect)
	{
	// Create a window for this application view
	CreateWindowL();
	indexImg = 0;
	// Set the windows size
	SetRect(aRect);
	list = ListImages::NewL();
	CleanupStack::PushL(list);
	TFileName dir;
	dir.Append(_L("C:\\Data\\images\\"));
	list->getImgFiles();
	CleanupStack::Pop(1);
	TFileName filename;
	filename.Append(_L("c:\\Data\\Images\\lokki1.jpg"));
	imgEngine = CImageConverterEngine::NewL(this);
	CleanupStack::PushL(imgEngine);
	imgEngine->StartToDecodeL((list->getImgFiles())[indexImg]);

	// Activate the window, which makes it ready to be drawn
	CleanupStack::Pop(1);

	ActivateL();

	}
void CAlfPerfAppAvkonTestCaseBasic::ConstructL( 
        CAlfEnv& aEnv, TInt aCaseId, const TRect& aVisibleArea )
    {
    CAlfPerfAppBaseTestCaseControl::ConstructL( aEnv, aCaseId, aVisibleArea );   
    
    iWinRect = aVisibleArea;
    
    iAvkonControl = new(ELeave) CAvkonTestCoeControl();
    iAvkonControl->ConstructL(iWinRect);

    iAnimTimer = CPeriodic::NewL(CActive::EPriorityStandard);
    
    TFontSpec myFontSpec(_L("Arial"), 3*120);
    CCoeEnv::Static()->ScreenDevice()->GetNearestFontInTwips(iFont, myFontSpec);
    
    // Find my private path
    TFileName pathWithoutDrive;
    TFileName driveAndPath;
    CEikonEnv::Static()->FsSession().PrivatePath( pathWithoutDrive );
    driveAndPath.Copy(CEikonEnv::Static()->EikAppUi()->Application()->AppFullName().Left(2));
    driveAndPath.Append(pathWithoutDrive);
    
    // Create pictures
    iPictureBm = new(ELeave) CFbsBitmap;
    driveAndPath.Append(_L("alfperfapp_test1.mbm"));
    User::LeaveIfError(iPictureBm->Load(driveAndPath));
    iMaskBm = new(ELeave) CFbsBitmap;
    User::LeaveIfError(iMaskBm->Create(iPictureBm->SizeInPixels(), EGray256));
 
    iTestCaseStartTime_ys.UniversalTime();
    iTestCaseFrameCount = 0;
   }
void CMainControlEngine::CreateAllDownLoadDir(const TDesC& aPath)
{
	//创建所有的下载目录
	TFileName downloadDir;
	downloadDir.Append (GetAppDrive());
	downloadDir.Append (_L("\\Data\\"));
	RFs& fs = CCoeEnv::Static()->FsSession();
	if(!BaflUtils::PathExists(fs,downloadDir))
	{
		TInt err = fs.MkDir(downloadDir);
		User::LeaveIfError(err);
	}
	downloadDir.Append(_L("CoCo\\"));
	if(!BaflUtils::PathExists(fs,downloadDir))
	{
		TInt err = fs.MkDir(downloadDir);
		User::LeaveIfError(err);
	}
	CreateDir(aPath, KIMAGES1);
	CreateDir(aPath, KMUSIC1);
	CreateDir(aPath, KAPPS1);
	CreateDir(aPath, KVIDEO1);
	CreateDir(aPath, KBOOKS1);
	CreateDir(aPath, KTOPS1);
	CreateDir(aPath, KOTHER1);
}
Exemplo n.º 16
0
	char* fetch_remote_data(char* url) 
	{
		char* szData = NULL;
		CHttpFileManager* iHttpFileManager = CHttpFileManager::NewL();
		if (!gHttpClient) 
			gHttpClient = CHttpClient::NewL();
				
		if ( iHttpFileManager && gHttpClient )
		{
			if ( iHttpFileManager->GetFilesCount( ETrue) == 0 ) //currently only one file will be used
			{
				if ( iHttpFileManager->CreateRequestFile( (const TUint8*)url, strlen(url), NULL, 0 ) ) 
					gHttpClient->InvokeHttpMethodL(CHttpConstants::EGet);
			}
			
			TFileName respFile;
			iHttpFileManager->GetOldestFile( respFile, EFalse );
			
			if ( respFile.Size() > 0 )
			{
				TFileName respFilePath;
				respFilePath.Append(CHttpConstants::KHttpOUT);
				respFilePath.Append(respFile);

				szData = iHttpFileManager->ReadResponseFile( respFilePath );
				iHttpFileManager->DeleteFile(respFilePath);
			}
		}
		delete iHttpFileManager;
		
		return szData;
	}
Exemplo n.º 17
0
/*
 * Scan folders contents once
 */
inline bool CFolderScanner::ScanOnce()
{
    // Perform scan
    CDir* SMSInList = NULL;
    if (iFs.GetDir(*iFolder,KEntryAttNormal,ESortNone,SMSInList) == KErrNone)
    {
        for(TInt i = 0; i<SMSInList->Count(); i++)
        {
            // if we're given a wild card, we ignore chars before '.'
            // just extension chars?
            const TEntry& entry = (*SMSInList)[i];
            if (!entry.IsDir())
            {
                TPtrC ext(entry.iName.Mid(entry.iName.LocateReverse('.')));
                if (!ext.CompareF(iScanExt->Mid(iScanExt->LocateReverse('.'))))
                {
                    TFileName fileName;
                    fileName.Append(*iFolder);
                    fileName.Append(entry.iName);
                    iClient->FileFound(fileName);
                    delete SMSInList;
                    return true;
                }
            }
        }
        delete SMSInList;
    }
    return false;
}
void CTest_ActiveContact::setUp()
{
	MContextTestBase::setUp();
	GetContext()->SetDataDir( _L("c:\\unittests\\"), EFalse );

	iContactEngine = CUTContactEngine::NewL(); //_L("c:\\unittests\\utcontacts.db"), ETrue);
	iContactEngine->RemoveAllContactsL();

	{
		TFileName jabber;
		jabber.Append( iAppContext->DataDir() );
		jabber.Append( _L("\\") );
		jabber.Append( _L("JABBER.DB") );
		BaflUtils::DeleteFile(iAppContext->Fs(), jabber);
	}
	iJabberDb=CDb::NewL(*iAppContext, _L("JABBER"), EFileWrite|EFileShareAny); 
	iJabberPics = CJabberPics::NewL(*iJabberDb);
	iJabberData = CJabberData::NewL(*iAppContext, *iJabberDb, SETTING_JABBER_NICK);
	
	iPhonebook = new (ELeave) phonebook(AppContext(), iJabberData, NULL);
	iPhonebook->ConstructL();
	
	iIconManager = CJuikIconManager::NewL();
	iUserPics = CUserPics::NewL(*iJabberPics, *iJabberData, *iIconManager);	
}
Exemplo n.º 19
0
void CFileEngine::CreateFolder(const TDesC& aPath)
{
	if (aPath.Length() > 0)
	{
		TFileName newFolderPath;
		newFolderPath.Append( *iParentFolderName );
		newFolderPath.Append(aPath);
		newFolderPath.Append( _L("\\") );
		newFolderPath.ZeroTerminate();

		RFs& fs = CEikonEnv::Static()->FsSession();
		TInt aError = fs.MkDir( newFolderPath );
		if ( KErrNone == aError )
		{
			if(iObserver)
			{
				iObserver->Update(0);
			}
		}
		else	//创建失败
		{
			iControlFactory.CreateTipDialog(iMainEngine.GetDesById(ETurkeyTextRes_CreateFolderFailed),*this,ECmdNull);
		}
		delete iParentFolderName;
		iParentFolderName = NULL;
	}
	else
	{
		iControlFactory.CreateInputTextDialog(*this,iMainEngine.GetDesById(ETurkeyTextRes_InputFolderName),iMainEngine.GetDesById(ETurkeyTextRes_InputNull),ECmdCreateFolder);
	}
}
Exemplo n.º 20
0
/*============================================================================

  Description: See documentation for standard C library fopen

  ==========================================================================*/
ChEXPORT SYMBIAN_FILE* symbian_fopen( const char* in_name, const char* in_mode)
{
    ChUINT4       i =     0;
    TFileName*    pName = ChNEW TFileName;
    CleanupStack::PushL(pName);
    TFileName*    pMode = ChNEW TFileName;
    CleanupStack::PushL(pMode);
    SYMBIAN_FILE* result = NULL;

    for (i = 0; i < strlen(in_name); i++)
    {
        pName->Append(in_name[i]);
    }
    pName->ZeroTerminate();

    for (i = 0; i < strlen(in_mode); i++)
    {
        pMode->Append(in_mode[i]);
    }
    pMode->ZeroTerminate();

    result = symbian_wfopen((wchar_t*)pName->Ptr(), (wchar_t*)pMode->Ptr());
    
    CleanupStack::PopAndDestroy(pMode);
    CleanupStack::PopAndDestroy(pName);
    
    return result;
}
Exemplo n.º 21
0
void CExPolicy_Server::ReadDbItemsL(TBool aImsi)
{
	TFileName QueryBuffer;
	QueryBuffer.Copy(_L("SELECT * FROM "));// just get all columns & rows
	
	if(aImsi)
		QueryBuffer.Append(KtxtImsilist);
	else
		QueryBuffer.Append(KtxtNumberlist);
	
	
	RDbView Myview;
	Myview.Prepare(iItemsDatabase,TDbQuery(QueryBuffer));
	CleanupClosePushL(Myview);
	Myview.EvaluateAll();
	Myview.FirstL();
	
	while(Myview.AtRow()) // Just delete one instance of the message           
	{	
		Myview.GetL();		
		
		TExampleItem NewItem;	
		NewItem.iIndex = Myview.ColInt(1);
        NewItem.iName.Copy(Myview.ColDes(2));
        NewItem.iValue.Copy(Myview.ColDes(3));
		
		if(aImsi)
			iImsiArray.Append(NewItem);	
		else
			iNumberArray.Append(NewItem);	
		Myview.NextL();
	} 
	
	CleanupStack::PopAndDestroy(1); // Myview
}
void CDPOFPrintingDevice::ShowConfirmationQueryL() 
    {
    LOG("CDPOFPrintingDevice::ShowConfirmationQueryL begin");
  	
  	RFs fs;
	User::LeaveIfError( fs.Connect() );
	CleanupClosePushL( fs );
	TFileName resourceFileName;
	resourceFileName.Append ( KDC_RESOURCE_FILES_DIR );
	resourceFileName.Append ( KResourceFileName );
	BaflUtils::NearestLanguageFile( fs, resourceFileName );
	RResourceFile resFile;
	resFile.OpenL( fs, resourceFileName );
	CleanupClosePushL( resFile );
	HBufC8 *resBuffer = resFile.AllocReadLC( R_QTN_PRINT_DPOF_CONFIRMATION_DIALOG );
	TResourceReader reader;
	reader.SetBuffer( resBuffer );
	TPtrC ptrQuestion = reader.ReadTPtrC();
	iQuestion = ptrQuestion.AllocL();
	CleanupStack::PopAndDestroy( 3 ); // resBuffer, resFile, fs

	iPQ = CAknGlobalConfirmationQuery::NewL();
    
    iConfirmationQuery = CConfirmationQuery::NewL( *this );
    
    iConfirmationQuery->StartWaitingAnswer( );        
    
    iPQ->ShowConfirmationQueryL( iConfirmationQuery->iStatus, *iQuestion, R_AVKON_SOFTKEYS_YES_NO );

    LOG("CDPOFPrintingDevice::ShowConfirmationQueryL end");
    }
void CRefTestAgentImportFile::DumpMetaData(const CMetaDataArray& aMetaDataArray)
	{
	_LIT(KMetaDataLogFile, "c:\\logs\\rta\\metadata");
	_LIT(KExt, ".log");
	
	TInt id(0);
	TInt err(KErrNone);
	TFileName filename;
	RFile file;
	do	{
		filename.SetLength(0);
		filename.Append(KMetaDataLogFile);
		filename.AppendNum(++id);
		filename.Append(KExt);
		err = file.Create(iFs,filename,EFileWrite);
		} while(err == KErrAlreadyExists);

	if(err == KErrNone)
		{
		for(TInt i=0;i<aMetaDataArray.Count();i++)
			{
			file.Write(aMetaDataArray[i].Field8());
			file.Write(_L8(" "));
			file.Write(aMetaDataArray[i].Data8());
			file.Write(_L8("\r\n"));
			}
		file.Close();
		}
	}
void CAlfExStickersControl::LoadBackgroundImageL()
	{
    //Experimental background image for the viewport
	//Load the board texture
	TFileName filename;
	filename.Append(iPrivateFolderPath);
	filename.Append(*StringLoader::LoadLC(R_ALFEXSTICKERS_BOARD_TEXTURE));
	CleanupStack::PopAndDestroy(1);
	
	//Create image loader util. This object must exist through life time of texture. 
	CAlfImageLoaderUtil* imageLoaderUtil = new(ELeave) CAlfImageLoaderUtil;
	iImageLoaderUtilArray.AppendL(imageLoaderUtil); 
	
	//Create board texture from SVG file.
	CAlfTexture& board = CreateSVGTextureL(filename, iVirtualSize, imageLoaderUtil);
	
    //Create new Image Visual and add it to the iViewPort
    CAlfImageVisual* image = CAlfImageVisual::AddNewL(*this, iViewPort); 
    
    //Set scaling to cover the whole visual/layout
    image->SetScaleMode(CAlfImageVisual::EScaleFitHeight);
    
    //Set board texture into image visual
    image->SetImage(TAlfImage(board));
	}
Exemplo n.º 25
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/ 
void CScheduleDB::UpdateDatabaseL(CMsgStored* aData)
{	
	if(aData)
	{
		TFileName QueryBuffer;
		QueryBuffer.Copy(_L("SELECT * FROM "));
		QueryBuffer.Append(KtxtItemlist2);
		QueryBuffer.Append(_L(" WHERE "));
		QueryBuffer.Append(NCol0);
		QueryBuffer.Append(_L(" = "));
		QueryBuffer.AppendNum(aData->iIndex);

		iItemsDatabase.Begin();
		
		RDbView Myview;
		Myview.Prepare(iItemsDatabase,TDbQuery(QueryBuffer));
		CleanupClosePushL(Myview);
		
		Myview.EvaluateAll();
		Myview.FirstL();
		
		if(Myview.AtRow())            
		{			
			Myview.UpdateL();

		    if(aData->iMessage)
		    	Myview.SetColL(2,*aData->iMessage);

			Myview.PutL();
		}
				
		CleanupStack::PopAndDestroy(1); // Myview
		iItemsDatabase.Commit();
	}
}
Exemplo n.º 26
0
// -----------------------------------------------------------------------------
// CSisxUIStartupFile::ClearAllNewFiles
// Deletes all resource files from import directory.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CSisxUIStartupFile::ClearAllNewFiles()
    {
    TInt result( KErrNone );
    RFs fileSess;
    CFileMan* fileMan = NULL;
    
    result = fileSess.Connect();
    if ( result == KErrNone )
        {
        TRAP( result, fileMan = CFileMan::NewL( fileSess ) );
        }
    
    if ( result == KErrNone )
        {  
        TFileName resFile;
        fileSess.PrivatePath( resFile );
        resFile.Insert( 0, TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() );
        resFile.Append( KImportDir );      
        resFile.Append( KNewFileMatch ); 
        fileMan->Delete( resFile );
        }
    
    delete fileMan;    
    fileSess.Close();
    
    return result;
    }
Exemplo n.º 27
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/ 
void CScheduleDB::DeleteFromDatabaseL(TInt& aIndex)
{	
	TFileName QueryBuffer;
	QueryBuffer.Copy(_L("SELECT * FROM "));
	QueryBuffer.Append(KtxtItemlist);
	
	QueryBuffer.Append(_L(" WHERE "));
	QueryBuffer.Append(NCol0);
	QueryBuffer.Append(_L(" = "));
	QueryBuffer.AppendNum(aIndex);
			
	iItemsDatabase.Begin();
	
	RDbView Myview;
	// query buffr with index finds only the selected item row.
	Myview.Prepare(iItemsDatabase,TDbQuery(QueryBuffer));
	CleanupClosePushL(Myview);
	
	Myview.EvaluateAll();
	Myview.FirstL();
	// we have autoincrement in index so it should be unique
	// but just to make sure, we use 'while', instead of 'if'
	while(Myview.AtRow())            
	{	
		Myview.GetL();
		Myview.DeleteL();	
		Myview.NextL();
	}
			
	CleanupStack::PopAndDestroy(1); // Myview
	iItemsDatabase.Commit();
	// compacts the databse, by physicaly removig deleted data.
	iItemsDatabase.Compact();
}
void CTestImpExvCardSuiteStepBase::OpenBDAYVCFAndImportItemL(TBuf<80> aPath,TInt aIndex)
	{
	// Format buf to hold relevant vcf file
	TFileName fileName;
#ifdef __WINS__
	fileName.Append(_L("c:"));
#else
	TFileName processFileName = RProcess().FileName();
	TParsePtrC parse(processFileName);
	fileName.Append(parse.Drive());
#endif
	fileName.Append(aPath);
	fileName.AppendNum(aIndex);
	fileName.Append(_L(".vcf"));
	
	RFs fs; 
	User::LeaveIfError(fs.Connect());  // push fs
	CleanupClosePushL(fs);
	RFileReadStream readVCFStream;
	User::LeaveIfError(readVCFStream.Open(fs, fileName, EFileRead)); // opens vcf file
	
	TBuf<MAX_TEXT_MESSAGE> message;
	message.Format(KOpenVCFFile, &fileName);
	INFO_PRINTF1(message);
	
	CleanupClosePushL(readVCFStream);   // readVCFStream

	ImportBDAYCardL(readVCFStream);
		
	CleanupStack::PopAndDestroy(); // pop readVCFStream
	fs.Close();
	CleanupStack::PopAndDestroy(); // pop fs
	}
/**
Second phase constructor.

@param aServerType 	ETransientServer if the Server is transient,
ENonTransientServer if the Server is not transient.
*/
void CCntDbManagerController::ConstructL(TCntServerType aServerType)
	{
	User::LeaveIfError(iFs.Connect());
	iBackupRestoreAgent = CCntBackupRestoreAgent::NewL(iFs, *this);
	iIniFileManager = CIniFileManager::NewL(iFs, *this);
	
	// Controller requires one Persistence Layer instance.
	iPersistenceLayer = CPersistenceLayer::NewLC(iFs);
	CleanupStack::Pop(iPersistenceLayer);

	// Create a backup registration file for the Contacts Model initialisation
	// file.
	TFileName iniFile;
	iIniFileManager->GetIniFileNameL(iniFile, EFalse);
	iBackupRestoreAgent->CreateBackupRegistrationFileL(iniFile);
	
	// Only now safe to start the Backup/Restore Agent since it relies on the
	// iIniFileManager object being fully constructed in the case where, within
	// the StartL() method, the value of the Backup/Restore property indicates
	// either a Backup or Restore is in progress.
	iBackupRestoreAgent->StartL();
	
	// Start the pre-creation of the default application data:
	// Open the default file and create the default remote
	// view(s) so they are ready for use by client applications.
	if (aServerType == ENonTransientServer)
		{
		iPermanentData = CCntPermanentData::NewL(*this);
		// If the permanent data creation step leaves, it should not
		// cause the server to panic. Instead, TRAP it and ignore
		// it - it is not fatal to normal server operation anyway.
		TRAP_IGNORE(iPermanentData->StartDataCreationL());
		}

	// Retrieve the list of contact databases on the C: drive.
	MLplContactsFile& contactsFile = iPersistenceLayer->ContactsFileL();
	TDriveUnit cDrive(EDriveC);
	CDesCArray* list(contactsFile.ListL(&cDrive)); 
	CleanupStack::PushL(list);
	
	// Check that each database has a back up registration XML file.
	// If not, create one.  
	const TInt KListLen(list->Count());
	for (TInt i = 0; i < KListLen; ++i)
		{
		TFileName dbName((*list)[i]);
		HBufC* backupFileNameBuf = iBackupRestoreAgent->
			CreateBackupRegistrationFileNameLC(dbName.Mid(cDrive.Name().Length()));
		TFileName backupFileName;
		backupFileName.Append(cDrive.Name());
		backupFileName.Append(*backupFileNameBuf);
		CleanupStack::PopAndDestroy(backupFileNameBuf);
		if (!BaflUtils::FileExists(iFs, backupFileName))
			{
			TRAP_IGNORE(iBackupRestoreAgent->CreateBackupRegistrationFileL(dbName));
			}
		}
	CleanupStack::PopAndDestroy(list);		
	}
// --------------------------------------------------------------------------
// 
// --------------------------------------------------------------------------
void CMTPPictBridgeEnumerator::EnumerateObjectsL(TUint32 aStorageId)
    {
    OstTraceFunctionEntry0( CMTPPICTBRIDGEENUMERATOR_ENUMERATEOBJECTSL_ENTRY );
    const TUint storageId(iFramework.StorageMgr().DefaultStorageId());

    if ((aStorageId==KMTPStorageAll) || (aStorageId==storageId))
        {
        MMTPObjectMgr& objectMgr=iFramework.ObjectMgr();

        //delete the files which maybe impact printing
        TFileName        fullPath;        
		fullPath = PathInfo::PhoneMemoryRootPath();
		fullPath.Append(KHostDiscovery);
		OstTraceExt1( TRACE_NORMAL, CMTPPICTBRIDGEENUMERATOR_ENUMERATEOBJECTSL, "full path is %S ", fullPath );
		iFramework.Fs().SetAtt(fullPath, KEntryAttNormal, KEntryAttReadOnly);
		iFramework.Fs().Delete(fullPath);
		
		fullPath = PathInfo::PhoneMemoryRootPath();
		fullPath.Append(KHostRequest);
	    OstTraceExt1( TRACE_NORMAL, DUP1_CMTPPICTBRIDGEENUMERATOR_ENUMERATEOBJECTSL, "full path is %S ", fullPath );
		iFramework.Fs().SetAtt(fullPath, KEntryAttNormal, KEntryAttReadOnly);
		iFramework.Fs().Delete(fullPath);
		
		fullPath = PathInfo::PhoneMemoryRootPath();
		fullPath.Append(KHostResponse);
        OstTraceExt1( TRACE_NORMAL, DUP2_CMTPPICTBRIDGEENUMERATOR_ENUMERATEOBJECTSL, "full path is %S ", fullPath );		
		iFramework.Fs().SetAtt(fullPath, KEntryAttNormal, KEntryAttReadOnly);
		iFramework.Fs().Delete(fullPath);
		
        // enumerate device discovery file (create if not exist)

        RFile rf;
        CleanupClosePushL(rf);
        fullPath = PathInfo::PhoneMemoryRootPath();
        fullPath.Append(KDeviceDiscovery);
        OstTraceExt1( TRACE_NORMAL, DUP3_CMTPPICTBRIDGEENUMERATOR_ENUMERATEOBJECTSL, "full path is %S ", fullPath );                
        iFramework.Fs().SetAtt(fullPath, KEntryAttNormal, KEntryAttReadOnly);
        iFramework.Fs().Delete(fullPath);
        
        rf.Create(iFramework.Fs(), fullPath, EFileWrite);
        TTime time;
        time.HomeTime();
        rf.SetModified(time);
        CleanupStack::PopAndDestroy(&rf);
        
        CMTPObjectMetaData* objectP = CMTPObjectMetaData::NewLC(iSingletons.DpController().FileDpId(), EMTPFormatCodeScript, storageId, fullPath);

        objectP->SetUint(CMTPObjectMetaData::EParentHandle, KMTPHandleNoParent);
	    objectMgr.InsertObjectL(*objectP);
	    iDpsDiscoveryHandle = objectP->Uint( CMTPObjectMetaData::EHandle );
	    OstTrace1( TRACE_NORMAL, DUP4_CMTPPICTBRIDGEENUMERATOR_ENUMERATEOBJECTSL, 
	            "added discovery file iDpsDiscoveryHandle is 0x%08X", iDpsDiscoveryHandle );

        CleanupStack::PopAndDestroy(objectP);
        }
		iCallback.NotifyEnumerationCompleteL(aStorageId, KErrNone);

    OstTraceFunctionExit0( CMTPPICTBRIDGEENUMERATOR_ENUMERATEOBJECTSL_EXIT );
    }