contentstorage/cautils/src/cainnerentry.cpp
changeset 66 32469d7d46ff
parent 61 8e5041d13c84
child 98 d2f833ab7940
equal deleted inserted replaced
61:8e5041d13c84 66:32469d7d46ff
    28     {
    28     {
    29     iText.Close();
    29     iText.Close();
    30     iDescription.Close();
    30     iDescription.Close();
    31     iEntryTypeName.Close();
    31     iEntryTypeName.Close();
    32     iAttributes.ResetAndDestroy();
    32     iAttributes.ResetAndDestroy();
       
    33     delete iIcon;
    33     }
    34     }
    34 
    35 
    35 // ---------------------------------------------------------------------------
    36 // ---------------------------------------------------------------------------
    36 //
    37 //
    37 // ---------------------------------------------------------------------------
    38 // ---------------------------------------------------------------------------
    61 //
    62 //
    62 EXPORT_C void CCaInnerEntry::ExternalizeL( RWriteStream& aStream ) const
    63 EXPORT_C void CCaInnerEntry::ExternalizeL( RWriteStream& aStream ) const
    63     {
    64     {
    64     aStream.WriteInt32L( iId );
    65     aStream.WriteInt32L( iId );
    65     aStream.WriteInt32L( iUid );
    66     aStream.WriteInt32L( iUid );
    66     aStream.WriteInt32L( iIcon.iId );
       
    67     aStream.WriteUint32L( iIcon.iFileName.Length() );
       
    68     aStream.WriteL( iIcon.iFileName, iIcon.iFileName.Length() );
       
    69     aStream.WriteUint32L( iIcon.iSkinId.Length() );
       
    70     aStream.WriteL( iIcon.iSkinId, iIcon.iSkinId.Length() );
       
    71     aStream.WriteUint32L( iIcon.iApplicationId.Length() );
       
    72     aStream.WriteL( iIcon.iApplicationId, iIcon.iApplicationId.Length() );
       
    73     aStream.WriteUint32L( iFlags );
    67     aStream.WriteUint32L( iFlags );
    74     aStream.WriteUint32L( iRole );
    68     aStream.WriteUint32L( iRole );
    75     aStream.WriteUint32L( iText.Length() );
    69     aStream.WriteUint32L( iText.Length() );
    76     aStream.WriteL( iText, iText.Length() );
    70     aStream.WriteL( iText, iText.Length() );
    77     aStream.WriteUint32L( iDescription.Length() );
    71     aStream.WriteUint32L( iDescription.Length() );
    78     aStream.WriteL( iDescription, iDescription.Length() );
    72     aStream.WriteL( iDescription, iDescription.Length() );
    79     aStream.WriteUint32L( iEntryTypeName.Length() );
    73     aStream.WriteUint32L( iEntryTypeName.Length() );
    80     aStream.WriteL( iEntryTypeName, iEntryTypeName.Length() );
    74     aStream.WriteL( iEntryTypeName, iEntryTypeName.Length() );
    81     iAttributes.ExternalizeL( aStream );
    75     iAttributes.ExternalizeL( aStream );
       
    76     iIcon->ExternalizeL( aStream );
    82     aStream.CommitL();
    77     aStream.CommitL();
    83     }
    78     }
    84 
    79 
    85 // ---------------------------------------------------------------------------
    80 // ---------------------------------------------------------------------------
    86 //
    81 //
    88 //
    83 //
    89 EXPORT_C void CCaInnerEntry::InternalizeL( RReadStream& aStream )
    84 EXPORT_C void CCaInnerEntry::InternalizeL( RReadStream& aStream )
    90     {
    85     {
    91     iId = aStream.ReadInt32L();
    86     iId = aStream.ReadInt32L();
    92     iUid = aStream.ReadInt32L();
    87     iUid = aStream.ReadInt32L();
    93     iIcon.iId = aStream.ReadInt32L();
       
    94     TUint length = aStream.ReadUint32L();
       
    95     aStream.ReadL( iIcon.iFileName, length );
       
    96     length = aStream.ReadUint32L();
       
    97     aStream.ReadL( iIcon.iSkinId, length );
       
    98     length = aStream.ReadUint32L();
       
    99     aStream.ReadL( iIcon.iApplicationId, length );
       
   100     iFlags = aStream.ReadUint32L();
    88     iFlags = aStream.ReadUint32L();
   101     iRole = aStream.ReadUint32L();
    89     iRole = aStream.ReadUint32L();
   102     length = aStream.ReadUint32L();
    90     TUint length = aStream.ReadUint32L();
   103     iText.Close();
    91     iText.Close();
   104     iText.CreateL( length );
    92     iText.CreateL( length );
   105     aStream.ReadL( iText, length );
    93     aStream.ReadL( iText, length );
   106     length = aStream.ReadUint32L();
    94     length = aStream.ReadUint32L();
   107     iDescription.Close( );
    95     iDescription.Close( );
   110     length = aStream.ReadUint32L( );
    98     length = aStream.ReadUint32L( );
   111     iEntryTypeName.Close();
    99     iEntryTypeName.Close();
   112     iEntryTypeName.CreateL( length );
   100     iEntryTypeName.CreateL( length );
   113     aStream.ReadL( iEntryTypeName, length );
   101     aStream.ReadL( iEntryTypeName, length );
   114     iAttributes.InternalizeL( aStream );
   102     iAttributes.InternalizeL( aStream );
       
   103     iIcon->InternalizeL( aStream );
   115     }
   104     }
   116 
   105 
   117 // ---------------------------------------------------------------------------
   106 // ---------------------------------------------------------------------------
   118 //
   107 //
   119 // ---------------------------------------------------------------------------
   108 // ---------------------------------------------------------------------------
   120 //
   109 //
   121 void CCaInnerEntry::ConstructL()
   110 void CCaInnerEntry::ConstructL()
   122     {
   111     {
   123 
   112     iIcon = CCaInnerIconDescription::NewL();
   124     }
   113     }
   125 
   114 
   126 // ---------------------------------------------------------------------------
   115 // ---------------------------------------------------------------------------
   127 //
   116 //
   128 // ---------------------------------------------------------------------------
   117 // ---------------------------------------------------------------------------
   129 //
   118 //
   130 CCaInnerEntry::CCaInnerEntry()
   119 CCaInnerEntry::CCaInnerEntry()
   131     {
   120     {
   132 
       
   133     }
   121     }
   134 
   122 
   135 // ---------------------------------------------------------------------------
   123 // ---------------------------------------------------------------------------
   136 //
   124 //
   137 // ---------------------------------------------------------------------------
   125 // ---------------------------------------------------------------------------
   170 
   158 
   171 // ---------------------------------------------------------------------------
   159 // ---------------------------------------------------------------------------
   172 //
   160 //
   173 // ---------------------------------------------------------------------------
   161 // ---------------------------------------------------------------------------
   174 //
   162 //
   175 EXPORT_C const CCaInnerEntry::TIconAttributes& CCaInnerEntry::GetIcon() const
   163 EXPORT_C const CCaInnerIconDescription* CCaInnerEntry::Icon() const
   176     {
   164     {
   177     return iIcon;
   165     return iIcon;
   178     }
   166     }
   179 
   167 
   180 // ---------------------------------------------------------------------------
   168 // ---------------------------------------------------------------------------
   217 //
   205 //
   218 // ---------------------------------------------------------------------------
   206 // ---------------------------------------------------------------------------
   219 //
   207 //
   220 EXPORT_C TInt CCaInnerEntry::GetIconId() const
   208 EXPORT_C TInt CCaInnerEntry::GetIconId() const
   221     {
   209     {
   222     return iIcon.iId;
   210     return iIcon->Id();
   223     }
   211     }
   224 //    SETTERS
   212 //    SETTERS
   225 
   213 
   226 // ---------------------------------------------------------------------------
   214 // ---------------------------------------------------------------------------
   227 //
   215 //
   267 // ---------------------------------------------------------------------------
   255 // ---------------------------------------------------------------------------
   268 //
   256 //
   269 EXPORT_C void CCaInnerEntry::SetIconDataL(
   257 EXPORT_C void CCaInnerEntry::SetIconDataL(
   270         const TDesC& aFilename, const TDesC& aSkinId, const TDesC& aApplicationId )
   258         const TDesC& aFilename, const TDesC& aSkinId, const TDesC& aApplicationId )
   271     {
   259     {
   272     iIcon.iFileName.Copy( aFilename );
   260     iIcon->SetFileNameL( aFilename );
   273     iIcon.iSkinId.Copy( aSkinId );
   261     iIcon->SetSkinIdL( aSkinId );
   274     iIcon.iApplicationId.Copy(aApplicationId);
   262     iIcon->SetApplicationIdL( aApplicationId );
   275     }
   263     }
   276 
   264 
   277 // ---------------------------------------------------------------------------
   265 // ---------------------------------------------------------------------------
   278 //
   266 //
   279 // ---------------------------------------------------------------------------
   267 // ---------------------------------------------------------------------------
   331 
   319 
   332 // ---------------------------------------------------------------------------
   320 // ---------------------------------------------------------------------------
   333 //
   321 //
   334 // ---------------------------------------------------------------------------
   322 // ---------------------------------------------------------------------------
   335 //
   323 //
       
   324 EXPORT_C TBool CCaInnerEntry::FindAttribute( const TDesC& aKey,
       
   325         TPtrC& aAttrVal )
       
   326     {
       
   327     return iAttributes.Find( aKey, aAttrVal );
       
   328     }
       
   329 
       
   330 // ---------------------------------------------------------------------------
       
   331 //
       
   332 // ---------------------------------------------------------------------------
       
   333 //
   336 EXPORT_C void CCaInnerEntry::SetUid( TInt32 aUid )
   334 EXPORT_C void CCaInnerEntry::SetUid( TInt32 aUid )
   337     {
   335     {
   338     iUid = aUid;
   336     iUid = aUid;
   339     }
   337     }
   340 
   338 
   342 //
   340 //
   343 // ---------------------------------------------------------------------------
   341 // ---------------------------------------------------------------------------
   344 //
   342 //
   345 EXPORT_C void CCaInnerEntry::SetIconId( TInt aIconId )
   343 EXPORT_C void CCaInnerEntry::SetIconId( TInt aIconId )
   346     {
   344     {
   347     iIcon.iId = aIconId;
   345     iIcon->SetId( aIconId );
   348     }
   346     }