// -----------------------------------------------------------------------------
// CTestSDKQueries::TestLqdlgPublishDialogL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestLqdlgPublishDialogL( CStifItemParser& /*aItem*/ )
    {
    TInt selectedOption( KZero );
    
    CDesCArrayFlat* mArray = new (ELeave) CDesCArrayFlat(KTen);
    CleanupStack::PushL( mArray );
     
    TBuf< KTen > palabra;
    for (TInt num = KZero; num< KTen; num++)
        {
       palabra.Format(_L("option %d"), num);
       mArray->AppendL(palabra);
        }
     
    CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &selectedOption );
    dlg->PrepareLC( R_UPDATE_QUERY_MSG_DIALOG );
    dlg->SetItemTextArray( mArray );
    dlg->SetOwnershipType( ELbmDoesNotOwnItemArray );
    
    CArrayFixFlat< TInt >* selArray = new( ELeave )CArrayFixFlat< TInt >( KFive );
    CleanupStack::PushL( selArray );
    selArray->AppendL( KOne );
    selArray->AppendL( KThree );
    
    TInt err = KErrNone;
    TRAP( err, dlg->PublishDialogL( KOne, KNullUid, selArray ));
    
    CleanupStack::Pop( KOne );
    CleanupStack::PopAndDestroy( KTwo );
    return KErrNone;
    }
// -----------------------------------------------------------------------------
// CTestSDKQueries::TestLqdlgConstructorLL
// -----------------------------------------------------------------------------
//
TInt CTestSDKQueries::TestLqdlgConstructorLL( CStifItemParser& /*aItem*/ )
    {
    CArrayFixFlat< TInt >* selArray = new( ELeave )CArrayFixFlat< TInt >( KFive );
    CleanupStack::PushL( selArray );
    selArray->AppendL( KOne );
    selArray->AppendL( KThree );
    CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( selArray );
    CleanupStack::PushL( dlg );
    STIF_ASSERT_NOT_NULL( dlg );
    CleanupStack::PopAndDestroy( dlg );
    CleanupStack::Pop( selArray );
    return KErrNone;
    }
void CContextMediaArrayImpl::PostEvent(CCMPost* aParent, CCMPost* aChild, TEvent aEvent)
{
	CALLSTACKITEM_N(_CL("CContextMediaArrayImpl"), _CL("PostEvent"));
	
	if (aParent != iParentPost) return;

	if (aEvent==EChildAdded) {
		iPostIdArray->AppendL(aChild->iPostId());
		iPostArray->AppendL(0);
		iObserver.PostEvent(aParent, aChild, aEvent);
	}

	if (aEvent==EPlaceholderFilled) {
		TInt i;
		for (i=0; i<iPostIdArray->Count();i++) {
			if (iPostIdArray->At(i) == aChild->iPostId()) {
				CC_TRAPD(ignore, iStorage.Release(iPostArray->At(i), 0));
				iPostArray->At(i) = 0;
				iObserver.PostEvent(aParent, aChild, aEvent);
				return;
			}
		}
	}

	if (aEvent==EPostHidden) {
		ReadFromStorage();
		iObserver.PostEvent(aParent, aChild, aEvent);
	}

	if (aEvent==EPostVisible) {
		ReadFromStorage();
		iObserver.PostEvent(aParent, aChild, aEvent);
	}

	if (aEvent==EPostUpdated) {
		iObserver.PostEvent(aParent, aChild, aEvent);
	} 

	if ((aEvent==EThumbnailLoaded) || (aEvent==EUnreadChanged)) {
		iObserver.PostEvent(aParent, aChild, aEvent);
	}

	if (aEvent==ELastPostChanged) {
		iObserver.PostEvent(aParent, aChild, aEvent);
	}
	
	//do nothing for:
	//	EMediaLoaded,
	//	EErrorUpdated,
}
Exemplo n.º 4
0
CArrayFix<TCoeHelpContext>* CMobileOfficeAppUi::HelpContextL() const
{
	CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
	CleanupStack::PushL(array);
	array->AppendL(TCoeHelpContext(KUidMobileOffice, _L("Introduction")));
	CleanupStack::Pop(array);
	return array;
}
Exemplo n.º 5
0
void CFMSServer::CreateScheduledReminderL()
    {
    FLOG(_L("CFMSServer::CreateScheduledReminderL ()"));
    _LIT(KFotaScheduleExe, "Z:\\sys\\bin\\fotaschedulehandler.exe");

    RScheduler scheduler;
    TTsTime startTime;
    TTime time;
    time.HomeTime();
    time = time + (TTimeIntervalHours(1));
    startTime.SetLocalTime(time);

    User::LeaveIfError(scheduler.Connect());
    CleanupClosePushL(scheduler);
    //Creating a persistent daily schedule
    
    TSchedulerItemRef persistentScheduleItem;
    CArrayFixFlat<TScheduleEntryInfo2>* entries = new CArrayFixFlat<TScheduleEntryInfo2> (1);
    CleanupStack::PushL(entries);
    persistentScheduleItem.iName = TUid::Uid(KFMSServerUid).Name();

    //TScheduleEntryInfo2 scentry1(startTime, EDaily, 1, 1);
    TScheduleEntryInfo2 scentry1;
    scentry1.SetStartTime(startTime);
    scentry1.SetInterval(1);
    scentry1.SetIntervalType(TIntervalType(EHourly));
    scentry1.SetValidityPeriod((TTimeIntervalMinutes) 1440); //1440 min = 24 hrs or 1 day
    
    entries->AppendL(scentry1);

    scheduler.Register(TFileName( KFotaScheduleExe ), 0 );
    TInt ret = scheduler.CreatePersistentSchedule(persistentScheduleItem, *entries);

    FLOG(_L("created schedule %d  %d:%d"), persistentScheduleItem.iHandle,
            time.DateTime().Hour(), time.DateTime().Minute());

    if (ret == KErrNone)
        {
        TTaskInfo taskInfo;
        taskInfo.iName = TUid::Uid(KFMSServerUid).Name();
        taskInfo.iRepeat = 1; //Repeat once
        taskInfo.iPriority = 1;

        TFotaScheduledUpdate fotareminder(-1, -1);
        TPckg<TFotaScheduledUpdate> fotareminderpkg(fotareminder);

        HBufC* data = HBufC::NewLC(fotareminderpkg.Length());
        data->Des().Copy(fotareminderpkg);

        TInt err = scheduler.ScheduleTask(taskInfo, *data,  persistentScheduleItem.iHandle);

        FLOG(_L("Schedule creation error %d"), err);

        CleanupStack::PopAndDestroy(data);
        }
    CleanupStack::PopAndDestroy(entries);
    CleanupStack::PopAndDestroy(&scheduler); // xx
    }
void CContextMediaArrayImpl::ReadFromStorage()
{
	CALLSTACKITEM_N(_CL("CContextMediaArrayImpl"), _CL("ReadFromStorage"));
	iPostIdArray->Reset();
	ReleasePosts();
	iPostArray->Reset();

	TBool ok = iStorage.FirstL(iNode, iSort, CPostStorage::EAscending, EFalse);
	while (ok) {
		TInt64 id = iStorage.GetCurrentIdL();
		iPostIdArray->AppendL(id);
		iPostArray->AppendL(0);
		ok = iStorage.NextL();
	}
	if (iStandAlone && iNode==iStorage.RootId()) {
		iPostIdArray->AppendL(iStorage.RootId());
		iPostArray->AppendL(0);
	}
}
Exemplo n.º 7
0
/**
This method should only be used by CImapAtomParser.
During parsing, a ReAllocL() may be required on the heap buffer that this atom and its 
descendants' string data descriptor points at.
This happens when the heap buffer needs to be expanded.
If this causes the heap buffer's address to change, then this atom and its descendants' 
pointer descriptors need updating.
@param The address of the new heap buffer
@param The address of the data within the heap buffer before the ReAllocL took place.
*/
void CImapAtom::FixupL(const HBufC8 *aNewBuffer, const TText8 *aOldBuffer)
	{
   // Fixup descriptor pointers
	CArrayFixFlat<CImapAtom*>* atomStack = new (ELeave) CArrayFixFlat<CImapAtom*>(10);
	CleanupStack::PushL(atomStack);

	atomStack->AppendL(this);
	CImapAtom* currentAtom;
	while (atomStack->Count() != 0)
   		{
		// Pop the top atom off of the stack
		currentAtom = (*atomStack)[atomStack->Count() - 1];
 		atomStack->ResizeL(atomStack->Count() - 1);
 
		// Fix up the current atom
		if (currentAtom->iAtom.Length()>0)
			{
			// Find offset from start of old buffer
			TInt start=(currentAtom->iAtom.Ptr()-aOldBuffer);

 			// Make new descriptor & assign it
			TPtrC8 bufptr(aNewBuffer->Ptr()+start,currentAtom->iAtom.Length());
			currentAtom->iAtom.Set(bufptr); // Note that we are setting the real iAtom not the copy returned by Atom()
			}
 
		// Add the first sibling to the stack,
		// subsequent siblings are added when this sibling is visited
		CImapAtom* siblingAtom = currentAtom->Next();
		if (siblingAtom)
			{
			atomStack->AppendL(siblingAtom);
			}
   
		// Add child to the stack
		CImapAtom* childAtom = currentAtom->Child();
		if (childAtom)
			{
			atomStack->AppendL(childAtom);
			}			
   		}
   
	CleanupStack::PopAndDestroy(atomStack);
   	}
