void KitaSubjectView::slotUpdateSubject( const KURL& url )
{
+ QDateTime currentdat = QDateTime::currentDateTime();
+
KURL datURL = Kita::ParseMisc::parseURLonly( url );
Kita::Thread* updated_thread = Kita::Thread::getByURLNew( datURL );
for ( QListViewItem * item = subjectList->firstChild(); item; item = item->nextSibling() ) {
if ( item->text( Col_DatURL ) == datURL.prettyURL() ) {
+ QDateTime since;
+ since.setTime_t( Kita::datToSince( datURL.prettyURL() ) );
+
int resNum = updated_thread->resNum();
int readNum = KitaThreadInfo::readNum( updated_thread->datURL() );
item->setText( Col_ResNum, QString( "%1" ).arg( resNum, 4 ) );
// ´ûÆÉ
item->setPixmap( Col_Mark, SmallIcon( "read" ) );
m_readNum++;
- item->setText( Col_MarkOrder, QString::number( ts_read ) );
+ //if( readNum > 1000) item->setText( Col_MarkOrder, "0" );
+ //else item->setText( Col_MarkOrder, "3" );
+ item->setText( Col_MarkOrder, QString::number( ( readNum > 1000 ) ? ts_readed : ts_read ) );
+ } else if ( since.secsTo( currentdat ) < 3600 * KitaConfig::MarkTime() ) {
+ item->setPixmap( Col_Mark, SmallIcon( "newthread" ) );
+ m_newNum++;
+ item->setText( Col_MarkOrder, QString::number( ts_new ) );
} else {
- item->setPixmap( Col_Mark, NULL );
+ item->setPixmap( Col_Mark, NULL );
item->setText( Col_MarkOrder, QString::number( ts_normal ) );
}
UpdateKindLabel();
QString refstr;
KURL datURL = Kita::ParseMisc::parseURL( url, refstr);
QString threadName = Kita::DatManager::threadName( datURL );
- int maxNum = Kita::DatManager::getMaxResNumber( datURL );
+ int maxNum = Kita::DatManager::getReadNum( datURL );
int num = 0;
if( refstr != QString::null ){
int i = refstr.find( "-" );
deleteAccessJob();
/* init variables */
- m_maxNum = 0;
+ m_readNum = 0;
m_rawData = QString::null;
m_subject = QString::null;
m_broken = FALSE;
void DatInfo::copyRawDataToBuffer(const QString& rawData)
{
QStringList linelist;
- int basenum = m_maxNum + 1;
+ int basenum = m_readNum + 1;
// hack for machiBBS
if ( Kita::boardType( m_datURL.url() ) == Board_MachiBBS && m_lastLine == QString::null && m_access->responseCode() == 200 )
{
basenum = 1;
- m_maxNum = 0;
+ m_readNum = 0;
}
bool endIsLF = FALSE;
}
/* update thread info */
- if( m_thread ) m_thread->setResNum( m_maxNum );
- KitaThreadInfo::setReadNum( m_datURL.prettyURL(), m_maxNum );
+ if( m_thread ){
+ if( m_thread->resNum() < m_readNum ) m_thread->setResNum( m_readNum );
+ KitaThreadInfo::setReadNum( m_datURL.prettyURL(), m_readNum );
+ }
}
resdat.set = TRUE;
resdat.linestr = line;
- if(m_maxNum < num) m_maxNum = num;
+ if(m_readNum < num) m_readNum = num;
m_rawData += line + '\n';
if(num == 1) parseDat ( num ); /* to get subject */
count = 0;
- for ( int i = 1; i <= m_maxNum; i++ )
+ for ( int i = 1; i <= m_readNum; i++ )
{
if(!parseDat(i)) continue;
{
/* collect responses that have anchor to rootnum */
- for ( int i = rootnum+1; i <= m_maxNum; i++ )
+ for ( int i = rootnum+1; i <= m_readNum; i++ )
{
if(checkAbonePrivate( i ) ) continue;
if(checkRes(i,rootnum))
/* several information */
/* public */
-int DatInfo::getMaxResNumber()
+int DatInfo::getReadNum()
{
QMutexLocker locker( &m_mutex );
- return m_maxNum;
+ return m_readNum;
}
int count = 0;
- for ( int i = 1; i <= m_maxNum; i++ )
+ for ( int i = 1; i <= m_readNum; i++ )
{
if( !parseDat(i) ) continue;
{
QMutexLocker locker( &m_mutex );
- return QMIN(m_kokoyonNum, m_maxNum);
+ return QMIN(m_kokoyonNum, m_readNum);
}
/* public */
{
QMutexLocker locker( &m_mutex );
- num = QMIN(num, m_maxNum);
+ num = QMIN(num, m_readNum);
m_kokoyonNum = num;
KitaThreadInfo::setReadNum( m_datURL.prettyURL(), num );
QMutex m_mutex;
/* basic information */
- int m_maxNum;
+ int m_readNum;
QString m_rawData;
KURL m_datURL;
QString m_subject;
bool getDomElement(int num, DOM::HTMLDocument& hdoc, DOM::Element& retelm);
/* numerical data */
- int getMaxResNumber();
+ int getReadNum();
int getNumByID( const QString& strid );
int getKokoyonNum();
void setKokoyonNum(int num);
#include <qstringlist.h>
#include "thread.h"
+#include "threadinfo.h"
#include "parsemisc.h"
#include "datmanager.h"
#include "datinfo.h"
/* public */
-int DatManager::getMaxResNumber( const KURL& url )
+int DatManager::getResNum( const KURL& url )
{
QMutexLocker locker( &m_mutex );
-
- DatInfo * datInfo = getDatInfo( url );
- if ( datInfo == NULL ) return 0;
- return datInfo->getMaxResNumber();
+ KURL datURL = Kita::ParseMisc::parseURLonly( url );
+ return KitaThreadInfo::resNum( datURL.prettyURL() );
}
-
/* public */
-int DatManager::getNumByID( const KURL& url, const QString& strid )
+int DatManager::getReadNum( const KURL& url )
{
QMutexLocker locker( &m_mutex );
DatInfo * datInfo = getDatInfo( url );
if ( datInfo == NULL ) return 0;
- return datInfo->getNumByID(strid);
+ return datInfo->getReadNum();
}
-
/* public */
int DatManager::getKokoyonNum( const KURL& url )
{
return datInfo->getDatSize();
}
+/* public */
+int DatManager::getNumByID( const KURL& url, const QString& strid )
+{
+ QMutexLocker locker( &m_mutex );
+
+ DatInfo * datInfo = getDatInfo( url );
+ if ( datInfo == NULL ) return 0;
+ return datInfo->getNumByID(strid);
+}
/* public */
static bool getDomElement(const KURL& url, int num, DOM::HTMLDocument& hdoc, DOM::Element& retelm);
/* numerical data */
- static int getMaxResNumber( const KURL& url );
- static int getNumByID( const KURL& url, const QString& strid );
+ static int getResNum( const KURL& url );
+ static int getReadNum( const KURL& url );
static int getKokoyonNum( const KURL& url );
static void setKokoyonNum( const KURL& url, int num);
static int getDatSize( const KURL& url );
-
+ static int getNumByID( const KURL& url, const QString& strid );
+
/* another information */
static bool isResValid( const KURL& url , int num);
static bool isBroken( const KURL& url );
if ( ! m_datInfo ) return ;
if ( m_hdoc == NULL ) return ;
- if ( m_bottomNum == m_datInfo->getMaxResNumber() )
+ if ( m_bottomNum == m_datInfo->getReadNum() )
{
removeTugi100();
return ;
/* update Kokomade Yonda */
if( m_mode == HTMLPART_MODE_MAINPART && !m_updatedKokoyon && !m_datURL.isEmpty())
{
- int maxNum = Kita::DatManager::getMaxResNumber( m_datURL );
- if( maxNum ) Kita::DatManager::setKokoyonNum( m_datURL, maxNum );
+ int readNum = Kita::DatManager::getReadNum( m_datURL );
+ if( readNum ) Kita::DatManager::setKokoyonNum( m_datURL, readNum );
}
m_updatedKokoyon = FALSE;
int top = m_domtree->getTopResNumber();
int bottom = m_domtree->getBottomResNumber();
- int totalNum = Kita::DatManager::getMaxResNumber( m_datURL );
- if ( top != 1 || bottom != totalNum )
+ int readNum = Kita::DatManager::getReadNum( m_datURL );
+ if ( top != 1 || bottom != readNum )
{
- showResponses( 1, totalNum );
+ showResponses( 1, readNum );
updateScreen( TRUE, TRUE );
}
}
if( showHeaderEtc )
{
- int maxNum = Kita::DatManager::getMaxResNumber( m_datURL);
+ int readNum = Kita::DatManager::getReadNum( m_datURL);
m_domtree->appendMae100();
m_domtree->appendTugi100();
m_domtree->appendKokoyon();
- m_domtree->appendFooter( maxNum );
+ m_domtree->appendFooter( readNum );
}
/*----------------------------*/
/* top = centerNum - preShowNum
bottom = centerNum + afterShowNum
- maxNum = ita::DatManager::getMaxResNumber
+ readNum = Kita::DatManager::getReadNum
- No.1 <- show -> No.20 <- not show -> No.(top) <- show -> No.(bottom) <- not show -> No.(maxNum) */
+ No.1 <- show -> No.20 <- not show -> No.(top) <- show -> No.(bottom) <- not show -> No.(readNum) */
bool KitaHTMLPart::load( int centerNum )
{
if( m_mode != HTMLPART_MODE_MAINPART ) return FALSE;
if( !m_domtree ) return FALSE;
- if( Kita::DatManager::getMaxResNumber( m_datURL ) == 0 ) return FALSE;
+ if( Kita::DatManager::getReadNum( m_datURL ) == 0 ) return FALSE;
m_domtree->appendTemplate();
showResponses( m_centerNum - preShowNum, m_centerNum + afterShowNum );
if( m_mode != HTMLPART_MODE_MAINPART ) return;
if( !m_domtree ) return;
- int maxNum = Kita::DatManager::getMaxResNumber( m_datURL );
+ int readNum = Kita::DatManager::getReadNum( m_datURL );
int bottom = m_domtree->getBottomResNumber();
int showNum = m_centerNum + afterShowNum;
/* parsing */
- if( oneAfterAnother ) parseResponses( bottom+1, maxNum );
+ if( oneAfterAnother ) parseResponses( bottom+1, readNum );
/* rendering */
if( m_firstReceive
- || ( bottom + delta < maxNum && maxNum <= showNum + delta -1 ) )
+ || ( bottom + delta < readNum && readNum <= showNum + delta -1 ) )
{
if( oneAfterAnother )
{
- showResponses( bottom+1, QMIN( maxNum, showNum ) );
+ showResponses( bottom+1, QMIN( readNum, showNum ) );
updateScreen( TRUE, FALSE );
}
- else parseResponses( bottom+1, QMIN( maxNum, showNum ) );
+ else parseResponses( bottom+1, QMIN( readNum, showNum ) );
}
- if( m_firstReceive && m_centerNum < maxNum )
+ if( m_firstReceive && m_centerNum < readNum )
{
gotoAnchor( QString().setNum( m_centerNum ), FALSE );
m_firstReceive = FALSE;
if( m_mode != HTMLPART_MODE_MAINPART ) return;
int bottom = m_domtree->getBottomResNumber();
- int maxNum = Kita::DatManager::getMaxResNumber( m_datURL );
+ int readNum = Kita::DatManager::getReadNum( m_datURL );
- if ( maxNum != bottom )
+ if ( readNum != bottom )
{
showResponses( bottom + 1, bottom + 100 );
updateScreen( TRUE, TRUE );
if( m_mode != HTMLPART_MODE_MAINPART ) return;
int bottom = m_domtree->getBottomResNumber();
- int maxNum = Kita::DatManager::getMaxResNumber( m_datURL );
+ int readNum = Kita::DatManager::getReadNum( m_datURL );
- if ( maxNum != bottom )
+ if ( readNum != bottom )
{
- showResponses( bottom + 1, maxNum );
+ showResponses( bottom + 1, readNum );
updateScreen( TRUE, TRUE );
}
}
}
int bottom = m_domtree->getBottomResNumber();
- int maxNum = Kita::DatManager::getMaxResNumber( m_datURL );
+ int readNum = Kita::DatManager::getReadNum( m_datURL );
- if ( maxNum != bottom )
+ if ( readNum != bottom )
{
- showResponses( bottom + 1, maxNum );
+ showResponses( bottom + 1, readNum );
updateScreen( TRUE, TRUE );
}
int top = m_domtree->getTopResNumber();
int bottom = m_domtree->getBottomResNumber();
- int maxNum = Kita::DatManager::getMaxResNumber( m_datURL );
+ int readNum = Kita::DatManager::getReadNum( m_datURL );
- if ( top != 1 || bottom != maxNum )
+ if ( top != 1 || bottom != readNum )
{
- showResponses( 1, maxNum );
+ showResponses( 1, readNum );
updateScreen( TRUE, TRUE );
gotoAnchor( "header", FALSE );
/* !! very dangerous to call DatManager::getDatInfoPointer without locking !! */
Kita::DatManager::lock( m_datURL );
Kita::DatInfo* datInfo = Kita::DatManager::getDatInfoPointer( m_datURL );
- for( int i = 1; i <= datInfo->getMaxResNumber() ; i++ )
+ for( int i = 1; i <= datInfo->getReadNum() ; i++ )
{
if( datInfo->isMarked( i ) )
{
this,SLOT( slotChangeCaption( const QString& )));
view->setup( datURL, VIEWMODE_KITANAVI );
- totalNum = Kita::DatManager::getMaxResNumber( datURL );
+ totalNum = Kita::DatManager::getReadNum( datURL );
/*---------------------------------------------*/
/* copy data from DatManager to KitaThreadView */
case VIEWMODE_PARENT:
- totalNum = Kita::DatManager::getMaxResNumber(m_datURL);
+ totalNum = Kita::DatManager::getReadNum(m_datURL);
broken = Kita::DatManager::isBroken(m_datURL);
datSize = Kita::DatManager::getDatSize(m_datURL);
setSubjectLabel(Kita::DatManager::thread_boardName(m_datURL),
Kita::DatManager::thread_name(m_datURL)
+ QString( " (%1)" )
- .arg( Kita::DatManager::getMaxResNumber(m_datURL) ),
+ .arg( Kita::DatManager::getReadNum(m_datURL) ),
Kita::DatManager::thread_boardURL( m_datURL ) );
emit setMainURLLine( Kita::DatManager::thread_url(m_datURL) );
updateButton();
gotoCombo->clear();
gotoCombo->insertItem( Kita::ParseMisc::utf8ToUnicode( KITAUTF8_GOTO ) );
gotoCombo->insertItem( Kita::ParseMisc::utf8ToUnicode( KITAUTF8_KOKOYON ) );
- for( int i = 1; i < Kita::DatManager::getMaxResNumber(m_datURL); i += 100 )
+ for( int i = 1; i < Kita::DatManager::getReadNum(m_datURL); i += 100 )
{
gotoCombo->insertItem( QString().setNum( i ) + "-" );
}
emit updateThreadTab( m_datURL );
QString captionStr = Kita::DatManager::thread_name( m_datURL )
- + QString( " (%1)" ).arg( Kita::DatManager::getMaxResNumber( m_datURL ) );
+ + QString( " (%1)" ).arg( Kita::DatManager::getReadNum( m_datURL ) );
emit setMainCaption( captionStr );
showStatusBar( "" );
{
if ( w == bodyText ) return ;
- int resnum = Kita::DatManager::getMaxResNumber( m_datURL ) + 1 ;
+ int resnum = Kita::DatManager::getReadNum( m_datURL ) + 1 ;
QDateTime now = QDateTime::currentDateTime();
QString bodystr = body();