From f5de7e0a3f022849f336815f4e1db3fa50673b43 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Wed, 5 Mar 2014 17:46:52 +0000 Subject: [PATCH] Add method to get encodedQuery independent of Qt version --- src/libtomahawk/utils/TomahawkUtils.cpp | 10 ++++++++++ src/libtomahawk/utils/TomahawkUtils.h | 1 + 2 files changed, 11 insertions(+) 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 ); }