idlehomescreen/widgetmanager/src/wmpersistentwidgetorder.cpp
branchRCL_3
changeset 9 f966699dea19
parent 1 5315654608de
child 15 ff572dfe6d86
equal deleted inserted replaced
5:c743ef5928ba 9:f966699dea19
   110 void CWmPersistentWidgetOrder::StoreL( const RWidgetDataValues& aArray )
   110 void CWmPersistentWidgetOrder::StoreL( const RWidgetDataValues& aArray )
   111     {
   111     {
   112     // 1. create stream for storing the data to a file
   112     // 1. create stream for storing the data to a file
   113     TFileName storeFileName;
   113     TFileName storeFileName;
   114     GetStoreFileNameL( storeFileName );
   114     GetStoreFileNameL( storeFileName );
   115     CPermanentFileStore* fileStore = CPermanentFileStore::ReplaceLC(
   115     CPermanentFileStore* fileStore = NULL;
       
   116     fileStore = CPermanentFileStore::ReplaceLC(
   116             iFs, storeFileName, EFileWrite );
   117             iFs, storeFileName, EFileWrite );
   117     fileStore->SetTypeL( KPermanentFileStoreLayoutUid );
   118     fileStore->SetTypeL( KPermanentFileStoreLayoutUid );
   118     RStoreWriteStream writer;
   119     RStoreWriteStream writer;
   119     TStreamId id = writer.CreateLC( *fileStore );
   120     TStreamId id = writer.CreateLC( *fileStore );
   120     // 2. write all content to the stream
   121     // 2. write all content to the stream
   121     writer.WriteInt32L( aArray.Count() );
   122     writer.WriteInt32L( aArray.Count() );
   122     for( TInt i=0; i<aArray.Count(); ++i )
   123     for( TInt i=0; i<aArray.Count(); ++i )
   123         {
   124         {
   124         TInt32 uid = aArray[i]->Uid().iUid;
   125         CWmWidgetData* data = aArray[i];
   125         const TDesC16& publisherId = aArray[i]->HsContentInfo().PublisherId();
   126         if ( !data || !data->IsValid() )
       
   127             {
       
   128             User::Leave( KErrArgument ); 
       
   129             }
       
   130         TInt32 uid = data->Uid().iUid;
       
   131         const TDesC16& publisherId = data->HsContentInfo().PublisherId();
   126         writer.WriteInt32L( uid );
   132         writer.WriteInt32L( uid );
   127         writer.WriteInt32L( publisherId.Length() );
   133         writer.WriteInt32L( publisherId.Length() );
   128         writer.WriteL( publisherId, publisherId.Length() );
   134         writer.WriteL( publisherId, publisherId.Length() );
   129         }
   135         }
   130     // 3. check available space and commit the stream
   136     // 3. check available space and commit the stream