ui/views/detailsview/src/glxdetailsview.cpp
changeset 24 99ad1390cd33
parent 23 74c9f037fd5d
child 26 c499df2dbb33
equal deleted inserted replaced
23:74c9f037fd5d 24:99ad1390cd33
    16 */
    16 */
    17 
    17 
    18 //--------------------------------------------------------------------------------------------------------------------------------------------
    18 //--------------------------------------------------------------------------------------------------------------------------------------------
    19 
    19 
    20 #include <QModelIndex>
    20 #include <QModelIndex>
    21 #include <QtDebug>
       
    22 #include <qdatetime.h>
    21 #include <qdatetime.h>
    23 
    22 
    24 //--------------------------------------------------------------------------------------------------------------------------------------------
    23 //--------------------------------------------------------------------------------------------------------------------------------------------
    25 
    24 
    26 #include <hbdataform.h>
    25 #include <hbdataform.h>
    39 #include "glxmodelparm.h"
    38 #include "glxmodelparm.h"
    40 #include "glxdetailscustomwidgets.h"
    39 #include "glxdetailscustomwidgets.h"
    41 #include "glxviewids.h"
    40 #include "glxviewids.h"
    42 #include <glxcommandhandlers.hrh>
    41 #include <glxcommandhandlers.hrh>
    43 
    42 
       
    43 #include "OstTraceDefinitions.h"
       
    44 #ifdef OST_TRACE_COMPILER_IN_USE
       
    45 #include "glxdetailsviewTraces.h"
       
    46 #endif
    44 
    47 
    45 
    48 
    46 //--------------------------------------------------------------------------------------------------------------------------------------------
    49 //--------------------------------------------------------------------------------------------------------------------------------------------
    47 //GlxDetailsView
    50 //GlxDetailsView
    48 //--------------------------------------------------------------------------------------------------------------------------------------------
    51 //--------------------------------------------------------------------------------------------------------------------------------------------
    49 GlxDetailsView::GlxDetailsView(HbMainWindow *window) :  GlxView ( GLX_DETAILSVIEW_ID),
    52 GlxDetailsView::GlxDetailsView(HbMainWindow *window) :  GlxView ( GLX_DETAILSVIEW_ID),
    50     mDetailsPixmap(NULL), 
    53     mDetailsIcon(NULL), 
    51     mBlackBackgroundItem(NULL), 
       
    52     mModel(NULL), 
    54     mModel(NULL), 
    53     mWindow(window), 
    55     mWindow(window), 
    54     mDataForm(NULL), 
    56     mDataForm(NULL), 
    55     mDetailModel(NULL),
    57     mDetailModel(NULL),
    56     mCustomPrototype(NULL),
    58     mCustomPrototype(NULL),
    57     mSelIndex (0)
    59     mSelIndex (0)
    58 {
    60     {
    59     qDebug("@@@GlxDetailsView::GlxDetailsView constructor Enter");
    61     OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY );
       
    62     
    60     setContentFullScreen( true );//for smooth transtion between grid to full screen and vice versa
    63     setContentFullScreen( true );//for smooth transtion between grid to full screen and vice versa
    61 }
    64     OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT );
       
    65     }
    62 
    66 
    63 //--------------------------------------------------------------------------------------------------------------------------------------------
    67 //--------------------------------------------------------------------------------------------------------------------------------------------
    64 //~GlxDetailsView
    68 //~GlxDetailsView
    65 //--------------------------------------------------------------------------------------------------------------------------------------------
    69 //--------------------------------------------------------------------------------------------------------------------------------------------
    66 GlxDetailsView::~GlxDetailsView()
    70 GlxDetailsView::~GlxDetailsView()
    67 {
    71     {
    68     qDebug("@@@GlxDetailsView::~GlxDetailsView Enter");
    72     OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" );
    69 
    73 
    70     if(mDetailsPixmap) {
    74     if(mDetailsIcon) {
    71         delete mDetailsPixmap;
    75     delete mDetailsIcon;
    72         mDetailsPixmap = NULL;
    76     mDetailsIcon = NULL;
    73     }
    77     }
    74 
    78 
    75     if(mDataForm && mDataForm->model()) {
    79     if(mDataForm && mDataForm->model()) {
    76         delete mDataForm->model();
    80     delete mDataForm->model();
    77         mDataForm->setModel(0);
    81     mDataForm->setModel(0);
    78     }
    82     }
    79 
    83 
    80     if(mDataForm) {
    84     if(mDataForm) {
    81         delete mDataForm;
    85     delete mDataForm;
    82         mDataForm = NULL;
    86     mDataForm = NULL;
    83     }
    87     }
    84 
    88 
    85 
    89 
    86     if(mBlackBackgroundItem) {
    90 
    87         delete mBlackBackgroundItem;
       
    88         mBlackBackgroundItem = NULL;
       
    89     }
       
    90     
       
    91     clearCurrentModel();
    91     clearCurrentModel();
    92     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
    92     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
    93 }
    93     }
    94 
    94 
    95 //--------------------------------------------------------------------------------------------------------------------------------------------
    95 //--------------------------------------------------------------------------------------------------------------------------------------------
    96 //activate
    96 //activate
    97 //--------------------------------------------------------------------------------------------------------------------------------------------
    97 //--------------------------------------------------------------------------------------------------------------------------------------------
    98 void GlxDetailsView::activate()
    98 void GlxDetailsView::activate()
    99 {
    99     {
   100     qDebug("@@@GlxDetailsView::activate Enter");
   100     OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY );
       
   101     
   101     setFormData();
   102     setFormData();
   102     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
   103     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
   103 }
   104     OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT );
       
   105     }
   104 
   106 
   105 //--------------------------------------------------------------------------------------------------------------------------------------------
   107 //--------------------------------------------------------------------------------------------------------------------------------------------
   106 //initializeView
   108 //initializeView
   107 //--------------------------------------------------------------------------------------------------------------------------------------------
   109 //--------------------------------------------------------------------------------------------------------------------------------------------
   108 void GlxDetailsView::initializeView(QAbstractItemModel *model)
   110 void GlxDetailsView::initializeView(QAbstractItemModel *model)
   109 {   
   111 {   
   110     qDebug("@@@GlxDetailsView::initializeView Enter");
   112     OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
   111     
       
   112     mBlackBackgroundItem = new HbIconItem(this);
       
   113     mBlackBackgroundItem->setBrush(QBrush(Qt::black));
       
   114     mBlackBackgroundItem->hide();
       
   115 
   113 
   116     //To show the thumbnail 
   114     //To show the thumbnail 
   117     mDetailsPixmap = new QGraphicsPixmapItem(this);
   115     if ( mDataForm == NULL) {
   118 
   116         mDetailsIcon = new HbIconItem(this);
   119     //Create the form and the model for the data form
   117 
   120     mDataForm = new HbDataForm(this);
   118         //Create the form and the model for the data form
   121     mDetailModel = new HbDataFormModel();
   119         mDataForm = new HbDataForm(this);
   122 
   120         mDetailModel = new HbDataFormModel();
   123     //custom prototype
   121 
   124     mCustomPrototype = new GlxDetailsCustomWidgets(mDataForm);
   122         //custom prototype
   125     mDataForm->setItemPrototype(mCustomPrototype);
   123         mCustomPrototype = new GlxDetailsCustomWidgets(mDataForm);           
       
   124         QList <HbAbstractViewItem*> protos = mDataForm->itemPrototypes();
       
   125         protos.append(mCustomPrototype);
       
   126         mDataForm->setItemPrototypes(protos);
       
   127     
       
   128         //Add the Widgets according to the mime type
       
   129         addWidgets();
       
   130     }   
   126 
   131 
   127     //Set the Model
   132     //Set the Model
   128     mModel = model;
   133     mModel = model;
   129     initializeNewModel();
   134     initializeNewModel();
   130     
   135 
   131     //Add the Widgets according to the mime type
       
   132     addWidgets();
       
   133     
       
   134     //Set the Layout Correspondingly.
   136     //Set the Layout Correspondingly.
   135     updateLayout(mWindow->orientation());
   137     updateLayout(mWindow->orientation());
   136     
   138 
   137     //Shows the Image 
   139     //Shows the Image 
   138     showImage();
   140     showImage();
   139         
   141 
       
   142     OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT );
   140 }
   143 }
   141 
   144 
   142 //--------------------------------------------------------------------------------------------------------------------------------------------
   145 //--------------------------------------------------------------------------------------------------------------------------------------------
   143 //resetView
   146 //resetView
   144 //--------------------------------------------------------------------------------------------------------------------------------------------
   147 //--------------------------------------------------------------------------------------------------------------------------------------------
   145 void GlxDetailsView::resetView()
   148 void GlxDetailsView::resetView()
   146 {
   149     {
   147  //Do Nothing here
   150     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_RESETVIEW, "GlxDetailsView::resetView" );
   148 }
   151     
       
   152     //Do Nothing here
       
   153     }
   149 
   154 
   150 //--------------------------------------------------------------------------------------------------------------------------------------------
   155 //--------------------------------------------------------------------------------------------------------------------------------------------
   151 //deActivate
   156 //deActivate
   152 //--------------------------------------------------------------------------------------------------------------------------------------------
   157 //--------------------------------------------------------------------------------------------------------------------------------------------
   153 void GlxDetailsView::deActivate()
   158 void GlxDetailsView::deActivate()
   154 { 
   159 { 
   155     qDebug("@@@GlxDetailsView::deActivate Enter");
   160     OstTraceFunctionEntry0( GLXDETAILSVIEW_DEACTIVATE_ENTRY );
   156 
       
   157     //mWindow->setItemVisible(Hb::AllItems, FALSE) ;
       
   158 
       
   159     if(mDetailsPixmap) {
       
   160         delete mDetailsPixmap;
       
   161         mDetailsPixmap = NULL;
       
   162     }
       
   163 
       
   164     if(mDataForm && mDataForm->model()) {
       
   165         delete mDataForm->model();
       
   166         mDataForm->setModel(0);
       
   167     }
       
   168 
       
   169     if(mDataForm) {
       
   170         delete mDataForm;
       
   171         mDataForm = NULL;
       
   172     }
       
   173 
       
   174     if(mBlackBackgroundItem) {
       
   175         delete mBlackBackgroundItem;
       
   176         mBlackBackgroundItem = NULL;
       
   177     }
       
   178     
       
   179     clearCurrentModel();
   161     clearCurrentModel();
   180     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
   162     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
       
   163     OstTraceFunctionExit0( GLXDETAILSVIEW_DEACTIVATE_EXIT );
   181 }
   164 }
   182 
   165 
   183 //--------------------------------------------------------------------------------------------------------------------------------------------
   166 //--------------------------------------------------------------------------------------------------------------------------------------------
   184 //addWidgets
   167 //addWidgets
   185 //--------------------------------------------------------------------------------------------------------------------------------------------
   168 //--------------------------------------------------------------------------------------------------------------------------------------------
   186 void GlxDetailsView::addWidgets()
   169 void GlxDetailsView::addWidgets()
   187     {
   170     {
   188     qDebug("@@@GlxDetailsView::addWidgets create the form");
   171     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets create Form" );
   189 
   172     
   190     //----------------------------START OF CREATION OF WIDGETS---------------------------------//
   173     //----------------------------START OF CREATION OF WIDGETS---------------------------------//
   191     // To add new widgets in the details view, add it here.
   174     // To add new widgets in the details view, add it here.
   192 
   175 
   193     //---------------------------IMAGE NAME LABEL --------------------------------------------//
   176     //---------------------------IMAGE NAME LABEL --------------------------------------------//
   194     qDebug("@@@GlxDetailsView::addWidgets create Image name Label"); 
   177     OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets create Image Label" );
   195     HbDataFormModelItem *imageLabelitem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(ImageNameItem), QString("Name"), mDetailModel->invisibleRootItem());
   178     HbDataFormModelItem *imageLabelitem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(ImageNameItem), QString("Name"), mDetailModel->invisibleRootItem());
   196     imageLabelitem->setData(HbDataFormModelItem::KeyRole,QString(""));
   179     imageLabelitem->setData(HbDataFormModelItem::KeyRole,QString(""));
   197 
   180 
   198     //---------------------------DATE LABEL --------------------------------------------//
   181     //---------------------------DATE LABEL --------------------------------------------//
   199     qDebug("@@@GlxDetailsView::addWidgets create Image name Label"); 
   182     OstTrace0( TRACE_NORMAL, DUP2_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets date label" );
   200     HbDataFormModelItem *dateLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(DateLabelItem), QString("Date"), mDetailModel->invisibleRootItem());
   183     HbDataFormModelItem *dateLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(DateLabelItem), QString("Date"), mDetailModel->invisibleRootItem());
   201     dateLabelItem->setData(HbDataFormModelItem::KeyRole,QString(""));
   184     dateLabelItem->setData(HbDataFormModelItem::KeyRole,QString(""));
   202 
   185 
   203     //---------------------------LOCATION LABEL--------------------------------------------//
   186     //---------------------------LOCATION LABEL--------------------------------------------//
   204     qDebug("@@@GlxDetailsView::addWidgets create Location Label");
   187     OstTrace0( TRACE_NORMAL, DUP3_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets location label" );
   205     HbDataFormModelItem *locationLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(LocationTagItem), QString("Location Tag"), mDetailModel->invisibleRootItem());
   188     HbDataFormModelItem *locationLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(LocationTagItem), QString("Location Tag"), mDetailModel->invisibleRootItem());
   206     locationLabelItem->setData(HbDataFormModelItem::KeyRole, QString(""));
   189     locationLabelItem->setData(HbDataFormModelItem::KeyRole, QString(""));
   207 
   190 
   208     //---------------------------DURATION LABEL--------------------------------------------//
       
   209     /*
       
   210      Need to Add a check here for the type of the item, if it is video or image
       
   211      qDebug("@@@GlxDetailsView::addWidgets create Duration Label");
       
   212      HbDataFormModelItem *DurationLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(DurationItem), QString("Duration"), mDetailModel->invisibleRootItem());
       
   213      DurationLabelItem->setData(HbDataFormModelItem::KeyRole, QString("")); 
       
   214     */
       
   215 
       
   216     //----------------------------COMMENTS TEXT ITEM---------------------------------------------//
   191     //----------------------------COMMENTS TEXT ITEM---------------------------------------------//
   217     qDebug("@@@GlxDetailsView::addWidgets create Comment text edit");
   192     OstTrace0( TRACE_NORMAL, DUP5_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets comment text" );
   218     HbDataFormModelItem *commentsLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(CommentsItem), QString("Comments"), mDetailModel->invisibleRootItem());
   193     HbDataFormModelItem *commentsLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(CommentsItem), QString("Comments"), mDetailModel->invisibleRootItem());
   219     commentsLabelItem->setData(HbDataFormModelItem::KeyRole, QString(""));
   194     commentsLabelItem->setData(HbDataFormModelItem::KeyRole, QString(""));
   220 
   195 
   221     //----------------------------END OF CREATION OF WIDGETS-------------------------------------//
   196     //----------------------------END OF CREATION OF WIDGETS-------------------------------------//
   222 
   197 
   227 
   202 
   228 //--------------------------------------------------------------------------------------------------------------------------------------------
   203 //--------------------------------------------------------------------------------------------------------------------------------------------
   229 //setModel
   204 //setModel
   230 //--------------------------------------------------------------------------------------------------------------------------------------------
   205 //--------------------------------------------------------------------------------------------------------------------------------------------
   231 void GlxDetailsView::setModel(QAbstractItemModel *model)
   206 void GlxDetailsView::setModel(QAbstractItemModel *model)
   232 {
   207     {
   233     qDebug("@@@GlxDetailsView::setModel");
   208     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" );
   234     if ( mModel == model ) {
   209     if ( mModel == model ) {
   235         return ;
   210     return ;
   236     }
   211     }
   237     clearCurrentModel();
   212     clearCurrentModel();
   238     mModel = model;
   213     mModel = model;
   239     initializeNewModel();
   214     initializeNewModel();
   240 }
   215     }
   241 
   216 
   242 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
   217 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
   243 {
   218     {
       
   219     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" );
   244     if ( transtionEffect == FULLSCREEN_TO_DETAIL
   220     if ( transtionEffect == FULLSCREEN_TO_DETAIL
   245             || transtionEffect == DETAIL_TO_FULLSCREEN ) {
   221             || transtionEffect == DETAIL_TO_FULLSCREEN ) {
   246         return this;
   222             return this;
   247     }
   223     }
   248     
   224 
   249     return NULL;    
   225     return NULL;    
   250 }
   226     }
   251 
   227 
   252 //--------------------------------------------------------------------------------------------------------------------------------------------
   228 //--------------------------------------------------------------------------------------------------------------------------------------------
   253 //updateLayout
   229 //updateLayout
   254 //--------------------------------------------------------------------------------------------------------------------------------------------
   230 //--------------------------------------------------------------------------------------------------------------------------------------------
   255 void GlxDetailsView::updateLayout(Qt::Orientation orient)
   231 void GlxDetailsView::updateLayout(Qt::Orientation orient)
   256     {
   232     {
   257     qDebug("GlxDetailsView::updateLayout() %d", orient );
   233     OstTrace1( TRACE_NORMAL, GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout;orient=%d", orient );
   258 
   234     
   259     QRect screen_rect = mWindow->geometry(); 
   235     QRect screen_rect = mWindow->geometry(); 
   260     setGeometry(screen_rect);
   236     setGeometry(screen_rect);
   261 
   237 
   262     if(orient == Qt::Horizontal)
   238     if(orient == Qt::Horizontal)
   263         {
   239         {
   264         qDebug("GlxDetailsView::updateLayout HORIZONTAL");
   240         OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout HORIZONTAL" );
   265 
   241         mDetailsIcon->setPos(15,75);
   266         mBlackBackgroundItem->setSize(QSize(280,280));
       
   267         mBlackBackgroundItem->setPos(11,71);
       
   268 
       
   269         mDetailsPixmap->setPos(15,75);
       
   270         mDetailsPixmap->setZValue(mBlackBackgroundItem->zValue() + 1);
       
   271 
       
   272        // mDataForm->setPos(301,5);
       
   273         mDataForm->setGeometry(301,60,335,300);
   242         mDataForm->setGeometry(301,60,335,300);
   274 
   243 
   275         }
   244         }
   276     else
   245     else
   277         {
   246         {
   278         qDebug("GlxDetailsView::updateLayout VERTICAL");
   247         OstTrace0( TRACE_NORMAL, DUP2_GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout VERTICAL" );
   279 
   248         mDetailsIcon->setPos(25,75);
   280         mBlackBackgroundItem->setSize(QSize(310,260));
       
   281         mBlackBackgroundItem->setPos(25,75);
       
   282 
       
   283         mDetailsPixmap->setPos(25,75);
       
   284         mDetailsPixmap->setZValue(mBlackBackgroundItem->zValue() + 1);
       
   285 
       
   286 //        mDataForm->setPos(5,291);
       
   287         mDataForm->setGeometry(5,351,335,300);
   249         mDataForm->setGeometry(5,351,335,300);
   288         mDataForm->setMaximumWidth(340);
   250         mDataForm->setMaximumWidth(340);
   289         }
   251         }
   290     }
   252     }
   291 
   253 
   292 void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start, int end)
   254 void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start, int end)
   293 {
   255     {
   294     Q_UNUSED(parent);
   256     Q_UNUSED(parent);
   295     Q_UNUSED(start);
   257     Q_UNUSED(start);
   296     Q_UNUSED(end);
   258     Q_UNUSED(end);
   297     qDebug("GlxDetailsView::rowsRemoved");
   259     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ROWSREMOVED, "GlxDetailsView::rowsRemoved" );
   298     
   260 
   299     if ( mModel->rowCount() <= 0 ) {
   261     if ( mModel->rowCount() <= 0 ) {
   300         return emit actionTriggered( EGlxCmdEmptyData );
   262     return emit actionTriggered( EGlxCmdEmptyData );
   301     }
   263     }
   302     
   264 
   303     if ( start <= mSelIndex && end >= mSelIndex ) {
   265     if ( start <= mSelIndex && end >= mSelIndex ) {
   304         return emit actionTriggered( EGlxCmdBack );
   266     return emit actionTriggered( EGlxCmdBack );
   305     }
   267     }
   306 }
   268     }
   307 
   269 
   308 //--------------------------------------------------------------------------------------------------------------------------------------------
   270 //--------------------------------------------------------------------------------------------------------------------------------------------
   309 //showImage
   271 //showImage
   310 //--------------------------------------------------------------------------------------------------------------------------------------------
   272 //--------------------------------------------------------------------------------------------------------------------------------------------
   311 void GlxDetailsView::showImage()
   273 void GlxDetailsView::showImage()
   312     {
   274     {
   313     qDebug("GlxDetailsView::showImage() Enter" );
   275     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" );
   314     
   276     
   315     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   277     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
   316     if ( variant.isValid() &&  variant.canConvert<int> () ) {
   278     if ( variant.isValid() &&  variant.canConvert<int> () ) {
   317         mSelIndex = variant.value<int>();  
   279         mSelIndex = variant.value<int>();  
   318     }
   280     }
   319 
   281 
   320     variant = mModel->data( mModel->index( mSelIndex ,0), GlxFsImageRole);
   282     variant = mModel->data( mModel->index( mSelIndex ,0), GlxFsImageRole);
   321     if ( variant.isValid() &&  variant.canConvert<HbIcon> () )
   283     if ( variant.isValid() &&  variant.canConvert<HbIcon> () )
   322         {
   284         {
   323         QIcon itemIcon = variant.value<HbIcon>().qicon();
       
   324         if(mWindow->orientation() == Qt::Horizontal)
   285         if(mWindow->orientation() == Qt::Horizontal)
   325             {
   286             {
   326             qDebug("GlxDetailsView::showImage HORIZONTAL");
   287             OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage HORIZONTAL" );
   327             QPixmap itemPixmap = itemIcon.pixmap(128,128);
   288             
   328             QSize sz( 270, 270);
   289             mDetailsIcon->resize(QSize(270, 270));
   329             itemPixmap = itemPixmap.scaled(sz, Qt::IgnoreAspectRatio );
   290             mDetailsIcon->setIcon(variant.value<HbIcon>());
   330             if(itemPixmap.isNull())
       
   331                 {
       
   332                 qDebug("@@@GlxDetailsView::showImage Null Pixmap");
       
   333                 }
       
   334             else
       
   335                 {
       
   336                 qDebug("@@@GlxDetailsView::showImage NOT --Null Pixmap");
       
   337                 mDetailsPixmap->setPixmap(itemPixmap);
       
   338                 }
       
   339             }
   291             }
   340         else
   292         else
   341             {
   293             {
   342             qDebug("GlxDetailsView::showImage VERTICAL");
   294             OstTrace0( TRACE_NORMAL, DUP2_GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage VERTICAL" );
   343 
   295             mDetailsIcon->resize(QSize(310, 260));
   344             QPixmap itemPixmap = itemIcon.pixmap(128,128);
   296             mDetailsIcon->setIcon(variant.value<HbIcon>());
   345             QSize sz( 310, 260);
       
   346             itemPixmap = itemPixmap.scaled(sz, Qt::IgnoreAspectRatio );
       
   347 
       
   348             if(itemPixmap.isNull())
       
   349                 {
       
   350                 qDebug("@@@GlxDetailsView::showImage Null Pixmap");
       
   351                 }
       
   352             else
       
   353                 {
       
   354                 qDebug("@@@GlxDetailsView::showImage NOT --Null Pixmap");
       
   355                 mDetailsPixmap->setPixmap(itemPixmap);
       
   356                 }
       
   357             }
   297             }
   358         }
   298         }
   359     }
   299     }
   360 
   300 
   361 //--------------------------------------------------------------------------------------------------------------------------------------------
   301 //--------------------------------------------------------------------------------------------------------------------------------------------
   362 //FillData
   302 //FillData
   363 //--------------------------------------------------------------------------------------------------------------------------------------------
   303 //--------------------------------------------------------------------------------------------------------------------------------------------
   364 void GlxDetailsView::setFormData()
   304 void GlxDetailsView::setFormData()
   365     {
   305     {
   366     qDebug("GlxDetailsView::FillData Enter");
   306     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETFORMDATA, "GlxDetailsView::setFormData" );
       
   307     
   367     //Call to set the Image Name
   308     //Call to set the Image Name
   368     setImageName();
   309     setImageName();
   369     //Call to set the date in the from
   310     //Call to set the date in the from
   370     setDate();
   311     setDate();
   371     }
   312     }
   373 //--------------------------------------------------------------------------------------------------------------------------------------------
   314 //--------------------------------------------------------------------------------------------------------------------------------------------
   374 //setImageName
   315 //setImageName
   375 //--------------------------------------------------------------------------------------------------------------------------------------------
   316 //--------------------------------------------------------------------------------------------------------------------------------------------
   376 void GlxDetailsView::setImageName()
   317 void GlxDetailsView::setImageName()
   377     {
   318     {
   378     qDebug("GlxDetailsView::setImageName Enter");
   319     OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY );
   379 
   320 
   380     QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
   321     QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
   381     QString imageName = imagePath.section('\\',-1);
   322     QString imageName = imagePath.section('\\',-1);
   382 
   323 
   383     //Fetch the text edit for displaying the Name from the Form Model
   324     //Fetch the text edit for displaying the Name from the Form Model
   384     GlxDetailsCustomWidgets * imageLabel = (GlxDetailsCustomWidgets *)mDataForm->itemByIndex(mDetailModel->index(0,0));
   325     GlxDetailsCustomWidgets * imageLabel = (GlxDetailsCustomWidgets *)mDataForm->itemByIndex(mDetailModel->index(0,0));
   385 
   326 
   386     if(imageLabel)
   327     if(imageLabel)
   387         {
   328         {
   388         qDebug("GlxDetailsView::setImageName  imageLabel!=NULL");
   329         OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETIMAGENAME, "GlxDetailsView::setImageName ImageLabel !=NULL" );
   389         HbLineEdit* label = static_cast<HbLineEdit*>(imageLabel->dataItemContentWidget());
   330         HbLineEdit* label = static_cast<HbLineEdit*>(imageLabel->dataItemContentWidget());
   390 
   331 
   391         if(label) 
   332         if(label) 
   392             {
   333             {
   393             qDebug("GlxDetailsView::setImageName,setText");
   334             OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_SETIMAGENAME, "GlxDetailsView::setImageName SetText" );
   394             label->setText(imageName);
   335             label->setText(imageName);
   395             }
   336             }
   396         }
   337         }
   397 }
   338     OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT );
       
   339     }
   398 
   340 
   399 //--------------------------------------------------------------------------------------------------------------------------------------------
   341 //--------------------------------------------------------------------------------------------------------------------------------------------
   400 //setDate
   342 //setDate
   401 //--------------------------------------------------------------------------------------------------------------------------------------------
   343 //--------------------------------------------------------------------------------------------------------------------------------------------
   402 void GlxDetailsView::setDate()
   344 void GlxDetailsView::setDate()
   403     {
   345     {
   404     qDebug("GlxDetailsView::setDate Enter");
   346     OstTraceFunctionEntry0( GLXDETAILSVIEW_SETDATE_ENTRY );
   405 
   347     
   406     QString datestring;
   348     QString datestring;
   407     QString str("dd.MM.yyyy");
   349     QString str("dd.MM.yyyy");
   408     QDate date = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxDateRole)).value<QDate>();
   350     QDate date = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxDateRole)).value<QDate>();
   409 
   351 
   410     if(date.isNull() == FALSE )
   352     if(date.isNull() == FALSE )
   411         {
   353         {
   412         qDebug("GlxDetailsView::setDate date is not Null");
   354         OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setDate is not NULL" );
   413         datestring = date.toString(str);
   355         datestring = date.toString(str);
   414         }
   356         }
   415 
   357 
   416     //Fetch the Label from the Form Model
   358     //Fetch the Label from the Form Model
   417     GlxDetailsCustomWidgets * dateLabel = (GlxDetailsCustomWidgets *)mDataForm->itemByIndex(mDetailModel->index(1,0));
   359     GlxDetailsCustomWidgets * dateLabel = (GlxDetailsCustomWidgets *)mDataForm->itemByIndex(mDetailModel->index(1,0));
   418 
   360 
   419     if(dateLabel) 
   361     if(dateLabel) 
   420         {
   362         {
   421         qDebug("GlxDetailsView::setDate  dateLabel!=NULL");
   363         OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setDate Datelabel is not NULL" );
       
   364         
   422         HbLabel* label = static_cast<HbLabel*>(dateLabel->dataItemContentWidget());
   365         HbLabel* label = static_cast<HbLabel*>(dateLabel->dataItemContentWidget());
   423 
   366 
   424         if(label) 
   367         if(label) 
   425             {
   368             {
   426             qDebug("GlxDetailsView::setDate,setText");
   369             OstTrace0( TRACE_NORMAL, DUP2_GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setDate SetText" );
   427             label->setPlainText(datestring);
   370             label->setPlainText(datestring);
   428             }
   371             }
   429         }    
   372         }    
       
   373     OstTraceFunctionExit0( GLXDETAILSVIEW_SETDATE_EXIT );
   430     }
   374     }
   431 
   375 
   432 void GlxDetailsView::initializeNewModel()
   376 void GlxDetailsView::initializeNewModel()
   433 {
   377     {
       
   378     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" );
       
   379     
   434     if ( mModel ) {
   380     if ( mModel ) {
   435         connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   381     connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   436     }
   382     }
   437 }
   383     }
   438 
   384 
   439 void GlxDetailsView::clearCurrentModel()
   385 void GlxDetailsView::clearCurrentModel()
   440 {
   386     {
       
   387     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" );
       
   388     
   441     if ( mModel ) {
   389     if ( mModel ) {
   442         disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   390     disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   443         mModel = NULL ;
   391     mModel = NULL ;
   444     }    
   392     }    
   445 }
   393     }