videocollection/videocollectionview/src/videocollectionuiloader.cpp
changeset 24 7d93ee07fb27
parent 20 b9e04db066d4
child 28 c48470be1ba7
--- a/videocollection/videocollectionview/src/videocollectionuiloader.cpp	Fri May 14 15:53:50 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionuiloader.cpp	Thu May 27 12:53:14 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: 21 %
+// Version : %version: 22 %
 
 // INCLUDE FILES
 #include <qgraphicswidget.h>
@@ -199,7 +199,7 @@
 // doFindWidget
 // ---------------------------------------------------------------------------
 //
-QGraphicsWidget* VideoCollectionUiLoader::doFindWidget(const QString &name)
+QGraphicsWidget* VideoCollectionUiLoader::doFindWidget(const QString &name, bool loadIfNotFound)
 {
 	FUNC_LOG;
     QGraphicsWidget *widget = 0;
@@ -211,7 +211,7 @@
     }
 
     // 2. load from document and initialize
-    else
+    else if (loadIfNotFound)
     {
         // find object from queue
         int index = indexInQueue(name);
@@ -238,7 +238,7 @@
 // doFindObject
 // ---------------------------------------------------------------------------
 //
-QObject* VideoCollectionUiLoader::doFindObject(const QString &name)
+QObject* VideoCollectionUiLoader::doFindObject(const QString &name, bool loadIfNotFound)
 {
 	FUNC_LOG;
     QObject *object = 0;
@@ -250,7 +250,7 @@
     }
 
     // 2. load from document and initialize
-    else
+    else if (loadIfNotFound)
     {
         // find object from queue
         int index = indexInQueue(name);
@@ -373,10 +373,8 @@
                     wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
                 if(model)
                 {
-                    // open and sort model
-                    model->open(VideoCollectionCommon::ELevelVideos);
-                    VideoCollectionViewUtils::sortModel(model, true, VideoCollectionCommon::ELevelVideos);
-                    
+                	VideoCollectionViewUtils::sortModel(model, true, VideoCollectionCommon::ELevelVideos);
+                	
                     // init widget
                     VideoServices *videoServices = 0;
                     if (mIsService)
@@ -393,9 +391,8 @@
             		VideoCollectionCommon::EModelTypeCollections);
             if (model)
             {
-                model->open(VideoCollectionCommon::ELevelCategory);
                 VideoCollectionViewUtils::sortModel(model, true, VideoCollectionCommon::ELevelCategory);
-
+                
                 // initialize video collection widget
                 VideoListWidget *videoList =
                     qobject_cast<VideoListWidget*>(object);
@@ -417,6 +414,10 @@
             		VideoCollectionCommon::EModelTypeCollectionContent);
             if (model)
             {
+                // collection content contains always a list of videos so we use 
+                // ELevelVideos as target for sorting
+                VideoCollectionViewUtils::sortModel(model, false, VideoCollectionCommon::ELevelVideos);
+                
                 VideoListWidget *videoList = qobject_cast<VideoListWidget*>(object);
                 if (videoList)
                 {