videocollection/videocollectionview/src/videocollectionviewplugin.cpp
changeset 35 3738fe97f027
parent 30 4f111d64a341
child 36 8aed59de29f9
--- a/videocollection/videocollectionview/src/videocollectionviewplugin.cpp	Thu Apr 01 23:22:15 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionviewplugin.cpp	Thu Apr 01 23:32:44 2010 +0300
@@ -17,6 +17,7 @@
 
 // INCLUDE FILES
 #include <xqplugin.h>
+#include <xqserviceutil.h>
 #include <hbaction.h>
 #include <hbapplication.h>
 #include <hbinstance.h>
@@ -24,6 +25,7 @@
 #include "videocollectionviewplugin.h"
 #include "videolistview.h"
 #include "videocollectionuiloader.h"
+#include "mpxhbvideocommondefs.h"
 
 // ---------------------------------------------------------------------------
 // Constructor
@@ -32,7 +34,8 @@
 VideoCollectionViewPlugin::VideoCollectionViewPlugin()
     : mUiLoader(0),
       mView(0),
-      mActivated(false)
+      mActivated(false),
+      mIsService(false)
 {
 }
 
@@ -61,6 +64,13 @@
 
         mUiLoader->reset();
 
+        if (XQServiceUtil::isService())
+        {
+        	mIsService = true;
+        }
+        
+        mUiLoader->setIsService(mIsService);
+
 		bool ok(false);
 
 		QList<QObject *> objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
@@ -78,15 +88,35 @@
             return;
         }
 
-        if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) ) {
+        if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) ||
+           !connect( this, SIGNAL(doDelayeds()), mView, SLOT(doDelayedsSlot()) )) {
             // TODO: handle error: connecting signal
             delete mView;
             mView = 0;
             return;
         }
-
+        mTimerId = startTimer(DELAYED_LOAD_TIMEOUT);
         mView->initializeView();
+    }
+}
 
+
+// ---------------------------------------------------------------------------
+// timerEvent
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::timerEvent(QTimerEvent *event)
+{
+    if (event)
+    {
+        if (event->timerId() == mTimerId)
+        {
+        	killTimer(mTimerId);
+        	mTimerId = 0;
+
+        	emit command(MpxHbVideoCommon::DoDelayedLoad);
+        	emit doDelayeds();
+        }
     }
 }