Qt5-specific: Fix pictures loading for Bgl and some Stardict dictionaries

This commit is contained in:
Abs62 2013-09-27 17:04:25 +04:00
parent f7ea6b1dcc
commit a1d539ff1f
4 changed files with 13 additions and 4 deletions

View file

@ -203,7 +203,7 @@ sptr< Dictionary::DataRequest > ArticleNetworkAccessManager::getResource(
} }
try try
{ {
return dictionaries[ x ]->getResource( url.path().mid( 1 ).toUtf8().data() ); return dictionaries[ x ]->getResource( Qt4x5::Url::path( url ).mid( 1 ).toUtf8().data() );
} }
catch( std::exception & e ) catch( std::exception & e )
{ {

View file

@ -1042,7 +1042,7 @@ vector< ResourceToSaveHandler * > ArticleView::saveResource( const QUrl & url, c
for( unsigned x = 0; x < activeDicts->size(); ++x ) for( unsigned x = 0; x < activeDicts->size(); ++x )
{ {
req = (*activeDicts)[ x ]->getResource( req = (*activeDicts)[ x ]->getResource(
url.path().mid( 1 ).toUtf8().data() ); Qt4x5::Url::path( url ).mid( 1 ).toUtf8().data() );
ResourceToSaveHandler * handler = new ResourceToSaveHandler( this, req, fileName ); ResourceToSaveHandler * handler = new ResourceToSaveHandler( this, req, fileName );
handlers.push_back( handler ); handlers.push_back( handler );
@ -1453,7 +1453,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
savePath = QDir::homePath(); savePath = QDir::homePath();
} }
QString name = url.path().section( '/', -1 ); QString name = Qt4x5::Url::path( url ).section( '/', -1 );
if ( result == saveSoundAction ) if ( result == saveSoundAction )
{ {

View file

@ -2964,7 +2964,7 @@ static void filterAndCollectResources( QString & html, QRegExp & rx, const QStri
{ {
QUrl url( rx.cap( 1 ) ); QUrl url( rx.cap( 1 ) );
QString host = url.host(); QString host = url.host();
QString resourcePath = QString::fromLatin1( QUrl::toPercentEncoding( url.path(), "/" ) ); QString resourcePath = QString::fromLatin1( QUrl::toPercentEncoding( Qt4x5::Url::path( url ), "/" ) );
if ( !host.startsWith( '/' ) ) if ( !host.startsWith( '/' ) )
host.insert( 0, '/' ); host.insert( 0, '/' );

View file

@ -110,6 +110,15 @@ inline void setQueryItems( QUrl & url, QList< QPair< QString, QString > > const
#endif #endif
} }
inline QString path( QUrl const & url )
{
#if IS_QT_5
return url.path( QUrl::FullyDecoded );
#else
return url.path();
#endif
}
} }
namespace Dom namespace Dom