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 ) );
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 );
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( "" ) );
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 ) {
return datInfo->getSubject();
}
- return thread->name();
+ return Kita::Thread::getName( datURL );
}
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 ) ) );
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(" +$");
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: