// -----------------------------------------------------------------------------
// CTestSDKButtons::TestMenuBtWriteInternalStateL
// -----------------------------------------------------------------------------
//
TInt CTestSDKButtons::TestMenuBtWriteInternalStateL( CStifItemParser& /*aItem*/ )
    {
    class CTestEikMenuButton : public CEikMenuButton
        {
    public:
        /*Constructor*/
        CTestEikMenuButton(){}
        /*Deconstructor*/
        ~CTestEikMenuButton(){}
        void DoWriteInternalStateL( RWriteStream aStream )
            {
            WriteInternalStateL( aStream );
            }
        };
    CTestEikMenuButton* menubutton = new ( ELeave ) CTestEikMenuButton;
    CleanupStack::PushL( menubutton );
    TResourceReader reader;
    CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TEST_MENU_BUTTON );
    menubutton->ConstructFromResourceL( reader );
    const TInt KHBufSize = 4096;
    HBufC8* buf = HBufC8::NewL( KHBufSize );
    CleanupStack::PushL( buf );
    TPtr8 ptr = buf->Des();
    RDesWriteStream stream;
    CleanupClosePushL( stream );
    stream.Open( ptr );
    menubutton->DoWriteInternalStateL( stream );
    stream.CommitL();
    stream.Close();
    CleanupStack::PopAndDestroy( 4 );// menubutton, reader, buf, stream
    
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKSettingPages::TestSettingpagesRadioButtonWriteInternalStateLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKSettingPages::TestSettingpagesRadioButtonWriteInternalStateLL( CStifItemParser& /*aItem*/ )
    {
    CDesCArrayFlat* mArr = new( ELeave ) CDesCArrayFlat( KSize );
    CleanupStack::PushL( mArr );

    TBuf<KBufSize> tom( KTom );
    TBuf<KBufSize> jack( KJack );
    TBuf<KBufSize> mary( KMary );
    mArr->AppendL( tom );
    mArr->AppendL( jack );
    mArr->AppendL( mary );
    TInt optin( KZero );
    TBuf< KBufSize > buffer( KTestString );
    CTestRadioButtonSettingPage* dialog =
    new (ELeave) CTestRadioButtonSettingPage( &buffer, KOne, EAknCtPopupSettingList,
        R_EXAMPLE_EDITOR_CONTROL, R_EXAMPLE_SETTING_PAGE, optin, mArr );
    CleanupStack::PushL( dialog );
    dialog->ConstructL();
    
    RDesWriteStream stream;
    CleanupClosePushL( stream );
    HBufC8* hbuf = HBufC8::NewL( KHBufSize );
    CleanupStack::PushL( hbuf );
    TPtr8 ptr = hbuf->Des();
    stream.Open( ptr );
    dialog->DoWriteInternalStateL( stream );
    stream.CommitL();
    stream.Close();  
    CleanupStack::PopAndDestroy( KFour );
    return KErrNone;
    }
static void ExternalizeL( RDesWriteStream& aStream, CCallRemotePartyInfo& aInfo )
    {
    aStream.PushL();
    aInfo.ExternalizeL( aStream );
    aStream.CommitL();
    aStream.Pop();
    aStream.Close();
    }
Exemplo n.º 4
0
// --------------------------------------------------------------------------
// void CNSmlSOSHandler::CompleteEventMsgL( MSyncMLEventObserver::TEvent aEvent, TInt aId, TInt aError, TInt aAdditional )
// Writes data to all event messages and completes them.
// --------------------------------------------------------------------------
//
void CNSmlSOSHandler::CompleteEventMsgL( MSyncMLEventObserver::TEvent aEvent, TInt aId, TInt aError, TInt aAdditional )
    {
    if ( iEventMsgs.Count() )
        {
        HBufC8* buf = HBufC8::NewLC(( (2*KSizeofTInt8) + (3*KSizeofTInt32) ));
        TPtr8 bufPtr = buf->Des();

        RDesWriteStream stream;
        stream.Open(bufPtr);
        CleanupClosePushL(stream);

        stream.WriteInt8L( (TInt8) ENSmlTypeEvent );
        stream.WriteInt8L( (TInt8) aEvent );
        stream.WriteInt32L( aId );
        stream.WriteInt32L( aError );
        stream.WriteInt32L( aAdditional );
        stream.CommitL();

        while ( iEventMsgs.Count() > 0 )
            {
            if(!iEventMsgs[0].IsNull()&& iEventMsgs[0].Handle())
                {
                iEventMsgs[0].Write( 0, bufPtr, 0 );
                iEventMsgs[0].Complete( KErrNone );
                }
            iEventMsgs.Remove(0);
            }
        CleanupStack::PopAndDestroy(&stream); 
        CleanupStack::PopAndDestroy(buf);
        }
    }
