TPtrC CTestImpExvCardSuiteStepBase::GetExpectedUTCFromIniL(TInt numberOfCases,TBuf<80> aConfig, TBool aExpectedBDay)
	{
	TPtrC expectedUTC;
	TPtrC expectedBDAY;
	
	TPtrC config = aConfig;
	HBufC *configval = HBufC::NewLC(config.Length()+2);
	
	TPtr configSection = configval->Des();
	
	configSection.Append(config);
	configSection.AppendNum(numberOfCases);
	
	if (aExpectedBDay)
		{
		GetStringFromConfig(configSection,KExpectedBDay,expectedBDAY);
		CleanupStack::PopAndDestroy(configval);
		return expectedBDAY;
		}
	else
		{
		GetStringFromConfig(configSection,KExpectedUTC,expectedUTC);
		CleanupStack::PopAndDestroy(configval);
		return expectedUTC;
		}
	}
Exemplo n.º 2
0
void CSliderForDialog :: Draw( const TRect& /*aRect*/ ) const
{
   // ��������� ��������
   TRect rect = Rect();
   TInt runner_w = iMaxLbWidth + 2 * iDelimiter + 2 * iBvThickness;
   TInt runner_h = font->HeightInPixels() + 2 * iDelimiter + 2 * iBvThickness;
   TInt x_offs = rect.iTl.iX + iBvThickness + runner_w / 2;
 
   TPoint line_A( x_offs + 2, rect.iTl.iY + rect.Height() / 2 ),
          line_B( rect.iBr.iX - runner_w / 2 - 2, line_A.iY );
 
   TInt  runner_c = line_A.iX + iValue * ( line_B.iX - line_A.iX ) / iMaxVal;
   TRect iRunner_rect=TRect( runner_c  - runner_w / 2,
                      line_A.iY - runner_h / 2,
                      runner_c  + runner_w / 2,
                      line_A.iY + runner_h / 2 );
 
   TBufC<50> tmpLabel;	
   TPtr tmpPtr = tmpLabel.Des();
   tmpPtr.Append( iLabel );
   tmpPtr.AppendNum( iValue );
 
   TRgb penColor, brushColor;
   if( IsFocused() )
   { 
      penColor = KRgbBlack;
      brushColor = KRgbRed;
   }
   else
   {
      penColor = KRgbWhite;
      brushColor = KRgbGray;
   }
   CWindowGc& gc = SystemGc();
   //Window().SetTransparencyAlphaChannel();
   //TRgb c(0,0,0,0);
   //Window().SetBackgroundColor(c);
   //gc.Clear();
   
   gc.SetPenSize( TSize( iBvThickness, iBvThickness ) );   
   gc.SetPenStyle( CGraphicsContext :: ENullPen );
   gc.SetPenColor( penColor );   
   gc.SetBrushStyle( CGraphicsContext :: ESolidBrush );
   gc.SetPenStyle( CGraphicsContext :: ESolidPen );
 
   gc.DrawLine( line_A, line_B );
 
   gc.SetBrushColor( brushColor );
   gc.DrawRoundRect( iRunner_rect, TSize( 4, 4 ) );   
 
   gc.UseFont( font );   
   gc.DrawText( tmpLabel, TPoint( iRunner_rect.iTl.iX + iDelimiter + iBvThickness, 
	                          iRunner_rect.iBr.iY - iDelimiter - iBvThickness ) );   
}
Exemplo n.º 3
0
TInt CSpecialLog::SaveL(void)
{
	// Open file.
	TFileName filename;
	filename.Copy(KSpecialLogPath);
	filename.Append(KSpecialLogFile);
	RFile file;
	TInt result = file.Replace(* iFs, filename, EFileWrite);
	if (KErrNone != result)
	{
		return result;
	}

	// Write file
	TFileText fileText;
	fileText.Set(file);
	HBufC* buffer = HBufC::NewLC(KSpecialLogLineBufferSize);
	TPtr line = buffer->Des();

	line.Copy(KSpecialLogSection);					// Write section header.
	fileText.Write(line);

	for (TInt i = 0; i < iLogSpecial.Count(); i ++)	// Write all special log entries.
	{
		const RLogSpecial & entry = iLogSpecial[i];
		// Write key (text if defined, otherwise index)
		if (i < KNumSpecialLogKeys)
			line.Copy((const TUint16 *) KSpecialLogKeyText[i]);	// TODO: Fix the cast.
		else
			line.Num(i);

		line.Append(_L("="));
		// Write value.
		if (ESpecialLogInt == entry.iType)
			line.AppendNum(entry.iInt);
		else
			line.Append(* entry.iText);

		result = fileText.Write(line);
		if (result != KErrNone)
			break;
	}
	CleanupStack::PopAndDestroy(buffer);
	file.Close();

	if (KErrEof == result) result = KErrNone;

	iState = ESaved;

	// Bubble result of TFileText::Write().
	return result;
}
Exemplo n.º 4
0
// -----------------------------------------------------------------------------
// CLandmarksModel::FormatListItemLC
// Formats a list item to the following format "X\tlandmarkName\t"
// where X = icon index
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
HBufC* CLandmarksModel::FormatListItemLC(CPosLandmark& aLandmark)
    {
    // Extract name
    TPtrC name;
    aLandmark.GetLandmarkName(name);
    // 10 extra chars for icon index and column separator
    const TInt KExtraChars = 10;
    HBufC* formattedNameBuf = HBufC::NewLC(name.Length() + KExtraChars);
    TPtr formattedNamePtr = formattedNameBuf->Des();

    // Extract icon info
    TPtrC mbmIconFile;
    TInt iconIndex, maskIndex;
    TInt res = aLandmark.GetIcon(mbmIconFile, iconIndex, maskIndex);

    // Format list item
    if (res == KErrNone)
        {
        // Create icon and append it to icon array. 
        TRAPD(err, AppendIconL(mbmIconFile, iconIndex, maskIndex));
        if (err == KErrNone)
            {
            // Append the array index where the icon is appended
            formattedNamePtr.AppendNum(iIconList->Count() - 1);
            }
        else
            {
            formattedNamePtr.AppendNum(KDefaultIconIndex);
            }
        }
    else // res == KErrNotFound
        {
        formattedNamePtr.AppendNum(KDefaultIconIndex);
        }
    formattedNamePtr.Append(KTab);
    formattedNamePtr.Append(name);

    return formattedNameBuf;
    }
