<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.newlc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>NewLC - Share: how to create a SMS with attachment in inbox - Comments</title>
 <link>http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox</link>
 <description>Comments for &quot;Share: how to create a SMS with attachment in inbox&quot;</description>
 <language>en</language>
<item>
 <title>Re: Share: how to create a SMS with attachment in inbox</title>
 <link>http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox#comment-41675</link>
 <description>&lt;p&gt;What about creating a neat article on NewLC Tutorils section about your solution?&lt;/p&gt;</description>
 <pubDate>Thu, 20 Sep 2007 16:34:17 +0200</pubDate>
 <dc:creator>vin2ktalks</dc:creator>
 <guid isPermaLink="false">comment 41675 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Share: how to create a SMS with attachment in inbox</title>
 <link>http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox#comment-41667</link>
 <description>&lt;p&gt;#ifdef __S60V22__ &lt;br /&gt;
#ifndef __S60V21__&lt;br /&gt;
// Open description file of the attachment&lt;br /&gt;
tempfileName.ZeroTerminate ();&lt;br /&gt;
TFileName desfileName = tempfileName.Left( tempfileName.Length () - 3 );&lt;br /&gt;
desfileName.ZeroTerminate ();&lt;/p&gt;

&lt;p&gt;RFs fs;&lt;br /&gt;
User::LeaveIfError( fs.Connect() );&lt;/p&gt;

&lt;p&gt;RFile attchDesFile;&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
TUint8 aUnkownFileds1[] = {0x68, 0x3C, 0x00, 0x10, 0x68, 0x3C, 0x00, 0x10, &lt;br /&gt;
0x00, 0x00, 0x00, 0x00, 0x4B, 0x8E, 0x8D, 0x00, 0x02, 0xC5, 0xAA, 0x00, 0x10 };&lt;br /&gt;
TUint8 aUnkownFields2[] = {0x00 , 0x10 , 0x00 , 0x00 }; &lt;br /&gt;
TUint8 aUnkownFields3[] = {0x00 , 0x00 , 0x00}; &lt;br /&gt;
TUint8 aTrailingBytes[] = {0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};&lt;/p&gt;

&lt;p&gt;// Replace the automated generated description file&lt;br /&gt;
attchDesFile.Replace( fs, desfileName, EFileWrite | EFileStream );&lt;/p&gt;

