clock/clockui/clockalarmeditor/src/clockalarmcustomitem.cpp
changeset 57 bb2d3e476f29
parent 55 2c54b51f39c4
equal deleted inserted replaced
55:2c54b51f39c4 57:bb2d3e476f29
    22 #include <HbAbstractItemView>
    22 #include <HbAbstractItemView>
    23 #include <HbDataFormModel>
    23 #include <HbDataFormModel>
    24 
    24 
    25 // User includes.
    25 // User includes.
    26 #include "clockalarmcustomitem.h"
    26 #include "clockalarmcustomitem.h"
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "clockalarmcustomitemTraces.h"
       
    30 #endif
       
    31 
    27 
    32 
    28 /*!
    33 /*!
    29 	\class ClockAlarmCustomItem
    34 	\class ClockAlarmCustomItem
    30 
    35 
    31 	This class is responsible for creating customitem for Alarm Time field in
    36 	This class is responsible for creating customitem for Alarm Time field in
    38 	\param parent The parent.
    43 	\param parent The parent.
    39  */
    44  */
    40 ClockAlarmCustomItem::ClockAlarmCustomItem(QGraphicsItem *parent)
    45 ClockAlarmCustomItem::ClockAlarmCustomItem(QGraphicsItem *parent)
    41 :HbDataFormViewItem(parent)
    46 :HbDataFormViewItem(parent)
    42 {
    47 {
       
    48 	OstTraceFunctionEntry0( CLOCKALARMCUSTOMITEM_CLOCKALARMCUSTOMITEM_ENTRY );
    43 	// Nothing yet.
    49 	// Nothing yet.
       
    50 	OstTraceFunctionExit0( CLOCKALARMCUSTOMITEM_CLOCKALARMCUSTOMITEM_EXIT );
    44 }
    51 }
    45 
    52 
    46 /*!
    53 /*!
    47 	Destructor.
    54 	Destructor.
    48  */
    55  */
    49 ClockAlarmCustomItem::~ClockAlarmCustomItem()
    56 ClockAlarmCustomItem::~ClockAlarmCustomItem()
    50 {
    57 {
       
    58 	OstTraceFunctionEntry0( DUP1_CLOCKALARMCUSTOMITEM_CLOCKALARMCUSTOMITEM_ENTRY );
    51 	// Nothing yet.
    59 	// Nothing yet.
       
    60 	OstTraceFunctionExit0( DUP1_CLOCKALARMCUSTOMITEM_CLOCKALARMCUSTOMITEM_EXIT );
    52 }
    61 }
    53 
    62 
    54 /*!
    63 /*!
    55 	Creates customitem.
    64 	Creates customitem.
    56 
    65 
    57 	\sa
    66 	\sa
    58  */
    67  */
    59 HbAbstractViewItem* ClockAlarmCustomItem::createItem()
    68 HbAbstractViewItem* ClockAlarmCustomItem::createItem()
    60 {
    69 {
       
    70 	OstTraceFunctionEntry0( CLOCKALARMCUSTOMITEM_CREATEITEM_ENTRY );
    61 	return new ClockAlarmCustomItem(*this);
    71 	return new ClockAlarmCustomItem(*this);
    62 }
    72 }
    63 
    73 
    64 /*!
    74 /*!
    65 	
    75 	
    66 	\sa
    76 	\sa
    67  */
    77  */
    68 bool ClockAlarmCustomItem::canSetModelIndex(const QModelIndex &index) const
    78 bool ClockAlarmCustomItem::canSetModelIndex(const QModelIndex &index) const
    69 {
    79 {
       
    80 	OstTraceFunctionEntry0( CLOCKALARMCUSTOMITEM_CANSETMODELINDEX_ENTRY );
    70 	HbDataFormModelItem::DataItemType itemType = 
    81 	HbDataFormModelItem::DataItemType itemType = 
    71 			static_cast<HbDataFormModelItem::DataItemType>(
    82 			static_cast<HbDataFormModelItem::DataItemType>(
    72 			index.data(HbDataFormModelItem::ItemTypeRole).toInt());
    83 			index.data(HbDataFormModelItem::ItemTypeRole).toInt());
    73 
    84 
    74 	if(itemType == (HbDataFormModelItem::CustomItemBase)) {
    85 	if(itemType == (HbDataFormModelItem::CustomItemBase)) {
       
    86 		OstTraceFunctionExit0( CLOCKALARMCUSTOMITEM_CANSETMODELINDEX_EXIT );
    75 		return true;
    87 		return true;
    76 	} else {
    88 	} else {
       
    89 		OstTraceFunctionExit0( DUP1_CLOCKALARMCUSTOMITEM_CANSETMODELINDEX_EXIT );
    77 		return false;
    90 		return false;
    78 	}
    91 	}
    79 
    92 
    80 }
    93 }
    81 
    94 
    82 void ClockAlarmCustomItem::restore()
    95 void ClockAlarmCustomItem::restore()
    83 {
    96 {
       
    97 	OstTraceFunctionEntry0( CLOCKALARMCUSTOMITEM_RESTORE_ENTRY );
    84 	HbDataFormModelItem::DataItemType itemType =
    98 	HbDataFormModelItem::DataItemType itemType =
    85 			static_cast<HbDataFormModelItem::DataItemType>(
    99 			static_cast<HbDataFormModelItem::DataItemType>(
    86 			modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
   100 			modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
    87 	if(itemType == (HbDataFormModelItem::CustomItemBase)) {
   101 	if(itemType == (HbDataFormModelItem::CustomItemBase)) {
    88 
   102 
    93 		mCustomButton->setProperty("text", modlItem->contentWidgetData("text"));
   107 		mCustomButton->setProperty("text", modlItem->contentWidgetData("text"));
    94 		mCustomButton->setProperty(
   108 		mCustomButton->setProperty(
    95 				"objectName", modlItem->contentWidgetData("objectName"));
   109 				"objectName", modlItem->contentWidgetData("objectName"));
    96 	}
   110 	}
    97 
   111 
       
   112 	OstTraceFunctionExit0( CLOCKALARMCUSTOMITEM_RESTORE_EXIT );
    98 }
   113 }
    99 
   114 
   100 /*!
   115 /*!
   101 	Creates the custom widget
   116 	Creates the custom widget
   102 
   117 
   103 	\sa
   118 	\sa
   104  */
   119  */
   105 HbWidget* ClockAlarmCustomItem::createCustomWidget()
   120 HbWidget* ClockAlarmCustomItem::createCustomWidget()
   106 {
   121 {
       
   122 	OstTraceFunctionEntry0( CLOCKALARMCUSTOMITEM_CREATECUSTOMWIDGET_ENTRY );
   107 	mCustomButton = new HbPushButton(this);
   123 	mCustomButton = new HbPushButton(this);
       
   124 	OstTraceFunctionExit0( CLOCKALARMCUSTOMITEM_CREATECUSTOMWIDGET_EXIT );
   108 	return mCustomButton;
   125 	return mCustomButton;
   109 }
   126 }
   110 
   127 
   111 // End of file	--Don't remove this.
   128 // End of file	--Don't remove this.