Up to: Mika Raento's Symbian Programming pages
I first tried using the lower level OBEX functionality to send files but I couldn't get that working with my laptop. Not even the supplied examples (that do work with another phone) worked with the laptop. So I'm using the CSendAppUi class.
The CSendAppUi only works with graphical applications, since it has to be put in a menu and used from the menu choice. Here's how it works:
sendui=CSendAppUi::NewL(Econtext_logCmdSendAppUi, NULL);The command id should be chosen so that there are free ids after it, since the CSendAppUi will return one of several ids that begin with the given, depending on the type of communications chosen.
sendui->DisplaySendMenuItemL(*aMenuPane, 1, TSendingCapabilities (0, 100000, 0));in your DynInitMenuPaneL(). We want to send largish files but no other content, so we initialize the TSendingCapabilities with bodysize 0 and no flags, but with at least 100k available for attachments.
sendui->DisplaySendCascadeMenuL(*aMenuPane);in your DynInitMenuPaneL().
switch ( aCommand ) { default: if (aCommand > Econtext_logCmdSendAppUi) { CDir* dir; _LIT(dirname, "c:\\system\\apps\\context_log\\log*.txt"); User::LeaveIfError(fsSession.GetDir(dirname, KEntryAttNormal, ESortByName, dir)); CleanupStack::PushL(dir); CDesC16ArrayFlat *array = new (ELeave) CDesC16ArrayFlat(dir->Count()); CleanupStack::PushL(array); TBuf<256> filen; for (int i=0; i<dir->Count(); i++) { filen=(TText*)L"c:\\system\\apps\\context_log\\"; filen.Append((*dir)[i].iName); TEntry fe; if (fsSession.Entry(filen, fe)==KErrNone && fe.iSize>0) { array->AppendL(filen); } } sendui->CreateAndSendMessageL (aCommand, 0, array); CleanupStack::PopAndDestroy(2); // dir, array } break; }
Things to note:
Mika Raento, mikie(at)iki.fi