void CFriendLink::EnterModel(TInt atype)
{
//	atype += 1;

	TBuf<30>temptitle;
	temptitle.Zero();
	switch(atype)
	{
	case 0:
		{
			temptitle.Append(iMainEngine.GetDesById(ECoCoTextRes_MainView_Three));
			temptitle.Append(_L("->"));
			CNormalListBoxItem& item = (CNormalListBoxItem&)ilistbox->CurItem();

			temptitle.Append(item.GetText());
			CNewDownload* newdowload = CNewDownload::NewL(this,iMainEngine);
			newdowload->titlebuf.Zero();
			newdowload->titlebuf.Copy(temptitle);
			newdowload->iFirstID = EContentHotDownload;
			TInt tempsecondid = ilistbox->CurItemIndex();			
			newdowload->iSecondID = iMainEngine.GetSynchronContent().GetItemID(EContentHotDownload,tempsecondid,-1);
			newdowload->iThirdID = 0;
			newdowload->ConstructLater();
			newdowload->SetViewType(EContentHotDownload);
			this->SetChildWindow(newdowload);
		}
		break;
	case 1:
		{
			if(iFLinkType==0)
			{
				iPIndex=ilistbox->CurItemIndex();
				this->ChangeFriendLinkList(iPIndex);
			}
			else
			{
				TFileName downLoadUrl;
				downLoadUrl.Zero();
				downLoadUrl.Append(_L("http://59.36.96.182/interface/f?n="));
				downLoadUrl.Append(iMainEngine.GetIMEI());
				downLoadUrl.Append(_L("&id="));
				TInt firstid = EContentFriendLink;
				TInt secondid = iPIndex;
				TInt thirdid =this->ilistbox->CurItemIndex();
				TInt Urlid = iMainEngine.GetSynchronContent().GetItemID(firstid,secondid,thirdid);

				downLoadUrl.AppendNum(Urlid);
				downLoadUrl.Append(_L("&t="));
				downLoadUrl.AppendNum(1);
				this->iMainEngine.LaunchWapBrowswerL(downLoadUrl);
			}
		}
	    break;
	default:
	    break;
	}
}
Example #2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput )
    {
    MDesCArray* itemList = iListbox->Model()->ItemTextArray();
    CDesCArray* itemArray = ( CDesCArray* ) itemList;

    itemArray->AppendL( aString );

    iListbox->HandleItemAdditionL();
    iListbox->SetCurrentItemIndex( iCount );
    iCount++;
    if ( aLast )
        {
        if (aFileOutput)
            {
            RFile file;
            RFs& fs = CEikonEnv::Static()->FsSession();
            TFileName fileName =_L("Layout_");

            TRect screenRect;
            AknLayoutUtils::LayoutMetricsRect(
                AknLayoutUtils::EApplicationWindow,
                screenRect );

            // Add screen dimensions
            TInt height = screenRect.Height();
            TInt width = screenRect.Width();
            fileName.AppendNum(height);
            fileName.Append('_');
            fileName.AppendNum(width);

            fileName.Append(_L(".txt"));

            TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
            if (err==KErrNotFound) // file does not exist - create it
                err=file.Create(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
            else
                file.SetSize(0); //sweep the file
            TFileText textFile;
            textFile.Set(file);
            err = textFile.Seek(ESeekStart);
            if (err) User::InfoPrint(_L("File corrupted"));

            // Finally loop through all the entries:
            TInt idx = 0;
            for(;idx!=itemList->MdcaCount();idx++)
                {
                err = textFile.Write(itemList->MdcaPoint(idx));
                if (err) User::InfoPrint(_L("File corrupted"));
                }
            file.Close();
            }
        DrawNow();
        }
    }
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();
		}
	}
Example #4
0
static void TestMkDir()
{
    test.Next(_L("Benchmark MkDir"));
    ClearSessionDirectory();

    TTime startTime;
    TTime endTime;
    TTimeIntervalMicroSeconds timeTaken(0);
    startTime.HomeTime();

    const TInt KNumDirEntries = 100;
    for (TInt n=0; n<KNumDirEntries; n++)
    {
        TFileName dirName = _L("\\F32-TST\\DIR_");
        dirName.AppendNum(n);
        dirName.Append(_L("\\"));
        TInt r = TheFs.MkDir(dirName);
        test_KErrNone(r);
    }

    endTime.HomeTime();
    timeTaken=endTime.MicroSecondsFrom(startTime);
    TInt timeTakenInMs = I64LOW(timeTaken.Int64() / 1000);
    test.Printf(_L("Time taken to create %d entries = %d ms\n"), KNumDirEntries, timeTakenInMs);
}
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;
    }
Example #6
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();
}
Example #7
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;
}
Example #8
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();
	}
}
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
	}
