OSDN Git Service

refactoring.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 7 Dec 2003 10:34:58 +0000 (10:34 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 7 Dec 2003 10:34:58 +0000 (10:34 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@648 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/kita.cpp
kita/src/libkita/favoritethreads.cpp
kita/src/libkita/thread.cpp
kita/src/libkita/thread.h

index f265d2a..3a77caa 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.getBoard(), thread.datURL(), thread.name(), thread.resNum() );
+  Kita::Thread* t = new Kita::Thread( thread.boardName(), thread.datURL(), thread.name(), thread.resNum() );
   FavoriteThreads* favorite = FavoriteThreads::getInstance();
 
   if( on ) {
index 8034c7f..cd7c979 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.getBoard()), thread.datURL(), thread.name(), thread.resNum() ) );
+    m_threadList.append( new Kita::Thread( thread.boardName(), thread.datURL(), thread.name(), thread.resNum() ) );
 
     delete m_threadParser;
     m_threadParser = 0;
index d0a028f..e0feccb 100644 (file)
@@ -34,6 +34,12 @@ Thread::Thread() : m_board( 0 )
 {
 }
 
+Thread::Thread( const QString& boardName, const KURL& datURL, const QString& threadName, int resNum )
+  : m_datURL( datURL ), m_threadName( threadName ), m_resNum( resNum )
+{
+  m_board = new Board( datToBoard( datURL.url() ), boardName );
+}
+
 Thread::Thread(const Board& board, const KURL& datURL, const QString threadName, int resNum)
   : m_datURL(datURL), m_threadName(threadName), m_resNum(resNum)
 {
@@ -43,13 +49,6 @@ Thread::Thread(const Board& board, const KURL& datURL, const QString threadName,
   m_board = new Board( board.url(), board.name() );
 }
 
-Thread::Thread(const Board* board, const KURL& datURL, const QString threadName, int resNum)
-  : m_datURL(datURL), m_threadName(threadName), m_resNum(resNum)
-{
-  m_datID = m_datURL.filename().section(".", 0, 0);
-  m_board = new Board( board->url(), board->name() );
-}
-
 Thread::Thread( const KURL& datURL, const QString& threadName, int resNum )
   : m_datURL( datURL ), m_threadName( threadName ), m_resNum( resNum ), m_board( 0 )
 {
@@ -275,7 +274,7 @@ 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.getBoard(), newURL);
+  m_thread = Kita::Thread( m_thread.boardName(), newURL);
   emit redirection( newURL.url() );
 }
 
@@ -328,7 +327,7 @@ void ThreadFactory::insertThread( Thread& thread )
     instance = new ThreadFactory();
   }
 
-  Thread* new_thread = new Thread( thread.getBoard(), thread.datURL(), thread.name(), thread.resNum() );
+  Thread* new_thread = new Thread( thread.boardName(), thread.datURL(), thread.name(), thread.resNum() );
   instance->m_dict.insert( thread.datURL().url(), new_thread );
 }
 
index f801030..4a7a6ac 100644 (file)
@@ -39,8 +39,8 @@ 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 Board& board, const KURL& datURL, const QString threadName = QString::null, int resNum = 0);
-    Thread(const Board* board, 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 );
@@ -51,7 +51,6 @@ namespace Kita {
     const QString& name() const;
     void setName(const QString& name) { m_threadName = name; }
     void setResNum(int resNum) { m_resNum = resNum; }
-    const Board* getBoard() const { return m_board; }
     const QString& boardName() const;
     const QString boardURL() const;
     const QString boardID() const;