|
|
|
@ -75,18 +75,18 @@ namespace Amarok
|
|
|
|
|
{ |
|
|
|
|
TQString escapeHTML( const TQString &s ) |
|
|
|
|
{ |
|
|
|
|
return TQString(s).tqreplace( "&", "&" ).tqreplace( "<", "<" ).tqreplace( ">", ">" ); |
|
|
|
|
// .tqreplace( "%", "%25" ) has to be the first(!) one, otherwise we would do things like converting spaces into %20 and then convert them into %25%20
|
|
|
|
|
return TQString(s).replace( "&", "&" ).replace( "<", "<" ).replace( ">", ">" ); |
|
|
|
|
// .replace( "%", "%25" ) has to be the first(!) one, otherwise we would do things like converting spaces into %20 and then convert them into %25%20
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TQString escapeHTMLAttr( const TQString &s ) |
|
|
|
|
{ |
|
|
|
|
return TQString(s).tqreplace( "%", "%25" ).tqreplace( "'", "%27" ).tqreplace( "\"", "%22" ).tqreplace( "#", "%23" ).tqreplace( "?", "%3F" ); |
|
|
|
|
return TQString(s).replace( "%", "%25" ).replace( "'", "%27" ).replace( "\"", "%22" ).replace( "#", "%23" ).replace( "?", "%3F" ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TQString unescapeHTMLAttr( const TQString &s ) |
|
|
|
|
{ |
|
|
|
|
return TQString(s).tqreplace( "%3F", "?" ).tqreplace( "%23", "#" ).tqreplace( "%22", "\"" ).tqreplace( "%27", "'" ).tqreplace( "%25", "%" ); |
|
|
|
|
return TQString(s).replace( "%3F", "?" ).replace( "%23", "#" ).replace( "%22", "\"" ).replace( "%27", "'" ).replace( "%25", "%" ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TQString verboseTimeSince( const TQDateTime &datetime ) |
|
|
|
@ -146,7 +146,7 @@ namespace Amarok
|
|
|
|
|
*/ |
|
|
|
|
void albumArtistTrackFromUrl( TQString url, TQString &artist, TQString &album, TQString &detail ) |
|
|
|
|
{ |
|
|
|
|
if ( !url.tqcontains("@@@") ) return; |
|
|
|
|
if ( !url.contains("@@@") ) return; |
|
|
|
|
//KHTML removes the trailing space!
|
|
|
|
|
if ( url.endsWith( " @@@" ) ) |
|
|
|
|
url += ' '; |
|
|
|
@ -443,9 +443,9 @@ void ContextBrowser::openURLRequest( const KURL &url )
|
|
|
|
|
} |
|
|
|
|
else if ( url.protocol() == "show" ) |
|
|
|
|
{ |
|
|
|
|
if ( url.path().tqcontains( "suggestLyric-" ) ) |
|
|
|
|
if ( url.path().contains( "suggestLyric-" ) ) |
|
|
|
|
{ |
|
|
|
|
TQString _url = url.url().mid( url.url().tqfind( TQString( "-" ) ) +1 ); |
|
|
|
|
TQString _url = url.url().mid( url.url().find( TQString( "-" ) ) +1 ); |
|
|
|
|
debug() << "Clicked lyrics URL: " << _url << endl; |
|
|
|
|
m_dirtyLyricsPage = true; |
|
|
|
|
showLyrics( _url ); |
|
|
|
@ -503,7 +503,7 @@ void ContextBrowser::openURLRequest( const KURL &url )
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else if ( url.protocol() == "externalurl" ) |
|
|
|
|
Amarok::invokeBrowser( url.url().tqreplace( TQRegExp( "^externalurl:" ), "http:") ); |
|
|
|
|
Amarok::invokeBrowser( url.url().replace( TQRegExp( "^externalurl:" ), "http:") ); |
|
|
|
|
|
|
|
|
|
else if ( url.protocol() == "lastfm" ) |
|
|
|
|
{ |
|
|
|
@ -547,7 +547,7 @@ void ContextBrowser::openURLRequest( const KURL &url )
|
|
|
|
|
else if( url.protocol() == "ggartist" ) |
|
|
|
|
{ |
|
|
|
|
const TQString url2 = TQString( "http://www.google.com/musicsearch?q=%1&res=artist" ) |
|
|
|
|
.tqarg( KURL::encode_string_no_slash( unescapeHTMLAttr( url.path() ).tqreplace( " ", "+" ), 106 /*utf-8*/ ) ); |
|
|
|
|
.tqarg( KURL::encode_string_no_slash( unescapeHTMLAttr( url.path() ).replace( " ", "+" ), 106 /*utf-8*/ ) ); |
|
|
|
|
Amarok::invokeBrowser( url2 ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -558,7 +558,7 @@ void ContextBrowser::openURLRequest( const KURL &url )
|
|
|
|
|
|
|
|
|
|
else if( url.protocol() == "stream" ) |
|
|
|
|
{ |
|
|
|
|
Playlist::instance()->insertMedia( KURL::fromPathOrURL( url.url().tqreplace( TQRegExp( "^stream:" ), "http:" ) ), Playlist::DefaultOptions ); |
|
|
|
|
Playlist::instance()->insertMedia( KURL::fromPathOrURL( url.url().replace( TQRegExp( "^stream:" ), "http:" ) ), Playlist::DefaultOptions ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else if( url.protocol() == "compilationdisc" || url.protocol() == "albumdisc" ) |
|
|
|
@ -639,10 +639,10 @@ void ContextBrowser::engineNewMetaData( const MetaBundle& bundle, bool trackChan
|
|
|
|
|
if ( MetaBundle( m_currentURL ).artist() != bundle.artist() ) |
|
|
|
|
m_dirtyWikiPage = true; |
|
|
|
|
// Prepend stream metadata history item to list
|
|
|
|
|
if ( !m_metadataHistory.first().tqcontains( bundle.prettyTitle() ) ) |
|
|
|
|
if ( !m_metadataHistory.first().contains( bundle.prettyTitle() ) ) |
|
|
|
|
{ |
|
|
|
|
newMetaData = true; |
|
|
|
|
const TQString timeString = KGlobal::locale()->formatTime( TQTime::currentTime() ).tqreplace(" ", " "); // don't break over lines
|
|
|
|
|
const TQString timeString = KGlobal::locale()->formatTime( TQTime::currentTime() ).replace(" ", " "); // don't break over lines
|
|
|
|
|
m_metadataHistory.prepend( TQString( "<td valign='top'>" + timeString + " </td><td align='left'>" + escapeHTML( bundle.prettyTitle() ) + "</td>" ) ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -676,7 +676,7 @@ void ContextBrowser::engineNewMetaData( const MetaBundle& bundle, bool trackChan
|
|
|
|
|
|
|
|
|
|
// look for the cue file that matches the media file played first
|
|
|
|
|
TQString path = bundle.url().path(); |
|
|
|
|
TQString cueFile = path.left( path.tqfindRev('.') ) + ".cue"; |
|
|
|
|
TQString cueFile = path.left( path.findRev('.') ) + ".cue"; |
|
|
|
|
|
|
|
|
|
m_cuefile->setCueFileName( cueFile ); |
|
|
|
|
|
|
|
|
@ -713,7 +713,7 @@ void ContextBrowser::engineNewMetaData( const MetaBundle& bundle, bool trackChan
|
|
|
|
|
{ |
|
|
|
|
line = line.mid( 5 ).remove( '"' ); |
|
|
|
|
|
|
|
|
|
if ( line.tqcontains( bundle.filename(), false ) ) |
|
|
|
|
if ( line.contains( bundle.filename(), false ) ) |
|
|
|
|
{ |
|
|
|
|
cueFile = dir.filePath(*it); |
|
|
|
|
foundCueFile = true; |
|
|
|
@ -799,7 +799,7 @@ void ContextBrowser::saveHtmlData()
|
|
|
|
|
TQTextStream stream( &exportedDocument ); |
|
|
|
|
stream.setEncoding( TQTextStream::UnicodeUTF8 ); |
|
|
|
|
stream << m_HTMLSource // the pure html data..
|
|
|
|
|
.tqreplace( "<html>", |
|
|
|
|
.replace( "<html>", |
|
|
|
|
TQString( "<html><head><style type=\"text/css\">" |
|
|
|
|
"%1</style></head>" ) |
|
|
|
|
.tqarg( HTMLView::loadStyleSheet() ) ); // and the
|
|
|
|
@ -931,7 +931,7 @@ void ContextBrowser::slotContextMenu( const TQString& urlString, const TQPoint&
|
|
|
|
|
} |
|
|
|
|
else if( url.protocol() == "stream" ) |
|
|
|
|
{ |
|
|
|
|
url = KURL::fromPathOrURL( url.url().tqreplace( TQRegExp( "^stream:" ), "http:" ) ); |
|
|
|
|
url = KURL::fromPathOrURL( url.url().replace( TQRegExp( "^stream:" ), "http:" ) ); |
|
|
|
|
urls = KURL::List( url ); |
|
|
|
|
menu.insertTitle( i18n("Podcast"), TITLE ); |
|
|
|
|
menu.insertItem( SmallIconSet( Amarok::icon( "files" ) ), i18n( "&Load" ), MAKE ); |
|
|
|
@ -1601,13 +1601,13 @@ CurrentTrackJob::showHomeByAlbums()
|
|
|
|
|
"<div class='album-body' style='display:%9;' id='IDP%10'>\n" ) |
|
|
|
|
.args( TQStringList() |
|
|
|
|
<< TQString::number( i ) |
|
|
|
|
<< pcb.link().url().tqreplace( TQRegExp( "^http:" ), "externalurl:" ) |
|
|
|
|
<< pcb.link().url().replace( TQRegExp( "^http:" ), "externalurl:" ) |
|
|
|
|
<< escapeHTMLAttr( imageAttr ) |
|
|
|
|
<< escapeHTMLAttr( image ) |
|
|
|
|
<< escapeHTML( ep.duration() ? MetaBundle::prettyTime( ep.duration() ) : TQString( "" ) ) |
|
|
|
|
<< ( ep.localUrl().isValid() |
|
|
|
|
? ep.localUrl().url() |
|
|
|
|
: ep.url().url().tqreplace( TQRegExp( "^http:" ), "stream:" ) ) |
|
|
|
|
: ep.url().url().replace( TQRegExp( "^http:" ), "stream:" ) ) |
|
|
|
|
<< escapeHTML( pcb.title() + ": " + ep.title() ) |
|
|
|
|
<< escapeHTML( date ) |
|
|
|
|
<< "none" |
|
|
|
@ -1772,7 +1772,7 @@ void CurrentTrackJob::showLastFm( const MetaBundle ¤tTrack )
|
|
|
|
|
newUrls.append( &titleUrl ); |
|
|
|
|
|
|
|
|
|
for ( TQString* url = newUrls.first(); url; url = newUrls.next() ) |
|
|
|
|
url->tqreplace( TQRegExp( "^http:" ), "externalurl:" ); |
|
|
|
|
url->replace( TQRegExp( "^http:" ), "externalurl:" ); |
|
|
|
|
|
|
|
|
|
const TQString skipIcon = KGlobal::iconLoader()->iconPath( Amarok::icon("next"), -KIcon::SizeSmallMedium ); |
|
|
|
|
const TQString loveIcon = KGlobal::iconLoader()->iconPath( Amarok::icon("love"), -KIcon::SizeSmallMedium ); |
|
|
|
@ -1988,7 +1988,7 @@ void CurrentTrackJob::showPodcast( const MetaBundle ¤tTrack )
|
|
|
|
|
<< escapeHTML( pcb.title() ) |
|
|
|
|
<< escapeHTML( peb.title() ) |
|
|
|
|
<< ( pcb.link().isValid() |
|
|
|
|
? pcb.link().url().tqreplace( TQRegExp( "^http:" ), "externalurl:" ) |
|
|
|
|
? pcb.link().url().replace( TQRegExp( "^http:" ), "externalurl:" ) |
|
|
|
|
: "current://track" ) |
|
|
|
|
<< image |
|
|
|
|
<< imageAttr |
|
|
|
@ -2064,7 +2064,7 @@ void CurrentTrackJob::showPodcast( const MetaBundle ¤tTrack )
|
|
|
|
|
<< escapeHTML( ep.duration() ? MetaBundle::prettyTime( ep.duration() ) : TQString( "" ) ) |
|
|
|
|
<< ( ep.localUrl().isValid() |
|
|
|
|
? ep.localUrl().url() |
|
|
|
|
: ep.url().url().tqreplace( TQRegExp( "^http:" ), "stream:" ) ) |
|
|
|
|
: ep.url().url().replace( TQRegExp( "^http:" ), "stream:" ) ) |
|
|
|
|
<< escapeHTML( ep.title() ) |
|
|
|
|
<< escapeHTML( date ) |
|
|
|
|
<< (peb.url() == ep.url() ? "block" : "none" ) |
|
|
|
@ -3256,9 +3256,9 @@ void ContextBrowser::showLyrics( const TQString &url )
|
|
|
|
|
TQString title = EngineController::instance()->bundle().title(); |
|
|
|
|
TQString artist = EngineController::instance()->bundle().artist(); |
|
|
|
|
|
|
|
|
|
if( title.tqcontains("PREVIEW: buy it at www.magnatune.com", true) >= 1 ) |
|
|
|
|
if( title.contains("PREVIEW: buy it at www.magnatune.com", true) >= 1 ) |
|
|
|
|
title = title.remove(" (PREVIEW: buy it at www.magnatune.com)"); |
|
|
|
|
if( artist.tqcontains("PREVIEW: buy it at www.magnatune.com", true) >= 1 ) |
|
|
|
|
if( artist.contains("PREVIEW: buy it at www.magnatune.com", true) >= 1 ) |
|
|
|
|
artist = artist.remove(" (PREVIEW: buy it at www.magnatune.com)"); |
|
|
|
|
|
|
|
|
|
if ( title.isEmpty() ) { |
|
|
|
@ -3266,15 +3266,15 @@ void ContextBrowser::showLyrics( const TQString &url )
|
|
|
|
|
The fact that it often (but not always) has artist name together, can be bad, |
|
|
|
|
but at least the user will hopefully get nice suggestions. */ |
|
|
|
|
TQString prettyTitle = EngineController::instance()->bundle().prettyTitle(); |
|
|
|
|
int h = prettyTitle.tqfind( '-' ); |
|
|
|
|
int h = prettyTitle.find( '-' ); |
|
|
|
|
if ( h != -1 ) |
|
|
|
|
{ |
|
|
|
|
title = prettyTitle.mid( h+1 ).stripWhiteSpace(); |
|
|
|
|
if( title.tqcontains("PREVIEW: buy it at www.magnatune.com", true) >= 1 ) |
|
|
|
|
if( title.contains("PREVIEW: buy it at www.magnatune.com", true) >= 1 ) |
|
|
|
|
title = title.remove(" (PREVIEW: buy it at www.magnatune.com)"); |
|
|
|
|
if ( artist.isEmpty() ) { |
|
|
|
|
artist = prettyTitle.mid( 0, h ).stripWhiteSpace(); |
|
|
|
|
if( artist.tqcontains("PREVIEW: buy it at www.magnatune.com", true) >= 1 ) |
|
|
|
|
if( artist.contains("PREVIEW: buy it at www.magnatune.com", true) >= 1 ) |
|
|
|
|
artist = artist.remove(" (PREVIEW: buy it at www.magnatune.com)"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -3399,10 +3399,10 @@ ContextBrowser::lyricsResult( TQCString cXmlDoc, bool cached ) //SLOT
|
|
|
|
|
if ( el.attribute( "add_url" ).isEmpty() ) |
|
|
|
|
{ |
|
|
|
|
m_lyricAddUrl = spec.readPathEntry( "add_url" ); |
|
|
|
|
m_lyricAddUrl.tqreplace( "MAGIC_ARTIST", KURL::encode_string_no_slash( EngineController::instance()->bundle().artist() ) ); |
|
|
|
|
m_lyricAddUrl.tqreplace( "MAGIC_TITLE", KURL::encode_string_no_slash( EngineController::instance()->bundle().title() ) ); |
|
|
|
|
m_lyricAddUrl.tqreplace( "MAGIC_ALBUM", KURL::encode_string_no_slash( EngineController::instance()->bundle().album() ) ); |
|
|
|
|
m_lyricAddUrl.tqreplace( "MAGIC_YEAR", KURL::encode_string_no_slash( TQString::number( EngineController::instance()->bundle().year() ) ) ); |
|
|
|
|
m_lyricAddUrl.replace( "MAGIC_ARTIST", KURL::encode_string_no_slash( EngineController::instance()->bundle().artist() ) ); |
|
|
|
|
m_lyricAddUrl.replace( "MAGIC_TITLE", KURL::encode_string_no_slash( EngineController::instance()->bundle().title() ) ); |
|
|
|
|
m_lyricAddUrl.replace( "MAGIC_ALBUM", KURL::encode_string_no_slash( EngineController::instance()->bundle().album() ) ); |
|
|
|
|
m_lyricAddUrl.replace( "MAGIC_YEAR", KURL::encode_string_no_slash( TQString::number( EngineController::instance()->bundle().year() ) ) ); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
m_lyricAddUrl = el.attribute( "add_url" ); |
|
|
|
@ -3430,11 +3430,11 @@ ContextBrowser::lyricsResult( TQCString cXmlDoc, bool cached ) //SLOT
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
lyrics += i18n( "<p>You can <a href=\"%1\">search for the lyrics</a> on the Web.</p>" ) |
|
|
|
|
.tqarg( TQString( m_lyricSearchUrl ).tqreplace( TQRegExp( "^http:" ), "externalurl:" ) ); |
|
|
|
|
.tqarg( TQString( m_lyricSearchUrl ).replace( TQRegExp( "^http:" ), "externalurl:" ) ); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
lyrics = el.text(); |
|
|
|
|
lyrics.tqreplace( "\n", "<br/>\n" ); // Plaintext -> HTML
|
|
|
|
|
lyrics.replace( "\n", "<br/>\n" ); // Plaintext -> HTML
|
|
|
|
|
|
|
|
|
|
const TQString title = el.attribute( "title" ); |
|
|
|
|
const TQString artist = el.attribute( "artist" ); |
|
|
|
@ -3740,7 +3740,7 @@ TQString
|
|
|
|
|
ContextBrowser::wikiURL( const TQString &item ) |
|
|
|
|
{ |
|
|
|
|
// add any special characters to be replaced here
|
|
|
|
|
TQString wStr = TQString(item).tqreplace( "/", " " ); |
|
|
|
|
TQString wStr = TQString(item).replace( "/", " " ); |
|
|
|
|
|
|
|
|
|
return TQString( "http://%1.wikipedia.org/wiki/" ).tqarg( wikiLocale() ) |
|
|
|
|
+ KURL::encode_string_no_slash( wStr, 106 /*utf-8*/ ); |
|
|
|
@ -3789,7 +3789,7 @@ ContextBrowser::showLabelsDialog()
|
|
|
|
|
foreach( allLabels ) |
|
|
|
|
{ |
|
|
|
|
TQCheckListItem *item = new TQCheckListItem( m_labelListView, *it, TQCheckListItem::CheckBox ); |
|
|
|
|
item->setOn( trackLabels.tqcontains( *it ) ); |
|
|
|
|
item->setOn( trackLabels.contains( *it ) ); |
|
|
|
|
} |
|
|
|
|
if( dialog->exec() == TQDialog::Accepted ) |
|
|
|
|
{ |
|
|
|
@ -3936,9 +3936,9 @@ void ContextBrowser::showWikipedia( const TQString &url, bool fromHistory, bool
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Hack to make wiki searches work with magnatune preview tracks
|
|
|
|
|
if (tmpWikiStr.tqcontains( "PREVIEW: buy it at www.magnatune.com" ) >= 1 ) { |
|
|
|
|
if (tmpWikiStr.contains( "PREVIEW: buy it at www.magnatune.com" ) >= 1 ) { |
|
|
|
|
tmpWikiStr = tmpWikiStr.remove(" (PREVIEW: buy it at www.magnatune.com)" ); |
|
|
|
|
int index = tmpWikiStr.tqfind( '-' ); |
|
|
|
|
int index = tmpWikiStr.find( '-' ); |
|
|
|
|
if ( index != -1 ) { |
|
|
|
|
tmpWikiStr = tmpWikiStr.left (index - 1); |
|