[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/context/engines/wikipedia
From:       Dan Leinir Turthra Jensen <admin () leinir ! dk>
Date:       2008-11-15 17:03:20
Message-ID: 1226768600.193534.17031.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 884688 by leinir:

Make sure that the relative links inside the wikipedia HTML is forcibly made into \
absolute links (yes, this is deep linking, but we're showing wikipedia data as \
wikipedia data, not stealing any credz here)


 M  +10 -1     WikipediaEngine.cpp  
 M  +1 -0      WikipediaEngine.h  


--- trunk/extragear/multimedia/amarok/src/context/engines/wikipedia/WikipediaEngine.cpp \
#884687:884688 @@ -289,9 +289,12 @@
 
     //first we convert all the links with protocol to external, as they should all \
be External Links.  m_wiki.replace( QRegExp( "href= *\"http:" ), \
                "href=\"externalurl:" );
-    //m_wiki.replace( QRegExp( "href= *\"/" ), "href=\"" +m_wikiBaseUrl );
     m_wiki.replace( QRegExp( "href= *\"#" ), "href=\"" +m_wikiCurrentUrl + '#' );
 
+    // Make sure that the relative links inside the wikipedia HTML is forcibly made \
into absolute links (yes, this is deep linking, but we're showing wikipedia data as \
wikipedia data, not stealing any credz here) +    m_wiki.replace( QRegExp( "href= \
*\"/" ), "href=\"" + wikiSiteUrl() ); +    m_wiki.replace( QRegExp( "src= *\"/" ), \
"src=\"" + wikiSiteUrl() ); +    
     QString m_wikiHTMLSource = "<html><body>\n";
     m_wikiHTMLSource.append( m_wiki );
     if ( !m_wikiLanguages.isEmpty() )
@@ -368,6 +371,12 @@
     return QString( "http://%1.wikipedia.org/wiki/" ).arg( wikiLocale() ) + \
KUrl::toPercentEncoding( item, "/" );  }
 
+inline QString
+WikipediaEngine::wikiSiteUrl()
+{
+    return QString( "http://%1.wikipedia.org/" ).arg( wikiLocale() );
+}
+
 void
 WikipediaEngine::reloadWikipedia()
 {
--- trunk/extragear/multimedia/amarok/src/context/engines/wikipedia/WikipediaEngine.h \
#884687:884688 @@ -65,6 +65,7 @@
     QString wikiArtistPostfix();
     QString wikiAlbumPostfix();
     QString wikiTrackPostfix();
+    QString wikiSiteUrl();
     QString wikiUrl( const QString& item ) const;
     QString wikiLocale() const;
     


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic