messagingapp/msgutils/unidatamodel/unimmsdataplugin/src/unimmsdataplugin_p.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  * 
       
    14  * Description: 
       
    15  *
       
    16  */
       
    17 
       
    18 //SYSTEM INCLUDES
       
    19 #include <e32cmn.h>
       
    20 #include <mtclreg.h>
       
    21 #include <mtclbase.h>
       
    22 #include <msvids.h>
       
    23 #include <txtetext.h>
       
    24 #include <txtrich.h>
       
    25 #include <txtfmlyr.h>
       
    26 #include <badesca.h>
       
    27 #include <eikrted.h>
       
    28 
       
    29 #include <mmsclient.h>
       
    30 #include <mmssettings.h>
       
    31 #include <mmsheaders.h>
       
    32 #include <MsgMediaInfo.h>
       
    33 #include <MsgMediaResolver.h>
       
    34 #include <DRMHelper.h>
       
    35 
       
    36 
       
    37 #include <QDateTime>
       
    38 
       
    39 #include "convergedmessage.h"
       
    40 #include "s60qconversions.h"
       
    41 #include "convergedmessageaddress.h"
       
    42 #include "unimmsdataplugin_p.h"
       
    43 #include "UniDataModel.h"
       
    44 #include "debugtraces.h"
       
    45 #include "sessioneventhandler.h"
       
    46 
       
    47 
       
    48 #define KSenduiMtmMmsUidValue 0x100058E1
       
    49 const TUid KSenduiMtmMmsUid =
       
    50 {KSenduiMtmMmsUidValue};
       
    51 _LIT(KUnixEpoch, "19700000:000000.000000");
       
    52 
       
    53 const TInt KMmsArrayAllocationNumber = 6;
       
    54 
       
    55 UniMMSDataPluginPrivate::UniMMSDataPluginPrivate():
       
    56     mSession(NULL),
       
    57     mMtmRegistry(NULL),
       
    58     mUniDataModel(NULL),
       
    59     mMmsClient(NULL),
       
    60     mInsertingMedia(NULL),
       
    61     iEditor(NULL),
       
    62     iDom(NULL),
       
    63     iDRMHelper(NULL),
       
    64     iSessionHandler(NULL)
       
    65     {
       
    66 
       
    67     done = EFalse;
       
    68     iSessionHandler = new SessionEventHandler();
       
    69     mSession = CMsvSession::OpenSyncL(*iSessionHandler);
       
    70     iSessionHandler->start();
       
    71     }
       
    72 
       
    73 void UniMMSDataPluginPrivate::initL()
       
    74 {
       
    75     mMtmRegistry = CClientMtmRegistry::NewL(*mSession);
       
    76     mMmsClient
       
    77     = static_cast<CMmsClientMtm*> (mMtmRegistry->NewMtmL(KSenduiMtmMmsUid));
       
    78 
       
    79     User::LeaveIfError(mfsSession.Connect());
       
    80     iMessageId = 0;
       
    81 }
       
    82 
       
    83 UniMMSDataPluginPrivate::~UniMMSDataPluginPrivate()
       
    84 {
       
    85     delete iEditor;
       
    86     delete iDom;
       
    87     if(mUniDataModel)
       
    88     {
       
    89         delete mUniDataModel;
       
    90     }
       
    91     mfsSession.Close();
       
    92     delete mMmsClient;
       
    93     delete mMtmRegistry;
       
    94     delete iSessionHandler;
       
    95     delete mSession;
       
    96 }
       
    97 
       
    98 int UniMMSDataPluginPrivate::setMessageId(int messageId)
       
    99 {
       
   100     TInt error = KErrNone;
       
   101     TRAP(error, setMessageIdL(messageId));
       
   102     return error;
       
   103 }
       
   104 
       
   105 void UniMMSDataPluginPrivate::setMessageIdL(int messageId)
       
   106 {
       
   107     if (done == EFalse)
       
   108     {
       
   109         initL();
       
   110     }
       
   111 
       
   112     if (iMessageId != messageId)
       
   113     {
       
   114         if (done)
       
   115         {
       
   116             reset();
       
   117         }
       
   118         done = ETrue;
       
   119         iMessageId = messageId;
       
   120         mMmsClient->SwitchCurrentEntryL(iMessageId);
       
   121         mMmsClient->LoadMessageL();
       
   122         mUniDataModel = CUniDataModel::NewL(mfsSession, *mMmsClient);
       
   123         mUniDataModel->RestoreL(*this, EFalse);
       
   124     }
       
   125 }
       
   126 
       
   127 void UniMMSDataPluginPrivate::reset()
       
   128 {
       
   129     delete mUniDataModel;
       
   130     mUniDataModel = NULL;
       
   131 }
       
   132 
       
   133 void UniMMSDataPluginPrivate::body(QString& aBodyText)
       
   134 {
       
   135 
       
   136     CRichText& textBody = mMmsClient->Body();
       
   137     TInt len = textBody.DocumentLength();
       
   138     HBufC* buf = HBufC::NewL(len);
       
   139     TPtr bufPtr = buf->Des();
       
   140     aBodyText = S60QConversions::s60DescToQString(bufPtr);
       
   141 }
       
   142 
       
   143 int UniMMSDataPluginPrivate::messageSize()
       
   144 {
       
   145     return mMmsClient->MessageSize();
       
   146 }
       
   147 
       
   148 
       
   149 QString UniMMSDataPluginPrivate::subject()
       
   150 {
       
   151    TPtrC sub =  mMmsClient->SubjectL();
       
   152    return S60QConversions::s60DescToQString(sub);
       
   153 }
       
   154 
       
   155 
       
   156 
       
   157 
       
   158 void UniMMSDataPluginPrivate::toRecipientList(
       
   159     ConvergedMessageAddressList& mAddressList)
       
   160 {
       
   161     CMsvEntry* cEntry = mSession->GetEntryL(KMsvGlobalInBoxIndexEntryIdValue);
       
   162     CleanupStack::PushL(cEntry);
       
   163     TRAPD (error, cEntry->SetEntryL( iMessageId ));
       
   164     if (error != KErrNone)
       
   165     {
       
   166         CleanupStack::PopAndDestroy(); // cEntry
       
   167         return;
       
   168     }
       
   169     CMsvStore* store = cEntry->ReadStoreL();
       
   170     CleanupStack::PushL(store);
       
   171     CMmsSettings* settings = CMmsSettings::NewL();
       
   172     CleanupStack::PushL(settings);
       
   173     CMmsHeaders* mmsHeaders = CMmsHeaders::NewL(settings->MmsVersion());
       
   174     CleanupStack::PushL(mmsHeaders);
       
   175     mmsHeaders->RestoreL(*store);
       
   176     TPtrC name;
       
   177     TPtrC address;
       
   178     TPtrC to;
       
   179     for (TInt id = 0; id < mmsHeaders->ToRecipients().MdcaCount(); id++)
       
   180     {
       
   181         to.Set( (mmsHeaders->ToRecipients())[id]);
       
   182         extractNameAndAddress(to, name, address);
       
   183         // populate address
       
   184         ConvergedMessageAddress
       
   185         * messageAddress =
       
   186             new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
       
   187                 S60QConversions::s60DescToQString(name));
       
   188         mAddressList.append(messageAddress);
       
   189     }
       
   190 
       
   191     CleanupStack::PopAndDestroy(3); //  mmsHeaders, settings, store
       
   192 
       
   193     CleanupStack::PopAndDestroy(); // cEntry
       
   194 }
       
   195 
       
   196 void UniMMSDataPluginPrivate::ccRecipientList(
       
   197     ConvergedMessageAddressList& mAddressList)
       
   198 {
       
   199     CMsvEntry* cEntry = mSession->GetEntryL(KMsvGlobalInBoxIndexEntryIdValue);
       
   200     CleanupStack::PushL(cEntry);
       
   201     TRAPD (error, cEntry->SetEntryL( iMessageId ));
       
   202     if (error != KErrNone)
       
   203     {
       
   204         CleanupStack::PopAndDestroy(); // cEntry
       
   205         return;
       
   206     }
       
   207     CMsvStore* store = cEntry->ReadStoreL();
       
   208     CleanupStack::PushL(store);
       
   209     CMmsSettings* settings = CMmsSettings::NewL();
       
   210     CleanupStack::PushL(settings);
       
   211     CMmsHeaders* mmsHeaders = CMmsHeaders::NewL(settings->MmsVersion());
       
   212     CleanupStack::PushL(mmsHeaders);
       
   213     mmsHeaders->RestoreL(*store);
       
   214     //CDesCArray& ccList = mmsHeaders->CcRecipients();
       
   215 
       
   216     TPtrC cc;
       
   217     TPtrC name;
       
   218     TPtrC address;
       
   219     for (TInt id = 0; id < mmsHeaders->CcRecipients().MdcaCount(); id++)
       
   220     {
       
   221         cc.Set( (mmsHeaders->CcRecipients())[id]);
       
   222         extractNameAndAddress(cc, name, address);
       
   223         // populate address
       
   224         ConvergedMessageAddress
       
   225         * messageAddress =
       
   226             new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
       
   227                 S60QConversions::s60DescToQString(name));
       
   228         mAddressList.append(messageAddress);
       
   229     }
       
   230 
       
   231     CleanupStack::PopAndDestroy(3); //  mmsHeaders, settings, store
       
   232 
       
   233     CleanupStack::PopAndDestroy(); // cEntry
       
   234 }
       
   235 
       
   236 void UniMMSDataPluginPrivate::bccRecipientList(
       
   237     ConvergedMessageAddressList& mAddressList)
       
   238 {
       
   239     CMsvEntry* cEntry = mSession->GetEntryL(KMsvGlobalInBoxIndexEntryIdValue);
       
   240     CleanupStack::PushL(cEntry);
       
   241     TRAPD (error, cEntry->SetEntryL( iMessageId ));
       
   242     if (error != KErrNone)
       
   243     {
       
   244         CleanupStack::PopAndDestroy(); // cEntry
       
   245         return;
       
   246     }
       
   247     CMsvStore* store = cEntry->ReadStoreL();
       
   248     CleanupStack::PushL(store);
       
   249     CMmsSettings* settings = CMmsSettings::NewL();
       
   250     CleanupStack::PushL(settings);
       
   251     CMmsHeaders* mmsHeaders = CMmsHeaders::NewL(settings->MmsVersion());
       
   252     CleanupStack::PushL(mmsHeaders);
       
   253     mmsHeaders->RestoreL(*store);
       
   254     //CDesCArray& bccList = mmsHeaders->BccRecipients();
       
   255 
       
   256     TPtrC bcc;
       
   257     TPtrC name;
       
   258     TPtrC address;
       
   259     for (TInt id = 0; id < mmsHeaders->BccRecipients().MdcaCount(); id++)
       
   260     {
       
   261         bcc.Set( (mmsHeaders->BccRecipients())[id]);
       
   262         extractNameAndAddress(bcc, name, address);
       
   263         // populate address
       
   264         ConvergedMessageAddress
       
   265         * messageAddress =
       
   266             new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
       
   267                 S60QConversions::s60DescToQString(name));
       
   268         mAddressList.append(messageAddress);
       
   269     }
       
   270 
       
   271     CleanupStack::PopAndDestroy(3); //  mmsHeaders, settings, store
       
   272 
       
   273     CleanupStack::PopAndDestroy(); // cEntry
       
   274 }
       
   275 
       
   276 void UniMMSDataPluginPrivate::fromAddress(QString& messageAddress)
       
   277 {
       
   278 
       
   279     TPtrC sender = mMmsClient->Sender();
       
   280     messageAddress = S60QConversions::s60DescToQString(sender);
       
   281 }
       
   282 
       
   283 UniMessageInfoList UniMMSDataPluginPrivate::attachmentList()
       
   284 {
       
   285     UniMessageInfoList attlist;
       
   286     int attcount = mUniDataModel->AttachmentList().Count();
       
   287 
       
   288     QString path;
       
   289     QString mimetype;
       
   290     int size;
       
   291     for (int i = 0; i < attcount; i++)
       
   292     {
       
   293         CUniObject *obj = mUniDataModel->AttachmentList().GetByIndex(i);
       
   294 
       
   295         mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType());
       
   296         path
       
   297         = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath());
       
   298         size = obj->Size(EFalse);
       
   299 
       
   300         UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype);
       
   301         attlist << msgobj;
       
   302     }
       
   303 
       
   304     return attlist;
       
   305 }
       
   306 
       
   307 QString UniMMSDataPluginPrivate::messageType()
       
   308 {
       
   309     QString str("mms");
       
   310     return str;
       
   311 }
       
   312 
       
   313 MsgPriority UniMMSDataPluginPrivate::messagePriority()
       
   314 {
       
   315     return Normal;
       
   316 }
       
   317 
       
   318 int UniMMSDataPluginPrivate::attachmentCount()
       
   319 {
       
   320     return mUniDataModel->AttachmentList().Count();
       
   321 }
       
   322 
       
   323 bool UniMMSDataPluginPrivate::hasAttachment()
       
   324 {
       
   325     int count = mUniDataModel->AttachmentList().Count();
       
   326     if (count > 0)
       
   327     {
       
   328         return true;
       
   329     }
       
   330     else
       
   331     {
       
   332         return false;
       
   333     }
       
   334 }
       
   335 
       
   336 int UniMMSDataPluginPrivate::objectCount()
       
   337 {
       
   338     return mUniDataModel->ObjectList().Count();
       
   339 }
       
   340 
       
   341 UniMessageInfoList UniMMSDataPluginPrivate::objectList()
       
   342 {
       
   343     UniMessageInfoList objlist;
       
   344     int objcount = mUniDataModel->ObjectList().Count();
       
   345 
       
   346     QString path;
       
   347     QString mimetype;
       
   348     int size;
       
   349     for (int i = 0; i < objcount; i++)
       
   350     {
       
   351         CUniObject *obj = mUniDataModel->ObjectList().GetByIndex(i);
       
   352 
       
   353         mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType());
       
   354         path
       
   355         = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath());
       
   356         size = obj->Size(EFalse);
       
   357 
       
   358         UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype);
       
   359         objlist << msgobj;
       
   360     }
       
   361 
       
   362     return objlist;
       
   363 }
       
   364 
       
   365 /*
       
   366  * For now not reqd
       
   367  */
       
   368 int UniMMSDataPluginPrivate::slideCount()
       
   369 {
       
   370     return mUniDataModel->SmilModel().SlideCount();
       
   371 }
       
   372 
       
   373 UniMessageInfoList UniMMSDataPluginPrivate::slideContent(TInt slidenum)
       
   374 {
       
   375     UniMessageInfoList slidecontent;
       
   376 
       
   377     int slideobjcount = mUniDataModel->SmilModel().SlideObjectCount(slidenum);
       
   378 
       
   379     QString path;
       
   380     QString mimetype;
       
   381     int size;
       
   382     for (int i = 0; i < slideobjcount; i++)
       
   383     {
       
   384         CUniObject *obj = mUniDataModel->SmilModel().GetObjectByIndex(slidenum,
       
   385             i);
       
   386 
       
   387         mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType());
       
   388         path
       
   389         = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath());
       
   390         size = obj->Size(EFalse);
       
   391 
       
   392         UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype);
       
   393         slidecontent << msgobj;
       
   394     }
       
   395 
       
   396     return slidecontent;
       
   397 }
       
   398 
       
   399 int UniMMSDataPluginPrivate::timeStamp()
       
   400 {
       
   401     QDateTime retTimeStamp;
       
   402     TTime timeStamp = mMmsClient->Entry().Entry().iDate;
       
   403     TTime unixEpoch(KUnixEpoch);
       
   404     TTimeIntervalSeconds seconds;
       
   405     timeStamp.SecondsFrom(unixEpoch, seconds);
       
   406     return seconds.Int();
       
   407 }
       
   408 
       
   409 void UniMMSDataPluginPrivate::extractNameAndAddress(const TDesC& aMsvAddress,
       
   410     TPtrC& aName,
       
   411     TPtrC& aAddress)
       
   412 {
       
   413     // For address information separation (start)
       
   414     const TUint KMsgMmsAddressStartChar('<');
       
   415 
       
   416     // For address information separation (end)
       
   417     const TUint KMsgMmsAddressEndChar('>');
       
   418 
       
   419     TInt addressStart = aMsvAddress.LocateReverse(KMsgMmsAddressStartChar);
       
   420     TInt addressEnd = aMsvAddress.LocateReverse(KMsgMmsAddressEndChar);
       
   421 
       
   422     if (addressStart != KErrNotFound && addressEnd != KErrNotFound
       
   423             && addressEnd > addressStart)
       
   424     {
       
   425         // verified address, will be used as selected from contacts manager
       
   426         aName.Set(aMsvAddress.Ptr(), addressStart);
       
   427         aAddress.Set(aMsvAddress.Mid(addressStart + 1).Ptr(), (addressEnd
       
   428                 - addressStart) - 1);
       
   429         if (!aAddress.Length())
       
   430         {
       
   431             aAddress.Set(aName);
       
   432             aName.Set(KNullDesC); // empty string
       
   433         }
       
   434     }
       
   435     else
       
   436     {
       
   437         // unverified string, will be used as entered in the header field
       
   438         aName.Set(KNullDesC); // empty string
       
   439         aAddress.Set(aMsvAddress.Ptr(), aMsvAddress.Length()); // a whole string to address
       
   440     }
       
   441 
       
   442     if (aName.CompareF(aAddress) == 0)
       
   443     {
       
   444         aName.Set(KNullDesC); // empty string
       
   445     }
       
   446 }
       
   447 
       
   448 void UniMMSDataPluginPrivate::RestoreReady(TInt /*aParseResult*/, 
       
   449     TInt /*aError*/)
       
   450 {
       
   451 }
       
   452 
       
   453 void UniMMSDataPluginPrivate::addObjectL( int aSlideNum,UniMessageInfo* aInfo )
       
   454 {
       
   455     TInt error = KErrNone;
       
   456 
       
   457     HBufC* filePath = S60QConversions::qStringToS60Desc(aInfo->path());
       
   458     if(filePath)	
       
   459     {	
       
   460         CleanupStack::PushL(filePath);	
       
   461 
       
   462         RFile file = mUniDataModel->MediaResolver().FileHandleL( *filePath);
       
   463         CleanupClosePushL( file );
       
   464 
       
   465         mInsertingMedia = mUniDataModel->MediaResolver().CreateMediaInfoL( file );
       
   466 
       
   467         //TODO try using the commented code after testing on diff env or on hardware
       
   468         //mUniDataModel->MediaResolver().ParseInfoDetailsL( mInsertingMedia, file ); 
       
   469         iDRMHelper = CDRMHelper::NewL();   
       
   470         mInsertingMedia->ParseInfoDetailsL( file, *iDRMHelper, *this );
       
   471 
       
   472         mUniDataModel->SmilModel().AddObjectL( *this, aSlideNum, mInsertingMedia );
       
   473 
       
   474         //Since the ownership is transferred dont delete these
       
   475         mInsertingMedia = NULL;
       
   476         iDRMHelper = NULL;
       
   477 
       
   478 
       
   479         CleanupStack::PopAndDestroy( &file );
       
   480         CleanupStack::PopAndDestroy( filePath );	
       
   481     }	
       
   482 }
       
   483 
       
   484 void UniMMSDataPluginPrivate::ObjectSaveReady( TInt /*aError*/ )
       
   485 {
       
   486 
       
   487 }
       
   488 
       
   489 void UniMMSDataPluginPrivate::MediaInfoParsed()
       
   490 {
       
   491 
       
   492 }			
       
   493 void UniMMSDataPluginPrivate::addTextObjectL(int aSlideNum,QString aText )
       
   494 {
       
   495     TInt error = KErrNone;	
       
   496 
       
   497     //Delete this always
       
   498     delete iEditor;
       
   499     iEditor = NULL;
       
   500 
       
   501     HBufC* textContent = S60QConversions::qStringToS60Desc(aText);
       
   502     if(textContent)
       
   503     {	
       
   504         CleanupStack::PushL(textContent);		 
       
   505 
       
   506         iEditor = new CEikRichTextEditor;   
       
   507         iEditor->ConstructL(NULL,0,0,CEikEdwin::ENoAutoSelection|
       
   508             CEikEdwin::EOwnsWindow,0,0);
       
   509         iEditor->RichText()->InsertL(0,*textContent);
       
   510 
       
   511         mUniDataModel->SmilModel().AddTextObjectL( aSlideNum,iEditor);
       
   512         CleanupStack::PopAndDestroy( textContent );	
       
   513     }	
       
   514 }		
       
   515 
       
   516 void UniMMSDataPluginPrivate::addSlideL( int aSlideNum )
       
   517 {
       
   518     TInt error = KErrNone;	
       
   519     mUniDataModel->SmilModel().AddSlideL(aSlideNum);
       
   520 }		
       
   521 
       
   522 void UniMMSDataPluginPrivate::composeSmilL(CMsvStore& aEditStore)
       
   523 {	
       
   524     TInt error = KErrNone;	
       
   525 
       
   526     delete iDom;
       
   527     iDom = NULL;
       
   528 
       
   529     iDom = mUniDataModel->SmilModel().ComposeL();
       
   530 
       
   531     mUniDataModel->SmilList().CreateSmilAttachmentL( *this,aEditStore, iDom );
       
   532 }
       
   533 
       
   534 void UniMMSDataPluginPrivate::saveObjects()
       
   535 {
       
   536     mUniDataModel->ObjectList().SaveAll( *this, CMsvAttachment::EMsvFile );	
       
   537 }
       
   538 
       
   539 void UniMMSDataPluginPrivate::SmilComposeEvent( TInt /*aError*/ )
       
   540 {
       
   541 
       
   542 }
       
   543 
       
   544 TMsvAttachmentId UniMMSDataPluginPrivate::getSmilAttachmentByIndex() 
       
   545 {
       
   546     return mUniDataModel->SmilList().GetSmilAttachmentByIndex( 0 );
       
   547 }
       
   548 
       
   549 void UniMMSDataPluginPrivate::restoreL(CBaseMtm& mtm)
       
   550 {
       
   551     initL();	
       
   552     mUniDataModel = CUniDataModel::NewL(mfsSession, mtm);
       
   553     mUniDataModel->RestoreL(*this, ETrue);
       
   554 }
       
   555 
       
   556 void UniMMSDataPluginPrivate::addAttachmentL( UniMessageInfo* aInfo )
       
   557 {
       
   558     TInt error = KErrNone;
       
   559 
       
   560     HBufC* filePath = S60QConversions::qStringToS60Desc(aInfo->path());
       
   561     if(filePath)    
       
   562     {   
       
   563         CleanupStack::PushL(filePath);  
       
   564 
       
   565         RFile file = mUniDataModel->MediaResolver().FileHandleL( *filePath);
       
   566         CleanupClosePushL( file );
       
   567 
       
   568         mInsertingMedia = mUniDataModel->MediaResolver().CreateMediaInfoL( file );
       
   569 
       
   570         //TODO try using the commented code after testing on diff env or on hardware
       
   571         //mUniDataModel->MediaResolver().ParseInfoDetailsL( mInsertingMedia, file ); 
       
   572         iDRMHelper = CDRMHelper::NewL();   
       
   573         mInsertingMedia->ParseInfoDetailsL( file, *iDRMHelper, *this );
       
   574 
       
   575         mUniDataModel->AddAttachmentL( *this, mInsertingMedia,
       
   576             CMsvAttachment::EMsvFile );
       
   577 
       
   578         //Since the ownership is transferred dont delete these
       
   579         mInsertingMedia = NULL;
       
   580         iDRMHelper = NULL;
       
   581 
       
   582 
       
   583         CleanupStack::PopAndDestroy( &file );
       
   584         CleanupStack::PopAndDestroy( filePath );    
       
   585     }   
       
   586 }
       
   587 
       
   588 void UniMMSDataPluginPrivate::removeSlide(int aSlideNumber)
       
   589 {
       
   590     mUniDataModel->SmilModel().RemoveSlide(aSlideNumber);
       
   591 }
       
   592 
       
   593 
       
   594 CMsvSession* UniMMSDataPluginPrivate::session()
       
   595 {
       
   596     return mSession;
       
   597 }
       
   598