&lt;p&gt;RFileWriteStream stream(attchDesFile);&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
for ( TUint i = 0; i &lt; sizeof( aUnkownFileds1 ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
stream.WriteUint8L ( aUnkownFileds1[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;// 66 + attach file name length&lt;br /&gt;
// Increment by 8 when file length increments 1&lt;br /&gt;
stream.WriteUint8L ( 66 + igpFileName.Length() * 8 );&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
for ( i = 0; i &lt; sizeof( aUnkownFields2 ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
stream.WriteUint8L ( aUnkownFields2[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;// This field indicates the file name length&lt;br /&gt;
stream.WriteUint8L ( igpFileName.Length () );&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
for ( i = 0; i &lt; sizeof( aUnkownFields3 ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
stream.WriteUint8L ( aUnkownFields3[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;// attachment file name&lt;br /&gt;
stream.WriteL( igpFileName );&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
for ( i = 0; i &lt; sizeof( aTrailingBytes ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
stream.WriteUint8L ( aTrailingBytes[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;stream.Close ();&lt;br /&gt;
attchDesFile.Close ();&lt;br /&gt;
fs.Close();&lt;br /&gt;
#endif //#ifndef __S60V21__&lt;br /&gt;
#endif //#ifdef __S60V22__ &lt;/p&gt;

&lt;p&gt;#ifdef __S60V21__&lt;br /&gt;
// Open description file of the attachment&lt;br /&gt;
tempfileName.ZeroTerminate ();&lt;br /&gt;
TFileName desfileName21 = tempfileName.Left( tempfileName.Length () - 3 );&lt;br /&gt;
desfileName21.ZeroTerminate ();&lt;/p&gt;

&lt;p&gt;RFs fs21;&lt;br /&gt;
User::LeaveIfError( fs21.Connect() );&lt;/p&gt;

&lt;p&gt;RFile attchDesFile21;&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
TUint8 aUnkownFileds1_21[] = {0x68, 0x3C, 0x00, 0x10, 0x68, 0x3C, 0x00, 0x10, &lt;br /&gt;
0x00, 0x00, 0x00, 0x00, 0x4B, 0x8E, 0x8D, 0x00, 0x02, 0xC5, 0xAA, 0x00, 0x10 };&lt;br /&gt;
TUint8 aUnkownFields2_21[] = {0x00 ,0x00 , 0x00 }; &lt;br /&gt;
//TUint8 aUnkownFields3[] = {0x00 , 0x00 , 0x00}; &lt;br /&gt;
TUint8 aTrailingBytes_21[] = {0x00, 0x00, 0x00, 0x00};&lt;/p&gt;

&lt;p&gt;// Replace the automated generated description file&lt;br /&gt;
attchDesFile21.Replace( fs21, desfileName21, EFileWrite | EFileStream );&lt;/p&gt;

&lt;p&gt;RFileWriteStream stream21(attchDesFile21);&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
for ( TUint i = 0; i &lt; sizeof( aUnkownFileds1_21 ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
stream21.WriteUint8L ( aUnkownFileds1_21[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;// 66 + attach file name length&lt;br /&gt;
// Increment by 8 when file length increments 1&lt;br /&gt;
stream21.WriteUint8L ( 34 + igpFileName.Length() * 8 );&lt;/p&gt;

&lt;p&gt;// This field indicates the file name length&lt;br /&gt;
stream21.WriteUint8L ( igpFileName.Length () );&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
for ( i = 0; i &lt; sizeof( aUnkownFields2_21 ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
stream21.WriteUint8L ( aUnkownFields2_21[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
//for ( TUint i = 0; i &lt; sizeof( aUnkownFields3 ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
// {&lt;br /&gt;
// stream.WriteUint8L ( aUnkownFields3[i] );&lt;br /&gt;
// }&lt;/p&gt;

&lt;p&gt;// attachment file name&lt;br /&gt;
stream21.WriteL( igpFileName );&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
for ( i = 0; i &lt; sizeof( aTrailingBytes_21 ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
stream21.WriteUint8L ( aTrailingBytes_21[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;stream21.Close ();&lt;br /&gt;
attchDesFile21.Close ();&lt;br /&gt;
fs21.Close();&lt;br /&gt;
#endif&lt;/p&gt;

&lt;p&gt;#ifdef __UIQV21__&lt;br /&gt;
// Open description file of the attachment&lt;br /&gt;
tempfileName.ZeroTerminate ();&lt;br /&gt;
TFileName desfileNameUiq = tempfileName.Left( tempfileName.Length () - 3 );&lt;br /&gt;
desfileNameUiq.ZeroTerminate ();&lt;/p&gt;

&lt;p&gt;RFs fsUiq;&lt;br /&gt;
User::LeaveIfError( fsUiq.Connect() );&lt;/p&gt;

&lt;p&gt;RFile attchDesFileUiq;&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
TUint8 aUnkownFileds1Uiq[] = {0x68, 0x3C, 0x00, 0x10, 0x68, 0x3C, 0x00, 0x10, &lt;br /&gt;
0x00, 0x00, 0x00, 0x00, 0x4B, 0x8E, 0x8D, 0x00, 0x02, 0xA4, 0x53, 0x00, 0x10 };&lt;/p&gt;

&lt;p&gt;TUint8 aUnknownFileds2Uiq[] = { 0x00, 0x00, 0x00 };&lt;br /&gt;
// Replace the automated generated description file&lt;br /&gt;
attchDesFileUiq.Replace( fsUiq, desfileNameUiq, EFileWrite | EFileStream );&lt;/p&gt;

&lt;p&gt;RFileWriteStream streamUiq(attchDesFileUiq);&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;br /&gt;
for ( TUint i = 0; i &lt; sizeof( aUnkownFileds1Uiq ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
streamUiq.WriteUint8L ( aUnkownFileds1Uiq[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;// 66 + attach file name length&lt;br /&gt;
// Increment by 8 when file length increments 1&lt;br /&gt;
streamUiq.WriteUint8L ( 18 + igpFileName.Length() * 8 );&lt;/p&gt;

&lt;p&gt;// This field indicates the file name length&lt;br /&gt;
streamUiq.WriteUint8L ( igpFileName.Length () );&lt;/p&gt;

&lt;p&gt;for ( i = 0; i &lt; sizeof( aUnknownFileds2Uiq ) / sizeof ( TUint8 ); i ++ )&lt;br /&gt;
{&lt;br /&gt;
streamUiq.WriteUint8L ( aUnknownFileds2Uiq[i] );&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;// attachment file name&lt;br /&gt;
streamUiq.WriteL( igpFileName );&lt;/p&gt;

&lt;p&gt;// Unknown fields&lt;/p&gt;

&lt;p&gt;streamUiq.Close ();&lt;br /&gt;
attchDesFileUiq.Close ();&lt;br /&gt;
fsUiq.Close();&lt;/p&gt;

&lt;p&gt;#endif&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Thu, 20 Sep 2007 14:20:51 +0200</pubDate>
 <dc:creator>xueyw</dc:creator>
 <guid isPermaLink="false">comment 41667 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Share: how to create a SMS with attachment in inbox</title>
 <link>http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox#comment-41666</link>
 <description>&lt;p&gt;// Move igp file from c:\ to bt message attachment dir&lt;br /&gt;
// When download completes, igp is stored temporarily stored in c:\ //&lt;br /&gt;
RFs session;&lt;br /&gt;
session.Connect();&lt;br /&gt;
CleanupClosePushL( session );&lt;br /&gt;
CFileMan* fman = CFileMan::NewL( session );&lt;br /&gt;
fman-&gt;Move( igpFileName, *completeFilePath );&lt;br /&gt;
//TInt err =fman-&gt;Copy( igpFileName, *completeFilePath );&lt;/p&gt;

&lt;p&gt;delete fman;&lt;br /&gt;
CleanupStack::PopAndDestroy(); // completeFilePath&lt;br /&gt;
CleanupStack::PopAndDestroy(); // session&lt;/p&gt;

&lt;p&gt;// Process attachment&lt;br /&gt;
CMsvEntry* attachment=messageSession-&gt;GetEntryL( attachmentId );&lt;br /&gt;
TMsvEntry attachmentEntry=attachment-&gt;Entry();&lt;br /&gt;
CleanupStack::PushL( attachment );&lt;/p&gt;

&lt;p&gt;// Set attachment attributes&lt;br /&gt;
fileName.Append( description );&lt;br /&gt;
TEntry fileEntry;&lt;br /&gt;
messageSession-&gt;FileSession().Entry( fileName, fileEntry );&lt;br /&gt;
attachmentEntry.iDetails.Set( description );&lt;br /&gt;
attachmentEntry.iDate.HomeTime();&lt;br /&gt;
attachmentEntry.iSize = fileEntry.iSize;&lt;/p&gt;

&lt;p&gt;#ifdef __UIQV21__&lt;br /&gt;
ExternaliseAndCommit1FileNameL( attachment, TUid::Uid( KUidMsgTypeBT), &amp;description );&lt;br /&gt;
#endif&lt;/p&gt;

&lt;p&gt;#ifdef __S60V12__&lt;br /&gt;
ExternaliseAndCommit1FileNameL( attachment, TUid::Uid( KUidMsgTypeBt), &amp;description );&lt;br /&gt;
#endif &lt;br /&gt;
#ifdef __S60V22__&lt;br /&gt;
ExternaliseAndCommit1FileNameL( attachment, TUid::Uid( KUidMsgTypeBt.iUid ), &amp;description ); &lt;br /&gt;
#endif &lt;/p&gt;

&lt;p&gt;attachment-&gt;ChangeL( attachmentEntry );&lt;br /&gt;
CleanupStack::PopAndDestroy(); // attachment&lt;/p&gt;

&lt;p&gt;newEntry = entry-&gt;Entry();&lt;br /&gt;
newEntry.iSize = fileEntry.iSize;&lt;br /&gt;
newEntry.SetVisible( ETrue );&lt;br /&gt;
newEntry.SetInPreparation( EFalse );&lt;br /&gt;
newEntry.SetUnread( ETrue );&lt;br /&gt;
entry-&gt;ChangeL( newEntry );&lt;/p&gt;

&lt;p&gt;CleanupStack::PopAndDestroy(3); // inbox, mtmReg and mtm&lt;br /&gt;
CleanupStack::Pop(); // TCleanupItem(DeleteEntry, &amp;infoHolder&lt;br /&gt;
CleanupStack::PopAndDestroy(2); // messageSession, registry&lt;/p&gt;

&lt;p&gt;// For symbian v8 only&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Thu, 20 Sep 2007 14:20:28 +0200</pubDate>
 <dc:creator>xueyw</dc:creator>
 <guid isPermaLink="false">comment 41666 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Share: how to create a SMS with attachment in inbox</title>
 <link>http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox#comment-41665</link>
 <description>&lt;p&gt;#ifdef __UIQV21__&lt;br /&gt;
newEntry.iMtm = TUid::Uid( KUidMsgTypeBT );&lt;br /&gt;
#endif&lt;/p&gt;

&lt;p&gt;#ifdef __S60V12__&lt;br /&gt;
newEntry.iMtm = TUid::Uid( KUidMsgTypeBt );&lt;br /&gt;
#endif //&lt;br /&gt;
#ifdef __S60V22__&lt;br /&gt;
newEntry.iMtm = TUid::Uid( KUidMsgTypeBt.iUid );&lt;br /&gt;
#endif //__S60V22__&lt;br /&gt;
newEntry.SetVisible( EFalse );&lt;br /&gt;
newEntry.SetInPreparation( ETrue );&lt;br /&gt;
newEntry.iType = KUidMsvMessageEntry;&lt;br /&gt;
newEntry.iServiceId = KMsvUnknownServiceIndexEntryId;&lt;br /&gt;
newEntry.iDate.HomeTime();&lt;br /&gt;
newEntry.iSize = 120553;//todo&lt;br /&gt;
newEntry.iDetails.Set( details );&lt;br /&gt;
newEntry.iDescription.Set( description );&lt;/p&gt;

&lt;p&gt;// For bio&lt;br /&gt;
// For future usage&lt;br /&gt;
//newEntry.iBioType = 0x101F3CD9;&lt;br /&gt;
//newEntry.iMtmData3 = 1;&lt;br /&gt;
//KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated; // this defines MT message&lt;br /&gt;
//newEntry.iMtmData1 = 0;&lt;br /&gt;
//newEntry.iMtmData2 = 0;&lt;br /&gt;
//TUid aTypeUid;&lt;br /&gt;
//aTypeUid.iUid = 0x10000F6A;&lt;br /&gt;
//newEntry.iType = aTypeUid;&lt;br /&gt;
//TUid aMtmUid;&lt;br /&gt;
//aMtmUid.iUid = 0x10001262;&lt;br /&gt;
//newEntry.iMtm = aMtmUid;&lt;/p&gt;

&lt;p&gt;inbox-&gt;CreateL(newEntry);&lt;br /&gt;
infoHolder.iEntryId=newEntry.Id();&lt;/p&gt;

&lt;p&gt;CClientMtmRegistry* mtmReg = CClientMtmRegistry::NewL( *messageSession );&lt;br /&gt;
CleanupStack::PushL( mtmReg );&lt;/p&gt;

&lt;p&gt;// Child entry of inbox&lt;br /&gt;
// CMsvEntry&lt;br /&gt;
CMsvEntry* entry = messageSession-&gt;GetEntryL( newEntry.Id() );&lt;br /&gt;
CleanupStack::PushL( entry );&lt;/p&gt;

&lt;p&gt;CBaseMtm *mtm = mtmReg-&gt;NewMtmL( entry-&gt;Entry().iMtm );&lt;br /&gt;
// takes ownership&lt;br /&gt;
// The attachment will belong to it&lt;br /&gt;
mtm-&gt;SetCurrentEntryL( entry ); &lt;br /&gt;
CleanupStack::Pop(); // entry&lt;br /&gt;
CleanupStack::PushL( mtm );&lt;/p&gt;

&lt;p&gt;// Create an empty attachment&lt;br /&gt;
// On return, we get values of attachmentId, tempfileName &lt;br /&gt;
TFileName tempfileName;&lt;br /&gt;
TMsvId attachmentId;&lt;br /&gt;
mtm-&gt;CreateAttachmentL( attachmentId, tempfileName );&lt;/p&gt;

&lt;p&gt;// Construct the path of the file to be created as attachment&lt;br /&gt;
HBufC* completeFilePath = HBufC::NewLC( 500 ); &lt;br /&gt;
TPtr completeFilePathPtr = completeFilePath-&gt;Des();&lt;br /&gt;
completeFilePathPtr.Append( tempfileName );&lt;br /&gt;
completeFilePathPtr.Append( description );&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Thu, 20 Sep 2007 14:20:09 +0200</pubDate>
 <dc:creator>xueyw</dc:creator>
 <guid isPermaLink="false">comment 41665 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Share: how to create a SMS with attachment in inbox</title>
 <link>http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox#comment-41664</link>
 <description>&lt;p&gt;CMsvSession* messageSession;&lt;br /&gt;
CClientMtmRegistry* registry;&lt;br /&gt;
TFileName details;&lt;br /&gt;
TFileName description;&lt;br /&gt;
TFileName fileName;&lt;br /&gt;
TEntryInfoHolder infoHolder;&lt;/p&gt;

&lt;p&gt;messageSession = CMsvSession::OpenSyncL(*this);&lt;br /&gt;
CleanupStack::PushL(messageSession);&lt;/p&gt;

&lt;p&gt;registry = CClientMtmRegistry::NewL( *messageSession );&lt;br /&gt;
CleanupStack::PushL( registry );&lt;/p&gt;

&lt;p&gt;infoHolder.messageSession = messageSession;&lt;br /&gt;
infoHolder.iEntryId = 0; // No entry yet !&lt;br /&gt;
CleanupStack::PushL( TCleanupItem( DeleteEntry, &amp;infoHolder ) );&lt;/p&gt;

&lt;p&gt;// Subject&lt;br /&gt;
_LIT(KSub, &quot;InterGrafx&quot;);&lt;br /&gt;
details.Copy( KSub() );&lt;/p&gt;

&lt;p&gt;// Description&lt;br /&gt;
description.Copy( igpFileName );&lt;/p&gt;

&lt;p&gt;// Get message inbox&lt;br /&gt;
CMsvEntry* inbox=messageSession-&gt;GetEntryL( KMsvGlobalInBoxIndexEntryIdValue );&lt;br /&gt;
CleanupStack::PushL( inbox );&lt;/p&gt;

&lt;p&gt;TMsvEntry newEntry;&lt;/p&gt;

&lt;p&gt;// Child entry of inbox&lt;br /&gt;
// TMsvEntry&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Thu, 20 Sep 2007 14:19:50 +0200</pubDate>
 <dc:creator>xueyw</dc:creator>
 <guid isPermaLink="false">comment 41664 at http://www.newlc.com</guid>
</item>
<item>
 <title>Share: how to create a SMS with attachment in inbox</title>
 <link>http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox</link>
 <description>&lt;p&gt;I followed the instruction from the link below: &lt;a href=&quot;http://www.symbian.com/developer/techlib/v9.2docs/doc_source/faqsdk/faq_1151.html&quot;&gt;http://www.symbian.com/developer/techlib/v9.2docs/doc_source/faqsdk/faq_1151.html&lt;/a&gt;&lt;br /&gt;
But it doesn&#039;t work on 6630, 6600.&lt;/p&gt;

&lt;p&gt;And I found a solution to it.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/en/forum/share-how-create-sms-attachment-inbox#comments</comments>
 <category domain="http://www.newlc.com/en/forums/communications">Communications</category>
 <pubDate>Thu, 20 Sep 2007 14:19:27 +0200</pubDate>
 <dc:creator>xueyw</dc:creator>
 <guid isPermaLink="false">19031 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
