Sending files with SendUi
Article Metadata
Compatibility
Article
CSendUi API in 3rd edition and CSendAppUi API in pre-3rd edition is probably the easiest way on sending files from Symbian S60 devices. Note that it has internal protection against sending copy protected content, thus you can not send some files for example SIS files with it.
First define following member variables in your class definition:
#ifdef __SERIES60_3X__
CSendUi* iSendUi;
#else
CSendAppUi* iSendUi;
#endif
The indef with __SERIES60_3X__ will make sure that code compiled for 3rd edition will use CSendUi and other platforms will use CSendAppUi. Then to construct the SendUi instance, just add following lines into the ContsructL()-function of your class.
#ifdef __SERIES60_3X__
iSendUi = CSendUi::NewL();
#else
iSendUi = CSendAppUi::NewL(0);
#endif
Which after you can add your files to be sent into descriptor array and then you can use the following function to send the files out from the phone.
// Includes needed
#include <sendui.h>
#include <cmessagedata.h>
// Implementation>
void CreateAndSendMessageL(CDesCArray* aArray)
{
if(aArray && iSendUi)
{
TSendingCapabilities MySendCapa;
MySendCapa.iFlags = TSendingCapabilities::ESupportsAttachments;
if(aArray->Count())
{
#ifdef __SERIES60_3X__
CMessageData* Mymessage = CMessageData::NewLC();
for(TInt i=0; i< aArray->Count(); i++)
{
Mymessage->AppendAttachmentL(aArray->MdcaPoint(i));
}
TUid MyServiceUid = iSendUi->ShowSendQueryL(Mymessage,MySendCapa);
if(iSendUi->ValidateServiceL(MyServiceUid,MySendCapa))
{
iSendUi->CreateAndSendMessageL(MyServiceUid,Mymessage);
}
CleanupStack::PopAndDestroy( Mymessage);
#else
iSendUi->CreateAndSendMessagePopupQueryL(KtxApplicationName,MySendCapa,NULL,aArray);
#endif
}
}
}
The Sending function will cause SendUi to pop up selection list box filled with possible methods for sending the files, and selecting one will cause files to be sent with selected method.


(no comments yet)