OSDN Git Service

now refactoring...
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 8 Dec 2003 14:49:29 +0000 (14:49 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 8 Dec 2003 14:49:29 +0000 (14:49 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@656 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/favoritelistview.cpp
kita/src/kita.cpp
kita/src/kitasubjectview.cpp
kita/src/libkita/board.cpp
kita/src/libkita/favoritethreads.cpp
kita/src/libkita/tests/threadtest.cpp
kita/src/libkita/thread.cpp
kita/src/libkita/thread.h
kita/src/part/kitathreadpart.cpp

index eefb93c..97e788b 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "libkita/favoritethreads.h"
 #include "libkita/board.h"
+#include "libkita/kita_misc.h"
 #include "kitacacheinfo.h"
 
 #include <qmap.h>
@@ -130,7 +131,8 @@ void FavoriteListView::slotContextMenuRequested( QListViewItem* item, const QPoi
   kdDebug() << "datURL = " << datURL.url() << endl;
   Kita::Board board = Kita::Board( KURL( datURL, ".." ) );
   kdDebug() << "board.url = " << board.url().url() << endl;
-  Kita::Thread thread( board.name(), datURL );
+  Kita::Board::setName( Kita::datToBoard( datURL.url() ), board.name() );
+  Kita::Thread thread( datURL );
   kdDebug() << "thread.url = %s" << thread.url() << endl;
   thread.setName( item->text( Row_Subject ) );
   thread.setResNum( item->text( Row_Read ).toInt() );
index 3a77caa..1181dda 100644 (file)
@@ -517,7 +517,7 @@ void KitaMainWindow::setUrl(const KURL& url)
 
 void KitaMainWindow::bookmark( const Kita::Thread& thread, bool on )
 {
-  Kita::Thread* t = new Kita::Thread( thread.boardName(), thread.datURL(), thread.name(), thread.resNum() );
+  Kita::Thread* t = new Kita::Thread( thread.datURL(), thread.name(), thread.resNum() );
   FavoriteThreads* favorite = FavoriteThreads::getInstance();
 
   if( on ) {
index 3907b44..151866c 100644 (file)
@@ -34,6 +34,7 @@
 #include "kitacacheinfo.h"
 #include "part/kita2ch.h"
 #include "libkita/thread.h"
+#include "libkita/kita_misc.h"
 
 enum SubjectViewRows {
   Row_Mark,
@@ -92,7 +93,8 @@ void KitaSubjectView::loadThread( int, QListViewItem* item )
   KURL datURL = m_board.url();
   datURL.addPath("/dat/" + datName);
 
-  Kita::Thread* thread = new Kita::Thread( m_board.name(), datURL,
+  Kita::Board::setName( Kita::datToBoard( datURL.url() ), m_board.name() );
+  Kita::Thread* thread = new Kita::Thread( datURL,
                                            item->text( Row_Subject ),
                                            item->text( Row_Read ).toInt() );
 
@@ -268,7 +270,8 @@ void KitaSubjectView::slotContextMenuRequested( QListViewItem* item, const QPoin
   KURL datURL = m_board.url();
   datURL.addPath("/dat/" + datName);
 
-  Kita::Thread thread( m_board.name(), datURL );
+  Kita::Board::setName( Kita::datToBoard( datURL.url() ), m_board.name() );
+  Kita::Thread thread( datURL );
   thread.setName( item->text( Row_Subject ) );
   thread.setResNum( item->text( Row_Read ).toInt() );
 
index c9c789f..1622b10 100644 (file)
@@ -21,6 +21,8 @@
 #include <qregexp.h>
 #include <qdict.h>
 
+#include "kita_misc.h"
+
 #include "qcp932codec.h"
 
 using namespace Kita;
@@ -97,7 +99,8 @@ const QPtrList<Thread> Board::getThreadList() const
 
         KURL datURL = m_boardURL;
         datURL.addPath("/dat/" + fname);
-        Kita::Thread* thread = new Kita::Thread( name(), datURL, subject, num.toInt());
+        Kita::Board::setName( datToBoard( datURL.url() ), name() );
+        Kita::Thread* thread = new Kita::Thread( datURL, subject, num.toInt());
         threadList.append(thread);
       }
     }
index cd7c979..a7e990a 100644 (file)
@@ -158,7 +158,7 @@ bool FavoritesXmlParser::endElement( const QString& namespaceURI, const QString&
     m_inThread = false;
     m_threadParser->endElement( namespaceURI, localName, qName );
     Kita::Thread thread = m_threadParser->getThread();
-    m_threadList.append( new Kita::Thread( thread.boardName(), thread.datURL(), thread.name(), thread.resNum() ) );
+    m_threadList.append( new Kita::Thread( thread.datURL(), thread.name(), thread.resNum() ) );
 
     delete m_threadParser;
     m_threadParser = 0;
index 16e3193..e9a9e16 100644 (file)
@@ -14,7 +14,8 @@ using namespace Kita;
 
 void ThreadTest::setUp()
 {
-    m_normal = new Thread( "Linux",
+    Kita::Board::setName( "http://pc.2ch.net/linux/", "Linux" );
+    m_normal = new Thread( 
     KURL( "http://pc.2ch.net/linux/dat/1069738960.dat" ),
     "Kita - 2ch client for KDE",
     0 );
index 47b04f8..abd5410 100644 (file)
@@ -35,12 +35,12 @@ Thread::Thread()
     m_boardName = QString::null;
 }
 
-Thread::Thread( const QString& boardName, const KURL& datURL, const QString& threadName, int resNum )
+/*Thread::Thread( const QString& boardName, const KURL& datURL, const QString& threadName, int resNum )
   : m_datURL( datURL ), m_threadName( threadName ), m_resNum( resNum )
 {
     m_boardName = boardName;
     Kita::Board::setName( boardURL(), boardName );
-}
+}*/
 
 Thread::Thread( const KURL& datURL, const QString& threadName, int resNum )
   : m_datURL( datURL ), m_threadName( threadName ), m_resNum( resNum )
@@ -200,7 +200,8 @@ bool ThreadXmlParser::endElement( const QString& namespaceURI, const QString& lo
     m_boardParser->endElement( namespaceURI, localName, qName );
   } else if( localName == "thread" ) {
     m_inThread = false;
-    m_thread = Kita::Thread( m_board->name(), KURL( m_datUrlStr ), m_threadName, m_resNum );
+    Kita::Board::setName( datToBoard( m_datUrlStr ), m_board->name() );
+    m_thread = Kita::Thread( KURL( m_datUrlStr ), m_threadName, m_resNum );
     m_isValid = true;
     // create thread;
   } else if( localName == "daturl" ) {
@@ -268,7 +269,8 @@ void ThreadAccess::enter_loop()
 void ThreadAccess::slotRedirection(KIO::Job *, const KURL & newURL)
 {
   kdDebug() << "Redirected to newURL: " << newURL.url() << endl;
-  m_thread = Kita::Thread( m_thread.boardName(), newURL);
+  Kita::Board::setName( datToBoard( newURL.url() ), m_thread.boardName() );
+  m_thread = Kita::Thread( newURL);
   emit redirection( newURL.url() );
 }
 
@@ -321,7 +323,7 @@ void ThreadFactory::insertThread( Thread& thread )
     instance = new ThreadFactory();
   }
 
-  Thread* new_thread = new Thread( thread.boardName(), thread.datURL(), thread.name(), thread.resNum() );
+  Thread* new_thread = new Thread( thread.datURL(), thread.name(), thread.resNum() );
   instance->m_dict.insert( thread.datURL().url(), new_thread );
 }
 
index a4a904c..1b8b75d 100644 (file)
@@ -38,7 +38,7 @@ namespace Kita {
   public:
     Thread();
     Thread( const Thread& obj );
-    Thread( const QString& boardName, const KURL& datURL, const QString& threadName = QString::null, int resNum = 0 );
+//    Thread( const QString& boardName, const KURL& datURL, const QString& threadName = QString::null, int resNum = 0 );
     Thread( const KURL& datURL, const QString& threadName = QString::null, int resNum = 0 );
     ~Thread();
     Thread& operator=( const Thread& obj );
index 1c9890d..dd60082 100644 (file)
@@ -65,7 +65,8 @@ bool KitaThreadPart::openURL( const KURL& _url )
              this, SLOT( slotOpenURLResult() ) );
 
     Kita::Board board( m_url.upURL().upURL() );
-    m_threadview->showThread( Kita::Thread( board.name(), m_url ) );
+    Kita::Board::setName( board.url().url(), board.name() );
+    m_threadview->showThread( Kita::Thread( m_url ) );
     emit started( 0 );
     return true;
 }