1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

Manually encode "'" as %27 for QUrls which is legal and makes more apps happy

This commit is contained in:
Leo Franchi
2011-08-14 14:17:06 -04:00
parent 65405682aa
commit 99a298edb5

View File

@@ -142,7 +142,9 @@ GlobalActionManager::copyPlaylistToClipboard( const dynplaylist_ptr& playlist )
}
QClipboard* cb = QApplication::clipboard();
cb->setText( link.toEncoded() );
QByteArray data = link.toEncoded();
data.replace( "'", "%27" ); // QUrl doesn't encode ', which it doesn't have to. Some apps don't like ' though, and want %27. Both are valid.
cb->setText( data );
return link.toString();
}
@@ -178,7 +180,9 @@ void
GlobalActionManager::copyToClipboard( const query_ptr& query ) const
{
QClipboard* cb = QApplication::clipboard();
cb->setText( openLinkFromQuery( query ).toEncoded() );
QByteArray data = openLinkFromQuery( query ).toEncoded();
data.replace( "'", "%27" ); // QUrl doesn't encode ', which it doesn't have to. Some apps don't like ' though, and want %27. Both are valid.
cb->setText( data );
}