// ---------------------------------------------------------------------------
// Get an array of image quality levels that are in use with the current
// product with given Camera/Display ID. If the ID is zero, then all levels
// dispite of the ID value are returned.
// ---------------------------------------------------------------------------
//
TInt CImagingConfigManager::GetImageQualityLevelsL(
                                        CArrayFixFlat<TUint>& aLevels,
                                        TUint /*aCameraDisplayID*/ )
    {
    aLevels.Reset();
    for( TInt i = 0 ; i < NumberOfImageQualityLevels() ; i++ )
        {
        aLevels.AppendL(
                iImageQualitySets->At( i ).iImageQualitySetLevel );
        }
    return KErrNone;
    }
Exemplo n.º 9
0
CArrayFix<TCoeHelpContext>* CPodcastAppUi::HelpContextL() const
   { 
    CArrayFixFlat<TCoeHelpContext>* array = 
                new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
    CleanupStack::PushL(array);
    
    if (iFeedView->IsVisible()) {
		array->AppendL(TCoeHelpContext(KUidPodcast,KContextFeedsView));
    } else if (iShowsView->IsVisible()) {
		array->AppendL(TCoeHelpContext(KUidPodcast,KContextShowsView));
    } else if (iSearchView->IsVisible()) {
		array->AppendL(TCoeHelpContext(KUidPodcast,KContextSearch));
    } else if (iQueueView->IsVisible()) {
		array->AppendL(TCoeHelpContext(KUidPodcast,KContextDownloadQueue));
    } else {
		array->AppendL(TCoeHelpContext(KUidPodcast,KContextSettings));
    }
	
    CleanupStack::Pop(array);
    return array;
	}
Exemplo n.º 10
0
//Puts the existing settings and some new settings in the list of settings
//Now both will be deleted on exit.
void CPigeonScheduledSend::PopulateSettingsL()
{
    delete iSettings;
    iSettings = NULL;

    //Make some shiny new settings instead
    iSettings = CMsvScheduleSettings::NewL();
    iSettings->SetShortInterval(KShortInterval);
    iSettings->SetLongInterval(KLongInterval);

    CArrayFixFlat<TTimeIntervalSeconds>* intervals = new(ELeave)CArrayFixFlat<TTimeIntervalSeconds>(20);
    CleanupStack::PushL(intervals);
    intervals->AppendL(KFirstInterval);
    intervals->AppendL(KSecondInterval);
    intervals->AppendL(KThirdInterval);

    iSettings->SetVariableIntervalsL(*intervals);  // copies intervals

    CleanupStack::PopAndDestroy();  //intervals
//	iSettingsList->AppendL(custom);
}
Exemplo n.º 11
0
CArrayFix<TCoeHelpContext>* CRhodesAppUi::HelpContextL() const
	{
#warning "Please see comment about help and UID3..."
	// Note: Help will not work if the application uid3 is not in the
	// protected range.  The default uid3 range for projects created
	// from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they
	// can be self signed and installed on the device during testing.
	// Once you get your official uid3 from Symbian Ltd. and find/replace
	// all occurrences of uid3 in your project, the context help will
	// work.
	CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
	CleanupStack::PushL(array);
	array->AppendL(TCoeHelpContext(KUidRhodesApp, KGeneral_Information));
	CleanupStack::Pop(array);
	return array;
	}
Exemplo n.º 12
0
CArrayFix<TCoeHelpContext>* CHelloS60AppUi::HelpContextL() const
{
#warning "Please see comment about help and UID3..."
    // Note: Help will not work if the application uid3 is not in the
    // protected range.  The default uid3 range for projects created
    // from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they
    // can be self signed and installed on the device during testing.
    // Once you get your official uid3 from Symbian Ltd. and find/replace
    // all occurrences of uid3 in your project, the context help will
    // work. Alternatively, a patch now exists for the versions of
    // HTML help compiler in SDKs and can be found here along with an FAQ:
    // http://www3.symbian.com/faq.nsf/AllByDate/E9DF3257FD565A658025733900805EA2?OpenDocument
    CArrayFixFlat<TCoeHelpContext>* array = new (ELeave) CArrayFixFlat<
    TCoeHelpContext> (1);
    CleanupStack::PushL(array);
    array->AppendL(TCoeHelpContext(KUidHelloS60App, KGeneral_Information));
    CleanupStack::Pop(array);
    return array;
}
Exemplo n.º 13
0
CArrayFixFlat<TPtrC>* CKeytoolFileView::ReadArrayArgumentsLC(TInt cmdIndex)
	{
	CArrayFixFlat<TPtrC>* currentCmd = new (ELeave) CArrayFixFlat<TPtrC> (10);
	CleanupStack::PushL(currentCmd);
	TPtr cmd = iArgs[cmdIndex]->Des();
	cmd.Trim();
	TLex arguments(cmd);
	while(!arguments.Eos())
    	{
        TPtrC token = arguments.NextToken();
        currentCmd->AppendL(token);
        }
    
    TBuf<150> string;
	string.Format(_L("Command :  %S\noutput :"), &cmd);
	KeyToolUtils::PrintInfoL(_L("================================================"));
	KeyToolUtils::PrintInfoL(_L("================================================\n"));
    DisplayErrorL(string, 0);
    return currentCmd;
	}
/*!
 * Store contact
 */
