23 #include "NSmlStatusContainer.h" |
23 #include "NSmlStatusContainer.h" |
24 #include "nsmlcliagconstants.h" |
24 #include "nsmlcliagconstants.h" |
25 #include "nsmlerror.h" |
25 #include "nsmlerror.h" |
26 #include "smlmetinfdtd.h" |
26 #include "smlmetinfdtd.h" |
27 |
27 |
|
28 // CONSTANTS |
|
29 _LIT8(KDbPersonal, "100000" ); |
|
30 |
28 // --------------------------------------------------------- |
31 // --------------------------------------------------------- |
29 // CNSmlStatusContainer::CNSmlStatusContainer |
32 // CNSmlStatusContainer::CNSmlStatusContainer |
30 // Constructor, nothing special in here. |
33 // Constructor, nothing special in here. |
31 // --------------------------------------------------------- |
34 // --------------------------------------------------------- |
32 // |
35 // |
218 TInt result = cenrep->Get( KNSmlDMSCOMOTargetRef, targetPath ); |
221 TInt result = cenrep->Get( KNSmlDMSCOMOTargetRef, targetPath ); |
219 if((targetPath.Length()) && (result == KErrNone)) |
222 if((targetPath.Length()) && (result == KErrNone)) |
220 { |
223 { |
221 TPtrC8 sourcePath( (TUint8*) (*iStatusArray)[aEntryID-1].status->targetRefList->targetRef->content, (*iStatusArray)[aEntryID-1].status->targetRefList->targetRef->length ); |
224 TPtrC8 sourcePath( (TUint8*) (*iStatusArray)[aEntryID-1].status->targetRefList->targetRef->content, (*iStatusArray)[aEntryID-1].status->targetRefList->targetRef->length ); |
222 |
225 |
223 SmlSource_t* source = new( ELeave ) SmlSource_t; |
226 (*iStatusArray)[aEntryID-1].status->itemList = new ( ELeave ) SmlItemList_t; |
224 source->locURI = new( ELeave ) SmlPcdata_t; |
227 (*iStatusArray)[aEntryID-1].status->itemList->item = new( ELeave ) SmlItem_t; |
225 source->locURI->SetDataL( sourcePath ); |
228 |
226 source->locURI->contentType = SML_PCDATA_OPAQUE; |
229 (*iStatusArray)[aEntryID-1].status->itemList->item->source = new( ELeave ) SmlSource_t; |
227 source->locURI->extension = SML_EXT_UNDEFINED; |
230 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locURI = new( ELeave ) SmlPcdata_t; |
228 source->locName = NULL; |
231 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locURI->SetDataL( sourcePath ); |
|
232 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locURI->contentType = SML_PCDATA_OPAQUE; |
|
233 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locURI->extension = SML_EXT_UNDEFINED; |
|
234 (*iStatusArray)[aEntryID-1].status->itemList->item->source->locName = NULL; |
229 |
235 |
230 SmlTarget_t* target = new( ELeave ) SmlTarget_t; |
236 _LIT8( KNSmlNull, "null" ); |
231 target->locURI = new( ELeave ) SmlPcdata_t; |
237 if(targetPath.Compare( KNSmlNull )!= 0) |
232 target->locURI->SetDataL( targetPath ); |
238 { |
233 target->locURI->contentType = SML_PCDATA_OPAQUE; |
239 (*iStatusArray)[aEntryID-1].status->itemList->item->target = new( ELeave ) SmlTarget_t; |
234 target->locURI->extension = SML_EXT_UNDEFINED; |
240 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locURI = new( ELeave ) SmlPcdata_t; |
235 target->locName = NULL; |
241 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locURI->SetDataL( targetPath ); |
236 AddSourceRefL( aEntryID, source ); |
242 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locURI->contentType = SML_PCDATA_OPAQUE; |
237 |
243 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locURI->extension = SML_EXT_UNDEFINED; |
238 SmlTargetRefList_t** targetRefList; |
244 (*iStatusArray)[aEntryID-1].status->itemList->item->target->locName = NULL; |
239 targetRefList = &(*iStatusArray)[aEntryID-1].status->targetRefList; |
245 } |
240 while( *targetRefList ) |
246 (*iStatusArray)[aEntryID-1].status->targetRefList = NULL; |
241 { |
247 |
242 if ((*targetRefList)->next == NULL ) |
|
243 break; |
|
244 targetRefList = &(*targetRefList)->next; |
|
245 } |
|
246 *targetRefList = new( ELeave ) SmlTargetRefList_t; |
|
247 CreateTargetRefL( target, (*targetRefList)->targetRef ); |
|
248 |
|
249 _LIT8(KNullString, ""); |
248 _LIT8(KNullString, ""); |
250 result = cenrep->Set( KNSmlDMSCOMOTargetRef, KNullString ); |
249 result = cenrep->Set( KNSmlDMSCOMOTargetRef, KNullString ); |
251 } |
250 } |
252 delete cenrep; |
251 delete cenrep; |
253 cenrep = NULL; |
252 cenrep = NULL; |
254 } |
253 } |
255 } |
254 } |
256 |
255 |
|
256 // TargertUri Fix Ends |
|
257 |
257 CleanupStack::PopAndDestroy(); //statusCode |
258 CleanupStack::PopAndDestroy(); //statusCode |
258 } |
259 } |
259 } |
260 } |
260 // --------------------------------------------------------- |
261 // --------------------------------------------------------- |
261 // CNSmlStatusContainer::SetChalL() |
262 // CNSmlStatusContainer::SetChalL() |
534 } |
535 } |
535 } |
536 } |
536 return statusPresents; |
537 return statusPresents; |
537 } |
538 } |
538 // --------------------------------------------------------- |
539 // --------------------------------------------------------- |
|
540 // CNSmlStatusContainer::FillItemDataL() |
|
541 // Populates the Item structure |
|
542 // --------------------------------------------------------- |
|
543 EXPORT_C void CNSmlStatusContainer::FillItemDataL( SmlItem_t*& aItem ) |
|
544 { |
|
545 //Source |
|
546 aItem->source = new( ELeave ) SmlSource_t; |
|
547 SmlPcdata_t* srcdata = new( ELeave ) SmlPcdata_t; |
|
548 srcdata->SetDataL( KDbPersonal ); |
|
549 srcdata->contentType = SML_PCDATA_OPAQUE; |
|
550 srcdata->extension = SML_EXT_UNDEFINED; |
|
551 CopyPcdataL( srcdata, aItem->source->locURI ); |
|
552 |
|
553 // Source Parent |
|
554 aItem->sourceParent = new( ELeave ) SmlSourceParent_t; |
|
555 SmlPcdata_t* srcprntdata = new( ELeave ) SmlPcdata_t; |
|
556 srcprntdata->SetDataL( _L8("/") ); |
|
557 srcprntdata->contentType = SML_PCDATA_OPAQUE; |
|
558 srcprntdata->extension = SML_EXT_UNDEFINED; |
|
559 CopyPcdataL( srcprntdata, aItem->sourceParent->locURI ); |
|
560 } |
|
561 // --------------------------------------------------------- |
|
562 // CNSmlStatusContainer::StatusItem() |
|
563 // Retrieve the Status element bearing the ID provided |
|
564 // --------------------------------------------------------- |
|
565 EXPORT_C SmlStatus_t* CNSmlStatusContainer::StatusItem( TInt aStatusID ) |
|
566 { |
|
567 |
|
568 if( ( iStatusArray ) && |
|
569 ( iStatusArray->Count() <= aStatusID ) ) |
|
570 { |
|
571 |
|
572 return (*iStatusArray)[aStatusID-1].status; |
|
573 } |
|
574 |
|
575 return NULL; |
|
576 } |
|
577 // --------------------------------------------------------- |
539 // CNSmlStatusContainer::CreatePcdataL() |
578 // CNSmlStatusContainer::CreatePcdataL() |
540 // Creates Pcdata |
579 // Creates Pcdata |
541 // Created element is not pushed to Cleanup stack |
580 // Created element is not pushed to Cleanup stack |
542 // --------------------------------------------------------- |
581 // --------------------------------------------------------- |
543 void CNSmlStatusContainer::CreatePcdataL( SmlPcdata_t*& aPcdata, const TDesC8& aContent ) const |
582 void CNSmlStatusContainer::CreatePcdataL( SmlPcdata_t*& aPcdata, const TDesC8& aContent ) const |