KitaThreadView::~KitaThreadView()
{
- if ( m_popup ) {
+ if ( m_popup )
+ {
delete m_popup;
m_popup = NULL;
}
-
+
/* unlock URL */
Kita::DatManager::unlock(m_datURL);
/* don't delete m_threadPart before deleting m_domtree */
- if ( m_domtree ) {
+ if ( m_domtree )
+ {
delete m_domtree;
m_domtree = NULL;
}
- if ( m_threadPart ) {
+ if ( m_threadPart )
+ {
delete m_threadPart;
m_threadPart = NULL;
}
{ //process Anchor tags. Anchor tags not proccessed here cause 'emit KParts::BrowserExtention::openURLRequest()'
DOM::HTMLAnchorElement anchor = node;
- if ( ! anchor.href().isEmpty() ) {
+ if ( ! anchor.href().isEmpty() )
+ {
kdDebug() << "AnchorNodeActivated::" << endl;
} // end: anchor.href().isEmpty()
} // end of Anchor tags.
void KitaThreadView::setSubjectLabel( const QString& boardName, const QString& threadName, const QString boardURL )
{
QString disp;
- if ( boardName.isEmpty() ) {
+ if ( boardName.isEmpty() )
+ {
disp = threadName;
- } else {
+ }
+ else
+ {
disp = QString( "<a href=\"%1\">[%2]</a> %3" ).arg( boardURL ).arg( boardName ).arg( threadName );
}
BookmarkButton->setEnabled( true );
ReloadButton->setEnabled( true );
- if ( HighLightButton->isOn() ) {
+ if ( HighLightButton->isOn() )
+ {
HighLightButton->toggle();
}
- if ( FavoriteThreads::getInstance() ->contains( m_thread->datURL() ) ) {
+ if ( FavoriteThreads::getInstance() ->contains( m_thread->datURL() ) )
+ {
BookmarkButton->setOn( true );
- } else {
+ }
+ else
+ {
BookmarkButton->setOn( false );
}
}
Kita::WriteResult writeResult( input );
kdDebug() << "code = " << writeResult.code() << endl;
- switch ( writeResult.code() ) {
+ switch ( writeResult.code() )
+ {
case Kita::K2ch_Unknown:
// probably OK.
emit writeSucceeded();
case Kita::K2ch_Cookie:
if ( KMessageBox::questionYesNo( 0, eucjpCodec->toUnicode( cookie_message ),
eucjpCodec->toUnicode( cookie_title ) )
- == KMessageBox::Yes ) {
+ == KMessageBox::Yes )
+ {
KitaWriteDialog * dialog = openDialog( m_postInfo );
dialog->postMessage();
- } else {
+ }
+ else
+ {
KitaWriteDialog* dialog = openDialog( m_postInfo );
dialog->show();
}
void KitaThreadView::insertSearchCombo()
{
- for ( int count = 0; count < SearchCombo->count(); ++count ) {
- if ( SearchCombo->text( count ) == SearchCombo->currentText() ) {
+ for ( int count = 0; count < SearchCombo->count(); ++count )
+ {
+ if ( SearchCombo->text( count ) == SearchCombo->currentText() )
+ {
// found
return ;
}
void KitaThreadView::hidePopup()
{
- if ( m_popup ) {
+ if ( m_popup )
+ {
m_popup->hide();
}
}
paletteChanged();
if (kapp)
{
- connect(kapp, SIGNAL(kdisplayPaletteChanged()),
- this, SLOT(paletteChanged()));
+ connect(kapp, SIGNAL(kdisplayPaletteChanged()),
+ this, SLOT(paletteChanged()));
}
}
void KitaSubjectLabel::paletteChanged()
{
- QPalette p = kapp ? kapp->palette() : palette();
- p.setBrush(QColorGroup::Base, p.brush(QPalette::Normal, QColorGroup::Background));
- p.setColor(QColorGroup::Text, p.color(QPalette::Normal, QColorGroup::Foreground));
- setPalette(p);
+ QPalette p = kapp ? kapp->palette() : palette();
+ p.setBrush(QColorGroup::Base, p.brush(QPalette::Normal, QColorGroup::Background));
+ p.setColor(QColorGroup::Text, p.color(QPalette::Normal, QColorGroup::Foreground));
+ setPalette(p);
}
QSize KitaSubjectLabel::minimumSizeHint() const
{
- QSize ms = minimumSize();
- if ((ms.width() > 0) && (ms.height() > 0))
- return ms;
-
- int w = 400;
- if (ms.width() > 0)
- w = ms.width();
-
- QString txt = text();
- QSimpleRichText rt(txt, font());
- rt.setWidth(w - 2*frameWidth() - 10);
- w = 10 + rt.widthUsed() + 2*frameWidth();
- if (w < ms.width())
- w = ms.width();
- int h = rt.height() + 2*frameWidth();
- if ( h < ms.height())
- h = ms.height();
-
- return QSize(w, h);
+ QSize ms = minimumSize();
+ if ((ms.width() > 0) && (ms.height() > 0))
+ return ms;
+
+ int w = 400;
+ if (ms.width() > 0)
+ w = ms.width();
+
+ QString txt = text();
+ QSimpleRichText rt(txt, font());
+ rt.setWidth(w - 2*frameWidth() - 10);
+ w = 10 + rt.widthUsed() + 2*frameWidth();
+ if (w < ms.width())
+ w = ms.width();
+ int h = rt.height() + 2*frameWidth();
+ if ( h < ms.height())
+ h = ms.height();
+
+ return QSize(w, h);
}
QSize KitaSubjectLabel::sizeHint() const
{
- return minimumSizeHint();
+ return minimumSizeHint();
}
PopupTextBrowser::PopupTextBrowser( QFrame* frame )
/*---------------------------------------*/
/* setup */
- /* unlock previous URL */
- Kita::DatManager::unlock(m_datURL);
+ /* unlock previous URL */
+ Kita::DatManager::unlock(m_datURL);
m_thread = const_cast<Kita::Thread *>( thread );
m_datURL = m_thread->datURL();
- /* lock new URL */
- Kita::DatManager::lock(m_datURL);
+ /* lock new URL */
+ Kita::DatManager::lock(m_datURL);
/* setup HTMLPart */
m_threadPart->setupEx( this, m_domtree, m_thread );
m_viewmode = mode;
/* If curreent mode is VIEWMODE_PREVIEW , hide buttons */
- if ( m_viewmode == VIEWMODE_PREVIEW ) {
+ if ( m_viewmode == VIEWMODE_PREVIEW )
+ {
QLayout* Base = layout();
Base->remove( Subjectframe );
Base->removeItem( layout2 );
/* get log from cahce */
int maxnum = Kita::DatManager::getMaxResNumber(m_datURL);
m_rescode = 200;
- if ( maxnum ) {
+ if ( maxnum )
+ {
- /* copy data to dom */
- for(int i = 1; i <= maxnum; i++){
- const QString& line = Kita::DatManager::getDat(m_datURL,i);
- if(line != QString::null) m_domtree->setDat( line , i );
- }
+ /* copy data to dom */
+ for(int i = 1; i <= maxnum; i++)
+ {
+ const QString& line = Kita::DatManager::getDat(m_datURL,i);
+ if(line != QString::null) m_domtree->setDat( line , i );
+ }
- /* show templates (No.1->No.KitaDomTree::m_templateNum) */
- m_domtree->appendTemplate();
+ /* show templates (No.1->No.KitaDomTree::m_templateNum) */
+ m_domtree->appendTemplate();
- /* rendering */
- m_kokoyonNum = Kita::DatManager::getKokoyonNum(m_datURL);
- for ( int i = m_kokoyonNum - m_preShowNum ; i <= m_kokoyonNum ; i++ )
- m_domtree->appendRes( i, FALSE );
- updateScreen();
+ /* rendering */
+ m_kokoyonNum = Kita::DatManager::getKokoyonNum(m_datURL);
+ for ( int i = m_kokoyonNum - m_preShowNum ; i <= m_kokoyonNum ; i++ )
+ m_domtree->appendRes( i, FALSE );
+ updateScreen();
- m_threadPart->gotoKokoyon();
+ m_threadPart->gotoKokoyon();
}
- else {
- m_kokoyonNum = 0;
- showStatusBar( "" );
+ else
+ {
+ m_kokoyonNum = 0;
+ showStatusBar( "" );
}
-
+
/* update data */
- m_firstReceive = TRUE;
+ m_firstReceive = TRUE;
if( m_online ) slotReloadButton();
else updateInfo();
-
+
topLevelWidget() ->raise();
setActiveWindow();
}
/*---------*/ /* public slot */
void KitaThreadView::slotReloadButton()
{
- switch ( m_viewmode ) {
+ switch ( m_viewmode )
+ {
case VIEWMODE_PREVIEW: break;
case VIEWMODE_PARENT:
-
- /* update cache */
- /* After updating cache, DatManager will call slotFinishLoad.*/
- if( m_online ){
- m_domtree->StopParseThread();
- m_showNum = m_domtree->getBottomResNumber() + m_afterShowNum;
- Kita::DatManager::updateCache(m_datURL,this);
- m_threadPart->view()->setFocus();
- showStatusBar( Kita::ParseMisc::utf8ToUnicode( KITAUTF8_NOWRENEW ) );
- }
- break;
+
+ /* update cache */
+ /* After updating cache, DatManager will call slotFinishLoad.*/
+ if( m_online )
+ {
+ m_domtree->StopParseThread();
+ m_showNum = m_domtree->getBottomResNumber() + m_afterShowNum;
+ Kita::DatManager::updateCache(m_datURL,this);
+ m_threadPart->view()->setFocus();
+ showStatusBar( Kita::ParseMisc::utf8ToUnicode( KITAUTF8_NOWRENEW ) );
+ }
+ break;
default:
/*-----------------------------------*/
/* slot called when Kita::DatManager
received new data. */ /* public slot */
-void KitaThreadView::slotReceiveData(){
+void KitaThreadView::slotReceiveData()
+{
int bottomNum = m_domtree->getBottomResNumber();
int beforeNum = m_domtree->getMaxResNumber();
m_rescode = Kita::DatManager::getResponseCode(m_datURL);
m_serverTime = Kita::DatManager::getServerTime(m_datURL);
-
+
/* copy new data to DOM */
- for(int i = beforeNum+1; i <= afterNum; i++){
- const QString& line = Kita::DatManager::getDat(m_datURL,i);
- if(line != QString::null){
- m_domtree->setDat( line , i );
- m_domtree->parseRes( i, i );
- }
+ for(int i = beforeNum+1; i <= afterNum; i++)
+ {
+ const QString& line = Kita::DatManager::getDat(m_datURL,i);
+ if(line != QString::null)
+ {
+ m_domtree->setDat( line , i );
+ m_domtree->parseRes( i, i );
+ }
}
/* rendering */
- if(bottomNum < m_showNum ){
- for ( int i = bottomNum+1 ; i <= m_showNum; i++ ) m_domtree->appendRes( i, FALSE );
- updateScreen();
- if(m_firstReceive && m_kokoyonNum < afterNum ){
- m_threadPart->gotoKokoyon();
- m_firstReceive = FALSE;
- }
+ if(bottomNum < m_showNum )
+ {
+ for ( int i = bottomNum+1 ; i <= m_showNum; i++ ) m_domtree->appendRes( i, FALSE );
+ updateScreen();
+ if(m_firstReceive && m_kokoyonNum < afterNum )
+ {
+ m_threadPart->gotoKokoyon();
+ m_firstReceive = FALSE;
+ }
}
}
/*-----------------------------------*/
/* slot called when Kita::DatManager
finished updating new data. */ /* public slot */
-void KitaThreadView::slotFinishLoad(){
+void KitaThreadView::slotFinishLoad()
+{
m_firstReceive = FALSE;
slotReceiveData();
/* convert to the correct URL */
/* see also comments in KitaDomTree::createHTMLDocument for details */
- if ( urlin.protocol() == "file" ) {
+ if ( urlin.protocol() == "file" )
+ {
if ( urlin.prettyURL().mid( 5, 14 ) == "/test/read.cgi" )
url = KURL( m_thread->datURL(), ".." + urlin.prettyURL().mid( 5 ) );
/* 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() ) {
+ || datURL.path() != KURL( m_thread->datURL() ).path() )
+ {
emit openURLRequest( datURL, args );
return ;
}
/*---------------------------*/
/* show popupmenu for #write */
- if ( datURL.ref().left( 5 ) == "write" ) {
+ if ( datURL.ref().left( 5 ) == "write" )
+ {
QClipboard * clipboard = QApplication::clipboard();
QString str, resstr;
int resNum = datURL.ref().mid( 5 ).toInt();
-
- /* show res tree on the popup */
- if(m_threadPart->isRightClick()){
- int num;
- QString htmlstr
- = Kita::DatManager::getTreeByRes(m_thread->datURL(),resNum,num);
- if ( !num ) return ;
- QString tmpstr = QString("<DIV>No.%1 : [%2]<BR>").arg(resNum).arg(num);
- tmpstr += htmlstr;
- tmpstr += "<BR><BR></DIV>";
- showPopup( tmpstr, QString::null );
- return;
- }
- /* show tree on the kitanavi */
- else if(m_threadPart->isCtrlClick() || m_threadPart->isMidClick()){
- showKitaNaviResTree(resNum);
- return;
- }
+
+ /* show res tree on the popup */
+ if(m_threadPart->isRightClick())
+ {
+ int num;
+ QString htmlstr
+ = Kita::DatManager::getTreeByRes(m_thread->datURL(),resNum,num);
+ if ( !num ) return ;
+ QString tmpstr = QString("<DIV>No.%1 : [%2]<BR>").arg(resNum).arg(num);
+ tmpstr += htmlstr;
+ tmpstr += "<BR><BR></DIV>";
+ showPopup( tmpstr, QString::null );
+ return;
+ }
+ /* show tree on the kitanavi */
+ else if(m_threadPart->isCtrlClick() || m_threadPart->isMidClick())
+ {
+ showKitaNaviResTree(resNum);
+ return;
+ }
KPopupMenu *popupMenu = new KPopupMenu( m_threadPart->view() );
popupMenu->clear();
popupMenu->insertItem( i18n( "write response" ), 0 );
popupMenu->insertItem( i18n( "quote this" ), 1 );
popupMenu->insertItem( i18n( "copy" ), 3 );
- if ( m_viewmode == VIEWMODE_PARENT ) {
+ if ( m_viewmode == VIEWMODE_PARENT )
+ {
popupMenu->insertSeparator();
popupMenu->insertItem( i18n( "set Kokomade Yonda" ), 2 );
}
- switch ( popupMenu->exec( QCursor::pos() ) ) {
+ switch ( popupMenu->exec( QCursor::pos() ) )
+ {
case 0:
resstr = ">>" + QString().setNum( resNum ) + "\n";
break;
case 2:
delete popupMenu;
- m_kokoyonNum = resNum;
- Kita::DatManager::setKokoyonNum(m_datURL,resNum);
- updateScreen();
- gotoAnchor( QString().setNum( resNum ) );
+ m_kokoyonNum = resNum;
+ Kita::DatManager::setKokoyonNum(m_datURL,resNum);
+ updateScreen();
+ gotoAnchor( QString().setNum( resNum ) );
return ;
case 3:
/*----------------------------*/
/* extract responses by ID */
- if(datURL.ref().left(5) == "idpop"){
-
- QString strid = datURL.ref().mid(5).replace("%2B","+").replace("%2F", "/"); /* decode %2B -> +, %2F -> / */
-
- /* show them on the popup */
- if(m_threadPart->isRightClick()){
- int num;
- QString htmlstr
- = Kita::DatManager::getHtmlByID(m_thread->datURL(),strid,num );
- if ( num <= 1 ) return ;
- QString tmpstr = QString("<DIV>ID:%1:[%2]<BR>").arg(strid).arg(num);
- tmpstr += htmlstr;
- tmpstr += "<BR><BR></DIV>";
- showPopup( tmpstr, QString::null );
- }
-
- /* show them on the kitanavi */
- else if(m_threadPart->isCtrlClick() || m_threadPart->isMidClick())
- showKitaNaviByID(strid);
- else {
+ if(datURL.ref().left(5) == "idpop")
+ {
+
+ QString strid = datURL.ref().mid(5).replace("%2B","+").replace("%2F", "/"); /* decode %2B -> +, %2F -> / */
+
+ /* show them on the popup */
+ if(m_threadPart->isRightClick())
+ {
+ int num;
+ QString htmlstr
+ = Kita::DatManager::getHtmlByID(m_thread->datURL(),strid,num );
+ if ( num <= 1 ) return ;
+ QString tmpstr = QString("<DIV>ID:%1:[%2]<BR>").arg(strid).arg(num);
+ tmpstr += htmlstr;
+ tmpstr += "<BR><BR></DIV>";
+ showPopup( tmpstr, QString::null );
+ }
+
+ /* show them on the kitanavi */
+ else if(m_threadPart->isCtrlClick() || m_threadPart->isMidClick())
+ showKitaNaviByID(strid);
+ else
+ {
KPopupMenu *popupMenu = new KPopupMenu( m_threadPart->view() );
popupMenu->clear();
popupMenu->insertItem( i18n( "add id to abone list" ), 0 );
- switch ( popupMenu->exec( QCursor::pos() ) ) {
+ switch ( popupMenu->exec( QCursor::pos() ) )
+ {
case 0:
KitaConfig::addAboneID( strid );
delete popupMenu;
}
}
- return;
+ 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 ) {
+ if ( totalNum != bottom )
+ {
appendRes( bottom + 1, bottom + 100 );
}
gotoAnchor( QString().setNum( bottom ) );
return ;
- } else if ( datURL.ref().left( 6 ) == "nokori" ) {
+ }
+ else if ( datURL.ref().left( 6 ) == "nokori" )
+ {
- if ( totalNum != bottom ) {
+ if ( totalNum != bottom )
+ {
appendRes( bottom + 1, totalNum );
}
gotoAnchor( QString().setNum( bottom ) );
return ;
- } else if ( datURL.ref().left( 7 ) == "tosaigo" ) {
+ }
+ else if ( datURL.ref().left( 7 ) == "tosaigo" )
+ {
- if ( totalNum != bottom ) {
+ if ( totalNum != bottom )
+ {
appendRes( bottom + 1, totalNum );
}
gotoAnchor( "footer" );
return ;
- } else if ( datURL.ref().left( 6 ) == "mae100" ) {
+ }
+ else if ( datURL.ref().left( 6 ) == "mae100" )
+ {
- if ( top != 1 ) {
+ if ( top != 1 )
+ {
m_domtree->appendTemplate();
appendRes( top - 100, bottom );
gotoAnchor( QString().setNum( top ) );
}
return ;
- } else if ( datURL.ref().left( 8 ) == "maezenbu" ) {
+ }
+ else if ( datURL.ref().left( 8 ) == "maezenbu" )
+ {
- if ( top != 1 ) {
+ if ( top != 1 )
+ {
appendRes( 1, bottom );
gotoAnchor( QString().setNum( top ) );
}
return ;
- } else if ( datURL.ref().left( 6 ) == "tmp100" ) {
+ }
+ else if ( datURL.ref().left( 6 ) == "tmp100" )
+ {
int tmpnum = m_domtree->getTemplateNumber();
- if ( tmpnum < top ) {
+ if ( tmpnum < top )
+ {
m_domtree->setTemplateNumber( tmpnum + 100 );
m_domtree->appendTemplate();
appendRes( top, bottom );
}
return ;
- } else if ( datURL.ref().left( 5 ) == "zenbu" ) {
+ }
+ else if ( datURL.ref().left( 5 ) == "zenbu" )
+ {
- if ( top != 1 || bottom != totalNum ) {
+ if ( top != 1 || bottom != totalNum )
+ {
appendRes( 1, totalNum );
gotoAnchor( "header" );
}
int refNum,refNum2;
int i = refstr.find( "-" );
- if ( i != -1 ) {
+ if ( i != -1 )
+ {
refNum = refstr.left( i ).toInt();
- refNum2 = QMIN(refstr.mid(i+1).toInt(),totalNum);
- if(refNum2 < refNum) refNum2 = refNum;
+ refNum2 = QMIN(refstr.mid(i+1).toInt(),totalNum);
+ if(refNum2 < refNum) refNum2 = refNum;
refstr = datURL.ref().left( i );
- } else refNum = refNum2 = refstr.toInt();
+ }
+ else refNum = refNum2 = refstr.toInt();
if ( !refNum ) return ;
/* show Kita Navi or goto anchor */
if(m_threadPart->isCtrlClick() || m_threadPart->isMidClick()
- || m_viewmode == VIEWMODE_KITANAVI){
- showKitaNavi(refNum,refNum2);
+ || m_viewmode == VIEWMODE_KITANAVI)
+ {
+ showKitaNavi(refNum,refNum2);
}
else gotoAnchor( refstr );
}
bool broken = FALSE;
QString infostr = QString::null;
QString errstr = QString::null;
-
- switch( m_viewmode ){
+
+ switch( m_viewmode )
+ {
case VIEWMODE_PARENT:
- totalNum = Kita::DatManager::getMaxResNumber(m_datURL);
- broken = Kita::DatManager::isBroken(m_datURL);
- datSize = Kita::DatManager::getDatSize(m_datURL);
+ totalNum = Kita::DatManager::getMaxResNumber(m_datURL);
+ broken = Kita::DatManager::isBroken(m_datURL);
+ datSize = Kita::DatManager::getDatSize(m_datURL);
- errstr = QString::null;
- if ( m_rescode != 200 && m_rescode != 206 )
- errstr = QString( "Error %1" ).arg( m_rescode );
- if ( broken ) info += " This thread is broken.";
+ errstr = QString::null;
+ if ( m_rescode != 200 && m_rescode != 206 )
+ errstr = QString( "Error %1" ).arg( m_rescode );
+ if ( broken ) info += " This thread is broken.";
/* show status bar */
infostr = m_thread->name() +
- QString( " [Total: %1 New: %2] %3 k" ).arg( totalNum ).arg( totalNum - m_kokoyonNum ).arg( datSize / 1024 )
- + info + " " + errstr;
+ QString( " [Total: %1 New: %2] %3 k" ).arg( totalNum ).arg( totalNum - m_kokoyonNum ).arg( datSize / 1024 )
+ + info + " " + errstr;
emit signalChangeStatusbar( infostr );
emit showThreadCompleted( m_thread->url() );
topLevelWidget() ->setCaption( m_thread->name() );
-
- return;
- break;
+
+ return;
+ break;
case VIEWMODE_KITANAVI:
- QString infostr = QString( "[%1] %2" ).arg(m_thread->boardName()).arg( m_thread->name() );
- emit signalChangeStatusbar( infostr );
+ QString infostr = QString( "[%1] %2" ).arg(m_thread->boardName()).arg( m_thread->name() );
+ emit signalChangeStatusbar( infostr );
- return;
- break;
- }
+ return;
+ break;
+ }
}
{
KURL newURL = url;
- if ( url.path().contains( "/test/read.cgi" ) ) {
+ if ( url.path().contains( "/test/read.cgi" ) )
+ {
newURL.setProtocol( KURL( thread->datURL() ).protocol() );
QString tmp = url.path().section( "/test/read.cgi", 1 );
newURL.setPath( newPath );
QString refBase = tmp.section( '/', 3 );
- if ( ! refBase.isEmpty() ) {
+ if ( ! refBase.isEmpty() )
+ {
QString newRef;
if ( refBase.at( 0 ) == '-' ) newRef = "1" + refBase;
int bottom = m_domtree->getBottomResNumber();
int res = anc.toInt();
- if ( res == 1 ) {
+ if ( res == 1 )
+ {
anc = "header";
- } else if ( res > 1 ) {
+ }
+ else if ( res > 1 )
+ {
/* data is not set */
if ( !m_domtree->isResDataSet( res ) ) return ;
/* show res if it is not shown */
- if ( !m_domtree->isResShown( res ) ) {
+ if ( !m_domtree->isResShown( res ) )
+ {
if ( res > bottom ) appendRes( bottom + 1, res + 99 );
- else if ( res < top ) {
+ else if ( res < top )
+ {
m_domtree->appendTemplate();
appendRes( res, bottom );
}
}
/* aboned */
- if ( !m_domtree->isResShown( res ) ) {
- while ( res > 0 ) {
+ if ( !m_domtree->isResShown( res ) )
+ {
+ while ( res > 0 )
+ {
if ( m_domtree->isResShown( res ) ) break;
res--;
}
/*--------------------*/
/* update information */ /* public */
-void KitaThreadView::updateInfo(){
-
+void KitaThreadView::updateInfo()
+{
+
/* uptate informations */
setSubjectLabel(Kita::DatManager::thread_boardName(m_datURL),
- Kita::DatManager::thread_name(m_datURL)
- + QString( " (%1)" )
- .arg( Kita::DatManager::getMaxResNumber(m_datURL) ),
+ Kita::DatManager::thread_name(m_datURL)
+ + QString( " (%1)" )
+ .arg( Kita::DatManager::getMaxResNumber(m_datURL) ),
Kita::DatManager::thread_boardURL( m_datURL ) );
emit showThreadCompleted( Kita::DatManager::thread_url(m_datURL) );
m_domtree->findTextInit();
updateButton();
-
+
gotoCombo->clear();
gotoCombo->insertItem( Kita::ParseMisc::utf8ToUnicode( KITAUTF8_GOTO ) );
gotoCombo->insertItem( Kita::ParseMisc::utf8ToUnicode( KITAUTF8_KOKOYON ) );
- for( int i = 1; i < m_thread->resNum(); i += 100 ) {
+ for( int i = 1; i < m_thread->resNum(); i += 100 )
+ {
gotoCombo->insertItem( QString().setNum( i ) + "-" );
}
gotoCombo->insertItem( Kita::ParseMisc::utf8ToUnicode( KITAUTF8_SAIGO ) );
gotoCombo->adjustSize();
-
+
emit thread( m_thread );
showStatusBar( "" );
m_threadPart->view() ->setFocus();
void KitaThreadView::showPopup( QString innerHTML, QString imgfile )
{
- if ( m_popup ) {
+ if ( m_popup )
+ {
delete m_popup;
m_popup = NULL;
}
/* text popup */
- if ( imgfile == NULL ) {
+ if ( imgfile == NULL )
+ {
m_popup = new Kita::ResPopup( m_threadPart->view() );
m_popup->setText( innerHTML );
m_popup->adjustSize();
QPoint pos = QCursor::pos();
int x = pos.x(), y = pos.y();
- if ( x + mrg + pw < sw ) {
+ if ( x + mrg + pw < sw )
+ {
x = x + mrg;
y = QMAX( 0, y - ( ph + mrg ) );
- } else if ( y - ( mrg + ph ) >= 0 ) {
+ }
+ else if ( y - ( mrg + ph ) >= 0 )
+ {
x = QMAX( 0, sw - pw );
y = y - ( ph + mrg );
- } else if ( y + ( mrg + ph ) <= sh ) {
+ }
+ else if ( y + ( mrg + ph ) <= sh )
+ {
x = QMAX( 0, sw - pw );
y = y + mrg;
- } else if ( x - ( mrg + pw ) >= 0 ) {
+ }
+ else if ( x - ( mrg + pw ) >= 0 )
+ {
x = x - ( mrg + pw );
y = QMAX( 0, y - ( ph + mrg ) );
- } else {
+ }
+ else
+ {
x = x + mrg;
y = QMAX( 0, y - ( ph + mrg ) );
}
if ( !isActiveWindow() ) return ;
if ( url.isEmpty() ) return ;
- if ( m_popup ) {
+ if ( m_popup )
+ {
delete m_popup;
m_popup = NULL;
}
/* id popup */
- if ( url.left( 6 ) == "#idpop" ) {
+ 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 );
int refNum2;
if ( url.at( 0 ) == '#' ) refstr = url.mid( 1 );
- else if ( url.left( 7 ) == "mailto:" ) {
+ else if ( url.left( 7 ) == "mailto:" )
+ {
DOM::Node node = m_threadPart->nodeUnderMouse().firstChild();
QString nodeValue = node.nodeValue().string();
refstr = nodeValue;
- } else {
+ }
+ else
+ {
datURL = filterReadCGI( KURL( m_thread->datURL(), url ) , m_thread );
refstr = datURL.ref();
}
if ( regexp.search( datURL.url() ) == -1 ) return ;
int i = refstr.find( "-" );
- if ( i != -1 ) { /* >>refNum-refNum2 */
+ if ( i != -1 )
+ { /* >>refNum-refNum2 */
refNum = refstr.left( i ).toInt();
refNum2 = refstr.mid( i + 1 ).toInt();
- if ( refNum ) {
+ if ( refNum )
+ {
if ( refNum2 < refNum ) refNum2 = refNum;
if ( refNum2 - refNum > m_maxpopup - 1 ) refNum2 = refNum + m_maxpopup - 1;
}
- } else { /* >>refNum */
+ }
+ else
+ { /* >>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 );
/* jump */
QString str = SearchCombo->currentText();
- if ( str.at( 0 ) == ':' ) {
+ if ( str.at( 0 ) == ':' )
+ {
QString anc = str.mid( 1 );
gotoAnchor( anc );
SearchCombo->setFocus();
}
/* extract responses by keywords */
- else if(str.at(0) == '?'){
- QString query = str.mid(1);
- showKitaNaviByWord(query);
- return;
+ else if(str.at(0) == '?')
+ {
+ QString query = str.mid(1);
+ showKitaNaviByWord(query);
+ return;
}
/* if this is parent, then show all responses, and search */
- if ( m_viewmode == VIEWMODE_PARENT ) {
+ if ( m_viewmode == VIEWMODE_PARENT )
+ {
int top = m_domtree->getTopResNumber();
int bottom = m_domtree->getBottomResNumber();
int totalNum = m_domtree->getMaxResNumber();
- if ( top != 1 || bottom != totalNum ) {
+ if ( top != 1 || bottom != totalNum )
+ {
appendRes( 1, totalNum );
}
}
void KitaThreadView::slotComboActivated( int index )
{
- if ( index == gotoCombo->count() - 1 ) {
+ if ( index == gotoCombo->count() - 1 )
+ {
// last
gotoAnchor( "footer" );
- } else if ( index == 1 ) {
+ }
+ else if ( index == 1 )
+ {
// kokomade yonda
gotoAnchor( "kokomade_yonda" );
- } else if ( index != 0 ) {
+ }
+ else if ( index != 0 )
+ {
QString numText = gotoCombo->text( index );
numText.truncate( numText.length() - 1 );
gotoAnchor( numText );
GobackAnchorButton->setEnabled( FALSE );
BookmarkButton->setEnabled( FALSE );
- switch( m_viewmode ){
+ switch( m_viewmode )
+ {
case VIEWMODE_PREVIEW:
- writeButton->setEnabled( FALSE );
+ writeButton->setEnabled( FALSE );
SearchCombo->setEnabled( FALSE );
SearchButton->setEnabled( FALSE );
HighLightButton->setEnabled( FALSE );
- ReloadButton->setEnabled( FALSE );
- break;
+ ReloadButton->setEnabled( FALSE );
+ break;
case VIEWMODE_KITANAVI:
- writeButton->setEnabled( TRUE );
- ReloadButton->setEnabled( TRUE );
- break;
+ writeButton->setEnabled( TRUE );
+ ReloadButton->setEnabled( TRUE );
+ break;
}
-
+
if ( cmbstr != NULL ) SearchCombo->insertItem( cmbstr );
if ( anchor != NULL ) gotoAnchor( anchor );
/*-----------------------*/
/* show Kita Navi */
/*-----------------------*/ /* private */
-void KitaThreadView::showKitaNavi(int startnum, int endnum){
-
+void KitaThreadView::showKitaNavi(int startnum, int endnum)
+{
hidePopup();
KitaNavi* kitanavi;
-
+
if(!(kitanavi = KitaNavi::getKitaNavi())) return;
-
+
kitanavi->addTab(KITANAVI_SHOWRES,m_thread,m_serverTime,QString::null,startnum,endnum);
}
/*-------------------------------*/
/* extract ID & show Kita Navi */
/*-------------------------------*/ /* private */
-void KitaThreadView::showKitaNaviByID(QString strid){
-
+void KitaThreadView::showKitaNaviByID(QString strid)
+{
hidePopup();
KitaNavi* kitanavi;
/*--------------------------------------*/
/* extract by keywords & show kita navi */
-/*--------------------------------------*/
- /* called from KitaHTMLPart::slotPopupMenu */ /* public */
-void KitaThreadView::showKitaNaviByWord(QString query){
-
+/*--------------------------------------*/
+/* called from KitaHTMLPart::slotPopupMenu */ /* public */
+void KitaThreadView::showKitaNaviByWord(QString query)
+{
hidePopup();
KitaNavi* kitanavi;
if(!(kitanavi = KitaNavi::getKitaNavi())) return;
-
- kitanavi->addTab(KITANAVI_EXTBYWORD,m_thread,m_serverTime,query,0,0);
+
+ kitanavi->addTab(KITANAVI_EXTBYWORD,m_thread,m_serverTime,query,0,0);
}
/*--------------------------------------*/
/* show res tree on the kitanavi */
/*--------------------------------------*/ /* private */
-void KitaThreadView::showKitaNaviResTree(int resNum){
-
+void KitaThreadView::showKitaNaviResTree(int resNum)
+{
hidePopup();
KitaNavi* kitanavi;
-
+
if(!(kitanavi = KitaNavi::getKitaNavi())) return;
int num;
QString htmlstr =
- Kita::DatManager::getTreeByRes(m_thread->datURL(),resNum,num);
+ Kita::DatManager::getTreeByRes(m_thread->datURL(),resNum,num);
if ( !num ) return ;
-
+
kitanavi->addTab(KITANAVI_SHOWRESTREE,m_thread,m_serverTime,htmlstr,resNum,num);
}