videocollection/videocollectionview/src/videocollectionviewplugin.cpp
changeset 35 3738fe97f027
parent 30 4f111d64a341
child 36 8aed59de29f9
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 #include <xqplugin.h>
    19 #include <xqplugin.h>
       
    20 #include <xqserviceutil.h>
    20 #include <hbaction.h>
    21 #include <hbaction.h>
    21 #include <hbapplication.h>
    22 #include <hbapplication.h>
    22 #include <hbinstance.h>
    23 #include <hbinstance.h>
    23 
    24 
    24 #include "videocollectionviewplugin.h"
    25 #include "videocollectionviewplugin.h"
    25 #include "videolistview.h"
    26 #include "videolistview.h"
    26 #include "videocollectionuiloader.h"
    27 #include "videocollectionuiloader.h"
       
    28 #include "mpxhbvideocommondefs.h"
    27 
    29 
    28 // ---------------------------------------------------------------------------
    30 // ---------------------------------------------------------------------------
    29 // Constructor
    31 // Constructor
    30 // ---------------------------------------------------------------------------
    32 // ---------------------------------------------------------------------------
    31 //
    33 //
    32 VideoCollectionViewPlugin::VideoCollectionViewPlugin()
    34 VideoCollectionViewPlugin::VideoCollectionViewPlugin()
    33     : mUiLoader(0),
    35     : mUiLoader(0),
    34       mView(0),
    36       mView(0),
    35       mActivated(false)
    37       mActivated(false),
       
    38       mIsService(false)
    36 {
    39 {
    37 }
    40 }
    38 
    41 
    39 // ---------------------------------------------------------------------------
    42 // ---------------------------------------------------------------------------
    40 // Destructor
    43 // Destructor
    59             mUiLoader = new VideoCollectionUiLoader();
    62             mUiLoader = new VideoCollectionUiLoader();
    60         }
    63         }
    61 
    64 
    62         mUiLoader->reset();
    65         mUiLoader->reset();
    63 
    66 
       
    67         if (XQServiceUtil::isService())
       
    68         {
       
    69         	mIsService = true;
       
    70         }
       
    71         
       
    72         mUiLoader->setIsService(mIsService);
       
    73 
    64 		bool ok(false);
    74 		bool ok(false);
    65 
    75 
    66 		QList<QObject *> objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
    76 		QList<QObject *> objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
    67 
    77 
    68 	    if (!ok)
    78 	    if (!ok)
    76         {
    86         {
    77             // TODO: handle error: creating view
    87             // TODO: handle error: creating view
    78             return;
    88             return;
    79         }
    89         }
    80 
    90 
    81         if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) ) {
    91         if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) ||
       
    92            !connect( this, SIGNAL(doDelayeds()), mView, SLOT(doDelayedsSlot()) )) {
    82             // TODO: handle error: connecting signal
    93             // TODO: handle error: connecting signal
    83             delete mView;
    94             delete mView;
    84             mView = 0;
    95             mView = 0;
    85             return;
    96             return;
    86         }
    97         }
       
    98         mTimerId = startTimer(DELAYED_LOAD_TIMEOUT);
       
    99         mView->initializeView();
       
   100     }
       
   101 }
    87 
   102 
    88         mView->initializeView();
       
    89 
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // timerEvent
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 void VideoCollectionViewPlugin::timerEvent(QTimerEvent *event)
       
   109 {
       
   110     if (event)
       
   111     {
       
   112         if (event->timerId() == mTimerId)
       
   113         {
       
   114         	killTimer(mTimerId);
       
   115         	mTimerId = 0;
       
   116 
       
   117         	emit command(MpxHbVideoCommon::DoDelayedLoad);
       
   118         	emit doDelayeds();
       
   119         }
    90     }
   120     }
    91 }
   121 }
    92 
   122 
    93 // ---------------------------------------------------------------------------
   123 // ---------------------------------------------------------------------------
    94 // Destroy view
   124 // Destroy view