// ============================================================================
// CIconConverter::GetTempIconName()
// Get temporary icon name
//
// @since 3.1
// ============================================================================
void CIconConverter::GetTempIconName( TInt aIndex, TFileName& aIconName )
    {
    _LIT( KIcon, "ICON" );
    _LIT( KBmp, ".MBM" );
    aIconName.Append( KIcon );
    aIconName.AppendNum( static_cast<TInt64>( aIndex ) );
    aIconName.Append( KBmp );
    }
Example #11
0
LOCAL_C TInt MakeFileName(TInt aThreadId, TInt aFileNumber, RFs & aFs, TFileName& aName, TBool aMakeDir)
//
// creates a file name and makes all the directory components, if required
//
	{
	
	TFileName path;
	path.Format(KPath, aThreadId);
	
	TChar driveLetter;
	TInt  r;
	r = aFs.DriveToChar(gDriveNumber, driveLetter);
	if (r != KErrNone)
		{
		LogError(r, KDriveToChar, KNullDesC, driveLetter, 0);
		aFs.Close();
		return(r);
		}
		
	path[0] = (TText) driveLetter;
	r = aFs.SetSessionPath(path);
	if (r != KErrNone)
		{
		LogError(r, KSetSessPath, path, 0, 0);
		aFs.Close();
		return(r);
		}
		
	// add additional directories
	TInt fileNumber;
	fileNumber = aFileNumber;
	r = AppendPath(path, fileNumber, 0);
	if(r != KErrNone)
		{
		LogError(r, KAppendPath, path, fileNumber, 0);
		aFs.Close();
		return(r);
		}
		
	if(aMakeDir)
		{
		r = aFs.MkDirAll(path);
		if (r != KErrNone && r != KErrAlreadyExists)
			{
			LogError(r, KMdAll, path, 0, 0);
			aFs.Close();
			return(r);
			}
		}
		
	// and finally add file name
	path.Append(KFilePrefix);
	path.AppendNum(aFileNumber);

	aName = path;
	return(KErrNone);
	}
Example #12
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/ 
void CScheduleDB::UpdateDatabaseL(CMsgSched* aData)
{	
	if(aData)
	{
		TFileName QueryBuffer;
		QueryBuffer.Copy(_L("SELECT * FROM "));
		QueryBuffer.Append(KtxtItemlist);
		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->iUnicode)
				Myview.SetColL(2,0x100);
			else
				Myview.SetColL(2,0x000);
		    
		    if(aData->iNunmber)
		    	Myview.SetColL(3,*aData->iNunmber);
		    
		    if(aData->iMessage)
		    	Myview.SetColL(4,*aData->iMessage);
			
			Myview.SetColL(5,aData->iTime);
			Myview.SetColL(6,aData->iRepeat);
			
			if(aData->iEnabled)
				Myview.SetColL(7,0x100);
			else
				Myview.SetColL(7,0x000);

			if(aData->iFlashSMS)
				Myview.SetColL(8,0x100);
			else
				Myview.SetColL(8,0x000);
				
			Myview.PutL();
		}
				
		CleanupStack::PopAndDestroy(1); // Myview
		iItemsDatabase.Commit();
	}
}
void CZXingBarcodeReaderAppView::StorePicture( TDesC8* aData )
	{
	// Create path for filename
	TFileName path = PathInfo::PhoneMemoryRootPath(); 
	path.Append(PathInfo::ImagesPath());

	// Ensure that path exists
	BaflUtils::EnsurePathExistsL(iEikonEnv->FsSession(),path);

	// Get next free filename for the image
	TFileName fileToSave;
	TBool fileExists = ETrue;
	for (TInt i=1 ; i<100 ; i++)
		{
	fileToSave.Copy(path);
	fileToSave.Append(_L("cw_image_"));
	fileToSave.AppendNum(i);
	fileToSave.Append(_L(".jpg"));
	fileExists = BaflUtils::FileExists(iEikonEnv->FsSession(),fileToSave);
	if (!fileExists)
		{
	break;
		}
		}

	// Save file
	if (!fileExists)
		{
	RFile file;
	TInt err = file.Create(iEikonEnv->FsSession(),fileToSave,EFileWrite);
	if (!err)
		{
	file.Write(*aData);
	file.Close();
	SetTitle(fileToSave);
		}
	else
		{
	SetError(_L("File saving error %d"),err);
		}
		}
	else
		{
	SetTitle(_L("File not saved, delete old pictures!"));
		}
	}
