ui/views/detailsview/src/glxdetailsview.cpp
changeset 50 a0f57508af73
parent 45 863223ea6961
child 52 a3a4c0de738e
--- a/ui/views/detailsview/src/glxdetailsview.cpp	Fri Jun 25 15:41:33 2010 +0530
+++ b/ui/views/detailsview/src/glxdetailsview.cpp	Sat Jul 10 00:59:39 2010 +0530
@@ -100,7 +100,9 @@
     {
     OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY );
     //create and set the Favourite Model
-    setFavModel();
+    if(getSubState() != IMAGEVIEWER_DETAIL_S) {
+       setFavModel();
+    }
     
     //fill the data
     FillDetails();
@@ -120,19 +122,20 @@
 //--------------------------------------------------------------------------------------------------------------------------------------------
 //initializeView
 //--------------------------------------------------------------------------------------------------------------------------------------------
-void GlxDetailsView::initializeView(QAbstractItemModel *model)
-    {
+void GlxDetailsView::initializeView( QAbstractItemModel *model, GlxView *preView)
+{
+    Q_UNUSED( preView )
     OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY );
     bool loaded = false;
-    
+
     if(!mDocLoader)
         {
          mDocLoader = new GlxDetailsViewDocLoader();
         }
-    
+
     //Load the docml
     mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded);     
-    
+
     HbView *mView = static_cast<HbView*> (mDocLoader->findWidget(
             GLX_DETAILSVIEW_VIEW));
     
@@ -144,6 +147,7 @@
     mFavIcon = static_cast<HbPushButton*> (mDocLoader->findWidget(
             GLX_DETAILSVIEW_FAVICON));
 
+
     mDescriptions = static_cast<GlxDetailsDescriptionEdit*> (mDocLoader->findWidget(
             GLX_DETAILSVIEW_DESCRPTIONTEXT));
     
@@ -159,20 +163,26 @@
     mSizeLabel = static_cast<HbLabel*> (mDocLoader->findWidget(
             GLX_DETAILSVIEW_SIZETEXT));
 
-    //set the frame graphics to the background of the fav icon
-    HbFrameItem* frame = new HbFrameItem(this);
-    frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-    frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
-    frame->graphicsItem()->setOpacity(0.2);
-    mFavIcon->setBackgroundItem(frame->graphicsItem(), -1);
-    mFavIcon->setBackground(HbIcon("qtg_fr_multimedia_trans"));
-    mFavIcon->setIcon(HbIcon(GLXICON_REMOVE_FAV));
     
-    setWidget(mView);
-
-    //Set the Model
+        //Set the Model
     mModel = model;  
-
+   if(getSubState() == IMAGEVIEWER_DETAIL_S) {
+       mFavIcon->hide();
+    }
+    else
+    {
+        //set the frame graphics to the background of the fav icon
+        HbFrameItem* frame = new HbFrameItem(this);
+        frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+        frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
+        frame->graphicsItem()->setOpacity(0.2);
+        mFavIcon->setBackgroundItem(frame->graphicsItem(), -1);
+        mFavIcon->setBackground(HbIcon("qtg_fr_multimedia_trans"));
+        mFavIcon->setIcon(HbIcon(GLXICON_REMOVE_FAV));
+     }	
+	 
+	setWidget(mView);
+	
     //Set the Layout Correspondingly.
     updateLayout(mWindow->orientation());
 
@@ -211,11 +221,12 @@
 //--------------------------------------------------------------------------------------------------------------------------------------------
 void GlxDetailsView::cleanUp()
     {
+    qDebug("GlxDetailsView::cleanUp Enter");
+	//clear the connections
+    clearConnections();   
+    
     clearCurrentModel();
 
-    //clear the connections
-    clearConnections();   
-
     delete mFavModel;
     mFavModel = NULL;
 
@@ -296,15 +307,21 @@
     {
     connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
             SLOT(updateLayout(Qt::Orientation)));
+    
+    
+    if(getSubState() != IMAGEVIEWER_DETAIL_S) {    
     connect(mFavIcon, SIGNAL(clicked()), this, SLOT(updateFavourites()));
     
     connect(mDescriptions, SIGNAL(labelPressed()), this,
             SLOT(UpdateDescription()));
     
+    connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
+                   this, SLOT( dataChanged(QModelIndex,QModelIndex) ));
+    }
+    
     connect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() ));
     
-    connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
-               this, SLOT( dataChanged(QModelIndex,QModelIndex) ));    
+        
     }
 
 //--------------------------------------------------------------------------------------------------------------------------------------------
@@ -312,18 +329,22 @@
 //--------------------------------------------------------------------------------------------------------------------------------------------
 void GlxDetailsView::clearConnections()
     {
+    
+    qDebug("GlxDetailsView:: clearConnections");
     disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
             SLOT(updateLayout(Qt::Orientation)));
-    
+           
+    if(mModel && getSubState() != IMAGEVIEWER_DETAIL_S) {
     disconnect(mFavIcon, SIGNAL(clicked()), this, SLOT(updateFavourites()));
-    
     disconnect(mDescriptions, SIGNAL(labelPressed()), this,
             SLOT(UpdateDescription()));
+    disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
+                    this, SLOT( dataChanged(QModelIndex,QModelIndex) ));
+    }
     
     disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() ));
     
-    disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ),
-                this, SLOT( dataChanged(QModelIndex,QModelIndex) ));
+    
     }
 
 //--------------------------------------------------------------------------------------------------------------------------------------------
@@ -614,3 +635,20 @@
         }
     return sizeString;
     }
+
+//--------------------------------------------------------------------------------------------------------------------------------------------
+//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;
+ }