calendarui/agendaeventviewer/src/agendaeventvieweritem.cpp
changeset 45 b6db4fd4947b
parent 18 c198609911f9
child 55 2c54b51f39c4
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
    38 
    38 
    39  \param parent Pointer to QGraphicsItem.
    39  \param parent Pointer to QGraphicsItem.
    40  */
    40  */
    41 AgendaEventViewerItem::AgendaEventViewerItem(QGraphicsItem *parent) :
    41 AgendaEventViewerItem::AgendaEventViewerItem(QGraphicsItem *parent) :
    42 	HbWidget(parent), mPrimaryText(NULL), mSecondaryText(NULL),
    42 	HbWidget(parent), mPrimaryText(NULL), mSecondaryText(NULL),
    43 	        mPrimaryIcon(NULL), mSecondaryIcon(NULL)
    43 	        mPrimaryIcon(NULL), mSecondaryIcon(NULL),mPrimaryRightIcon(NULL),
       
    44 	        mPrimaryLeftIcon(NULL)
    44 {
    45 {
    45 
    46 
    46 	// Path for widgetml and css files.
    47 	// Path for widgetml and css files.
    47 	HbStyleLoader::registerFilePath(":/");
    48 	HbStyleLoader::registerFilePath(":/");
    48 
    49 
    68                                                    int role)
    69                                                    int role)
    69 {
    70 {
    70 	if (!itemData.isEmpty()) {
    71 	if (!itemData.isEmpty()) {
    71 		QString firstItemData(QString::null);
    72 		QString firstItemData(QString::null);
    72 		QString secondItemData(QString::null);
    73 		QString secondItemData(QString::null);
    73 
    74 		QString thirdItemData(QString::null);
    74 		if (itemData.count() == 2) {
    75         if (itemData.count() == 2) {
       
    76             firstItemData = itemData.at(0);
       
    77             secondItemData = itemData.at(1);
       
    78         }
       
    79         else if (itemData.count() == 3) {
    75 			firstItemData = itemData.at(0);
    80 			firstItemData = itemData.at(0);
    76 			secondItemData = itemData.at(1);
    81 			secondItemData = itemData.at(1);
       
    82 			thirdItemData = itemData.at(2);
    77 		} else {
    83 		} else {
    78 			firstItemData = itemData.at(0);
    84 			firstItemData = itemData.at(0);
    79 		}
    85 		}
    80 
    86 
    81 		if (role == Qt::DisplayRole) {
    87 		if (role == Qt::DisplayRole) {
   105 			} else {
   111 			} else {
   106 				mSecondaryText->setText("");
   112 				mSecondaryText->setText("");
   107 				}
   113 				}
   108 		} else {
   114 		} else {
   109 			if (role == Qt::DecorationRole) {
   115 			if (role == Qt::DecorationRole) {
   110 				if (!firstItemData.isEmpty()) {
   116                if (!firstItemData.isEmpty()) {
   111 					if (!mPrimaryIcon) {
   117                    if (!mPrimaryLeftIcon) {
   112 						mPrimaryIcon = new HbIconItem(this);
   118                    mPrimaryLeftIcon = new HbIconItem(this);
       
   119                    }
       
   120                    HbStyle::setItemName(mPrimaryLeftIcon, "primaryLeftIconItem");
       
   121                    mPrimaryLeftIcon->setVisible(true);
       
   122                    mPrimaryLeftIcon->setIconName(firstItemData);
       
   123 
       
   124                } else {
       
   125                    if (mPrimaryLeftIcon) {
       
   126                        HbStyle::setItemName(mPrimaryLeftIcon,"");
       
   127                        mPrimaryLeftIcon->setVisible(false); 
       
   128                    }
       
   129                    
       
   130                }
       
   131 				if (!secondItemData.isEmpty()) {
       
   132 					if (!mPrimaryRightIcon) {
       
   133 					mPrimaryRightIcon = new HbIconItem(this);
   113 					}
   134 					}
   114 					HbStyle::setItemName(mPrimaryIcon, "primaryIconItem");
   135 					HbStyle::setItemName(mPrimaryRightIcon, "primaryRightIconItem");
   115 					mPrimaryIcon->setVisible(true);
   136 					mPrimaryRightIcon->setVisible(true);
   116 					mPrimaryIcon->setIconName(firstItemData);
   137 					mPrimaryRightIcon->setIconName(secondItemData);
   117 
   138 
   118 				} else {
   139 				} else {
   119 					if (mPrimaryIcon) {
   140 					if (mPrimaryRightIcon) {
   120 						HbStyle::setItemName(mPrimaryIcon,"");
   141 						HbStyle::setItemName(mPrimaryRightIcon,"");
   121 						mPrimaryIcon->setVisible(false); 
   142 						mPrimaryRightIcon->setVisible(false); 
   122 					}
   143 					}
   123 					
   144 					
   124 				}
   145 				}
   125 				if (!secondItemData.isEmpty()) {
   146 				if (!thirdItemData.isEmpty()) {
   126 					if (!mSecondaryIcon) {
   147 					if (!mSecondaryIcon) {
   127 						mSecondaryIcon = new HbIconItem(this);
   148 						mSecondaryIcon = new HbIconItem(this);
   128 						HbStyle::setItemName(mSecondaryIcon, 
   149 						HbStyle::setItemName(mSecondaryIcon, 
   129 						                     "secondaryIconItem");
   150 						                     "secondaryIconItem");
   130 					}
   151 					}
   131 					mSecondaryIcon->setIconName(secondItemData);
   152 					mSecondaryIcon->setIconName(thirdItemData);
   132 
   153 
   133 				} else {
   154 				} else {
   134 					if (mSecondaryIcon) {
   155 					if (mSecondaryIcon) {
   135 						delete mSecondaryIcon;
   156 						delete mSecondaryIcon;
   136 						mSecondaryIcon = NULL;
   157 						mSecondaryIcon = NULL;