Пример #1
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
TBool CExPolicy_Server::OkToAddToValDb(RDbDatabase& aDatabase,const TDesC& aCode,const TDesC8& aString)
{
	TBool Ret(ETrue);
	
	TFileName QueryBuffer;
	QueryBuffer.Copy(_L("SELECT * FROM "));
	QueryBuffer.Append(KtxtVallist);
	
	RDbView Myview;
	Myview.Prepare(aDatabase,TDbQuery(QueryBuffer));
	CleanupClosePushL(Myview);
	Myview.EvaluateAll();
	Myview.FirstL();
	
	QueryBuffer.Copy(aString);
		
	while(Myview.AtRow()) // Just delete one instance of the message           
	{	
		Myview.GetL();		
		
		if(QueryBuffer == Myview.ColDes(3)
		&& aCode == Myview.ColDes(2))
		{
			Ret = EFalse;
			break;	
		}
			
		Myview.NextL();
	} 
	
	CleanupStack::PopAndDestroy(1); // Myview
	
	return Ret;
}
Пример #2
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
        }
Пример #3
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CExPolicy_Server::AddToValDatabase(RDbDatabase& aDatabase,const TDesC& aCode,const TDesC8& aString)
{
	TFileName QueryBuffer;
	QueryBuffer.Copy(_L("SELECT * FROM "));
	QueryBuffer.Append(KtxtVallist);

	aDatabase.Begin();

	RDbView Myview;
	Myview.Prepare(aDatabase,TDbQuery(QueryBuffer));
	CleanupClosePushL(Myview);

	Myview.InsertL(); 
		
	Myview.SetColL(2,aCode);
	
	QueryBuffer.Copy(aString);
	
	Myview.SetColL(3,QueryBuffer);

	Myview.PutL();  
		
	CleanupStack::PopAndDestroy(1); // Myview
	aDatabase.Commit();
}
Пример #4
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");
	}
Пример #5
0
void CCompare::ConstructL(const TTestActionSpec& aTestActionSpec)
{
	CKeyStoreTestAction::ConstructL(aTestActionSpec);

	TInt err = KErrNone;
	TInt pos = 0;

	TDriveUnit sysDrive (RFs::GetSystemDrive());
	TBuf<128> ramDrive (sysDrive.Name());
	ramDrive.Append(_L("\\tkeystore\\data\\"));
	
	iOriginalFile = ramDrive;
	iNewFile = ramDrive;
	
	TFileName buf;
	buf.FillZ();

	buf.Copy(Input::ParseElement(aTestActionSpec.iActionBody, 
							KOriginalFile, 
							KOriginalFileEnd, pos, err));	
//	Now the filename itself
	iOriginalFile.Append(buf);

	buf.Copy(Input::ParseElement(aTestActionSpec.iActionBody, 
							KNewFile, 
							KNewFileEnd, pos, err));
//	Now the filename itself
	iNewFile.Append(buf);

//	iExpectedResult = SetExpectedResultL(Input::ParseElement(aTestActionSpec.iActionResult, 
//															KReturnStart, 
//															KReturnEnd, pos, err));
}
void CEmTubePlaylistManager::ImportPlaylistsL()
	{
	TFileName fileName;
	RFile file;
	RFs session;
	session.Connect();
	CleanupClosePushL( session );

#ifndef __WINS__
	TParsePtrC parse( CEikonEnv::Static()->EikAppUi()->Application()->AppFullName() );
	fileName.Copy( parse.Drive() );
	TPath privateDir;
	User::LeaveIfError( session.PrivatePath( privateDir ) );
	fileName.Append( privateDir );
#else
	fileName.Copy( _L("C:\\Data\\") );
#endif

	fileName.Append( KPlaylistsFilename );

	TInt err = file.Open( session, fileName, EFileStream | EFileRead );
	CleanupClosePushL( file );

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

		TInt count = stream.ReadInt32L();
		for( TInt i=0;i<count;i++)
			{
			CEmTubePlaylist *pl = CEmTubePlaylist::NewL( stream );
			iPlaylists.Append( pl );
			}
		CleanupStack::PopAndDestroy( &stream );
		}

	if( iPlaylists.Count() == 0 )
		{
		HBufC* name = StringLoader::LoadLC( R_PLAYLIST_MOST_PLAYED_TXT );
		AddPlaylistL( *name, CEmTubePlaylist::EPlaylistInternal );
		CleanupStack::PopAndDestroy( name );

		name = StringLoader::LoadLC( R_PLAYLIST_RECENTLY_PLAYED_TXT );
		AddPlaylistL( *name, CEmTubePlaylist::EPlaylistInternal );
		CleanupStack::PopAndDestroy( name );

		name = StringLoader::LoadLC( R_PLAYLIST_RECENTLY_SAVED_TXT );
		AddPlaylistL( *name, CEmTubePlaylist::EPlaylistInternal );
		CleanupStack::PopAndDestroy( name );
		}

	CleanupStack::PopAndDestroy( &file );
	CleanupStack::PopAndDestroy( &session );
	}
