--- a/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Fri Jun 11 17:53:15 2010 +0530
+++ b/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Fri Jun 25 15:41:33 2010 +0530
@@ -24,13 +24,16 @@
#include <QCache>
#include <QDebug>
#include <glxmlwrapper.h>
+#include"glxdrmutilitywrapper.h"
#include <glxfiltergeneraldefs.h>
+#include <glximageviewermanager.h>
//#define GLXPERFORMANCE_LOG
#include <glxperformancemacro.h>
#include "glxicondefs.h" //Contains the icon names/Ids
+#include<glxviewids.h>
GlxMediaModel::GlxMediaModel(GlxModelParm & modelParm)
{
@@ -39,7 +42,7 @@
mMLWrapper = new GlxMLWrapper(modelParm.collection(),0,EGlxFilterImage);
mMLWrapper->setContextMode( modelParm.contextMode() );
mContextMode = modelParm.contextMode( ) ;
-
+ mDRMUtilityWrapper = new GlxDRMUtilityWrapper();
int err = connect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType)));
qDebug("updateItem() connection status %d", err);
err = connect(mMLWrapper, SIGNAL(itemCorrupted(int)), this, SLOT(itemCorrupted(int)));
@@ -65,6 +68,7 @@
externalDataCount = 0;
mFocusIndex = -1;
mSubState = -1;
+ mTempVisibleWindowIndex = 0;
}
GlxMediaModel::~GlxMediaModel()
@@ -85,7 +89,7 @@
err = disconnect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelpopulated()));
err = disconnect(mMLWrapper, SIGNAL(updateDetails()), this, SLOT(updateDetailItems()));
delete mMLWrapper;
-
+ delete mDRMUtilityWrapper;
}
//------------------------------------------------------------------------------------------------------------
@@ -360,8 +364,30 @@
HbIcon* GlxMediaModel::GetFsIconItem(int itemIndex, GlxTBContextType tbContextType) const
{
- HbIcon* itemIcon = itemFsIconCache[itemIndex]; //Initialize icon from the Cache will be NULL if Item not present
- if (!itemIcon) {
+ HbIcon* itemIcon = NULL; //Initialize icon from the Cache will be NULL if Item not present
+
+ bool drmProtected = mMLWrapper->IsDrmProtected(itemIndex);
+ if(drmProtected)
+ {
+ QString imagePath = mMLWrapper->retrieveItemUri(itemIndex);
+ bool rightValid = mMLWrapper->IsDrmValid(itemIndex);
+ if(!rightValid)
+ {
+ //show error note here
+ if(itemIndex == mFocusIndex )
+ mDRMUtilityWrapper->ShowRightsInfo(imagePath);
+ return itemIcon;
+ }
+ else
+ {
+ //consumeDrmRights(imagePath);
+ mDRMUtilityWrapper->ConsumeRights(imagePath);
+ bool rightValid = mDRMUtilityWrapper->ItemRightsValidityCheck(imagePath,true);
+ mMLWrapper->setDrmValid(itemIndex,rightValid);
+ }
+ }
+ itemIcon = itemFsIconCache[itemIndex]; //Initialize icon from the Cache will be NULL if Item not present
+ if (!itemIcon) {
itemIcon = mMLWrapper->retrieveItemIcon(itemIndex, tbContextType);
if(itemIcon){
emit iconAvailable(itemIndex,itemIcon, tbContextType);
@@ -407,6 +433,10 @@
void GlxMediaModel::modelpopulated()
{
+ if ( mTempVisibleWindowIndex!=-1) {
+ mMLWrapper->setVisibleWindowIndex(mTempVisibleWindowIndex);
+ mTempVisibleWindowIndex = -1;
+ }
emit populated();
}
@@ -470,10 +500,10 @@
{
qDebug("GlxMediaModel::setFocusIndex%d", index.row());
int itemIndex = index.row();
-
+ int mlIndex = -1;
if(itemIndex >=externalDataCount)
{
- int mlIndex = itemIndex - externalDataCount;
+ mlIndex = itemIndex - externalDataCount;
mMLWrapper->setFocusIndex(mlIndex);
mFocusIndex = -1;
}
@@ -481,10 +511,22 @@
mFocusIndex = itemIndex;
if(rowCount() > externalDataCount) {
mMLWrapper->setFocusIndex(0);
+ mlIndex = 0;
}
}
-
+ if(mSubState != IMAGEVIEWER_S ){
+ if( mMLWrapper->IsDrmProtected(mlIndex) && (!mMLWrapper->IsDrmValid(mlIndex)) )
+ {
+ QString imagePath = mMLWrapper->retrieveItemUri(mlIndex);
+ mDRMUtilityWrapper->ShowRightsInfo(imagePath);
+ }
+ }else {
+ CGlxImageViewerManager* CGlxImageViewerManager = CGlxImageViewerManager::InstanceL();
+ const TDesC& title = CGlxImageViewerManager->ImageUri()->Des();
+ QString imagePath = QString::fromUtf16(title.Ptr(),title.Length());
+ mDRMUtilityWrapper->ShowRightsInfo(imagePath);
+ }
}
QModelIndex GlxMediaModel::getFocusIndex() const
@@ -554,6 +596,12 @@
mSubState = value.value <int> () ;
return TRUE;
}
+ if ( GlxTempVisualWindowIndex == role ) {
+ if ( value.isValid() && value.canConvert<int> () ) {
+ mTempVisibleWindowIndex = value.value <int> ();
+ return TRUE;
+ }
+ }
return FALSE;
}