OSDN Git Service

refactoring.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Fri, 2 Jan 2004 13:31:24 +0000 (13:31 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Fri, 2 Jan 2004 13:31:24 +0000 (13:31 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@768 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/favoritelistview.cpp
kita/src/kitasubjectview.cpp
kita/src/libkita/thread.cpp
kita/src/libkita/thread.h
kita/src/part/kitathreadview.cpp

index b097f00..20f72de 100644 (file)
@@ -11,7 +11,6 @@
 #include "favoritelistview.h"
 
 #include "libkita/favoritethreads.h"
-#include "libkita/board.h"
 #include "libkita/kita_misc.h"
 #include "libkita/threadinfo.h"
 
@@ -110,9 +109,9 @@ void FavoriteListView::slotContextMenuRequested( QListViewItem* item, const QPoi
     QString datName = item->text( Row_DatName );
     KURL datURL = KURL( item->text( Row_DatURL ) );
 
-    Kita::Thread* thread = new Kita::Thread( datURL.url() );
-    thread->setName( item->text( Row_Subject ) );
-    thread->setResNum( item->text( Row_Read ).toInt() );
+    Kita::Thread::setName( datURL.url(), item->text( Row_Subject ) );
+    Kita::Thread* thread = Kita::Thread::getByURL( datURL.url() );
+    KitaThreadInfo::setResNum( datURL.url(), item->text( Row_Read ).toInt() );
 
     QClipboard* clipboard = QApplication::clipboard();
 
index 8530973..9307b7f 100644 (file)
@@ -8,6 +8,8 @@
 *   (at your option) any later version.                                   *
 ***************************************************************************/
 
+#include "kitasubjectview.h"
+
 // include files for Qt
 #include <qtoolbutton.h>
 #include <qtextbrowser.h>
@@ -15,6 +17,7 @@
 #include <qregexp.h>
 #include <qfile.h>
 #include <qclipboard.h>
+#include <qapplication.h>
 
 // kdelibs/kio
 #include <kio/slaveconfig.h>
 #include <kpopupmenu.h>
 #include <krun.h>
 
-#include "kitasubjectview.h"
-#include "favoritelistview.h"
-#include "kita.h"
 #include "libkita/threadinfo.h"
-#include "part/kita2ch.h"
 #include "libkita/thread.h"
 #include "libkita/kita_misc.h"
+#include "part/kita2ch.h"
 
 KitaSubjectView::KitaSubjectView( QWidget* parent, const char* name )
         : Kita::ThreadListView( parent, name )
@@ -153,9 +153,9 @@ void KitaSubjectView::slotContextMenuRequested( QListViewItem* item, const QPoin
     datURL.addPath( "/dat/" + datName );
 
     Kita::Board::setName( Kita::datToBoard( datURL.url() ), m_board->name() );
-    Kita::Thread* thread = new Kita::Thread( datURL.url() );
-    thread->setName( item->text( Row_Subject ) );
-    thread->setResNum( item->text( Row_Read ).toInt() );
+    Kita::Thread::setName( datURL.url(), item->text( Row_Subject ) );
+    Kita::Thread* thread = Kita::Thread::getByURL( datURL.url() );
+    KitaThreadInfo::setResNum( datURL.url(), item->text( Row_Read ).toInt() );
 
     QClipboard* clipboard = QApplication::clipboard();
 
index e9f9bd1..d9942be 100644 (file)
 #include <config.h>
 
 #include <kurl.h>
+#include <kdebug.h>
+
 #include <kio/slaveconfig.h>
 #include <kio/jobclasses.h>
 #include <kio/scheduler.h>
-#include <kdebug.h>
 
 #include <qwidget.h>
 #include <qapplication.h>
@@ -63,6 +64,9 @@ int Thread::resNum() const
 
 const QString& Thread::name() const
 {
+    if ( ! Kita::Thread::getByURL( m_datURL ) ->m_threadName.isEmpty() ) {
+        return Kita::Thread::getByURL( m_datURL ) ->m_threadName;
+    }
     return m_threadName;
 }
 
@@ -146,7 +150,7 @@ Thread* Thread::getByURL( const QString& datURL )
 void Thread::setName( const QString& datURL, const QString& threadName )
 {
     if ( datURL.isNull() ) {
-        return;
+        return ;
     }
 
     if ( m_threadDict == 0 ) {
@@ -156,7 +160,7 @@ void Thread::setName( const QString& datURL, const QString& threadName )
     Thread* newThread = new Thread( datURL, threadName );
     m_threadDict->replace( datURL, newThread );
 
-    return;
+    return ;
 }
 
 ThreadXmlParser::ThreadXmlParser()
index 9f9ef59..e8c87ce 100644 (file)
@@ -40,7 +40,6 @@ namespace Kita
         const QString& datURL() const;
         const QString url() const;
         const QString datID() const;
-        void setName( const QString& name ) { m_threadName = name; }
         const QString& name() const;
         void setResNum( int resNum );
         int resNum() const;
index 3ff52d4..6cb94fe 100644 (file)
 
 #include "kitahtmlpart.h"
 #include "kitawritedialog.h"
-#include "libkita/threadinfo.h"
 #include "kita2ch.h"
 #include "kitaconfig.h"
 
+#include "libkita/threadinfo.h"
 #include "libkita/comment.h"
 #include "libkita/qcp932codec.h"
 #include "libkita/favoritethreads.h"
@@ -209,7 +209,7 @@ void KitaThreadView::update( const QString& result )
 
         num++;
         if ( num == 1 ) {
-            m_thread->setName( comment.getSubject() );
+            Kita::Thread::setName( m_thread->datURL(), comment.getSubject() );
         }
         text += comment.toHtml( num );