Esempio n. 1
0
EXPORT_C TInt FontUtils::GetAvailableHeightsInTwipsAndPointsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,CArrayFix<TInt>& aTwipsList,CDesCArray& aPointsList)
/** Gets a list of all heights in twips, available for the named typeface and the 
graphics device specified.

Also gets a list of heights in points, represented as character strings.

@param aDevice The graphics device.
@param aTypefaceName The name of the typeface.
@param aTwipsList On return, contains all available heights for the typeface, 
in twips.
@param aPointsList On return, the heights in points, represented as character 
strings.
@return KErrNotSupported if the named typeface is not supported by the graphics 
device, otherwise KErrNone. */
	{ // static
	aTwipsList.Reset();
	aPointsList.Reset();
	TInt err=GetAvailableHeightsInTwipsL(aDevice,aTypefaceName,aTwipsList);
	if (err==KErrNotSupported)
		return err;
	const TInt count=aTwipsList.Count();
	for (TInt ii=0;ii<count;ii++)
		{
		const TInt points=PointsFromTwips(aTwipsList[ii]);
		if (points<EMinFontHeight)
			continue;
		TBuf<8> num;
		num.Num(points);
		aPointsList.AppendL(num);
		}
	return KErrNone;
	}
Esempio n. 2
0
EXPORT_C void FontUtils::GetAvailableFontsL(const CGraphicsDevice& aDevice, CDesCArray& aFontNameList,TInt aFonts)
/** Gets the list of typeface names available for the graphics device.

@param aDevice The graphics device.
@param aFontNameList On return, contains the list of typeface names.
@param aFonts Can be used to specify which sorts of typefaces are required. 
For possible values, see the flags defined in gulftflg.hrh 
beginning with EGulAllFonts. */
	{ // static
	aFontNameList.Reset();
	const TInt numTypefaces=aDevice.NumTypefaces();
	TTypefaceSupport typefaceInfo;
	for (TInt ii=0;ii<numTypefaces;ii++)
		{
		aDevice.TypefaceSupport(typefaceInfo,ii);
		if (typefaceInfo.iTypeface.IsProportional())
			{
			if (aFonts==EGulMonospaceFontsOnly)
				continue;
			}
		else if (aFonts==EGulNoMonospaceFonts || aFonts==EGulNoMonospaceOrSymbolFonts)
			continue;
		if (typefaceInfo.iTypeface.IsSymbol())
			{
			if (aFonts==EGulNoSymbolFonts || aFonts==EGulNoMonospaceOrSymbolFonts || aFonts==EGulMonospaceFontsOnly)
				continue;
			}
		else if (aFonts==EGulSymbolFontsOnly)
			continue;
		aFontNameList.AppendL(typefaceInfo.iTypeface.iName);
		}
	}
Esempio n. 3
0
// ----------------------------------------------------------------------------
// Copies elements from one array of descriptors to another
// ----------------------------------------------------------------------------
//
EXPORT_C void MPXUser::CopyArrayL(const MDesCArray& aSrc, CDesCArray& aDest)
    {
    aDest.Reset();
    for (TInt i=0; i < aSrc.MdcaCount(); ++i)
        {
        aDest.AppendL(aSrc.MdcaPoint(i));
        }
    }
Esempio n. 4
0
void CPixelMetricsMapperViewContainer::ClearL()
    {
    MDesCArray* itemList = iListbox->Model()->ItemTextArray();
    CDesCArray* itemArray = ( CDesCArray* ) itemList;

    itemArray->Reset();

    iListbox->HandleItemAdditionL();
    iCount = 0;
    DrawNow();
    }