Exemplo n.º 5
0
void CIpUpsDialog::DoDisplayDialogL()
/**
Uses the notifier framework to display the dialog.
*/
   {
   // Externalize the prompt data to a descriptor
   RNullWriteStream ns;
   ns << *iPromptData;
   ns.CommitL();
   iPromptDataDes.CreateL(ns.BytesWritten());
   RDesWriteStream ws;	
   ws.Open(iPromptDataDes);
   ws << *iPromptData;
   ws.CommitL();	
   iNotifier.StartNotifierAndGetResponse(iStatus, TUid::Uid(iNotifierId),
                                         iPromptDataDes, iPromptResultPckg);
   SetActive();
   iState = EProcessResult;
   }
Exemplo n.º 6
0
 void UpdateDescriptorL()
     {
     delete iBuf;
     iBuf = 0;
     iBuf = HBufC8::NewL((iLines.Count()+1)*8 + 2*4);
     RDesWriteStream stream;
     TPtr8 ptr = iBuf->Des();
     stream.Open(ptr);
     CleanupClosePushL(stream);
     stream.WriteInt32L(iLines.Count());
     for (TInt i = iLines.Count()-1; i >= 0; i--)
         {
         if (iLines[i].iTexture)
             stream.WriteInt32L(iLines[i].iTexture->ServerHandle());
         else
             stream.WriteInt32L(0);                
         stream.WriteInt32L(iLines[i].iGap);
         }
     stream.WriteInt32L(iExtents.iWidth);
     stream.WriteInt32L(iExtents.iHeight);
     stream.CommitL();
     CleanupStack::PopAndDestroy(); // close stream
     }
Exemplo n.º 7
0
// --------------------------------------------------------------------------
// HBufC8* CNSmlSOSHandler::WriteSyncErrorL( TErrorLevel aErrorLevel, TInt aError, TInt aTaskId, TInt aInfo1, TInt aInfo2 )
// --------------------------------------------------------------------------
//
HBufC8* CNSmlSOSHandler::WriteSyncErrorL( TErrorLevel aErrorLevel, TInt aError, TInt aTaskId, TInt aInfo1, TInt aInfo2 )
	{
    HBufC8* buf = HBufC8::NewLC( ( 3*KSizeofTInt8 + ( 4*KSizeofTInt32 ) ) );
    TPtr8 bufPtr = buf->Des();

    RDesWriteStream stream;
    stream.Open( bufPtr );
    CleanupClosePushL( stream );

    stream.WriteInt8L( (TInt8) ENSmlTypeProgressEvent );
    stream.WriteInt8L( (TInt8) ENSmlSyncError );
    stream.WriteInt8L( (TInt8) aErrorLevel );

    stream.WriteInt32L( aError );
    stream.WriteInt32L( aTaskId );
    stream.WriteInt32L( aInfo1 );
    stream.WriteInt32L( aInfo2 );
    stream.CommitL();
    
    CleanupStack::PopAndDestroy( &stream ); 
    CleanupStack::Pop( buf );
   	
   	return buf;
	}
void CBBFetchMediaRequest::ConstructL(const CFbsBitmap* aBitmap)
{
	iMediaThumbnail = CBBString8::NewL(KThumbnail, 1024);
	TInt err=KErrNone;
	if (aBitmap) {
		{
			TPtr8 bufp(iMediaThumbnail->iBuf->Des());
			RDesWriteStream wStream;
			wStream.Open(bufp);
			CC_TRAPD(err, aBitmap->ExternalizeL(wStream));
			if (err==KErrNone) {
				wStream.CommitL();
				wStream.Close();
			}
		}
		while (err==KErrOverflow) {
			TInt size = iMediaThumbnail->iBuf->Des().MaxLength() *2;
			delete iMediaThumbnail; iMediaThumbnail=0;
			iMediaThumbnail = CBBString8::NewL(KThumbnail, size);
			TPtr8 bufp(iMediaThumbnail->iBuf->Des());
			RDesWriteStream wStream;
			wStream.Open(bufp);
			CC_TRAP(err, aBitmap->ExternalizeL(wStream));
			if (err==KErrNone)  {
				wStream.CommitL();
				wStream.Close();
			}
		}
	}

	RDebug::Print(_L("%d"), iMediaThumbnail->iBuf->Des().Length());
	
	/*if (aBitmap) {
		TPckg<CFbsBitmap> xBitmap(*aBitmap);
		iMediaThumbnail = CBBString8::NewL(KThumbnail, xBitmap.Size());
		iMediaThumbnail->Append(xBitmap);
	} else {
		iMediaThumbnail = CBBString8::NewL(KThumbnail, 0);
	}*/
}
Exemplo n.º 9
0
// --------------------------------------------------------------------------
// HBufC8* CNSmlSOSHandler::WriteSyncProgressL( TStatus aStatus, TInt aInfo1, TInt aInfo2 )
// --------------------------------------------------------------------------
//
HBufC8* CNSmlSOSHandler::WriteSyncProgressL( TStatus aStatus, TInt aInfo1, TInt aInfo2 )
	{
	HBufC8* buf = HBufC8::NewLC( (3*KSizeofTInt8 + (2*KSizeofTInt32) ));
    TPtr8 bufPtr = buf->Des();

    RDesWriteStream stream;
    stream.Open( bufPtr );
    CleanupClosePushL( stream );

    stream.WriteInt8L( (TInt8) ENSmlTypeProgressEvent );
    stream.WriteInt8L( (TInt8) ENSmlSyncProgress );
    stream.WriteInt8L( (TInt8) aStatus );

    stream.WriteInt32L( aInfo1 );
    stream.WriteInt32L( aInfo2 );
    stream.CommitL(); 
    
    CleanupStack::PopAndDestroy( &stream );
    CleanupStack::Pop( buf );
    
    return buf;
	}
