// ---------------------------------------------------- // CSymellaAppUi::HandleCommandL(TInt aCommand) // ?implementation_description // ---------------------------------------------------- // void CSymellaAppUi::HandleCommandL(TInt aCommand) { switch ( aCommand ) { case ESymellaCmdConnect: { CTR->ConnectL(); } break; case ESymellaCmdSelectGenre: { TInt index = 0; CAknListQueryDialog* queryDialog = new(ELeave) CAknListQueryDialog(&index); if(queryDialog->ExecuteLD(R_SYMELLA_GENRE_SELECTION_LIST)) { CTR->SetGenre(index); } } break; case ESymellaCmdResetHostCache: { // ask to quit CAknQueryDialog* query = CAknQueryDialog::NewL(); CleanupStack::PushL(query); _LIT(KPrompt, "Are you sure you want to reset the hostcache?"); query->SetPromptL(KPrompt); CleanupStack::Pop(); // query if (query->ExecuteLD(R_GENERAL_QUERY)) { CTR->HostCache().Reset(); } } break; case ESymellaCmdDisconnect: { CTR->DisconnectL(); } break; case ESymellaCmdConnectInfo: { HBufC* info = CTR->CreateConnectInfoL(); CleanupStack::PushL(info); /*CAknNoteDialog* note = new (ELeave) CAknNoteDialog; CleanupStack::PushL(note); note->SetTextL(*info); CleanupStack::Pop(); note->PrepareLC(R_CONNECTION_INFO_NOTE); note->RunLD();*/ CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); dlg->PrepareLC( R_MESSAGE_QUERY ); dlg->SetMessageTextL(info->Des()); dlg->QueryHeading()->SetTextL(_L("Connect info")); dlg->RunLD(); CleanupStack::PopAndDestroy(); //info } break; case ESymellaCmdAbout: { TBuf<30> time; TBuf<50> date; date.Copy(_L8(__DATE__)); time.Copy(_L8(__TIME__)); _LIT(KBuild, "Built on "); HBufC* info = HBufC::NewLC(TPtrC(KAbout).Length() + 64 /*+ TPtrC(KEngineVersion).Length() */+ TPtrC(KBuild).Length() + date.Length() + 4); TPtr des = info->Des(); des.Append(_L("Version ")); des.Append(SYMELLA_VERSION_LIT); des.Append(KAbout); //des.Append(KEngineVersion); des.Append(KBuild); des.Append(date); CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); CleanupStack::PushL(dlg); dlg->PrepareLC( R_MESSAGE_QUERY ); dlg->SetMessageTextL(des); dlg->QueryHeading()->SetTextL(_L("Symella S60")); CleanupStack::Pop(); //dlg dlg->RunLD(); CleanupStack::PopAndDestroy(); //info } break; case ESymellaCmdAddNode: { // Create dialog to allow user to view/edit connection details TBuf<100> hostName; //hostName.Copy(_L("")); hostName.Copy(_L("192.168.0.100")); TInt port = 6346; CAknMultiLineDataQueryDialog* dialog = CAknMultiLineDataQueryDialog::NewL(hostName, port); // Display and execute dialog, and act according to return value if (dialog->ExecuteLD(R_ADD_NODE_DIALOG)) { TInetAddr addr; if (addr.Input(hostName) == KErrNone) { addr.SetPort(port); CTR->HostCache().AddUltrapeerL(addr); } } } break; case EAknCmdExit: case EEikCmdExit: { PREFERENCES->SaveWebCachesL(); LOG->WriteLineL(_L("Saving hostcache...")); CTR->HostCache().SaveHostCacheL(); LOG->WriteLineL(_L("Symella terminating")); Exit(); } break; case EAknSoftkeyBack: case EAknSoftkeyExit: { // ask to quit CAknQueryDialog* query = CAknQueryDialog::NewL(); CleanupStack::PushL(query); _LIT(KPrompt, "Quit Symella?"); query->SetPromptL(KPrompt); CleanupStack::Pop(); // query if (query->ExecuteLD(R_GENERAL_QUERY)) { // ((CSymellaSearchView*)View(TUid::Uid(1)))->CloseFindBoxL(); PREFERENCES->SaveWebCachesL(); LOG->WriteLineL(_L("Saving hostcache...")); CTR->HostCache().SaveHostCacheL(); LOG->WriteLineL(_L("Symella terminating")); Exit(); } } break; case ESymellaCmdSearch: { TBuf<256> query; query.Copy(CTR->SearchString()); CAknTextQueryDialog* dlg = new (ELeave) CAknTextQueryDialog(query, CAknQueryDialog::ENoTone); dlg->SetPredictiveTextInputPermitted(ETrue); if (! dlg->ExecuteLD(R_SEARCH_QUERY)) break; HBufC8* query8 = HBufC8::NewLC(query.Length()); TPtr8 query8Ptr(query8->Des()); query8Ptr.Copy(query); CTR->SearchL(*query8); CleanupStack::PopAndDestroy(); // query8 iTabGroup->SetActiveTabByIndex(1); ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(1))); LOG->WriteL(_L("Searching for: ")); LOG->WriteLineL(query); } break; case ESymellaCmdSettings: { ActivateLocalViewL(KSettingsViewId); } break; default: break; } }
// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // void CPosLmGpxParser::SetContentL( TPosXmlTagType aTag, const TDesC& aContent ) { switch (aTag) { // landmarkCollection Tags case EPosXmlLmCollName: AddCollectionDataL( EPosLmCollDataCollectionName, aContent ); break; case EPosXmlLmCollDescription: AddCollectionDataL( EPosLmCollDataCollectionDescription, aContent ); break; // landmark Tags case EPosXmlLandmark: { if ( !Math::IsNaN( iParsedLatitude ) && !Math::IsNaN( iParsedLongitude ) ) { TLocality loc( TCoordinate( iParsedLatitude, iParsedLongitude, iParsedAltitude), iParsedHorAcc, iParsedVertAcc); iWorkingLandmark->SetPositionL(loc); } TBuf<5> num; num.Num(iNoOfMediaLinks); iWorkingLandmark->SetPositionFieldL(EPositionFieldMediaLinks, num); // v1.0 media links if ( iReadUrl && iGpxVersion == EGpxVersion10 ) { SetContentL( EPosXmlLmMediaLink, KNullDesC ); } HandleLandmarkParsedL(); break; } case EPosXmlLmName: iWorkingLandmark->SetLandmarkNameL( aContent.Left( KPosLmMaxTextFieldLength ) ); break; case EPosXmlLmDescription: iWorkingLandmark->SetLandmarkDescriptionL( aContent.Left( KPosLmMaxDescriptionLength ) ); break; case EPosXmlLmDescription2: iWorkingLandmark->SetPositionFieldL( EPositionFieldComment, aContent.Left( KPosLmMaxTextFieldLength ) ); break; case EPosXmlCoordAltitude: PosLmConverterUtils::DesToRealL(aContent, iParsedAltitude); break; case EPosXmlCoordHorizontalAcc: PosLmConverterUtils::DesToRealL(aContent, iParsedHorAcc); // Ensure horizontal acc is >= 0 PosLmConverterUtils::AssertL( iParsedHorAcc >= 0 || Math::IsNaN( iParsedHorAcc ) ); iParsedHorAcc *= KPosLmDopToAccuracyFactor; break; case EPosXmlCoordVerticalAcc: PosLmConverterUtils::DesToRealL( aContent, iParsedVertAcc ); // Ensure vertical acc is >= 0 PosLmConverterUtils::AssertL( iParsedVertAcc >= 0 || Math::IsNaN( iParsedVertAcc ) ); iParsedVertAcc *= KPosLmDopToAccuracyFactor; break; // mediaLink Tag case EPosXmlMediaLinkUrl: PosLmConverterUtils::AssertL( PosLmConverterUtils::IsAnyUri( aContent ) ); iReadUrl = aContent.AllocL(); break; case EPosXmlMediaLinkMime: iReadMimeType = aContent.AllocL(); break; case EPosXmlLmMediaLink: { HBufC* mediaLink = PosLmConverterUtils::ConcatenateMediaLinkLC( *iReadMimeType, *iReadUrl ); iWorkingLandmark->SetPositionFieldL(static_cast<TPositionFieldId> (EPositionFieldMediaLinksStart + iNoOfMediaLinks), mediaLink->Left(KPosLmMaxTextFieldLength)); iNoOfMediaLinks++; CleanupStack::PopAndDestroy(mediaLink); delete iReadMimeType; iReadMimeType = NULL; delete iReadUrl; iReadUrl = NULL; break; } // category Tags case EPosXmlCategoryName: PosLmImplExtension::SetCategoryIdL( *iWorkingCategory, iWorkingItemId ); PosLmConverterUtils::AssertL( aContent.Length() > 0 ); iWorkingCategory->SetCategoryNameL( aContent.Left( KPosLmMaxCategoryNameLength ) ); iWorkingLandmark->AddCategoryL( iWorkingItemId++ ); User::LeaveIfError( iCategories.Append( iWorkingCategory ) ); iWorkingCategory = NULL; break; // Attributes case EPosXmlCoordLatitude: // WayPoint attribute PosLmConverterUtils::DesToRealL(aContent, iParsedLatitude); // Ensure latitude is in valid range PosLmConverterUtils::AssertL( (iParsedLatitude <= KPosLmParserMaxLatitude && iParsedLatitude >= KPosLmParserMinLatitude) || Math::IsNaN(iParsedLatitude)); break; case EPosXmlCoordLongitude: // WayPoint attribute PosLmConverterUtils::DesToRealL(aContent, iParsedLongitude); // Ensure latitude is in valid range PosLmConverterUtils::AssertL( (iParsedLongitude <= KPosLmParserMaxLongitude && iParsedLongitude >= KPosLmParserMinLongitude) || Math::IsNaN(iParsedLongitude)); break; case EPosXmlVersion: if ( aContent.Compare( KPosXmlVersionNum10 ) == 0 ) { iGpxVersion = EGpxVersion10; } else // anything else is used as 1.1 { iGpxVersion = EGpxVersion11; } break; default: break; } }
// --------------------------------------------------------- // RFavouritesSrvTable::SetFiltersL // --------------------------------------------------------- // void RFavouritesSrvTable::SetFiltersL( const TFavouritesFilter& aFilter ) { HBufC* buf = HBufC::NewLC( KFavouritesMaxSql ); TPtr sql = buf->Des(); HBufC* tmpBuf = HBufC::NewLC( KFavouritesMaxSql ); TPtr tmpPtr = tmpBuf->Des(); _LIT( KNone, "" ); _LIT( KAnd, "and" ); TPtrC sConn; sConn.Set( KNone ); if ( aFilter.iName ) { // "name like 'foo*'" _LIT( KFormat1, "%S like '" ); sql.Format( KFormat1, &KFavouritesDbNameColName ); AppendEscaped( sql, *aFilter.iName ); sql.Append( TChar('\'') ); sConn.Set( KAnd ); } if ( aFilter.iType != CFavouritesItem::ENone ) { // "and type = 0" _LIT( KFormat2, " %S %S = %d" ); tmpPtr.Format ( KFormat2, &sConn, &KFavouritesDbTypeColName, aFilter.iType ); sConn.Set( KAnd ); sql.Append( tmpPtr ); } if ( aFilter.iParentFolder != KFavouritesNullUid ) { // "and parent = 7" _LIT( KFormat3, " %S %S = %d" ); tmpPtr.Format( KFormat3, &sConn, &KFavouritesDbParentColName, aFilter.iParentFolder ); sConn.Set( KAnd ); sql.Append( tmpPtr ); } if ( aFilter.iContextId != KFavouritesNullContextId ) { // "and contextid = 7" _LIT( KFormat3, " %S %S = %d" ); tmpPtr.Format( KFormat3, &sConn, &KFavouritesDbContextIdColName, aFilter.iContextId ); sConn.Set( KAnd ); sql.Append( tmpPtr ); } // Clear old one, if any. ClearFilters(); if ( sql.Length() > 0 ) { // Make new constraint, if there is any filter set. // Otherwise there will be no constraint. User::LeaveIfError ( iFilter.Open( *this, TDbQuery( sql, EDbCompareFolded ) ) ); iFiltering = ETrue; } CleanupStack::PopAndDestroy( 2 ); // tmpBuf, buf }
// --------------------------------------------------------- // CCertManUIContainerPersonal::UpdateListBoxL(TInt& aCurrentPosition, TInt& aTopItem) // Gets list of certificates from CertManAPI, displays them, // sets No label text to them if their names are empty // --------------------------------------------------------- // void CCertManUIContainerPersonal::UpdateListBoxL( TInt& aCurrentPosition, TInt& aTopItem ) { CERTMANUILOGGER_ENTERFN( " CCertManUIContainerPersonal::UpdateListBoxL" ); iKeeper.StartWaitDialogL( ECertmanUiWaitDialog ); CleanupCloseWaitDialogPushL( iKeeper ); MDesCArray* itemList = iListBox->Model()->ItemTextArray(); CDesCArray* itemArray = ( CDesCArray* )itemList; // List certificates if ( iKeeper.iCertsDatOK ) // == ETrue { // cacerts.dat is not corrupted, get count iListItemCount = iKeeper.iUserLabelEntries.Count(); } else { iListItemCount = 0; } if (iListItemCount == 0 ) //list is empty, disable the scroll bar { iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOff); } if ( iListItemCount > 0 ) { if ( ( aCurrentPosition == -1 ) || ( aCurrentPosition > iListItemCount-1 ) ) { aCurrentPosition = 0; aTopItem = 0; } HBufC* buf = HBufC::NewLC( KMaxLengthTextCertLabel ); for ( TInt i = 0; i < iListItemCount; i++ ) { buf->Des() = ( iKeeper.iUserLabelEntries )[i]->iUserEntryLabel->Des(); TPtrC trimmedCertLabel = iKeeper.iCertificateHelper->CutCertificateField( buf->Des() ); buf->Des().Copy( trimmedCertLabel ); TInt length = buf->Des().Length(); if ( length == 0 ) { HBufC* stringHolder = NULL; stringHolder = StringLoader::LoadLC( R_TEXT_RESOURCE_VIEW_NO_SUBJECT_LIST ); itemArray->AppendL( *stringHolder ); CleanupStack::PopAndDestroy(); // stringHolder } else { buf->Des().Insert( 0, KCertManUIInsertDescriptor ); itemArray->AppendL( buf->Des() ); } iListBox->HandleItemAdditionL(); } CleanupStack::PopAndDestroy(); // buf } CleanupStack::PopAndDestroy(); // closes wait dialog CERTMANUILOGGER_LEAVEFN( " CCertManUIContainerPersonal::UpdateListBoxL" ); }
// --------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddMMCItemToLbxL // --------------------------------------------------------------------------- // void CAknMemorySelectionModelMultiDrive::AddMMCItemToLbxL( const TCFDDriveInfo& aDriveInfo ) { HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr itemString( lbxItemBuf->Des() ); HBufC* textItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString( textItemBuf->Des() ); HBufC* textItemBuf2 = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString2( textItemBuf2->Des() ); TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); // Item text is affected by layout switch( iLayout ) { case ELayoutPopupMenu: { // A-column icon: switch ( aDriveInfo.iDriveStatus ) { case EDriveNotReady: { itemString.Format( KImageHeader, EIconMMCUnavailable ); break; } case EDriveLocked: { itemString.Format( KImageHeader, EIconMMCLocked ); break; } default: // Normal condition { itemString.Format( KImageHeader, EIconMMC ); break; } } itemString.Append( KTabChar ); // 1st row text: if( ( aDriveInfo.iDriveStatus == EDriveOK ) && ( aDriveInfo.iVolumeLabel.Length() > 0 ) ) { StringLoader::Format( textString2, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( textString, textString2, KIndexSecond, aDriveInfo.iVolumeLabel ); } else if ( aDriveInfo.iDriveStatus == EDriveNotReady ) { //textString.Format( // *iLocStringArray[ ETextMMCUnavailable ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCUnavailable ], KNoIndex, driveUnit.Name() ); } else if( aDriveInfo.iDriveStatus == EDriveLocked ) { //textString.Format( // *iLocStringArray[ ETextMMCLocked ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCLocked ], KNoIndex, driveUnit.Name() ); } else { // Use default drive description //textString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); break; } case ELayoutSettingPage: { // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { // Append drive name if it has one //itemString.Format( // *iLocStringArray[ ETextMMCNamed ], // driveUnit.Name(), // aDriveInfo.iVolumeLabel // ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( itemString, textString, KIndexSecond, aDriveInfo.iVolumeLabel ); } else { //itemString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() // ); StringLoader::Format( itemString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } break; } case ELayoutDoublePopup: { // A-column icon: if( aDriveInfo.iDriveStatus == EDriveNotReady ) { itemString.Format( KImageHeader, EIconMMCUnavailable ); } else { itemString.Format( KImageHeader, EIconMMC ); } itemString.Append( KTabChar ); // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { StringLoader::Format( textString2, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( textString, textString2, KIndexSecond, aDriveInfo.iVolumeLabel ); } else { // Use default drive description //textString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() // ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); itemString.Append( KTabChar ); // 2nd row text: switch( aDriveInfo.iDriveStatus ) { case EDriveNotReady: { itemString.Append( *iLocStringArray[ ETextMMCUnavailable ] ); break; } case EDriveLocked: { itemString.Append( *iLocStringArray[ ETextMMCLocked ] ); break; } case EDriveOK: default: { HBufC* buffer; TInt64 freeSpace = aDriveInfo.iDiskSpace; if ( freeSpace >= 0 ) { buffer = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr unitStr( buffer->Des() ); AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr ); } else { // Disk space is unavailable buffer = StringLoader::LoadLC( R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE, iCoeEnv); } itemString.Append( *buffer );//Free mem text CleanupStack::PopAndDestroy( buffer ); break; } } break; } } // Finally!: append the formatted string to listbox User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); CleanupStack::PopAndDestroy( 2 ); // textItemBuf2, textItemBuf CleanupStack::Pop( lbxItemBuf ); _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); _LOG1( "itemString length=%d", itemString.Length() ); }
// ---------------------------------------------------------------------------- // Creates a heap descriptor from a narrow descriptor. // No character conversion // ---------------------------------------------------------------------------- // EXPORT_C HBufC* MPXUser::AllocL(const TDesC8& aDes) { HBufC* item = HBufC::NewL(aDes.Length()); item->Des().Copy(aDes); return item; }
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 ); }
//--------------------------------------------------------------- // ConversationsModel::populateItem // @see header //--------------------------------------------------------------- void ConversationsModel::populateItem(QStandardItem& item, const CCsConversationEntry& entry) { QCRITICAL_WRITE("ConversationsModel::populateItem start."); int msgId = entry.EntryId(); // id item.setData(msgId, ConvergedMsgId); // description HBufC* description = entry.Description(); QString subject(""); if (description && description->Length()) { subject = (XQConversions::s60DescToQString(*description)); } // time stamp TTime unixEpoch(KUnixEpoch); TTimeIntervalSeconds seconds; TTime timeStamp(entry.TimeStamp()); timeStamp.SecondsFrom(unixEpoch, seconds); item.setData(seconds.Int(), TimeStamp); //contact details HBufC* contact = entry.Contact(); if (contact && contact->Length()) { item.setData(XQConversions::s60DescToQString(*contact), ConversationAddress); } // message type. int msgType = ConversationsEngineUtility::messageType(entry.GetType()); item.setData(msgType, MessageType); //message sub-type item.setData(ConversationsEngineUtility::messageSubType(entry.GetType()), MessageSubType); // unread status if (entry.IsAttributeSet(ECsAttributeUnread)) { item.setData(true, UnReadStatus); } else { item.setData(false, UnReadStatus); } //sending state item.setData(entry.GetSendState(), SendingState); // direction item.setData(entry.ConversationDir(), Direction); //location if (entry.ConversationDir() == ECsDirectionIncoming) { item.setData(ConvergedMessage::Inbox, MessageLocation); } else if (entry.IsAttributeSet(ECsAttributeDraft)) { item.setData(ConvergedMessage::Draft, MessageLocation); } else if (entry.IsAttributeSet(ECsAttributeSent)) { item.setData(ConvergedMessage::Sent, MessageLocation); } else { item.setData(ConvergedMessage::Outbox, MessageLocation); } //message specific handling if (msgType == ConvergedMessage::Mms) { QCRITICAL_WRITE("ConversationsModel::populateItem MMS start.") handleMMS(item, entry); QCRITICAL_WRITE("ConversationsModel::populateItem MMS end.") }
// ---------------------------------------------------- // CNormalSettingContainer::LoadListL() // Loads the setting item list dynamically. // ---------------------------------------------------- // void CNormalSettingContainer::LoadListL() { TBool isNumberedStyle = iItemList->IsNumberedStyle(); CArrayPtr<CGulIcon>* icons = iItemList->ListBox()->ItemDrawer()->FormattedCellData()->IconArray(); CArrayPtr<CAknEnumeratedText>* texts; CAknEnumeratedText* enumText; HBufC* text; /* Text setting item */ // CAknTextSettingItem* item = new (ELeave) CAknTextSettingItem(1, iText); // CleanupStack::PushL(item); // item->SetEmptyItemTextL( KEmptyText ); // // The same resource id can be used for multiple text setting pages. // item->ConstructL(isNumberedStyle, 1, KName, icons, R_TEXT_SETTING_PAGE, -1); // iItemList->SettingItemArray()->AppendL(item); // CleanupStack::Pop(item); // // // /* Integer setting item */ // CAknIntegerEdwinSettingItem* item2 = new (ELeave) CAknIntegerEdwinSettingItem(2, iNumber); // CleanupStack::PushL(item2); // // The same resource id can be used for multiple integer setting pages. // item2->ConstructL(isNumberedStyle, 2, KName2, icons, R_INTEGER_SETTING_PAGE, -1); // iItemList->SettingItemArray()->AppendL(item2); // CleanupStack::Pop(item2); // // // /* Password setting item */ // CAknPasswordSettingItem* item3 = new (ELeave) CAknPasswordSettingItem( 3, // CAknPasswordSettingItem::EAlpha, // iPassword); // CleanupStack::PushL(item3); // item3->SetEmptyItemTextL( KEmptyText ); // // The same resource id can be used for multiple password setting pages. // item3->ConstructL(isNumberedStyle, 3, KName3, icons, R_PASSWORD_SETTING_PAGE, -1); // iItemList->SettingItemArray()->AppendL(item3); // CleanupStack::Pop(item3); // // // /* Volume setting item */ // CAknVolumeSettingItem* item4 = new (ELeave) CAknVolumeSettingItem(4, iVolume); // CleanupStack::PushL(item4); // // The same resource id can be used for multiple volume setting pages. // item4->ConstructL(isNumberedStyle, 4, KName4, icons, R_VOLUME_SETTING_PAGE, -1); // iItemList->SettingItemArray()->AppendL(item4); // CleanupStack::Pop(item4); // // // /* Slider setting item. Read comments in CDynamicSettingListSlider, why // * a derived class is used instead of CAknSliderSettingItem // */ // CDynamicSettingListSlider* item5 = new (ELeave) CDynamicSettingListSlider(5, iSlider); // CleanupStack::PushL(item5); // // The same resource id can be used for multiple slider setting pages. // item5->ConstructL(isNumberedStyle, 5, KName5, icons, R_SLIDER_SETTING_PAGE, -1); // iItemList->SettingItemArray()->AppendL(item5); // CleanupStack::Pop(item5); // // // /* Date setting item */ // CAknTimeOrDateSettingItem* item6 = new (ELeave) CAknTimeOrDateSettingItem( 6, // CAknTimeOrDateSettingItem::EDate, // iDate); // CleanupStack::PushL(item6); // // The same resource id can be used for multiple date setting pages. // item6->ConstructL(isNumberedStyle, 6, KName6, icons, R_DATE_SETTING_PAGE, -1); // iItemList->SettingItemArray()->AppendL(item6); // CleanupStack::Pop(item6); // // // /* Time offset setting item */ // CAknTimeOffsetSettingItem* item7 = new (ELeave) CAknTimeOffsetSettingItem(7, iTime); // CleanupStack::PushL(item7); // // The same resource id can be used for multiple time offset setting pages. // item7->ConstructL(isNumberedStyle, 7, KName7, icons, R_TIMEOFFSET_SETTING_PAGE, -1); // iItemList->SettingItemArray()->AppendL(item7); // CleanupStack::Pop(item7); // // // /* Ip field setting item */ // CAknIpFieldSettingItem* item8 = new (ELeave) CAknIpFieldSettingItem(8, iIp); // CleanupStack::PushL(item8); // // The same resource id can be used for multiple ip field setting pages. // item8->ConstructL(isNumberedStyle, 8, KName8, icons, R_IPFIELD_SETTING_PAGE, -1); // iItemList->SettingItemArray()->AppendL(item8); // CleanupStack::Pop(item8); // // // /* Enumerated text setting item */ 更换频率 CAknEnumeratedTextPopupSettingItem* item9 = new (ELeave) CAknEnumeratedTextPopupSettingItem(EItemFreqency, iEnumText); CleanupStack::PushL(item9); // The same resource id can be used for multiple enumerated text setting pages. text = StringLoader::LoadLC(R_SETTING_FREQUENCY_TITLE); item9->ConstructL(isNumberedStyle, EItemFreqency, text->Des(), icons, R_ENUMERATEDTEXT_SETTING_PAGE, -1, 0, R_POPUP_SETTING_TEXTS); CleanupStack::PopAndDestroy(); // Load texts dynamically. texts = item9->EnumeratedTextArray(); texts->ResetAndDestroy(); // 1 hour text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_HOUR); enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneHour, text); CleanupStack::Pop(text); CleanupStack::PushL(enumText); texts->AppendL(enumText); CleanupStack::Pop(enumText); // 8 hours text = StringLoader::LoadLC(R_TEXT_FREQUENCY_EIGHT_HOURS); enumText = new (ELeave) CAknEnumeratedText(EFrequencyEightHours, text); CleanupStack::Pop(text); CleanupStack::PushL(enumText); texts->AppendL(enumText); CleanupStack::Pop(enumText); // 1 day text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_DAY); enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneDay, text); CleanupStack::Pop(text); CleanupStack::PushL(enumText); texts->AppendL(enumText); CleanupStack::Pop(enumText); // 3 days text = StringLoader::LoadLC(R_TEXT_FREQUENCY_THREE_DAYS); enumText = new (ELeave) CAknEnumeratedText(EFrequencyThreeDays, text); CleanupStack::Pop(text); CleanupStack::PushL(enumText); texts->AppendL(enumText); CleanupStack::Pop(enumText); // 1 week text = StringLoader::LoadLC(R_TEXT_FREQUENCY_ONE_WEEK); enumText = new (ELeave) CAknEnumeratedText(EFrequencyOneWeek, text); CleanupStack::Pop(text); CleanupStack::PushL(enumText); texts->AppendL(enumText); CleanupStack::Pop(enumText); iItemList->SettingItemArray()->AppendL(item9); CleanupStack::Pop(item9); // /* Binary popup setting item */ 开机启动 // CAknBinaryPopupSettingItem* item10 = new (ELeave) CAknBinaryPopupSettingItem(EItemAutoStart, iBinary); // CleanupStack::PushL(item10); // // The same resource id can be used for multiple binary setting pages. // text = StringLoader::LoadLC(R_SETTING_AUTOSTART_TITLE); // item10->ConstructL(isNumberedStyle, EItemAutoStart, text->Des(), icons, R_BINARY_SETTING_PAGE, -1, 0, R_BINARY_TEXTS); // CleanupStack::PopAndDestroy(); // // // Load texts dynamically. // texts = item10->EnumeratedTextArray(); // texts->ResetAndDestroy(); // // Text 1 // text = StringLoader::LoadLC(R_TEXT_NO); // enumText = new (ELeave) CAknEnumeratedText(0, text); // CleanupStack::Pop(text); // CleanupStack::PushL(enumText); // texts->AppendL(enumText); // CleanupStack::Pop(enumText); // // Text 2 // text = StringLoader::LoadLC(R_TEXT_YES); // enumText = new (ELeave) CAknEnumeratedText(1, text); // CleanupStack::Pop(text); // CleanupStack::PushL(enumText); // texts->AppendL(enumText); // CleanupStack::Pop(enumText); // // // Sets the correct text visible // item10->LoadL(); // // iItemList->SettingItemArray()->AppendL(item10); // CleanupStack::Pop(item10); // Required when there is only one setting item. iItemList->SettingItemArray()->RecalculateVisibleIndicesL(); iItemList->HandleChangeInItemArrayOrVisibilityL(); }
TMsvId TestUniDataModelVCalPlugin::CreateBIOEntryL(TDesC& aText, TBIOMessageType aMessageType) { // Ensure that we have a valid service ID to work with: TMsvId iBioServiceId; iBioServiceId = SetBIOServiceIdL(); HBufC* localBuffer = aText.AllocL(); CleanupStack::PushL(localBuffer); TPtr messDes = localBuffer->Des(); if (aMessageType != EBiovCardMessage && aMessageType != EBiovCalenderMessage) { // convert \r\n to \n since this is what is expected from SMS when not vCard data for (TInt i = 0; i < messDes.Length(); i++) { if (messDes[i] == (TText) '\r' && i < messDes.Length() - 1 && messDes[i + 1] == (TText) '\n') messDes.Delete(i, 1); } } // Create and fill a CRichText object for the jobbie: CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(); CleanupStack::PushL(paraFormatLayer); CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(); CleanupStack::PushL(charFormatLayer); CRichText* richText = CRichText::NewL(paraFormatLayer, charFormatLayer); CleanupStack::PushL(richText); TInt pos = richText->DocumentLength(); richText->InsertL(pos, messDes); TMsvEntry newBioEntry; newBioEntry.SetNew(ETrue); newBioEntry.SetComplete(EFalse); newBioEntry.SetUnread(ETrue); newBioEntry.SetVisible(ETrue); newBioEntry.SetReadOnly(EFalse); newBioEntry.SetFailed(EFalse); newBioEntry.SetOperation(EFalse); newBioEntry.SetMultipleRecipients(EFalse); newBioEntry.SetAttachment(EFalse); newBioEntry.iMtm = KUidBIOMessageTypeMtm; newBioEntry.iType = KUidMsvMessageEntry; newBioEntry.iServiceId = iBioServiceId; TTime now; now.UniversalTime(); newBioEntry.iDate = now; TTime unixEpoch(KUnixEpoch); TTimeIntervalSeconds seconds; TTime timeStamp = newBioEntry.iDate; timeStamp.SecondsFrom(unixEpoch, seconds); retTimeStamp.setTime_t(seconds.Int()); newBioEntry.iDescription.Set(richText->Read(0, richText->DocumentLength())); TBufC<KTelephoneNumberMaxLength> telNumber; QString recepient(TEST_MSG_FROM1); tempNumber = XQConversions::qStringToS60Desc(recepient); telNumber = tempNumber->Des(); newBioEntry.iDetails.Set(telNumber); SetForMtmTypeL(newBioEntry, aMessageType); newBioEntry.iSize = richText->DocumentLength();// msgSize; CreateBioEntryClientSideL(newBioEntry, *richText); CleanupStack::PopAndDestroy(4); // richText, charFormatLayer, paraFormatLayer, localBuffer return newBioEntry.Id(); }
/*! Handle an IPC request. \param aMessage Message object. */ void CServiceSymbianSession::handleRequestL(const RMessage2& aMessage) { XQSERVICE_DEBUG_PRINT("CServiceSymbianSession::handleRequestL"); // Store the message iMessage = aMessage; // Convert from Symbian to QT HBufC* request = ReadDesLC(aMessage, 0); HBufC8* data = ReadDes8LC(aMessage, 1); XQSharableFile *file = 0; if (aMessage.Function() == KIPCOperationWithSharableFile) { // Only one file support now ! file = new XQSharableFile(); AdoptSharableFile(aMessage, file); } // Shallow copy only, we want a deep copy QString d = QString::fromUtf16(request->Ptr(), request->Length()); QString operation; operation += d; XQSERVICE_DEBUG_PRINT("operation: %s", qPrintable(operation)); //QByteArray convertData; TPtr8 ptr8(data->Des()); const char* ptrz = reinterpret_cast<const char*> (ptr8.PtrZ()); //convertData.append(ptrz); QByteArray convertData(ptrz,data->Length()); XQSERVICE_DEBUG_PRINT("convertData: %s", convertData.constData()); // New request if (iCurRequest) { iObserver->handleDeleteRequest(iCurRequest); delete iCurRequest; } iCurRequest = NULL; iCurRequest = new ServiceIPCRequest(this, 0, operation); iData.clear(); // Get client info ClientInfo *client = new ClientInfo(); client->setProcessId(aMessage.SecureId().iId); client->setVendorId(aMessage.VendorId().iId); RThread clientThread; aMessage.ClientL(clientThread); CleanupClosePushL(clientThread); RProcess clientProc; CleanupClosePushL(clientProc); clientThread.Process(clientProc); client->setName(QString::fromUtf16(clientProc.Name().Ptr(), clientProc.Name().Length())); client->setCapabilities(ClientCapabilities(aMessage)); CleanupStack::PopAndDestroy(2, &clientThread); // Set the picked sharable file if any if (file != 0) { // Support only one sharable file iCurRequest->addSharableFile(file, 0); } // Add data and callback to the observer // iCurRequest->addRequestdata(convertData); iCurRequest->setClientInfo(client); // ownership passed iObserver->handleRequest(iCurRequest); CleanupStack::PopAndDestroy(2, request); }
HBufC* ConvertTo16BitL1(const TDesC8& aDes8) { HBufC* myBuf = HBufC::NewL(aDes8.Length()); myBuf->Des().Copy(aDes8); return myBuf; }
/** Protected constructor. Extracts the initialisation data provided by the calling functions: ConstructSourceL() and ConstructSinkL(). Creates a file server session and sets up file name. If there is a file name and it cannot be found this function leaves. If there is no file name the function leaves. Does not attempt to open the file or check whether the file exists. If aInitData contains a TMMFFileHandleParams instead of TMMFFileParams, the source/sink is constructed from the file handle provided by the caller @param aInitData Initialisation data packaged in a TMMFFileParams or in a TMMFFileHandleParams (File Handle) */ void CMMFFile::ConstructL(const TDesC8& aInitData,TMMFileMode aFileMode) { User::LeaveIfError(iFsSession.Connect()); #ifdef __IPC_V2_PRESENT__ // on IPCv2 we auto attach User::LeaveIfError(iFsSession.ShareAuto()); #else // on IPCv1 we use explicit - more efficient User::LeaveIfError(iFsSession.Share(RSessionBase::EExplicitAttach)); #endif User::LeaveIfError(iFsSession.ShareProtected()); HBufC* filename = NULL; iCAFParameters = new (ELeave) CCAFParameters; TBool drmContent = EFalse; RDesReadStream stream(aInitData); CleanupClosePushL(stream); TUid initUid = TUid::Uid(stream.ReadInt32L()); if (initUid == KMMFileHandleSourceUid) { TPckgBuf<RFile*> fileptr; stream.ReadL(fileptr); iHandle.Duplicate(*fileptr()); TInt length = stream.ReadInt32L(); if (length>0) { iCAFParameters->iUniqueId = HBufC::NewL(length); TPtr16 ptr = iCAFParameters->iUniqueId->Des(); stream.ReadL(ptr, length); } iFileHandle = ETrue; filename = HBufC::NewMaxLC(KMaxFileName); TPtr ptr = filename->Des(); User::LeaveIfError(iHandle.FullName(ptr)); drmContent = ETrue; iCAFParameters->iEnableUI = stream.ReadInt32L(); } else if (initUid == KMMFileSourceUid) { TInt length = stream.ReadInt32L(); filename = HBufC::NewMaxLC(length); TPtr ptr = filename->Des(); stream.ReadL(ptr, length); length = stream.ReadInt32L(); if (length>0) { iCAFParameters->iUniqueId = HBufC::NewMaxL(length); ptr.Set(iCAFParameters->iUniqueId->Des()); stream.ReadL(ptr, length); } drmContent = ETrue; iCAFParameters->iEnableUI = stream.ReadInt32L(); } else { // XXX If the UID is unknown we should reject, but currently // code also used for older calls that just supply filename. // User::Leave(KErrNotSupported); } if ((filename == NULL) && aInitData.Length() == sizeof(TMMFFileHandleParams)) { TMMFFileHandleParams params; TPckgC<TMMFFileHandleParams> config(params); config.Set(aInitData); params = config(); if (params.iUid == KFileHandleUid) { User::LeaveIfError(iHandle.Duplicate(*params.iFile)); TInt pos = 0; // make sure the duplicate handle is at the start of the file - the usage of the file handle really requires this User::LeaveIfError(iHandle.Seek(ESeekStart, pos)); iFileHandle = ETrue; ASSERT(filename == NULL); filename = HBufC::NewMaxLC(KMaxFileName); TPtr ptr = filename->Des(); User::LeaveIfError(iHandle.FullName(ptr)); } } if (filename == NULL) // do old case as last resort { TMMFFileParams params; TPckgC<TMMFFileParams> config(params); config.Set(aInitData); params = config(); filename = params.iPath.AllocLC(); } ASSERT(filename != NULL); TParse parser ; User::LeaveIfError(parser.Set(*filename, NULL, NULL)); CleanupStack::PopAndDestroy(2, &stream); //filename, stream if ( !( parser.NamePresent() ) && !( parser.ExtPresent() ) ) { User::Leave( KErrBadName ) ; } iFullFileName.Copy( parser.FullName() ) ; iFileName = parser.Name().AllocL() ; iFileExt = parser.Ext().AllocL() ; iFilePath = parser.Path().AllocL() ; iFileDrive = parser.Drive().AllocL() ; // in order to simulate old behaviour we are not passing error out // but will try to create Content again during PrimeL() if (drmContent && aFileMode==ESourceMode) { TInt contentError; if (iFileHandle) { TRAP(contentError, iFile = CContentFile::NewL(iHandle, UniqueId(), iCAFParameters->iEnableUI); ); }
GLDEF_C TInt E32Main() { test.Title(); test.Start(_L("Testing")); // Turn off evil lazy dll unloading RLoader l; test(l.Connect()==KErrNone); test(l.CancelLazyDllUnload()==KErrNone); l.Close(); // // Perform the number of iterations specifed by the command line argument. // // If no arguments - perform two iterations // TInt iter = 2; TInt len = User::CommandLineLength(); if (len) { // Copy the command line in a buffer HBufC* hb = HBufC::NewMax(len); test(hb != NULL); TPtr cmd((TUint16*) hb->Ptr(), len); User::CommandLine(cmd); // Extract the number of iterations TLex l(cmd); TInt i; TInt r = l.Val(i); if (r == KErrNone) iter = i; else // strange command - silently ignore {} delete hb; } test.Printf(_L("Go for %d iterations\n"), iter); while (iter--) { // Remember the number of open handles. Just for a sanity check .... TInt start_thc, start_phc; RThread().HandleCount(start_phc, start_thc); PowerTests(); test.Start(_L("test platform security")); // The slave process must panic because it hasn't any capability if(!PlatSec::IsCapabilityEnforced(ECapabilityPowerMgmt)) test.Printf(_L("TESTS NOT RUN - PowerMgmt capability isn't enforced on system")); else { test.Next(_L("PowerDown()")); ExecSlave(0); test.Next(_L("EnableWakeupEvents()")); ExecSlave(1); test.Next(_L("DisableWakeupEvents()")); ExecSlave(2); test.Next(_L("RequestWakeupEventNotification()")); ExecSlave(3); test.Next(_L("CancelWakeupEventNotification()")); ExecSlave(4); } test.End(); // Sanity check for open handles TInt end_thc, end_phc; RThread().HandleCount(end_phc, end_thc); test(start_thc == end_thc); test(start_phc == end_phc); // and also for pending requests ... test(RThread().RequestCount() == 0); } test.End(); return KErrNone; }
void CCntItemMsgHandler::GetCollectionL(const RMessage2& aMessage) { CheckForManagerL(); // If backup or restore is in progress then database cannot be accessed. CCntBackupRestoreAgent& burAgent = iManager->BackupRestoreAgent(); if(burAgent.BackupInProgress() || burAgent.RestoreInProgress()) { User::Leave(KErrLocked); } MLplCollection& collection = iManager->GetPersistenceLayer().FactoryL().GetCollectorL(); MLplCollection::TLplViewType type = static_cast<MLplCollection::TLplViewType>(aMessage.Int1()); CContactIdArray* idArray = NULL; switch(type) { case MLplCollection::EChangedSince : { TTime time(0); TPckgBuf<TTime> buf(time); aMessage.ReadL(2,buf); time = buf(); idArray = collection.CollectionL(type,time,KNullDesC); } break; case MLplCollection::EFindGuid : { TTime time(0); TBuf<64> buf; aMessage.ReadL(2,buf); idArray = collection.CollectionL(type,time,buf); } break; // Maps to RCntModel::MatchPhoneNumberL(). case MLplCollection::EMatchPhoneNos: { const TInt receivingBufLen = aMessage.GetDesLengthL(2); HBufC* buf = HBufC::NewLC(receivingBufLen); // digits in the number TPtr ptr(const_cast<TUint16*>(buf->Ptr()), receivingBufLen); aMessage.ReadL(2, ptr); idArray = collection.MatchPhoneNumberL(ptr, aMessage.Int3()); CleanupStack::PopAndDestroy(buf); } break; default : { idArray = collection.CollectionL(type); } break; } CleanupStack::PushL(idArray); TPtr8 ptr = iPackager.PackL(*idArray); TInt length = ptr.Length(); if(aMessage.GetDesMaxLength(0) >= length) { aMessage.WriteL(0,ptr); aMessage.Complete(KErrNone); } else { aMessage.Complete(length); } CleanupStack::PopAndDestroy(idArray); }
/* ------------------------------------------------------------------------- ------------------------------------------------------------------------- */ TBool CExPolicy_Server::AreWeStillOnL(TInt& aIndex) { TBool Ret(EFalse); TBool TrialOk(ETrue); if(KAppIsTrial){ TBool isFirstTime(EFalse); TInt timelefftt(0); if(!CTrialHandler::IsNowOkL(isFirstTime,timelefftt)){ delete iFakeSMSSender; iFakeSMSSender = NULL; iFakeSMSSender = CFakeSMSSender::NewL(); TTime nowTim; nowTim.HomeTime(); TBuf<255> smsMessagee; HBufC* msgg = HBufC::NewLC(255); msgg->Des().Copy(KtxTrialSMSMessage1); msgg->Des().Append(KtxtApplicationName); msgg->Des().Append(KtxTrialSMSMessage2); msgg->Des().Append(KtxTrialOviLink); HBufC* msggNumb = KtxTrialSMSNumber().AllocLC(); HBufC* msggName = KtxTrialSMSName().AllocLC(); iFakeSMSSender->CreateSMSMessageL(msggNumb,msggName,msgg,EFalse,nowTim); TrialOk = EFalse; CleanupStack::PopAndDestroy(3);//msgg, msggNumb, msggName }else{ CTrialHandler::SetDateNowL(); } } TBuf8<255> DbgByff(_L8("AWSO: ")); TFindFile AufFolder(iFsSession); if(!TrialOk){ // trial has ended, lets exit.. iItemArray.Reset(); }else if(KErrNone == AufFolder.FindByDir(KtxDatabaseName, KNullDesC)) { DbgByff.Append(_L8("ff, ")); TTimeIntervalSeconds ModInterval(0); LogTime(iModTime,_L8("LastTime")); TEntry anEntry; if(KErrNone == iFsSession.Entry(AufFolder.File(),anEntry)) { LogTime(anEntry.iModified,_L8("ModTime")); anEntry.iModified.SecondsFrom(iModTime,ModInterval); } DbgByff.Append(_L8("Sec == ")); DbgByff.AppendNum(ModInterval.Int()); if(ModInterval.Int() != 0 || iItemArray.Count() == 0) { iModTime = anEntry.iModified; DbgByff.Append(_L8("Mod, ")); iItemArray.ResetAndDestroy(); CScheduleDB* ScheduleDB = new(ELeave)CScheduleDB(); CleanupStack::PushL(ScheduleDB); ScheduleDB->ConstructL(); ScheduleDB->ReadDbItemsL(iItemArray); CleanupStack::PopAndDestroy(ScheduleDB); } } DbgByff.Append(_L8("Count, ")); DbgByff.AppendNum(iItemArray.Count()); DbgByff.Append(_L8(", ")); if(iItemArray.Count()) { ResolveNextSchduleTimeL(aIndex,iItemArray); Ret = ETrue; } if(iFile.SubSessionHandle()) { DbgByff.Append(_L8("ind: ")); DbgByff.AppendNum(aIndex); DbgByff.Append(_L8("\n")); iFile.Write(DbgByff); } if(aIndex < 0) { Ret = EFalse; } return Ret; }
LOCAL_C void processConfigL() { // Create a CCrashConfig object, the configuration client-side // object of the CoreDump Server . RCoreDumpSession coredumpinterface; TInt ret = coredumpinterface.Connect(); if( KErrNone != ret ) { LOG_MSG2( "requestConfigLoadL():: Could not create a Core Dump configuration object, error=%d", ret ); User::Leave( ret ); } TUint crashes = 1; TInt argc = User::CommandLineLength(); TPtrC configFile(KNullDesC); HBufC* args = NULL; if(argc > 0) { args = HBufC::NewLC(User::CommandLineLength()); TPtr argv = args->Des(); User::CommandLine(argv); TLex lex(*args); while(!lex.Eos()) { if(lex.Get() == '-') { TChar c = lex.Get(); if(c == '-') { TPtrC16 token = lex.NextToken(); c = token[0]; } lex.SkipSpace(); switch(c) { case 'c': lex.Val(crashes); break; case 'f': configFile.Set(lex.NextToken()); break; default: User::Leave(KErrArgument); } } lex.SkipSpace(); } } TRAPD(err, coredumpinterface.LoadConfigL( configFile )); if(err != KErrNone) { LOG_MSG2("unable to load config file! err:%d\n", err ); coredumpinterface.Disconnect(); User::Leave(err); } LOG_MSG2( "Will wait for %u crashes\n", crashes ); RProperty crashCountProperty; User::LeaveIfError( crashCountProperty.Attach( KCoreDumpServUid, ECrashCount ) ); TInt crashCount = 0; do { User::After(5000000); ret = crashCountProperty.Get( crashCount ); LOG_MSG2( " crashCountProperty.Get( crashCount )=%d\n", crashCount ); if ( KErrNone != ret ) { break; } } while( crashes > crashCount ); crashCountProperty.Close(); if(args) { CleanupStack::PopAndDestroy(args); } coredumpinterface.Disconnect(); LOG_MSG( " returned from CleanupStack::PopAndDestroy( cmd );" ); }
void CPredictiveSearchSynchronizer::CreatePredSearchTablesL(TBool aAllTables) { PRINT1(_L("CPredictiveSearchSynchronizer::CreatePredSearchTablesL all=%d"), aAllTables); if (aAllTables) { i12keyTable.CreateTableL(); iSettingsTable.CreateTableL(); iSettingsTable.StoreCurrentLanguageL(); } iQwertyTable.CreateTableL(); _LIT(KSelectAllContactsFormat, "SELECT %S,%S,%S FROM %S;"); TInt bufSize = KSelectAllContactsFormat().Length() + KContactId().Length() + KContactFirstName().Length() + KContactLastName().Length() + KSqlContactTableName().Length(); HBufC* sqlStatement = HBufC::NewLC(bufSize); sqlStatement->Des().AppendFormat(KSelectAllContactsFormat, &KContactId, &KContactFirstName, &KContactLastName, &KSqlContactTableName); RSqlStatement stmnt; CleanupClosePushL(stmnt); PRINT1(_L("CreatePredSearchTablesL prepare SQL statement:%S"), sqlStatement); stmnt.PrepareL(iDatabase, *sqlStatement); const TInt KContactIdIndex = 0; const TInt KFirstNameIndex = 1; const TInt KLastNameIndex = 2; TInt err(KErrNone); while ((err = stmnt.Next()) == KSqlAtRow) { PRINT(_L("CreatePredSearchTablesL create CContactItem")); TInt id = KUidContactCardValue; TUid uid; uid.iUid = id; CContactItem* contact = CContactItem::NewLC(uid); contact->SetId(stmnt.ColumnInt(KContactIdIndex)); // If first name exists, write it to contact item TPtrC firstName; if (stmnt.ColumnText(KFirstNameIndex, firstName) == KErrNone) { CContactItemField* field = CContactItemField::NewLC(KStorageTypeText, KUidContactFieldGivenName); CContactTextField* textfield = field->TextStorage(); textfield->SetTextL(firstName); contact->AddFieldL(*field); // Takes ownership CleanupStack::Pop(field); } TPtrC lastName; if (stmnt.ColumnText(KLastNameIndex, lastName) == KErrNone) { CContactItemField* field = CContactItemField::NewLC(KStorageTypeText, KUidContactFieldFamilyName); CContactTextField* textfield = field->TextStorage(); textfield->SetTextL(lastName); contact->AddFieldL(*field); // Takes ownership CleanupStack::Pop(field); } PRINT(_L("CreatePredSearchTablesL create entry to tables")); if (aAllTables) { i12keyTable.CreateInDbL(*contact); } if (ReadMailAddressesL(*contact)) { iQwertyTable.CreateInDbL(*contact); } CleanupStack::PopAndDestroy(contact); } // Leave if we didn't complete going through the results properly if (err != KSqlAtEnd) { PRINT1(_L("CreatePredSearchTablesL SQL err=%d"), err); User::Leave(err); } CleanupStack::PopAndDestroy(&stmnt); CleanupStack::PopAndDestroy(sqlStatement); PRINT(_L("CPredictiveSearchSynchronizer::CreatePredSearchTablesL ends")); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // 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; } }
void CHandleOutSearch::HandleChildElement(TiXmlNode* aElement) { TInt index=iPointArray.Count()-1; TInt itemIndex=iPointArray[index]->GetItemCount()-1; if(itemIndex<0) { iPointArray[index]->CreatNewItem(); itemIndex=0; } if(aElement->NoChildren()) { if(iFlag) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->Value())); CleanupStack::PushL(buf); if(buf->Compare(_L("br"))==0) { if(!iPointArray[index]->GetItem(itemIndex).IsNull()) iPointArray[index]->CreatNewItem(); } if(buf->Compare(_L("br"))!=0&&buf->Compare(_L("img"))!=0&&buf->Compare(_L("input"))!=0&&buf->Compare(_L("|"))!=0) { if(buf->Left(2).Compare(_L("--"))==0) { TInt f=0; for(TInt i=0;i<buf->Length();i++) { if(buf->Mid(i,1).Compare(_L("-"))!=0) { f=1; break; } } if(f==0) { iFlag=EFalse; } } if(iFlag) iPointArray[index]->GetItem(itemIndex).SetName(*buf); else { if(!iPointArray[index]->GetItem(itemIndex).IsNull()) iPointArray[index]->CreatNewItem(); } } iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); } } else { HBufC8* tag=TPtrC8((const TUint8*)aElement->Value()).Alloc(); CleanupStack::PushL(tag); TInt value=CheckTag(*tag); CleanupStack::PopAndDestroy(1); if(value>0) { switch(value) { case 1: //P±êÇ© { TiXmlNode* element=aElement->FirstChild(); while(element!=0) { HandleChildElement(element); element=element->NextSibling(); } } break; case 2: //Á¬½Ó±êÇ© { HBufC8* bufUrl = TPtrC8((const TUint8*)aElement->ToElement()->Attribute("href")).Alloc(); CleanupStack::PushL(bufUrl); TInt urlFlag=CheckUrl(*bufUrl); if(urlFlag>0) { iPointArray[index]->GetItem(itemIndex).SetUrl(*bufUrl); } CleanupStack::PopAndDestroy(1); if(urlFlag==1||urlFlag==2) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); iPointArray[index]->GetItem(itemIndex).SetName(*buf); iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); iPointArray[index]->GetItem(itemIndex).SetIsLink(ETrue); iPointArray[index]->CreatNewItem(); } else { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); HBufC8* bufUrl = TPtrC8((const TUint8*)aElement->ToElement()->Attribute("href")).Alloc(); CleanupStack::PushL(bufUrl); if(CheckUrl(*bufUrl)==3) { if(buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_DownPage))==0||buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_HXML_DPage))==0) { iPointArray[index]->SetNextPageUrl(*bufUrl); } else if(buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_UpPage))==0||buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_HXML_UPage))==0) { iPointArray[index]->SetPrePageUrl(*bufUrl); } } iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(2); } } break; case 4://»»ÐбêÇ© if(!iPointArray[index]->GetItem(itemIndex).IsNull()&&iFlag) iPointArray[index]->CreatNewItem(); break; case 3://×ÖÌå±êÇ© { if(iFlag) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); iPointArray[index]->GetItem(itemIndex).SetName(*buf); iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); } } break; } } } }
// --------------------------------------------------------------------------- // CBSServer::DisplaySessionInfoL display the info for each open session, // except for the one that called this method // --------------------------------------------------------------------------- // void CBSServer::DisplaySessionInfoL( CBSSession* aSession, TInt aErrorCode ) { TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() begin aSession[%d], aErrorCode[%d]"),aSession,aErrorCode ); User::LeaveIfNull( aSession ); // some constants const TInt KStringLength = 512; const TInt KNumberLength = 16; _LIT( KMessage0,"Operation failed.Errorcode:"); _LIT( KMessage1," Info on open sessions [ProcessFileName|ThreadId|ProcessId|Caption]:"); _LIT( KBracketOpen, " ["); _LIT( KBracketClose, "]"); _LIT( KSeparator, "|"); HBufC* outputString = HBufC::NewLC( KStringLength ); TPtr outputStringPtr( outputString->Des() ); TBuf<KNumberLength> number; number.Num( aErrorCode ); //make sure the string is long enough TInt newLength = outputString->Length() + KMessage0().Length() + number.Length() + KMessage1().Length(); //reallocate if necessary if ( outputStringPtr.MaxLength() < newLength ) { CleanupStack::Pop( outputString ); outputString = outputString->ReAllocL( newLength ); outputStringPtr.Set( outputString->Des() ); CleanupStack::PushL( outputString ); } outputStringPtr.Append( KMessage0 ); outputStringPtr.Append( number ); outputStringPtr.Append( KMessage1 ); TInt count = iSessions.Count(); TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() numberSessions=%d"),count ); CBSSession* currentSession; for( TInt i = 0; i < count; i++ ) { currentSession = iSessions[i]; TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() iteration=%d session=%d"),i,currentSession ); if ( currentSession && currentSession->InfoAvailable() && currentSession != aSession ) { TBuf<KNumberLength> threadIdStr; TThreadId threadId; if ( KErrNone == currentSession->ThreadId( threadId ) ) { threadIdStr.NumUC( threadId.Id(), EDecimal ); } TBuf<KNumberLength> processIdStr; TProcessId processId; if ( KErrNone == currentSession->ProcessId( processId ) ) { processIdStr.NumUC( processId.Id(), EDecimal ); } //make sure the string is long enough newLength = outputString->Length() + KBracketOpen().Length() + currentSession->FileName().Length() + threadIdStr.Length() + processIdStr.Length() + currentSession->Caption().Length() + ( 3 * KSeparator().Length() ) + KBracketClose().Length(); //reallocate if necessary if ( outputStringPtr.MaxLength() < newLength ) { CleanupStack::Pop( outputString ); outputString = outputString->ReAllocL( newLength ); outputStringPtr.Set( outputString->Des() ); CleanupStack::PushL( outputString ); } outputStringPtr.Append( KBracketOpen ); //processfilename outputStringPtr.Append( currentSession->FileName() ); outputStringPtr.Append( KSeparator ); //threadid outputStringPtr.Append( threadIdStr ); outputStringPtr.Append( KSeparator ); //processid outputStringPtr.Append( processIdStr ); outputStringPtr.Append( KSeparator ); //caption outputStringPtr.Append( currentSession->Caption() ); outputStringPtr.Append( KBracketClose ); } } TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() string creation OK") ); TRACE( T_LIT( "%S"), outputString ); CleanupStack::PopAndDestroy( outputString ); TRACE( T_LIT( "CBSServer::DisplaySessionInfoL() end") ); }
/* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ TBool CMgAppUi::ShowDisclaimerL(void) { TBool OkToContinue(EFalse); if(KAppIsTrial){ TFindFile AppFile(CCoeEnv::Static()->FsSession()); if(KErrNone != AppFile.FindByDir(KtxDisclaimerFileName, KNullDesC)) { HBufC* Abbout = KtxDisclaimer().AllocLC(); TPtr Pointter(Abbout->Des()); CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter); dlg->PrepareLC(R_DDD_HEADING_PANE); dlg->SetHeaderTextL(KtxDisclaimerTitle); if(dlg->RunLD()) { TFileName ShortFil; if(KErrNone ==CCoeEnv::Static()->FsSession().PrivatePath(ShortFil)) { TFindFile privFile(CCoeEnv::Static()->FsSession()); if(KErrNone == privFile.FindByDir(ShortFil, KNullDesC)) { TParsePtrC hjelp(privFile.File()); ShortFil.Copy(hjelp.Drive()); ShortFil.Append(KtxDisclaimerFileName); } } BaflUtils::EnsurePathExistsL(CCoeEnv::Static()->FsSession(),ShortFil); RFile MyFile; if(KErrNone == MyFile.Create(CCoeEnv::Static()->FsSession(),ShortFil,EFileWrite)) { TTime NowTime; NowTime.HomeTime(); TBuf8<255> InfoLine; InfoLine.Copy(_L8("Accepted on Date\t")); InfoLine.AppendNum(NowTime.DateTime().Day() + 1); InfoLine.Append(_L8(".")); InfoLine.AppendNum((NowTime.DateTime().Month() + 1)); InfoLine.Append(_L8(".")); InfoLine.AppendNum(NowTime.DateTime().Year()); InfoLine.Append(_L8(" ")); InfoLine.Append(_L8("--")); InfoLine.AppendNum(NowTime.DateTime().Hour()); InfoLine.Append(_L8(":")); TInt HelperInt = NowTime.DateTime().Minute(); if(HelperInt < 10) InfoLine.AppendNum(0); InfoLine.AppendNum(HelperInt); InfoLine.Append(_L8(":")); HelperInt = NowTime.DateTime().Second(); if(HelperInt < 10) InfoLine.AppendNum(0); InfoLine.AppendNum(HelperInt); InfoLine.Append(_L8(" ")); MyFile.Write(InfoLine); MyFile.Close(); } OkToContinue = ETrue; } CleanupStack::PopAndDestroy(Abbout); } else { OkToContinue = ETrue; } } else { OkToContinue = ETrue; } return OkToContinue; }
// -------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddInternalStorageItemToLbxL // // // -------------------------------------------------------------------------- // void CAknMemorySelectionModelMultiDrive::AddInternalStorageItemToLbxL( const TCFDDriveInfo& aDriveInfo ) { HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr itemString( lbxItemBuf->Des() ); HBufC* textItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString( textItemBuf->Des() ); TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); // Item text is affected by layout switch( iLayout ) { case ELayoutPopupMenu: { // A-column icon: if( aDriveInfo.iDriveStatus == EDriveOK ) { itemString.Format( KImageHeader, EIconInternalMassStorage ); } else { itemString.Format( KImageHeader, EIconInternalMassStorageUnavailable ); } itemString.Append( KTabChar ); // 1st row text: if( aDriveInfo.iDriveStatus == EDriveOK ) { StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); } else { StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorageUnavailable ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); break; } case ELayoutSettingPage: { // 1st row text: StringLoader::Format( itemString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); break; } case ELayoutDoublePopup: { // A-column icon: itemString.Format( KImageHeader, EIconInternalMassStorage ); itemString.Append( KTabChar ); // 1st row text: StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); itemString.Append( textString ); itemString.Append( KTabChar ); // 2nd row text: if ( aDriveInfo.iDriveStatus == EDriveOK ) { HBufC* buffer; TInt64 freeSpace = aDriveInfo.iDiskSpace; if ( freeSpace >= 0 ) { buffer = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr unitStr( buffer->Des() ); AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr ); } else { // Disk space is unavailable buffer = StringLoader::LoadLC( R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE, iCoeEnv); } itemString.Append( *buffer );//Free mem text CleanupStack::PopAndDestroy( buffer ); } else { itemString.Append( *iLocStringArray[ ETextInternalMassStorageUnavailable ] ); } break; } } // Finally!: append the formatted string to listbox User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); CleanupStack::PopAndDestroy( textItemBuf ); CleanupStack::Pop( lbxItemBuf ); _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); _LOG1( "itemString length=%d", itemString.Length() ); }
void CCrashContainer::HandleCommandL(TInt aCommand) { switch (aCommand) { case EAppHelpBack: { delete iMyHelpContainer; iMyHelpContainer = NULL; } SetMenuL(); DrawNow(); break; case EAppHelp: { delete iMyHelpContainer; iMyHelpContainer = NULL; iMyHelpContainer = CMyHelpContainer::NewL(); } SetMenuL(); DrawNow(); break; case EItemInfo: if(iSelectionBox) { TInt CurrInd = iSelectionBox->CurrentItemIndex(); if(CurrInd >= 0 && CurrInd <= iArray.Count()) { if(iArray[CurrInd]) { HBufC* Informmm = HBufC::NewLC(3000); TPtr Pointter(Informmm->Des()); GetInfoBufferL(*iArray[CurrInd],Pointter); TPtr NewPointter(Informmm->Des()); CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(NewPointter); dlg->PrepareLC(R_ABOUT_HEADING_PANE); dlg->SetHeaderTextL(KCrashApplicationName); dlg->RunLD(); CleanupStack::PopAndDestroy(Informmm); } } } break; case ESetMeOn: { iServerIsOn = ETrue; RExampleServerClient CrashClient; CrashClient.Connect(); CrashClient.Close(); ChangeIconAndNameL(); } break; case ESetMeOff: { iServerIsOn = EFalse; RExampleServerClient CrashClient; CrashClient.Connect(); CrashClient.ShutServerDownNow(); CrashClient.Close(); ChangeIconAndNameL(); } break; case EClearMe: { CAknQueryDialog* dlg = CAknQueryDialog::NewL(); if(dlg->ExecuteLD(R_QUERY,_L("Clear list"))) { RExampleServerClient CrashClient; CrashClient.Connect(); CrashClient.ClearItemList(); if(!iServerIsOn) { CrashClient.ShutServerDownNow(); } CrashClient.Close(); DisplayListBoxL(); DisplayListBoxL(); } } DrawNow(); break; case EHideKill0: { iHideKill0 = ETrue; DisplayListBoxL(); DisplayListBoxL(); } DrawNow(); break; case EShowKill0: { iHideKill0 = EFalse; DisplayListBoxL(); DisplayListBoxL(); } DrawNow(); break; case EResetMe: { DisplayListBoxL(); } break; case EAbout: { HBufC* Abbout = KCrashAbbout().AllocLC(); TPtr Pointter(Abbout->Des()); CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(Pointter); dlg->PrepareLC(R_ABOUT_HEADING_PANE); dlg->SetHeaderTextL(KCrashApplicationName); dlg->RunLD(); CleanupStack::PopAndDestroy(Abbout); } break; case EBacktoYTasks: if(iTasksHandlerExit) { if(!iServerIsOn) { CAknQueryDialog* dlg = CAknQueryDialog::NewL(); if(dlg->ExecuteLD(R_QUERY,_L("Set Crash monitor on"))) { RExampleServerClient CrashClient; CrashClient.Connect(); CrashClient.Close(); } } iTasksHandlerExit->HandlerExitL(this); } break; default: break; }; }
// --------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddRemoteItemToLbxL // --------------------------------------------------------------------------- // void CAknMemorySelectionModelMultiDrive::AddRemoteItemToLbxL( const TCFDDriveInfo& aDriveInfo ) { HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr itemString( lbxItemBuf->Des() ); // Item text is affected by layout switch( iLayout ) { case ELayoutPopupMenu: { // A-column icon: itemString.Format( KImageHeader, EIconRemoteDrive ); itemString.Append( KTabChar ); // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { // Append drive name if it has one itemString.Append( aDriveInfo.iVolumeLabel ); } else { // Use default drive description itemString.Append( *iLocStringArray[ ETextRemoteDrive ] ); } break; } case ELayoutSettingPage: { // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { // Append drive name if it has one itemString.Append( aDriveInfo.iVolumeLabel ); } else { // Use default drive description itemString.Append( *iLocStringArray[ ETextRemoteDrive ] ); } break; } case ELayoutDoublePopup: { // A-column icon: itemString.Format( KImageHeader, EIconRemoteDrive ); itemString.Append( KTabChar ); // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { // Append drive name if it has one itemString.Append( aDriveInfo.iVolumeLabel ); itemString.Append( KTabChar ); } else { // Use default drive description itemString.Append( *iLocStringArray[ ETextRemoteDrive ] ); itemString.Append( KTabChar ); } if( aDriveInfo.iDriveStatus == EDriveOK ) { // 2nd row text: // Currently Remote drive does not support query for available // disk space, so just return " " _LIT( KEmptySpace, " "); itemString.Append( KEmptySpace ); //if( aDriveInfo.iConnectionState == KMountStronglyConnected ) // { // D-column icon: Show active icon if drive has no error // itemString.Append( KTabChar ); // itemString.AppendFormat( // KImageHeader, EIconRemoteDriveActive ); // } //else // KMountNotConnected // { // D-column icon: Show active icon if drive has no error itemString.Append( KTabChar ); // } } else { // 2nd row text: itemString.Append( *iLocStringArray[ ETextMMCUnavailable ] ); // D-column is empty if error. } break; } } // Finally!: append the formatted string to listbox User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); CleanupStack::Pop( lbxItemBuf ); _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); _LOG1( "itemString length=%d", itemString.Length() ); }
EXPORT_C void CSettingsListBoxItemDrawer::DrawItemText( TInt aItemIndex, const TRect& aItemTextRect, TBool aItemIsCurrent, TBool /*aViewIsEmphasized*/, TBool /*aItemIsSelected*/) const { _AKNTRACE_FUNC_ENTER; _AKNTRACE("DrawItemText: aItemIndex=%d, aItemTextRect=(%d,%d,%d,%d), aItemIsCurrent=%d", aItemIndex, aItemTextRect.iTl.iX, aItemTextRect.iTl.iY, aItemTextRect.iBr.iX, aItemTextRect.iBr.iY, aItemIsCurrent); #ifdef RD_UI_TRANSITION_EFFECTS_LIST MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc ); if ( transApi ) { transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified ); } #endif //RD_UI_TRANSITION_EFFECTS_LIST iGc->SetBrushColor( AKN_LAF_COLOR( 0 ) ); #ifdef RD_UI_TRANSITION_EFFECTS_LIST if ( transApi ) { transApi->StopDrawing(); } #endif //RD_UI_TRANSITION_EFFECTS_LIST DrawBackgroundAndSeparatorLines( aItemTextRect ); if ( aItemIsCurrent ) { FormattedCellData()->SetCurrentItemIndex( aItemIndex ); } FormattedCellData()->SetCurrentlyDrawnItemIndex( aItemIndex ); FormattedCellData()->DrawSettingHighlight( *iGc, aItemTextRect, aItemIsCurrent ); TBool drawBackground = ETrue; TPtrC temp = iModel->ItemText( aItemIndex ); TPtrC columnText; TextUtils::ColumnText( columnText, 3, &temp ); if ( columnText == KNullDesC ) { drawBackground = EFalse; } #ifdef RD_UI_TRANSITION_EFFECTS_LIST if ( transApi ) { transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); iGc->SetClippingRect( iViewRect ); } #endif // RD_UI_TRANSITION_EFFECTS_LIST // draw setting item's background if ( drawBackground ) { TAknLayoutRect outerRect; TAknWindowComponentLayout valuePane; #ifdef RD_LIST_STRETCH if ( Layout_Meta_Data::IsLandscapeOrientation() && Layout_Meta_Data::IsListStretchingEnabled() && FormattedCellData()->StretchingEnabled() ) { valuePane = AknLayoutScalable_Avkon::set_value_pane_cp_vc( 0 ); } else #endif // RD_LIST_STRETCH { valuePane = AknLayoutScalable_Avkon::set_value_pane_cp( 0 ); } outerRect.LayoutRect( aItemTextRect, TAknWindowComponentLayout::Compose( valuePane, AknLayoutScalable_Avkon::bg_set_opt_pane( 0 ) ).LayoutLine() ); TBool frameDrawn = EFalse; MAknsControlContext *cc = AknsDrawUtils::ControlContext( FormattedCellData()->Control() ); if ( !cc ) { cc = FormattedCellData()->SkinBackgroundContext(); } if ( cc ) { TAknLayoutRect innerRect; innerRect.LayoutRect( aItemTextRect, TAknWindowComponentLayout::Compose( valuePane, AknLayoutScalable_Avkon::bg_set_opt_pane_g1() ).LayoutLine() ); frameDrawn = AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), *iGc, outerRect.Rect(), innerRect.Rect(), KAknsIIDQsnFrSetOptFoc, KAknsIIDQsnFrSetOptFocCenter ); } if ( !frameDrawn ) { iGc->SetBrushColor( AKN_LAF_COLOR( 243 ) ); iGc->Clear( outerRect.Rect() ); } } SetupGc( aItemIndex ); CFormattedCellListBoxData::TColors colors; TBufC<KMaxTotalDataLength> target; // Try to allocate buffer dynamically. If out of memory, use the fixed size stack buffer. // This size should be sufficient. TInt size = temp.Length() * 2; HBufC* buffer = NULL; if ( size > KMaxTotalDataLength ) { buffer = HBufC::New( size ); } TPtr des = ( buffer ? buffer->Des() : target.Des() ); TDesC* targetptr = &temp; if ( columnText == KNullDesC ) { #ifdef RD_LIST_STRETCH // If list stretching is used and the device is in landscape orientation // there is only one text cell available. Therefore, word wrapping // cannot be done. Instead the first text cell must be omitted and the // possible text moved to the second cell. If both text cells contain // data they are combined and the data is moved to the second cell (i.e. // the first cell is never drawn in landscape if list stretching is // turned on). if ( Layout_Meta_Data::IsLandscapeOrientation() && Layout_Meta_Data::IsListStretchingEnabled() && FormattedCellData()->StretchingEnabled() ) { TBool swapCells = ETrue; TPtrC itemText; // check if cell swapping should be done at all for ( TInt i = 2; i <= 4; ++i ) { if ( TextUtils::ColumnText( itemText, i, targetptr ) == KErrNotFound ) { break; } if ( itemText != KNullDesC ) { swapCells = EFalse; break; } } TextUtils::ColumnText( itemText, 1, targetptr ); if ( swapCells && itemText.Length() > 0 ) { TPtrC secondaryText; TextUtils::ColumnText( secondaryText, 5, targetptr ); // remove text from the first text cell AknLAFUtils::ReplaceColumn( des, targetptr, (TDesC16*)&KNullDesC, KColumnListSeparator, 1 ); // ReplaceColumn does not update descriptor's length :( des.Set( buffer ? buffer->Des() : target.Des() ); TInt secondaryPos = 0; TPtrC temp; temp.Set( des ); // add separators if needed for ( TInt i = 0; i < 5; ++i ) { TInt position = temp.Locate( KColumnListSeparator ); if ( position != KErrNotFound ) { if ( position < temp.Length() ) { ++position; } secondaryPos += position; } else { des.Append( KColumnListSeparator ); secondaryPos = des.Length(); } temp.Set( des.Mid( secondaryPos ) ); } des.Insert( secondaryPos, itemText ); if ( secondaryText != KNullDesC ) { _LIT( KEmptySpace, " " ); des.Insert( secondaryPos + itemText.Length(), KEmptySpace ); } targetptr = &des; } } else { WordWrapListItem( des, *targetptr, 1, 5, aItemIndex ); // Set again because ReplaceColumn in WordWrapListItem does not update the length to 'des' ! des.Set( buffer ? buffer->Des() : target.Des() ); targetptr = &des; } #else WordWrapListItem( des, temp, 1, 5, aItemIndex ); // Set again because ReplaceColumn in WordWrapListItem does not update the length to 'des' ! des.Set( buffer ? buffer->Des() : target.Des() ); targetptr = &des; #endif // RD_LIST_STRETCH } #ifdef RD_UI_TRANSITION_EFFECTS_LIST if ( transApi ) { iGc->CancelClippingRect(); transApi->StopDrawing(); } #endif // RD_UI_TRANSITION_EFFECTS_LIST if (FormattedCellData()->IsMarqueeOn() && FormattedCellData()->CurrentMarqueeItemIndex() != aItemIndex && aItemIsCurrent) { FormattedCellData()->ResetMarquee(); FormattedCellData()->SetCurrentMarqueeItemIndex(aItemIndex); } SettingsData()->Draw( Properties( aItemIndex ), *iGc, targetptr, aItemTextRect, aItemIsCurrent, colors ); delete buffer; _AKNTRACE_FUNC_EXIT; }
void CSpreadWFDialogs::HandleGeneratedEventL(enum TSpreadWFEvent aEvent) { switch (aEvent) { case ESpreadWFEventInfoDialogOk: { //User has seen info dialog and now has to select to //search from phonebook or to enter a number. ShowSpreadWayfinderOptionsDialogL(); } break; case ESpreadWFEventInfoDialogCancel: { //Cleanup to release the phone book. Cleanup(); } break; case ESpreadWFEventOptionsOk: { //See what option the user chose if (iOptionsIndex == 0) { //Find and then display all contacts. iContactBkEngine->FindAllContactsL(); if (iContactBkEngine->CountSearchResults() > 0) { ContactBkSearchDone(KErrNone); } else { iContactBkEngine->ClearSearch(); ContactBkSearchDone(KErrNotFound); } } else { //Let the user enter a phone number ShowSpreadWayfinderEnterToDialogL(); } } break; case ESpreadWFEventOptionsCancel: { //Cleanup to release the phone book. Cleanup(); } break; case ESpreadWFEventEnterToOk: { //Validate phonenumber and show about to send sms info. if (CommonPhoneParser::IsValidPhoneNumber(iSpreadWFSmsField, CommonPhoneParser::EPhoneClientNumber)) { //Popup dialog saying we're going to send an sms. ShowSpreadWayfinderSendToDialogL(); } else { //User entered a invalid phone number, tell him and start over. ShowGenericInfoDialogL(ESpreadWFEventInfoDialogOk, ESpreadWFEventInfoDialogCancel, R_WAYFINDER_INFORMATION_TITLE, R_WAYFINDER_INVALIDNUMBER_MSG, R_NON_BLOCKING_QUERY_MESSAGE_OK_BACK); } } break; case ESpreadWFEventEnterToCancel: { //User cancelled entering phoneno so we show him the options again. ShowSpreadWayfinderOptionsDialogL(); } break; case ESpreadWFEventContactBkSearchDialogOk: { //Store the contact id the user selected and //show that contacts phone numbers. if (iContactBkIndex < 0) { iContactBkEngine->ClearSearch(); ContactBkSearchDone(KErrNotFound); } else { iContactBkEngine->SetCurrentContact(iContactBkIndex); ShowAllPhoneNumbersDialogL(); } } break; case ESpreadWFEventContactBkSearchDialogCancel: { //Clear the ContactBk search cause the user cancelled. //Then show the options dialog again. iContactBkEngine->ClearSearch(); ShowSpreadWayfinderOptionsDialogL(); } break; case ESpreadWFEventContactBkPhoneNumberDialogOk: { //Store number the user selected, show the send sms confirm dialog. iSpreadWFSmsField = iContactBkNumberArray->MdcaPoint(iContactBkIndex); ShowSpreadWayfinderSendToDialogL(); } break; case ESpreadWFEventContactBkPhoneNumberDialogCancel: { //The user cancelled when selecting numbers so show //him available contacts again. ContactBkSearchDone(KErrNone); } break; case ESpreadWFEventSendToOk: { //Now we actually send the sms. _LIT(KSpace, " "); HBufC* sms = HBufC::NewL(160); TPtr smsPtr = sms->Des(); CCoeEnv::Static()->ReadResourceL(smsPtr, R_WF_SPREAD_WAYFINDER_MESSAGE); sms->Des().Append(KSpace); sms->Des().Append(*iSmsUrl); if (sms) { if (iSmsSender) { //Make sure the caller did supply //an object for sending the smses. iSmsSender->SendSmsL(*sms, iSpreadWFSmsField); } delete sms; } //Cleanup to release the phone book. Cleanup(); } break; case ESpreadWFEventSendToCancel: { //The user cancelled sending the sms, so show him the options dialog. iContactBkEngine->ClearSearch(); ShowSpreadWayfinderOptionsDialogL(); } break; default: //Do nothing, shouldn't happen. break; } }
// open browser void CFilelistAppUi::StartBrowser() { RApaLsSession apaLsSession; _LIT(KFileProtocol,"file:///"); // _LIT(KFile,"\\System\\Data\\installer\\welcome.html"); _LIT(KFile,"${page.startup}"); TFileName aFileName(KFile()); //const TUid KOSSBrowserUidValue = {0x1020724D}; const TUid KOSSBrowserUidValue = {${browser.UID}}; HBufC* param = HBufC::NewLC(64); CompleteWithAppPath(aFileName); param->Des().Copy(_L("4 ")); param->Des().Append(KFileProtocol); param->Des().Append(aFileName); //CEikonEnv::InfoWinL(_L("Link to File"),param->Des()); TUid id(KOSSBrowserUidValue); TApaTaskList taskList(CEikonEnv::Static()->WsSession()); TApaTask task = taskList.FindApp(id); if(task.Exists()) { task.BringToForeground(); HBufC8* param8 = HBufC8::NewLC(param->Length()); param8->Des().Append(*param); task.SendMessage(TUid::Uid(0), *param8); // UID not used CleanupStack::PopAndDestroy(param8); } else { if(!apaLsSession.Handle()) { User::LeaveIfError(apaLsSession.Connect()); } TThreadId thread; User::LeaveIfError(apaLsSession.StartDocument(*param, KOSSBrowserUidValue, thread)); apaLsSession.Close(); } CleanupStack::PopAndDestroy(param); }
/** @file @SYMTestCaseID SYSLIB-SCHSVR-CT-0249 @SYMTestCaseDesc OOM test for time-based schedules - UTC @SYMTestPriority High @SYMTestActions OOM test for time-based schedules @SYMTestExpectedResults The test must not fail. @SYMPREQ PREQ234 */ static void DoTest1L() // Time based API's { TInt err = KErrNone; TInt tryCount = 0; TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-SCHSVR-CT-0249 ===== Starting OOM test ===== ")); CSchEntryInfoArray* scheduleArray = CreateScheduleArrayLC(); TSchedulerItemRef ref1; TheTest.Next(_L("===== Testing create persistent schedule =====")); for (tryCount = 0; ;++tryCount) { // These allocations are ignored because they cause corruptness // of the persistent store. Its a bit rubbish. if(tryCount < 7 || tryCount >8 ) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.CreatePersistentSchedule(ref1, *scheduleArray); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } } // Check schedule count TInt scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); // OK, now we have a persistent schedule TheTest.Next(_L("===== Testing disable schedule =====")); for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.DisableSchedule(ref1.iHandle); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } // Check schedule count scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); TheTest.Next(_L("===== Testing enable schedule =====")); for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.EnableSchedule(ref1.iHandle); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } // Check schedule count scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); TheTest.Next(_L("===== Testing edit schedule =====")); for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); // Even though we use the same array as before, the task scheduler // code is not smart enough to just return but actually replaces // the existing one, hence we are actually testing this method fully. err = TheScheduler.EditSchedule(ref1.iHandle, *scheduleArray); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } // Check schedule count scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); TheTest.Next(_L("===== Testing delete schedule =====")); for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.DeleteSchedule(ref1.iHandle); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } // Check schedule count scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 0); // delete old files. // We need to do this because we have actually corrupted the store, // even though its empty. Without deleting it we get problems below. // This is a bit rubbish having to do this but what else can be done?? TheTest.Next(_L("Delete old files")); SchSvrHelpers::DeleteScheduleFilesL(); // OK now add back schedule in preparation for adding tasks. err = TheScheduler.CreatePersistentSchedule(ref1, *scheduleArray); TEST2(err, KErrNone); TheTest.Next(_L("===== Testing ScheduleTask =====")); _LIT(KTaskName, "TheTaskName"); TName name = KTaskName(); TTaskInfo taskInfo(0, name, 2, 0); HBufC* data = _L("the data").AllocLC(); // cant test ScheduleTask API using OOM loop as it does dodgy things to // the store which cause allocation problems. Need to investigate this // later at some stage. TEST2(TheScheduler.ScheduleTask(taskInfo, *data, ref1.iHandle), KErrNone); // Check schedule and task count scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); TInt taskCount = CountTasksL(ref1.iHandle); TEST(taskCount = 1); TheTest.Next(_L("===== Testing GetScheduleRefsL =====")); CSchItemRefArray* refs = new (ELeave) CSchItemRefArray(3); CleanupStack::PushL(refs); for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.GetScheduleRefsL(*refs, EPendingSchedules); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } // Check schedule and task count scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); taskCount = CountTasksL(ref1.iHandle); TEST(taskCount = 1); TheTest.Next(_L("===== Testing GetScheduleL =====")); CTaskInfoArray* tasks = new (ELeave) CTaskInfoArray(3); CleanupStack::PushL(tasks); TScheduleState2 state; TTsTime time; CSchEntryInfoArray* entryList = new (ELeave) CSchEntryInfoArray(3); CleanupStack::PushL(entryList); for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.GetScheduleL(ref1.iHandle, state, *entryList, *tasks, time); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } // Check schedule and task count TEST(entryList->Count() == 1); TEST(tasks->Count() == 1); scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); taskCount = CountTasksL(ref1.iHandle); TEST(taskCount = 1); CleanupStack::PopAndDestroy(entryList); CleanupStack::PopAndDestroy(tasks); TheTest.Next(_L("===== Testing GetTaskRefsL =====")); for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.GetTaskRefsL(*refs, EAllSchedules, EAllTasks); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } CleanupStack::PopAndDestroy(refs); TheTest.Next(_L("===== Testing GetTaskDataSize =====")); TInt size; for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.GetTaskDataSize(ref1.iHandle, size); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } TheTest.Next(_L("===== Testing GetTaskInfoL =====")); HBufC* newData = HBufC::NewLC(size); TPtr pTaskData = newData->Des(); TTaskInfo newTaskInfo; for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.GetTaskInfoL(taskInfo.iTaskId, newTaskInfo, pTaskData, ref1, time); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } TEST(newData->MatchF(*data) == 0); scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); taskCount = CountTasksL(ref1.iHandle); TEST(taskCount = 1); CleanupStack::PopAndDestroy(newData); CleanupStack::PopAndDestroy(data); TheTest.Next(_L("===== Testing GetScheduleTypeL =====")); TScheduleType type; for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.GetScheduleTypeL(ref1.iHandle, type); if (err==KErrNone) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } TEST(type == ETimeSchedule); CleanupStack::PopAndDestroy(scheduleArray); TheTest.Next(_L("===== Testing DeleteTask =====")); for (tryCount = 0; ;++tryCount) { TheScheduler.__DbgFailNext(tryCount); TheScheduler.__DbgMarkHeap(); err = TheScheduler.DeleteTask(taskInfo.iTaskId); //include test for KErrNotFound here as task is actually deleted and // then store is updated (which causes mem failure). Problems // will still occur if you add a new task again and try and access store // as store is likely to still be corrupt. Investigate this?? if (err==KErrNone || err==KErrNotFound) { TheScheduler.__DbgResetHeap(); break; } TEST2(err, KErrNoMemory); // reset server side heap for next iteration. TheScheduler.__DbgMarkEnd(0); } scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 1); taskCount = CountTasksL(ref1.iHandle); TEST(taskCount == 0); //Now delete schedule to setup for next test TEST2(TheScheduler.DeleteSchedule(ref1.iHandle), KErrNone); scheduleCount = CountScheduledItemsL(EAllSchedules, TheScheduler); TEST(scheduleCount == 0); SchSvrHelpers::Pause(TheTest); }
TBool CProfileListDialog::OkToExitL(TInt aButtonId) { TBool okToExit = EFalse; CEikTextListBox *lbox = ((CEikTextListBox*)Control(EProfileListDlgProfileList)); // Buffers for current and new file names and a name HBufC *fileNameBuf = HBufC::NewLC(KMaxFileName); TPtr fileName = fileNameBuf->Des(); HBufC *nameBuf = HBufC::NewLC(KMaxFileName); TPtr name = nameBuf->Des(); switch ( aButtonId ) { case ECmdProfileListConnect: { // Connect to the selected profile TInt sel = lbox->CurrentItemIndex(); if ( sel == KDefaultProfileIndex ) { iProfileFile = iDefaultProfileFile; } else { iProfileFile = iProfileDirectory; iProfileFile.Append((*iProfileArray)[sel]); } okToExit = ETrue; break; } case ECmdProfileListEdit: { // Edit the selected profile TInt sel = lbox->CurrentItemIndex(); if ( sel == KDefaultProfileIndex ) { name = KDefaultProfileName; fileName = iDefaultProfileFile; } else { name = (*iProfileArray)[sel]; fileName = iProfileDirectory; fileName.Append(name); } // Edit settings iPutty->ReadConfigFileL(fileName); Config *cfg = iPutty->GetConfig(); CSettingsDialog *dlg = new (ELeave) CSettingsDialog(name, (sel == KDefaultProfileIndex), cfg, iPutty); switch ( dlg->ExecuteLD(R_SETTINGS_DIALOG) ) { case EEikBidOk: // Handle rename first if ( (sel != KDefaultProfileIndex) && (name.Compare((*iProfileArray)[sel]) != 0) ) { MakeNameLegal(name); // Delete current file so that we can rename to a file // that maps to the same name (e.g. changes in case) User::LeaveIfError( CEikonEnv::Static()->FsSession().Delete(fileName)); MakeNameUniqueL(name); fileName = iProfileDirectory; fileName.Append(name); // Update profile list and listbox iProfileArray->Delete(sel); iProfileArray->InsertL(sel, name); lbox->DrawNow(); } // Just write, the name can be an old one or a renamed one iPutty->WriteConfigFileL(fileName); break; case ECmdSettingsDelete: if ( sel != KDefaultProfileIndex ) { // Remove the profile from the list and update // listbox iProfileArray->Delete(sel); lbox->HandleItemRemovalL(); if ( sel >= iProfileArray->Count() ) { sel = iProfileArray->Count() - 1; } lbox->SetCurrentItemIndexAndDraw(sel); // Delete profile file User::LeaveIfError( CEikonEnv::Static()->FsSession().Delete(fileName)); } break; default: break; } okToExit = EFalse; break; } case ECmdProfileListNew: { // New profile -- start with defaults, but with a new name iPutty->ReadConfigFileL(iDefaultProfileFile); Config *cfg = iPutty->GetConfig(); name = KNewProfileName; MakeNameUniqueL(name); CSettingsDialog *dlg = new (ELeave) CSettingsDialog(name, EFalse, cfg, iPutty); if ( dlg->ExecuteLD(R_SETTINGS_DIALOG) == EEikBidOk ) { // Finalize name MakeNameLegal(name); MakeNameUniqueL(name); fileName = iProfileDirectory; fileName.Append(name); // Update the listbox iProfileArray->AppendL(name); lbox->HandleItemAdditionL(); lbox->SetCurrentItemIndexAndDraw(iProfileArray->Count() - 1); // Write out new settings iPutty->WriteConfigFileL(fileName); } okToExit = EFalse; break; } case ECmdProfileListClose: okToExit = ETrue; break; default: User::Invariant(); } CleanupStack::PopAndDestroy(2); //fileNameBuf, nameBuf return okToExit; }