当前位置: 首页>>代码示例>>C++>>正文


C++ HBufC类代码示例

本文整理汇总了C++中HBufC的典型用法代码示例。如果您正苦于以下问题:C++ HBufC类的具体用法?C++ HBufC怎么用?C++ HBufC使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HBufC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

// ----------------------------------------------------
// 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:
//.........这里部分代码省略.........
开发者ID:imrekel,项目名称:Symella,代码行数:101,代码来源:SymellaAppUi.cpp

示例2: switch

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
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;
            }

//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:101,代码来源:EPos_CPosLmGpxParser.cpp

示例3: SetFiltersL

// ---------------------------------------------------------
// 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
}
开发者ID:kuailexs,项目名称:symbiandump-mw4,代码行数:70,代码来源:FavouritesSrvTable.cpp

示例4: CERTMANUILOGGER_ENTERFN

// ---------------------------------------------------------
// 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" );
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:72,代码来源:CertmanuicontainerPersonal.cpp

示例5: itemString

// ---------------------------------------------------------------------------
// 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:
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:101,代码来源:caknmemoryselectionmodelmultidrive.cpp

示例6: AllocL

// ----------------------------------------------------------------------------
// 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;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:11,代码来源:mpxuser.cpp

示例7: ShowSingleValueL

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;
//.........这里部分代码省略.........
开发者ID:mpvader,项目名称:qt,代码行数:101,代码来源:pm_mapperapp.cpp

示例8: QCRITICAL_WRITE

//---------------------------------------------------------------
// 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.")
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:72,代码来源:conversationsmodel.cpp

示例9: LoadListL

// ----------------------------------------------------
// 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();
//.........这里部分代码省略.........
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:101,代码来源:NormalSettingContainer.cpp

示例10: SetBIOServiceIdL

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();
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:76,代码来源:testunidatamodelvcalplugin.cpp

示例11: XQSERVICE_DEBUG_PRINT

/*!
    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);
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:74,代码来源:xqserviceipcserver_symbiansession.cpp

示例12: ConvertTo16BitL1

HBufC* ConvertTo16BitL1(const TDesC8& aDes8)
{
   HBufC* myBuf = HBufC::NewL(aDes8.Length());
   myBuf->Des().Copy(aDes8);
   return myBuf;
}
开发者ID:bohwaz,项目名称:officereader,代码行数:6,代码来源:EditorViewContainer.cpp

示例13: ConstructSourceL

/**
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);
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:Mmffile.cpp

示例14: E32Main

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;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:79,代码来源:t_power.cpp

示例15: Ret

/*
-------------------------------------------------------------------------
-------------------------------------------------------------------------
*/
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())
	{	
//.........这里部分代码省略.........
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:101,代码来源:ExampleServer.cpp


注:本文中的HBufC类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。