void CTangramAnimation::Init()
	{
	TFileName file;
#ifndef __WINS__
	file.Copy(KTangramImage);
	CompleteWithAppPath(file);
#else
	file.Copy(KResourceDirction);
	file.Append(KTangramImage);
#endif	
	iBitmapArray->LoadDataFromFile(file);
	}
void CAknFileSettingPage::ReadFilesL(const TDesC* aPos)
{
    TInt pos=-1;
    iFiles->Reset();
    FileControl()->Reset();
    TFileName buffer;
    if(iFileValue.Length())
    {
        buffer.Copy(KFolderIcon);
        buffer.Append(KFolderUp);
        iFiles->AppendL(buffer);
        TParse parse;
        parse.SetNoWild(iFileValue,NULL,NULL);
        CDir* list;
        User::LeaveIfError(iFs.GetDir(parse.DriveAndPath(),KEntryAttMaskSupported,ESortByName|EDirsFirst,list));
        CleanupStack::PushL(list);
        for(TInt i=0; i<list->Count(); i++)
        {
            const TDesC& name=(*list)[i].iName;
            if((*list)[i].IsDir())
            {
                buffer.Copy(KFolderIcon);
            }
            else
            {
                if(name.MatchF(KMelodyMask1)<0&&name.MatchF(KMelodyMask2)<0&&name.MatchF(KMelodyMask3)<0&&name.MatchF(KMelodyMask4)<0) continue;
                buffer.Copy(KMelodyIcon);
            }
            buffer.Append(name);
            if(aPos&&name.MatchF(*aPos)>=0) pos=iFiles->Count();
            iFiles->AppendL(buffer);
        }
        CleanupStack::PopAndDestroy(); //list
    }
    else
    {
        TDriveList drives;
        User::LeaveIfError(iFs.DriveList(drives));
        for(TInt drive=EDriveA; drive<=EDriveZ; drive++)
        {
            if(drives[drive])
            {
                buffer.Copy(KFolderIcon);
                buffer.Append(drive+'a');
                buffer.Append(':');
                iFiles->AppendL(buffer);
            }
        }
    }
    FileControl()->HandleItemAdditionL();
    if(pos!=-1) FileControl()->SetCurrentItemIndexAndDraw(pos);
    UpdateFileL();
}
Пример #9
0
/**
 * @brief Completes the second phase of Symbian object construction.
 * Put initialization code that could leave here.
 */
