uifw/AvKon/notifsrc/AknSDData.cpp
changeset 0 2f259fa3e83a
child 10 9f56a4e1b8ab
child 45 667edd0b8678
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uifw/AvKon/notifsrc/AknSDData.cpp	Tue Feb 02 01:00:49 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <SecondaryDisplay/AknSecondaryDisplayDefs.h>
+#include <s32mem.h>
+#include "aknSDData.h"
+
+EXPORT_C void CAknSDData::ExternalizeL(RWriteStream& aStream) const
+    {
+    aStream.WriteInt32L(iCategory.iUid);
+    aStream.WriteInt32L(iDialogIdx);
+    if (iAdditionalData)
+        {
+        aStream.WriteInt32L(iAdditionalData->Length());
+        aStream << *iAdditionalData;            
+        }
+    else 
+        {
+        aStream.WriteInt32L(KErrNotFound);              
+        }    
+    }
+        
+EXPORT_C void CAknSDData::InternalizeL(RReadStream& aStream)
+    {
+    delete iAdditionalData;
+    iAdditionalData = 0;
+
+    iCategory.iUid = aStream.ReadInt32L();
+    iDialogIdx = aStream.ReadInt32L();
+    TInt size = aStream.ReadInt32L();
+    if (size != KErrNotFound )
+        {
+        iAdditionalData = HBufC8::NewL(size);
+        TPtr8 ptr (iAdditionalData->Des());
+        aStream >> ptr;
+        }
+    }
+
+EXPORT_C void CAknSDData::InsertGlobalListQueryItemIdsL(RArray<TInt>& aIdArray)
+    {
+    TInt count = aIdArray.Count();
+    if (count == 0)
+        {
+        return; // no use to waste mem and time to post nothing
+        }
+    
+    TInt previousLength = iAdditionalData?iAdditionalData->Length():0;
+        
+    HBufC8* newBuf = HBufC8::NewLC((count+2)*4+previousLength);
+    TPtr8 ptr = newBuf->Des();
+    RDesWriteStream strm(ptr);
+    CleanupClosePushL(strm);
+    strm.WriteInt32L(EAknListQueryItemsInfo);
+    strm.WriteInt32L(count);
+    for(TInt i = 0;i < count; i++)
+        {
+        strm.WriteInt32L(aIdArray[i]);
+        }
+
+    if (previousLength)
+        {
+        strm << *iAdditionalData;        
+        }
+        
+    strm.CommitL();
+    CleanupStack::PopAndDestroy(); // close stream
+    
+    CleanupStack::Pop(); // new buf
+    delete iAdditionalData;
+    iAdditionalData = newBuf;    
+    }
+    
+// End of file