Exemplo n.º 5
0
TPtrC CTestExBDayLocal::GetPhoneL(TInt numberOfCases)
	{
	TPtrC phone;
	
	TPtrC config = KVCard();
	HBufC *configval = HBufC::NewLC(config.Length()+2);
	
	TPtr configSection = configval->Des();
	
	configSection.Append(config);
	configSection.AppendNum(numberOfCases);
	
	GetStringFromConfig(configSection,KPhone,phone);
	
	CleanupStack::PopAndDestroy(configval);
	
	return phone;
	}
void CSpaceInvadersAppView::DrawPoints(CWindowGc& aGc) const
{
    TRgb pencolor = TRgb(255,255,255);
    aGc.SetPenColor(pencolor);
    _LIT(KPointsText, "Points: ");

    TBufC<15> pointsText;
    TPtr pointsPtr = pointsText.Des();
    pointsPtr.Append(KPointsText);
    pointsPtr.AppendNum(iHolder->ActivePoints());

    const CFont* menuFont =
        AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL);
    aGc.UseFont(menuFont);
    TInt textLength = menuFont->TextWidthInPixels(pointsPtr);
    TInt textHeight = menuFont->HeightInPixels();
    TPoint textpoint(Rect().Width() / 2 - textLength / 2, textHeight);
    aGc.DrawText(pointsPtr, textpoint);
}
Exemplo n.º 7
0
/**
converts contents of a contact item field to a string
*/
HBufC *CContactViewTest::FieldStringLC(const CContactItemField &aField)
	{
	HBufC *buf = NULL;
	if( aField.IsTemplateLabelField() )
		{
		buf = HBufC::NewLC(0);
		return buf;
		}
	switch(aField.StorageType())
		{
		case KStorageTypeText:
			{
			buf = HBufC::NewLC(aField.Label().Length()+2);
			TPtr ptr = buf->Des();
			ptr.Append( aField.Label() );
			}
		break;
		case KStorageTypeContactItemId:
			{
			buf = HBufC::NewLC(20);//assume cid < 20 digits
			TContactItemId cid = aField.AgentStorage()->Value();
			TPtr ptr = buf->Des();
			ptr.AppendNum(cid);
			}
		break;
		case KStorageTypeStore:
		case KStorageTypeDateTime:
			{
			buf = HBufC::NewLC(0);//views dont care about date/time or binary fields
			}
		break;
		default:
			{
			_LIT(KCCVTest,"CCVTest");
			User::Panic(KCCVTest , EInvariantFalse );
			}
		break;
		}
	return buf;

	}
