m_popup = NULL;
}
- killJob();
+ killJob();
/* don't delete m_threadPart before deleting m_domtree */
if ( m_domtree ) {
/*--------------------*/ /* private slots */
void KitaThreadView::slotWriteButtonClicked( QString resstr )
{
- if ( ! m_serverTime ) return;
+ if ( ! m_serverTime ) return ;
KURL bbscgiURL = KURL( m_thread->boardURL(), "../test/bbs.cgi" );
bbscgiURL.setProtocol( "http" );
{
if ( m_access ) {
m_access->killJob();
- delete m_access;
- m_access = NULL;
+ delete m_access;
+ m_access = NULL;
}
m_serverTime = 0;
}
/*-------*/
/* setup */
/*-------*/
-void KitaThreadView::setupEx( const Kita::Thread* thread,int serverTime,int mode )
+void KitaThreadView::setupEx( const Kita::Thread* thread, int serverTime, int mode )
{
/* config. */
/* online mode */
m_online = TRUE;
-
+
/*---------------------------------------*/
/* setup */
- killJob();
+ killJob();
m_thread = const_cast<Kita::Thread *>( thread );
/* setup HTMLPart */
m_threadPart->setupEx( this, m_domtree, m_thread );
-
+
/* setup DOM */
m_domtree->parseResInit( m_thread );
m_viewmode = mode;
/* If curreent mode is VIEWMODE_PREVIEW , hide buttons */
- if ( m_viewmode == VIEWMODE_PREVIEW ){
- KitaThreadViewBaseLayout->remove( subjectLabel );
- KitaThreadViewBaseLayout->removeItem( layout2 );
+ if ( m_viewmode == VIEWMODE_PREVIEW ) {
+ KitaThreadViewBaseLayout->remove( subjectLabel );
+ KitaThreadViewBaseLayout->removeItem( layout2 );
}
-
+
/* m_serverTime is used for writing */
m_serverTime = serverTime;
setActiveWindow();
/* setup */
- setupEx( thread , 0, VIEWMODE_PARENT);
+ setupEx( thread , 0, VIEWMODE_PARENT );
/* read cache */
update_readCache();
/*---------*/ /* public slot */
void KitaThreadView::slotReloadButton()
{
- switch (m_viewmode){
+ switch ( m_viewmode ) {
case VIEWMODE_PREVIEW: break;
default:
- /* When this is not parent, show the thread with new tab */
- KParts::URLArgs tmp;
- emit openURLRequest(m_thread->datURL() , tmp );
- break;
-
+ /* When this is not parent, show the thread with new tab */
+ KParts::URLArgs tmp;
+ emit openURLRequest( m_thread->datURL() , tmp );
+ break;
+
}
}
url = KURL( m_thread->datURL(), urlin.prettyURL().mid( 15 ) );
}
- KURL datURL = filterReadCGI( url , m_thread);
+ KURL datURL = filterReadCGI( url , m_thread );
/* If this is not anchor, then emit openURLRequest and return */
if ( datURL.host() != KURL( m_thread->datURL() ).host()
- || datURL.path() != KURL( m_thread->datURL() ).path() ){
- emit openURLRequest( datURL, args );
- return;
+ || datURL.path() != KURL( m_thread->datURL() ).path() ) {
+ emit openURLRequest( datURL, args );
+ return ;
}
- if (! datURL.hasRef() ) return;
+ if ( ! datURL.hasRef() ) return ;
if ( m_viewmode == VIEWMODE_PREVIEW ) return ;
/*---------------------------*/
if ( datURL.ref().left( 5 ) == "write" ) {
- QClipboard * clipboard = QApplication::clipboard();
- QString str, resstr;
- int resNum = datURL.ref().mid( 5 ).toInt();
-
- KPopupMenu *popupMenu = new KPopupMenu( m_threadPart->view() );
- popupMenu->clear();
- popupMenu->insertItem( "write response", 0 );
- popupMenu->insertItem( "quote this", 1 );
- popupMenu->insertItem( "copy", 3 );
- if ( m_viewmode == VIEWMODE_PARENT ) {
- popupMenu->insertSeparator();
- popupMenu->insertItem( "set Kokomade Yonda", 2 );
- }
-
- switch ( popupMenu->exec( QCursor::pos() ) ) {
- case 0:
- resstr = ">>" + QString().setNum( resNum ) + "\n";
- break;
-
- case 1:
- resstr = ">>" + QString().setNum( resNum ) + "\n";
- resstr += m_domtree->getResStr( resNum, "> " );
- break;
-
- case 2:
- delete popupMenu;
- m_domtree->setKokoyonNum( resNum );
- KitaThreadInfo::setReadNum( m_thread->datURL(), resNum );
- update_finish();
- gotoAnchor( datURL.ref().mid( 5 ) );
- return ;
-
- case 3:
- delete popupMenu;
- str = threadName()
- + "\n" + threadURL().url() + QString().setNum( resNum )
- + "\n\n" + m_domtree->getResStr( resNum, "" );
- clipboard->setText( str , QClipboard::Clipboard );
- clipboard->setText( str , QClipboard::Selection );
- return ;
-
- default:
- delete popupMenu;
- return ;
- }
-
- delete popupMenu;
- slotWriteButtonClicked( resstr );
- return ;
+ QClipboard * clipboard = QApplication::clipboard();
+ QString str, resstr;
+ int resNum = datURL.ref().mid( 5 ).toInt();
+
+ KPopupMenu *popupMenu = new KPopupMenu( m_threadPart->view() );
+ popupMenu->clear();
+ popupMenu->insertItem( "write response", 0 );
+ popupMenu->insertItem( "quote this", 1 );
+ popupMenu->insertItem( "copy", 3 );
+ if ( m_viewmode == VIEWMODE_PARENT ) {
+ popupMenu->insertSeparator();
+ popupMenu->insertItem( "set Kokomade Yonda", 2 );
+ }
+
+ switch ( popupMenu->exec( QCursor::pos() ) ) {
+ case 0:
+ resstr = ">>" + QString().setNum( resNum ) + "\n";
+ break;
+
+ case 1:
+ resstr = ">>" + QString().setNum( resNum ) + "\n";
+ resstr += m_domtree->getResStr( resNum, "> " );
+ break;
+
+ case 2:
+ delete popupMenu;
+ m_domtree->setKokoyonNum( resNum );
+ KitaThreadInfo::setReadNum( m_thread->datURL(), resNum );
+ update_finish();
+ gotoAnchor( datURL.ref().mid( 5 ) );
+ return ;
+
+ case 3:
+ delete popupMenu;
+ str = threadName()
+ + "\n" + threadURL().url() + QString().setNum( resNum )
+ + "\n\n" + m_domtree->getResStr( resNum, "" );
+ clipboard->setText( str , QClipboard::Clipboard );
+ clipboard->setText( str , QClipboard::Selection );
+ return ;
+
+ default:
+ delete popupMenu;
+ return ;
+ }
+
+ delete popupMenu;
+ slotWriteButtonClicked( resstr );
+ return ;
}
- if ( m_viewmode != VIEWMODE_PARENT ) return;
+ if ( m_viewmode != VIEWMODE_PARENT ) return ;
/*----------------------------*/
/* next 100 ,before 100 ,etc. */
int bottom = m_domtree->getBottomResNumber();
int totalNum = m_domtree->getMaxResNumber();
- if ( datURL.ref().left( 7 ) == "tugi100" ) {
+ if ( datURL.ref().left( 7 ) == "tugi100" ) {
+
+ if ( totalNum != bottom ) {
+ appendRes( bottom + 1, bottom + 100 );
+ }
+ gotoAnchor( QString().setNum( bottom ) );
+ return ;
- if ( totalNum != bottom ) {
- appendRes( bottom + 1, bottom + 100 );
- }
- gotoAnchor( QString().setNum( bottom ) );
- return;
-
} else if ( datURL.ref().left( 6 ) == "nokori" ) {
- if ( totalNum != bottom ) {
- appendRes( bottom + 1, totalNum );
- }
- gotoAnchor( QString().setNum( bottom ) );
- return;
+ if ( totalNum != bottom ) {
+ appendRes( bottom + 1, totalNum );
+ }
+ gotoAnchor( QString().setNum( bottom ) );
+ return ;
} else if ( datURL.ref().left( 7 ) == "tosaigo" ) {
- if ( totalNum != bottom ) {
- appendRes( bottom + 1, totalNum );
- }
- gotoAnchor( "footer" );
- return;
-
+ if ( totalNum != bottom ) {
+ appendRes( bottom + 1, totalNum );
+ }
+ gotoAnchor( "footer" );
+ return ;
+
} else if ( datURL.ref().left( 6 ) == "mae100" ) {
-
- if ( top != 1 ) {
- m_domtree->appendTemplate();
- appendRes( top - 100, bottom );
- gotoAnchor( QString().setNum( top ) );
- }
- return;
-
+
+ if ( top != 1 ) {
+ m_domtree->appendTemplate();
+ appendRes( top - 100, bottom );
+ gotoAnchor( QString().setNum( top ) );
+ }
+ return ;
+
} else if ( datURL.ref().left( 8 ) == "maezenbu" ) {
-
- if ( top != 1 ) {
- appendRes( 1, bottom );
- gotoAnchor( QString().setNum( top ) );
- }
- return;
-
+
+ if ( top != 1 ) {
+ appendRes( 1, bottom );
+ gotoAnchor( QString().setNum( top ) );
+ }
+ return ;
+
} else if ( datURL.ref().left( 6 ) == "tmp100" ) {
-
- int tmpnum = m_domtree->getTemplateNumber();
-
- if ( tmpnum < top ) {
- m_domtree->setTemplateNumber( tmpnum + 100 );
- m_domtree->appendTemplate();
- appendRes( top, bottom );
- gotoAnchor( QString().setNum( tmpnum ) );
- }
- return;
-
+
+ int tmpnum = m_domtree->getTemplateNumber();
+
+ if ( tmpnum < top ) {
+ m_domtree->setTemplateNumber( tmpnum + 100 );
+ m_domtree->appendTemplate();
+ appendRes( top, bottom );
+ gotoAnchor( QString().setNum( tmpnum ) );
+ }
+ return ;
+
} else if ( datURL.ref().left( 5 ) == "zenbu" ) {
- if ( top != 1 || bottom != totalNum ) {
- appendRes( 1, totalNum );
- gotoAnchor( "header" );
- }
- return;
-
+ if ( top != 1 || bottom != totalNum ) {
+ appendRes( 1, totalNum );
+ gotoAnchor( "header" );
+ }
+ return ;
+
}
/*---------------------*/
int i = refstr.find( "-" );
if ( i != -1 ) {
- refNum = refstr.left( i ).toInt();
- refstr = datURL.ref().left( i );
- }
- else refNum = refstr.toInt();
+ refNum = refstr.left( i ).toInt();
+ refstr = datURL.ref().left( i );
+ } else refNum = refstr.toInt();
- if( !refNum ) return;
+ if ( !refNum ) return ;
gotoAnchor( refstr );
}
anc = "header";
} else if ( res > 1 ) {
- /* data is not set */
- if ( !m_domtree->isResDataSet( res ) ) return ;
- if( res > maxres ) return ;
+ /* data is not set */
+ if ( !m_domtree->isResDataSet( res ) ) return ;
+ if ( res > maxres ) return ;
- /* show res if it is not shown */
+ /* show res if it is not shown */
if ( !m_domtree->isResShown( res ) ) {
if ( res > bottom ) appendRes( bottom + 1, res + 99 );
m_access = new Kita::Access( m_thread );
connect( m_access, SIGNAL( redirection( const QString& ) ),
SIGNAL( setLocationBarURL( const QString& ) ) );
- m_serverTime = m_access->serverTime();
+ m_serverTime = m_access->serverTime();
}
/* get log from cahce & copy to dom */
m_rescode = m_access->responseCode();
if ( m_rescode == 200 || m_rescode == 206 ) {
- if ( updateline.length() > 1 ){
- update_copydata( updateline, maxres + 1 );
- Kita::DatManager::deleteDat(m_thread->datURL());
- }
+ if ( updateline.length() > 1 ) {
+ update_copydata( updateline, maxres + 1 );
+ Kita::DatManager::deleteDat( m_thread->datURL() );
+ }
}
}
m_domtree->StopParseThread();
/* If bottom = -1, this thread is not shown yet. */
/* If maxres = prevReadNum, no new data was obtained. */
/* See also kitadomtree.h */
-
+
/* Data is not set */
if ( maxres == 0 ) {
showStatusBar( "" );
/* This thread is not shown */
if ( bottom < 0 ) {
bottom = QMAX( 0, prevReadNum - m_preShowNum );
- /* show templates (No.1->No.KitaDomTree::m_templateNum) */
- m_domtree->appendTemplate();
+ /* show templates (No.1->No.KitaDomTree::m_templateNum) */
+ m_domtree->appendTemplate();
}
/* show resposes from No.bottom to No.prevReadNum */
No.(prevReadNum-m_preShowNum) -> No.(prevReadNum+m_afterShowNum)
are shown. */
-
+
/* finish rendering */
m_thread->setResNum( maxres );
KitaThreadInfo::setReadNum( m_thread->datURL(), maxres );
showStatusBar( "" );
Kita::Thread::setName( m_thread->datURL(), m_domtree->getSubject() );
emit thread( m_thread );
- setSubjectLabel( m_thread->boardName(), m_thread->name() + QString(" (%1)").arg( m_thread->resNum() ) );
+ setSubjectLabel( m_thread->boardName(), m_thread->name() + QString( " (%1)" ).arg( m_thread->resNum() ) );
m_domtree->findTextInit();
updateButton();
emit showThreadCompleted( m_thread->url() );
{
hidePopup();
if ( !isActiveWindow() ) return ;
- if ( url.isEmpty() ) return;
-
+ if ( url.isEmpty() ) return ;
+
if ( m_popup ) {
- delete m_popup;
- m_popup = NULL;
+ delete m_popup;
+ m_popup = NULL;
}
/* id popup */
- if ( url.left( 6 ) == "#idpop" ) {
- int num = Kita::DatManager::getNumByID(m_thread->datURL(), url.mid( 6 ) );
- if ( num <= 1 ) return ;
- QString tmpstr = QString("<DIV>ID:%1:[%2]<BR><BR></DIV>").arg(url.mid( 6 )).arg(num);
- showPopup( tmpstr, QString::null );
- return;
+ if ( url.left( 6 ) == "#idpop" ) {
+ int num = Kita::DatManager::getNumByID( m_thread->datURL(), url.mid( 6 ) );
+ if ( num <= 1 ) return ;
+ QString tmpstr = QString( "<DIV>ID:%1:[%2]<BR><BR></DIV>" ).arg( url.mid( 6 ) ).arg( num );
+ showPopup( tmpstr, QString::null );
+ return ;
}
/*-------------------------*/
/* popup for anchor */
-
+
QString innerHTML = QString::null;
QString refstr;
KURL datURL = m_thread->datURL();
int refNum;
int refNum2;
-
+
if ( url.at( 0 ) == '#' ) refstr = url.mid( 1 );
else if ( url.left( 7 ) == "mailto:" ) {
- DOM::Node node = m_threadPart->nodeUnderMouse().firstChild();
- QString nodeValue = node.nodeValue().string();
- refstr = nodeValue;
- }
- else {
- datURL = filterReadCGI( KURL( m_thread->datURL(), url ) , m_thread);
- refstr = datURL.ref();
+ DOM::Node node = m_threadPart->nodeUnderMouse().firstChild();
+ QString nodeValue = node.nodeValue().string();
+ refstr = nodeValue;
+ } else {
+ datURL = filterReadCGI( KURL( m_thread->datURL(), url ) , m_thread );
+ refstr = datURL.ref();
}
/* Is this url 2ch ? */
/* copied from KitaThreadTabWidget::slotOpenURLRequest */
QRegExp regexp( "http://([^/]*)/([^/]*)/dat/(.*)\\.dat" );
- if( regexp.search( datURL.url() ) == -1 ) return;
+ if ( regexp.search( datURL.url() ) == -1 ) return ;
int i = refstr.find( "-" );
if ( i != -1 ) { /* >>refNum-refNum2 */
- refNum = refstr.left( i ).toInt();
- refNum2 = refstr.mid( i + 1 ).toInt();
+ refNum = refstr.left( i ).toInt();
+ refNum2 = refstr.mid( i + 1 ).toInt();
+
+ if ( refNum ) {
+ if ( refNum2 < refNum ) refNum2 = refNum;
+ if ( refNum2 - refNum > m_maxpopup - 1 ) refNum2 = refNum + m_maxpopup - 1;
+ }
- if ( refNum ) {
- if ( refNum2 < refNum ) refNum2 = refNum;
- if ( refNum2 - refNum > m_maxpopup - 1 ) refNum2 = refNum + m_maxpopup - 1;
- }
-
} else { /* >>refNum */
- refNum = refstr.toInt();
- refNum2 = refNum;
+ refNum = refstr.toInt();
+ refNum2 = refNum;
}
/* another thread ? */
if ( datURL.host() != KURL( m_thread->datURL() ).host()
- || datURL.path() != KURL( m_thread->datURL() ).path() ){
+ || datURL.path() != KURL( m_thread->datURL() ).path() ) {
+
+ /* show subject */
+ innerHTML = Kita::DatManager::getSubject( datURL );
+ if ( innerHTML != QString::null ) innerHTML += "<br><br>";
- /* show subject */
- innerHTML = Kita::DatManager::getSubject(datURL);
- if(innerHTML != QString::null) innerHTML += "<br><br>";
-
- if ( !refNum ) refNum = refNum2 = 1;
+ if ( !refNum ) refNum = refNum2 = 1;
}
/* get HTML and show it */
- if ( !refNum ) return;
- innerHTML += Kita::DatManager::getHtml(datURL,refNum, refNum2 );
+ if ( !refNum ) return ;
+ innerHTML += Kita::DatManager::getHtml( datURL, refNum, refNum2 );
- if (innerHTML != QString::null ) showPopup( innerHTML, QString::null );
+ if ( innerHTML != QString::null ) showPopup( innerHTML, QString::null );
}
void KitaThreadView::slotSearchButton()
{
if ( m_viewmode == VIEWMODE_PREVIEW ) return ;
-
+
if ( m_serverTime == 0 ) return ; /* Nothing is shown on the screen.*/
/* jump */
}
/* public */
-void KitaThreadView::domApplyChange( QString lbstr, /* label */
- QString hstr, /* header */
- QString fstr, /* footer */
- QString anchor, /* anchor to jump */
+void KitaThreadView::domApplyChange( QString lbstr, /* label */
+ QString hstr, /* header */
+ QString fstr, /* footer */
+ QString anchor, /* anchor to jump */
QString cmbstr /* strings to set combo box */
- )
+ )
{
/* label, header & footer */