contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp
changeset 103 b99b84bcd2d1
parent 83 156f692b1687
child 104 9b022b1f357c
--- a/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp	Fri Jun 11 13:58:37 2010 +0300
+++ b/contentstorage/casrv/cawidgetscanner/src/cawidgetdescription.cpp	Wed Jun 23 18:33:40 2010 +0300
@@ -17,13 +17,12 @@
 
 
 // INCLUDE FILES
+#include <hbtextresolversymbian.h>
 
 #include "cadef.h"
 #include "cawidgetdescription.h"
 #include "cainnerentry.h"
 #include "widgetscannerutils.h"
-#include "hbtextresolversymbian.h"
-
 #include "cawidgetscannerdef.h"
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -34,7 +33,7 @@
 // -----------------------------------------------------------------------------
 //
 CCaWidgetDescription::CCaWidgetDescription() :
-    iEntryId(KNoId), iMmcId()
+    iEntryId( KNoId ), iValid ( EFalse )
     {
     }
 
@@ -65,13 +64,17 @@
         User::LeaveIfError( uidLex.Val( iPackageUid, EHex ));
         }
     iTitle.CreateL( aEntry->GetText() );
+    
     iIconUri.CreateL( aEntry->Icon()->FileName() );
+    
+    TPtrC attribute;
+    aEntry->FindAttribute( KPreviewImageAttrName, attribute );
+    iPreviewImageName.CreateL( attribute.Length() );
+    iPreviewImageName = attribute;
+    
     //library
     iLibrary.CreateL( KCaMaxAttrValueLen );
     aEntry->FindAttribute( KAttrWidgetLibrary, iLibrary );
-    //path
-    iPath.CreateL( KCaMaxAttrValueLen );
-    aEntry->FindAttribute( KAttrWidgetPath, iPath );
     //uri
     iUri.CreateL( KCaMaxAttrValueLen );
     aEntry->FindAttribute( KAttrWidgetUri, iUri );
@@ -131,18 +134,20 @@
 //
 CCaWidgetDescription::~CCaWidgetDescription()
     {
+
+    iModificationTime.Close();
+    iServiceXml.Close();
+    iMmcId.Close();
+    iUri.Close();
+    iLibrary.Close();
+    iPreviewImageName.Close();
+    iIconUri.Close();
     iTitle.Close();
     iDescription.Close();
-    iUri.Close();
-    iIconUri.Close();
-    iLibrary.Close();
-    iPath.Close();
-    iModificationTime.Close();
-    iMmcId.Close();
-    iServiceXml.Close();
-    iManifestFilePathName.Close();
     iStringIdTitle.Close();
     iStringIdDescription.Close();
+    iManifestFilePathName.Close();
+    
     }
 
 // ----------------------------------------------------------------------------
@@ -152,14 +157,16 @@
 TBool CCaWidgetDescription::Compare(
         const CCaWidgetDescription& aFirst,const CCaWidgetDescription& aSecond)
     {
+    TBool result = EFalse;
     if( aFirst.GetUri() == aSecond.GetUri() )
         {
-        return ETrue;
+        result = ETrue;
         }
     else
         {
-        return EFalse;
+        result = EFalse;
         }
+    return result;
     }
 
 // ----------------------------------------------------------------------------
@@ -168,24 +175,28 @@
 //
 TBool CCaWidgetDescription::Compare( const CCaWidgetDescription& aToCompare )
     {
+    TBool result = EFalse;
     if( aToCompare.GetLibrary() == GetLibrary() &&
             aToCompare.GetDescription() == GetDescription() &&
             aToCompare.GetUri() == GetUri() &&
             aToCompare.GetIconUri() == GetIconUri() &&
+            aToCompare.GetPreviewImageName() == GetPreviewImageName() &&
             aToCompare.GetTitle() == GetTitle() &&
             aToCompare.GetLibrary() != KNoLibrary &&
             aToCompare.GetModificationTime() == GetModificationTime() &&
             aToCompare.GetServiceXml() == GetServiceXml()
             )
         {
-        return ETrue;
+        result = ETrue;
         }
     else
         {
-        return EFalse;
+        result = EFalse;
         }
+    return result;
     }
 
+
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -210,6 +221,15 @@
 //
 // -----------------------------------------------------------------------------
 //