Exemplo n.º 8
0
void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast )
    {
    HBufC* buffer = HBufC::NewLC( 100 );
    TPtr bufferPtr = buffer->Des();

    switch (aPixelMetric)
        {
        case QStyle::PM_DockWidgetTitleMargin:
            bufferPtr.Append(_L("DockTitleMargin: "));
            break;
        case QStyle::PM_DockWidgetTitleBarButtonMargin:
            bufferPtr.Append(_L("DockTitleBtnMargin: "));
            break;
        case QStyle::PM_ButtonMargin:
            bufferPtr.Append(_L("ButtonMargin: "));
            break;
        case QStyle::PM_ButtonDefaultIndicator:
            bufferPtr.Append(_L("ButtonDefaultIndicator: "));
            break;
        case QStyle::PM_MdiSubWindowFrameWidth:
            bufferPtr.Append(_L("MdiSubWndFrameW: "));
            break;
        case QStyle::PM_ComboBoxFrameWidth:
            bufferPtr.Append(_L("ComboBoxFrameWidth: "));
            break;
        case QStyle::PM_SpinBoxFrameWidth:
            bufferPtr.Append(_L("SpinBoxFrameWidth: "));
            break;
        case QStyle::PM_DefaultFrameWidth:
            bufferPtr.Append(_L("DefaultFrameWidth: "));
            break;
        case QStyle::PM_RadioButtonLabelSpacing:
            bufferPtr.Append(_L("RadioButtonLabelSpc: "));
            break;
        case QStyle::PM_CheckBoxLabelSpacing:
            bufferPtr.Append(_L("CheckBoxLabelSpacing: "));
            break;
        case QStyle::PM_ToolTipLabelFrameWidth:
            bufferPtr.Append(_L("ToolTipLabelFrameW: "));
            break;
        case QStyle::PM_ListViewIconSize:
            bufferPtr.Append(_L("ListViewIconSize: "));
            break;
        case QStyle::PM_LargeIconSize:
            bufferPtr.Append(_L("LargeIconSize: "));
            break;
        case QStyle::PM_IconViewIconSize:
            bufferPtr.Append(_L("IconViewIconSize: "));
            break;
        case QStyle::PM_TabBarIconSize:
            bufferPtr.Append(_L("TabBarIconSize: "));
            break;
        case QStyle::PM_MessageBoxIconSize:
            bufferPtr.Append(_L("MessageBoxIconSize: "));
            break;
        case QStyle::PM_ButtonIconSize:
            bufferPtr.Append(_L("ButtonIconSize: "));
            break;
        case QStyle::PM_TextCursorWidth:
            bufferPtr.Append(_L("TextCursorWidth: "));
            break;
        case QStyle::PM_SliderLength:
            bufferPtr.Append(_L("SliderLength: "));
            break;
        case QStyle::PM_SliderThickness:
            bufferPtr.Append(_L("SliderThickness: "));
            break;
        case QStyle::PM_SliderTickmarkOffset:
            bufferPtr.Append(_L("SliderTickmarkOffset: "));
            break;
        case QStyle::PM_SliderControlThickness:
            bufferPtr.Append(_L("SliderCntrlThickness: "));
            break;
        case QStyle::PM_SliderSpaceAvailable:
            bufferPtr.Append(_L("SliderSpaceAvailable: "));
            break;
        case QStyle::PM_MenuBarItemSpacing:
            bufferPtr.Append(_L("MenuBarItemSpacing: "));
            break;
        case QStyle::PM_MenuBarHMargin:
            bufferPtr.Append(_L("MenuBarHMargin: "));
            break;
        case QStyle::PM_MenuBarVMargin:
            bufferPtr.Append(_L("MenuBarVMargin: "));
            break;
        case QStyle::PM_ToolBarItemSpacing:
            bufferPtr.Append(_L("ToolBarItemSpacing: "));
            break;
        case QStyle::PM_ToolBarFrameWidth:
            bufferPtr.Append(_L("ToolBarFrameWidth: "));
            break;
        case QStyle::PM_ToolBarItemMargin:
            bufferPtr.Append(_L("ToolBarItemMargin: "));
            break;
        case QStyle::PM_LayoutLeftMargin:
            bufferPtr.Append(_L("LayoutLeftMargin: "));
            break;
        case QStyle::PM_LayoutRightMargin:
            bufferPtr.Append(_L("LayoutRightMargin: "));
            break;
        case QStyle::PM_LayoutTopMargin:
            bufferPtr.Append(_L("LayoutTopMargin: "));
            break;
        case QStyle::PM_LayoutBottomMargin:
            bufferPtr.Append(_L("LayoutBottomMargin: "));
            break;
        case QStyle::PM_LayoutHorizontalSpacing:
            bufferPtr.Append(_L("LayoutHSpacing: "));
            break;
        case QStyle::PM_LayoutVerticalSpacing:
            bufferPtr.Append(_L("LayoutVSpacing: "));
            break;
        case QStyle::PM_MaximumDragDistance:
            bufferPtr.Append(_L("MaxDragDistance: "));
            break;
        case QStyle::PM_ScrollBarExtent:
            bufferPtr.Append(_L("ScrollBarExtent: "));
            break;
        case QStyle::PM_ScrollBarSliderMin:
            bufferPtr.Append(_L("ScrollBarSliderMin: "));
            break;
        case QStyle::PM_MenuBarPanelWidth:
            bufferPtr.Append(_L("MenuBarPanelWidth: "));
            break;
        case QStyle::PM_ProgressBarChunkWidth:
            bufferPtr.Append(_L("ProgBarChunkWidth: "));
            break;
        case QStyle::PM_TabBarTabOverlap:
            bufferPtr.Append(_L("TabBarTabOverlap: "));
            break;
        case QStyle::PM_TabBarTabHSpace:
            bufferPtr.Append(_L("TabBarTabHSpace: "));
            break;
        case QStyle::PM_TabBarTabVSpace:
            bufferPtr.Append(_L("TabBarTabVSpace: "));
            break;
        case QStyle::PM_TabBarBaseHeight:
            bufferPtr.Append(_L("TabBarBaseHeight: "));
            break;
        case QStyle::PM_TabBarBaseOverlap:
            bufferPtr.Append(_L("TabBarBaseOverlap: "));
            break;
        case QStyle::PM_TabBarScrollButtonWidth:
            bufferPtr.Append(_L("TabBarScrollBtnWidth: "));
            break;
        case QStyle::PM_TabBarTabShiftHorizontal:
            bufferPtr.Append(_L("TabBarTabShiftH: "));
            break;
        case QStyle::PM_TabBarTabShiftVertical:
            bufferPtr.Append(_L("TabBarTabShiftV: "));
            break;
        case QStyle::PM_MenuPanelWidth:
            bufferPtr.Append(_L("MenuPanelWidth: "));
            break;
        case QStyle::PM_MenuHMargin:
            bufferPtr.Append(_L("MenuHMargin: "));
            break;
        case QStyle::PM_MenuVMargin:
            bufferPtr.Append(_L("MenuVMargin: "));
            break;
        case QStyle::PM_MenuDesktopFrameWidth:
            bufferPtr.Append(_L("MenuFrameWidth: "));
            break;
        case QStyle::PM_SmallIconSize:
            bufferPtr.Append(_L("SmallIconSize: "));
            break;
        case QStyle::PM_FocusFrameHMargin:
            bufferPtr.Append(_L("FocusFrameHMargin: "));
            break;
        case QStyle::PM_FocusFrameVMargin:
            bufferPtr.Append(_L("FocusFrameVMargin: "));
            break;
        case QStyle::PM_ToolBarIconSize:
            bufferPtr.Append(_L("ToolBarIconSize: "));
            break;
        case QStyle::PM_TitleBarHeight: // use titlepane height
            bufferPtr.Append(_L("TitleBarHeight: "));
            break;
        case QStyle::PM_IndicatorWidth:
            bufferPtr.Append(_L("IndicatorWidth: "));
            break;
        case QStyle::PM_IndicatorHeight:
            bufferPtr.Append(_L("IndicatorHeight: "));
            break;
        case QStyle::PM_ExclusiveIndicatorHeight:
            bufferPtr.Append(_L("ExclusiveIndHeight: "));
            break;
        case QStyle::PM_ExclusiveIndicatorWidth:
            bufferPtr.Append(_L("ExclusiveIndWidth: "));
            break;
        case QStyle::PM_HeaderMargin: // not in S60
            bufferPtr.Append(_L("HeaderMargin: "));
            break;
        case QStyle::PM_MenuScrollerHeight: // not in S60
            bufferPtr.Append(_L("MenuScrollerHeight: "));
            break;
        case QStyle::PM_MenuTearoffHeight: // not in S60
            bufferPtr.Append(_L("MenuTearoffHeight: "));
            break;
        case QStyle::PM_DockWidgetFrameWidth: // not in S60
            bufferPtr.Append(_L("DockFrameWidth: "));
            break;
        case QStyle::PM_DockWidgetSeparatorExtent: // not in S60
            bufferPtr.Append(_L("DockSepExtent: "));
            break;
        case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60
            bufferPtr.Append(_L("MdiSubWndMinWidth: "));
            break;
        case QStyle::PM_HeaderGripMargin: // not in S60
            bufferPtr.Append(_L("HeaderGripMargin: "));
            break;
        case QStyle::PM_SplitterWidth: // not in S60
            bufferPtr.Append(_L("SplitterWidth: "));
            break;
        case QStyle::PM_ToolBarExtensionExtent: // not in S60
            bufferPtr.Append(_L("ToolBarExtExtent: "));
            break;
        case QStyle::PM_ToolBarSeparatorExtent: // not in S60
            bufferPtr.Append(_L("ToolBarSepExtent: "));
            break;
        case QStyle::PM_ToolBarHandleExtent: // not in s60
            bufferPtr.Append(_L("ToolBarHandleExtent: "));
            break;
        case QStyle::PM_MenuButtonIndicator: // none???
            bufferPtr.Append(_L("MenuButtonIndicator: "));
            break;
        case QStyle::PM_ButtonShiftHorizontal: //none in 3.x
            bufferPtr.Append(_L("ButtonShiftHorizontal: "));
            break;
        case QStyle::PM_ButtonShiftVertical: // none in 3.x
            bufferPtr.Append(_L("ButtonShiftVertical: "));
            break;
        case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together
            bufferPtr.Append(_L("TabScrollBtnOverlap: "));
            break;
        case QStyle::PM_SizeGripSize: // use default
            bufferPtr.Append(_L("SizeGripSize: "));
            break;
        case QStyle::PM_DockWidgetHandleExtent:
            bufferPtr.Append(_L("DockWdgtHandleExt: "));
            break;
        case QStyle::PM_CheckListButtonSize:
            bufferPtr.Append(_L("CheckListButtonSize: "));
            break;
        case QStyle::PM_CheckListControllerSize:
            bufferPtr.Append(_L("CheckListCntlerSize: "));
            break;
        case QStyle::PM_DialogButtonsSeparator:
            bufferPtr.Append(_L("DialogBtnSeparator: "));
            break;
        case QStyle::PM_DialogButtonsButtonWidth:
            bufferPtr.Append(_L("DialogBtnWidth: "));
            break;
        case QStyle::PM_DialogButtonsButtonHeight:
            bufferPtr.Append(_L("DialogBtnHeight: "));
            break;
        case QStyle::PM_HeaderMarkSize:
            bufferPtr.Append(_L("HeaderMarkSize: "));
            break;
        case QStyle::PM_SpinBoxSliderHeight:
            bufferPtr.Append(_L("SpinBoxSliderHeight: "));
            break;
        case QStyle::PM_DefaultTopLevelMargin:
            bufferPtr.Append(_L("DefaultTopLvlMrg: "));
            break;
        case QStyle::PM_DefaultChildMargin:
            bufferPtr.Append(_L("DefaultChildMrg: "));
            break;
        case QStyle::PM_DefaultLayoutSpacing:
            bufferPtr.Append(_L("DefaultlayoutSpc: "));
            break;
        case QStyle::PM_TabCloseIndicatorWidth:
            bufferPtr.Append(_L("TabCloseIndWidth: "));
            break;
        case QStyle::PM_TabCloseIndicatorHeight:
            bufferPtr.Append(_L("TabCloseIndHeight: "));
            break;
        case QStyle::PM_ScrollView_ScrollBarSpacing:
            bufferPtr.Append(_L("ScrollViewBarSpc: "));
            break;
        case QStyle::PM_SubMenuOverlap:
            bufferPtr.Append(_L("SubMenuOverlap: "));
            break;
        case QStyle::PM_Custom_FrameCornerHeight:
            bufferPtr.Append(_L("C_FrCornerHeight: "));
            break;
        case QStyle::PM_Custom_FrameCornerWidth:
            bufferPtr.Append(_L("C_FrCornerWidth: "));
            break;
        case QStyle::PM_Custom_ThinLineWidth:
            bufferPtr.Append(_L("C_ThinLineWidth: "));
            break;
        case QStyle::PM_Custom_BoldLineWidth:
            bufferPtr.Append(_L("C_BoldLineWidth: "));
            break;
        case QStyle::PM_Custom_MessageBoxHeight:
            bufferPtr.Append(_L("C_MsgBoxHeight: "));
            break;
        default:
            bufferPtr.Append(_L("Default: "));
            break;
        }

    if (iFileOutputOn)
        {
        bufferPtr.Append('\t');
        }
    bufferPtr.AppendNum(aValue);
    bufferPtr.Append(_L(" "));
    ShowL( *buffer, aLast, iFileOutputOn );
    CleanupStack::PopAndDestroy( buffer );
    }
