OSDN Git Service

refactoring.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sat, 9 Oct 2004 15:26:25 +0000 (15:26 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sat, 9 Oct 2004 15:26:25 +0000 (15:26 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1430 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/favoritelistview.cpp
kita/src/kitasubjectview.cpp
kita/src/libkita/datmanager.cpp
kita/src/libkita/favoritethreads.cpp
kita/src/libkita/thread.cpp
kita/src/libkita/thread.h

index 57da297..611de14 100644 (file)
@@ -82,7 +82,7 @@ void FavoriteListView::update()
 
         KListViewItem* item = new KListViewItem( subjectList );
         item->setText( Col_Board, Kita::DatManager::boardName( datURL ) );
-        item->setText( Col_Subject, Kita::unescape( thread->name() ) );
+        item->setText( Col_Subject, Kita::unescape( Kita::Thread::getName( datURL ) ) );
         item->setText( Col_Read, QString( "%1" ).arg( readNum, 4 ) );
         if ( resNum > 0 ) {
             item->setText( Col_ResNum, QString( "%1" ).arg( resNum, 4 ) );
@@ -153,7 +153,7 @@ void FavoriteListView::slotContextMenuRequested( QListViewItem* item, const QPoi
         emit openURLRequestExt( datURL, KParts::URLArgs(), "kita_open_2chthread", 1 );
         break;
     case 2:
-        clipboard->setText( thread->name() + "\n" + threadURL );
+        clipboard->setText( Kita::Thread::getName( datURL ) + "\n" + threadURL );
         break;
     case 3:
         emit bookmarked( datURL, false );
index cfd6ca0..00b4376 100644 (file)
@@ -167,7 +167,7 @@ void KitaSubjectView::loadBoard( const QString& boardURL )
 
         Kita::ThreadListViewItem* item = new Kita::ThreadListViewItem( subjectList );
         item->setText( Col_ID, QString( "%1" ).arg( i + 1, 4 ) );
-        item->setText( Col_Subject, Kita::unescape( thread->name() ) );
+        item->setText( Col_Subject, Kita::unescape( Kita::Thread::getName( datURL ) ) );
         item->setText( Col_ResNum, QString( "%1" ).arg( resNum, 4 ) );
         item->setText( Col_Read, ( readNum > 0 ) ? QString( "%1" ).arg( readNum, 4 ) : QString( "" ) );
         item->setText( Col_Unread, ( readNum > 0 && resNum != readNum ) ? QString( "%1" ).arg( resNum - readNum, 4 ) : QString( "" ) );
@@ -344,7 +344,7 @@ void KitaSubjectView::slotContextMenuRequested( QListViewItem* item, const QPoin
         emit openURLRequestExt( datURL, KParts::URLArgs(), "kita_open_2chthread", 1 );
         break;
     case Menu_CopyTitleAndURL:
-        clipboard->setText( thread->name() + "\n" + threadURL );
+        clipboard->setText( Kita::Thread::getName( datURL ) + "\n" + threadURL );
         break;
     case Menu_Favorites:
         if ( isFavorites ) {
index 437c916..7c2cc5c 100644 (file)
@@ -394,7 +394,7 @@ const QString& DatManager::threadName( const KURL& url )
         return datInfo->getSubject();
     }
 
-    return thread->name();
+    return Kita::Thread::getName( datURL );
 }
 
 
index 7153c54..86d6d36 100644 (file)
@@ -152,7 +152,7 @@ const QString FavoriteThreads::toXML() const
         threadElement.appendChild( datURLElement );
         datURLElement.appendChild( document.createTextNode( datURL ) );
 
-        QString threadName = thread->name();
+        QString threadName = Kita::Thread::getName( datURL );
         QDomElement nameElement = document.createElement( "name" );
         threadElement.appendChild( nameElement );
         nameElement.appendChild( document.createTextNode( Kita::unescape( threadName ) ) );
index 2342686..25ecd73 100644 (file)
@@ -85,6 +85,15 @@ Thread* Thread::getByURLNew( const KURL& datURL )
     return m_threadDict->find( datURL.prettyURL() );
 }
 
+const QString& Thread::getName( const KURL& datURL )
+{
+    Thread* thread = Thread::getByURLNew( datURL );
+    if ( thread == NULL ) {
+        return QString::null;
+    }
+    return thread->m_threadName;
+}
+
 void Thread::setName( const QString& datURL, QString threadName )
 {
     QRegExp qrx(" +$");    
index d02970a..1610486 100644 (file)
@@ -35,15 +35,16 @@ namespace Kita
 
     protected:
         Thread();
+        const QString& name() const;
 
     public:
         ~Thread();
 
         const QString& datURL() const;
-        const QString& name() const;
 
         static Thread* getByURL( const QString& datURL );
         static Thread* getByURLNew( const KURL& datURL );
+        static const QString& getName( const KURL& datURL );
         static void setName( const QString& datURL, QString threadName );
         static void replace( const QString& fromURL, const QString& toURL );
     private: