***************************************************************************/
#include "thread.h"
-#include "qcp932codec.h"
-#include <config.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <kurl.h>
-#include <kdebug.h>
-#include <kprotocolmanager.h>
-#include <kglobal.h>
-#include <kstandarddirs.h>
-
-#include <kio/slaveconfig.h>
-#include <kio/jobclasses.h>
-#include <kio/scheduler.h>
-#include <kio/netaccess.h>
-
-#include <qwidget.h>
-#include <qapplication.h>
#include <qregexp.h>
QDict<Thread>* Thread::m_threadDict = 0;
-Thread::Thread()
-{}
-
-Thread::Thread( const QString& datURL, const QString& threadName )
- : m_datURL( datURL ), m_threadName( threadName ), m_cached( 0 )
+Thread::Thread( const KURL& datURL )
+ : m_datURL( datURL ), m_threadName( 0 ) , m_resNum( 0 ), m_readNum( 0 ), m_viewPos( 0 )
{}
Thread::~Thread()
{}
-const QString& Thread::datURL() const
+const KURL& Thread::datURL() const
{
return m_datURL;
}
}
/* public */
-const bool Thread::isCached() const
+void Thread::setThreadName( QString threadName )
{
- return m_cached;
+ /* remove space */
+ QRegExp qrx(" +$");
+ threadName.replace( qrx, "" );
+
+ /* unescape */
+ threadName.replace( "<", "<" ).replace( ">", ">" ).replace( "&", "&" );
+
+ m_threadName = threadName;
}
/* public */
-void Thread::setCached( bool cached )
+const int Thread::resNum() const
{
- m_cached = cached;
+ return m_resNum;
}
+/* public */
+void Thread::setResNum( int num )
+{
+ m_resNum = num;
+}
-Thread* Thread::getByURL( const QString& datURL )
+/* public */
+const int Thread::readNum() const
+{
+ return m_readNum;
+}
+
+/* public */
+void Thread::setReadNum( int num )
+{
+ m_readNum = num;
+ if ( m_resNum < m_readNum ) setResNum( m_readNum );
+}
+
+/* public */
+const int Thread::viewPos() const
+{
+ return m_viewPos;
+}
+
+/* public */
+void Thread::setViewPos( int num )
+{
+ m_viewPos = num;
+}
+
+/*--------------------------------------------*/
+
+/* static functions */
+
+Thread* Thread::getByURL( const KURL& datURL )
{
if ( m_threadDict == 0 ) {
m_threadDict = new QDict<Thread>();
}
- Thread* thread = m_threadDict->find( datURL );
+ Thread* thread = m_threadDict->find( datURL.prettyURL() );
if ( thread ) return thread;
Thread* newThread = new Thread( datURL );
- m_threadDict->insert( datURL, newThread );
+ m_threadDict->insert( datURL.prettyURL(), newThread );
return newThread;
}
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(" +$");
- threadName.replace( qrx, "" );
-
- if ( datURL.isNull() ) {
- return ;
- }
-
- if ( m_threadDict == 0 ) {
- m_threadDict = new QDict<Thread>();
- }
-
- if ( m_threadDict->find( datURL ) ) {
- Thread * thread = getByURL( datURL );
- thread->m_threadName = threadName;
- } else {
- Thread* newThread = new Thread( datURL, threadName );
- m_threadDict->insert( datURL, newThread );
- }
-
- return ;
-}
-
void Thread::replace( const QString& fromURL, const QString& toURL )
{
if( m_threadDict == NULL ) return;