void CPhotoListView::StoreFolder()
{
	int answer;
	TInt Index;
	if(iFolderStatus>=0)
	{
		TInt compareflag;
	    TBuf<160> folderName;
	
	    folderName.FillZ();
		folderName.Zero();
		folderName.SetLength(0);
		CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL(folderName, CAknQueryDialog::ENoTone );
		answer=( dlg->ExecuteLD( R_FOLDER_NAME_QUERY ) ); // new folder name
		if(answer)
		{
			iFolderStatus=0;			
			
			compareflag=iPhotosAppUi->CheckAndSaveFolderToDB(folderName);
	
			if(compareflag!=1)
			{
				comment.Copy(folderName);
				iNewFolder = 1;
				ReadandSendData();
			}
			else
			{
				CDesCArray* folderexist = iPhotosAppUi->FolderExist();
				//CEikonEnv::Static ()->AlertWin (folderexist->MdcaPoint(0)) ;
				TBuf<100> msg;
				msg.Copy(folderexist->MdcaPoint(0));
				CAknMessageQueryDialog* verdlg = CAknMessageQueryDialog::NewL(msg);	
				verdlg->PrepareLC(R_ABOUT_QUERY);
				verdlg->RunLD();				
				folderexist->Reset();
			}
		}
		else
		{
			Index=0;				
			iFolderStatus=0;
			iPublic_Photo=EFalse;

		}
	}
}	
void
CTrialContainer::ResetItems(TBool showTrial)
{
   MDesCArray* itemList = iListBox->Model()->ItemTextArray();
   CDesCArray* itemArray = static_cast<CDesCArray*>( itemList );

   itemArray->Reset();
   iListBox->HandleItemRemovalL(); // Updates listbox.
   // Actually, the HandleItemRemovalL does not provoke a redraw...
   iListBox->Reset();

   if ((iShowTrial = showTrial)) {
      AppendItemAndUpdateBoxL(R_STARTMENU_TRIAL, *itemArray);
   }
   AppendItemAndUpdateBoxL(R_STARTMENU_REGISTER, *itemArray);
   AppendItemAndUpdateBoxL(R_STARTMENU_ALREADYREGISTERED, *itemArray);
}
// --------------------------------------------------------------------------
// CUpnpContentServerHandler::RefreshShareContentL
// ( other items are commented in header )
// --------------------------------------------------------------------------
//
void CUpnpContentServerHandler::RefreshShareContentL(
    TInt aType )
    {
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );

    if ( ( aType == EImageAndVideo && iVisualSharingReq ) ||
         ( aType == EPlaylist && iMusicSharingReq ) )
        {
        // no refresh available if sharing is ongoing
        __LOG1( "Error: %d", __LINE__ );
        User::Leave( KErrServerBusy );
        }

    if ( iMetadata->RefreshOngoing() )
        {
        __LOG("CUpnpContentServerHandler: Waiting refresh 1");
        iWait.Start();
        }

    delete iReader;
    iReader = NULL;
    iReader = CUpnpSelectionReader::NewL( iMetadata );

    RArray<TInt> selectedItems;
    CleanupClosePushL( selectedItems );
    CDesCArray* containers = new ( ELeave ) CDesCArrayFlat( 10 );
    CleanupStack::PushL( containers );
    iReader->FetchCollectionsL( containers );
    GetSelectionIndexesL( selectedItems, aType );
    CDesCArray* ids = new (ELeave) CDesCArrayFlat(4);
    CleanupStack::PushL( ids );
    CDesCArray* names = new (ELeave) CDesCArrayFlat(4);
    CleanupStack::PushL( names );
    iReader->CollectionIdsL( *ids, *names );

    if ( aType == EImageAndVideo )
        {
        iVisualSharingReq = CUpnpSharingRequest::NewL( aType,
                                                       selectedItems,
                                                       ids,
                                                       names );
        }
    else if ( aType == EPlaylist )
        {
        iMusicSharingReq = CUpnpSharingRequest::NewL( aType,
                                                      selectedItems,
                                                      ids,
                                                      names );
        }
    else
        {
        User::Leave( KErrArgument );
        }

    CleanupStack::Pop( names ); // ownership transferred
    CleanupStack::Pop( ids ); // ownership transferred
    ChangeShareContentL( selectedItems, aType );

    selectedItems.Reset();
    containers->Reset();

    CleanupStack::PopAndDestroy( containers );
    CleanupStack::PopAndDestroy( &selectedItems );
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
    }