Exemplo n.º 9
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
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;
        }
    }
Exemplo n.º 10
0
void CLowDiskSpaceTest::FillDiskL()
	{
	_LIT(KFillDiskTitle, "Fill the disk");
	test.Next(_L("Fill the disk"));

	
	TVolumeInfo tv;
	User::LeaveIfError( iFileSession.Volume(tv) );
	
	TInt frees = 0;
	iManyFiles = tv.iFree / KMaxTInt;
	
	if ( iManyFiles > 0)
		{
		TPtrC tname( KFileName );
		TInt i = 0;
		for( ; i < iManyFiles; ++i )
			{
			HBufC *fval=HBufC::NewLC( tname.Length()+4 );//assume #files < 10000
			TPtr fptr = fval->Des() ;
			fptr.Append( tname );
			fptr.AppendNum( i );
			
			User::LeaveIfError( iFile->Replace( iFileSession, fptr, EFileWrite ) );
			User::LeaveIfError( iFile->SetSize( KMaxTInt ) );
			iFile->Close();
			
			CleanupStack::PopAndDestroy( fval );
			}
		User::LeaveIfError( iFileSession.Volume(tv) );
		
		frees = tv.iFree - KMinusFull ;
		if( frees <= 0 )
			{
			frees = tv.iFree;
			}
		User::LeaveIfError( iFile->Replace( iFileSession, KFileName, EFileWrite ) );
		
	#ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
		TInt err = KErrDiskFull;
		while(err == KErrDiskFull)
			{
			err = iFile->SetSize(frees);
			frees -= 100;
			if(frees <= 0)
				{
				break;	
				}
			}
	#else
		User::LeaveIfError( iFile->SetSize( frees ) );
	#endif
	
		iFile->Close(); 
		}
	else
		{
		frees = tv.iFree - KMinusFull ;
		if( frees <= 0 )
			{
			frees = tv.iFree;
			}
		User::LeaveIfError( iFile->Replace( iFileSession, KFileName, EFileWrite ) );

	#ifdef __SYMBIAN_CNTMODEL_USE_SQLITE__
		TInt err = KErrDiskFull;
		while(err == KErrDiskFull)
			{
			err = iFile->SetSize(frees);
			frees -= 100;
			if(frees <= 0)
				{
				break;	
				}
			}
	#else
		User::LeaveIfError( iFile->SetSize( frees ) );
	#endif
				
		iFile->Close();
		}
	}
