コード例 #1
0
void CMobilePhone::RunL(void)
{
  TBuf16<128> string;
  if(iStatus==KErrNone)
  {
    string.Append(_L("Success."));
  }
  else
  {
    string.Append(_L("Error ("));
    string.AppendNum(iStatus.Int());
    string.Append(_L(")."));
  }
  ShowResult(string);
}
コード例 #2
0
// -----------------------------------------------------------------------------
// CSdDisk::ReleaseFiles
// This method deletes files created for filling the drive C
// 
// -----------------------------------------------------------------------------
void CSdDisk::ReleaseDisk(RFs& aFs)
    {
	// RDebug::Print(_L("Shareddatatest ## ReleaseDisk"));
	TInt i = 0;
	TInt err = KErrNone;
		
	do
	    {
		TBuf16<35> str;
		str.Copy(KFileName);
		str.AppendNum(i,EDecimal);
		
		err = aFs.Delete (str) ;
		
		i++;
	    }
	while ( err == KErrNone );
}
コード例 #3
0
TBool CTe_LbsIniFileReader::SetNextPoint()
{
    iIndex++;

    TBuf16<128> findText;

    findText.Zero();
    findText.Append(_L("["));
    findText.AppendNum(iIndex);
    findText.Append(_L("]"));

    iPoint = iPtr.Find(findText);

    if (iPoint == KErrNotFound)
    {
        return(EFalse);
    }

    return(ETrue);
}
コード例 #4
0
ファイル: pm_mapperapp.cpp プロジェクト: mpvader/qt
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
    {
    switch ( aCommand )
        {
        case EAknSoftkeyExit:
        case EEikCmdExit:
            Exit();
            break;
        case ECmdSwitchOutput:
            {
            HBufC* buffer = HBufC::NewLC( 100 );
            TPtr bufferPtr = buffer->Des();
            TBool last = ETrue;
            bufferPtr.Append(_L("Output switched to "));
            iFileOutputOn = !iFileOutputOn;
            if (iFileOutputOn)
                bufferPtr.Append(_L("file."));
            else
                bufferPtr.Append(_L("screen."));
            ShowL( *buffer, last );
            CleanupStack::PopAndDestroy( buffer );
            }
            break;
        case ECmdStatus:
            {
            ClearL();

            // layout
            HBufC* buffer = HBufC::NewLC( 100 );
            TPtr bufferPtr = buffer->Des();
            TBool last = ETrue;

            // Orientation
            bufferPtr.Append(_L("Orientation: "));
            bufferPtr.AppendNum((TInt)iAvkonAppUi->Orientation());
            ShowL( *buffer, last );
            bufferPtr.Zero();

            // Output
            bufferPtr.Append(_L("Output: "));
            if (iFileOutputOn) bufferPtr.Append(_L("File"));
            else bufferPtr.Append(_L("Screen"));
            ShowL( *buffer, last );
            bufferPtr.Zero();

            CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode();
            TInt hashValue = localAppScreenMode.ScreenStyleHash();
            TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation();
            TSize pixelSize = pixels.iPixelSize;

            bufferPtr.Append(_L("LayoutName: "));

            if ( (pixelSize.iWidth == 320 || pixelSize.iWidth == 240 )&&
                 (pixelSize.iHeight == 320 || pixelSize.iHeight == 240 ))
                 {
                if (hashValue==0x996F7AA7)
                    bufferPtr.Append(_L("QVGA2"));
                else
                    bufferPtr.Append(_L("QVGA1"));
                }
            else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 360 )&&
                    (pixelSize.iHeight == 360 || pixelSize.iHeight == 640 ))
                {
                bufferPtr.Append(_L("nHD"));
                }
            else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 480 )&&
                    (pixelSize.iHeight == 480 || pixelSize.iHeight == 640 ))
                {
                bufferPtr.Append(_L("VGA"));
                }
            else if ((pixelSize.iWidth == 352 || pixelSize.iWidth == 800 )&&
                    (pixelSize.iHeight == 800 || pixelSize.iHeight == 352 ))
                {
                bufferPtr.Append(_L("E90"));
                }
            else if ((pixelSize.iWidth == 320 || pixelSize.iWidth == 480 ||
                      pixelSize.iWidth == 240 || pixelSize.iWidth == 640 )&&
                    (pixelSize.iHeight == 320 || pixelSize.iHeight == 480 ||
                     pixelSize.iHeight == 240 || pixelSize.iHeight == 640))
                {
                bufferPtr.Append(_L("HVGA"));
                }
            else if ((pixelSize.iWidth == 480 || pixelSize.iWidth == 854 ||
                      pixelSize.iWidth == 848 || pixelSize.iWidth == 800 )&&
                    (pixelSize.iHeight == 800 || pixelSize.iHeight == 480 ||
                     pixelSize.iHeight == 848 || pixelSize.iHeight == 854))
                {
                bufferPtr.Append(_L("WVGA"));
                }
            else
                {
                bufferPtr.Append(_L("Unknown"));
                }

            ShowL( *buffer, last );
            bufferPtr.Zero();
            CleanupStack::PopAndDestroy( buffer );
            }
            break;
        case ECmdSwitchOrientation:
            {
            ClearL();
            HBufC* buffer = HBufC::NewLC( 100 );
            TPtr bufferPtr = buffer->Des();
            TBool last = ETrue;

            #ifndef __SERIES60_31__
            if (!iAvkonAppUi->OrientationCanBeChanged())
                {
                bufferPtr.Append(_L("Orientation cannot be changed."));
                ShowL( *buffer, last );
                bufferPtr.Zero();
                CleanupStack::PopAndDestroy( buffer );
                break;
                }
            #endif //__SERIES60_31__

            if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait)
                {
                iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
                }
            else if (iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationLandscape)
                {
                iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait);
                }
            else
                {
                // unspecified
                iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
                }
            bufferPtr.Append(_L("Orientation changed."));
            ShowL( *buffer, last );
            bufferPtr.Zero();
            CleanupStack::PopAndDestroy( buffer );
            break;
            }
        case ECmdStartCalculations:
            {
            ClearL();
            // Get known values
            TInt index = 0;
            TBool last = EFalse;
            if (iFileOutputOn)
                {
                TRect screenRect;
                AknLayoutUtils::LayoutMetricsRect(
                    AknLayoutUtils::EApplicationWindow,
                    screenRect );

                // Add screen dimensions
                TInt height = screenRect.Height();
                TInt width = screenRect.Width();
                TBuf16<32> tgt;
                // HEIGHT
                tgt.Append(_L("height: \t"));
                tgt.AppendNum(height, EDecimal); // put max height into text file
                ShowL( tgt, last );
                tgt.Zero();
                // WIDTH
                tgt.Append(_L("width: \t"));
                tgt.AppendNum(width, EDecimal); // put max width into text file
                ShowL( tgt, last );
                tgt.Zero();
                // VERSION
                TPixelMetricsVersion version = PixelMetrics::Version();
                tgt.Append(_L("major_version: \t"));
                tgt.AppendNum(version.majorVersion, EDecimal); // put major version into text file
                ShowL( tgt, last );
                tgt.Zero();
                tgt.Append(_L("minor_version: \t"));
                tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file
                ShowL( tgt, last );
                tgt.Zero();
                }

            TInt myValue = KErrNotFound;
            for (;;)
                {
                if (index==QStyle::PM_Custom_MessageBoxHeight)
                    {
                    last = ETrue;
                    }
                myValue = PixelMetrics::PixelMetricValue(static_cast<QStyle::PixelMetric>(index));
                ShowSingleValueL( index, myValue, last );

                if (last) break;
                // if last before custom values, "jump" to custom base
                if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase;
                index++;
                }
            }
            break;
        case ECmdCreateHeaderFile:
            CreateHeaderFileL();
            break;
        default:
            break;
        }
    }