Esempio n. 8
0
void CPlaylist::ResetView()
{
	CDesCArray* array = static_cast<CDesCArray*>(iListBox->Model()->ItemTextArray());
	array->Reset();
	iListBox->Reset();
}
Esempio n. 9
0
void CImSmtpSession::SendFileL()
	{
	// Start the 'file mailer' object
	__ASSERT_DEBUG(!iSmtpFile,gPanic(EImsmSmtpFileObjectAlreadyExists));
	// log the info of the message to be sent
	if (iLogMessage)
		iLogMessage->Reset();
	//  Update the header info for this message..
	CImHeader* header = CImHeader::NewLC();
	CMsvStore* store = iServerEntry.EditStoreL();
	CleanupStack::PushL(store);
	header->RestoreL(*store);

	TBool isBccRcpt = EFalse;
	CDesCArray* rcptArray = NULL;
	TBool sendBccNow = iToRcptHeaderUpdated;

	if(!iToRcptHeaderUpdated)
		{
		//  Set the new info...
		//set from address
		HBufC* formatedAddress = CreateFormattedAddressLC(iSettings.EmailAddress(), iSettings.EmailAlias());//Format the address fields
		header->SetFromL(*formatedAddress);
		CleanupStack::PopAndDestroy(formatedAddress);
		formatedAddress = NULL;

		// set ReceiptAddress if one exists in the settings
		if( header->ReceiptAddress().Length() == 0 && iSettings.ReceiptAddress().Length() > 0 )
			{
			formatedAddress=CreateFormattedAddressLC(iSettings.ReceiptAddress(),iSettings.EmailAlias());//Format the address fields
			header->SetReceiptAddressL(*formatedAddress);
			CleanupStack::PopAndDestroy(formatedAddress);
			formatedAddress = NULL;
			}

		if(header->ToRecipients().Count()==0 && header->CcRecipients().Count()==0)
			{
			sendBccNow=ETrue;
			}

		// ReplyToAddress
		if ((header->ReplyTo().Length() == 0 || header->ReplyTo() == iSettings.ReplyToAddress()) &&
		    (iSettings.ReplyToAddress().Length() > 0))
			{
			formatedAddress= CreateFormattedAddressLC(iSettings.ReplyToAddress(),iSettings.EmailAlias());//Format the address fields
			header->SetReplyToL(*formatedAddress);
			CleanupStack::PopAndDestroy(formatedAddress);
			formatedAddress = NULL;
			}
		
		//make a copy of 'Bcc' recipients then remove from Msg header
		rcptArray= &(header->BccRecipients());
		if (iSettings.SendCopyToSelf()==ESendCopyAsBccRecipient)
			{
			if ( header->ReceiptAddress().Length() )
				rcptArray->AppendL(header->ReceiptAddress());
			else if ( header->ReplyTo().Length() )
				rcptArray->AppendL(header->ReplyTo());
			}

		if(rcptArray->Count() > 0)
			{
			iBccRcptFound=ETrue; // 'Bcc' recipients exists
			iBccRcptIndex=0;	  //reset the counter
			iFinishedWithBccRcpts=EFalse;

			iSendFiles->ResetBccRcptArrayL();

			TInt numberRcpts = rcptArray->Count();
			if(numberRcpts)
			{
			iSendFiles->BccRcptArray().AppendL((*rcptArray)[0]);
			CDesCArray& tempArr = iSendFiles->BccRcptArray();
			for(TInt counter=1; counter<numberRcpts; counter++)
				{
				TInt aPos = 0;
				tempArr.Find((*rcptArray)[counter],aPos,ECmpFolded16);			
				if(aPos > 0)	
				iSendFiles->BccRcptArray().AppendL((*rcptArray)[counter]);
				}
				}
			rcptArray->Reset();
			}

		iToRcptHeaderUpdated=ETrue;
		isBccRcpt=EFalse;
		}

	// Reset the number of Sent Messages, if all previous messages have been sent
	if (iNumMsgsSent >= iNumMsgsToSend)
		{
		iNumMsgsSent = 0;
		}

	// Calc the num of messages we're sending. If there is a To or CC,
	// recipient then there will be a message sent
	if(header->ToRecipients().Count()>0 || header->CcRecipients().Count()>0)
		iNumMsgsToSend = 1;
	else
		iNumMsgsToSend = 0;

	// If there are BCC recipients, then we will be sending a message to each
	if (iBccRcptFound)
		iNumMsgsToSend += iSendFiles->BccRcptArray().Count();

	// Make sure there are recipients to send to.
	__ASSERT_ALWAYS(iNumMsgsToSend,gPanic(EImsmZeroRecipientsInMessage));

	// sending Msg to 'Bcc' recipients so update header
	if (sendBccNow && iBccRcptFound)
		{
		rcptArray= &(header->BccRecipients());
		rcptArray->Reset();
		header->BccRecipients().AppendL(iSendFiles->BccRcptArray()[iBccRcptIndex]);

		++iBccRcptIndex;//for the next recipient
		if(iBccRcptIndex < iSendFiles->BccRcptArray().Count())
			iFinishedWithBccRcpts=EFalse;
		else
			iFinishedWithBccRcpts=ETrue;

		isBccRcpt=ETrue;
		}

	header->StoreL(*store);
	store->CommitL();
	if (iLogMessage)
		{
		iLogMessage->LogEvent().SetEventType(KLogMailEventTypeUid);
		if ((header->ToRecipients().Count()
 			+ header->CcRecipients().Count()
 			+ header->BccRecipients().Count()) > 1)
 		// If there are multiple recipients then set the recipient to 'multiple'
 			{
 			TBuf<KLogMaxSharedStringLength> multipleRecipientsString;
 			iLogMessage->GetString(multipleRecipientsString, R_LOG_REMOTE_MULTIPLE);
 			iLogMessage->LogEvent().SetRemoteParty(multipleRecipientsString);
 			}
 		else
 		// If there is only one recipient then set the recipient name
 			{
			if (header->ToRecipients().Count())
				iLogMessage->LogEvent().SetRemoteParty(header->ToRecipients()[0]);

			else if (header->CcRecipients().Count())
				iLogMessage->LogEvent().SetRemoteParty(header->CcRecipients()[0]);

			else if (header->BccRecipients().Count())
				iLogMessage->LogEvent().SetRemoteParty(header->BccRecipients()[0]);
			}

		iLogMessage->LogEvent().SetSubject(header->Subject());

		TBuf<KLogMaxSharedStringLength> outString;
		iLogMessage->GetString(outString, R_LOG_DIR_OUT);
		iLogMessage->LogEvent().SetDirection(outString);

		iLogMessage->LogEvent().SetLink(iServerEntry.Entry().Id());
		}

	CleanupStack::PopAndDestroy(2, header);

	iTimeNow.UniversalTime();	// Set time/date of sending this message file
	if (iLogMessage)
		iLogMessage->LogEvent().SetTime(iTimeNow);
	TRAPD(error,iSmtpFile = CImSmtpFile::NewL(	*iSocket,
                                                iServerEntry,
												iTimeNow,
												iSmtpBuffer,
												iSettings,
												isBccRcpt)); // Create the file mailing object

	if(error == KErrNone)
		{
		// If this is the first message to send, then calc the total bytes to send
		if (iNumMsgsSent == 0)
			{
			iTotalBytesToSend =  iSmtpFile->TotalMsgSizeL() * iNumMsgsToSend;
			}

		// Tell the file how many bytes it will be sending.  This is just a
		// rough estimate for progress
		iSmtpFile->SetBytesToSend(iTotalBytesToSend/iNumMsgsToSend);

		// Increment the number of messages sent
		++iNumMsgsSent;

		iSmtpFile->StartL(iStatus);		// start sending the message
		MOBILITY_TEST_MTM_STATE(iServiceId, KMobilityTestMtmStateSmtpSendFile);
		}
	else
		{
		iCompleted=error;
		RequestComplete(iStatus,0-error);	// Failed to create File object, but don't want to stop session prematurely, so negate error code
		}
	}
