ui/views/detailsview/src/glxdetailsview.cpp
changeset 62 36d93b4dc635
parent 58 383b67fbdb11
child 65 ccee5c4b0de4
equal deleted inserted replaced
58:383b67fbdb11 62:36d93b4dc635
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8  *
       
     9  * Initial Contributors:
     8  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
     9  * Nokia Corporation - initial contribution.
    11  *
    10  *
    12  * Contributors:
    11  * Contributors:
    13  *
    12  *
    14  * Description:   ?Description
    13  * Description:   ?Description
    15  *
    14  *
    16  */
    15  */
    17 
    16 
    18 //--------------------------------------------------------------------------------------------------------------------------------------------
    17 //Includes Qt
    19 
       
    20 
    18 
    21 #include <QModelIndex>
    19 #include <QModelIndex>
    22 #include <qdatetime.h>
       
    23 #include <QDebug>
    20 #include <QDebug>
    24 #include <HbAnchorLayout.h>
    21 
    25 //--------------------------------------------------------------------------------------------------------------------------------------------
    22 //Includes Orbit
    26 
       
    27 #include <hblabel.h>
    23 #include <hblabel.h>
    28 #include <hbdataform.h>
       
    29 #include <hbinstance.h>
    24 #include <hbinstance.h>
    30 #include <hbiconitem.h>
    25 #include <hblistview.h>
    31 #include <hbframeitem.h>
       
    32 #include <hbpushbutton.h>
    26 #include <hbpushbutton.h>
    33 #include <hbdataformmodel.h>
       
    34 #include <hbdocumentloader.h>
       
    35 #include <hbdataformmodelitem.h>
       
    36 #include <hbdataformviewitem.h>
       
    37 #include <hbparameterlengthlimiter.h>
    27 #include <hbparameterlengthlimiter.h>
    38 //--------------------------------------------------------------------------------------------------------------------------------------------
    28 
    39 #include "glxviewids.h"
    29 //User Includes
       
    30 #include "glxlog.h"      //contains the declaration of GLX LOGS
       
    31 #include "glxviewids.h"  //contains view ids used here 
    40 #include "glxicondefs.h" //Contains the icon names/Ids
    32 #include "glxicondefs.h" //Contains the icon names/Ids
    41 #include "glxmodelparm.h"
    33 #include "glxmodelparm.h" //contains the declaration of GlxModelParm used to check for favourites 
    42 #include "glxmediamodel.h"
    34 #include "shareuidialog.h" //contains the declaration for share ui/send dialogs
    43 #include "glxdetailsview.h"
    35 #include "glxdetailsicon.h" //contains the declaration of glxdetailsicon to show the image
    44 #include "glxfavmediamodel.h"
    36 #include "glxdetailsview.h" //contains the declaration of this file/class
    45 #include "glxdocloaderdefs.h"
    37 #include "glxviewdocloader.h" //contains the declaration of GlxDetailsViewDocLoader
    46 #include <glxcommandhandlers.hrh>
    38 #include "glxfavmediamodel.h" //contains the declaration of GlxFavMediaModel,used to check for favourites
    47 #include  "glxlocalisationstrings.h"
    39 #include "glxdocloaderdefs.h" //contains the #define/constants of docml constants 
    48 #include "glxdetailstextedit.h"
    40 #include "glxcommandhandlers.hrh" //contains the declaration of rename and description command
    49 #include "glxdetailsicon.h"
    41 #include "glxlocalisationstrings.h" //contains the localisation strings
    50 
    42 #include "glxdetailsviewmodelwrapper.h" //contains the model wrapper for the media model of list widget
    51 
    43 #include "glxdetailsviewitemprototype.h" //contains the custom widgets prototype decalaration
    52 #include "glxviewdocloader.h"
    44 #include "glxcollectionpluginalbums.hrh" //contains declaration of KGlxCollectionPluginFavoritesAlbumId
    53 #include <glxcollectionpluginalbums.hrh>
       
    54 
       
    55 #include "glxlog.h"
       
    56 #include "glxloggerenabler.h"
       
    57 
       
    58 
       
    59 #include "OstTraceDefinitions.h"
    45 #include "OstTraceDefinitions.h"
    60 #ifdef OST_TRACE_COMPILER_IN_USE
    46 #ifdef OST_TRACE_COMPILER_IN_USE
    61 #include "glxdetailsviewTraces.h"
    47 #include "glxdetailsviewTraces.h"
    62 #endif
    48 #endif
    63 
    49 
    64 //SIZE OF THE IMAGE , LAYOUTS TEAM NEED TO GIVER THE SIZE IN UNITS
       
    65 #define GLX_IMAGE_WIDTH 333
       
    66 #define GLX_IMAGE_HEIGHT 215 
       
    67 const int KBytesInKB = 1024;
       
    68 const int KBytesInMB = 1024 * 1024;
       
    69 const int KBytesInGB = 1024 * 1024 * 1024;
       
    70 
       
    71 //--------------------------------------------------------------------------------------------------------------------------------------------
    50 //--------------------------------------------------------------------------------------------------------------------------------------------
    72 //GlxDetailsView
    51 //GlxDetailsView
    73 //--------------------------------------------------------------------------------------------------------------------------------------------
    52 //--------------------------------------------------------------------------------------------------------------------------------------------
    74 GlxDetailsView::GlxDetailsView(HbMainWindow *window) 
    53 GlxDetailsView::GlxDetailsView(HbMainWindow *window) :
    75     : GlxView( GLX_DETAILSVIEW_ID ),
    54     GlxView(GLX_DETAILSVIEW_ID), mImageBackGround(NULL), mDetailsIcon(NULL), mView(NULL), mFavIcon(
    76       mDetailsIcon( NULL ),
    55         NULL), mModel(NULL), mFavModel(NULL), mWindow(window), mSelIndex(0), mDocLoader(NULL),
    77       mFavIcon( NULL ), 
    56         mListView(NULL), mListModel(NULL), mShareButton(NULL)
    78       mModel( NULL ), 
       
    79       mFavModel( NULL ),
       
    80       mWindow( window ),
       
    81       mSelIndex( 0 ),
       
    82       mDocLoader( NULL ),
       
    83       mImageName( NULL ),
       
    84       mDescriptions( NULL ),
       
    85       mDateLabel( NULL ),
       
    86       mSizeLabel( NULL ),
       
    87       mTimeLabel( NULL )
       
    88 {
    57 {
    89     GLX_LOG_INFO("GlxDetailsView::GlxDetailsView");
    58     GLX_LOG_INFO("GlxDetailsView::GlxDetailsView");
    90     OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY );
    59     OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY );
    91     setContentFullScreen(true);//for smooth transtion between grid to full screen and vice versa
    60     setContentFullScreen(true);//for smooth transtion between grid to full screen and vice versa
    92     OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT );
    61     OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT );
    96 //~GlxDetailsView
    65 //~GlxDetailsView
    97 //--------------------------------------------------------------------------------------------------------------------------------------------
    66 //--------------------------------------------------------------------------------------------------------------------------------------------
    98 GlxDetailsView::~GlxDetailsView()
    67 GlxDetailsView::~GlxDetailsView()
    99 {
    68 {
   100     OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" );
    69     OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" );
   101     
    70 
       
    71     delete mDetailsIcon;
       
    72     mDetailsIcon = NULL;
       
    73 
       
    74     delete mImageBackGround;
       
    75     mImageBackGround = NULL;
       
    76 
       
    77     delete mView;
       
    78     mView = NULL;
       
    79 
       
    80     mDocLoader->reset();
   102     delete mDocLoader;
    81     delete mDocLoader;
   103     mDocLoader = NULL;
    82     mDocLoader = NULL;   
   104     
    83 
   105     cleanUp();
    84 }
   106 }
       
   107 
       
   108 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   109 //activate
       
   110 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   111 void GlxDetailsView::activate()
       
   112     {
       
   113     OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY );
       
   114     //create and set the Favourite Model
       
   115     if(getSubState() != IMAGEVIEWER_DETAIL_S) {
       
   116        setFavModel();
       
   117     }
       
   118     
       
   119     //fill the data
       
   120     FillDetails();
       
   121     
       
   122     //Initialze the Model
       
   123     initializeNewModel();
       
   124     
       
   125     //make the connections
       
   126     setConnections();
       
   127         
       
   128     //Set context mode to fetch descriptions
       
   129     mModel->setData(QModelIndex(), (int) GlxContextComment, GlxContextRole);    
       
   130     
       
   131     OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT );
       
   132     }
       
   133 
    85 
   134 //--------------------------------------------------------------------------------------------------------------------------------------------
    86 //--------------------------------------------------------------------------------------------------------------------------------------------
   135 //initializeView
    87 //initializeView
   136 //--------------------------------------------------------------------------------------------------------------------------------------------
    88 //--------------------------------------------------------------------------------------------------------------------------------------------
   137 void GlxDetailsView::initializeView( QAbstractItemModel *model, GlxView *preView)
    89 void GlxDetailsView::initializeView(QAbstractItemModel *model, GlxView *preView)
   138 {
    90 {
   139     Q_UNUSED( preView )
    91     Q_UNUSED( preView )
   140     OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
    92     OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
   141     bool loaded = false;
    93     bool loaded = false;
   142 
    94 
   143     if(!mDocLoader)
    95     if (!mDocLoader) {
   144         {
    96         mDocLoader = new GlxDetailsViewDocLoader();
   145          mDocLoader = new GlxDetailsViewDocLoader();
    97     }
   146         }
    98     mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded);
   147 
    99 
   148     //Load the docml
   100     if (!mView) {
   149     mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded);     
   101 
   150 
   102         mView = static_cast<HbView*> (mDocLoader->findWidget(GLX_DETAILSVIEW_VIEW));
   151     HbView *mView = static_cast<HbView*> (mDocLoader->findWidget(
   103         mImageBackGround = static_cast<HbLabel*> (mDocLoader->findWidget(
   152             GLX_DETAILSVIEW_VIEW));
   104             GLX_DETAILSVIEW_IMGBCKGROUND));
   153     
   105         mDetailsIcon = static_cast<HbLabel*> (mDocLoader->findWidget(GLX_DETAILSVIEW_IMAGE));
   154     mDetailsIcon = static_cast<HbLabel*> (mDocLoader->findWidget(
   106     }
   155             GLX_DETAILSVIEW_IMAGE));
   107 
   156     mFavIcon = static_cast<GlxDetailsIcon*> (mDocLoader->findWidget(
   108     mFavIcon = static_cast<GlxDetailsIcon*> (mDocLoader->findWidget(GLX_DETAILSVIEW_FAVICON));
   157             GLX_DETAILSVIEW_FAVICON));
   109 
   158 
   110     mShareButton = static_cast<HbPushButton*> (mDocLoader->findWidget(GLX_DETAILSVIEW_SHAREBUTTON));
   159 
   111 
   160     mDescriptions = static_cast<GlxDetailsTextEdit*> (mDocLoader->findWidget(
   112     mListView = static_cast<HbListView*> (mDocLoader->findWidget(GLX_DETAILSVIEW_LISTWIDGET));
   161             GLX_DETAILSVIEW_DESCRPTIONTEXT));
   113 
   162     
       
   163     mImageName = static_cast<GlxDetailsTextEdit*> (mDocLoader->findWidget(
       
   164             GLX_DETAILSVIEW_IMGNAME));
       
   165     
       
   166     mDateLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
       
   167             GLX_DETAILSVIEW_DATETEXT));
       
   168     
       
   169     mTimeLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
       
   170             GLX_DETAILSVIEW_TIMETEXT));
       
   171     
       
   172     mSizeLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
       
   173             GLX_DETAILSVIEW_SIZETEXT));
       
   174 
       
   175     mFavIconEnabled  =  HbIcon(GLXICON_ADD_TO_FAV);
       
   176     mFavIconDisabled =  HbIcon(GLXICON_REMOVE_FAV);   
       
   177         
       
   178     //Set the Model
   114     //Set the Model
   179     mModel = model;  
   115     mModel = model;
   180    if(getSubState() == IMAGEVIEWER_DETAIL_S) {
   116 
   181        mFavIcon->hide();
       
   182     }
       
   183     else
       
   184     {
       
   185        mFavIcon->setItemIcon(HbIcon(GLXICON_REMOVE_FAV));
       
   186      }	
       
   187 	 
       
   188 	setWidget(mView);
       
   189 	
       
   190     //Set the Layout Correspondingly.
   117     //Set the Layout Correspondingly.
   191     updateLayout(mWindow->orientation());
   118     updateLayout(mWindow->orientation());
       
   119         
       
   120     GlxDetailsViewItemProtoType *prototype = new GlxDetailsViewItemProtoType(mListView);
       
   121     mListView->setItemPrototype(prototype);
       
   122     mListModel = new GlxDetailsViewModelWrapper(mModel);
       
   123     mListView->setModel(mListModel);
       
   124 
       
   125     mImageBackGround->show();
       
   126     mDetailsIcon->show();
       
   127     
       
   128     setWidget(mView);
       
   129 
       
   130     
   192 
   131 
   193     OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT );
   132     OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT );
   194     }
   133 }
       
   134 
       
   135 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   136 //activate
       
   137 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   138 void GlxDetailsView::activate()
       
   139 {
       
   140     OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY );
       
   141 
       
   142     mFavIconEnabled = HbIcon(GLXICON_ADD_TO_FAV);
       
   143     mFavIconDisabled = HbIcon(GLXICON_REMOVE_FAV);
       
   144 
       
   145     if (getSubState() != IMAGEVIEWER_DETAIL_S) {
       
   146         //set the favorite model to check if this image is in favourites folder or not
       
   147         setFavModel();
       
   148         mFavIcon->setItemIcon(mFavIconDisabled);
       
   149     }
       
   150     else {
       
   151         mFavIcon->hide();
       
   152     }
       
   153 
       
   154     //Initialze the Model
       
   155     initializeNewModel();
       
   156 
       
   157     //make the connections
       
   158     setConnections();
       
   159 
       
   160     //Set context mode to fetch descriptions
       
   161     mModel->setData(QModelIndex(), (int) GlxContextComment, GlxContextRole);
       
   162 
       
   163     OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT );
       
   164 }
   195 
   165 
   196 //--------------------------------------------------------------------------------------------------------------------------------------------
   166 //--------------------------------------------------------------------------------------------------------------------------------------------
   197 //resetView
   167 //resetView
   198 //--------------------------------------------------------------------------------------------------------------------------------------------
   168 //--------------------------------------------------------------------------------------------------------------------------------------------
   199 void GlxDetailsView::resetView()
   169 void GlxDetailsView::resetView()
   200     {
   170 {
   201     GLX_LOG_INFO("GlxDetailsView::resetView");
   171     GLX_LOG_INFO("GlxDetailsView::resetView");
       
   172 
       
   173     //Remove the context created to update details
       
   174     if (mModel) {
       
   175         mModel->setData(QModelIndex(), (int) GlxContextComment, GlxRemoveContextRole);
       
   176     }
       
   177 
       
   178     //clear the connections
       
   179     clearConnections();
       
   180     //clear the model
       
   181     clearCurrentModel();
       
   182 
       
   183     delete mFavIcon;
       
   184     mFavIcon = NULL;
       
   185 
       
   186     delete mFavModel;
       
   187     mFavModel = NULL;
       
   188 
       
   189     delete mShareButton;
       
   190     mShareButton = NULL;
       
   191 
   202     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_RESETVIEW, "GlxDetailsView::resetView" );
   192     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_RESETVIEW, "GlxDetailsView::resetView" );
   203     }
   193 }
   204 
   194 
   205 //--------------------------------------------------------------------------------------------------------------------------------------------
   195 //--------------------------------------------------------------------------------------------------------------------------------------------
   206 //deActivate
   196 //deActivate
   207 //--------------------------------------------------------------------------------------------------------------------------------------------
   197 //--------------------------------------------------------------------------------------------------------------------------------------------
   208 void GlxDetailsView::deActivate()
   198 void GlxDetailsView::deActivate()
   209     {
   199 {
   210     GLX_LOG_INFO("GlxDetailsView::deActivate");
   200     GLX_LOG_INFO("GlxDetailsView::deActivate");
   211     OstTraceFunctionEntry0( GLXDETAILSVIEW_DEACTIVATE_ENTRY );
   201     OstTraceFunctionEntry0( GLXDETAILSVIEW_DEACTIVATE_ENTRY );
   212 
   202 
   213     //Remove the context created to update details
   203     mImageBackGround->hide();
   214     mModel->setData(QModelIndex(), (int) GlxContextComment,
   204     mDetailsIcon->hide();
   215             GlxRemoveContextRole);
       
   216     cleanUp();
   205     cleanUp();
   217     
   206 
   218     OstTraceFunctionExit0( GLXDETAILSVIEW_DEACTIVATE_EXIT );
   207     OstTraceFunctionExit0( GLXDETAILSVIEW_DEACTIVATE_EXIT );
   219     }
   208 }
   220 
       
   221 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   222 //cleanUp
       
   223 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   224 void GlxDetailsView::cleanUp()
       
   225     {
       
   226     qDebug("GlxDetailsView::cleanUp Enter");
       
   227 	//clear the connections
       
   228     clearConnections();   
       
   229     
       
   230     clearCurrentModel();
       
   231 
       
   232     delete mFavModel;
       
   233     mFavModel = NULL;
       
   234        
       
   235     delete mFavIcon;
       
   236     mFavIcon = NULL;
       
   237 
       
   238     delete mDetailsIcon;
       
   239     mDetailsIcon = NULL;
       
   240     }
       
   241 
   209 
   242 //--------------------------------------------------------------------------------------------------------------------------------------------
   210 //--------------------------------------------------------------------------------------------------------------------------------------------
   243 //setModel
   211 //setModel
   244 //--------------------------------------------------------------------------------------------------------------------------------------------
   212 //--------------------------------------------------------------------------------------------------------------------------------------------
   245 void GlxDetailsView::setModel(QAbstractItemModel *model)
   213 void GlxDetailsView::setModel(QAbstractItemModel *model)
   246     {
   214 {
   247     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" );
   215     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" );
   248     if (mModel == model)
   216     if (mModel == model) {
   249         {
       
   250         return;
   217         return;
   251         }
   218     }
   252     clearCurrentModel();
   219     clearCurrentModel();
   253     mModel = model;
   220     mModel = model;
   254     initializeNewModel();
   221     initializeNewModel();
   255     }
   222 }
       
   223 
       
   224 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   225 //getAnimationItem
       
   226 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   227 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
       
   228 {
       
   229     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" );
       
   230     if (transtionEffect == FULLSCREEN_TO_DETAIL || transtionEffect == DETAIL_TO_FULLSCREEN) {
       
   231         return this;
       
   232     }
       
   233     return NULL;
       
   234 }
       
   235 
       
   236 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   237 //cleanUp
       
   238 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   239 void GlxDetailsView::cleanUp()
       
   240 {
       
   241     delete mListModel;
       
   242     mListModel = NULL;
       
   243 
       
   244     delete mListView;
       
   245     mListView = NULL;
       
   246 
       
   247     takeWidget();
       
   248 }
       
   249 
       
   250 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   251 //showImage
       
   252 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   253 void GlxDetailsView::showImage()
       
   254 {
       
   255     QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole);
       
   256     if (variant.isValid() && variant.canConvert<int> ()) {
       
   257         mSelIndex = variant.value<int> ();
       
   258     }
       
   259 
       
   260     variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole);
       
   261 
       
   262     if (variant.isValid() && variant.canConvert<HbIcon> ()) {
       
   263         mDetailsIcon->setIcon(variant.value<HbIcon> ());
       
   264         mImageBackGround->setIcon(HbIcon(":/data/details.svg"));
       
   265     }
       
   266 }
   256 
   267 
   257 //--------------------------------------------------------------------------------------------------------------------------------------------
   268 //--------------------------------------------------------------------------------------------------------------------------------------------
   258 //setFavModel
   269 //setFavModel
   259 //--------------------------------------------------------------------------------------------------------------------------------------------
   270 //--------------------------------------------------------------------------------------------------------------------------------------------
   260 void GlxDetailsView::setFavModel()
   271 void GlxDetailsView::setFavModel()
   261 {
   272 {
   262     GlxModelParm modelParm;
   273     GlxModelParm modelParm;
   263     QString imagePath = (mModel->data(mModel->index(mModel->data(
   274     QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0, 0),
   264             mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
   275         GlxFocusIndexRole).value<int> (), 0), GlxUriRole)).value<QString> ();
   265             GlxUriRole)).value<QString> ();
       
   266 
   276 
   267     if (mFavModel == NULL) {
   277     if (mFavModel == NULL) {
   268         modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId);
   278         modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId);
   269         modelParm.setContextMode(GlxContextFavorite);
   279         modelParm.setContextMode(GlxContextFavorite);
   270         modelParm.setPath(imagePath);
   280         modelParm.setPath(imagePath);
   276 //initializeNewModel
   286 //initializeNewModel
   277 //--------------------------------------------------------------------------------------------------------------------------------------------
   287 //--------------------------------------------------------------------------------------------------------------------------------------------
   278 void GlxDetailsView::initializeNewModel()
   288 void GlxDetailsView::initializeNewModel()
   279 {
   289 {
   280     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" );
   290     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" );
   281     
   291 
   282     if (mModel) {
   292     if (mModel) {
   283         connect( mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   293         connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
   284         connect( mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() ));
   294             SLOT(rowsRemoved(QModelIndex,int,int)));
   285         connect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) );
   295         connect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( refreshDetailsview() ));
       
   296         connect(mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ));
   286     }
   297     }
   287 }
   298 }
   288 
   299 
   289 //--------------------------------------------------------------------------------------------------------------------------------------------
   300 //--------------------------------------------------------------------------------------------------------------------------------------------
   290 //clearCurrentModel
   301 //clearCurrentModel
   292 void GlxDetailsView::clearCurrentModel()
   303 void GlxDetailsView::clearCurrentModel()
   293 {
   304 {
   294     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" );
   305     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" );
   295 
   306 
   296     if (mModel) {
   307     if (mModel) {
   297         disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   308         disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
   298         disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() ));
   309             SLOT(rowsRemoved(QModelIndex,int,int)));
   299         disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) );
   310         disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( refreshDetailsview() ));
       
   311         disconnect(mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ));
   300         mModel = NULL;
   312         mModel = NULL;
   301     }
   313     }
   302 }
   314 }
   303 
   315 
   304 //--------------------------------------------------------------------------------------------------------------------------------------------
   316 //--------------------------------------------------------------------------------------------------------------------------------------------
   305 //setConnections
   317 //setConnections
   306 //--------------------------------------------------------------------------------------------------------------------------------------------
   318 //--------------------------------------------------------------------------------------------------------------------------------------------
   307 void GlxDetailsView::setConnections()
   319 void GlxDetailsView::setConnections()
   308 {
   320 {
       
   321 
   309     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
   322     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
   310             SLOT(updateLayout(Qt::Orientation)));
   323         SLOT(updateLayout(Qt::Orientation)));
   311     
   324 
   312     if(getSubState() != IMAGEVIEWER_DETAIL_S) {    
   325     connect(mShareButton, SIGNAL(clicked()), this, SLOT(launchShareDialog()));
   313     connect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites()));
   326 
   314     
   327     if (getSubState() != IMAGEVIEWER_DETAIL_S) {
   315     connect(mDescriptions, SIGNAL(labelPressed()), this,
   328 
   316             SLOT(UpdateDescription()));
   329         connect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites()));
   317     
   330 
   318     connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
   331         connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this,
   319                    this, SLOT( dataChanged(QModelIndex,QModelIndex) ));
   332             SLOT( dataChanged(QModelIndex,QModelIndex) ));
       
   333 
       
   334         //Connect the signals only in case of details view launched from photos app
       
   335         // and dont connect the signals if the details view is launched from MMS,File Manager
       
   336         // or other apps.
       
   337         connect((mListView->itemPrototypes()).at(0), SIGNAL(signalFromCustomWidget(int)), this,
       
   338             SLOT(triggerTheCommand(int)));
       
   339 
   320     }
   340     }
   321 }
   341 }
   322 
   342 
   323 //--------------------------------------------------------------------------------------------------------------------------------------------
   343 //--------------------------------------------------------------------------------------------------------------------------------------------
   324 //clearConnections
   344 //clearConnections
   325 //--------------------------------------------------------------------------------------------------------------------------------------------
   345 //--------------------------------------------------------------------------------------------------------------------------------------------
   326 void GlxDetailsView::clearConnections()
   346 void GlxDetailsView::clearConnections()
   327 {
   347 {
   328     
   348     GLX_LOG_INFO("GlxDetailsView::clearConnections ");
   329     qDebug("GlxDetailsView:: clearConnections");
   349 
   330     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
   350     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
   331             SLOT(updateLayout(Qt::Orientation)));
   351         SLOT(updateLayout(Qt::Orientation)));
   332            
   352 
   333     if(mModel && getSubState() != IMAGEVIEWER_DETAIL_S) {
   353     if (mModel && getSubState() != IMAGEVIEWER_DETAIL_S) {
   334     disconnect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites()));
   354 
   335     disconnect(mDescriptions, SIGNAL(labelPressed()), this,
   355         disconnect((mListView->itemPrototypes()).at(0), SIGNAL(signalFromCustomWidget(int)), this,
   336             SLOT(UpdateDescription()));
   356             SLOT(triggerTheCommand(int)));
   337     disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
   357 
   338                     this, SLOT( dataChanged(QModelIndex,QModelIndex) ));
   358         disconnect(mShareButton, SIGNAL(released()), this, SLOT(launchShareDialog()));
   339     }
   359 
   340 }
   360         disconnect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites()));
   341 
   361 
   342 //--------------------------------------------------------------------------------------------------------------------------------------------
   362         disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this,
   343 //getAnimationItem
   363             SLOT( dataChanged(QModelIndex,QModelIndex) ));
   344 //--------------------------------------------------------------------------------------------------------------------------------------------
   364     }
   345 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
   365 }
   346     {
   366 
   347     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" );
   367 //--------------------------------------------------------------------------------------------------------------------------------------------
   348     if (transtionEffect == FULLSCREEN_TO_DETAIL || transtionEffect
   368 //getSubState
   349             == DETAIL_TO_FULLSCREEN)
   369 //--------------------------------------------------------------------------------------------------------------------------------------------
   350         {
   370 int GlxDetailsView::getSubState()
   351     return this;
   371 {
       
   372     int substate = NO_DETAIL_S;
       
   373 
       
   374     if (mModel) {
       
   375         QVariant variant = mModel->data(mModel->index(0, 0), GlxSubStateRole);
       
   376 
       
   377         if (variant.isValid() && variant.canConvert<int> ()) {
       
   378             substate = variant.value<int> ();
   352         }
   379         }
   353     return NULL;
   380     }
   354     }
   381     return substate;
       
   382 }
   355 
   383 
   356 //--------------------------------------------------------------------------------------------------------------------------------------------
   384 //--------------------------------------------------------------------------------------------------------------------------------------------
   357 //updateLayout
   385 //updateLayout
   358 //--------------------------------------------------------------------------------------------------------------------------------------------
   386 //--------------------------------------------------------------------------------------------------------------------------------------------
   359 void GlxDetailsView::updateLayout(Qt::Orientation orient)
   387 void GlxDetailsView::updateLayout(Qt::Orientation orient)
   360     {
   388 {
   361     OstTrace1( TRACE_NORMAL, GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout;orient=%d", orient );
       
   362     GLX_LOG_INFO("GlxDetailsView::updateLayout ");
   389     GLX_LOG_INFO("GlxDetailsView::updateLayout ");
   363     bool loaded = false;
   390     bool loaded = false;
   364     QString section;
   391     QString section;
   365 
   392 
   366     //Load the widgets accroding to the current Orientation
   393     //Load the widgets accroding to the current Orientation
   367     if (orient == Qt::Horizontal)
   394     if (orient == Qt::Horizontal) {
   368         {
       
   369         section = GLX_DETAILSVIEW_LSSECTION;
   395         section = GLX_DETAILSVIEW_LSSECTION;
   370         }
   396     }
   371     else
   397     else {
   372         {
       
   373         section = GLX_DETAILSVIEW_PTSECTION;
   398         section = GLX_DETAILSVIEW_PTSECTION;
   374         }
   399     }
   375 
   400 
   376     //Load the Sections
   401     //Load the Sections
   377     mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, section, &loaded);
   402     mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, section, &loaded);
   378 
   403 
   379     showImage();
   404     showImage();
   380 	//This is just to over come the bug in docloader,once that is fixed we can remove the 
   405 
   381     //below lines of code
       
   382     FillDetails();
       
   383     
       
   384     GLX_LOG_INFO1("GlxDetailsView::updateLayout =%d\n",loaded);
   406     GLX_LOG_INFO1("GlxDetailsView::updateLayout =%d\n",loaded);
   385     }
   407 }
   386 
   408 
   387 //--------------------------------------------------------------------------------------------------------------------------------------------
   409 //--------------------------------------------------------------------------------------------------------------------------------------------
   388 //rowsRemoved
   410 //rowsRemoved
   389 //--------------------------------------------------------------------------------------------------------------------------------------------
   411 //--------------------------------------------------------------------------------------------------------------------------------------------
   390 void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start,
   412 void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start, int end)
   391         int end)
   413 {
   392     {
       
   393     Q_UNUSED(parent);
   414     Q_UNUSED(parent);
   394     Q_UNUSED(start);
   415     Q_UNUSED(start);
   395     Q_UNUSED(end);
   416     Q_UNUSED(end);
   396     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ROWSREMOVED, "GlxDetailsView::rowsRemoved" );
   417     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ROWSREMOVED, "GlxDetailsView::rowsRemoved" );
   397 
   418 
   398     if (mModel->rowCount() <= 0)
   419     if (mModel->rowCount() <= 0) {
   399         {
       
   400         return emit actionTriggered(EGlxCmdEmptyData);
   420         return emit actionTriggered(EGlxCmdEmptyData);
       
   421     }
       
   422 
       
   423     if (start <= mSelIndex && end >= mSelIndex) {
       
   424         return emit actionTriggered(EGlxCmdBack);
       
   425     }
       
   426 }
       
   427 
       
   428 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   429 //modelDestroyed
       
   430 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   431 void GlxDetailsView::modelDestroyed()
       
   432 {
       
   433     mModel = NULL;
       
   434 }
       
   435 
       
   436 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   437 //dataChanged
       
   438 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   439 void GlxDetailsView::dataChanged(QModelIndex startIndex, QModelIndex endIndex)
       
   440 {
       
   441     Q_UNUSED(endIndex);
       
   442 
       
   443     QVariant variant = mFavModel->data(startIndex, GlxFavorites);
       
   444     if (variant.isValid() && variant.canConvert<bool> ()) {
       
   445         if (variant.value<bool> ()) {
       
   446             mFavIcon->setItemIcon(mFavIconEnabled);
   401         }
   447         }
   402 
   448         else {
   403     if (start <= mSelIndex && end >= mSelIndex)
   449             mFavIcon->setItemIcon(mFavIconDisabled);
   404         {
       
   405         return emit actionTriggered(EGlxCmdBack);
       
   406         }
   450         }
   407     }
   451     }
   408 
   452 }
   409 void GlxDetailsView::modelDestroyed()
   453 
   410 {
   454 //--------------------------------------------------------------------------------------------------------------------------------------------
   411     mModel = NULL;
   455 //refreshDetailsview
   412 }
   456 //--------------------------------------------------------------------------------------------------------------------------------------------
   413 
   457 void GlxDetailsView::refreshDetailsview()
   414 //--------------------------------------------------------------------------------------------------------------------------------------------
   458 {
   415 //FillData
   459     GLX_LOG_INFO("GlxDetailsView::refreshDetailsview ");
   416 //--------------------------------------------------------------------------------------------------------------------------------------------
   460     mListModel->refreshCustomWidget();
   417 void GlxDetailsView::FillDetails()
   461 }
   418     {
   462 
   419     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETFORMDATA, "GlxDetailsView::setFormData" );
   463 //--------------------------------------------------------------------------------------------------------------------------------------------
   420 
   464 //triggerTheCommand
   421     qDebug("GlxDetailsView::FillDetails");
   465 //--------------------------------------------------------------------------------------------------------------------------------------------
   422     //Call to set the Image Name
   466 void GlxDetailsView::triggerTheCommand(int row)
   423     setImageName();
   467 {
   424 
   468     GLX_LOG_INFO("GlxDetailsView::triggerTheCommand ");
   425     //Call to set the description
   469 
   426     setDesc();
   470     if (row == GlxDetailsViewItemProtoType::widgetNameIndex) {
   427 
   471         emit actionTriggered(EGlxCmdRenameFile);
   428     //Call to set the date in the from
   472     }
   429     setDate();
   473     else {
   430 
   474         emit actionTriggered(EGlxCmdComment);
   431     //Call to set the time
   475     }
   432     setTime();
   476 }
   433 
   477 
   434     //Call to set the size
   478 //--------------------------------------------------------------------------------------------------------------------------------------------
   435     setSize();
   479 //updateFavourites
   436 
   480 //--------------------------------------------------------------------------------------------------------------------------------------------
   437     }
   481 void GlxDetailsView::updateFavourites()
   438 //--------------------------------------------------------------------------------------------------------------------------------------------
   482 {
   439 //showImage
   483     QVariant variant = mFavModel->data(mFavModel->index(0, 0), GlxFavorites);
   440 //--------------------------------------------------------------------------------------------------------------------------------------------
   484     if (variant.isValid() && variant.canConvert<bool> ()) {
   441 void GlxDetailsView::showImage()
   485         if (variant.value<bool> ()) {
   442  {
   486             emit actionTriggered(EGlxCmdRemoveFromFav);
   443     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" );
       
   444 
       
   445     QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole);
       
   446     if (variant.isValid() && variant.canConvert<int> ())
       
   447         {
       
   448         mSelIndex = variant.value<int> ();
       
   449         }
   487         }
   450 
   488         else {
   451     variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole);
   489             emit actionTriggered(EGlxCmdAddToFav);
   452     
       
   453     if (variant.isValid() && variant.canConvert<HbIcon> ())
       
   454         {
       
   455          mDetailsIcon->setIcon(variant.value<HbIcon> ());
       
   456         }
   490         }
   457    }
   491     }
   458 
   492 }
   459 //--------------------------------------------------------------------------------------------------------------------------------------------
   493 
   460 //setImageName
   494 //--------------------------------------------------------------------------------------------------------------------------------------------
   461 //--------------------------------------------------------------------------------------------------------------------------------------------
   495 //launchShareDialog
   462 void GlxDetailsView::setImageName()
   496 //--------------------------------------------------------------------------------------------------------------------------------------------
   463     {
   497 void GlxDetailsView::launchShareDialog()
   464     OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY );
   498 {
   465     QString imagePath = (mModel->data(mModel->index(mModel->data(
   499     GLX_LOG_INFO("GlxDetailsView::launchShareDialog ");
   466             mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
   500     emit actionTriggered(EGlxCmdSend);
   467             GlxUriRole)).value<QString> ();
   501 }
   468     QString imageName = imagePath.section('\\', -1);
   502 
   469     
       
   470     mImageName->setItemText(imageName);    
       
   471     OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT );
       
   472     }
       
   473 
       
   474 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   475 //setImageName
       
   476 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   477 void GlxDetailsView::setDesc()
       
   478     {
       
   479     
       
   480     //This is a hack , Initialize to some characters and then set the text
       
   481     //as of know if the description text is Null , we cant see the Description edit box
       
   482     //The issue has been informed to Application designer team.
       
   483     mDescriptions->setItemText("a");
       
   484     QString description = (mModel->data(mModel->index(mModel->data(
       
   485             mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
       
   486             GlxDescRole)).value<QString> ();
       
   487      mDescriptions->setItemText(description);       
       
   488     }
       
   489 
       
   490 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   491 //setDate
       
   492 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   493 void GlxDetailsView::setDate()
       
   494     {
       
   495     OstTraceFunctionEntry0( GLXDETAILSVIEW_SETDATE_ENTRY );
       
   496 
       
   497     QString datestring;
       
   498     QString dateFormat("dd.MM.yyyy");
       
   499     QDate date = (mModel->data(mModel->index(mModel->data(
       
   500             mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
       
   501             GlxDateRole)).value<QDate> ();
       
   502         
       
   503     if (date.isNull() == FALSE)
       
   504         {
       
   505         OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setDate is not NULL" );
       
   506         QString dateStringValue = date.toString(dateFormat);
       
   507         datestring = hbTrId(GLX_DETAILS_DATE).arg(dateStringValue);
       
   508         }
       
   509 
       
   510     mDateLabel->setPlainText(datestring);
       
   511 
       
   512     OstTraceFunctionExit0( GLXDETAILSVIEW_SETDATE_EXIT );
       
   513     }
       
   514 
       
   515 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   516 //setTime
       
   517 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   518 void GlxDetailsView::setTime()
       
   519     {
       
   520     QString timestring;
       
   521     QString timeFormat("h:m ap");
       
   522     QTime timevalue = (mModel->data(mModel->index(mModel->data(mModel->index(
       
   523             0, 0), GlxFocusIndexRole).value<int> (), 0), GlxTimeRole)).value<
       
   524             QTime> ();
       
   525         
       
   526     if (timevalue.isNull() == FALSE)
       
   527         {
       
   528         QString timeStringValue = timevalue.toString(timeFormat);
       
   529         timestring = hbTrId(GLX_DETAILS_TIME).arg(timeStringValue);
       
   530         }
       
   531      mTimeLabel->setPlainText(timestring);
       
   532     }
       
   533 
       
   534 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   535 //setSize
       
   536 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   537 void GlxDetailsView::setSize()
       
   538     {
       
   539     int size = 0;
       
   540     size = (mModel->data(mModel->index(mModel->data(mModel->index(0, 0),
       
   541             GlxFocusIndexRole).value<int> (), 0), GlxSizeRole)).value<int> ();
       
   542     
       
   543     QString sizeString;
       
   544     sizeString = sizeinStrings(size);
       
   545     mSizeLabel->setPlainText(sizeString);
       
   546     
       
   547    }
       
   548 
       
   549 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   550 //dataChanged
       
   551 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   552 void GlxDetailsView::dataChanged(QModelIndex startIndex, QModelIndex endIndex)
       
   553     {
       
   554     Q_UNUSED(endIndex);
       
   555 
       
   556     QVariant variant = mFavModel->data(startIndex, GlxFavorites);
       
   557     if (variant.isValid() && variant.canConvert<bool> ())
       
   558         {
       
   559         if (variant.value<bool> ())
       
   560             {
       
   561             mFavIcon->setItemIcon(mFavIconEnabled);
       
   562             }
       
   563         else
       
   564             {
       
   565             mFavIcon->setItemIcon(mFavIconDisabled);
       
   566             }
       
   567         }
       
   568     }
       
   569 
       
   570 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   571 //UpdateDescription
       
   572 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   573 void GlxDetailsView::UpdateDescription()
       
   574     {
       
   575     GLX_LOG_INFO("GlxDetailsView::UpdateDescription ");
       
   576     qDebug("GlxDetailsView::UpdateDescription");
       
   577     emit actionTriggered(EGlxCmdComment);
       
   578     }
       
   579 
       
   580 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   581 //updateFavourites
       
   582 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   583 void GlxDetailsView::updateFavourites()
       
   584     {
       
   585     QVariant variant = mFavModel->data(mFavModel->index(0, 0), GlxFavorites);
       
   586     if (variant.isValid() && variant.canConvert<bool> ())
       
   587         {
       
   588         if (variant.value<bool> ())
       
   589             {
       
   590             emit actionTriggered(EGlxCmdRemoveFromFav);
       
   591             }
       
   592         else
       
   593             {
       
   594             emit actionTriggered(EGlxCmdAddToFav);
       
   595             }
       
   596         }
       
   597     }
       
   598 
       
   599 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   600 //sizeinStrings
       
   601 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   602 QString GlxDetailsView::sizeinStrings(int size)
       
   603     {
       
   604     QString sizeString;
       
   605     if (size >= KBytesInGB)
       
   606         {
       
   607         int gbSize = size / KBytesInGB; // Size in GB
       
   608         sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_GB, gbSize);         
       
   609         }
       
   610     else if (size >= KBytesInMB)
       
   611         {
       
   612         int mbSize = size / KBytesInMB; // Size in MB
       
   613         sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_MB, mbSize);         
       
   614         }
       
   615     else if (size >= KBytesInKB)
       
   616         {
       
   617         int kbSize = size / KBytesInKB; // Size in KB
       
   618         sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_KB, kbSize);
       
   619         }
       
   620     else
       
   621         {
       
   622          sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_BYTES, size);
       
   623         }
       
   624     return sizeString;
       
   625     }
       
   626 
       
   627 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   628 //getSubState
       
   629 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   630 int GlxDetailsView::getSubState()
       
   631   {
       
   632     int substate = NO_DETAIL_S;
       
   633 
       
   634     if (mModel) {
       
   635       QVariant variant = mModel->data(mModel->index(0, 0), GlxSubStateRole);
       
   636 
       
   637       if (variant.isValid() && variant.canConvert<int> ()) {
       
   638            substate = variant.value<int> ();
       
   639       }
       
   640     } 
       
   641     return substate;
       
   642  }