// -----------------------------------------------------------------------------
// CWPInternetAPDB::DeleteFromDatabaseL
// -----------------------------------------------------------------------------
//
TBool CWPInternetAPDB::DeleteFromDatabaseL(TUint aAPId)
    {
    FLOG( _L( "[Provisioning] CWPInternetAPDB::DeleteFromDatabaseL" ) );
    TBool rowsdeleted = EFalse;
    TFileName QueryBuffer;
    QueryBuffer.Copy(_L("SELECT * FROM "));
    QueryBuffer.Append(KtxtItemlist);
    QueryBuffer.Append(_L(" WHERE "));
    QueryBuffer.Append(NCol2);
    QueryBuffer.Append(_L(" = "));
    QueryBuffer.AppendNum(aAPId);

    iItemsDatabase.Begin();

    RDbView Myview;
    // query buffer with index finds only the selected item row.
    Myview.Prepare(iItemsDatabase, TDbQuery(QueryBuffer));
    CleanupClosePushL(Myview);

    Myview.EvaluateAll();
    if( Myview.FirstL())
    {
    	if (!Myview.IsEmptyL())
        {
        // 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();
            }

        iItemsDatabase.Commit();
        // compacts the databse, by physically removig deleted data.
        iItemsDatabase.Compact();
        rowsdeleted = ETrue;
        }
    }
    CleanupStack::PopAndDestroy(1); // Myview

    FLOG( _L( "[Provisioning] CWPInternetAPDB::DeleteFromDatabaseL: done" ) );
    return rowsdeleted;
    }
Example #15
0
LOCAL_C TInt AppendPath(TFileName& aPath, TInt aNumber, TInt aLevel)
//
// helper function for MakeFileName()
//
	{
	
	if(aNumber > KMaxFilesPerDirectory)
		{
		aNumber /= KMaxFilesPerDirectory;
		AppendPath(aPath, aNumber, aLevel + 1);
		}
		
	if(aLevel)
		{	
		aPath.AppendNum(aNumber % KMaxFilesPerDirectory);	
		aPath.Append('\\');	
		}
	
	return(KErrNone);
	}
void CSenServiceDispatcher::OpenDispatcherLogL()
    {
#ifdef _SENDEBUG
    RThread thread;
    RProcess process;
    TFileName logFile;
    logFile.Append( KSenDispactherThreadLog().Left(KSenDispactherThreadLog().Length()-4) ); // exclude ".log" file extension
    logFile.AppendNum( iConnectionID );
    logFile.Append( KSenUnderline );
    logFile.Append( process.Name().Left(32));
    logFile.Append( KSenUnderline );
    logFile.Append( thread.Name().Left(20));
    logFile.Append( KSenDispactherThreadLog().Right(4) ); // postfix with ".log" file extension

    // Open connection to the file logger server
    TLSLOG_OPEN( KSenDispatcherLogChannel, KSenDispatcherLogLevel, KSenDispactherThread, logFile );
    TLSLOG_L(KSenDispatcherLogChannel, KSenDispatcherLogLevel, "CSenServiceDispatcher::ExecuteL - About to create new dispatcher thread..");
    TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, 
                                _L("- Connection ID: (%d)"), iConnectionID));
#endif
    }
Example #17
0
TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) const
{
    aFileHandle.Seek(ESeekStart);
    // Layout data is deployed like this:
    // first line - height
    // second line - width
    TFileName lines;
    TFileName layoutName;

    TInt height = -666;
    TInt width = -666;
    // Collect name information.
    for (TInt i=0; i<6; i++)
        {
        User::LeaveIfError(aFileHandle.Read(lines));
        // Remove pixel metrics name and ":"
        lines = lines.Mid(lines.Find(KColon)+1);
        // Remove tab
        lines = lines.Mid(lines.Find(KTab)+1);
        TLex myLexer(lines);
        TInt error = KErrNone;
        if (i==0) //height is first
            {
            error = myLexer.Val(height);
            }
        if (i==1) //width is second
            {
            error = myLexer.Val(width);
            }
        User::LeaveIfError(error);
        }

    // Interpret results and write name to buffer.
    if ( (width == 240 && height == 320) ||
         (width == 320 && height == 240))
        {
        layoutName.Append(_L("QVGA "));
        }
    else if ( (width == 360 && height == 640) ||
         (width == 640 && height == 360))
        {
        layoutName.Append(_L("NHD "));
        }
    else if ( (width == 480 && height == 640) ||
         (width == 640 && height == 480))
        {
        layoutName.Append(_L("VGA "));
        }
    else if ( (width == 800 && height == 352) ||
         (width == 352 && height == 800))
        {
        layoutName.Append(_L("E90 "));
        }
    else if ( (width == 800 && height == 480) ||
         (width == 480 && height == 800) ||
         (width == 848 && height == 480) ||
         (width == 480 && height == 848) ||
         (width == 854 && height == 480) ||
         (width == 480 && height == 854))
        {
        layoutName.Append(_L("WVGA "));
        }
    else if ( (width == 480 && height == 320) ||
         (width == 320 && height == 480) ||
         (width == 640 && height == 240) ||
         (width == 240 && height == 640))
        {
        layoutName.Append(_L("HVGA "));
        }
    else
        {
        layoutName.Append(_L("Unknown "));
        layoutName.AppendNum(height);
        layoutName.Append(_L("x"));
        layoutName.AppendNum(width);
        }
    if (width > height)
        {
        layoutName.Append(_L("Landscape"));
        }
    else
        {
        layoutName.Append(_L("Portrait"));
        }
    return layoutName;
    }