void Csymbian_ua_guiAppUi::ConstructL()
{
    // [[[ begin generated region: do not modify [Generated Contents]
    BaseConstructL (EAknEnableSkin);
    InitializeContainersL();
    // ]]] end generated region [Generated Contents]

    // Create private folder
    RProcess process;
    TFileName path;

    path.Copy (process.FileName().Left (2));

    if (path.Compare (_L ("c")) || path.Compare (_L ("C")))
        CEikonEnv::Static()->FsSession().CreatePrivatePath (EDriveC);
    else if (path.Compare (_L ("e")) || path.Compare (_L ("E")))
        CEikonEnv::Static()->FsSession().CreatePrivatePath (EDriveE);

    // Init PJSUA
    if (symbian_ua_init() != 0) {
        symbian_ua_destroy();
        Exit();
    }

    ExecuteDlg_wait_initLD();

    CTimer::ConstructL();
    CActiveScheduler::Add (this);
    After (4000000);
}
Пример #10
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
}
Пример #11
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
Пример #12
0
EXPORT_C void CCnaConverterList::UpdateL()
/** Requests a rescan of the disk to refresh the list of converters. */
{
    // delete old array and populate it with new values
    iImplementationArray.ResetAndDestroy();
    REComSession::ListImplementationsL(KUidConverterDll16,iImplementationArray);
    for (TInt i=0; i<iImplementationArray.Count(); i++)
    {   // load the conarc-plugin resource file. This should be set to 1 in
        // the ecom resource file to show there is extra file to load
        if (iImplementationArray[i]->OpaqueData().Length()!=0 )
        {
            _LIT(KPath,"z:\\resource\\convert\\");
            _LIT(KExtension,".rsc");
            TFileName resourceFile;
            resourceFile.Copy(KPath);
            resourceFile.AppendNum((TInt)iImplementationArray[i]->ImplementationUid().iUid, EHex);
            resourceFile.Append(KExtension);
            CCnaConvInfoFileReader2* readConverter=CCnaConvInfoFileReader2::NewL(resourceFile);
            CleanupStack::PushL(readConverter);
            readConverter->RestoreL();
            const TInt converterCount = readConverter->Count();
            for (TInt j = 0 ; j < converterCount ; j++ )
            {
                CCnaConverter* tempConv= readConverter->AtL(j);
                CleanupStack::PushL(tempConv);
                iConverters->AppendL(tempConv);
                CleanupStack::Pop(tempConv);
            }
            CleanupStack::PopAndDestroy(readConverter);
        }
    }
    iDoneScan=ETrue;
}
void CListCertificates::AddDNL(const TDesC8& aDNBuf)
	{
	if (aDNBuf.Length())
		{
		RFs fs;
		User::LeaveIfError(fs.Connect());
		CleanupClosePushL(fs);
		
		TFileName fn;
		fn.Copy(aDNBuf);
		RFile file;
		file.Open(fs, fn, EFileRead);
		CleanupClosePushL(file);
		
		TInt size;
		file.Size(size);
		
		HBufC8* cert = HBufC8::NewMaxLC(size);
		TPtr8 ptr(cert->Des());
		file.Read(ptr);
		
		CX509Certificate* parsedCert = CX509Certificate::NewLC(*cert);
		HBufC8* issuer = parsedCert->DataElementEncoding(CX509Certificate::EIssuerName)->AllocLC();
		User::LeaveIfError(iDNs.Append(issuer));
		
		CleanupStack::Pop(issuer);
		CleanupStack::PopAndDestroy(4, &fs);
		}
	}
Пример #14
0
TVerdict CDumpDrmArchive::doTestStepL()
	{
	// SetTestStepResult(EInconclusive) is a bad idea.
	// It makes the TEST macroes unusable.

	TPtrC fileName;
	TPtrC outputPath;
	GetStringFromConfig(ConfigSection(),_L("Filename"),fileName);
	GetStringFromConfig(ConfigSection(),_L("outputpath"),outputPath);
	__UHEAP_MARK;	
	
	INFO_PRINTF2(_L("Reading DRM archive: %S "), &fileName);

	RFs fs;
	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);
	
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API 
	RFile64 file;
#else
	RFile file;
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
	User::LeaveIfError(file.Open(fs, fileName, EFileRead | EFileStream | EFileShareReadersOnly));
	CleanupClosePushL(file);
	
	CRefTestAgentArchive* archive = CRefTestAgentArchive::NewL(file);
	CleanupStack::PushL(archive);
	
	TBuf <256> mimeType;
	mimeType.Copy(archive->DefaultMimeType());
	INFO_PRINTF2(_L("Default Mime Type : %S "), &mimeType);
	CDrmFiles& drmFiles = archive->DrmFilesL();
	
	// enhance this later
	// just dump out the default content object
	CDrmFileContent& defaultContent = drmFiles.FindL(KDefaultContentObject());

	TBuf8 <1024> buffer;
	TInt length = 1024;
	TFileName outputFileName;
	outputFileName.Copy(outputPath);
	outputFileName.Append(_L("output.txt"));
	
	RFile outputFile;
	User::LeaveIfError(outputFile.Create(fs, outputFileName, EFileWrite | EFileStream | EFileShareAny));
	CleanupClosePushL(outputFile);
	while(length > 0)
		{
		User::LeaveIfError(defaultContent.Read(buffer, buffer.MaxLength()));
		length = buffer.Length();
		User::LeaveIfError(outputFile.Write(buffer));
		}

	
	CleanupStack::PopAndDestroy(4, &fs); // fs, file, archive, outputFile
	
	__UHEAP_MARKEND;
	
	return TestStepResult();
	}	
