13 * |
13 * |
14 * Description: Implementation of VideoServiceUriFetch |
14 * Description: Implementation of VideoServiceUriFetch |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 // Version : %version: % |
|
19 |
18 #include <hbapplication.h> |
20 #include <hbapplication.h> |
19 #include <videoservices.h> |
|
20 #include <videoserviceurifetch.h> |
|
21 |
21 |
|
22 #include "videoservices.h" |
|
23 #include "videoserviceurifetch.h" |
22 #include "mpxhbvideocommondefs.h" |
24 #include "mpxhbvideocommondefs.h" |
|
25 #include "mpxvideo_debug.h" |
23 |
26 |
24 |
27 |
25 // ---------------------------------------------------------------------------- |
28 // ---------------------------------------------------------------------------- |
26 // VideoServiceUriFetch() |
29 // VideoServiceUriFetch() |
27 // ---------------------------------------------------------------------------- |
30 // ---------------------------------------------------------------------------- |
28 // |
31 // |
29 VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent) |
32 VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent) |
30 : XQServiceProvider(QLatin1String("com.nokia.Videos.IVideoFetch"),parent), |
33 : XQServiceProvider( QLatin1String("com.nokia.Videos.IVideoFetch"), parent ) |
31 mRequestIndex(0), |
34 , mRequestIndex( 0 ) |
32 mServiceApp(parent) |
35 , mServiceApp( parent ) |
33 { |
36 { |
|
37 MPX_ENTER_EXIT(_L("VideoServiceUriFetch::VideoServiceUriFetch()")); |
34 publishAll(); |
38 publishAll(); |
35 } |
39 } |
36 |
40 |
37 // ---------------------------------------------------------------------------- |
41 // ---------------------------------------------------------------------------- |
38 // ~VideoServiceUriFetch() |
42 // ~VideoServiceUriFetch() |
39 // ---------------------------------------------------------------------------- |
43 // ---------------------------------------------------------------------------- |
40 // |
44 // |
41 VideoServiceUriFetch::~VideoServiceUriFetch() |
45 VideoServiceUriFetch::~VideoServiceUriFetch() |
42 { |
46 { |
43 |
47 MPX_DEBUG(_L("VideoServiceUriFetch::~VideoServiceUriFetch()")); |
44 } |
48 } |
45 |
49 |
46 // ---------------------------------------------------------------------------- |
50 // ---------------------------------------------------------------------------- |
47 // fetchFailed() |
51 // fetchFailed() |
48 // ---------------------------------------------------------------------------- |
52 // ---------------------------------------------------------------------------- |
49 // |
53 // |
50 void VideoServiceUriFetch::fetchFailed( int errorCode ) |
54 void VideoServiceUriFetch::fetchFailed( int errorCode ) |
51 { |
55 { |
|
56 MPX_ENTER_EXIT(_L("VideoServiceUriFetch::fetchFailed()"), |
|
57 _L("errorCode = %d"), errorCode ); |
|
58 |
52 QStringList filesList; |
59 QStringList filesList; |
53 filesList.insert(0, QString::number( errorCode ));//result |
60 filesList.insert( 0, QString::number( errorCode ) ); //result |
54 doComplete(filesList); |
61 doComplete( filesList ); |
55 } |
62 } |
56 |
63 |
57 // ---------------------------------------------------------------------------- |
64 // ---------------------------------------------------------------------------- |
58 // complete() |
65 // complete() |
59 // ---------------------------------------------------------------------------- |
66 // ---------------------------------------------------------------------------- |
60 // |
67 // |
61 void VideoServiceUriFetch::complete( QStringList filesList ) |
68 void VideoServiceUriFetch::complete( QStringList filesList ) |
62 { |
69 { |
63 doComplete(filesList); |
70 MPX_ENTER_EXIT(_L("VideoServiceUriFetch::complete()")); |
|
71 |
|
72 doComplete( filesList ); |
64 } |
73 } |
65 |
74 |
66 // ---------------------------------------------------------------------------- |
75 // ---------------------------------------------------------------------------- |
67 // doComplete() |
76 // doComplete() |
68 // ---------------------------------------------------------------------------- |
77 // ---------------------------------------------------------------------------- |
69 // |
78 // |
70 void VideoServiceUriFetch::doComplete( QStringList filesList) |
79 void VideoServiceUriFetch::doComplete( QStringList filesList) |
71 { |
80 { |
|
81 MPX_ENTER_EXIT(_L("VideoServiceUriFetch::doComplete()")); |
|
82 |
72 if ( isActive() ) |
83 if ( isActive() ) |
73 { |
84 { |
74 connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
85 connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); |
75 completeRequest(mRequestIndex, filesList); |
86 bool ok = completeRequest(mRequestIndex, filesList); |
76 mRequestIndex = 0; |
87 mRequestIndex = 0; |
|
88 |
|
89 // |
|
90 // double check that request was completed succesfully, otherwise |
|
91 // videos application cannot be exited at all |
|
92 // |
|
93 if ( ! ok ) |
|
94 { |
|
95 MPX_DEBUG(_L("VideoServiceUriFetch::doComplete() : completeRequest FAILED !")); |
|
96 |
|
97 qApp->quit(); |
|
98 } |
77 } |
99 } |
78 } |
100 } |
79 |
101 |
80 // ---------------------------------------------------------------------------- |
102 // ---------------------------------------------------------------------------- |
81 // isActive() |
103 // isActive() |
82 // ---------------------------------------------------------------------------- |
104 // ---------------------------------------------------------------------------- |
83 // |
105 // |
84 bool VideoServiceUriFetch::isActive() |
106 bool VideoServiceUriFetch::isActive() |
85 { |
107 { |
|
108 MPX_DEBUG(_L("VideoServiceUriFetch::isActive() ret %d"), mRequestIndex ); |
|
109 |
86 return (mRequestIndex > 0); |
110 return (mRequestIndex > 0); |
87 } |
111 } |
88 |
112 |
89 // ---------------------------------------------------------------------------- |
113 // ---------------------------------------------------------------------------- |
90 // VideoServiceUriFetch() |
114 // VideoServiceUriFetch() |
91 // ---------------------------------------------------------------------------- |
115 // ---------------------------------------------------------------------------- |
92 // |
116 // |
93 QString VideoServiceUriFetch::contextTitle() const |
117 QString VideoServiceUriFetch::contextTitle() const |
94 { |
118 { |
|
119 MPX_DEBUG(_L("VideoServiceUriFetch::contextTitle() ret %s"), mTitle.data() ); |
|
120 |
95 return mTitle; |
121 return mTitle; |
96 } |
122 } |
97 |
123 |
98 // ---------------------------------------------------------------------------- |
124 // ---------------------------------------------------------------------------- |
99 // fetch() |
125 // fetch() |
100 // ---------------------------------------------------------------------------- |
126 // ---------------------------------------------------------------------------- |
101 // |
127 // |
102 void VideoServiceUriFetch::fetch(const QString& title) |
128 void VideoServiceUriFetch::fetch(const QString& title) |
103 { |
129 { |
|
130 MPX_ENTER_EXIT(_L("VideoServiceUriFetch::fetch()"), |
|
131 _L("title = %s"), title.data() ); |
|
132 |
104 mTitle = title; |
133 mTitle = title; |
105 emit mServiceApp->activated(MpxHbVideoCommon::ActivateCollectionView); |
134 emit mServiceApp->activated(MpxHbVideoCommon::ActivateCollectionView); |
106 emit mServiceApp->titleReady(title); |
135 emit mServiceApp->titleReady(title); |
107 |
136 |
108 mServiceApp->setCurrentService(VideoServices::EUriFetcher); |
137 mServiceApp->setCurrentService(VideoServices::EUriFetcher); |
109 |
138 |
110 mRequestIndex = setCurrentRequestAsync(); |
139 mRequestIndex = setCurrentRequestAsync(); |
|
140 MPX_DEBUG(_L("VideoServiceUriFetch::fetch() : mRequestIndex(%d)"), mRequestIndex ); |
111 } |
141 } |
112 |
142 |