--- a/ui/views/detailsview/src/glxdetailsview.cpp Thu Sep 02 20:26:45 2010 +0300
+++ b/ui/views/detailsview/src/glxdetailsview.cpp Fri Sep 17 08:29:24 2010 +0300
@@ -5,7 +5,6 @@
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
@@ -15,76 +14,46 @@
*
*/
-//--------------------------------------------------------------------------------------------------------------------------------------------
-
+//Includes Qt
#include <QModelIndex>
-#include <qdatetime.h>
#include <QDebug>
-#include <HbAnchorLayout.h>
-//--------------------------------------------------------------------------------------------------------------------------------------------
+//Includes Orbit
#include <hblabel.h>
-#include <hbdataform.h>
#include <hbinstance.h>
-#include <hbiconitem.h>
-#include <hbframeitem.h>
+#include <hblistview.h>
#include <hbpushbutton.h>
-#include <hbdataformmodel.h>
-#include <hbdocumentloader.h>
-#include <hbdataformmodelitem.h>
-#include <hbdataformviewitem.h>
#include <hbparameterlengthlimiter.h>
-//--------------------------------------------------------------------------------------------------------------------------------------------
-#include "glxviewids.h"
+
+//User Includes
+#include "glxlog.h" //contains the declaration of GLX LOGS
+#include "glxviewids.h" //contains view ids used here
#include "glxicondefs.h" //Contains the icon names/Ids
-#include "glxmodelparm.h"
-#include "glxmediamodel.h"
-#include "glxdetailsview.h"
-#include "glxfavmediamodel.h"
-#include "glxdocloaderdefs.h"
-#include <glxcommandhandlers.hrh>
-#include "glxlocalisationstrings.h"
-#include "glxdetailstextedit.h"
-#include "glxdetailsicon.h"
-
-
-#include "glxviewdocloader.h"
-#include <glxcollectionpluginalbums.hrh>
-
-#include "glxlog.h"
-#include "glxloggerenabler.h"
-
-
+#include "glxmodelparm.h" //contains the declaration of GlxModelParm used to check for favourites
+#include "shareuidialog.h" //contains the declaration for share ui/send dialogs
+#include "glxdetailsicon.h" //contains the declaration of glxdetailsicon to show the image
+#include "glxdetailsview.h" //contains the declaration of this file/class
+#include "glxviewdocloader.h" //contains the declaration of GlxDetailsViewDocLoader
+#include "glxfavmediamodel.h" //contains the declaration of GlxFavMediaModel,used to check for favourites
+#include "glxdocloaderdefs.h" //contains the #define/constants of docml constants
+#include "glxcommandhandlers.hrh" //contains the declaration of rename and description command
+#include "glxlocalisationstrings.h" //contains the localisation strings
+#include "glxdetailsviewmodelwrapper.h" //contains the model wrapper for the media model of list widget
+#include "glxdetailsviewitemprototype.h" //contains the custom widgets prototype decalaration
+#include "glxcollectionpluginalbums.hrh" //contains declaration of KGlxCollectionPluginFavoritesAlbumId
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
#include "glxdetailsviewTraces.h"
#endif
-//SIZE OF THE IMAGE , LAYOUTS TEAM NEED TO GIVER THE SIZE IN UNITS
-#define GLX_IMAGE_WIDTH 333
-#define GLX_IMAGE_HEIGHT 215
-const int KBytesInKB = 1024;
-const int KBytesInMB = 1024 * 1024;
-const int KBytesInGB = 1024 * 1024 * 1024;
-
//--------------------------------------------------------------------------------------------------------------------------------------------
//GlxDetailsView
//--------------------------------------------------------------------------------------------------------------------------------------------
-GlxDetailsView::GlxDetailsView(HbMainWindow *window)
- : GlxView( GLX_DETAILSVIEW_ID ),
- mDetailsIcon( NULL ),
- mFavIcon( NULL ),
- mModel( NULL ),
- mFavModel( NULL ),
- mWindow( window ),
- mSelIndex( 0 ),
- mDocLoader( NULL ),
- mImageName( NULL ),
- mDescriptions( NULL ),
- mDateLabel( NULL ),
- mSizeLabel( NULL ),
- mTimeLabel( NULL )
+GlxDetailsView::GlxDetailsView(HbMainWindow *window) :
+ GlxView(GLX_DETAILSVIEW_ID), mImageBackGround(NULL), mDetailsIcon(NULL), mView(NULL), mFavIcon(
+ NULL), mModel(NULL), mFavModel(NULL), mWindow(window), mSelIndex(0), mDocLoader(NULL),
+ mListView(NULL), mListModel(NULL), mShareButton(NULL)
{
GLX_LOG_INFO("GlxDetailsView::GlxDetailsView");
OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY );
@@ -98,161 +67,203 @@
GlxDetailsView::~GlxDetailsView()
{
OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" );
-
+
+ delete mDetailsIcon;
+ mDetailsIcon = NULL;
+
+ delete mImageBackGround;
+ mImageBackGround = NULL;
+
+ delete mView;
+ mView = NULL;
+
+ mDocLoader->reset();
delete mDocLoader;
- mDocLoader = NULL;
+ mDocLoader = NULL;
+
+}
+
+//--------------------------------------------------------------------------------------------------------------------------------------------
+//initializeView
+//--------------------------------------------------------------------------------------------------------------------------------------------
+void GlxDetailsView::initializeView(QAbstractItemModel *model, GlxView *preView)
+{
+ Q_UNUSED( preView )
+ OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
+ bool loaded = false;
+
+ if (!mDocLoader) {
+ mDocLoader = new GlxDetailsViewDocLoader();
+ }
+ mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded);
+
+ if (!mView) {
+
+ mView = static_cast<HbView*> (mDocLoader->findWidget(GLX_DETAILSVIEW_VIEW));
+ mImageBackGround = static_cast<HbLabel*> (mDocLoader->findWidget(
+ GLX_DETAILSVIEW_IMGBCKGROUND));
+ mDetailsIcon = static_cast<HbLabel*> (mDocLoader->findWidget(GLX_DETAILSVIEW_IMAGE));
+ }
+
+ mFavIcon = static_cast<GlxDetailsIcon*> (mDocLoader->findWidget(GLX_DETAILSVIEW_FAVICON));
+
+ mShareButton = static_cast<HbPushButton*> (mDocLoader->findWidget(GLX_DETAILSVIEW_SHAREBUTTON));
+
+ mListView = static_cast<HbListView*> (mDocLoader->findWidget(GLX_DETAILSVIEW_LISTWIDGET));
+
+ //Set the Model
+ mModel = model;
+
+ //Set the Layout Correspondingly.
+ updateLayout(mWindow->orientation());
+
+ GlxDetailsViewItemProtoType *prototype = new GlxDetailsViewItemProtoType(mListView);
+ mListView->setItemPrototype(prototype);
+ mListModel = new GlxDetailsViewModelWrapper(mModel);
+ mListView->setModel(mListModel);
+
+ mImageBackGround->show();
+ mDetailsIcon->show();
- cleanUp();
+ setWidget(mView);
+
+
+
+ OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT );
}
//--------------------------------------------------------------------------------------------------------------------------------------------
//activate
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::activate()
- {
+{
OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY );
- //create and set the Favourite Model
- if(getSubState() != IMAGEVIEWER_DETAIL_S) {
- setFavModel();
+
+ mFavIconEnabled = HbIcon(GLXICON_ADD_TO_FAV);
+ mFavIconDisabled = HbIcon(GLXICON_REMOVE_FAV);
+
+ if (getSubState() != IMAGEVIEWER_DETAIL_S) {
+ //set the favorite model to check if this image is in favourites folder or not
+ setFavModel();
+ mFavIcon->setItemIcon(mFavIconDisabled);
}
-
- //fill the data
- FillDetails();
-
- //Initialze the Model
- initializeNewModel();
-
- //make the connections
- setConnections();
-
- //Set context mode to fetch descriptions
- mModel->setData(QModelIndex(), (int) GlxContextComment, GlxContextRole);
-
- OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT );
+ else {
+ mFavIcon->hide();
}
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//initializeView
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::initializeView( QAbstractItemModel *model, GlxView *preView)
-{
- Q_UNUSED( preView )
- OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
- bool loaded = false;
+ //Initialze the Model
+ initializeNewModel();
- if(!mDocLoader)
- {
- mDocLoader = new GlxDetailsViewDocLoader();
- }
-
- //Load the docml
- mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded);
-
- HbView *mView = static_cast<HbView*> (mDocLoader->findWidget(
- GLX_DETAILSVIEW_VIEW));
-
- mDetailsIcon = static_cast<HbLabel*> (mDocLoader->findWidget(
- GLX_DETAILSVIEW_IMAGE));
- mFavIcon = static_cast<GlxDetailsIcon*> (mDocLoader->findWidget(
- GLX_DETAILSVIEW_FAVICON));
-
+ //make the connections
+ setConnections();
- mDescriptions = static_cast<GlxDetailsTextEdit*> (mDocLoader->findWidget(
- GLX_DETAILSVIEW_DESCRPTIONTEXT));
-
- mImageName = static_cast<GlxDetailsTextEdit*> (mDocLoader->findWidget(
- GLX_DETAILSVIEW_IMGNAME));
-
- mDateLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
- GLX_DETAILSVIEW_DATETEXT));
-
- mTimeLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
- GLX_DETAILSVIEW_TIMETEXT));
-
- mSizeLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
- GLX_DETAILSVIEW_SIZETEXT));
+ //Set context mode to fetch descriptions
+ mModel->setData(QModelIndex(), (int) GlxContextComment, GlxContextRole);
- mFavIconEnabled = HbIcon(GLXICON_ADD_TO_FAV);
- mFavIconDisabled = HbIcon(GLXICON_REMOVE_FAV);
-
- //Set the Model
- mModel = model;
- if(getSubState() == IMAGEVIEWER_DETAIL_S) {
- mFavIcon->hide();
- }
- else
- {
- mFavIcon->setItemIcon(HbIcon(GLXICON_REMOVE_FAV));
- }
-
- setWidget(mView);
-
- //Set the Layout Correspondingly.
- updateLayout(mWindow->orientation());
-
- OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT );
- }
+ OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT );
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
//resetView
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::resetView()
- {
+{
GLX_LOG_INFO("GlxDetailsView::resetView");
+
+ //Remove the context created to update details
+ if (mModel) {
+ mModel->setData(QModelIndex(), (int) GlxContextComment, GlxRemoveContextRole);
+ }
+
+ //clear the connections
+ clearConnections();
+ //clear the model
+ clearCurrentModel();
+
+ delete mFavIcon;
+ mFavIcon = NULL;
+
+ delete mFavModel;
+ mFavModel = NULL;
+
+ delete mShareButton;
+ mShareButton = NULL;
+
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_RESETVIEW, "GlxDetailsView::resetView" );
- }
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
//deActivate
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::deActivate()
- {
+{
GLX_LOG_INFO("GlxDetailsView::deActivate");
OstTraceFunctionEntry0( GLXDETAILSVIEW_DEACTIVATE_ENTRY );
- //Remove the context created to update details
- mModel->setData(QModelIndex(), (int) GlxContextComment,
- GlxRemoveContextRole);
+ mImageBackGround->hide();
+ mDetailsIcon->hide();
cleanUp();
-
+
OstTraceFunctionExit0( GLXDETAILSVIEW_DEACTIVATE_EXIT );
+}
+
+//--------------------------------------------------------------------------------------------------------------------------------------------
+//setModel
+//--------------------------------------------------------------------------------------------------------------------------------------------
+void GlxDetailsView::setModel(QAbstractItemModel *model)
+{
+ OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" );
+ if (mModel == model) {
+ return;
}
+ clearCurrentModel();
+ mModel = model;
+ initializeNewModel();
+}
+
+//--------------------------------------------------------------------------------------------------------------------------------------------
+//getAnimationItem
+//--------------------------------------------------------------------------------------------------------------------------------------------
+QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
+{
+ OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" );
+ if (transtionEffect == FULLSCREEN_TO_DETAIL || transtionEffect == DETAIL_TO_FULLSCREEN) {
+ return this;
+ }
+ return NULL;
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
//cleanUp
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::cleanUp()
- {
- qDebug("GlxDetailsView::cleanUp Enter");
- //clear the connections
- clearConnections();
-
- clearCurrentModel();
+{
+ delete mListModel;
+ mListModel = NULL;
+
+ delete mListView;
+ mListView = NULL;
- delete mFavModel;
- mFavModel = NULL;
-
- delete mFavIcon;
- mFavIcon = NULL;
+ takeWidget();
+}
- delete mDetailsIcon;
- mDetailsIcon = NULL;
+//--------------------------------------------------------------------------------------------------------------------------------------------
+//showImage
+//--------------------------------------------------------------------------------------------------------------------------------------------
+void GlxDetailsView::showImage()
+{
+ QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole);
+ if (variant.isValid() && variant.canConvert<int> ()) {
+ mSelIndex = variant.value<int> ();
}
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//setModel
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::setModel(QAbstractItemModel *model)
- {
- OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" );
- if (mModel == model)
- {
- return;
- }
- clearCurrentModel();
- mModel = model;
- initializeNewModel();
+ variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole);
+
+ if (variant.isValid() && variant.canConvert<HbIcon> ()) {
+ mDetailsIcon->setIcon(variant.value<HbIcon> ());
+ mImageBackGround->setIcon(HbIcon(":/data/details.svg"));
}
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
//setFavModel
@@ -260,9 +271,8 @@
void GlxDetailsView::setFavModel()
{
GlxModelParm modelParm;
- QString imagePath = (mModel->data(mModel->index(mModel->data(
- mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
- GlxUriRole)).value<QString> ();
+ QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0, 0),
+ GlxFocusIndexRole).value<int> (), 0), GlxUriRole)).value<QString> ();
if (mFavModel == NULL) {
modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId);
@@ -278,11 +288,12 @@
void GlxDetailsView::initializeNewModel()
{
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" );
-
+
if (mModel) {
- connect( mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
- connect( mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() ));
- connect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) );
+ connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
+ SLOT(rowsRemoved(QModelIndex,int,int)));
+ connect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( refreshDetailsview() ));
+ connect(mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ));
}
}
@@ -294,9 +305,10 @@
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" );
if (mModel) {
- disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int)));
- disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() ));
- disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) );
+ disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this,
+ SLOT(rowsRemoved(QModelIndex,int,int)));
+ disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( refreshDetailsview() ));
+ disconnect(mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ));
mModel = NULL;
}
}
@@ -306,17 +318,25 @@
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::setConnections()
{
+
connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
- SLOT(updateLayout(Qt::Orientation)));
-
- if(getSubState() != IMAGEVIEWER_DETAIL_S) {
- connect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites()));
-
- connect(mDescriptions, SIGNAL(labelPressed()), this,
- SLOT(UpdateDescription()));
-
- connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
- this, SLOT( dataChanged(QModelIndex,QModelIndex) ));
+ SLOT(updateLayout(Qt::Orientation)));
+
+ connect(mShareButton, SIGNAL(clicked()), this, SLOT(launchShareDialog()));
+
+ if (getSubState() != IMAGEVIEWER_DETAIL_S) {
+
+ connect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites()));
+
+ connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this,
+ SLOT( dataChanged(QModelIndex,QModelIndex) ));
+
+ //Connect the signals only in case of details view launched from photos app
+ // and dont connect the signals if the details view is launched from MMS,File Manager
+ // or other apps.
+ connect((mListView->itemPrototypes()).at(0), SIGNAL(signalFromCustomWidget(int)), this,
+ SLOT(triggerTheCommand(int)));
+
}
}
@@ -325,318 +345,158 @@
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::clearConnections()
{
-
- qDebug("GlxDetailsView:: clearConnections");
+ GLX_LOG_INFO("GlxDetailsView::clearConnections ");
+
disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
- SLOT(updateLayout(Qt::Orientation)));
-
- if(mModel && getSubState() != IMAGEVIEWER_DETAIL_S) {
- disconnect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites()));
- disconnect(mDescriptions, SIGNAL(labelPressed()), this,
- SLOT(UpdateDescription()));
- disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
- this, SLOT( dataChanged(QModelIndex,QModelIndex) ));
+ SLOT(updateLayout(Qt::Orientation)));
+
+ if (mModel && getSubState() != IMAGEVIEWER_DETAIL_S) {
+
+ disconnect((mListView->itemPrototypes()).at(0), SIGNAL(signalFromCustomWidget(int)), this,
+ SLOT(triggerTheCommand(int)));
+
+ disconnect(mShareButton, SIGNAL(released()), this, SLOT(launchShareDialog()));
+
+ disconnect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites()));
+
+ disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this,
+ SLOT( dataChanged(QModelIndex,QModelIndex) ));
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------
-//getAnimationItem
+//getSubState
//--------------------------------------------------------------------------------------------------------------------------------------------
-QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect)
- {
- OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" );
- if (transtionEffect == FULLSCREEN_TO_DETAIL || transtionEffect
- == DETAIL_TO_FULLSCREEN)
- {
- return this;
+int GlxDetailsView::getSubState()
+{
+ int substate = NO_DETAIL_S;
+
+ if (mModel) {
+ QVariant variant = mModel->data(mModel->index(0, 0), GlxSubStateRole);
+
+ if (variant.isValid() && variant.canConvert<int> ()) {
+ substate = variant.value<int> ();
}
- return NULL;
}
+ return substate;
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
//updateLayout
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::updateLayout(Qt::Orientation orient)
- {
- OstTrace1( TRACE_NORMAL, GLXDETAILSVIEW_UPDATELAYOUT, "GlxDetailsView::updateLayout;orient=%d", orient );
+{
GLX_LOG_INFO("GlxDetailsView::updateLayout ");
bool loaded = false;
QString section;
//Load the widgets accroding to the current Orientation
- if (orient == Qt::Horizontal)
- {
+ if (orient == Qt::Horizontal) {
section = GLX_DETAILSVIEW_LSSECTION;
- }
- else
- {
+ }
+ else {
section = GLX_DETAILSVIEW_PTSECTION;
- }
+ }
//Load the Sections
mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, section, &loaded);
showImage();
- //This is just to over come the bug in docloader,once that is fixed we can remove the
- //below lines of code
- FillDetails();
-
+
GLX_LOG_INFO1("GlxDetailsView::updateLayout =%d\n",loaded);
- }
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
//rowsRemoved
//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start,
- int end)
- {
+void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start, int end)
+{
Q_UNUSED(parent);
Q_UNUSED(start);
Q_UNUSED(end);
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ROWSREMOVED, "GlxDetailsView::rowsRemoved" );
- if (mModel->rowCount() <= 0)
- {
+ if (mModel->rowCount() <= 0) {
return emit actionTriggered(EGlxCmdEmptyData);
- }
-
- if (start <= mSelIndex && end >= mSelIndex)
- {
- return emit actionTriggered(EGlxCmdBack);
- }
}
+ if (start <= mSelIndex && end >= mSelIndex) {
+ return emit actionTriggered(EGlxCmdBack);
+ }
+}
+
+//--------------------------------------------------------------------------------------------------------------------------------------------
+//modelDestroyed
+//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::modelDestroyed()
{
mModel = NULL;
}
//--------------------------------------------------------------------------------------------------------------------------------------------
-//FillData
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::FillDetails()
- {
- OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETFORMDATA, "GlxDetailsView::setFormData" );
-
- qDebug("GlxDetailsView::FillDetails");
- //Call to set the Image Name
- setImageName();
-
- //Call to set the description
- setDesc();
-
- //Call to set the date in the from
- setDate();
-
- //Call to set the time
- setTime();
-
- //Call to set the size
- setSize();
-
- }
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//showImage
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::showImage()
- {
- OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" );
-
- QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole);
- if (variant.isValid() && variant.canConvert<int> ())
- {
- mSelIndex = variant.value<int> ();
- }
-
- variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole);
-
- if (variant.isValid() && variant.canConvert<HbIcon> ())
- {
- mDetailsIcon->setIcon(variant.value<HbIcon> ());
- }
- }
-
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//setImageName
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::setImageName()
- {
- OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY );
- QString imagePath = (mModel->data(mModel->index(mModel->data(
- mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
- GlxUriRole)).value<QString> ();
- QString imageName = imagePath.section('\\', -1);
-
- mImageName->setItemText(imageName);
- OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT );
- }
-
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//setImageName
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::setDesc()
- {
-
- //This is a hack , Initialize to some characters and then set the text
- //as of know if the description text is Null , we cant see the Description edit box
- //The issue has been informed to Application designer team.
- mDescriptions->setItemText("a");
- QString description = (mModel->data(mModel->index(mModel->data(
- mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
- GlxDescRole)).value<QString> ();
- mDescriptions->setItemText(description);
- }
-
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//setDate
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::setDate()
- {
- OstTraceFunctionEntry0( GLXDETAILSVIEW_SETDATE_ENTRY );
-
- QString datestring;
- QString dateFormat("dd.MM.yyyy");
- QDate date = (mModel->data(mModel->index(mModel->data(
- mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0),
- GlxDateRole)).value<QDate> ();
-
- if (date.isNull() == FALSE)
- {
- OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setDate is not NULL" );
- QString dateStringValue = date.toString(dateFormat);
- datestring = hbTrId(GLX_DETAILS_DATE).arg(dateStringValue);
- }
-
- mDateLabel->setPlainText(datestring);
-
- OstTraceFunctionExit0( GLXDETAILSVIEW_SETDATE_EXIT );
- }
-
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//setTime
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::setTime()
- {
- QString timestring;
- QString timeFormat("h:m ap");
- QTime timevalue = (mModel->data(mModel->index(mModel->data(mModel->index(
- 0, 0), GlxFocusIndexRole).value<int> (), 0), GlxTimeRole)).value<
- QTime> ();
-
- if (timevalue.isNull() == FALSE)
- {
- QString timeStringValue = timevalue.toString(timeFormat);
- timestring = hbTrId(GLX_DETAILS_TIME).arg(timeStringValue);
- }
- mTimeLabel->setPlainText(timestring);
- }
-
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//setSize
-//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::setSize()
- {
- int size = 0;
- size = (mModel->data(mModel->index(mModel->data(mModel->index(0, 0),
- GlxFocusIndexRole).value<int> (), 0), GlxSizeRole)).value<int> ();
-
- QString sizeString;
- sizeString = sizeinStrings(size);
- mSizeLabel->setPlainText(sizeString);
-
- }
-
-//--------------------------------------------------------------------------------------------------------------------------------------------
//dataChanged
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::dataChanged(QModelIndex startIndex, QModelIndex endIndex)
- {
+{
Q_UNUSED(endIndex);
QVariant variant = mFavModel->data(startIndex, GlxFavorites);
- if (variant.isValid() && variant.canConvert<bool> ())
- {
- if (variant.value<bool> ())
- {
+ if (variant.isValid() && variant.canConvert<bool> ()) {
+ if (variant.value<bool> ()) {
mFavIcon->setItemIcon(mFavIconEnabled);
- }
- else
- {
+ }
+ else {
mFavIcon->setItemIcon(mFavIconDisabled);
- }
}
}
+}
+
+//--------------------------------------------------------------------------------------------------------------------------------------------
+//refreshDetailsview
+//--------------------------------------------------------------------------------------------------------------------------------------------
+void GlxDetailsView::refreshDetailsview()
+{
+ GLX_LOG_INFO("GlxDetailsView::refreshDetailsview ");
+ mListModel->refreshCustomWidget();
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
-//UpdateDescription
+//triggerTheCommand
//--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::UpdateDescription()
- {
- GLX_LOG_INFO("GlxDetailsView::UpdateDescription ");
- qDebug("GlxDetailsView::UpdateDescription");
- emit actionTriggered(EGlxCmdComment);
+void GlxDetailsView::triggerTheCommand(int row)
+{
+ GLX_LOG_INFO("GlxDetailsView::triggerTheCommand ");
+
+ if (row == GlxDetailsViewItemProtoType::widgetNameIndex) {
+ emit actionTriggered(EGlxCmdRenameFile);
}
+ else {
+ emit actionTriggered(EGlxCmdComment);
+ }
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
//updateFavourites
//--------------------------------------------------------------------------------------------------------------------------------------------
void GlxDetailsView::updateFavourites()
- {
+{
QVariant variant = mFavModel->data(mFavModel->index(0, 0), GlxFavorites);
- if (variant.isValid() && variant.canConvert<bool> ())
- {
- if (variant.value<bool> ())
- {
+ if (variant.isValid() && variant.canConvert<bool> ()) {
+ if (variant.value<bool> ()) {
emit actionTriggered(EGlxCmdRemoveFromFav);
- }
- else
- {
+ }
+ else {
emit actionTriggered(EGlxCmdAddToFav);
- }
}
}
+}
//--------------------------------------------------------------------------------------------------------------------------------------------
-//sizeinStrings
+//launchShareDialog
//--------------------------------------------------------------------------------------------------------------------------------------------
-QString GlxDetailsView::sizeinStrings(int size)
- {
- QString sizeString;
- if (size >= KBytesInGB)
- {
- int gbSize = size / KBytesInGB; // Size in GB
- sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_GB, gbSize);
- }
- else if (size >= KBytesInMB)
- {
- int mbSize = size / KBytesInMB; // Size in MB
- sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_MB, mbSize);
- }
- else if (size >= KBytesInKB)
- {
- int kbSize = size / KBytesInKB; // Size in KB
- sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_KB, kbSize);
- }
- else
- {
- sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_BYTES, size);
- }
- return sizeString;
- }
+void GlxDetailsView::launchShareDialog()
+{
+ GLX_LOG_INFO("GlxDetailsView::launchShareDialog ");
+ emit actionTriggered(EGlxCmdSend);
+}
-//--------------------------------------------------------------------------------------------------------------------------------------------
-//getSubState
-//--------------------------------------------------------------------------------------------------------------------------------------------
-int GlxDetailsView::getSubState()
- {
- int substate = NO_DETAIL_S;
-
- if (mModel) {
- QVariant variant = mModel->data(mModel->index(0, 0), GlxSubStateRole);
-
- if (variant.isValid() && variant.canConvert<int> ()) {
- substate = variant.value<int> ();
- }
- }
- return substate;
- }