Пример #15
0
TInt CTestUtils::AppendMainLogL()
	{
	_LIT(KDisplayLogFile,"Log File %S\n");
	TParse loglocation;
	TFileName logfile;
	TInt err=ResolveLogFile(KNullDesC, loglocation);
	if(err!=KErrNone) 
		{
		iFs.MkDirAll(KMsvTestFileDefaultOutputBase);
		err=ResolveLogFile(KNullDesC, loglocation);
		}
	User::LeaveIfError(err);
	logfile.Copy(loglocation.FullName());
	logfile.Delete(logfile.Length()-1,1);
	AppendVariantName(logfile);
	iRTest.Printf(KDisplayLogFile, &logfile);
	iFs.MkDirAll(logfile);

	iLogBuf=HBufC::NewL(KMaxLogLineLength);
	iLogBuf8=HBufC8::NewL(KMaxLogLineLength);
	TInt pos=0;
	TInt ret=KErrNone;
	ret=iFile.Open(iFs,logfile,EFileWrite|EFileShareAny);
	if (ret==KErrNotFound)
		ret=iFile.Create(iFs,logfile,EFileWrite|EFileShareAny);
	if (ret==KErrNone)
		return(iFile.Seek(ESeekEnd,pos));
	else
		return(ret);
	}
Пример #16
0
TInt CTestUtils::OpenMainLogL()
	{
	_LIT(KDisplayLogFile,"Log File %S\n");
	TParse loglocation;
	TFileName logfile;
	TInt err=ResolveLogFile(KNullDesC, loglocation);
	if(err!=KErrNone) 
		{
		TChar driveChar=RFs::GetSystemDriveChar();
 		TBuf<2> systemDrive;
 		systemDrive.Append(driveChar);
 		systemDrive.Append(KDriveDelimiter);
 		TPath pathName(systemDrive) ;
		pathName.Append(KMsvTestFileDefaultOutputBase);		
		iFs.MkDirAll(pathName);
		err=ResolveLogFile(KNullDesC, loglocation);
		}
	User::LeaveIfError(err);
	logfile.Copy(loglocation.FullName());
	logfile.Delete(logfile.Length()-1,1);
	AppendVariantName(logfile);
	iRTest.Printf(KDisplayLogFile, &logfile);
	iFs.MkDirAll(logfile);

	iLogBuf=HBufC::NewL(KMaxLogLineLength);
	iLogBuf8=HBufC8::NewL(KMaxLogLineLength);
	return(iFile.Replace(iFs,logfile,EFileWrite|EFileShareAny));
	}
// ---------------------------------------------------------------------------
// CTestStartupListUpdater::ConstructL
// ---------------------------------------------------------------------------
//
void CTestStartupListUpdater::ConstructL()
    {
    // Read settings to check if test case name is to be appended to file name.
    RSettingServer settingsServer;
    User::LeaveIfError( settingsServer.Connect() );
    CleanupClosePushL( settingsServer );

    TLoggerSettings loggerSettings;
    User::LeaveIfError( settingsServer.GetLoggerSettings( loggerSettings ) );

    CleanupStack::PopAndDestroy( &settingsServer );

    TFileName logFileName;
    if( loggerSettings.iAddTestCaseTitle )
        {
        TName title;
        TestModuleIf().GetTestCaseTitleL( title );
        logFileName.Format( KTestStartupListUpdaterLogFileWithTitle, &title );
        }
    else
        {
        logFileName.Copy( KTestStartupListUpdaterLogFile );
        }

    iLog = CStifLogger::NewL( KTestStartupListUpdaterLogPath, logFileName,
        CStifLogger::ETxt, CStifLogger::EFile, EFalse );
    SendTestClassVersion();
    }
