*** amarok/src/contextbrowser.cpp	2006-06-06 18:09:56.000000000 +0000
--- amarokcopy/src/contextbrowser.cpp	2006-06-06 12:23:08.000000000 +0000
***************
*** 922,927 ****
--- 922,932 ----
      void showArtistsAlbums( const QString &artist, uint artist_id, uint album_id );
      void showArtistsCompilations( const QString &artist, uint artist_id, uint album_id );
      void showHome();
+     
+     //*
+     void showCustomSections();
+     //*/
+     
      QStringList showHomeByAlbums();
      void constructHTMLAlbums( const QStringList &albums, QString &htmlCode, const QString &idPrefix );
      static QString statsHTML( int score, int rating, bool statsbox = true ); // meh.
***************
*** 2156,2161 ****
--- 2161,2203 ----
      }
  }
  
+ //*
+ void CurrentTrackJob::showCustomSections()
+ {
+ 	for( int i = 0; i < ContextBrowser::instance()->m_custom_sections.count(); ++i ) 
+ 	{
+ 		QString section_name = 
+ 				ContextBrowser::instance()->m_custom_sections[ i ];
+ 		QString section_title =
+ 				ContextBrowser::instance()->m_custom_section_titles[ i ];
+ 		QString section_contents = 
+ 				ContextBrowser::instance()->m_custom_section_contents[ i ];
+ 		
+ 		// only show the section if there it has contents
+ 		if( !section_contents.isEmpty() )
+ 		{
+ 			m_HTMLSource.append(
+ 					"<div id='"+section_name+"_box' class='box'>\n"
+ 						"<div id='"+section_name+"-header' class='box-header' " "onClick=\"toggleBlock('CUSTOM_SECTION_"+section_name+"'); window.location.href='togglebox:ft';\" style='cursor: pointer;'>\n"
+ 						"<span id='"+section_name+"-header-title' class='box-header-title'>\n"
+ 							+ section_title +
+ 						"</span>\n"
+ 						"</div>\n"
+ 					"<table class='box-body' id='CUSTOM_SECTION_"+section_name+"' width='100%' border='0' cellspacing='0' cellpadding='0'>\n" 
+ 					"<tr><td>\n"
+ 					);
+ 			
+ 			m_HTMLSource.append( section_contents );
+ 			
+ 			m_HTMLSource.append(
+ 					"</td></tr>\n"
+ 					"</table>\n"
+ 					"</div>\n" );
+ 		};
+ 	};
+ };
+ //*/
+ 
  void CurrentTrackJob::showArtistsAlbums( const QString &artist, uint artist_id, uint album_id )
  {
      QString artistName = artist.isEmpty() ? escapeHTML( i18n( "This Artist" ) ) : escapeHTML( artist );
***************
*** 2616,2621 ****
--- 2658,2666 ----
          showArtistsAlbums( artist, artist_id, album_id );
          showArtistsCompilations( artist, artist_id, album_id );
      }
+     
+     showCustomSections();
+     
      m_HTMLSource.append( "</body></html>\n" );
  
      return true;
***************
*** 3092,3097 ****
--- 3137,3188 ----
          + KURL::encode_string_no_slash( item );
  }
  