// -----------------------------------------------------------------------------
// 
// -----------------------------------------------------------------------------
//
void CMCETestUISessionViewContainer::DoShowMenuL()
    {
    if ( iContextMenuAlreadyShown )
        {
        iContextMenuAlreadyShown = EFalse;
        return;
        }
        
    // Get command provider
    MMCETestUIEngineCmdProvider& cmdProvider = 
        iListBoxModel->CmdProvider( iListBox->CurrentItemIndex() );
    
    // Get commands    
    const RPointerArray<TMCETestUIEngineCmdBase>& commands = 
        cmdProvider.GetCommandsL();


    // Generate list
    CAknSinglePopupMenuStyleListBox* listBox = 
            new (ELeave) CAknSinglePopupMenuStyleListBox;   
    CleanupStack::PushL( listBox );
    
    CAknPopupList* popup = CAknPopupList::NewL( 
            listBox, 
            R_AVKON_SOFTKEYS_MENU_LIST,
            AknPopupLayouts::EPopupSNotePopupWindow );
    CleanupStack::PushL( popup );
    popup->SetTitleL( _L("Available commands") );
        
    listBox->ConstructL( popup, 
        EAknListBoxSelectionList | EAknListBoxLoopScrolling);
    
    listBox->CreateScrollBarFrameL( ETrue );
    listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
    
    CDesCArray* array = new (ELeave) CDesCArrayFlat( 1 );
    CleanupStack::PushL( array );
    
    for ( TInt i = 0; i < commands.Count(); ++i )
        {
        TInt itemLength = commands[i]->Caption().Length() + 
                          KTab().Length();
        HBufC* item = HBufC::NewLC( itemLength );
        TPtr itemPtr = item->Des();
        itemPtr.Append( commands[i]->Caption() );
        itemPtr.Append( KTab );

        array->AppendL( *item );

        CleanupStack::PopAndDestroy( item );
        item = NULL;
        }
           
    CleanupStack::Pop( array );
    listBox->Model()->SetItemTextArray( array );            
    
    CleanupStack::Pop( popup ); 
    TInt selectedCommand = -1;             
    if ( popup->ExecuteLD() )
        {
        selectedCommand = listBox->CurrentItemIndex();
        }

    CleanupStack::PopAndDestroy( listBox );

    if ( selectedCommand != -1 )
        {
        // This will not work...
        TRAPD( err, commands[ selectedCommand ]->ExecuteL() );
        if ( err != KErrNone )
            {
            CEikonEnv* eikonEnv = CEikonEnv::Static();
            CMCETestUIAppUi* tempUiPtr = (CMCETestUIAppUi*)eikonEnv->AppUi();
            TInt errorLength = KLeaveMessage().Length() + 10;
            HBufC* error = HBufC::NewL( errorLength );
            TPtr errorPtr = error->Des();
            errorPtr.Append( KLeaveMessage );
            errorPtr.AppendNum( err );
           // User::InfoPrint( *error );
            tempUiPtr->NotifyUser(*error);
            delete error;
            }
                          
        }
    }