コード例 #5
0
// -----------------------------------------------------------------------------
// CSdDisk::FillDisk()
// Fills the diskspace 
// 
// -----------------------------------------------------------------------------
void CSdDisk::FillDisk(RFs& aFs, TInt& aFreeDiskSpaceToLeave)
    {
	RFile iEaterFile;
	TInt fileSize(0);	
	TInt err(KErrNone);
	
	TReal64 diskFree = CheckDiskSpace(aFs);
	// RDebug::Print(_L("Shareddatatest ## Eat disk space") );
	
	// For loop to create eaterfiles
	for ( TInt i = 0 ; diskFree != 0 ; i++ )
	    {	
		TBuf16<30> str;
		str.Copy(KFileName);
		str.AppendNum(i,EDecimal);
			
		// RDebug::Print(_L("Shareddatatest ## Open file %s"), &str);
	
		err = iEaterFile.Open( aFs, str, EFileShareAny | EFileWrite );

		if ( err == KErrNotFound )	// file does not exist - create it
		    {
			err = iEaterFile.Create( aFs, str, EFileShareAny | EFileWrite );
		    }

		if ( err == KErrNone )
		    {
			// Create maximum size eaterfile if there is more disk space available than the maximum file size
			if ( diskFree > TReal64(KMaxTInt) )
			    {
				// RDebug::Print( _L("Shareddatatest ## Creating %d. EaterFile"), i+1);
				err = iEaterFile.SetSize( KMaxTInt );
				
				diskFree = diskFree - TReal64(KMaxTInt);
			    }
			
			// ... And if available disk space is less than maximum file size
			else
			    {
				// If aFreeDiskSpaceToLeave parameter says we have to leave some free disk
				if ( aFreeDiskSpaceToLeave != 0 )
				    {
					// RDebug::Print( _L("Shareddatatest ## Creating %d. EaterFile"), i+1);
					TInt sizeToSet = STATIC_CAST(TInt, I64INT(diskFree));
					err = iEaterFile.SetSize( sizeToSet - aFreeDiskSpaceToLeave * 1024 );
					iEaterFile.Size( fileSize );
					// RDebug::Print( _L("Shareddatatest ## Last EaterFileSize: %d"), fileSize);
					diskFree = 0;	
				    }
				
				// Otherwise try to eat all the disk space
				else
				    {
					// RDebug::Print( _L("Shareddatatest ## Creating %d. EaterFile"), i+1);
					TInt sizeToSet = STATIC_CAST(TInt, I64INT(diskFree));
					// RDebug::Print( _L("Shareddatatest ## Filesize in the end should be around %d bytes"), sizeToSet);
					
					for ( TInt j = 64 ; err != KErrDiskFull ; j-- )
					    {	
						err = iEaterFile.SetSize( sizeToSet - j * 1024 );
					    }
					iEaterFile.Size( fileSize );
					// RDebug::Print( _L("Shareddatatest ## Last EaterFileSize: %d bytes"), fileSize);
					// RDebug::Print( _L("Shareddatatest ## There should be %d bytes of free disk"),sizeToSet - fileSize);
					diskFree = 0;
				    }
			    }
		    }
		
		else
		    {
			RDebug::Print(_L("Shareddatatest ## Error = %d"), err);
			diskFree = 0;
		    }

		// RDebug::Print(_L("Shareddatatest ## Close file"));
		iEaterFile.Close();
	    }
    }