ui/views/detailsview/src/glxdetailsview.cpp
changeset 48 d0b4e67b3a60
parent 36 6481344a6d67
child 45 863223ea6961
equal deleted inserted replaced
36:6481344a6d67 48:d0b4e67b3a60
    14  * Description:   ?Description
    14  * Description:   ?Description
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 //--------------------------------------------------------------------------------------------------------------------------------------------
    18 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    19 
       
    20 
    19 #include <QModelIndex>
    21 #include <QModelIndex>
    20 #include <qdatetime.h>
    22 #include <qdatetime.h>
    21 
    23 #include <QDebug>
    22 //--------------------------------------------------------------------------------------------------------------------------------------------
    24 #include <HbAnchorLayout.h>
       
    25 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    26 
    23 #include <hblabel.h>
    27 #include <hblabel.h>
    24 #include <hbdataform.h>
    28 #include <hbdataform.h>
    25 #include <hbinstance.h>
    29 #include <hbinstance.h>
    26 #include <hbiconitem.h>
    30 #include <hbiconitem.h>
    27 #include <hblineedit.h>
    31 #include <hbframeitem.h>
       
    32 #include <hbpushbutton.h>
    28 #include <hbdataformmodel.h>
    33 #include <hbdataformmodel.h>
       
    34 #include <hbdocumentloader.h>
    29 #include <hbdataformmodelitem.h>
    35 #include <hbdataformmodelitem.h>
    30 #include <hbdataformviewitem.h>
    36 #include <hbdataformviewitem.h>
    31 
    37 
    32 //--------------------------------------------------------------------------------------------------------------------------------------------
    38 //--------------------------------------------------------------------------------------------------------------------------------------------
    33 #include "glxviewids.h"
    39 #include "glxviewids.h"
    34 #include "glxicondefs.h" //Contains the icon names/Ids
    40 #include "glxicondefs.h" //Contains the icon names/Ids
    35 #include "glxmodelparm.h"
    41 #include "glxmodelparm.h"
       
    42 #include "glxmediamodel.h"
    36 #include "glxdetailsview.h"
    43 #include "glxdetailsview.h"
    37 #include "glxfavmediamodel.h"
    44 #include "glxfavmediamodel.h"
       
    45 #include "glxdocloaderdefs.h"
    38 #include <glxcommandhandlers.hrh>
    46 #include <glxcommandhandlers.hrh>
    39 #include "glxdetailscustomicon.h"
    47 #include "glxdetailsdescriptionedit.h"
    40 #include "glxdetailscustomwidgets.h"
    48 #include "glxdetailsnamelabel.h"
       
    49 
       
    50 
       
    51 #include "glxviewdocloader.h"
    41 #include <glxcollectionpluginalbums.hrh>
    52 #include <glxcollectionpluginalbums.hrh>
       
    53 
       
    54 #include "glxlog.h"
       
    55 #include "glxloggerenabler.h"
    42 
    56 
    43 
    57 
    44 #include "OstTraceDefinitions.h"
    58 #include "OstTraceDefinitions.h"
    45 #ifdef OST_TRACE_COMPILER_IN_USE
    59 #ifdef OST_TRACE_COMPILER_IN_USE
    46 #include "glxdetailsviewTraces.h"
    60 #include "glxdetailsviewTraces.h"
    47 #endif
    61 #endif
    48 
    62 
    49 
       
    50 //SIZE OF THE IMAGE , LAYOUTS TEAM NEED TO GIVER THE SIZE IN UNITS
    63 //SIZE OF THE IMAGE , LAYOUTS TEAM NEED TO GIVER THE SIZE IN UNITS
    51 #define GLX_IMAGE_SIZE 215 
    64 #define GLX_IMAGE_SIZE 215 
       
    65 const int KBytesInKB = 1024;
       
    66 const int KBytesInMB = 1024 * 1024;
       
    67 const int KBytesInGB = 1024 * 1024 * 1024;
    52 
    68 
    53 //--------------------------------------------------------------------------------------------------------------------------------------------
    69 //--------------------------------------------------------------------------------------------------------------------------------------------
    54 //GlxDetailsView
    70 //GlxDetailsView
    55 //--------------------------------------------------------------------------------------------------------------------------------------------
    71 //--------------------------------------------------------------------------------------------------------------------------------------------
    56 GlxDetailsView::GlxDetailsView(HbMainWindow *window) :  
    72 GlxDetailsView::GlxDetailsView(HbMainWindow *window) :
    57     GlxView ( GLX_DETAILSVIEW_ID),
    73 GlxView(GLX_DETAILSVIEW_ID), mDetailsIcon(NULL), mFavIcon(NULL), mModel(
    58     mDetailsIcon(NULL),
    74         NULL), mFavModel(NULL), mWindow(window),
    59     mFavIcon(NULL),
    75         mSelIndex(0),mDescriptions(NULL),mDateLabel(NULL),mSizeLabel(NULL),mTimeLabel(NULL)
    60     mModel(NULL),
    76    {
    61     mFavModel(NULL),
    77     GLX_LOG_INFO("GlxDetailsView::GlxDetailsView");
    62     mDetailModel(NULL),
    78     OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY );
    63     mWindow(window), 
    79     setContentFullScreen(true);//for smooth transtion between grid to full screen and vice versa
    64     mDataForm(NULL),     
       
    65     mCustomPrototype(NULL),
       
    66     mSelIndex(0),
       
    67     mDateLabelItem(NULL),
       
    68     mImageLabelitem(NULL),
       
    69     mCommentsLabelitem(NULL)
       
    70         {
       
    71     OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY );    
       
    72     setContentFullScreen( true );//for smooth transtion between grid to full screen and vice versa
       
    73     OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT );
    80     OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT );
    74         }
    81    }
       
    82 
       
    83 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    84 //~GlxDetailsView
       
    85 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    86 GlxDetailsView::~GlxDetailsView()
       
    87     {
       
    88     OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" );
       
    89     
       
    90     delete mDocLoader;
       
    91     mDocLoader = NULL;
       
    92     
       
    93     cleanUp();
       
    94     }
    75 
    95 
    76 //--------------------------------------------------------------------------------------------------------------------------------------------
    96 //--------------------------------------------------------------------------------------------------------------------------------------------
    77 //activate
    97 //activate
    78 //--------------------------------------------------------------------------------------------------------------------------------------------
    98 //--------------------------------------------------------------------------------------------------------------------------------------------
    79 void GlxDetailsView::activate()
    99 void GlxDetailsView::activate()
    80     {
   100     {
    81     OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY );
   101     OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY );
    82     setFormData();    
   102     //create and set the Favourite Model
    83     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
   103     setFavModel();
    84     connect(mFavIcon,SIGNAL(updateFavourites()),this ,SLOT(updateFavourites()));
   104     
       
   105     //fill the data
       
   106     FillDetails();
       
   107     
       
   108     //Initialze the Model
       
   109     initializeNewModel();
       
   110     
       
   111     //make the connections
       
   112     setConnections();
       
   113         
       
   114     //Set context mode to fetch descriptions
       
   115     mModel->setData(QModelIndex(), (int) GlxContextComment, GlxContextRole);    
       
   116     
    85     OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT );
   117     OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT );
    86     }
   118     }
    87 
   119 
    88 //--------------------------------------------------------------------------------------------------------------------------------------------
   120 //--------------------------------------------------------------------------------------------------------------------------------------------
    89 //initializeView
   121 //initializeView
    90 //--------------------------------------------------------------------------------------------------------------------------------------------
   122 //--------------------------------------------------------------------------------------------------------------------------------------------
    91 void GlxDetailsView::initializeView(QAbstractItemModel *model)
   123 void GlxDetailsView::initializeView(QAbstractItemModel *model)
    92     {   
   124     {
    93     OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
   125     OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
    94 
   126     bool loaded = false;
    95     //To show the thumbnail 
   127     
    96     if ( mDataForm == NULL) {
   128     if(mDocLoader)
    97     mDataForm = new HbDataForm(this);
   129         {
    98     mDetailModel = new HbDataFormModel();
   130          mDocLoader = new GlxDetailsViewDocLoader();
    99 
   131         }
   100     //custom prototype
   132     
   101     mCustomPrototype = new GlxDetailsCustomWidgets(mDataForm);           
   133     //Load the docml
   102     QList <HbAbstractViewItem*> protos = mDataForm->itemPrototypes();
   134     mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded);     
   103     protos.append(mCustomPrototype);
   135     
   104     mDataForm->setItemPrototypes(protos);
   136     HbView *mView = static_cast<HbView*> (mDocLoader->findWidget(
   105 
   137             GLX_DETAILSVIEW_VIEW));
   106     //Add the Widgets according to the mime type
   138     
   107     addWidgets();
   139     HbWidget *mwidget = static_cast<HbWidget*> (mDocLoader->findWidget(
   108     }   
   140             "MainWidget"));
   109 
   141 
   110     if( mDetailsIcon == NULL) {
   142     mDetailsIcon = static_cast<HbLabel*> (mDocLoader->findWidget(
   111     mDetailsIcon = new HbIconItem(this);
   143             GLX_DETAILSVIEW_IMAGE));
   112     mFavIcon = new GlxDetailsCustomIcon(this);
   144     mFavIcon = static_cast<HbPushButton*> (mDocLoader->findWidget(
   113     }
   145             GLX_DETAILSVIEW_FAVICON));
       
   146 
       
   147     mDescriptions = static_cast<GlxDetailsDescriptionEdit*> (mDocLoader->findWidget(
       
   148             GLX_DETAILSVIEW_DESCRPTIONTEXT));
       
   149     
       
   150     mImageName = static_cast<GlxDetailsNameLabel*> (mDocLoader->findWidget(
       
   151             GLX_DETAILSVIEW_IMGNAME));
       
   152     
       
   153     mDateLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
       
   154             GLX_DETAILSVIEW_DATETEXT));
       
   155     
       
   156     mTimeLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
       
   157             GLX_DETAILSVIEW_TIMETEXT));
       
   158     
       
   159     mSizeLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
       
   160             GLX_DETAILSVIEW_SIZETEXT));
       
   161 
       
   162     //set the frame graphics to the background of the fav icon
       
   163     HbFrameItem* frame = new HbFrameItem(this);
       
   164     frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
   165     frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
       
   166     frame->graphicsItem()->setOpacity(0.2);
       
   167     mFavIcon->setBackgroundItem(frame->graphicsItem(), -1);
       
   168     mFavIcon->setBackground(HbIcon("qtg_fr_multimedia_trans"));
       
   169     mFavIcon->setIcon(HbIcon(GLXICON_REMOVE_FAV));
       
   170     
       
   171     setWidget(mView);
   114 
   172 
   115     //Set the Model
   173     //Set the Model
   116     mModel = model;
   174     mModel = model;  
   117     initializeNewModel();
       
   118 
   175 
   119     //Set the Layout Correspondingly.
   176     //Set the Layout Correspondingly.
   120     updateLayout(mWindow->orientation());
   177     updateLayout(mWindow->orientation());
   121 
   178 
   122     //Shows the Image 
   179     //Shows the Image 
   123     showImage(); 
   180     showImage();
   124     OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT );
   181     OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT );
   125     }
   182     }
   126 
   183 
   127 //--------------------------------------------------------------------------------------------------------------------------------------------
   184 //--------------------------------------------------------------------------------------------------------------------------------------------
   128 //resetView
   185 //resetView
   129 //--------------------------------------------------------------------------------------------------------------------------------------------
   186 //--------------------------------------------------------------------------------------------------------------------------------------------
   130 void GlxDetailsView::resetView()
   187 void GlxDetailsView::resetView()
   131     {
   188     {
   132     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_RESETVIEW, "GlxDetailsView::resetView" );   
   189     GLX_LOG_INFO("GlxDetailsView::resetView");
       
   190     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_RESETVIEW, "GlxDetailsView::resetView" );
   133     }
   191     }
   134 
   192 
   135 //--------------------------------------------------------------------------------------------------------------------------------------------
   193 //--------------------------------------------------------------------------------------------------------------------------------------------
   136 //deActivate
   194 //deActivate
   137 //--------------------------------------------------------------------------------------------------------------------------------------------
   195 //--------------------------------------------------------------------------------------------------------------------------------------------
   138 void GlxDetailsView::deActivate()
   196 void GlxDetailsView::deActivate()
   139     { 
   197     {
       
   198     GLX_LOG_INFO("GlxDetailsView::deActivate");
   140     OstTraceFunctionEntry0( GLXDETAILSVIEW_DEACTIVATE_ENTRY );
   199     OstTraceFunctionEntry0( GLXDETAILSVIEW_DEACTIVATE_ENTRY );
   141     cleanUp();      
   200 
       
   201     //Remove the context created to update details
       
   202     mModel->setData(QModelIndex(), (int) GlxContextComment,
       
   203             GlxRemoveContextRole);
       
   204     cleanUp();
       
   205     
   142     OstTraceFunctionExit0( GLXDETAILSVIEW_DEACTIVATE_EXIT );
   206     OstTraceFunctionExit0( GLXDETAILSVIEW_DEACTIVATE_EXIT );
   143     }
   207     }
   144 
   208 
   145 //--------------------------------------------------------------------------------------------------------------------------------------------
   209 //--------------------------------------------------------------------------------------------------------------------------------------------
   146 //cleanUp
   210 //cleanUp
   148 void GlxDetailsView::cleanUp()
   212 void GlxDetailsView::cleanUp()
   149     {
   213     {
   150     clearCurrentModel();
   214     clearCurrentModel();
   151 
   215 
   152     //clear the connections
   216     //clear the connections
   153     if(mWindow) {
   217     clearConnections();   
   154     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
       
   155     }
       
   156 
       
   157     if(mFavModel) {
       
   158     disconnect( mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) );
       
   159     }
       
   160 
       
   161     if(mFavIcon) {
       
   162     disconnect(mFavIcon,SIGNAL(updateFavourites()),this ,SLOT(updateFavourites()));
       
   163     }
       
   164 
   218 
   165     delete mFavModel;
   219     delete mFavModel;
   166     mFavModel = NULL;
   220     mFavModel = NULL;
   167 
   221 
   168     delete mFavIcon;
   222     delete mFavIcon;
   169     mFavIcon = NULL;
   223     mFavIcon = NULL;
   170 
   224 
   171     delete mDetailsIcon;
   225     delete mDetailsIcon;
   172     mDetailsIcon = NULL;    
   226     mDetailsIcon = NULL;
   173     }  
       
   174 
       
   175 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   176 //~GlxDetailsView
       
   177 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   178 GlxDetailsView::~GlxDetailsView()
       
   179     {
       
   180     OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" );
       
   181 
       
   182     cleanUp();     
       
   183 
       
   184     if(mDetailModel) {
       
   185       delete mDetailModel;
       
   186       mDataForm->setModel(0);
       
   187     }
       
   188 
       
   189     if(mDataForm) {
       
   190     delete mDataForm;
       
   191     mDataForm = NULL;
       
   192     }       
       
   193     }
       
   194 
       
   195 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   196 //addWidgets
       
   197 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   198 void GlxDetailsView::addWidgets()
       
   199     {
       
   200     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets create Form" );
       
   201 
       
   202     //----------------------------START OF CREATION OF WIDGETS---------------------------------//
       
   203     // To add new widgets in the details view, add it here.
       
   204 
       
   205     //---------------------------IMAGE NAME LABEL --------------------------------------------//
       
   206     OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets create Image Label" );
       
   207     mImageLabelitem = mDetailModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString("Name"), NULL);
       
   208 
       
   209     //---------------------------DATE LABEL --------------------------------------------//
       
   210     OstTrace0( TRACE_NORMAL, DUP2_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets date label" );
       
   211     mDateLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(DateLabelItem), QString("Date"), NULL);
       
   212 
       
   213 
       
   214     //----------------------------COMMENTS TEXT ITEM---------------------------------------------//
       
   215     OstTrace0( TRACE_NORMAL, DUP5_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets comment text" );
       
   216     mCommentsLabelitem = mDetailModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString("Description"), NULL);
       
   217 
       
   218     //----------------------------END OF CREATION OF WIDGETS-------------------------------------//
       
   219 
       
   220     //Set the model to the Data Form
       
   221     mDataForm->setModel(mDetailModel);
       
   222     }
       
   223 
       
   224 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   225 //setFavModel
       
   226 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   227 void GlxDetailsView::setFavModel()
       
   228     {
       
   229     GlxModelParm modelParm;
       
   230 
       
   231     QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
       
   232 
       
   233     if(mFavModel == NULL) {
       
   234     modelParm.setCollection( KGlxCollectionPluginFavoritesAlbumId );
       
   235     modelParm.setContextMode(GlxContextFavorite);
       
   236     modelParm.setPath(imagePath);
       
   237     mFavModel = new GlxFavMediaModel( modelParm );
       
   238     }
       
   239     QString imageName = imagePath.section('\\',-1);
       
   240     connect( mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) );   
       
   241     }
   227     }
   242 
   228 
   243 //--------------------------------------------------------------------------------------------------------------------------------------------
   229 //--------------------------------------------------------------------------------------------------------------------------------------------
   244 //setModel
   230 //setModel
   245 //--------------------------------------------------------------------------------------------------------------------------------------------
   231 //--------------------------------------------------------------------------------------------------------------------------------------------
   246 void GlxDetailsView::setModel(QAbstractItemModel *model)
   232 void GlxDetailsView::setModel(QAbstractItemModel *model)
   247     {
   233     {
   248     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" );
   234     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" );
   249     if ( mModel == model ) {
   235     if (mModel == model)
   250     return ;
   236         {
   251     }
   237         return;
       
   238         }
   252     clearCurrentModel();
   239     clearCurrentModel();
   253     mModel = model;
   240     mModel = model;
   254     initializeNewModel();
   241     initializeNewModel();
   255     }
   242     }
   256 
   243 
   257 //--------------------------------------------------------------------------------------------------------------------------------------------
   244 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   245 //setFavModel
       
   246 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   247 void GlxDetailsView::setFavModel()
       
   248 {
       
   249     GlxModelParm modelParm;
       
   250     QString imagePath = (mModel->data(mModel->index(mModel->data(
       
   251             mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
       
   252             GlxUriRole)).value<QString> ();
       
   253 
       
   254     if (mFavModel == NULL)
       
   255         {
       
   256         modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId);
       
   257         modelParm.setContextMode(GlxContextFavorite);
       
   258         modelParm.setPath(imagePath);
       
   259         mFavModel = new GlxFavMediaModel(modelParm);
       
   260         }
       
   261 }
       
   262 
       
   263 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   264 //initializeNewModel
       
   265 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   266 void GlxDetailsView::initializeNewModel()
       
   267     {
       
   268     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" );
       
   269 
       
   270     if (mModel)
       
   271         {
       
   272     connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
       
   273             SLOT(rowsRemoved(QModelIndex,int,int)));
       
   274         }
       
   275     }
       
   276 
       
   277 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   278 //clearCurrentModel
       
   279 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   280 void GlxDetailsView::clearCurrentModel()
       
   281     {
       
   282     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" );
       
   283 
       
   284     if (mModel)
       
   285         {
       
   286         disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
       
   287                 SLOT(rowsRemoved(QModelIndex,int,int)));
       
   288         mModel = NULL;
       
   289         }
       
   290     }
       
   291 
       
   292 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   293 //setConnections
       
   294 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   295 void GlxDetailsView::setConnections()
       
   296     {
       
   297     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
       
   298             SLOT(updateLayout(Qt::Orientation)));
       
   299     connect(mFavIcon, SIGNAL(clicked()), this, SLOT(updateFavourites()));
       
   300     
       
   301     connect(mDescriptions, SIGNAL(labelPressed()), this,
       
   302             SLOT(UpdateDescription()));
       
   303     
       
   304     connect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() ));
       
   305     
       
   306     connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
       
   307                this, SLOT( dataChanged(QModelIndex,QModelIndex) ));    
       
   308     }
       
   309 
       
   310 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   311 //clearConnections
       
   312 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   313 void GlxDetailsView::clearConnections()
       
   314     {
       
   315     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
       
   316             SLOT(updateLayout(Qt::Orientation)));
       
   317     
       
   318     disconnect(mFavIcon, SIGNAL(clicked()), this, SLOT(updateFavourites()));
       
   319     
       
   320     disconnect(mDescriptions, SIGNAL(labelPressed()), this,
       
   321             SLOT(UpdateDescription()));
       
   322     
       
   323     disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() ));
       
   324     
       
   325     disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
       
   326                 this, SLOT( dataChanged(QModelIndex,QModelIndex) ));
       
   327     }
       
   328 
       
   329 //--------------------------------------------------------------------------------------------------------------------------------------------
   258 //getAnimationItem
   330 //getAnimationItem
   259 //--------------------------------------------------------------------------------------------------------------------------------------------
   331 //--------------------------------------------------------------------------------------------------------------------------------------------
   260 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
   332 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
   261     {
   333     {
   262     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" );
   334     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" );
   263     if ( transtionEffect == FULLSCREEN_TO_DETAIL
   335     if (transtionEffect == FULLSCREEN_TO_DETAIL || transtionEffect
   264             || transtionEffect == DETAIL_TO_FULLSCREEN ) {
   336             == DETAIL_TO_FULLSCREEN)
       
   337         {
   265     return this;
   338     return this;
   266     }
   339         }
   267     return NULL;    
   340     return NULL;
   268     }
   341     }
   269 
   342 
   270 //--------------------------------------------------------------------------------------------------------------------------------------------
   343 //--------------------------------------------------------------------------------------------------------------------------------------------
   271 //updateLayout
   344 //updateLayout
   272 //--------------------------------------------------------------------------------------------------------------------------------------------
   345 //--------------------------------------------------------------------------------------------------------------------------------------------
   273 void GlxDetailsView::updateLayout(Qt::Orientation orient)
   346 void GlxDetailsView::updateLayout(Qt::Orientation orient)
   274     {
   347     {
   275     OstTrace1( TRACE_NORMAL, GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout;orient=%d", orient );
   348     OstTrace1( TRACE_NORMAL, GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout;orient=%d", orient );
   276 
   349     GLX_LOG_INFO("GlxDetailsView::updateLayout ");
   277     qreal IconPosX = 0.0;
   350     bool loaded = false;
   278     qreal IconPosY = 0.0;
   351     QString section;
   279     qreal FavIconPosX = 0.0;
   352 
   280     qreal FavIconPosY = 0.0;
   353     //Load the widgets accroding to the current Orientation
   281     qreal DataFormX = 0.0;
   354     if (orient == Qt::Horizontal)
   282     qreal DataFormY = 0.0;
   355         {
   283     qreal DataFormWidth = 0.0;
   356         section = GLX_DETAILSVIEW_LSSECTION;
   284     qreal DataFormHeight = 0.0;
       
   285 
       
   286 
       
   287     qreal screenWidth = 0.0;
       
   288     qreal screenHeight = 0.0;
       
   289     qreal leftMargin = 0.0;
       
   290     qreal bottomMargin = 0.0;
       
   291     qreal screenMargin = 0.0;
       
   292     qreal favIconSize = 0.0;
       
   293     qreal chromeHeight = 0.0;
       
   294     qreal middleVerticalMargin = 0.0;
       
   295 
       
   296     style()->parameter("hb-param-screen-width", screenWidth);
       
   297     style()->parameter("hb-param-screen-height", screenHeight);
       
   298 
       
   299     style()->parameter("hb-param-margin-gene-middle-vertical", middleVerticalMargin);
       
   300     style()->parameter("hb-param-margin-gene-left", leftMargin);
       
   301     style()->parameter("hb-param-margin-gene-bottom", bottomMargin);
       
   302     style()->parameter("hb-param-margin-gene-screen", screenMargin);
       
   303 
       
   304     style()->parameter("hb-param-graphic-size-primary-small", favIconSize);
       
   305     style()->parameter("hb-param-widget-chrome-height", chromeHeight);
       
   306 
       
   307 
       
   308     if(orient == Qt::Horizontal)
       
   309         {
       
   310     OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout HORIZONTAL" );
       
   311     setGeometry(0,0,640,360);
       
   312     IconPosX    = screenMargin;
       
   313     IconPosY    = (screenMargin + chromeHeight);
       
   314     FavIconPosX = (IconPosX + GLX_IMAGE_SIZE - (favIconSize +10));
       
   315     FavIconPosY = (IconPosY + GLX_IMAGE_SIZE - (favIconSize + 10));
       
   316     DataFormX =  screenMargin + GLX_IMAGE_SIZE + leftMargin ;
       
   317     DataFormY =  screenMargin + chromeHeight ;
       
   318 
       
   319     //This Commented code should be un commented , once the screen width and height size issue is solved and also
       
   320     //the dataform issue of wrapping issue is solved
       
   321     // DataFormWidth =  screenWidth(640) - DataFormX  - screenMargin ;
       
   322     // DataFormHeight = screenHeight(360) - DataFormY - screenMargin ;
       
   323     DataFormWidth = screenWidth - (screenMargin  + screenMargin) ;
       
   324     DataFormHeight = screenHeight - DataFormY;
       
   325 
       
   326         }
   357         }
   327     else
   358     else
   328         {
   359         {
   329     OstTrace0( TRACE_NORMAL, DUP2_GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout VERTICAL" );
   360         section = GLX_DETAILSVIEW_PTSECTION;
   330     setGeometry(0,0,screenWidth,screenHeight);
   361         }
   331     IconPosX    = (screenWidth/2) - (GLX_IMAGE_SIZE/2);
   362 
   332     IconPosY    = (screenMargin + chromeHeight);
   363     //Load the Sections
   333     FavIconPosX = (IconPosX + GLX_IMAGE_SIZE - (favIconSize +10));
   364     mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, section, &loaded);
   334     FavIconPosY = (IconPosY + GLX_IMAGE_SIZE - (favIconSize +10));
   365 
   335     DataFormX =  screenMargin;
   366     //This is just to over come the bug in docloader,once that is fixed we can remove the 
   336     DataFormY =  IconPosY + GLX_IMAGE_SIZE + middleVerticalMargin + bottomMargin ;
   367     //below lines of code
   337     DataFormWidth = screenWidth - (screenMargin  + screenMargin) ;
   368      setImageName();
   338     DataFormHeight = screenHeight - DataFormY;
   369      setDate();
   339         }
   370 
   340 
   371     GLX_LOG_INFO1("GlxDetailsView::updateLayout =%d\n",loaded);
   341     mDetailsIcon->setPos(IconPosX,IconPosY);
       
   342     //The Numerical should be updated once we get the parameters size from the layouts.
       
   343     mFavIcon->setItemGeometry(QRect(FavIconPosX-2 ,FavIconPosY-2 ,favIconSize+12,favIconSize + 12)) ;
       
   344     //Place the FavIcon with respect to the Widget.
       
   345     mFavIcon->setItemPos(2 ,2 );
       
   346     mDataForm->setGeometry(DataFormX,DataFormY,DataFormWidth,DataFormHeight);    
       
   347     }
   372     }
   348 
   373 
   349 //--------------------------------------------------------------------------------------------------------------------------------------------
   374 //--------------------------------------------------------------------------------------------------------------------------------------------
   350 //rowsRemoved
   375 //rowsRemoved
   351 //--------------------------------------------------------------------------------------------------------------------------------------------
   376 //--------------------------------------------------------------------------------------------------------------------------------------------
   352 void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start, int end)
   377 void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start,
       
   378         int end)
   353     {
   379     {
   354     Q_UNUSED(parent);
   380     Q_UNUSED(parent);
   355     Q_UNUSED(start);
   381     Q_UNUSED(start);
   356     Q_UNUSED(end);
   382     Q_UNUSED(end);
   357     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ROWSREMOVED, "GlxDetailsView::rowsRemoved" );
   383     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ROWSREMOVED, "GlxDetailsView::rowsRemoved" );
   358 
   384 
   359     if ( mModel->rowCount() <= 0 ) {
   385     if (mModel->rowCount() <= 0)
   360     return emit actionTriggered( EGlxCmdEmptyData );
   386         {
   361     }
   387         return emit actionTriggered(EGlxCmdEmptyData);
   362 
   388         }
   363     if ( start <= mSelIndex && end >= mSelIndex ) {
   389 
   364     return emit actionTriggered( EGlxCmdBack );
   390     if (start <= mSelIndex && end >= mSelIndex)
   365     }
   391         {
   366     }
   392         return emit actionTriggered(EGlxCmdBack);
   367 
   393         }
   368 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   369 //showImage
       
   370 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   371 void GlxDetailsView::showImage()
       
   372     {
       
   373     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" );
       
   374 
       
   375     QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
       
   376     if ( variant.isValid() &&  variant.canConvert<int> () ) {
       
   377     mSelIndex = variant.value<int>();  
       
   378     }
       
   379 
       
   380     variant = mModel->data( mModel->index( mSelIndex ,0), GlxFsImageRole);
       
   381     if ( variant.isValid() &&  variant.canConvert<HbIcon> () )
       
   382         {
       
   383         QIcon itemIcon = variant.value<HbIcon>().qicon();
       
   384         QPixmap itemPixmap = itemIcon.pixmap(GLX_IMAGE_SIZE,GLX_IMAGE_SIZE);
       
   385         QSize sz(GLX_IMAGE_SIZE,GLX_IMAGE_SIZE);
       
   386         itemPixmap = itemPixmap.scaled(sz, Qt::IgnoreAspectRatio );
       
   387     
       
   388     
       
   389         HbIcon tmp = HbIcon( QIcon(itemPixmap)) ;
       
   390         mDetailsIcon->setSize(QSize(GLX_IMAGE_SIZE, GLX_IMAGE_SIZE));
       
   391         mDetailsIcon->setIcon(tmp);
       
   392         mFavIcon->setItemIcon(HbIcon("qtg_graf_ratingslider_unrated"));
       
   393     
       
   394         qreal favIconSize = 0.0;
       
   395         style()->parameter("hb-param-graphic-size-primary-small", favIconSize);
       
   396         mFavIcon->setItemSize(QSize(favIconSize+10, favIconSize+10));
       
   397         }        
       
   398     }
   394     }
   399 
   395 
   400 //--------------------------------------------------------------------------------------------------------------------------------------------
   396 //--------------------------------------------------------------------------------------------------------------------------------------------
   401 //FillData
   397 //FillData
   402 //--------------------------------------------------------------------------------------------------------------------------------------------
   398 //--------------------------------------------------------------------------------------------------------------------------------------------
   403 void GlxDetailsView::setFormData()
   399 void GlxDetailsView::FillDetails()
   404     {
   400     {
   405     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETFORMDATA, "GlxDetailsView::setFormData" );
   401     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETFORMDATA, "GlxDetailsView::setFormData" );
   406 
   402 
   407     //create and set the Favourite Model
   403     qDebug("GlxDetailsView::FillDetails");
   408     setFavModel();
       
   409 
       
   410     //Call to set the Image Name
   404     //Call to set the Image Name
   411     setImageName();
   405     setImageName();
   412 
   406 
       
   407     //Call to set the description
       
   408     setDesc();
       
   409 
   413     //Call to set the date in the from
   410     //Call to set the date in the from
   414     setDate();
   411     setDate();
       
   412 
       
   413     //Call to set the time
       
   414     setTime();
       
   415 
       
   416     //Call to set the size
       
   417     setSize();
       
   418 
       
   419     }
       
   420 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   421 //showImage
       
   422 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   423 void GlxDetailsView::showImage()
       
   424     {
       
   425     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" );
       
   426 
       
   427     QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole);
       
   428     if (variant.isValid() && variant.canConvert<int> ())
       
   429         {
       
   430         mSelIndex = variant.value<int> ();
       
   431         }
       
   432 
       
   433     variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole);
       
   434     if (variant.isValid() && variant.canConvert<HbIcon> ())
       
   435         {
       
   436         QIcon itemIcon = variant.value<HbIcon> ().qicon();
       
   437         QPixmap itemPixmap = itemIcon.pixmap(GLX_IMAGE_SIZE, GLX_IMAGE_SIZE);
       
   438         QSize sz(GLX_IMAGE_SIZE, GLX_IMAGE_SIZE);
       
   439         itemPixmap = itemPixmap.scaled(sz, Qt::IgnoreAspectRatio);
       
   440 
       
   441         HbIcon tmp = HbIcon(QIcon(itemPixmap));
       
   442         mDetailsIcon->setIcon(tmp);
       
   443         }
   415     }
   444     }
   416 
   445 
   417 //--------------------------------------------------------------------------------------------------------------------------------------------
   446 //--------------------------------------------------------------------------------------------------------------------------------------------
   418 //setImageName
   447 //setImageName
   419 //--------------------------------------------------------------------------------------------------------------------------------------------
   448 //--------------------------------------------------------------------------------------------------------------------------------------------
   420 void GlxDetailsView::setImageName()
   449 void GlxDetailsView::setImageName()
   421     {
   450     {
   422     OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY );
   451     OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY );
   423 
   452     QString temp = "<u>";
   424     QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
   453     QString imagePath = (mModel->data(mModel->index(mModel->data(
   425     QString imageName = imagePath.section('\\',-1);
   454             mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
   426 
   455             GlxUriRole)).value<QString> ();
   427     mImageLabelitem->setContentWidgetData("text",imageName);
   456     QString imageName = imagePath.section('\\', -1);
       
   457     
       
   458     temp.append(imageName);
       
   459     temp.append("</u>");
       
   460     mImageName->setItemText(temp);    
   428     OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT );
   461     OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT );
   429     }
   462     }
   430 
   463 
   431 //--------------------------------------------------------------------------------------------------------------------------------------------
   464 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   465 //setImageName
       
   466 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   467 void GlxDetailsView::setDesc()
       
   468     {
       
   469     QString description = (mModel->data(mModel->index(mModel->data(
       
   470             mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
       
   471             GlxDescRole)).value<QString> ();
       
   472     mDescriptions->setItemText(description);
       
   473     }
       
   474 
       
   475 //--------------------------------------------------------------------------------------------------------------------------------------------
   432 //setDate
   476 //setDate
   433 //--------------------------------------------------------------------------------------------------------------------------------------------
   477 //--------------------------------------------------------------------------------------------------------------------------------------------
   434 void GlxDetailsView::setDate()
   478 void GlxDetailsView::setDate()
   435     {
   479     {
   436     OstTraceFunctionEntry0( GLXDETAILSVIEW_SETDATE_ENTRY );
   480     OstTraceFunctionEntry0( GLXDETAILSVIEW_SETDATE_ENTRY );
   437 
   481 
   438     QString datestring;
   482     QString datestring;
   439     QString str("dd.MM.yyyy");
   483     QString dateFormat("dd.MM.yyyy");
   440     QDate date = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxDateRole)).value<QDate>();
   484     QDate date = (mModel->data(mModel->index(mModel->data(
   441 
   485             mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
   442     if(date.isNull() == FALSE )
   486             GlxDateRole)).value<QDate> ();
   443         {
   487     
   444     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setDate is not NULL" );
   488     datestring = QString("Date: ");
   445     datestring = date.toString(str);
   489     if (date.isNull() == FALSE)
   446         }
   490         {
   447 
   491         OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setDate is not NULL" );
   448     mDateLabelItem->setContentWidgetData("plainText",datestring);
   492         datestring.append(date.toString(dateFormat));
       
   493         }
       
   494 
       
   495     mDateLabel->setPlainText(datestring);
   449 
   496 
   450     OstTraceFunctionExit0( GLXDETAILSVIEW_SETDATE_EXIT );
   497     OstTraceFunctionExit0( GLXDETAILSVIEW_SETDATE_EXIT );
   451     }
   498     }
   452 
   499 
   453 //--------------------------------------------------------------------------------------------------------------------------------------------
   500 //--------------------------------------------------------------------------------------------------------------------------------------------
   454 //initializeNewModel
   501 //setTime
   455 //--------------------------------------------------------------------------------------------------------------------------------------------
   502 //--------------------------------------------------------------------------------------------------------------------------------------------
   456 void GlxDetailsView::initializeNewModel()
   503 void GlxDetailsView::setTime()
   457     {
   504     {
   458     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" );
   505     QString timestring;
   459 
   506     QString timeFormat("h:m ap");
   460     if ( mModel ) {
   507     QTime timevalue = (mModel->data(mModel->index(mModel->data(mModel->index(
   461     connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   508             0, 0), GlxFocusIndexRole).value<int> (), 0), GlxTimeRole)).value<
   462     }
   509             QTime> ();
   463     }
   510     timestring = QString("Time: ");
   464 
   511     if (timevalue.isNull() == FALSE)
   465 //--------------------------------------------------------------------------------------------------------------------------------------------
   512         {
   466 //clearCurrentModel
   513         OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setTime is not NULL" );
   467 //--------------------------------------------------------------------------------------------------------------------------------------------
   514         timestring.append(timevalue.toString(timeFormat));
   468 void GlxDetailsView::clearCurrentModel()
   515         }
   469     {
   516     mTimeLabel->setPlainText(timestring);
   470     OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" );
   517     }
   471 
   518 
   472     if ( mModel ) {
   519 //--------------------------------------------------------------------------------------------------------------------------------------------
   473     disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
   520 //setSize
   474     mModel = NULL ;
   521 //--------------------------------------------------------------------------------------------------------------------------------------------
   475     }    
   522 void GlxDetailsView::setSize()
   476     }
   523     {
       
   524     int size = 0;
       
   525     size = (mModel->data(mModel->index(mModel->data(mModel->index(0, 0),
       
   526             GlxFocusIndexRole).value<int> (), 0), GlxSizeRole)).value<int> ();
       
   527     QString sizelabel;
       
   528     QString sizestring;
       
   529     sizelabel = QString("Size  : ");
       
   530     sizestring = sizeinStrings(size);
       
   531     sizelabel.append(sizestring);
       
   532     mSizeLabel->setPlainText(sizelabel);
       
   533     
       
   534    }
   477 
   535 
   478 //--------------------------------------------------------------------------------------------------------------------------------------------
   536 //--------------------------------------------------------------------------------------------------------------------------------------------
   479 //dataChanged
   537 //dataChanged
   480 //--------------------------------------------------------------------------------------------------------------------------------------------
   538 //--------------------------------------------------------------------------------------------------------------------------------------------
   481 void GlxDetailsView::dataChanged(QModelIndex startIndex, QModelIndex endIndex)
   539 void GlxDetailsView::dataChanged(QModelIndex startIndex, QModelIndex endIndex)
   482     {
   540     {
   483     Q_UNUSED(endIndex);      
   541     Q_UNUSED(endIndex);
   484  
   542 
   485     QVariant variant = mFavModel->data( startIndex, GlxFavorites );
   543     QVariant variant = mFavModel->data(startIndex, GlxFavorites);
   486     if ( variant.isValid() &&  variant.canConvert<bool> () ) 
   544     if (variant.isValid() && variant.canConvert<bool> ())
   487         {
   545         {
   488         if(variant.value<bool>() )
   546         if (variant.value<bool> ())
   489             {  
   547             {
   490              mFavIcon->setItemIcon(HbIcon(GLXICON_ADD_TO_FAV));
   548             mFavIcon->setIcon(HbIcon(GLXICON_ADD_TO_FAV));
   491             }
   549             }
   492         else 
   550         else
   493             {
   551             {
   494              mFavIcon->setItemIcon(HbIcon(GLXICON_REMOVE_FAV));
   552             mFavIcon->setIcon(HbIcon(GLXICON_REMOVE_FAV));
   495             }
   553             }
   496         }
   554         }
   497     }
   555     }
   498 
   556 
   499 //--------------------------------------------------------------------------------------------------------------------------------------------
   557 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   558 //UpdateDescription
       
   559 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   560 void GlxDetailsView::UpdateDescription()
       
   561     {
       
   562     GLX_LOG_INFO("GlxDetailsView::UpdateDescription ");
       
   563     qDebug("GlxDetailsView::UpdateDescription");
       
   564     emit actionTriggered(EGlxCmdComment);
       
   565     }
       
   566 
       
   567 //--------------------------------------------------------------------------------------------------------------------------------------------
   500 //updateFavourites
   568 //updateFavourites
   501 //--------------------------------------------------------------------------------------------------------------------------------------------
   569 //--------------------------------------------------------------------------------------------------------------------------------------------
   502 void GlxDetailsView::updateFavourites()
   570 void GlxDetailsView::updateFavourites()
   503     {
   571     {
   504     QVariant variant = mFavModel->data(mFavModel->index(0,0), GlxFavorites );
   572     QVariant variant = mFavModel->data(mFavModel->index(0, 0), GlxFavorites);
   505     if ( variant.isValid() &&  variant.canConvert<bool> ())
   573     if (variant.isValid() && variant.canConvert<bool> ())
   506         {
   574         {
   507         if(variant.value<bool>() )
   575         if (variant.value<bool> ())
   508             {
   576             {
   509              emit actionTriggered( EGlxCmdRemoveFromFav); 
   577             emit actionTriggered(EGlxCmdRemoveFromFav);
   510             }
   578             }
   511         else
   579         else
   512             {
   580             {
   513             emit actionTriggered(EGlxCmdAddToFav);
   581             emit actionTriggered(EGlxCmdAddToFav);
   514             }
   582             }
   515         }
   583         }
   516     }
   584     }
       
   585 
       
   586 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   587 //sizeinStrings
       
   588 //--------------------------------------------------------------------------------------------------------------------------------------------
       
   589 QString GlxDetailsView::sizeinStrings(int size)
       
   590     {
       
   591     QString sizeString;
       
   592     if (size >= KBytesInGB)
       
   593         {
       
   594         int gbSize = size / KBytesInGB; // Size in GB
       
   595         sizeString.setNum(gbSize);
       
   596         sizeString.append("GB");
       
   597         }
       
   598     else if (size >= KBytesInMB)
       
   599         {
       
   600         int mbSize = size / KBytesInMB; // Size in MB
       
   601         sizeString.setNum(mbSize);
       
   602         sizeString.append("MB");
       
   603         }
       
   604     else if (size >= KBytesInKB)
       
   605         {
       
   606         TInt kBsize = size / KBytesInKB; // bytes to kB
       
   607         sizeString.setNum(kBsize);
       
   608         sizeString.append("KB");
       
   609         }
       
   610     else
       
   611         {
       
   612         sizeString.setNum(size);
       
   613         sizeString.append("Bytes");
       
   614         }
       
   615     return sizeString;
       
   616     }