Пример #1
0
QString Playlist::toRelativeUrl(const KUrl &trackUrl) const
{
	if ((trackUrl.scheme() == url.scheme()) && (trackUrl.authority() == url.authority())) {
		QByteArray playlistPath = url.encodedPath();
		int index = playlistPath.lastIndexOf('/');
		playlistPath.truncate(index + 1);
		QByteArray trackPath = trackUrl.encodedPath();

		if (trackPath.startsWith(playlistPath)) {
			trackPath.remove(0, index + 1);
			KUrl relativeUrl;
			relativeUrl.setEncodedPath(trackPath);
			relativeUrl.setEncodedQuery(trackUrl.encodedQuery());
			relativeUrl.setEncodedFragment(trackUrl.encodedFragment());
			return relativeUrl.url();
		}
	}

	return trackUrl.url();
}
Пример #2
0
QString Utilities::deviceTypeFromUrl(const KUrl& url)
{
    return url.authority();
}