Пример #18
0
bool C_dir::RemoveDirectory(const wchar *path, bool recursively){

   bool ok = true;
   if(recursively){
      C_dir d;
      if(d.ScanBegin(path)){
         while(true){
            dword atts;
            const wchar *wp = d.ScanGet(&atts);
            if(!wp)
               break;
            Cstr_w fn; fn<<path <<'\\' <<wp;
            if(atts&C_file::ATT_DIRECTORY)
               ok = (RemoveDirectory(fn, true) && ok);
            else
               ok = (C_file::DeleteFile(fn) && ok);
         }
         d.ScanEnd();
      }
   }
   Cstr_w dirw;
   C_file::GetFullPath(path, dirw);

   RFs file_session;
   RFs &fs = InitFileSession(file_session);
   TFileName n;
   n.Copy(TPtrC((word*)(const wchar*)dirw, dirw.Length()));
   if(n[n.Length()-1]!='\\')
      n.Append('\\');
   ok = (fs.RmDir(n)==KErrNone && ok);
   CloseFileSession(file_session);
   return ok;
}
Пример #19
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);
	}
Пример #20
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();
}
Пример #21
0
// -----------------------------------------------------------------------------
// CWPInternetAPDB::SaveToDatabaseL
// -----------------------------------------------------------------------------
//   
void CWPInternetAPDB::SaveToDatabaseL(TInt& aIndex, TUint aAPId,
        TUint32 aBearerType, const TDesC& aOriginator)
    {
    FLOG( _L( "[Provisioning] CWPInternetAPDB::SaveToDatabaseL" ) );

    //If there is any existing rows for the same APID, delete those
    if (DeleteFromDatabaseL(aAPId))
        {
        iItemsDatabase.Begin();
        }

    TFileName QueryBuffer;
    QueryBuffer.Copy(_L("SELECT * FROM "));
    QueryBuffer.Append(KtxtItemlist);

    RDbView Myview;
    Myview.Prepare(iItemsDatabase, TDbQuery(QueryBuffer));
    CleanupClosePushL(Myview);

    Myview.InsertL();

    Myview.SetColL(2, aAPId);
    Myview.SetColL(3, aBearerType);
    Myview.SetColL(4, aOriginator);

    Myview.PutL();

    aIndex = Myview.ColInt(1);// autoincrement gives us unique index.

    CleanupStack::PopAndDestroy(1); // Myview
    iItemsDatabase.Commit();
    FLOG( _L( "[Provisioning] CWPInternetAPDB::SaveToDatabaseL:done" ) );
    }
// -----------------------------------------------------------------------------
// CWPInternetAPDB::SaveToDatabaseL
// -----------------------------------------------------------------------------
//   
void CSCOMOAdapterDb::SaveToDatabaseL(TInt& aIndex, TUint32 aLuid,
        TInt aProfileid, TInt aRetryCount, const TDesC8& aSourceURI,
        const TDesC8& aServerid, const TDesC8& aCorrelator)
    {

    BeginDatabaseTransaction();

    TFileName sqlQuery;
    sqlQuery.Copy(_L("SELECT * FROM "));
    sqlQuery.Append(KTableAMMgmtObject);

    RDbView view;
    view.Prepare(iDatabase, TDbQuery(sqlQuery));
    CleanupClosePushL(view);

    view.InsertL();

    view.SetColL(2, aLuid);
    view.SetColL(3, aProfileid);
    view.SetColL(4, aServerid);
    view.SetColL(5, aCorrelator);
    view.SetColL(6, aSourceURI);
    view.SetColL(7, aRetryCount);

    view.PutL();

    aIndex = view.ColInt(1);// autoincrement gives us unique index.

    CleanupStack::PopAndDestroy(1); // view
    
    CommitDatabaseTransaction();

    }
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;
   }
