ui/views/detailsview/src/glxdetailscustomwidgets.cpp
changeset 52 a3a4c0de738e
parent 50 a0f57508af73
child 54 0f0f3f26f787
equal deleted inserted replaced
50:a0f57508af73 52:a3a4c0de738e
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 #include "glxdetailscustomwidgets.h"
       
    19 #include <hbdataform.h>
       
    20 #include <hbdataformmodelitem.h> 
       
    21 #include <hbdataformmodel.h> 
       
    22 #include <hbdataformviewitem.h>
       
    23 
       
    24 #include <hblineedit.h>
       
    25 #include <hblabel.h>
       
    26 //#include "hbsettingformitem_p.h"
       
    27 #include <hbpushbutton.h>
       
    28 #include <hbiconitem.h>
       
    29 #include <QDir>
       
    30 #include <QGraphicsLinearLayout>
       
    31 
       
    32 GlxDetailsCustomWidgets::GlxDetailsCustomWidgets(QGraphicsItem *parent):
       
    33 HbDataFormViewItem(parent)
       
    34      {
       
    35      }
       
    36 
       
    37 GlxDetailsCustomWidgets::~GlxDetailsCustomWidgets()
       
    38     {
       
    39     }
       
    40 
       
    41 HbAbstractViewItem* GlxDetailsCustomWidgets::createItem()
       
    42     {
       
    43     return new GlxDetailsCustomWidgets(*this);
       
    44     }
       
    45 
       
    46 HbWidget* GlxDetailsCustomWidgets::createCustomWidget()
       
    47     {
       
    48     qDebug("GlxDetailsCustomWidgets::createCustomWidget");
       
    49     HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>(
       
    50             modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());
       
    51     switch(itemType)
       
    52         {
       
    53         
       
    54 		case DateLabelItem :
       
    55             {
       
    56             qDebug("GlxDetailsCustomWidgets::createCustomWidget:DateLabelItem");
       
    57             HbLabel *dateLabel = new HbLabel();
       
    58             return dateLabel;
       
    59             }
       
    60         
       
    61 
       
    62 
       
    63         default:
       
    64             return 0;
       
    65 
       
    66         }
       
    67     }
       
    68 
       
    69 bool GlxDetailsCustomWidgets::canSetModelIndex(const QModelIndex &index) const
       
    70 {
       
    71     HbDataFormModelItem::DataItemType itemType =
       
    72     static_cast<HbDataFormModelItem::DataItemType>(
       
    73             index.data(HbDataFormModelItem::ItemTypeRole).toInt());
       
    74 
       
    75     if(itemType >= ImageNameItem && 
       
    76             itemType <= CommentsItem )
       
    77         {
       
    78         return true;
       
    79         }
       
    80     return false;
       
    81 }
       
    82 
       
    83 //EOF