void CPhotoListView::GetFolder()
{
	TInt PopValue;	
	//TBuf<150> msg;
	TInt count=0;	
	
	CDesCArray* items = iPhotosAppUi->GetFolderList();	
    CDesCArray* foldernames = iPhotosAppUi->ReturnText();

	if (items == NULL)
	{
		Count = 0;
		items = new (ELeave) CDesCArrayFlat(1);
		items->AppendL(foldernames->MdcaPoint(0));
	}
	else
	{
		Count = items->MdcaCount();	
		items->AppendL(foldernames->MdcaPoint(0));
	}
	foldernames->Reset();

	CEikTextListBox* list = new( ELeave ) CAknSinglePopupMenuStyleListBox;
    CleanupStack::PushL( list );

    CAknPopupList* popupList = CAknPopupList::NewL(
       list,
       R_AVKON_SOFTKEYS_SELECT_CANCEL,
       AknPopupLayouts::EMenuWindow);

    CleanupStack::PushL( popupList );
    
    popupList->SetMaximumHeight(2);

    list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
    list->CreateScrollBarFrameL( ETrue );
    list->ScrollBarFrame()->SetScrollBarVisibilityL(
		   CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );

    CTextListBoxModel* model = list->Model();
    model->SetItemTextArray( items );
    model->SetOwnershipType( ELbmOwnsItemArray );
	
	count = GetPhotoCount();

//	TInt price;
//	TLex lex(iPhotosAppUi->iCharge);
//	lex.Val(price);
//	count = count * price;

//	TBuf<30> temp;
//	temp.AppendNum(count);	

//	msg.Copy(_L("Charge "));
//	msg.Append(temp);
//	msg.Append(_L(" pesos"));

	//msg.Copy(_L("Select Album:"));
	//msg.Copy(*(iEikonEnv->AllocReadResourceL(R_IMAGES_SELECT_ALBUM)));
	
	/*count = count / 3;
	temp.Copy(_L(""));
	temp.AppendNum(count);

	path = iPhotosAppUi->ImageFolderPath();
	if(path == 0 || path == 1)			
		msg.Append(_L(" Photos)"));
	else if(path == 2 || path == 3)
		msg.Append(_L(" Videos)"));*/

	popupList->SetTitleL(*(iEikonEnv->AllocReadResourceL(R_IMAGES_SELECT_ALBUM)));

	PopValue = popupList->ExecuteLD();		
	
	if(PopValue==0)
	{
		iFolderStatus=-1;
	}
	else if(PopValue==1)
	{
		PopValue=list->CurrentItemIndex();		
		iFolderStatus=PopValue;		
		TPtrC ptr1(items->MdcaPoint(PopValue));
		comment.Copy(ptr1);		
	}
	
	items->Reset();
	CleanupStack::Pop(); // popupList
    CleanupStack::PopAndDestroy(); // list	

}