36
|
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 for share player.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
35
|
18 |
#ifdef SHARE_FUNC_ENABLED
|
|
19 |
|
|
20 |
#include "mpdetailssharedialog.h"
|
|
21 |
#include "mpsharedata.h"
|
|
22 |
#include "mpsongdata.h"
|
|
23 |
#include "mptrace.h"
|
|
24 |
#include <QObject>
|
|
25 |
#include <QGraphicsWebView>
|
|
26 |
#include <QGraphicsScene>
|
|
27 |
#include <QWebPage>
|
|
28 |
#include <QWebFrame>
|
|
29 |
#include <QNetworkAccessManager>
|
|
30 |
#include <QNetworkDiskCache>
|
36
|
31 |
#include <QNetworkReply>
|
35
|
32 |
#include <QDesktopServices>
|
|
33 |
#include <QNetworkProxyFactory>
|
36
|
34 |
#include <QTimer>
|
35
|
35 |
#include <hbmessagebox.h>
|
|
36 |
#include <QFile>
|
|
37 |
#include <QTextStream>
|
36
|
38 |
#include <qsysteminfo.h>
|
|
39 |
#include <hbmainwindow.h>
|
|
40 |
#include <hbstyleloader.h>
|
|
41 |
#include <hbprogressdialog.h>
|
35
|
42 |
|
36
|
43 |
QTM_USE_NAMESPACE
|
35
|
44 |
|
|
45 |
// SHARE_INDEX_FILE defines where the index.html file is loaded from.
|
|
46 |
#define SHARE_INDEX_URL "qrc:///shareview/index.html"
|
|
47 |
|
|
48 |
#ifdef Q_OS_SYMBIAN
|
|
49 |
// Symbian target.
|
|
50 |
#ifdef SHARE_PLAYER_RND
|
|
51 |
// For R&D testing, index.html may be loaded from E: drive.
|
|
52 |
// User must manually place index.html in the correct location.
|
|
53 |
// If the RND file does not exist, then SHARE_INDEX_URL will be used.
|
36
|
54 |
#define RND_SHARE_INDEX_URL "file:///f:/index.html"
|
|
55 |
#define RND_SHARE_INDEX_FILE "f:\\index.html"
|
|
56 |
#define RND_OVI_LOGIN_FILE "f:\\ovicredentials.txt"
|
35
|
57 |
#endif
|
|
58 |
#else
|
|
59 |
// Assume Windows target.
|
|
60 |
#define RND_SHARE_INDEX_URL "file:///c:/temp/index.html"
|
|
61 |
#define RND_SHARE_INDEX_FILE "c:\\temp\\index.html"
|
|
62 |
#define RND_OVI_LOGIN_FILE "c:\\temp\\ovicredentials.txt"
|
|
63 |
|
|
64 |
#endif
|
|
65 |
|
36
|
66 |
// Default language in case QSystemInfo does not work.
|
|
67 |
#define DEFAULT_LANGUAGE "en-US"
|
|
68 |
|
|
69 |
// Default error message.
|
|
70 |
#define ERROR_MESSAGE "An error occured. Sharing is not currently available"
|
|
71 |
|
|
72 |
|
|
73 |
/*!
|
|
74 |
MpNetworkAccessManager allows local caching of publishing player files
|
|
75 |
in order to minimize network traffic.
|
|
76 |
The files will be cached to the private directory of the application,
|
|
77 |
i.e. in the music player's case, this is C:\Private\10207C62\Cache.
|
|
78 |
*/
|
35
|
79 |
class MpNetworkAccessManager : public QNetworkAccessManager
|
|
80 |
{
|
|
81 |
public:
|
36
|
82 |
MpNetworkAccessManager( QObject* parent = 0 )
|
|
83 |
: QNetworkAccessManager( parent )
|
|
84 |
{
|
|
85 |
proxyFactory()->setUseSystemConfiguration( true );
|
|
86 |
QNetworkDiskCache* diskCache = new QNetworkDiskCache( this );
|
|
87 |
QString location = QDesktopServices::storageLocation( QDesktopServices::CacheLocation );
|
|
88 |
diskCache->setCacheDirectory( location );
|
|
89 |
setCache( diskCache );
|
|
90 |
}
|
35
|
91 |
|
|
92 |
private:
|
36
|
93 |
QNetworkReply* createRequest( Operation op,
|
|
94 |
const QNetworkRequest &request,
|
|
95 |
QIODevice* outgoingData = 0 )
|
35
|
96 |
{
|
|
97 |
TX_ENTRY
|
36
|
98 |
TX_LOG_ARGS( "share: createRequest URL=" << request.url().toString() )
|
|
99 |
|
35
|
100 |
QVariant val = request.attribute( QNetworkRequest::CacheLoadControlAttribute );
|
|
101 |
|
|
102 |
// Change the cache load control attrbute!
|
|
103 |
QNetworkRequest req = request;
|
|
104 |
req.setAttribute( QNetworkRequest::CacheLoadControlAttribute,
|
36
|
105 |
QVariant( QNetworkRequest::PreferCache ) );
|
|
106 |
QNetworkReply* result = QNetworkAccessManager::createRequest( op, req, outgoingData );
|
35
|
107 |
TX_EXIT
|
36
|
108 |
return result;
|
|
109 |
}
|
|
110 |
};
|
|
111 |
|
|
112 |
/*!
|
|
113 |
MpShareWebView derives from QGraphicsWebView in order to override it's
|
|
114 |
contextMenuEvent method to prevent the background context menu from
|
|
115 |
being displayed when user makes long click in the web view.
|
|
116 |
*/
|
|
117 |
class MpShareWebView : public QGraphicsWebView
|
|
118 |
{
|
|
119 |
public:
|
|
120 |
MpShareWebView( QGraphicsItem * parent = 0 )
|
|
121 |
: QGraphicsWebView( parent )
|
|
122 |
{
|
|
123 |
settings()->setAttribute( QWebSettings::LocalContentCanAccessRemoteUrls, true );
|
|
124 |
settings()->setAttribute( QWebSettings::LocalStorageDatabaseEnabled, true );
|
|
125 |
settings()->enablePersistentStorage();
|
|
126 |
}
|
|
127 |
|
|
128 |
protected:
|
|
129 |
void contextMenuEvent( QGraphicsSceneContextMenuEvent* /*ev*/ ) // Override QGraphicsWebView::contextMenuEvent
|
|
130 |
{
|
|
131 |
// Fix to prevent "Stop" and "Reload" buttons in page background.
|
|
132 |
// Do not respond to the contextMenuEvent.
|
35
|
133 |
}
|
|
134 |
};
|
|
135 |
|
|
136 |
|
|
137 |
/*!
|
|
138 |
Constructor.
|
|
139 |
*/
|
|
140 |
MpDetailsShareDialog::MpDetailsShareDialog()
|
|
141 |
: mShareWebView( 0 ),
|
36
|
142 |
mShareNetAccMan( 0 ),
|
|
143 |
mProgressbar ( 0 ),
|
|
144 |
mIsInitialized( false )
|
35
|
145 |
{
|
36
|
146 |
// DeleteOnClose attribute prevents crash when user presses Cancel
|
|
147 |
// before publishing player is fully loaded.
|
|
148 |
setAttribute( Qt::WA_DeleteOnClose, true );
|
35
|
149 |
}
|
|
150 |
|
36
|
151 |
/*!
|
|
152 |
Initialize the share dialog.
|
|
153 |
When fully initialized we set our mIsInitialized flag to true.
|
|
154 |
Our isInitialized() method can be called to determine whether
|
|
155 |
initialization was successful.
|
|
156 |
*/
|
|
157 |
void MpDetailsShareDialog::initialize( MpSongData* aSongData, const QString& aUnknownTr )
|
35
|
158 |
{
|
|
159 |
TX_ENTRY
|
|
160 |
if ( !initUser() )
|
|
161 |
{
|
|
162 |
emit closeShareDialog();
|
|
163 |
return;
|
|
164 |
}
|
36
|
165 |
initShareData( aSongData, aUnknownTr );
|
|
166 |
initLanguage();
|
35
|
167 |
initNetworkAccessManager();
|
|
168 |
initWebView();
|
|
169 |
initSignalSlots();
|
|
170 |
|
|
171 |
setDismissPolicy( HbDialog::NoDismiss );
|
|
172 |
|
|
173 |
// No timeout needed for the dialog.
|
|
174 |
setTimeout( HbPopup::NoTimeout );
|
|
175 |
|
|
176 |
#ifdef SHARE_PLAYER_RND
|
|
177 |
// Test whether the RND file exists.
|
|
178 |
QFile file( RND_SHARE_INDEX_FILE );
|
|
179 |
if ( file.exists() )
|
|
180 |
{
|
|
181 |
// Load the RND URL from the specified location to the web view.
|
|
182 |
TX_LOG_ARGS( "share: Use RND index.html file " << RND_SHARE_INDEX_FILE )
|
|
183 |
mShareWebView->load( QUrl( RND_SHARE_INDEX_URL ) );
|
|
184 |
}
|
|
185 |
else
|
|
186 |
#endif
|
|
187 |
{
|
|
188 |
// Load the production URL from the application resources to the web view.
|
|
189 |
TX_LOG_ARGS( "share: Use QRC index.html file " << SHARE_INDEX_URL )
|
|
190 |
mShareWebView->load( QUrl( SHARE_INDEX_URL ) );
|
|
191 |
}
|
36
|
192 |
|
|
193 |
// Flag that the dialog is now fully initialized.
|
|
194 |
mIsInitialized = true;
|
|
195 |
|
|
196 |
// Show progress dialog in .3 second if loading not finished.
|
|
197 |
QTimer::singleShot(300, this, SLOT(showProgressDialog()));
|
|
198 |
|
35
|
199 |
TX_EXIT
|
|
200 |
}
|
|
201 |
|
|
202 |
/*!
|
|
203 |
Destructor.
|
|
204 |
*/
|
|
205 |
MpDetailsShareDialog::~MpDetailsShareDialog()
|
|
206 |
{
|
|
207 |
TX_ENTRY
|
36
|
208 |
if ( mShareData.songData() )
|
|
209 |
{
|
|
210 |
// Ensure that we remove the temporary album art file when we close the dialog.
|
|
211 |
// TODO this should be removed when base64 issue is solved.
|
|
212 |
TX_LOG_ARGS( "share: remove album art file" )
|
|
213 |
mShareData.songData()->removeAlbumArtFile();
|
|
214 |
}
|
35
|
215 |
logoutPlayer();
|
36
|
216 |
// Probably mShareNetAccMan should not be deleted but qt documentation
|
|
217 |
// does not indicate whether QWebPage takes ownership of the object or not.
|
|
218 |
// See http://doc.qt.nokia.com/4.6/qwebpage.html
|
|
219 |
//delete mShareNetAccMan;
|
35
|
220 |
TX_EXIT
|
|
221 |
}
|
|
222 |
|
36
|
223 |
/*!
|
|
224 |
Initialize share data.
|
|
225 |
*/
|
|
226 |
void MpDetailsShareDialog::initShareData( MpSongData* aSongData, const QString& aUnknownTr )
|
35
|
227 |
{
|
|
228 |
TX_ENTRY
|
|
229 |
// Set information for the share data.
|
|
230 |
mShareData.setOwner( this );
|
|
231 |
mShareData.setSongData( aSongData );
|
36
|
232 |
mShareData.setErrorMessage( tr( ERROR_MESSAGE ) );
|
|
233 |
mShareData.setUnknownTr( aUnknownTr );
|
35
|
234 |
TX_EXIT
|
|
235 |
}
|
|
236 |
|
36
|
237 |
/*!
|
|
238 |
Initialize language.
|
|
239 |
Language string is formatted like "en-US", where "en" is the ISO-639-1 language code,
|
|
240 |
and "US" is the ISO-3166-1 country code.
|
|
241 |
We use the QT Mobility API (systeminfo) to obtain the settings from the device.
|
|
242 |
In the event that we cannot construct the QSystemInfo variable then we will fallback
|
|
243 |
to some DEFAULT_LANGUAGE setting.
|
|
244 |
*/
|
|
245 |
void MpDetailsShareDialog::initLanguage()
|
|
246 |
{
|
|
247 |
TX_ENTRY
|
|
248 |
// Set language string, example "en-US".
|
|
249 |
QString language;
|
|
250 |
QSystemInfo* sysInfo = new QSystemInfo( this );
|
|
251 |
if ( sysInfo )
|
|
252 |
{
|
|
253 |
language += sysInfo->currentLanguage(); // ISO-639-1 language code.
|
|
254 |
language += "-";
|
|
255 |
language += sysInfo->currentCountryCode(); // ISO-3166-1 country code.
|
|
256 |
delete sysInfo;
|
|
257 |
}
|
|
258 |
else
|
|
259 |
{
|
|
260 |
// Fallback to the default language.
|
|
261 |
language = DEFAULT_LANGUAGE;
|
|
262 |
}
|
|
263 |
TX_LOG_ARGS( "share: language '" << language << "'" )
|
|
264 |
mShareData.setLanguage( language );
|
|
265 |
TX_EXIT
|
|
266 |
}
|
|
267 |
|
|
268 |
/*!
|
|
269 |
Initialize network access manager.
|
|
270 |
*/
|
35
|
271 |
void MpDetailsShareDialog::initNetworkAccessManager()
|
|
272 |
{
|
|
273 |
TX_ENTRY
|
36
|
274 |
// Make our own network access manager to allow file retrieval from local cache,
|
35
|
275 |
// since configuration for the default network access manager seems to be
|
|
276 |
// to always redownload from network.
|
36
|
277 |
if ( !mShareNetAccMan )
|
|
278 |
{
|
|
279 |
TX_LOG_ARGS( "share: construct network access manager" )
|
|
280 |
mShareNetAccMan = new MpNetworkAccessManager( this );
|
|
281 |
}
|
35
|
282 |
TX_EXIT
|
|
283 |
}
|
|
284 |
|
36
|
285 |
/*!
|
|
286 |
Initialize the web view.
|
|
287 |
*/
|
35
|
288 |
void MpDetailsShareDialog::initWebView()
|
|
289 |
{
|
|
290 |
TX_ENTRY
|
36
|
291 |
if ( !mShareWebView )
|
|
292 |
{
|
|
293 |
TX_LOG_ARGS( "share: construct share web view" )
|
|
294 |
mShareWebView = new MpShareWebView( this );
|
|
295 |
mShareWebView->page()->setNetworkAccessManager( mShareNetAccMan );
|
|
296 |
mShareWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
|
|
297 |
mShareWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded);
|
|
298 |
setContentWidget( mShareWebView );
|
|
299 |
addContext();
|
|
300 |
mProgressbar = new HbProgressDialog(HbProgressDialog::WaitDialog);
|
|
301 |
mProgressbar->setText(tr("Loading"));
|
|
302 |
}
|
35
|
303 |
TX_EXIT
|
|
304 |
}
|
|
305 |
|
36
|
306 |
/*!
|
|
307 |
Initialize signals and slots.
|
|
308 |
*/
|
35
|
309 |
void MpDetailsShareDialog::initSignalSlots()
|
|
310 |
{
|
|
311 |
TX_ENTRY
|
36
|
312 |
// Connect various signals to slots for networking.
|
|
313 |
connect( mShareNetAccMan, SIGNAL( sslErrors( QNetworkReply*, const QList< QSslError >& ) ),
|
|
314 |
this, SLOT( handleRequestSSLErrors( QNetworkReply*, const QList< QSslError >& ) ) );
|
|
315 |
connect( mShareNetAccMan, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( handleRequestFinished( QNetworkReply* ) ) );
|
|
316 |
|
35
|
317 |
// Connect various signals to slots for interface to webview.
|
|
318 |
connect( mShareWebView, SIGNAL( loadFinished( bool ) ), SLOT( onIndexLoad( bool ) ) );
|
|
319 |
connect( mShareWebView->page()->mainFrame(), SIGNAL( javaScriptWindowObjectCleared() ), this, SLOT( addContext() ) );
|
|
320 |
connect( mShareWebView->page(), SIGNAL( windowCloseRequested() ), this, SIGNAL( closeShareDialog() ) );
|
36
|
321 |
connect( mProgressbar, SIGNAL(cancelled()), this, SIGNAL( closeShareDialog() ) );
|
35
|
322 |
TX_EXIT
|
|
323 |
}
|
|
324 |
|
|
325 |
/*!
|
|
326 |
initUser is used as temporary solution until Single Sign On is implemented in platform.
|
|
327 |
*/
|
|
328 |
bool MpDetailsShareDialog::initUser()
|
|
329 |
{
|
|
330 |
TX_ENTRY
|
|
331 |
bool result = false;
|
|
332 |
#ifdef SHARE_PLAYER_RND
|
|
333 |
// ovicredentials.txt is used as temporary solution until Single Sign On is implemented in platform.
|
|
334 |
QFile file( RND_OVI_LOGIN_FILE );
|
|
335 |
if ( !file.open( QFile::ReadOnly ) )
|
|
336 |
{
|
36
|
337 |
// There must be e:ovicredentials.txt in the filesystem but don't show error dialog
|
|
338 |
// otherwise it will appear as soon as detailsview is created.
|
|
339 |
result = false;
|
35
|
340 |
}
|
|
341 |
else
|
|
342 |
{
|
|
343 |
QTextStream stream ( &file );
|
|
344 |
QString strCred = stream.readLine( 0 );
|
|
345 |
file.close();
|
|
346 |
QStringList slCred = strCred.split( ":" );
|
|
347 |
if ( slCred.length() > 1 )
|
|
348 |
{
|
|
349 |
mShareData.setUsername( slCred[ 0 ] );
|
|
350 |
mShareData.setPassword( slCred[ 1 ] );
|
|
351 |
result = true;
|
|
352 |
}
|
|
353 |
else
|
|
354 |
{
|
|
355 |
errorHandler( "share", QString( RND_OVI_LOGIN_FILE ) + " username:password expected" );
|
|
356 |
}
|
|
357 |
}
|
|
358 |
TX_LOG_ARGS( "share: credentials " << mShareData.username() << " / " << mShareData.password() )
|
|
359 |
#else
|
|
360 |
// TODO: Single Sign On stuff.
|
|
361 |
#endif // SHARE_PLAYER_RND
|
|
362 |
TX_EXIT
|
|
363 |
return result;
|
|
364 |
}
|
|
365 |
|
|
366 |
/*!
|
36
|
367 |
Returns true if the dialog has been fully initialized.
|
|
368 |
*/
|
|
369 |
bool MpDetailsShareDialog::isInitialized() const
|
|
370 |
{
|
|
371 |
return mIsInitialized;
|
|
372 |
}
|
|
373 |
|
|
374 |
/*!
|
|
375 |
Attempt to cache the publishing player files from internet
|
|
376 |
to improve user experience for first-time use.
|
|
377 |
If the files are already in the cache and have not expired,
|
|
378 |
then this should not do anything.
|
|
379 |
*/
|
|
380 |
void MpDetailsShareDialog::cachePublishingPlayerFiles()
|
|
381 |
{
|
|
382 |
TX_ENTRY
|
|
383 |
// We need the network access manager, so make sure it is initialized.
|
|
384 |
if ( !mShareNetAccMan )
|
|
385 |
{
|
|
386 |
initNetworkAccessManager();
|
|
387 |
}
|
|
388 |
// Attempt to get the required publishing player files from the net in advance.
|
|
389 |
// We don't listen to any signal that the download succeeded or failed
|
|
390 |
// since we will let it silently fail at this stage.
|
|
391 |
// These URLs are also included in index.html resource, and the two must
|
|
392 |
// be kept the same.
|
|
393 |
mShareNetAccMan->get( QNetworkRequest( QUrl(
|
|
394 |
"http://hf.ci.wipsl.com/PleiXXPTsup/noheva-be/css/ovi.player.share.ui.css" ) ) );
|
|
395 |
mShareNetAccMan->get( QNetworkRequest( QUrl(
|
|
396 |
"http://hf.ci.wipsl.com/PleiXXPTsup/noheva-be/js/publishplayer.js" ) ) );
|
|
397 |
TX_EXIT
|
|
398 |
}
|
|
399 |
|
|
400 |
/*!
|
35
|
401 |
Release resources from share player.
|
|
402 |
*/
|
|
403 |
void MpDetailsShareDialog::logoutPlayer()
|
|
404 |
{
|
|
405 |
TX_ENTRY
|
36
|
406 |
if ( mShareWebView )
|
35
|
407 |
{
|
|
408 |
mShareWebView->page()->mainFrame()->evaluateJavaScript( "music.teardown();" );
|
|
409 |
}
|
|
410 |
TX_EXIT
|
|
411 |
}
|
|
412 |
|
|
413 |
/*!
|
|
414 |
Adds the shared data context to the javascript of the loaded page.
|
|
415 |
*/
|
|
416 |
void MpDetailsShareDialog::addContext()
|
|
417 |
{
|
|
418 |
TX_ENTRY
|
36
|
419 |
if ( mShareWebView )
|
35
|
420 |
{
|
|
421 |
mShareWebView->page()->mainFrame()->addToJavaScriptWindowObject( "context", &mShareData );
|
|
422 |
}
|
|
423 |
TX_EXIT
|
|
424 |
}
|
|
425 |
|
|
426 |
/*!
|
|
427 |
Updates the shared data context in the javascript of the loaded page.
|
|
428 |
*/
|
|
429 |
void MpDetailsShareDialog::updateSharedData()
|
|
430 |
{
|
|
431 |
TX_ENTRY
|
36
|
432 |
if ( mShareWebView )
|
35
|
433 |
{
|
36
|
434 |
// We don't need to call updateContextArea when the track URL has been updated.
|
|
435 |
//mShareWebView->page()->mainFrame()->evaluateJavaScript( "music.updateContextArea();" );
|
35
|
436 |
mShareWebView->page()->mainFrame()->evaluateJavaScript( "music.updateMetadata();" );
|
|
437 |
}
|
|
438 |
TX_EXIT
|
|
439 |
}
|
|
440 |
|
|
441 |
/*!
|
|
442 |
Slot to call when index.html loading completes.
|
|
443 |
*/
|
|
444 |
void MpDetailsShareDialog::onIndexLoad( bool aOk )
|
|
445 |
{
|
|
446 |
TX_ENTRY
|
|
447 |
if ( !aOk )
|
|
448 |
{
|
|
449 |
// Close the popup window, failed to load index.html.
|
|
450 |
// This is pretty serious and most likely unrecoverable error.
|
|
451 |
// Only thing we can do really is to close the share player
|
|
452 |
// dialog - TODO do we need to show any error message to user?
|
|
453 |
TX_LOG_ARGS( "share: failed to load index.html" )
|
|
454 |
emit closeShareDialog();
|
|
455 |
}
|
|
456 |
TX_EXIT
|
|
457 |
}
|
|
458 |
|
|
459 |
/*!
|
|
460 |
Slot to call for debug output.
|
|
461 |
*/
|
|
462 |
void MpDetailsShareDialog::debugJs( QString s )
|
|
463 |
{
|
|
464 |
TX_ENTRY
|
|
465 |
TX_LOG_ARGS( "share: debugJs: " << s )
|
|
466 |
TX_EXIT
|
|
467 |
}
|
|
468 |
|
|
469 |
/*!
|
|
470 |
Slot to call for displaying an error message to the user.
|
|
471 |
*/
|
36
|
472 |
void MpDetailsShareDialog::errorHandler( QString aError, QString aMessage )
|
35
|
473 |
{
|
|
474 |
TX_ENTRY
|
36
|
475 |
// If error argument ends with "_SUCCESS", then this should be an info message.
|
|
476 |
// If error argument ends with "_FAILED" or something else, then this should be a warning message.
|
|
477 |
TX_LOG_ARGS( "share: errorHandler: " << aError << ": " << aMessage )
|
|
478 |
if ( aError.endsWith( "_SUCCESS" ) )
|
|
479 |
{
|
|
480 |
// TODO this method seems to be deprecated?
|
|
481 |
HbMessageBox::information( tr( "%1" ).arg( aError ) + ": " + tr( "%1" ).arg( aMessage ) ); // For week16 hbwidgets
|
|
482 |
}
|
|
483 |
else
|
|
484 |
{
|
|
485 |
// TODO this method seems to be deprecated?
|
|
486 |
HbMessageBox::warning( tr( "%1" ).arg( aError ) + ": " + tr( "%1" ).arg( aMessage ) ); // For week16 hbwidgets
|
|
487 |
// HbMessageBox::launchWarningMessageBox( tr( "%1" ).arg( aError ) + ": " + tr( "%1" ).arg( message ) ); // For week12 hbwidgets
|
|
488 |
}
|
35
|
489 |
TX_EXIT
|
|
490 |
}
|
|
491 |
|
|
492 |
/*!
|
|
493 |
Slot to call to clear the web view cache.
|
|
494 |
*/
|
|
495 |
void MpDetailsShareDialog::clearCache()
|
|
496 |
{
|
|
497 |
TX_ENTRY
|
|
498 |
QAbstractNetworkCache* cache = mShareNetAccMan ? mShareNetAccMan->cache() : NULL;
|
|
499 |
if ( cache )
|
|
500 |
{
|
|
501 |
TX_LOG_ARGS( "share: clearCache: clearing cache" )
|
|
502 |
cache->clear();
|
|
503 |
#ifdef SHARE_PLAYER_RND
|
|
504 |
errorHandler( "Cache", "Cleared cache!" );
|
|
505 |
#endif
|
|
506 |
}
|
|
507 |
else
|
|
508 |
{
|
|
509 |
TX_LOG_ARGS( "share: clearCache: unable to clear cache" )
|
|
510 |
#ifdef SHARE_PLAYER_RND
|
|
511 |
errorHandler( "Cache", "Could not clear cache!" );
|
|
512 |
#endif
|
|
513 |
}
|
|
514 |
TX_EXIT
|
|
515 |
}
|
|
516 |
|
36
|
517 |
/*!
|
|
518 |
Slot to show the publishing window after html elements are created in javascript.
|
|
519 |
*/
|
|
520 |
void MpDetailsShareDialog::showWindow()
|
|
521 |
{
|
|
522 |
TX_ENTRY
|
|
523 |
if (mProgressbar)
|
|
524 |
mProgressbar->close();
|
|
525 |
show();
|
|
526 |
TX_EXIT
|
|
527 |
}
|
|
528 |
|
|
529 |
/*!
|
|
530 |
Slot to show progress dialog if the publishing window is not loaded in .3 sec.
|
|
531 |
*/
|
|
532 |
void MpDetailsShareDialog::showProgressDialog()
|
|
533 |
{
|
|
534 |
TX_ENTRY
|
|
535 |
if (!isVisible())
|
|
536 |
mProgressbar->show();
|
|
537 |
TX_EXIT
|
|
538 |
}
|
|
539 |
|
|
540 |
/*!
|
|
541 |
Slot to SSL errors in network request. We will ignore any errors.
|
|
542 |
*/
|
|
543 |
void MpDetailsShareDialog::handleRequestSSLErrors( QNetworkReply* aReply, const QList< QSslError >& aErrors )
|
|
544 |
{
|
|
545 |
TX_ENTRY
|
|
546 |
aReply->ignoreSslErrors();
|
|
547 |
for( int i = 0; i < aErrors.count(); i++ )
|
|
548 |
{
|
|
549 |
TX_LOG_ARGS( "SSL error " << aErrors.at( i ).errorString() );
|
|
550 |
}
|
|
551 |
TX_EXIT
|
|
552 |
}
|
|
553 |
|
|
554 |
/*!
|
|
555 |
Slot to handle network request completion.
|
|
556 |
*/
|
|
557 |
void MpDetailsShareDialog::handleRequestFinished( QNetworkReply* aReply )
|
|
558 |
{
|
|
559 |
TX_ENTRY
|
|
560 |
if ( aReply->error() != QNetworkReply::NoError )
|
|
561 |
{
|
|
562 |
TX_LOG_ARGS( "Network request error " << aReply->error() << aReply->errorString() );
|
|
563 |
// TODO what to do now?
|
|
564 |
}
|
|
565 |
TX_EXIT
|
|
566 |
}
|
|
567 |
|
35
|
568 |
#endif // SHARE_FUNC_ENABLED
|