CArrayFixFlat<TUid>* CNsmlContactsDataStoreExtensionPrivate::ImportContactsL( const TDesC8 &contactbufbase )
{
    _DBG_FILE("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL: BEGIN");    

    DBG_DUMP((void*)contactbufbase.Ptr(), contactbufbase.Length(),
        _S8("CNsmlContactsDataStoreExtensionPrivate::ImportContactsL: To DB :"));      
    
    TBool ret( ETrue );
    CArrayFixFlat<TUid>* contactItems = new(ELeave) CArrayFixFlat<TUid>(4);
    QBuffer contactsbuf;
    contactsbuf.open(QBuffer::ReadWrite);
    QByteArray bytearray((char*)contactbufbase.Ptr());
    
    contactsbuf.write(bytearray);
    contactsbuf.seek(0);
    
    mReader->setDevice(&contactsbuf);
    if (mReader->startReading() && mReader->waitForFinished()) 
        {
        DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Buffer Count: %d"), mReader->results().count() );
        
        QList<QContact> contacts;
        if ( mImporter->importDocuments( mReader->results() ) )
            {
            contacts = mImporter->contacts();
            QMap<int, QContactManager::Error> errorMap;
            ret = mContactManager->saveContacts( &contacts, &errorMap );           
            DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Import Status: %d"), ret );
            }
        if( ret )
            {
            foreach (QContact contact, contacts ) 
                {
                TUint contactid = contact.id().localId();
                
                DBG_ARGS(_S("CNsmlContactsDataStoreExtensionPrivate::Contact ID: %d"), contactid );
                
                contactItems->AppendL( TUid::Uid( contactid ) );
                }
            }
Exemplo n.º 15
0
void CMsvScheduleSend::PopulateScheduleConditionsL(CArrayFixFlat<TTaskSchedulerCondition>& aSchConditions)
	{
	aSchConditions.Reset();

	TInt count = iAgentActions->Count();
	TTaskSchedulerCondition condition;
	
	// All system agent condition have a UID of KUidSystemCategory.
	condition.iCategory = KUidSystemCategory;
	
	for( TInt i = 0; i < count; ++i )
		{

		TMsvCondition agentCondition = iAgentActions->At(i).iCondition;

		condition.iKey	 = agentCondition.iVariable.iUid;
		condition.iState = agentCondition.iState;
		
		switch( agentCondition.iType )
			{
		case TMsvCondition::EMsvSchSendEquals:
			condition.iType = TTaskSchedulerCondition::EEquals;
			break;
		case TMsvCondition::EMsvSchSendNotEquals:
			condition.iType = TTaskSchedulerCondition::ENotEquals;
			break;
		case TMsvCondition::EMsvSchSendGreaterThan:
			condition.iType = TTaskSchedulerCondition::EGreaterThan;
			break;
		case TMsvCondition::EMsvSchSendLessThan:
			condition.iType = TTaskSchedulerCondition::ELessThan;
			break;
		default:
			User::Invariant();
			break;
			}
			
		aSchConditions.AppendL(condition);
		}
	}
Exemplo n.º 16
0
/**
Creates a new schedule on the task scheduler with which each message can be 
associated. 

The schedule is triggered by a start time being reached.

@see RScheduler::CreatePersistentSchedule

@param aScheduler
Handle to scheduler to update.

@param aSettings
Scheduler settings.

@param aStartTime
Schedule start time.

@param aValidityPeriod
Schedule validity period.

@param aRef 
On return, the new schedule.
*/
EXPORT_C void CMsvScheduleSend::CreateScheduleL(RScheduler& aScheduler, const CMsvScheduleSettings& aSettings, const TTime& aStartTime, const TTimeIntervalMinutes& aValidityPeriod, TSchedulerItemRef& aRef)
	{
	//Determine the new schedule entry	
	TScheduleEntryInfo2 taskInfo;
	taskInfo.SetIntervalType(aSettings.IntervalType());
	taskInfo.SetInterval(1);
	TTsTime startTime(aStartTime,ETrue);
	taskInfo.SetStartTime(startTime);
	taskInfo.SetValidityPeriod(aValidityPeriod);
	
	//Create the TScheduleEntryInfo arrag that is required by CreatePersistentSchedule
	CArrayFixFlat<TScheduleEntryInfo2>* entryInfos = new (ELeave) CArrayFixFlat<TScheduleEntryInfo2>(1);
	CleanupStack::PushL(entryInfos);

	//Append the new schedule entry
	entryInfos->AppendL(taskInfo);

	//Create the schedule
	User::LeaveIfError(aScheduler.CreatePersistentSchedule(aRef, *entryInfos));

	CleanupStack::PopAndDestroy(entryInfos);
	}
Exemplo n.º 17
0
/**
Provides conversion between view indexes and contact IDs.

@param aMessage.Int0() Buffer size (from client).
@param aMessage.Ptr1() Descriptor containing indices (from client).
@param aMessage.Ptr2() Descriptor containing contact IDs (to client).
*/
void CViewSubSessionBase::GetContactIdsL(const RMessage2& aMessage)
	{
	TPckgBuf<TInt> size;
	aMessage.ReadL(0,size);
	const TInt bufferSize = size();
	
	CBufFlat* buffer = CBufFlat::NewL(bufferSize);
	CleanupStack::PushL(buffer);
	buffer->ExpandL(0,bufferSize);
	TPtr8 des(buffer->Ptr(0));
	aMessage.ReadL(1,des);

	RBufReadStream readStream(*buffer);
	CleanupClosePushL(readStream);
	const TInt count = readStream.ReadUint32L(); 

	CArrayFixFlat<TInt>* indexes = new(ELeave) CArrayFixFlat<TInt>(8);	
	CleanupStack::PushL(indexes);

	for (TInt i=0; i<count; ++i)
		{
		TInt index = readStream.ReadUint32L();
		indexes->AppendL(index);
		}

	CContactIdArray* array = CContactIdArray::NewLC();
	iView->GetContactIdsL(*indexes, *array);

	HBufC8* buf=HBufC8::NewLC(bufferSize);
	TPtr8 bufPtr(buf->Des());
	RDesWriteStream writeStream(bufPtr);
	CleanupClosePushL(writeStream);
	writeStream << *array;
	bufPtr.SetLength(bufferSize);
	aMessage.WriteL(2,*buf);

	CleanupStack::PopAndDestroy(6, buffer); // &writeStream, buf, array, indexes, &readStream, buffer
	}
Exemplo n.º 18
0
void CIpsecTest4_1::TestOomPolicyListL()
/**
 * OOM helper function - implements normal usage of PolicyListL method
 */
{
    TInt ret;
    TIPSecPolicy pol;

    CIPSecAPI* api = CIPSecAPI::NewL();
    CleanupStack::PushL(api);

    CArrayFixFlat<TIPSecPolicy>* list = new (ELeave) CArrayFixFlat<TIPSecPolicy>(5);
    CleanupStack::PushL(list);

    list->AppendL(pol);
    ret = api->PolicyListL(*list);
    (void)ret; // to remove compiler warning

    TEST(api!=NULL);

    CleanupStack::PopAndDestroy(list);
    CleanupStack::PopAndDestroy(api);
}
// ---------------------------------------------------------------------------
// CAknDiscreetPopupDrawer::WrapTitleTextL
// Wraps long text to two lines.
// ---------------------------------------------------------------------------
//
void CAknDiscreetPopupDrawer::WrapTitleTextL()
    {
    CArrayFixFlat<TInt>* lineWidths 
        = new ( ELeave ) CArrayFixFlat<TInt>( KMaxNumOfLines );
    CleanupStack::PushL( lineWidths );
    CArrayFixFlat<TPtrC>* wrappedArray
        = new ( ELeave ) CArrayFixFlat<TPtrC>( KMaxNumOfLines );
    CleanupStack::PushL( wrappedArray );

    for ( TInt i = 0; i < KMaxNumOfLines; i++ )
        {
        lineWidths->AppendL( iTitleTextData.iTextRect.Width() );
        }

    HBufC* visualBuffer = HBufC::NewLC( 
            iTitleText->Length() + KMaxNumOfLines * KAknBidiExtraSpacePerLine );
    *visualBuffer = *iTitleText;
    TPtr ptr( visualBuffer->Des() );

    AknBidiTextUtils::ConvertToVisualAndWrapToArrayL(
            ptr, *lineWidths, *iTitleTextData.iTextFont, *wrappedArray, ETrue );

    if ( wrappedArray->Count() && wrappedArray->At( 1 ) != KNullDesC )
        {
        delete iTitleText;
        iTitleText = NULL;
        delete iBodyText;
        iBodyText = NULL;
        iTitleText = wrappedArray->At( 0 ).AllocL();
        iBodyText = wrappedArray->At( 1 ).AllocL();
        }

    CleanupStack::PopAndDestroy( visualBuffer );
    CleanupStack::PopAndDestroy( wrappedArray );
    CleanupStack::PopAndDestroy( lineWidths );
    }
Exemplo n.º 20
0
TBool CTCMBufferModeWrapper::DoCommandL(	const TTEFFunction& /*aCommand*/,
					const TTEFSectionName& /*aSection*/, 
					const TInt /*aAsyncErrorIndex*/)
	{
	if(BlockResult()==EPass)
       	{
       	//  ************** Delete the Block, the block start ****************
			const TInt ECircular=0;//C.A. added because TBuffermode enum doesnt exist in old ulogger api:
			const TInt EStraight=1;//C.A. as above:
			TInt result=0;
			INFO_PRINTF1(_L("About to test buffer Mode"));  //Block start
			RULogger logger;
			result=logger.Connect();
        	INFO_PRINTF2(_L("Connection to Ulogger: %d, attempt: 1"), result);
            if (result!=KErrNone)
            	{
            	INFO_PRINTF1(_L("Connection to Ulogger failed. Will try to connect max. 10 times"));
            	for (TInt i=2; i<12;i++)
                    {
                        User::After(1000);
                        result = logger.Connect();
                        INFO_PRINTF3(_L("Connection to Ulogger: %d, attempt: %d"), result, i);
                        if (result==KErrNone)
                        {
                        break;
                        }
                    }
            	}
			CClearConfig configIni;
			configIni.ClearL(logger);
			logger.SetSecondaryFilteringEnabled(EFalse);//C.A. previously:logger.DisableModuleUidFiltering();
//			C.A. previously:
/*			TBufferMode bufferCircular = ECircular;
			TBufferMode bufferStraight = EStraight;
			TBufferMode getBuffer = ECircular;	*/
			TInt bufferCircular = ECircular;
			TInt bufferStraight = EStraight;
			TInt getBuffer = ECircular;
			CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
			setprimfilter->AppendL(KGroupId);
			setprimfilter->AppendL((TGroupId) (192));
			RArray<TUint32> setsecondfilter;
			setsecondfilter.Append((TUint32) KComponentId);
			logger.SetPrimaryFiltersEnabled(*setprimfilter,ETrue);//C.A. previously:logger.EnableClassifications(*setprimfilter);
			//logger.EnableModuleUids(setsecondfilter);
			SetBlockResult(EPass);
			if(result==0)
			{
				INFO_PRINTF1(_L("BTrace to File plugin added"));
				_LIT8(KTextmedia,"uloggerfileplugin");
				const TPtrC8 mediaptr(KTextmedia);
				result=logger.ActivateOutputPlugin(mediaptr);//C.A. previously:Result=logger.SetActiveOutputPlugin(mediaptr);

				// write to a small circular buffer with a tight loop
				logger.SetBufferSize(4);
				logger.SetNotificationSize(3.9);
				result=logger.SetBufferMode(bufferCircular);
				if(result==KErrNone)
				{
					INFO_PRINTF1(_L("Buffer mode set without error"));
					logger.GetBufferMode(getBuffer);
					if(getBuffer==bufferCircular)
						INFO_PRINTF1(_L("Circular Buffer mode got correctly"));
					else
					{
						INFO_PRINTF1(_L("get buffer mode different from set circular - FAIL"));
						SetBlockResult(EFail);
					}
				}
				else
				{
					INFO_PRINTF2(_L("Buffer mode set failed with error %d"), result);
					SetBlockResult(EFail);
				}
				_LIT(KTextvalue1, "C:\\logs\\ULoggerBuffer4kDNS4kCircular.utf");
				const TPtrC valueptr1(KTextvalue1);
				INFO_PRINTF3(_L("Writing to buffer... Buffer size: %d, DNS: %d"),4,4);
				writeToBuffer(valueptr1, Ost_Count, &logger);

				// write to a small straight buffer with a tight loop
				result=logger.SetBufferMode(bufferStraight);
				if(result==KErrNone)
				{
					INFO_PRINTF1(_L("Buffer mode set without error"));
					logger.GetBufferMode(getBuffer);
					if(getBuffer==bufferStraight)
						INFO_PRINTF1(_L("Straight Buffer mode got correctly"));
					else
					{
						INFO_PRINTF1(_L("get buffer mode different from set straight - FAIL"));
						SetBlockResult(EFail);
					}
				}
				else
				{
					INFO_PRINTF2(_L("Buffer mode set failed with error %d"), result);
					SetBlockResult(EFail);
				}
				_LIT(KTextvalue2, "C:\\logs\\ULoggerBuffer4kDNS4kStraight.utf");
				const TPtrC valueptr2(KTextvalue2);
				INFO_PRINTF3(_L("Writing to buffer... Buffer size: %d, DNS: %d"),4,4);
				writeToBuffer(valueptr2, Ost_Count, &logger);

				// write to a large circular buffer with a tight loop
				logger.SetBufferSize(100);
				logger.SetNotificationSize(4);
				result=logger.SetBufferMode(bufferCircular);
				if(result==KErrNone)
				{
					INFO_PRINTF1(_L("Buffer mode set without error"));
					logger.GetBufferMode(getBuffer);
					if(getBuffer==bufferCircular)
						INFO_PRINTF1(_L("Circular Buffer mode got correctly"));
					else
					{
						INFO_PRINTF1(_L("get buffer mode different from set circular - FAIL"));
						SetBlockResult(EFail);
					}
				}
				else
				{
					INFO_PRINTF2(_L("Buffer mode set failed with error %d"), result);
					SetBlockResult(EFail);
				}
				_LIT(KTextvalue5, "C:\\logs\\ULoggerBuffer100kDNS4kCircular.utf");
				const TPtrC valueptr5(KTextvalue5);
				INFO_PRINTF3(_L("Writing to buffer... Buffer size: %d, DNS: %d"),100,4);
				writeToBuffer(valueptr5, Ost_Count, &logger);

				// write to a large straight buffer with a tight loop
				result=logger.SetBufferMode(bufferStraight);
				if(result==KErrNone)
				{
					INFO_PRINTF1(_L("Buffer mode set without error"));
					logger.GetBufferMode(getBuffer);
					if(getBuffer==bufferStraight)
						INFO_PRINTF1(_L("Straight Buffer mode got correctly"));
					else
					{
						INFO_PRINTF1(_L("get buffer mode different from set Straight - FAIL"));
						SetBlockResult(EFail);
					}
				}
				else
				{
					INFO_PRINTF2(_L("Buffer mode set failed with error %d"), result);
					SetBlockResult(EFail);
				}
				_LIT(KTextvalue6, "C:\\logs\\ULoggerBuffer100kDNS4kStraight.utf");
				const TPtrC valueptr6(KTextvalue6);
				INFO_PRINTF3(_L("Writing to buffer... Buffer size: %d, DNS: %d"),100,4);
				writeToBuffer(valueptr6, Ost_Count, &logger);

			}
			else
			{
				INFO_PRINTF1(_L("File Plugin error when added"));
				SetBlockResult(EFail);
			}
			logger.Close();
			INFO_PRINTF1(_L("Buffer Mode tests complete!"));

		//  **************   Block end ****************
       	}
  		return ETrue;
	}
TBool CTCMSerialPluginWrapper::DoCommandL(	const TTEFFunction& /*aCommand*/,
					const TTEFSectionName& /*aSection*/, 
					const TInt /*aAsyncErrorIndex*/)
	{
	    if (BlockResult()==EPass)
		{		
		//  ************** Delete the Block, the block start ****************
		
			TInt Result=0;
			SetBlockResult(EPass);
			INFO_PRINTF1(_L("About to test serial plugin"));  //Block start
			RULogger logger;
			Result = logger.Connect();
			INFO_PRINTF2(_L("Connection to Ulogger: %d, attempt: 1"), Result);
                if (Result!=KErrNone)
                {
                INFO_PRINTF1(_L("Connection to Ulogger failed. Will try to connect max. 10 times"));
                for (TInt i=2; i<12;i++)
                   {
                   User::After(1000);
                   Result = logger.Connect();
                   INFO_PRINTF3(_L("Connection to Ulogger: %d, attempt: %d"), Result, i);
                   if (Result==KErrNone)
                        {
                        break;
                        }
                   }
                }
			CClearConfig configIni;
			configIni.ClearL(logger);
			CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
			setprimfilter->AppendL(KGroupId);
			RArray<TUint32> setsecondfilter;
			setsecondfilter.Append((TUint32) KComponentId);
			logger.SetPrimaryFiltersEnabled(*setprimfilter,ETrue);//C.A. previously:logger.EnableClassifications(*setprimfilter);
			logger.SetSecondaryFiltersEnabled(setsecondfilter,ETrue);//C.A. previously:logger.EnableModuleUids(setsecondfilter);
			_LIT8(KTextmedia,"uloggerserialplugin");
			const TPtrC8 mediaptr(KTextmedia);
			// test the plugin can be activated
			Result=logger.ActivateOutputPlugin(mediaptr);//C.A. previously:Result=logger.SetActiveOutputPlugin(mediaptr);	
			if(Result==0||Result==-11)	
			{	
				INFO_PRINTF1(_L("Serial Plugin active"));		
				_LIT(KTextsetting, "output_port");	
				_LIT(KTextvalue, "3");
				// test setting the plugin settings
				TPluginConfiguration pluginConfig;
				pluginConfig.SetKey(KTextsetting);
				pluginConfig.SetValue(KTextvalue);			
				Result=logger.SetPluginConfigurations(mediaptr,pluginConfig);
				if(Result==KErrNone)	
				{
					INFO_PRINTF1(_L("Setting Serial Plugin Settings returns KErrNone but verify set correctly in next step"));
				// test that the plugging settings can be retrieved
				RPointerArray<TPluginConfiguration> getPluginConfigs;
				if(Result==KErrNone)	
				{
					INFO_PRINTF1(_L("Getting Serial Plugin Settings returns KErrNone but verify got correctly in next step"));
					Result=logger.GetPluginConfigurations(mediaptr, getPluginConfigs);
					_LIT(KTextChecksetting, "output_port");
					_LIT(KTextCheckValue, "3");
					// test that the plugging settings retrieved are correct
					if(getPluginConfigs.Count()>0)
						{
						if (!getPluginConfigs[0]->Key().Compare(KTextChecksetting) && !getPluginConfigs[0]->Value().Compare(KTextCheckValue))
							{
							INFO_PRINTF1(_L("Retrieved serial plugin settings are correct"));
							}
							else
								{		
								INFO_PRINTF1(_L("Retrieved serial plugin settings are incorrect"));
								SetBlockResult(EFail);
								}
							Result=logger.Start();//C.A. previously:Result=logger.StartOutputting();
							INFO_PRINTF2(_L("ulogger start returns error %d"), Result);
							TBool OstStatus=0;
#ifndef __WINSCW__	
#ifdef TE_UPT_TRACE_ENABLED
OstStatus = 1;
INFO_PRINTF1(_L("TRACING HAS BEEN ENABLED!"));
#else
OstStatus = 0;
INFO_PRINTF1(_L("TRACING HAS BEEN DISABLED! All Log files should be empty/not exist"));
#endif // trace enabled
							TTraceContext attrs(KComponentId, KGroupId, KContextId, KPc);						
							if(!OstTrace(attrs, KInitialClientFormat, KAny16)&&OstStatus)
								{
								INFO_PRINTF1(_L("Ost first trace via serial plugin failed"));
								SetBlockResult(EFail);
								}
							TTraceContext attrs1(KComponentId, KGroupId, KContextId, KPc);
							if(!OstTrace(attrs1, KInitialClientFormat, KAny16)&&OstStatus)
								{
								INFO_PRINTF1(_L("Ost second trace writing via serial plugin failed"));
								SetBlockResult(EFail);
								}
#endif	//winscw			
							logger.Stop();//C.A. previously:logger.StopOutputting();	
						}
					else
						{		
						INFO_PRINTF1(_L("Either SetPluginConfiguration failed or GetPluginConfiguration failed as returned a zero size array"));
						SetBlockResult(EFail);
						}
				}
				else
				{
					INFO_PRINTF1(_L("Failed to get serial Plugin Settings"));
					SetBlockResult(EFail);
				}
				getPluginConfigs.ResetAndDestroy();
			}
			else
			{
				INFO_PRINTF1(_L("Serial Plugin Settings error"));
				SetBlockResult(EFail);
			}					
		}
		else
		{			
			INFO_PRINTF1(_L("Serial Plugin error when activated"));
			SetBlockResult(EFail);
		}		
		TBuf8<32>activeplugins;	
		_LIT8(KTextmedia1,"uloggerserialplugin");
		TBuf8<32> checkplugins(KTextmedia1);
		// test the active plugin name can be retrieved
		logger.GetActiveOutputPlugin(activeplugins);//C.A. previously:logger.ActiveOutputPlugin(activeplugins);
		if (activeplugins.Compare(checkplugins)==0)
			INFO_PRINTF1(_L("Got correct active serial plugin"));
		else
		{
			INFO_PRINTF1(_L("Got incorrect active serial plugin"));
			SetBlockResult(EFail);
		}
		// test activating the second plugin
		_LIT8(KTextmedia2,"te_fileplugin");
		const TPtrC8 mediaptr2(KTextmedia2);
		Result=logger.ActivateOutputPlugin(mediaptr2);	//C.A. previously:Result=logger.SetActiveOutputPlugin(mediaptr2);	
		if(Result==0)			
			INFO_PRINTF1(_L("Second plugin activated correctly"));
		else
		{
			INFO_PRINTF1(_L("Second plugin activation error"));
			SetBlockResult(EFail);
		}
		// test the first plugin can now be removed as it is no longer the active plugin
		Result=logger.RemovePluginConfigurations(mediaptr);
		if(Result==0)
		{	
			INFO_PRINTF1(_L("Removed serial Plugin correctly"));
		}
		else
		{
			INFO_PRINTF1(_L("Failed to remove serial Plugin"));
			SetBlockResult(EFail);
		}
		logger.Stop();//C.A. previously:logger.StopOutputting();
		logger.Close();
		INFO_PRINTF1(_L("serial plugin tests complete!"));
		
		//  **************   Block end ****************
		}
		
	  	return ETrue;
	}
/** This user-side method configures the passed ULogger session to output to the passed plugin (with configurations) and with filter settings as specified by the user
    and starts the session in order to output trace points.
@param aLogger is ULogger session being passed to the routine to be configured and started
@param aPluginName is the TPtrC8 passed, identifying which ULogger plugin to output to
@param aPluginConfiguration is the TPluginConfiguration passed, indicating the hardware configurations for the specified plugin
@param aTestUTraceULoggerMatch is the user-defined boolean specifying whether the Ulogger filter settings should match the (test-specific) trace points or not
@return KErrNone if command was prepared correctly and a system wide error code otherwise.
 */
TInt CUptULogger::StartGeneralL(RULogger& aLogger, const TPtrC8& aPluginName, const TPluginConfiguration& aPluginConfiguration, const TBool& aGroupIdFiltering, const TBool& aComponentIdFiltering, const TBool& aGroupIdFilterMatch, const TBool& aComponentIdFilterMatch)
	{
	TInt err=0;
	
	//connect to the ULogger session
	err=aLogger.Connect();
	
    if (err!=KErrNone)
        {
        for (TInt i=2; i<12;i++)
            {
            User::After(1000);
            err = aLogger.Connect();
            if (err==KErrNone)
                {
                break;
                }
            }
        }
	
	//clear any configurations stored in the ULogger configuration file
	CClearConfig configIni;
	configIni.ClearL(aLogger);
	
	//prepare arrays for storing the filter settings to configure ULogger (and push any heap objects on the cleanup stack)
	CArrayFixFlat<TUint8> *setPrimFilter = new (ELeave)CArrayFixFlat<TUint8>(256);
	CleanupStack::PushL(setPrimFilter);
	RArray<TUint32> setSecondFilter;
	CleanupClosePushL(setSecondFilter);
	//now configure the filtering and filter match options according to the passed parameters:
	//aGroupIdFiltering aComponentIdFiltering aGroupIdFilterMatch aComponentIdFilterMatch	

	if(aGroupIdFiltering==1)
	    {
	    //We might have previously "disabled" primary filtering by enabling all filter
	    //values, we'll disable them all here initially and then enable what we want below
        TInt i;
        for (i=0;i<=255;i++)
            {
            setPrimFilter->AppendL((TUint8)i);
            }
        TInt err=aLogger.SetPrimaryFiltersEnabled(*setPrimFilter,EFalse);
        setPrimFilter->Delete(0,setPrimFilter->Count());
	    }
		//C.A. previously this but done by default:err=aLogger.EnableGroupIdFiltering();
	else
		//C.A. previously:err=aLogger.DisableClassificationFiltering();
		//C.A.: just enable all classifications so all is allowed through
		{
		TInt i;
		for (i=0;i<=255;i++)
			{
			setPrimFilter->AppendL((TUint8)i);
			}
		TInt err=aLogger.SetPrimaryFiltersEnabled(*setPrimFilter,ETrue);
		setPrimFilter->Delete(0,setPrimFilter->Count());
		}

	err=aLogger.SetSecondaryFilteringEnabled(aComponentIdFiltering);
//	C.A. previously	
/*	if(aComponentIdFiltering==1)
		err=aLogger.EnableModuleUidFiltering();
	else
		err=aLogger.DisableModuleUidFiltering();*/
	
	if(aGroupIdFilterMatch==1)
		{
		//if the user specifies that ULogger should have classifiaction filter settings which match the test trace points, then fill the filter arrays with the test trace point identifiers accordingly
		SetFilterL(setPrimFilter);		
		}
	else
		{
		//if the user specifies that ULogger should have classifciation filter settings which dont match the test trace points, then fill the filter arrays with the trace point identifiers which differ from the test trace point identifiers
		setPrimFilter->AppendL((TGroupId)(KGroupId+1));
		}
	
	if(aComponentIdFilterMatch==1)
			{
			//if the user specifies that ULogger should have module id filter settings which match the test trace points, then fill the filter arrays with the test trace point identifiers accordingly
			setSecondFilter.Append((TComponentId) KComponentId);
			}
		else
			{
			//if the user specifies that ULogger should have module id settings which dont match the test trace points, then fill the filter arrays with the trace point identifiers which differ from the test trace point identifiers
			setSecondFilter.Append((TComponentId) (KComponentId+1));
			}

	//set the filter settings in ULogger according to the above defined filter arrays
	err=aLogger.SetPrimaryFiltersEnabled(*setPrimFilter,ETrue);//C.A. previously:err=aLogger.EnableClassifications(*setPrimFilter);
	if(err==0)
		err=aLogger.SetSecondaryFiltersEnabled(setSecondFilter,ETrue);//C.A. previously:err=aLogger.EnableModuleUids(setSecondFilter);
	
	
	if(err==0)	
		{
		//now set the ULogger session to output to the specified plugin and configuration
		err=aLogger.ActivateOutputPlugin(aPluginName);//C.A. previously:err=aLogger.SetActiveOutputPlugin(aPluginName);
	
		if((err == KErrNone)/*Added*/||(err == KErrAlreadyExists))//C.A. have to add cuz old api returns -11 if plugin already activated
			{
			err=aLogger.SetPluginConfigurations(aPluginName, aPluginConfiguration);
			if(err==0)
				{
				//given the ULogger session has successfully been configured to output to the default file, start the session
				err=aLogger.Start();//C.A. previously:err=aLogger.StartOutputting();
				}
			}
		}
	
	//cleanup any heap objects

	CleanupStack::PopAndDestroy(&setSecondFilter);	
	CleanupStack::PopAndDestroy(setPrimFilter);
	
	return err;
	}
Exemplo n.º 23
0
// -----------------------------------------------------------------------------
// SetInfoPopupWindowLayoutL
//
// -----------------------------------------------------------------------------
//
void CAknInfoPopupNote::SetInfoPopupWindowLayoutL()
    {
    // Get parameter and table limits for popup preview text window
    TAknLayoutScalableParameterLimits limits = 
        AknLayoutScalable_Avkon::popup_preview_text_window_ParamLimits();

    TAknLayoutScalableTableLimits tableLimits =
        AknLayoutScalable_Avkon::popup_preview_text_window_t_Limits();

    // Get layout rects
    TRect rectScreen = iAvkonAppUi->ApplicationRect();
    TInt mainPaneVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 4 : 1;
    TRect rectMainPane = RectFromLayout( rectScreen,
        AknLayoutScalable_Avkon::main_pane( mainPaneVariety ) );

    // Use first variety to be able to get the font for text parsing
    TInt firstVariety = SelectWindowVariety( 1, limits );

    TRect rectPopupWindow = RectFromLayout( rectMainPane,
        AknLayoutScalable_Avkon::popup_preview_text_window( firstVariety ) );

    TInt firstIndex = tableLimits.FirstIndex();
    TInt firstLineVariety = AknLayoutScalable_Avkon::
        popup_preview_text_window_t_ParamLimits( firstIndex ).FirstVariety();
        
    TAknTextLineLayout popupTextLayout =
        AknLayoutScalable_Avkon::popup_preview_text_window_t(
            firstIndex, firstLineVariety );

    TAknLayoutText layoutText;
    layoutText.LayoutText( rectPopupWindow, popupTextLayout );
    TRect rectText = layoutText.TextRect();

    // Prepare text parsing
    const CFont *font = layoutText.Font();

    CArrayFixFlat<TInt>* lineWidths 
        = new ( ELeave ) CArrayFixFlat<TInt>( KMaxNumOfLines );
    CleanupStack::PushL( lineWidths );

    for ( TInt i = 0; i < KMaxNumOfLines; i++ )
        {
        lineWidths->AppendL( rectText.Width() );
        }

    // Parse text
    iText->ParseTextL( font, lineWidths );
    TInt numberOfLines = iText->NumberOfLines();

    CleanupStack::PopAndDestroy( lineWidths );

    // Select the variety index depending on the number of lines
    TInt windowVariety = SelectWindowVariety( numberOfLines, limits );

    // Set layouts for window and text lines
    AknLayoutUtils::LayoutControl( this, rectMainPane,       
        AknLayoutScalable_Avkon::popup_preview_text_window( windowVariety ) );

    rectPopupWindow = Rect();
    iText->SetRect( rectPopupWindow );

    for ( TInt lineIndex = tableLimits.FirstIndex(), ii = 0;
          ( lineIndex <= tableLimits.LastIndex() ) && ( ii < numberOfLines );
          ++lineIndex, ++ii )
        {
        // Select the variety index depending on the number of lines
        TInt lineVariety = SelectLineVariety( numberOfLines, 
            AknLayoutScalable_Avkon::popup_preview_text_window_t_ParamLimits(
                lineIndex ) );

        popupTextLayout = AknLayoutScalable_Avkon::popup_preview_text_window_t(
            lineIndex, lineVariety );

        AknLayoutUtils::LayoutLabel( iText->Line( ii ), rectPopupWindow,
            popupTextLayout, font );
       }

    // Override text color
    TRgb textColor = KRgbBlack;
    AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor,
        KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG55 );
    AknLayoutUtils::OverrideControlColorL( *iText, EColorLabelText, textColor );

    // Move pop-up note to right location
    if ( IsVisible() )
        {
        Relocate();
        }
    }
Exemplo n.º 24
0
// -----------------------------------------------------------------------------
// SetTooltipWindowLayoutL
//
// -----------------------------------------------------------------------------
//
void CAknInfoPopupNote::SetTooltipWindowLayoutL()
    {
    // Get parameter and table limits for popup preview text window
    TAknLayoutScalableParameterLimits limits = 
        AknLayoutScalable_Avkon::popup_preview_text_window_ParamLimits();

    TAknLayoutScalableTableLimits tableLimits =
        AknLayoutScalable_Avkon::popup_preview_text_window_t_Limits();

    // Get layout rects
    const TRect rectScreen = iAvkonAppUi->ApplicationRect();
    const TRect rectMainPane = rectScreen;

    // Set pop-up to contain only one line of text
    const TInt numberOfLines = 1;
    TInt windowVariety = SelectWindowVariety( numberOfLines, limits );

    TInt lineVariety = SelectLineVariety( numberOfLines, 
        AknLayoutScalable_Avkon:: popup_preview_text_window_t_ParamLimits(
             tableLimits.FirstIndex() ) );

    // Get the font for the text
    TRect rectPopupWindow = RectFromLayout( rectMainPane,
        AknLayoutScalable_Avkon::popup_preview_text_window(
            windowVariety ) );

    TAknTextComponentLayout popupTextLayout =
        AknLayoutScalable_Avkon::popup_preview_text_window_t(
            tableLimits.FirstIndex(), lineVariety );

    TAknLayoutText layoutText;
    layoutText.LayoutText( rectPopupWindow, popupTextLayout );
    const CFont *font = layoutText.Font();
    
    TInt maxLineWidth = ( rectMainPane.Width() - popupTextLayout.l() )
                        - popupTextLayout.r();

    TInt textWidth = font->TextWidthInPixels( iText->Text() );
    textWidth = Min( textWidth, maxLineWidth );

    // Parse text
    CArrayFixFlat<TInt>* lineWidths 
        = new ( ELeave ) CArrayFixFlat<TInt>( numberOfLines );
    CleanupStack::PushL( lineWidths );

    lineWidths->AppendL( textWidth );
    iText->ParseTextL( font, lineWidths );
    
    CleanupStack::PopAndDestroy( lineWidths );

    // Set layout for window
    rectPopupWindow = RectFromLayout( rectMainPane,
        AknLayoutScalable_Avkon::popup_preview_text_window( windowVariety ) );

    // Adjust window size depending on text length
    SetSize( TSize( textWidth + popupTextLayout.l() + popupTextLayout.r(),
                    rectPopupWindow.Height() ) );

    // Set layout for text lines
    rectPopupWindow = Rect();
    iText->SetRect( rectPopupWindow );

    for ( TInt lineIndex = tableLimits.FirstIndex(), ii = 0;
          ( lineIndex <= tableLimits.LastIndex() ) && ( ii < numberOfLines );
          ++lineIndex, ++ii )
        {
        popupTextLayout = AknLayoutScalable_Avkon::popup_preview_text_window_t(
            lineIndex, lineVariety );

        AknLayoutUtils::LayoutLabel( iText->Line( ii ), rectPopupWindow,
                                     popupTextLayout, font );
        }

    // Override text color
    TRgb textColor = KRgbBlack;
    AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), textColor,
        KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG55 );
    AknLayoutUtils::OverrideControlColorL( *iText, EColorLabelText, textColor );

    // Move tooltip to right location
    if ( IsVisible() )
        {
        Relocate();
        }
    }
