mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp
changeset 2 7a9a8e73f54b
parent 0 a2952bb97e68
child 10 d240f0a77280
equal deleted inserted replaced
1:7f2202662322 2:7a9a8e73f54b
    80     iRemainder = 0;
    80     iRemainder = 0;
    81     iTotalChunkNumber = 0;
    81     iTotalChunkNumber = 0;
    82     iChunkNumber = 0;
    82     iChunkNumber = 0;
    83     iChunkSize = 0;
    83     iChunkSize = 0;
    84     iArrayIndex = 0;
    84     iArrayIndex = 0;
       
    85     iRefCount = 1;
       
    86 
    85     }
    87     }
    86 
    88 
    87 
    89 
    88 // ---------------------------------------------------------------------------
    90 // ---------------------------------------------------------------------------
    89 // Two-Phased Constructor
    91 // Two-Phased Constructor
   101 // Two-Phased Constructor
   103 // Two-Phased Constructor
   102 // ---------------------------------------------------------------------------
   104 // ---------------------------------------------------------------------------
   103 //
   105 //
   104 CMPXCollectionUiHelperImp* CMPXCollectionUiHelperImp::NewLC(const TUid& aModeId)
   106 CMPXCollectionUiHelperImp* CMPXCollectionUiHelperImp::NewLC(const TUid& aModeId)
   105     {
   107     {
   106     CMPXCollectionUiHelperImp* self = new( ELeave ) CMPXCollectionUiHelperImp();
   108 
   107     CleanupStack::PushL( self );
   109 	CMPXCollectionUiHelperImp* self(NULL);
   108     self->ConstructL(aModeId);
   110 
   109     return self;
   111     if ( aModeId == KMcModeDefault )
       
   112         {
       
   113     	self = reinterpret_cast<CMPXCollectionUiHelperImp*>(Dll::Tls());
       
   114     	if ( !self )
       
   115             {
       
   116             self = new( ELeave ) CMPXCollectionUiHelperImp();
       
   117             CleanupStack::PushL( self );
       
   118 			self->ConstructL(aModeId);
       
   119             Dll::SetTls( self );
       
   120             }
       
   121         else
       
   122             {
       
   123             self->iRefCount++;
       
   124             CleanupStack::PushL( self );
       
   125             }
       
   126 
       
   127 		return self;
       
   128         }
       
   129     else
       
   130 		{
       
   131 		self = new( ELeave ) CMPXCollectionUiHelperImp();
       
   132 		CleanupStack::PushL( self );
       
   133 		self->ConstructL(aModeId);
       
   134 		return self;
       
   135 		}
   110     }
   136     }
   111 
   137 
   112 // ---------------------------------------------------------------------------
   138 // ---------------------------------------------------------------------------
   113 // Virtual Destructor
   139 // Virtual Destructor
   114 // ---------------------------------------------------------------------------
   140 // ---------------------------------------------------------------------------
  1014 // Frees this object
  1040 // Frees this object
  1015 // ---------------------------------------------------------------------------
  1041 // ---------------------------------------------------------------------------
  1016 //
  1042 //
  1017 void CMPXCollectionUiHelperImp::Close()
  1043 void CMPXCollectionUiHelperImp::Close()
  1018     {
  1044     {
  1019     delete this;
  1045 
       
  1046     ASSERT( iRefCount > 0 );
       
  1047     if ( --iRefCount == 0 )
       
  1048         {
       
  1049         // last client released
       
  1050         CMPXCollectionUiHelperImp* s = reinterpret_cast<CMPXCollectionUiHelperImp*>( Dll::Tls() );
       
  1051         if ( s )
       
  1052             {
       
  1053             if ( s == this )
       
  1054                 {
       
  1055                 delete this;
       
  1056                 Dll::SetTls( NULL );
       
  1057                 }
       
  1058             }
       
  1059         }
  1020     }
  1060     }
  1021 
  1061 
  1022 // ---------------------------------------------------------------------------
  1062 // ---------------------------------------------------------------------------
  1023 // Test if the specified title already exists for the category
  1063 // Test if the specified title already exists for the category
  1024 // ---------------------------------------------------------------------------
  1064 // ---------------------------------------------------------------------------