taskswitcher/server/src/tsmodelitem.cpp
changeset 127 7b66bc3c6dc9
parent 119 50e220be30d1
--- a/taskswitcher/server/src/tsmodelitem.cpp	Wed Oct 13 12:59:22 2010 +0300
+++ b/taskswitcher/server/src/tsmodelitem.cpp	Mon Oct 18 10:44:15 2010 +0300
@@ -15,6 +15,7 @@
 *
 */
 #include "tsmodel.h"
+#include "tsentryimp.h"
 // -----------------------------------------------------------------------------
 /**
  * Constructor
@@ -48,10 +49,9 @@
  * Validate item instance and retrieve display name data
  * @return item display name
  */
-const TDesC& TTsModelItem::DisplayNameL() const
+const TDesC& TTsModelItem::DisplayName() const
     {
-    ValidateL();
-    return iModel.DisplayNameL( iIndex );
+    return iModel.DisplayName( iIndex );
     }
 
 // -----------------------------------------------------------------------------
@@ -59,10 +59,9 @@
  * Validate item instance and retrieve icon handle ( CFbsBitmap handle )
  * @return item icon handle
  */
-TInt TTsModelItem::IconHandleL() const
+TInt TTsModelItem::IconHandle() const
     {
-    ValidateL();
-    return iModel.IconHandleL( iIndex );
+    return iModel.IconHandle( iIndex );
     }
 
 // -----------------------------------------------------------------------------
@@ -70,10 +69,9 @@
  * Validate item instance and retrieve entry key
  * @return item key
  */
-TTsModelItemKey TTsModelItem::KeyL() const
+TTsEntryKey TTsModelItem::Key() const
     {
-    ValidateL();
-    return iModel.KeyL( iIndex );
+    return iModel.Key( iIndex );
     }
 
 // -----------------------------------------------------------------------------
@@ -81,10 +79,9 @@
  * Validate item instance and retrieve entry timestamp
  * @return item timestamp
  */
-TTime TTsModelItem::TimestampL() const
+TTime TTsModelItem::Timestamp() const
     {
-    ValidateL();
-    return iModel.TimestampL( iIndex );
+    return iModel.Timestamp( iIndex );
     }
 
 // -----------------------------------------------------------------------------
@@ -93,21 +90,19 @@
  * with latest update time
  * @return item timestamp
  */
-TTime TTsModelItem::TimestampUpdateL() const 
-{
-    ValidateL();
-    return iModel.TimestampUpdateL(iIndex);
-}
+TTime TTsModelItem::TimestampUpdate() const 
+    {
+    return iModel.TimestampUpdate(iIndex);
+    }
 
 // -----------------------------------------------------------------------------
 /**
  * Validate item instance and retrieve activity status 
  * @return activity status
  */
-TBool TTsModelItem::IsActiveL() const
+TBool TTsModelItem::IsActive() const
     {
-    ValidateL();
-    return iModel.IsActiveL( iIndex );
+    return iModel.IsActive( iIndex );
     }
 
 // -----------------------------------------------------------------------------
@@ -115,10 +110,9 @@
  * Validate item instance and retrieve closable status 
  * @return closable status
  */
-TBool TTsModelItem::IsClosableL() const
+TBool TTsModelItem::IsClosable() const
     {
-    ValidateL();
-    return iModel.IsClosableL( iIndex );
+    return iModel.IsClosable( iIndex );
     }
 
 // -----------------------------------------------------------------------------
@@ -126,10 +120,9 @@
  * Validate item instance and forward close request to its owner 
  * @return EFalse on failure
  */
-TBool TTsModelItem::CloseL() const
+TBool TTsModelItem::Close() const
     {
-    ValidateL();
-    return iModel.CloseL( KeyL() );
+    return iModel.Close( Key() );
     }
 
 // -----------------------------------------------------------------------------
@@ -137,32 +130,27 @@
  * Validate item instance and forward launch request to its owner 
  * @return EFalse on failure
  */
-TBool TTsModelItem::LaunchL() const
+TBool TTsModelItem::Launch() const
     {
-    ValidateL();
-    return iModel.LaunchL( KeyL() );
+    return iModel.Launch( Key() );
     }
 
 // -----------------------------------------------------------------------------
 /**
  * @return EFalse if entry is not mandatory, other value in other cases  
  */
-TBool TTsModelItem::IsMandatoryL() const
+TBool TTsModelItem::IsMandatory() const
     {
-    ValidateL();
-    return iModel.IsMandatoryL( iIndex );
+    return iModel.IsMandatory( iIndex );
     }
 
 // -----------------------------------------------------------------------------
 /**
  * Validate item instance 
  */
-void TTsModelItem::ValidateL() const
+TBool TTsModelItem::IsValid() const
     {
-    if(iModel.Count() <= iIndex )
-        {
-        User::Leave( KErrOverflow );
-        }
+    return iModel.Count() > iIndex;
     }
 
 // -----------------------------------------------------------------------------
@@ -173,17 +161,6 @@
 
 void TTsModelItem::ExternalizeL( RWriteStream& aStream ) const
     {
-    aStream.WriteInt32L( DisplayNameL().Length() );
-    if( 0 < DisplayNameL().Length() )
-        {
-        aStream << DisplayNameL();
-        }
-    TPckgBuf<TTime> timestamp(TimestampUpdateL()); 
-    aStream.WriteL(timestamp);
-    aStream.WriteInt32L( IconHandleL() );
-    aStream.WriteInt32L( TTsModelItemKey::Size() );
-    aStream << KeyL();
-    aStream.WriteInt32L( IsActiveL() );
-    aStream.WriteInt32L( IsClosableL() );
+    CTsEntryImp::ExternalizeL(aStream, *this);
     }