+ //*
+ void
+ ContextBrowser::addCustomSection( const QString& name )
+ {
+ 	if( m_custom_sections.findIndex( name ) == -1 )
+ 	{
+ 		m_custom_sections.push_back( name );
+ 	}
+ }
+ 
+ void 
+ ContextBrowser::setCustomSection( const QString& section, const QString& contents )
+ {
+ 	int idx = m_custom_sections.findIndex( section );
+ 	if( idx != -1 )
+ 	{
+ 		while( idx >= m_custom_section_contents.count() )
+ 		{
+ 			m_custom_section_contents.push_back("");
+ 		}
+		
+		// unescape common html sequences
+		QString contents_temp = contents;
+		contents_temp
+			.replace("&gt;",">")
+			.replace("&lt;","<")
+			.replace("&amp;","&")
+			.replace("&quot;","\"");
+ 		
+ 		m_custom_section_contents[idx] = contents;
+ 		
+ 		renderView();
+ 	};
+ };
+ 
+ void
+ ContextBrowser::setCustomSectionTitle( const QString& section, const QString& title )
+ {
+ 	int idx = m_custom_sections.findIndex( section );
+ 	if( idx != -1 )
+ 	{
+ 		while( idx >= m_custom_section_titles.count() )
+ 		{
+ 			m_custom_section_titles.push_back("");
+ 		};
+ 		
+ 		m_custom_section_titles[idx] = title;
+ 		
+ 		renderView();
+ 	};
+ };
+ 
+ //*/
+ 
  void
  ContextBrowser::showWikipediaEntry( const QString &entry )
  {
*** amarok/src/contextbrowser.h	2006-06-05 21:51:05.000000000 +0000
--- amarokcopy/src/contextbrowser.h	2006-06-06 12:23:08.000000000 +0000
***************
*** 76,81 ****
--- 76,87 ----
          void showLyrics( const QString& url = QString::null );
          void showWikipedia( const QString& url = QString::null, bool fromHistory = false );
          void showWikipediaEntry( const QString& entry );
+         
+         //*
+         void addCustomSection( const QString& name );
+         void setCustomSection( const QString& section, const QString& contents );
+         void setCustomSectionTitle( const QString& section, const QString& title );
+         //*/
  
          void coverFetched( const QString &artist, const QString &album );
          void coverRemoved( const QString &artist, const QString &album );
***************
*** 179,184 ****
--- 185,196 ----
          QStringList   m_shownAlbums;
  
          CueFile      *m_cuefile;
+         
+         //*
+         QStringList   m_custom_sections;
+         QStringList   m_custom_section_contents;
+         QStringList   m_custom_section_titles;
+         //*/
  };
  
  #endif /* AMAROK_CONTEXTBROWSER_H */
*** amarok/src/amarokcore/amarokdcophandler.cpp	2006-06-05 21:50:51.000000000 +0000
--- amarokcopy/src/amarokcore/amarokdcophandler.cpp	2006-06-06 12:22:32.000000000 +0000
***************
*** 673,678 ****
--- 673,695 ----
      {
          ContextBrowser::instance()->lyricsResult( lyrics );
      }
+     
+     //*
+     void DcopContextBrowserHandler::addCustomSection( const QString& name )
+     {
+     	ContextBrowser::instance()->addCustomSection( name );
+     };
+     
+     void DcopContextBrowserHandler::setCustomSection( const QString& section, const QString& contents )
+     {
+     	ContextBrowser::instance()->setCustomSection( section, contents );
+     };
+     
+     void DcopContextBrowserHandler::setCustomSectionTitle( const QString& section, const QString& title )
+     {
+     	ContextBrowser::instance()->setCustomSectionTitle( section, title );
+     }
+     //*/
  
  /////////////////////////////////////////////////////////////////////////////////////
  // class DcopCollectionHandler
*** amarok/src/amarokcore/amarokdcophandler.h	2006-06-05 21:50:15.000000000 +0000
--- amarokcopy/src/amarokcore/amarokdcophandler.h	2006-06-06 12:22:32.000000000 +0000
***************
*** 161,166 ****
--- 161,172 ----
        virtual void showLyrics();
        virtual void showWiki();
        virtual void showLyrics( const QCString& lyrics );
+       
+       //*
+       virtual void addCustomSection( const QString& name );
+       virtual void setCustomSection( const QString& section, const QString& contents );
+       virtual void setCustomSectionTitle( const QString& section, const QString& title );
+       //*/
  };
  
  
*** amarok/src/amarokcore/amarokdcopiface.h	2006-06-05 21:53:07.000000000 +0000
--- amarokcopy/src/amarokcore/amarokdcopiface.h	2006-06-06 12:22:32.000000000 +0000
***************
*** 159,164 ****
--- 159,167 ----
     virtual void showLyrics() = 0;                           ///< Show the lyrics tab in the context browser.
     virtual void showWiki() = 0;                             ///< Show the wikipedia tab in the context browser.
     virtual void showLyrics( const QCString& lyrics ) = 0;    ///< Renders the lyrics (plan text) in the Lyrics tab.
+    virtual void addCustomSection( const QString& name ) = 0;
+    virtual void setCustomSection( const QString& section, const QString& contents ) = 0;
+    virtual void setCustomSectionTitle( const QString& section, const QString& title ) = 0;
  };
  
  
