ui/views/detailsview/src/glxdetailsview.cpp
author hgs
Mon, 17 May 2010 13:35:26 +0530
changeset 42 5e1df1b52eb3
parent 40 112f0ac2d1f0
child 36 6481344a6d67
permissions -rw-r--r--
201019_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
40
hgs
parents: 26
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents: 26
diff changeset
     3
 * All rights reserved.
hgs
parents: 26
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents: 26
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents: 26
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents: 26
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents: 26
diff changeset
     8
 *
hgs
parents: 26
diff changeset
     9
 * Initial Contributors:
hgs
parents: 26
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents: 26
diff changeset
    11
 *
hgs
parents: 26
diff changeset
    12
 * Contributors:
hgs
parents: 26
diff changeset
    13
 *
hgs
parents: 26
diff changeset
    14
 * Description:   ?Description
hgs
parents: 26
diff changeset
    15
 *
hgs
parents: 26
diff changeset
    16
 */
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <QModelIndex>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <qdatetime.h>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
//--------------------------------------------------------------------------------------------------------------------------------------------
40
hgs
parents: 26
diff changeset
    23
#include <hblabel.h>
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <hbdataform.h>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <hbinstance.h>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <hbiconitem.h>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <hblineedit.h>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include <hbdataformmodel.h>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include <hbdataformmodelitem.h>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include <hbdataformviewitem.h>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
//--------------------------------------------------------------------------------------------------------------------------------------------
40
hgs
parents: 26
diff changeset
    33
#include "glxviewids.h"
hgs
parents: 26
diff changeset
    34
#include "glxicondefs.h" //Contains the icon names/Ids
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include "glxmodelparm.h"
40
hgs
parents: 26
diff changeset
    36
#include "glxmediamodel.h"
hgs
parents: 26
diff changeset
    37
#include "glxdetailsview.h"
hgs
parents: 26
diff changeset
    38
#include "glxfavmediamodel.h"
hgs
parents: 26
diff changeset
    39
#include <glxcommandhandlers.hrh>
hgs
parents: 26
diff changeset
    40
#include "glxdetailscustomicon.h"
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
#include "glxdetailscustomwidgets.h"
40
hgs
parents: 26
diff changeset
    42
#include <glxcollectionpluginalbums.hrh>
hgs
parents: 26
diff changeset
    43
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    45
#include "OstTraceDefinitions.h"
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    46
#ifdef OST_TRACE_COMPILER_IN_USE
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    47
#include "glxdetailsviewTraces.h"
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    48
#endif
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
40
hgs
parents: 26
diff changeset
    51
//SIZE OF THE IMAGE , LAYOUTS TEAM NEED TO GIVER THE SIZE IN UNITS
hgs
parents: 26
diff changeset
    52
#define GLX_IMAGE_SIZE 215 
hgs
parents: 26
diff changeset
    53
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
//GlxDetailsView
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
//--------------------------------------------------------------------------------------------------------------------------------------------
40
hgs
parents: 26
diff changeset
    57
GlxDetailsView::GlxDetailsView(HbMainWindow *window) :  
hgs
parents: 26
diff changeset
    58
    GlxView ( GLX_DETAILSVIEW_ID),
hgs
parents: 26
diff changeset
    59
    mDetailsIcon(NULL),
hgs
parents: 26
diff changeset
    60
    mFavIcon(NULL),
hgs
parents: 26
diff changeset
    61
    mModel(NULL),
hgs
parents: 26
diff changeset
    62
    mFavModel(NULL),
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    mDetailModel(NULL),
40
hgs
parents: 26
diff changeset
    64
    mWindow(window), 
hgs
parents: 26
diff changeset
    65
    mDataForm(NULL),     
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
    mCustomPrototype(NULL),
40
hgs
parents: 26
diff changeset
    67
    mSelIndex(0),
hgs
parents: 26
diff changeset
    68
    mDateLabelItem(NULL),
hgs
parents: 26
diff changeset
    69
    mImageLabelitem(NULL),
hgs
parents: 26
diff changeset
    70
    mCommentsLabelitem(NULL)
hgs
parents: 26
diff changeset
    71
        {
hgs
parents: 26
diff changeset
    72
    OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY );    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    setContentFullScreen( true );//for smooth transtion between grid to full screen and vice versa
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    74
    OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT );
40
hgs
parents: 26
diff changeset
    75
        }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
//activate
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
void GlxDetailsView::activate()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    81
    {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    82
    OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY );
40
hgs
parents: 26
diff changeset
    83
    setFormData();    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
    connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
40
hgs
parents: 26
diff changeset
    85
    connect(mFavIcon,SIGNAL(updateFavourites()),this ,SLOT(updateFavourites()));
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    86
    OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    87
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
//initializeView
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
void GlxDetailsView::initializeView(QAbstractItemModel *model)
40
hgs
parents: 26
diff changeset
    93
    {   
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    94
    OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
    //To show the thumbnail 
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    97
    if ( mDataForm == NULL) {
40
hgs
parents: 26
diff changeset
    98
    mDataForm = new HbDataForm(this);
hgs
parents: 26
diff changeset
    99
    mDetailModel = new HbDataFormModel();
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   100
40
hgs
parents: 26
diff changeset
   101
    //custom prototype
hgs
parents: 26
diff changeset
   102
    mCustomPrototype = new GlxDetailsCustomWidgets(mDataForm);           
hgs
parents: 26
diff changeset
   103
    QList <HbAbstractViewItem*> protos = mDataForm->itemPrototypes();
hgs
parents: 26
diff changeset
   104
    protos.append(mCustomPrototype);
hgs
parents: 26
diff changeset
   105
    mDataForm->setItemPrototypes(protos);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
40
hgs
parents: 26
diff changeset
   107
    //Add the Widgets according to the mime type
hgs
parents: 26
diff changeset
   108
    addWidgets();
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   109
    }   
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
40
hgs
parents: 26
diff changeset
   111
    if( mDetailsIcon == NULL) {
hgs
parents: 26
diff changeset
   112
    mDetailsIcon = new HbIconItem(this);
hgs
parents: 26
diff changeset
   113
    mFavIcon = new GlxDetailsCustomIcon(this);
hgs
parents: 26
diff changeset
   114
    }
hgs
parents: 26
diff changeset
   115
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    //Set the Model
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    mModel = model;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
    initializeNewModel();
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   119
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    //Set the Layout Correspondingly.
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
    updateLayout(mWindow->orientation());
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   122
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    //Shows the Image 
40
hgs
parents: 26
diff changeset
   124
    showImage(); 
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   125
    OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT );
40
hgs
parents: 26
diff changeset
   126
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
//resetView
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
void GlxDetailsView::resetView()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   132
    {
40
hgs
parents: 26
diff changeset
   133
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_RESETVIEW, "GlxDetailsView::resetView" );   
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   134
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
//deActivate
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
void GlxDetailsView::deActivate()
40
hgs
parents: 26
diff changeset
   140
    { 
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   141
    OstTraceFunctionEntry0( GLXDETAILSVIEW_DEACTIVATE_ENTRY );
40
hgs
parents: 26
diff changeset
   142
    cleanUp();      
hgs
parents: 26
diff changeset
   143
    OstTraceFunctionExit0( GLXDETAILSVIEW_DEACTIVATE_EXIT );
hgs
parents: 26
diff changeset
   144
    }
hgs
parents: 26
diff changeset
   145
hgs
parents: 26
diff changeset
   146
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   147
//cleanUp
hgs
parents: 26
diff changeset
   148
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   149
void GlxDetailsView::cleanUp()
hgs
parents: 26
diff changeset
   150
    {
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    clearCurrentModel();
40
hgs
parents: 26
diff changeset
   152
hgs
parents: 26
diff changeset
   153
    //clear the connections
hgs
parents: 26
diff changeset
   154
    if(mWindow) {
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
    disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(updateLayout(Qt::Orientation)));
40
hgs
parents: 26
diff changeset
   156
    }
hgs
parents: 26
diff changeset
   157
hgs
parents: 26
diff changeset
   158
    if(mFavModel) {
hgs
parents: 26
diff changeset
   159
    disconnect( mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) );
hgs
parents: 26
diff changeset
   160
    }
hgs
parents: 26
diff changeset
   161
hgs
parents: 26
diff changeset
   162
    if(mFavIcon) {
hgs
parents: 26
diff changeset
   163
    disconnect(mFavIcon,SIGNAL(updateFavourites()),this ,SLOT(updateFavourites()));
hgs
parents: 26
diff changeset
   164
    }
hgs
parents: 26
diff changeset
   165
hgs
parents: 26
diff changeset
   166
    delete mFavModel;
hgs
parents: 26
diff changeset
   167
    mFavModel = NULL;
hgs
parents: 26
diff changeset
   168
hgs
parents: 26
diff changeset
   169
    delete mFavIcon;
hgs
parents: 26
diff changeset
   170
    mFavIcon = NULL;
hgs
parents: 26
diff changeset
   171
hgs
parents: 26
diff changeset
   172
    delete mDetailsIcon;
hgs
parents: 26
diff changeset
   173
    mDetailsIcon = NULL;    
hgs
parents: 26
diff changeset
   174
    }  
hgs
parents: 26
diff changeset
   175
hgs
parents: 26
diff changeset
   176
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   177
//~GlxDetailsView
hgs
parents: 26
diff changeset
   178
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   179
GlxDetailsView::~GlxDetailsView()
hgs
parents: 26
diff changeset
   180
    {
hgs
parents: 26
diff changeset
   181
    OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" );
hgs
parents: 26
diff changeset
   182
hgs
parents: 26
diff changeset
   183
    cleanUp();     
hgs
parents: 26
diff changeset
   184
hgs
parents: 26
diff changeset
   185
    if(mDetailModel) {
hgs
parents: 26
diff changeset
   186
      delete mDetailModel;
hgs
parents: 26
diff changeset
   187
      mDataForm->setModel(0);
hgs
parents: 26
diff changeset
   188
    }
hgs
parents: 26
diff changeset
   189
hgs
parents: 26
diff changeset
   190
    if(mDataForm) {
hgs
parents: 26
diff changeset
   191
    delete mDataForm;
hgs
parents: 26
diff changeset
   192
    mDataForm = NULL;
hgs
parents: 26
diff changeset
   193
    }       
hgs
parents: 26
diff changeset
   194
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
//addWidgets
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
void GlxDetailsView::addWidgets()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
    {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   201
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets create Form" );
40
hgs
parents: 26
diff changeset
   202
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
    //----------------------------START OF CREATION OF WIDGETS---------------------------------//
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
    // To add new widgets in the details view, add it here.
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
40
hgs
parents: 26
diff changeset
   206
    //---------------------------IMAGE NAME LABEL --------------------------------------------//
hgs
parents: 26
diff changeset
   207
    OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets create Image Label" );
hgs
parents: 26
diff changeset
   208
    mImageLabelitem = mDetailModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString("Name"), NULL);
hgs
parents: 26
diff changeset
   209
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
    //---------------------------DATE LABEL --------------------------------------------//
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   211
    OstTrace0( TRACE_NORMAL, DUP2_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets date label" );
40
hgs
parents: 26
diff changeset
   212
    mDateLabelItem = mDetailModel->appendDataFormItem((HbDataFormModelItem::DataItemType)(DateLabelItem), QString("Date"), NULL);
hgs
parents: 26
diff changeset
   213
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
    //----------------------------COMMENTS TEXT ITEM---------------------------------------------//
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   216
    OstTrace0( TRACE_NORMAL, DUP5_GLXDETAILSVIEW_ADDWIDGETS, "GlxDetailsView::addWidgets comment text" );
40
hgs
parents: 26
diff changeset
   217
    mCommentsLabelitem = mDetailModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString("Description"), NULL);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
    //----------------------------END OF CREATION OF WIDGETS-------------------------------------//
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
    //Set the model to the Data Form
40
hgs
parents: 26
diff changeset
   222
    mDataForm->setModel(mDetailModel);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
40
hgs
parents: 26
diff changeset
   225
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   226
//setFavModel
hgs
parents: 26
diff changeset
   227
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   228
void GlxDetailsView::setFavModel()
hgs
parents: 26
diff changeset
   229
    {
hgs
parents: 26
diff changeset
   230
    GlxModelParm modelParm;
hgs
parents: 26
diff changeset
   231
hgs
parents: 26
diff changeset
   232
    QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
hgs
parents: 26
diff changeset
   233
hgs
parents: 26
diff changeset
   234
    if(mFavModel == NULL) {
hgs
parents: 26
diff changeset
   235
    modelParm.setCollection( KGlxCollectionPluginFavoritesAlbumId );
hgs
parents: 26
diff changeset
   236
    modelParm.setContextMode(GlxContextFavorite);
hgs
parents: 26
diff changeset
   237
    modelParm.setPath(imagePath);
hgs
parents: 26
diff changeset
   238
    mFavModel = new GlxFavMediaModel( modelParm );
hgs
parents: 26
diff changeset
   239
    }
hgs
parents: 26
diff changeset
   240
    QString imageName = imagePath.section('\\',-1);
hgs
parents: 26
diff changeset
   241
    connect( mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) );   
hgs
parents: 26
diff changeset
   242
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
//setModel
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
void GlxDetailsView::setModel(QAbstractItemModel *model)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   248
    {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   249
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
    if ( mModel == model ) {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   251
    return ;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
    clearCurrentModel();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
    mModel = model;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    initializeNewModel();
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   256
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
40
hgs
parents: 26
diff changeset
   258
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   259
//getAnimationItem
hgs
parents: 26
diff changeset
   260
//--------------------------------------------------------------------------------------------------------------------------------------------
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   262
    {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   263
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
    if ( transtionEffect == FULLSCREEN_TO_DETAIL
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
            || transtionEffect == DETAIL_TO_FULLSCREEN ) {
40
hgs
parents: 26
diff changeset
   266
    return this;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
    return NULL;    
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   269
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
//updateLayout
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
void GlxDetailsView::updateLayout(Qt::Orientation orient)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
    {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   276
    OstTrace1( TRACE_NORMAL, GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout;orient=%d", orient );
40
hgs
parents: 26
diff changeset
   277
hgs
parents: 26
diff changeset
   278
    qreal IconPosX = 0.0;
hgs
parents: 26
diff changeset
   279
    qreal IconPosY = 0.0;
hgs
parents: 26
diff changeset
   280
    qreal FavIconPosX = 0.0;
hgs
parents: 26
diff changeset
   281
    qreal FavIconPosY = 0.0;
hgs
parents: 26
diff changeset
   282
    qreal DataFormX = 0.0;
hgs
parents: 26
diff changeset
   283
    qreal DataFormY = 0.0;
hgs
parents: 26
diff changeset
   284
    qreal DataFormWidth = 0.0;
hgs
parents: 26
diff changeset
   285
    qreal DataFormHeight = 0.0;
hgs
parents: 26
diff changeset
   286
hgs
parents: 26
diff changeset
   287
hgs
parents: 26
diff changeset
   288
    qreal screenWidth = 0.0;
hgs
parents: 26
diff changeset
   289
    qreal screenHeight = 0.0;
hgs
parents: 26
diff changeset
   290
    qreal leftMargin = 0.0;
hgs
parents: 26
diff changeset
   291
    qreal bottomMargin = 0.0;
hgs
parents: 26
diff changeset
   292
    qreal screenMargin = 0.0;
hgs
parents: 26
diff changeset
   293
    qreal favIconSize = 0.0;
hgs
parents: 26
diff changeset
   294
    qreal chromeHeight = 0.0;
hgs
parents: 26
diff changeset
   295
    qreal middleVerticalMargin = 0.0;
hgs
parents: 26
diff changeset
   296
hgs
parents: 26
diff changeset
   297
    style()->parameter("hb-param-screen-width", screenWidth);
hgs
parents: 26
diff changeset
   298
    style()->parameter("hb-param-screen-height", screenHeight);
hgs
parents: 26
diff changeset
   299
hgs
parents: 26
diff changeset
   300
    style()->parameter("hb-param-margin-gene-middle-vertical", middleVerticalMargin);
hgs
parents: 26
diff changeset
   301
    style()->parameter("hb-param-margin-gene-left", leftMargin);
hgs
parents: 26
diff changeset
   302
    style()->parameter("hb-param-margin-gene-bottom", bottomMargin);
hgs
parents: 26
diff changeset
   303
    style()->parameter("hb-param-margin-gene-screen", screenMargin);
hgs
parents: 26
diff changeset
   304
hgs
parents: 26
diff changeset
   305
    style()->parameter("hb-param-graphic-size-primary-small", favIconSize);
hgs
parents: 26
diff changeset
   306
    style()->parameter("hb-param-widget-chrome-height", chromeHeight);
hgs
parents: 26
diff changeset
   307
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
    if(orient == Qt::Horizontal)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
        {
40
hgs
parents: 26
diff changeset
   311
    OstTrace0( TRACE_NORMAL, DUP1_GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout HORIZONTAL" );
hgs
parents: 26
diff changeset
   312
    setGeometry(0,0,640,360);
hgs
parents: 26
diff changeset
   313
    IconPosX    = screenMargin;
hgs
parents: 26
diff changeset
   314
    IconPosY    = (screenMargin + chromeHeight);
hgs
parents: 26
diff changeset
   315
    FavIconPosX = (IconPosX + GLX_IMAGE_SIZE - (favIconSize +10));
hgs
parents: 26
diff changeset
   316
    FavIconPosY = (IconPosY + GLX_IMAGE_SIZE - (favIconSize + 10));
hgs
parents: 26
diff changeset
   317
    DataFormX =  screenMargin + GLX_IMAGE_SIZE + leftMargin ;
hgs
parents: 26
diff changeset
   318
    DataFormY =  screenMargin + chromeHeight ;
hgs
parents: 26
diff changeset
   319
hgs
parents: 26
diff changeset
   320
    //This Commented code should be un commented , once the screen width and height size issue is solved and also
hgs
parents: 26
diff changeset
   321
    //the dataform issue of wrapping issue is solved
hgs
parents: 26
diff changeset
   322
    // DataFormWidth =  screenWidth(640) - DataFormX  - screenMargin ;
hgs
parents: 26
diff changeset
   323
    // DataFormHeight = screenHeight(360) - DataFormY - screenMargin ;
hgs
parents: 26
diff changeset
   324
    DataFormWidth = screenWidth - (screenMargin  + screenMargin) ;
hgs
parents: 26
diff changeset
   325
    DataFormHeight = screenHeight - DataFormY;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
        }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
    else
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
        {
40
hgs
parents: 26
diff changeset
   330
    OstTrace0( TRACE_NORMAL, DUP2_GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout VERTICAL" );
hgs
parents: 26
diff changeset
   331
    setGeometry(0,0,screenWidth,screenHeight);
hgs
parents: 26
diff changeset
   332
    IconPosX    = (screenWidth/2) - (GLX_IMAGE_SIZE/2);
hgs
parents: 26
diff changeset
   333
    IconPosY    = (screenMargin + chromeHeight);
hgs
parents: 26
diff changeset
   334
    FavIconPosX = (IconPosX + GLX_IMAGE_SIZE - (favIconSize +10));
hgs
parents: 26
diff changeset
   335
    FavIconPosY = (IconPosY + GLX_IMAGE_SIZE - (favIconSize +10));
hgs
parents: 26
diff changeset
   336
    DataFormX =  screenMargin;
hgs
parents: 26
diff changeset
   337
    DataFormY =  IconPosY + GLX_IMAGE_SIZE + middleVerticalMargin + bottomMargin ;
hgs
parents: 26
diff changeset
   338
    DataFormWidth = screenWidth - (screenMargin  + screenMargin) ;
hgs
parents: 26
diff changeset
   339
    DataFormHeight = screenHeight - DataFormY;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
        }
40
hgs
parents: 26
diff changeset
   341
hgs
parents: 26
diff changeset
   342
    mDetailsIcon->setPos(IconPosX,IconPosY);
hgs
parents: 26
diff changeset
   343
    //The Numerical should be updated once we get the parameters size from the layouts.
hgs
parents: 26
diff changeset
   344
    mFavIcon->setItemGeometry(QRect(FavIconPosX-2 ,FavIconPosY-2 ,favIconSize+12,favIconSize + 12)) ;
hgs
parents: 26
diff changeset
   345
    //Place the FavIcon with respect to the Widget.
hgs
parents: 26
diff changeset
   346
    mFavIcon->setItemPos(2 ,2 );
hgs
parents: 26
diff changeset
   347
    mDataForm->setGeometry(DataFormX,DataFormY,DataFormWidth,DataFormHeight);    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
40
hgs
parents: 26
diff changeset
   350
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   351
//rowsRemoved
hgs
parents: 26
diff changeset
   352
//--------------------------------------------------------------------------------------------------------------------------------------------
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start, int end)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   354
    {
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
    Q_UNUSED(parent);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
    Q_UNUSED(start);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   357
    Q_UNUSED(end);
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   358
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ROWSREMOVED, "GlxDetailsView::rowsRemoved" );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   359
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
    if ( mModel->rowCount() <= 0 ) {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   361
    return emit actionTriggered( EGlxCmdEmptyData );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
    }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   363
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
    if ( start <= mSelIndex && end >= mSelIndex ) {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   365
    return emit actionTriggered( EGlxCmdBack );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
    }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   367
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
//showImage
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
void GlxDetailsView::showImage()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
    {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   374
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" );
40
hgs
parents: 26
diff changeset
   375
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
    QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
    if ( variant.isValid() &&  variant.canConvert<int> () ) {
40
hgs
parents: 26
diff changeset
   378
    mSelIndex = variant.value<int>();  
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   381
    variant = mModel->data( mModel->index( mSelIndex ,0), GlxFsImageRole);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   382
    if ( variant.isValid() &&  variant.canConvert<HbIcon> () )
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
        {
40
hgs
parents: 26
diff changeset
   384
        QIcon itemIcon = variant.value<HbIcon>().qicon();
hgs
parents: 26
diff changeset
   385
        QPixmap itemPixmap = itemIcon.pixmap(GLX_IMAGE_SIZE,GLX_IMAGE_SIZE);
hgs
parents: 26
diff changeset
   386
        QSize sz(GLX_IMAGE_SIZE,GLX_IMAGE_SIZE);
hgs
parents: 26
diff changeset
   387
        itemPixmap = itemPixmap.scaled(sz, Qt::IgnoreAspectRatio );
hgs
parents: 26
diff changeset
   388
    
hgs
parents: 26
diff changeset
   389
    
hgs
parents: 26
diff changeset
   390
        HbIcon tmp = HbIcon( QIcon(itemPixmap)) ;
hgs
parents: 26
diff changeset
   391
        mDetailsIcon->setSize(QSize(GLX_IMAGE_SIZE, GLX_IMAGE_SIZE));
hgs
parents: 26
diff changeset
   392
        mDetailsIcon->setIcon(tmp);
hgs
parents: 26
diff changeset
   393
        mFavIcon->setItemIcon(HbIcon("qtg_graf_ratingslider_unrated"));
hgs
parents: 26
diff changeset
   394
    
hgs
parents: 26
diff changeset
   395
        qreal favIconSize = 0.0;
hgs
parents: 26
diff changeset
   396
        style()->parameter("hb-param-graphic-size-primary-small", favIconSize);
hgs
parents: 26
diff changeset
   397
        mFavIcon->setItemSize(QSize(favIconSize+10, favIconSize+10));
hgs
parents: 26
diff changeset
   398
        }        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
//FillData
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
void GlxDetailsView::setFormData()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
    {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   406
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETFORMDATA, "GlxDetailsView::setFormData" );
40
hgs
parents: 26
diff changeset
   407
hgs
parents: 26
diff changeset
   408
    //create and set the Favourite Model
hgs
parents: 26
diff changeset
   409
    setFavModel();
hgs
parents: 26
diff changeset
   410
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
    //Call to set the Image Name
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
    setImageName();
40
hgs
parents: 26
diff changeset
   413
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
    //Call to set the date in the from
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
    setDate();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
//setImageName
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
void GlxDetailsView::setImageName()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
    {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   423
    OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
    QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
    QString imageName = imagePath.section('\\',-1);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
40
hgs
parents: 26
diff changeset
   428
    mImageLabelitem->setContentWidgetData("text",imageName);
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   429
    OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   430
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
//setDate
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
//--------------------------------------------------------------------------------------------------------------------------------------------
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
void GlxDetailsView::setDate()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
    {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   437
    OstTraceFunctionEntry0( GLXDETAILSVIEW_SETDATE_ENTRY );
40
hgs
parents: 26
diff changeset
   438
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   439
    QString datestring;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   440
    QString str("dd.MM.yyyy");
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
    QDate date = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxDateRole)).value<QDate>();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
    if(date.isNull() == FALSE )
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
        {
40
hgs
parents: 26
diff changeset
   445
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setDate is not NULL" );
hgs
parents: 26
diff changeset
   446
    datestring = date.toString(str);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
        }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
40
hgs
parents: 26
diff changeset
   449
    mDateLabelItem->setContentWidgetData("plainText",datestring);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   451
    OstTraceFunctionExit0( GLXDETAILSVIEW_SETDATE_EXIT );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
40
hgs
parents: 26
diff changeset
   454
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   455
//initializeNewModel
hgs
parents: 26
diff changeset
   456
//--------------------------------------------------------------------------------------------------------------------------------------------
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
void GlxDetailsView::initializeNewModel()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   458
    {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   459
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" );
40
hgs
parents: 26
diff changeset
   460
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
    if ( mModel ) {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   462
    connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
    }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   464
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
40
hgs
parents: 26
diff changeset
   466
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   467
//clearCurrentModel
hgs
parents: 26
diff changeset
   468
//--------------------------------------------------------------------------------------------------------------------------------------------
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   469
void GlxDetailsView::clearCurrentModel()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   470
    {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   471
    OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" );
40
hgs
parents: 26
diff changeset
   472
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
    if ( mModel ) {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   474
    disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   475
    mModel = NULL ;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
    }    
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   477
    }
40
hgs
parents: 26
diff changeset
   478
hgs
parents: 26
diff changeset
   479
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   480
//dataChanged
hgs
parents: 26
diff changeset
   481
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   482
void GlxDetailsView::dataChanged(QModelIndex startIndex, QModelIndex endIndex)
hgs
parents: 26
diff changeset
   483
    {
hgs
parents: 26
diff changeset
   484
    Q_UNUSED(endIndex);      
hgs
parents: 26
diff changeset
   485
 
hgs
parents: 26
diff changeset
   486
    QVariant variant = mFavModel->data( startIndex, GlxFavorites );
hgs
parents: 26
diff changeset
   487
    if ( variant.isValid() &&  variant.canConvert<bool> () ) 
hgs
parents: 26
diff changeset
   488
        {
hgs
parents: 26
diff changeset
   489
        if(variant.value<bool>() )
hgs
parents: 26
diff changeset
   490
            {  
hgs
parents: 26
diff changeset
   491
             mFavIcon->setItemIcon(HbIcon(GLXICON_ADD_TO_FAV));
hgs
parents: 26
diff changeset
   492
            }
hgs
parents: 26
diff changeset
   493
        else 
hgs
parents: 26
diff changeset
   494
            {
hgs
parents: 26
diff changeset
   495
             mFavIcon->setItemIcon(HbIcon(GLXICON_REMOVE_FAV));
hgs
parents: 26
diff changeset
   496
            }
hgs
parents: 26
diff changeset
   497
        }
hgs
parents: 26
diff changeset
   498
    }
hgs
parents: 26
diff changeset
   499
hgs
parents: 26
diff changeset
   500
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   501
//updateFavourites
hgs
parents: 26
diff changeset
   502
//--------------------------------------------------------------------------------------------------------------------------------------------
hgs
parents: 26
diff changeset
   503
void GlxDetailsView::updateFavourites()
hgs
parents: 26
diff changeset
   504
    {
hgs
parents: 26
diff changeset
   505
    QVariant variant = mFavModel->data(mFavModel->index(0,0), GlxFavorites );
hgs
parents: 26
diff changeset
   506
    if ( variant.isValid() &&  variant.canConvert<bool> ())
hgs
parents: 26
diff changeset
   507
        {
hgs
parents: 26
diff changeset
   508
        if(variant.value<bool>() )
hgs
parents: 26
diff changeset
   509
            {
hgs
parents: 26
diff changeset
   510
             emit actionTriggered( EGlxCmdRemoveFromFav); 
hgs
parents: 26
diff changeset
   511
            }
hgs
parents: 26
diff changeset
   512
        else
hgs
parents: 26
diff changeset
   513
            {
hgs
parents: 26
diff changeset
   514
            emit actionTriggered(EGlxCmdAddToFav);
hgs
parents: 26
diff changeset
   515
            }
hgs
parents: 26
diff changeset
   516
        }
hgs
parents: 26
diff changeset
   517
    }