OSDN Git Service

refactoring...
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 2 Jun 2003 15:12:27 +0000 (15:12 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 2 Jun 2003 15:12:27 +0000 (15:12 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@315 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/part/kitahtmlpart.cpp
kita/src/part/kitahtmlpart.h
kita/src/part/kitathreadview.cpp

index 3ac2584..f9ef58d 100644 (file)
@@ -18,6 +18,8 @@
 #include <qprogressdialog.h>
 #include <qmessagebox.h>
 
+#include "libkita/thread.h"
+
 KitaHTMLPart::KitaHTMLPart(QWidget *parent, const char *name)
  : KHTMLPart(parent, name), m_parent(parent)
 {
@@ -108,6 +110,21 @@ void KitaHTMLPart::displayContents(const QString& input, const KURL& url)
   if ( ! url.isEmpty() ) emit setLocationBarURL(url.url());
 }
 
+void KitaHTMLPart::displayContentsAndGotoURL( const QString& input, const Kita::Thread& thread )
+{
+  setContents( input );
+  displayContents( contents(), thread.datURL() );
+
+  if ( thread.datURL().hasRef() ) {
+    if ( ! gotoAnchor( thread.datURL().encodedHtmlRef()) )
+      gotoAnchor( thread.datURL().htmlRef() );
+  } else {
+    gotoAnchor( QString().setNum( thread.resNum() ) );
+  }
+  clearPosition();
+  pushCurrentPosition();
+}
+
 void KitaHTMLPart::pushCurrentPosition()
 {
   m_pointStack.push( QPoint( view()->contentsX(), view()->contentsY() ) );
index 6e87b61..ed4df38 100644 (file)
 #include <qvaluestack.h> // for gcc-2.9x
 template<class T> class QValueStack;
 
+namespace Kita
+{
+  class Thread;
+}
+
 /**
 @author Hideki Ikemoto
 */
@@ -52,9 +57,11 @@ public:
   void highLighten(bool yes, const QStringList &query);
   void highLightenNodes(DOM::NodeList nodes, const QStringList &query);
   static QStringList lt_gt_spliter( const QString & input );
-  void displayContents(const QString& input, const KURL& urlOfInput = 0);
+  void displayContentsAndGotoURL( const QString& input, const Kita::Thread& thread );
 public slots:
   bool gobackAnchor();
+private:
+  void displayContents( const QString& input, const KURL& urlOfInput = 0 );
 signals:
   void setLocationBarURL( const QString &url );
 };
index 6203aeb..67595b1 100644 (file)
@@ -263,17 +263,7 @@ void KitaThreadView::slotThreadResult(KIO::Job* job)
   text += "</body></html>";
   m_threadData.truncate(0);
 
-  m_threadPart->setContents(text);
-  m_threadPart->displayContents( m_threadPart->contents(), m_thread.datURL() );
-
-  if ( m_thread.datURL().hasRef() ) {
-    if ( ! m_threadPart->gotoAnchor( m_thread.datURL().encodedHtmlRef()) )
-      m_threadPart->gotoAnchor( m_thread.datURL().htmlRef() );
-  } else {
-    m_threadPart->gotoAnchor( QString().setNum(m_thread.resNum()) );
-  }
-  m_threadPart->clearPosition();
-  m_threadPart->pushCurrentPosition();
+  m_threadPart->displayContentsAndGotoURL( text, m_thread );
 
   if ( HighLightButton->isOn() ) {
     HighLightButton->toggle();