30
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Implementation of VideoServiceUriFetch
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
36
|
18 |
// Version : %version: %
|
|
19 |
|
30
|
20 |
#include <hbapplication.h>
|
|
21 |
|
36
|
22 |
#include "videoservices.h"
|
|
23 |
#include "videoserviceurifetch.h"
|
30
|
24 |
#include "mpxhbvideocommondefs.h"
|
36
|
25 |
#include "mpxvideo_debug.h"
|
30
|
26 |
|
|
27 |
|
|
28 |
// ----------------------------------------------------------------------------
|
|
29 |
// VideoServiceUriFetch()
|
|
30 |
// ----------------------------------------------------------------------------
|
|
31 |
//
|
|
32 |
VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent)
|
36
|
33 |
: XQServiceProvider( QLatin1String("com.nokia.Videos.IVideoFetch"), parent )
|
|
34 |
, mRequestIndex( 0 )
|
|
35 |
, mServiceApp( parent )
|
30
|
36 |
{
|
36
|
37 |
MPX_ENTER_EXIT(_L("VideoServiceUriFetch::VideoServiceUriFetch()"));
|
30
|
38 |
publishAll();
|
|
39 |
}
|
|
40 |
|
|
41 |
// ----------------------------------------------------------------------------
|
|
42 |
// ~VideoServiceUriFetch()
|
|
43 |
// ----------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
VideoServiceUriFetch::~VideoServiceUriFetch()
|
|
46 |
{
|
36
|
47 |
MPX_DEBUG(_L("VideoServiceUriFetch::~VideoServiceUriFetch()"));
|
30
|
48 |
}
|
|
49 |
|
|
50 |
// ----------------------------------------------------------------------------
|
|
51 |
// fetchFailed()
|
|
52 |
// ----------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
void VideoServiceUriFetch::fetchFailed( int errorCode )
|
|
55 |
{
|
36
|
56 |
MPX_ENTER_EXIT(_L("VideoServiceUriFetch::fetchFailed()"),
|
|
57 |
_L("errorCode = %d"), errorCode );
|
|
58 |
|
30
|
59 |
QStringList filesList;
|
36
|
60 |
filesList.insert( 0, QString::number( errorCode ) ); //result
|
|
61 |
doComplete( filesList );
|
30
|
62 |
}
|
|
63 |
|
|
64 |
// ----------------------------------------------------------------------------
|
|
65 |
// complete()
|
|
66 |
// ----------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
void VideoServiceUriFetch::complete( QStringList filesList )
|
|
69 |
{
|
36
|
70 |
MPX_ENTER_EXIT(_L("VideoServiceUriFetch::complete()"));
|
|
71 |
|
|
72 |
doComplete( filesList );
|
30
|
73 |
}
|
|
74 |
|
|
75 |
// ----------------------------------------------------------------------------
|
|
76 |
// doComplete()
|
|
77 |
// ----------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
void VideoServiceUriFetch::doComplete( QStringList filesList)
|
|
80 |
{
|
36
|
81 |
MPX_ENTER_EXIT(_L("VideoServiceUriFetch::doComplete()"));
|
|
82 |
|
30
|
83 |
if ( isActive() )
|
|
84 |
{
|
|
85 |
connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
|
36
|
86 |
bool ok = completeRequest(mRequestIndex, filesList);
|
30
|
87 |
mRequestIndex = 0;
|
36
|
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 |
}
|
30
|
99 |
}
|
|
100 |
}
|
|
101 |
|
|
102 |
// ----------------------------------------------------------------------------
|
|
103 |
// isActive()
|
|
104 |
// ----------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
bool VideoServiceUriFetch::isActive()
|
|
107 |
{
|
36
|
108 |
MPX_DEBUG(_L("VideoServiceUriFetch::isActive() ret %d"), mRequestIndex );
|
|
109 |
|
30
|
110 |
return (mRequestIndex > 0);
|
|
111 |
}
|
|
112 |
|
|
113 |
// ----------------------------------------------------------------------------
|
|
114 |
// VideoServiceUriFetch()
|
|
115 |
// ----------------------------------------------------------------------------
|
|
116 |
//
|
|
117 |
QString VideoServiceUriFetch::contextTitle() const
|
|
118 |
{
|
36
|
119 |
MPX_DEBUG(_L("VideoServiceUriFetch::contextTitle() ret %s"), mTitle.data() );
|
|
120 |
|
30
|
121 |
return mTitle;
|
|
122 |
}
|
|
123 |
|
|
124 |
// ----------------------------------------------------------------------------
|
|
125 |
// fetch()
|
|
126 |
// ----------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void VideoServiceUriFetch::fetch(const QString& title)
|
|
129 |
{
|
36
|
130 |
MPX_ENTER_EXIT(_L("VideoServiceUriFetch::fetch()"),
|
|
131 |
_L("title = %s"), title.data() );
|
|
132 |
|
30
|
133 |
mTitle = title;
|
|
134 |
emit mServiceApp->activated(MpxHbVideoCommon::ActivateCollectionView);
|
|
135 |
emit mServiceApp->titleReady(title);
|
|
136 |
|
|
137 |
mServiceApp->setCurrentService(VideoServices::EUriFetcher);
|
|
138 |
|
|
139 |
mRequestIndex = setCurrentRequestAsync();
|
36
|
140 |
MPX_DEBUG(_L("VideoServiceUriFetch::fetch() : mRequestIndex(%d)"), mRequestIndex );
|
30
|
141 |
}
|
|
142 |
|