diff --git a/src/libtomahawk/utils/TomahawkUtils.cpp b/src/libtomahawk/utils/TomahawkUtils.cpp index 129a6a86f..1cd3e031d 100644 --- a/src/libtomahawk/utils/TomahawkUtils.cpp +++ b/src/libtomahawk/utils/TomahawkUtils.cpp @@ -904,4 +904,14 @@ percentEncode( const QUrl& url ) return data; } +QByteArray +encodedQuery( const QUrl& url ) +{ +#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) + return url.query(QUrl::FullyEncoded).toUtf8(); +#else + return url.encodedQuery(); +#endif +} + } // ns diff --git a/src/libtomahawk/utils/TomahawkUtils.h b/src/libtomahawk/utils/TomahawkUtils.h index c40f58bd4..03cdfed68 100644 --- a/src/libtomahawk/utils/TomahawkUtils.h +++ b/src/libtomahawk/utils/TomahawkUtils.h @@ -213,6 +213,7 @@ namespace TomahawkUtils DLLEXPORT bool urlHasQueryItem( const QUrl& url, const QString& key ); DLLEXPORT QList > urlQueryItems( const QUrl& url ); DLLEXPORT void urlSetQuery( QUrl& url, const QString& query ); + DLLEXPORT QByteArray encodedQuery( const QUrl& url ); }