+TUint CCaWidgetDescription::GetPackageUidL()
+    {
+    return iPackageUid;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void CCaWidgetDescription::SetTitleL( const TDesC& aTitle )
     {
     iTitle.Close();
@@ -248,37 +268,19 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CCaWidgetDescription::SetLibraryL( const TDesC& aLibrary )
+void CCaWidgetDescription::SetPreviewImageNameL( const TDesC& aPreviewName )
     {
-    iLibrary.Close();
-    iLibrary.CreateL(aLibrary);
+    iPreviewImageName.Close();
+    iPreviewImageName.CreateL( aPreviewName );
     }
-
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 //
-void CCaWidgetDescription::SetMissing( TBool aMissing )
-    {
-    SetFlag( EMissing, aMissing );
-    }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CCaWidgetDescription::SetVisible( TBool aVisible )
+void CCaWidgetDescription::SetLibraryL( const TDesC& aLibrary )
     {
-    SetFlag( EVisible, aVisible );
-    }
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CCaWidgetDescription::SetUsed( TBool aUsed )
-    {
-    SetFlag( EUsed, aUsed );
+    iLibrary.Close();
+    iLibrary.CreateL(aLibrary);
     }
 
 // -----------------------------------------------------------------------------
@@ -375,23 +377,6 @@
 //
 // -----------------------------------------------------------------------------
 //
-TPtrC CCaWidgetDescription::GetPath( ) const
-    {
-    return iPath;
-    }
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void CCaWidgetDescription::SetPathL( const TDesC& aPath )
-    {
-	iPath.Close();
-	iPath.CreateL(aPath);
-    }
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
 TPtrC CCaWidgetDescription::GetDescription( ) const
     {
     return iDescription;
@@ -419,16 +404,27 @@
 //
 // -----------------------------------------------------------------------------
 //
+TPtrC CCaWidgetDescription::GetPreviewImageName( ) const
+    {
+    return iPreviewImageName;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 TPtrC CCaWidgetDescription::GetTitle( ) const
     {
+    TPtrC result ;
     if ( iTitle == KNullDesC )
         {
-        return GetLibraryName();
+        result.Set( GetLibraryName() );
         }
     else
         {
-        return iTitle;
+        result.Set( iTitle );
         }
+    return result;
     }
 
 // -----------------------------------------------------------------------------
@@ -504,20 +500,14 @@
             entry->SetFlags( entry->GetFlags() & ~ERemovable );
             }
         }
-    if ( iPath != KNullDesC )
-        {
-        entry->AddAttributeL(KAttrWidgetPath, iPath);
-        }
     if ( iTitle != KNullDesC )
         {
         entry->SetTextL(iTitle);
-        entry->AddAttributeL(KCaAttrLongName, iTitle);
         }
     else
         {
         TPtrC libraryName( GetLibraryName() );
         entry->SetTextL( libraryName );
-        entry->AddAttributeL( KCaAttrLongName, libraryName );
         }
 
     if ( iDescription != KNullDesC )
@@ -531,9 +521,12 @@
     if ( iIconUri != KNullDesC)
         {
         // aSkinId and AppId not used for widgets - KNullDesC
-        entry->SetIconDataL(iIconUri, KNullDesC, KNullDesC);
+        entry->SetIconDataL( iIconUri, KNullDesC, KNullDesC );
         }
-
+    if ( iPreviewImageName != KNullDesC )
+        {
+        entry->AddAttributeL( KPreviewImageAttrName, iPreviewImageName );
+        }
     if( iModificationTime != KNullDesC )
         {
         entry->AddAttributeL( KCaAttrInstallationTime, iModificationTime );
@@ -591,6 +584,10 @@
     return iServiceXml;
     }
 
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void CCaWidgetDescription::LocalizeTextsL()
 	{
     
@@ -659,10 +656,28 @@
 		}
 	}
 
-/*
- * Set manifest file path name
- * @param aManifestFilePt
- */
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+// 
+TBool CCaWidgetDescription::IsValid()
+    {
+    return iValid;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CCaWidgetDescription::SetValid(TBool aVal)
+    {
+    iValid = aVal;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 void CCaWidgetDescription::SetManifestFilePathNameL( 
     const TDesC& aManifestFilePathName )
     {
@@ -670,10 +685,10 @@
     iManifestFilePathName.CreateL( aManifestFilePathName );
     }
 
-/*
- * Get service fw xml filename
- * @return Service xml filename
- */
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 TPtrC CCaWidgetDescription::GetManifestFilePathName() const
     {
     return iManifestFilePathName;