Exemplo n.º 25
0
QT_BEGIN_NAMESPACE

QColor launchSymbianColorDialog(QColor initial)
{
    QColor currentColor = QColor::Invalid;
#ifdef Q_WS_S60
    QT_TRAP_THROWING(
        CArrayFixFlat<TRgb>* array = new( ELeave ) CArrayFixFlat<TRgb>(17);
        CleanupStack::PushL(array);
        array->AppendL(KRgbBlack);
        array->AppendL(KRgbDarkGray);
        array->AppendL(KRgbDarkRed);
        array->AppendL(KRgbDarkGreen);
        array->AppendL(KRgbDarkYellow);
        array->AppendL(KRgbDarkBlue);
        array->AppendL(KRgbDarkMagenta);
        array->AppendL(KRgbDarkCyan);
        array->AppendL(KRgbRed);
        array->AppendL(KRgbGreen);
        array->AppendL(KRgbYellow);
        array->AppendL(KRgbBlue);
        array->AppendL(KRgbMagenta);
        array->AppendL(KRgbCyan);
        array->AppendL(KRgbGray);
        array->AppendL(KRgbWhite);

        TRgb initialColour(initial.red(), initial.green(), initial.blue(), initial.alpha());

        TBool noneChosen = EFalse; // If true shows the default colour button
        CAknColourSelectionGrid* colourSelectionGrid =
            CAknColourSelectionGrid::NewL(array, EFalse, noneChosen, initialColour);
        CleanupStack::PushL(colourSelectionGrid);

    if (colourSelectionGrid->ExecuteLD()) {
    currentColor.setRgb(initialColour.Red(), initialColour.Green(),
                        initialColour.Blue(), initialColour.Alpha());
    }
    CleanupStack::Pop(colourSelectionGrid);
    CleanupStack::PopAndDestroy(array);
    );
Exemplo n.º 26
0
/**
Persist the items belonging to curent group into group table

@param aGroup referece to a contact group
*/
void CPplGroupsTable::WriteGroupMembersL(const CContactItem& aGroup)
	{
	if (aGroup.Type() != KUidContactGroup)
		{
		return;
		}

	const TContactItemId KGroupId(aGroup.Id() );

	// make sure we clear out any previous, out-of-date data
	TBool lowDiskErr(EFalse);
	DeleteItemL(KGroupId, lowDiskErr);
	if (lowDiskErr)
		{
		User::Leave(KErrDiskFull);
		}

	// build the RSqlStatement
	RSqlStatement stmnt;
	CleanupClosePushL(stmnt);
	stmnt.PrepareL(iDatabase, iInsertStmnt->SqlStringL() );
	const TInt KGroupIdIndex(KFirstIndex); 			// first parameter in query...	
	const TInt KMemberIdIndex(KGroupIdIndex + 1); 	// ...and the second parameter
	
	// copy and sort the member id array so we can see if there are duplicates
	const CContactIdArray* contactIdArray = static_cast<const CContactGroup&>(aGroup).ItemsContained();  //does not take the ownership
	
	const TInt arrayCount = contactIdArray->Count();
	CArrayFixFlat<TContactItemId>* sortedList = new(ELeave) CArrayFixFlat<TContactItemId>(KArrayGranularity);	
	CleanupStack::PushL(sortedList);
    for(TInt loop = 0;loop < arrayCount; ++loop)
    	{
    	sortedList->AppendL((*contactIdArray)[loop]);		
    	}
	TKeyArrayFix key(0,ECmpTInt);
	sortedList->Sort(key);

	// insert the group-member relationships
	const TInt KCountStmntParamIndex(KFirstIndex); // first and only parameter in query
	const TInt listLen(sortedList->Count() );
	TInt lastId(0);
	for (TInt i = 0; i < listLen; ++i)
		{
		TInt itemId((*sortedList)[i]);
		
		//check if a contact item with itemId id really exists in contact database
		RSqlStatement countStmnt;
		CleanupClosePushL(countStmnt);
		countStmnt.PrepareL(iDatabase, iCountContactsStmnt->SqlStringL() );
		User::LeaveIfError(countStmnt.BindInt(KCountStmntParamIndex, itemId) );
		TInt count = 0;
		TInt err = KErrNone;
		if((err = countStmnt.Next() ) == KSqlAtRow)
			{
			count = countStmnt.ColumnInt(iCountContactsStmnt->ParameterIndex(KSqlCount) );
			}
		else
			{
			User::LeaveIfError(err);	
			}	

		if(count == 0) 
			{
			User::Leave(KErrNotFound);	
			}
		CleanupStack::PopAndDestroy(&countStmnt);
			
		// only insert this if we haven't already seen it
		if (itemId != lastId || i == 0)
			{
			User::LeaveIfError(stmnt.BindInt(KGroupIdIndex, KGroupId) );
			User::LeaveIfError(stmnt.BindInt(KMemberIdIndex, itemId) );
			User::LeaveIfError(stmnt.Exec() );
			User::LeaveIfError(stmnt.Reset() );
			}
		lastId = itemId;
		}

	CleanupStack::PopAndDestroy(2, &stmnt); // and sortedList
	}
Exemplo n.º 27
0
TInt CTelephonyFunctions::GetCallInfoL(TDes8& aCallSelect, TDes8& aCallInfo, TDes8& aRemoteInfo)
/**
Get the current call information.
*/
	{
    CTelephony::TCallSelectionV1& CallSelectionV1 = reinterpret_cast<CTelephony::TCallSelectionV1&> 
                                                        ( const_cast<TUint8&> ( *aCallSelect.Ptr() ) );
    
	if(CallSelectionV1.iLine != CTelephony::EVoiceLine)
		{
		return KErrAccessDenied;
		}

	if(IsFlightModeOn())
		{
		return KErrAccessDenied;
		}

    CTelephony::TCallInfoV1& CallInfoV1 = reinterpret_cast<CTelephony::TCallInfoV1&> 
                                                        ( const_cast<TUint8&> ( *aCallInfo.Ptr() ) );

    CTelephony::TRemotePartyInfoV1& RemotePartyInfoV1 = reinterpret_cast<CTelephony::TRemotePartyInfoV1&> 
                                                        ( const_cast<TUint8&> ( *aRemoteInfo.Ptr() ) );	

	TPtr8* callInfoPkgPtr;
	RMobileCall::TMobileCallInfoV1* callInfoObjPtr;

	if(iTsyVersion == KNoMultimodeTsy)
		{
		return KErrNotSupported;
		}
	else if(iTsyVersion==KETelExtMultimodeV1 || iTsyVersion==KETelExtMultimodeV2)
		{
		RMobileCall::TMobileCallInfoV1*  callInfoV1 = new(ELeave) RMobileCall::TMobileCallInfoV1; 
		CleanupStack::PushL(callInfoV1);
		RMobileCall::TMobileCallInfoV1Pckg* callInfoV1Pckg = new(ELeave) RMobileCall::TMobileCallInfoV1Pckg(*callInfoV1); 
		CleanupStack::PushL(callInfoV1Pckg);
		callInfoPkgPtr = callInfoV1Pckg;
		callInfoObjPtr = callInfoV1;
		}
	else	//TSY v3
		{
		RMobileCall::TMobileCallInfoV3*  callInfoV3 = new(ELeave) RMobileCall::TMobileCallInfoV3; 
		CleanupStack::PushL(callInfoV3);
		RMobileCall::TMobileCallInfoV3Pckg* callInfoV3Pckg = new(ELeave) RMobileCall::TMobileCallInfoV3Pckg(*callInfoV3); 
		CleanupStack::PushL(callInfoV3Pckg);
		callInfoPkgPtr = callInfoV3Pckg;
		callInfoObjPtr = callInfoV3;
		}
 
	TInt numOfCalls=0;
	User::LeaveIfError(iLineVoice.EnumerateCall(numOfCalls));
	if (numOfCalls==0)
		{
		User::Leave(KErrNotFound);
		}
	CArrayFixFlat<RMobileCall>* tempCallArray = new (ELeave) CArrayFixFlat<RMobileCall>(numOfCalls);
	CleanupStack::PushL(TCleanupItem(CloseArrayOfCallObjects, tempCallArray));
	TInt i;
	
	RLine::TCallInfo callinfo;
	RMobileCall::TMobileCallStatus callStatus;
	TBool callFound=EFalse;
	for(i=0; i<numOfCalls; i++)
   		{
   		User::LeaveIfError(iLineVoice.GetCallInfo(i,callinfo));
   		RMobileCall tempCall; 
 		
 		tempCallArray->AppendL(tempCall);
 		User::LeaveIfError(tempCallArray->At(i).OpenExistingCall(iLineVoice,callinfo.iCallName));
		User::LeaveIfError(tempCallArray->At(i).GetMobileCallStatus(callStatus));
		 				
		if((callStatus==RMobileCall::EStatusConnected) &&
			(CallSelectionV1.iSelect==CTelephony::EActiveCall))
			{
			User::LeaveIfError(tempCallArray->At(i).GetMobileCallInfo(*callInfoPkgPtr));
			callFound=ETrue;
			break;
			}
		else if((callStatus==RMobileCall::EStatusHold) &&
			(CallSelectionV1.iSelect==CTelephony::EHeldCall))
			{
			User::LeaveIfError(tempCallArray->At(i).GetMobileCallInfo(*callInfoPkgPtr));
			callFound=ETrue;
			break;
			}
		else if(((callStatus==RMobileCall::EStatusDialling) ||
			  	(callStatus==RMobileCall::EStatusRinging) ||
			 	(callStatus==RMobileCall::EStatusAnswering) ||
				(callStatus==RMobileCall::EStatusConnecting) ||
				(callStatus==RMobileCall::EStatusReconnectPending) ||
				(callStatus==RMobileCall::EStatusDisconnecting) ||
				(callStatus==RMobileCall::EStatusDisconnectingWithInband) ||
				(callStatus==RMobileCall::EStatusTransferring) ||
				(callStatus==RMobileCall:: EStatusTransferAlerting) 
				) &&
			(CallSelectionV1.iSelect==CTelephony::EInProgressCall))
			{
			User::LeaveIfError(tempCallArray->At(i).GetMobileCallInfo(*callInfoPkgPtr));
			callFound=ETrue;
			break;
			}
		
		}	
	
	CleanupStack::PopAndDestroy(tempCallArray);	//tempCallArray
	if(!callFound)
		{
		CleanupStack::PopAndDestroy(2); //(callInfoV1Pckg or callInfoV3Pckg) AND (callInfoV1 or callInfoV3)		
		return KErrNotFound;
		}
	
	GetCallStatus(callInfoObjPtr->iStatus, CallInfoV1.iStatus);	

	if (callInfoObjPtr->iValid & RMobileCall::KCallSecurity)
		{
		if(callInfoObjPtr->ExtensionId() == KETelExtMultimodeV3)
			{
			RMobileCall::TMobileCallInfoV3* callInfoV3Ptr = reinterpret_cast<RMobileCall::TMobileCallInfoV3*>(callInfoObjPtr);
			
			switch(callInfoV3Ptr->iSecurity)
				{
			case RMobilePhone::ECipheringGSM:
				CallInfoV1.iSecurity = CTelephony::ECipheringGSM;
				break;
			case RMobilePhone::ECipheringWCDMA:
				CallInfoV1.iSecurity = CTelephony::ECipheringWCDMA;
				break;
			case RMobilePhone::ECipheringOff:
			default:
				CallInfoV1.iSecurity = CTelephony::ECipheringOff;
				break;
				}		
			}
		else
			CallInfoV1.iSecurity = CTelephony::ECipheringOff;
		}
	else
		{
		CallInfoV1.iSecurity = CTelephony::TPhoneNetworkSecurity();
		}

	
	if (callInfoObjPtr->iValid & RMobileCall::KCallStartTime)
		{
		CallInfoV1.iStartTime = callInfoObjPtr->iStartTime;
		}
	else
		{
		CallInfoV1.iStartTime = TDateTime();
		}
	if (callInfoObjPtr->iValid & RMobileCall::KCallDuration)
		{
		CallInfoV1.iDuration = callInfoObjPtr->iDuration;
		}
	else
		{
		CallInfoV1.iDuration = 0;
		}
	if (callInfoObjPtr->iValid & RMobileCall::KCallExitCode)
		{
		CallInfoV1.iExitCode = callInfoObjPtr->iExitCode;
		}
	else
		{
		CallInfoV1.iExitCode = 0;
		}
	
	if (callInfoObjPtr->iValid & RMobileCall::KCallDialledParty)
		{
		CopyTelAddress(callInfoObjPtr->iDialledParty, CallInfoV1.iDialledParty);
		}
	else
		{
		CallInfoV1.iDialledParty = CTelephony::TTelAddress();
		}

	//see whether we have an existing handle on the call
	CallInfoV1.iCallId = -1;
	RMobileCall* poolCall=NULL;
	RMobileCall::TMobileCallInfoV1  poolCallInfoV1;
	RMobileCall::TMobileCallInfoV1Pckg poolCallInfoV1Pckg(poolCallInfoV1);
	TInt err;
	
	for(int k=0;k<CTelephony::EISVMaxNumOfCalls;k++)
		{
		//get RMobileCall object
		if((poolCall = Call((CTelephony::TCallId)k)) != NULL)
			{
			//get call name
			err = poolCall->GetMobileCallInfo(poolCallInfoV1Pckg);
			if(err ==KErrNone)
				{
				//compare call names
				if(poolCallInfoV1.iCallName.MatchF(callinfo.iCallName)==0)
					{
					CallInfoV1.iCallId = k;
					break;			
					}
				}			
			}		
		}
		
	//fill TRemotePartyInfoV1
	RMobileCall::TMobileCallRemotePartyInfoV1& mobileRemoteParty = callInfoObjPtr->iRemoteParty;
	
	switch(mobileRemoteParty.iRemoteIdStatus)
		{
	case RMobileCall::ERemoteIdentityAvailable:
		RemotePartyInfoV1.iRemoteIdStatus = CTelephony::ERemoteIdentityAvailable;
		break;
	case RMobileCall::ERemoteIdentitySuppressed:
		RemotePartyInfoV1.iRemoteIdStatus = CTelephony::ERemoteIdentitySuppressed;
		break;
	case RMobileCall::ERemoteIdentityUnknown:
	default:
		RemotePartyInfoV1.iRemoteIdStatus = CTelephony::ERemoteIdentityUnknown;		
		break;
		}
		
	RemotePartyInfoV1.iCallingName.Copy(mobileRemoteParty.iCallingName);
	CopyTelAddress(mobileRemoteParty.iRemoteNumber, RemotePartyInfoV1.iRemoteNumber);
		
	switch(mobileRemoteParty.iDirection)
		{
	case RMobileCall::EMobileOriginated:
		RemotePartyInfoV1.iDirection = CTelephony::EMobileOriginated;
		break;
	case RMobileCall::EMobileTerminated:
		RemotePartyInfoV1.iDirection = CTelephony::EMobileTerminated;
		break;
	case RMobileCall::EDirectionUnknown:
	default:
		RemotePartyInfoV1.iDirection = CTelephony::EDirectionUnknown;
		break;
		}	
	
	CleanupStack::PopAndDestroy(2); //(callInfoV1Pckg or callInfoV3Pckg) AND (callInfoV1 or callInfoV3)
	
	return KErrNone;
	}	
Exemplo n.º 28
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
TBool CMainContainer::HandlePopUpMenuSelectionL(TInt& aCommand)
{
	TBool ret(EFalse);
	
	TBool isEnable(EFalse),isDisable(EFalse),isRemove(EFalse),isaPreview(EFalse);
	ShowMenuItemsL(isEnable,isDisable,isRemove,isaPreview);
	
	if(!isRemove && !isaPreview){
		ret = ETrue;
		aCommand = EProfModify;
	}else{
	
		TBuf<100> hjelpper;
		CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox;
		CleanupStack::PushL(list);
	
		CAknPopupList* popupList = CAknPopupList::NewL(list,R_AVKON_SOFTKEYS_OK_CANCEL);
		CleanupStack::PushL(popupList);
	
		list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect);
		list->CreateScrollBarFrameL(ETrue);
		list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
	
		CArrayFixFlat<TInt>* cmdArray = new (ELeave) CArrayFixFlat<TInt>(5);
		CleanupStack::PushL(cmdArray);
		CDesCArrayFlat* Array = new (ELeave) CDesCArrayFlat(5);
		CleanupStack::PushL(Array);

		if(isEnable){
			StringLoader::Load(hjelpper,R_CMD_ENABLE);
			Array->AppendL(hjelpper);
			cmdArray->AppendL(EProfEnable);
		}else if(isDisable){
			StringLoader::Load(hjelpper,R_CMD_DISABLE);
			Array->AppendL(hjelpper);
			cmdArray->AppendL(EProfDisable);
		}
		
		if(isaPreview && !iDimPreview){
			StringLoader::Load(hjelpper,R_CMD_MODIFY);
			Array->AppendL(hjelpper);
			cmdArray->AppendL(EProfModify);
	
			StringLoader::Load(hjelpper,R_CMD_PREVIEW);
			Array->AppendL(hjelpper);
			cmdArray->AppendL(EProfTest);		
		}

		if(isRemove){
			StringLoader::Load(hjelpper,R_CMD_DELETE);
			Array->AppendL(hjelpper);
			cmdArray->AppendL(EProfRemove);		
		}

		list->Model()->SetItemTextArray(Array);
		CleanupStack::Pop();//Array
		list->Model()->SetOwnershipType(ELbmOwnsItemArray);
	
		if (popupList->ExecuteLD())
		{
			TInt Selected = list->CurrentItemIndex();
			if(Selected >= 0 && Selected < cmdArray->Count())
			{
				ret = ETrue;
				aCommand = cmdArray->At(Selected);
			}
		}
	
		CleanupStack::PopAndDestroy(1); // cmdArray
		CleanupStack::Pop();            // popuplist
		CleanupStack::PopAndDestroy(1); // list
	}
	
	return ret;
}
Exemplo n.º 29
0
void CVoIPForm::ProcessCommandL(TInt aCommandId)
    {
    CAknForm::ProcessCommandL(aCommandId);

    switch (aCommandId)
        {
        case EVoIPEditMenuItemCommand:
            {
            CAknForm::ProcessCommandL(EAknFormCmdEdit);
            break;
            }
        case EVoIPAddMenuItemCommand:
            {
            CAknForm::ProcessCommandL(EAknFormCmdAdd);

            CVoIPAppUi* iAppUi =
                    static_cast<CVoIPAppUi*> (iEikonEnv->EikAppUi());
            const CPbkFieldsInfo& fieldsInfo =
                    iAppUi->GetPhoneBook()->GetFieldsInfo();

            const TInt count = fieldsInfo.Count();

            CDesCArray* list = new (ELeave) CDesCArrayFlat(count);
            CleanupStack::PushL(list);

            CArrayFixFlat<TInt>* correspondence = new (ELeave) CArrayFixFlat<
                    TInt> (count);
            CleanupStack::PushL(correspondence);

            for (TInt i = 0; i < count; ++i)
                {
                CPbkFieldInfo* fieldInfo = fieldsInfo[i];
                const TDesC* fieldName = &(fieldInfo->FieldName());

                if (fieldName->Length() > 0)
                    {
                    _LIT(KFormat, "\t%S");
                    TBuf<256> fieldStr;
                    fieldStr.Format(KFormat, fieldName);

                    list->AppendL(fieldStr);
                    correspondence->AppendL(i);
                    }
                }

            TInt selectedIndex;
            CAknSelectionListDialog* dialog = CAknSelectionListDialog::NewL(
                    selectedIndex, list, 0);

            if (dialog->ExecuteLD(R_LIST_DIALOG))
                {
                CPbkFieldInfo* fieldInfo =
                        fieldsInfo[(*correspondence)[selectedIndex]];
                const TDesC& fieldName = fieldInfo->FieldName();

                TInt id = fieldInfo->FieldId();
                TInt pageId = ActivePageId();
                TAny* unused = 0;

                if (fieldInfo->EditMode() == EPbkFieldEditModeAlpha)
                    {
                    TInt type = EEikCtEdwin;

                    CEikEdwin* editor = (CEikEdwin*) CreateLineByTypeL(
                            fieldName, pageId, id, type, unused);

                    editor->ConstructL(EEikEdwinNoHorizScrolling
                            | EEikEdwinResizable, 10, 100, 1);

                    }
                else if (fieldInfo->EditMode() == EPbkFieldEditModeNumeric)
                    {
                    TInt type = EEikCtEdwin;

                    CEikEdwin* editor = (CEikEdwin*) CreateLineByTypeL(
                            fieldName, pageId, id, type, unused);

                    editor->SetAknEditorInputMode(EAknEditorNumericInputMode);
                    editor->SetAknEditorAllowedInputModes(
                            EAknEditorNumericInputMode);

                    editor->ConstructL(EEikEdwinNoHorizScrolling
                            | EEikEdwinResizable, 10, 100, 1);
                    }
                else if (fieldInfo->EditMode() == EPbkFieldEditModeDate)
                    {
                    TInt type = EEikCtDateEditor;

                    CEikDateEditor* editor =
                            (CEikDateEditor*) CreateLineByTypeL(fieldName,
                                    pageId, id, type, unused);

                    editor->ConstructL(TTime(mindateTime),
                            TTime(maxdateTime), TTime(nowdateTime), ETrue);
                    }

                Line(id)->ActivateL();
                SetChangesPending(ETrue);
                UpdatePageL(ETrue);
                }

            CleanupStack::PopAndDestroy(2); // list, correspondence
            break;
            }
        default:
            {
            CVoIPAppUi* iAppUi =
                    static_cast<CVoIPAppUi*> (iEikonEnv->EikAppUi());

            CVoIPListBoxView* iView =
                    static_cast<CVoIPListBoxView*> (iAppUi->View(TUid::Uid(
                            EVoIPListBoxViewId)));

            iView->HandleCommandL(aCommandId);

            break;
            }
        }
    }
Exemplo n.º 30
0
void CLinePaginatorTest::StorePageBreakL(TInt aDocPos)
	{
	iNumPages++;
	iTestChars->AppendL(aDocPos);
	}