// ----------------------------------------------------------------------------
// CSysApPubSubObserver::HandlePropertyChangedL()
// ----------------------------------------------------------------------------
void CSysApPubSubObserver::HandlePropertyChangedL( const TUid& aCategory, const TUint aKey )
    {
    TInt value( 0 );
    RProperty::Get( aCategory, aKey, value );

#ifdef _DEBUG

    HBufC* hbuf = HBufC::New( 120 );

    if ( hbuf )
        {
        TPtr buf = hbuf->Des();

        buf = _L("CSysApPubSubObserver::HandlePropertyChangedL: category=0x");
        buf.AppendNumFixedWidth( aCategory.iUid, EHex, 8 );
        buf.Append( _L(", key=0x") );
        buf.AppendNumFixedWidth( aKey, EHex, 8 );
        buf.Append( _L(", value=") );
        buf.AppendNum( value );

        RDebug::Print( buf );
        delete hbuf;
        }

#endif

    // KIrdaPropertyCategory is actually defined as KUidSystemCategory, but just in case this ever changes,
    // check them separately here. The keys should have no overlap.
    if ( aCategory == KUidSystemCategory || aCategory == KIrdaPropertyCategory )
        {
        HandleSystemCategoryL( aKey, value );
        }
    else if ( aCategory == KPSUidStartup || aCategory == KAlarmServerPubSubCategory )
        {
        HandleStartupCategoryL( aKey, value );
        }
    else if ( aCategory == KPSUidCoreApplicationUIs )
        {
        HandleCoreAppUIsCategoryL( aKey, value );
        }
    else if ( aCategory == KPSUidHWRMPowerState )
        {
        HandleHwrmPowerStateCategoryL( aKey, value );
        }
    else if ( aCategory == KPSUidWlan )
        {
        HandleWlanCategoryL( aKey, value );
        }
    else if ( aCategory == KPSUidCtsyCallInformation )
        {
        HandleTelephonyCallInformationCategoryL( aKey, value );
        }
    else if ( aCategory == KPSUidNetworkInfo )
        {
        HandleNetworkInfoCategoryL( aKey, value );
        }
    else if ( aCategory == KPSUidHWRM )
        {
        HandleHwrmCategoryL( aKey, value );
        }
/*    else if ( aCategory == KPSUidHWRMFmTx )
        {
        HandleHwrmFmTxCategoryL( aKey, value );
        }
*/
    else if ( aCategory == KPSUidDataSynchronizationInternalKeys )
        {
        HandleDataSyncCategoryL( aKey, value );
        }
    else if ( aCategory == KPosIndicatorCategoryUid )
        {
        HandlePosIndicatorCategoryL( aKey, value );
        }
    else if ( aCategory == KUidPSSMSStackCategory )
        {
        HandleSmsStackCategoryL( aKey, value );
        }
    else if ( aCategory == KPSUidAvkonDomain)
        {
        HandleLKeylockEventL( aKey, value );
        }
    else if ( aCategory == KPSUidSecurityUIs)
        {
        HandleLightsOnRequestL( aKey, value );
        }
    }