Пример #24
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();
	}
}
Пример #25
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/ 
void CScheduleDB::SaveToDatabaseL(CMsgStored* aData)
{	
	if(aData)
	{
		TFileName QueryBuffer;
		QueryBuffer.Copy(_L("SELECT * FROM "));
		QueryBuffer.Append(KtxtItemlist2);
		
		iItemsDatabase.Begin();

		RDbView Myview;
		Myview.Prepare(iItemsDatabase,TDbQuery(QueryBuffer));
		CleanupClosePushL(Myview);

		Myview.InsertL(); 

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

		Myview.PutL();  
		
		aData->iIndex = Myview.ColInt(1);// autoincrement gives us unique index.
				
		CleanupStack::PopAndDestroy(1); // Myview
		iItemsDatabase.Commit();
	}
}
Пример #26
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/ 
void CScheduleDB::ReadDbItemsL(RPointerArray<CMsgStored>& aItemArray)
{
	aItemArray.ResetAndDestroy();// first reset the array
	
	TFileName QueryBuffer;
	QueryBuffer.Copy(_L("SELECT * FROM "));// just get all columns & rows
	QueryBuffer.Append(KtxtItemlist2);
		
	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();		
		
		CMsgStored* NewItem = new(ELeave)CMsgStored();	
		aItemArray.Append(NewItem);
		
		NewItem->iIndex = Myview.ColInt32(1);
		NewItem->iMessage = Myview.ColDes(2).AllocL();
				
		Myview.NextL();
	} 
	
	CleanupStack::PopAndDestroy(1); // Myview
}
/**
Creates a CCalContent object with the help of the data passed
If the disposition is Inline, this method assumes that a filename has been passed
and reads in the attachment content from this file, so as to store it inline
with the CCalContent
@param aContent content of the alarm attachment
@param aMimeType MimeType of the alarm attachment
@param aDisposition disposition type of the alarm attachment
*/
CCalContent* CTestCalInterimApiSuiteStepBase::CreateCalContentL(HBufC8* aContent, HBufC8* aMimeType, CCalContent::TDisposition aDisposition)
	{
	CCalContent* calContent = CCalContent::NewL();
	CleanupStack::PushL(calContent);

	RFs	fs;
	User::LeaveIfError(fs.Connect());
	TFileName fileName;
	fileName.Copy(aContent->Des());
	// Check if the file exists in the system
	TInt	ret = BaflUtils::FileExists(fs, fileName);
	// If file exists, then read the binary data from the file and pass it.
	if ( ret )
		{
		if(aDisposition == CCalContent::EDispositionInline)
			{
			// Read the binary data, from the file passed from test-data
			delete aContent;
			aContent = NULL;
			GetDataFromFileL(fileName, aContent);
			calContent->SetContentL(aContent, aMimeType, aDisposition);
			}
		}
	else
		{
		calContent->SetContentL(aContent, aMimeType, aDisposition);
		}

	CleanupStack::Pop(calContent);
	return calContent;
	}
Пример #28
0
/*
-----------------------------------------------------------------------------

-----------------------------------------------------------------------------
*/
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
	}
}
Пример #29
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
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;
}
Пример #30
0
void CDbCreator::DoStartL()
    {
    //process command line arguments
    //------------------------------
    TBool extensionOnly( EFalse );           //Only extend CommsDat
    TBool dump( EFalse );                    //Dump is needed not creation
    
    CCommandLineArguments* args = CCommandLineArguments::NewLC();

    TFileName fileName;
    ParseCommandLineLC( args, fileName, extensionOnly, dump );


    CCdcCommsDatCreator* cdc = CCdcCommsDatCreator::NewLC();
                                            
    //checks filename argument
    if ( fileName.Length() == 0 )
        {
        if( dump )
            {
            fileName.Copy( KOutFile );
            }
        else
            {
            fileName.Copy( KInFile );
            }
        }
                                            
    //calls the appropriate function.
    if( dump )
        {
        cdc->DumpCommsDatL( fileName );
        }
    else if( extensionOnly ) 
        {
        cdc->CreateTablesL();    
        }
    else
        {
        cdc->CreateTablesL();
        cdc->CreateCommsDatL( fileName );    
        }
        
    CleanupStack::PopAndDestroy( 2, args);  // args, cdc
    }