// ----------------------------------------------------------------------------
// Sends the command to Widget launcher
// ----------------------------------------------------------------------------
//
static void HandleWidgetCommandL( 
    RApaLsSession& aSession, 
    const TDesC& aWidget,
    const TUid& aUid,
    TUint32 aOperation )
    {
    const TInt size( 2* aWidget.Length() + 3*sizeof( TUint32 ) );
    
    // Message format is <filenameLength><unicode_filename><someintegervalue>
    CApaCommandLine* cmd( CApaCommandLine::NewLC() );
    HBufC8* opaque( HBufC8::NewLC( size ) );
    
    RDesWriteStream stream;
    TPtr8 des( opaque->Des() );
    
    stream.Open( des );
    CleanupClosePushL( stream );
    
    // Generate the command.
    stream.WriteUint32L( aUid.iUid );
    stream.WriteUint32L( aWidget.Length() );
    stream.WriteL( reinterpret_cast< const TUint8* >( aWidget.Ptr() ),
                   aWidget.Size() );
    
    stream.WriteInt32L( aOperation );
    
    CleanupStack::PopAndDestroy( &stream );
    
    // Generate command.
    cmd->SetCommandL( EApaCommandBackgroundAndWithoutViews );
    cmd->SetOpaqueDataL( *opaque );    

    CleanupStack::PopAndDestroy( opaque );
    
    cmd->SetExecutableNameL( KLauncherApp );
    
    User::LeaveIfError( aSession.StartApp( *cmd ) );
    CleanupStack::PopAndDestroy( cmd );
    }
Exemplo n.º 11
0
// --------------------------------------------------------------------------
// HBufC8* CNSmlSOSHandler::WriteSyncModificationsL( TInt aTaskId, const TSyncMLDataSyncModifications& aClientMods, const TSyncMLDataSyncModifications& aServerMods )
// --------------------------------------------------------------------------
//
HBufC8* CNSmlSOSHandler::WriteSyncModificationsL( TInt aTaskId, const TSyncMLDataSyncModifications& aClientMods,
                                                                const TSyncMLDataSyncModifications& aServerMods )
	{
	HBufC8* buf = HBufC8::NewLC( (2*KSizeofTInt8 + (11*KSizeofTInt32) ));
    TPtr8 bufPtr = buf->Des();

    RDesWriteStream stream;
    stream.Open(bufPtr);
    CleanupClosePushL(stream);

    stream.WriteInt8L( (TInt8) ENSmlTypeProgressEvent );
    stream.WriteInt8L( (TInt8) ENSmlModifications );

    stream.WriteInt32L( aTaskId );

    stream.WriteInt32L( aClientMods.iNumAdded );
    stream.WriteInt32L( aClientMods.iNumReplaced );
    stream.WriteInt32L( aClientMods.iNumMoved );
    stream.WriteInt32L( aClientMods.iNumDeleted );
    stream.WriteInt32L( aClientMods.iNumFailed );

    stream.WriteInt32L( aServerMods.iNumAdded );
    stream.WriteInt32L( aServerMods.iNumReplaced );
    stream.WriteInt32L( aServerMods.iNumMoved );
    stream.WriteInt32L( aServerMods.iNumDeleted );
    stream.WriteInt32L( aServerMods.iNumFailed );
    stream.CommitL();
    
    CleanupStack::PopAndDestroy( &stream ); 
    CleanupStack::Pop( buf );
    
    return buf;
	}