+2004-05-08 Hideki Ikemoto <ikemo@users.sourceforge.jp>
+
+ * ID popup. thanks >>421
+
2004-05-07 Hideki Ikemoto <ikemo@users.sourceforge.jp>
* fix: empty favorites if board is reloaded.
#include "comment.h"
#include "access.h"
#include "../part/kitaconfig.h"
+#include "../part/kita-utf8.h"
#include <qregexp.h>
#include <qsemaphore.h>
using namespace Kita;
+/* UTF-16 */
+#define UTF16_BRACKET 0xFF1E /* > */
+#define UTF16_0 0xFF10 /* 0 */
+#define UTF16_9 0xFF19 /* 9 */
+#define UTF16_EQ 0xFF1D /* = */
+#define UTF16_COMMA 0xFF0C /* , */
+
+#define KITA_RESDIGIT 4
+
/*---------------------------------------------------*/
/* DatInfo stores information of *.dat */
m_linedat.clear();
m_subject = QString::null;
m_maxNum = 0;
+ m_spacestr = QString::null;
+ m_anclistmap.clear();
if ( rawdata.length() ) {
QCp932Codec codec;
return *( m_idlist.at( num - 1 ) );
}
+/* convert dat to HTML */
+QString DatInfo::getHtml(int num){
+
+ QString retstr = QString::null;
+ QString line = getDat(num);
+ bool showAddr = KitaConfig::showMailAddress();
+
+ if(line != QString::null){
+
+ Kita::Comment comment( line );
+
+ /* check abone */
+ if(DatManager::checkAbone(getId(num),ABONECHK_BY_ID)) return retstr;
+ if(DatManager::checkAbone(comment.getName(),ABONECHK_BY_NAME)) return retstr;
+ if(DatManager::checkAbone(comment.getBody(),ABONECHK_BY_WORD)) return retstr;
+
+ retstr = comment.toHtml( num, showAddr );
+ }
+
+ return retstr;
+}
+
+
+/* Check if No.num has anchors to No.target */
+/* For exsample, if No.num has an anchor ">>target",
+ then return TRUE. */
+bool DatInfo::checkRes(const int target, const int num )
+{
+ AncList anclist;
+ AncListMap::Iterator ancmapit = m_anclistmap.find(num);
+
+ /* If map is not set, then do parsing */
+ if(ancmapit == m_anclistmap.end() ){
+
+ QString line = getDat(num);
+ if(line == QString::null) return FALSE;
+
+ ANCNUM anctmp;
+ QString linkstr;
+ int refNum[2];
+ unsigned int pos;
+
+ /* dummy */
+ anclist.clear();
+ anctmp.from = 0;
+ anctmp.to = 0;
+ anclist += anctmp;
+
+ /* remove HTML tags */
+ QRegExp rex( "<[^>]*>" );
+ line.remove(rex);
+
+ const QChar *chpt = line.unicode();
+ unsigned int i;
+ unsigned int length = line.length();
+
+ for ( i = 0 ; i < length ; i++ ) {
+
+ if( chpt[ i ].unicode() == UTF16_BRACKET ||
+ (chpt[ i] == '&' && chpt[ i+1] == 'g' && chpt[ i+2] == 't' && chpt[ i+3] == ';')){
+
+ while(DatManager::parseResAnchor(chpt+i,length-i,linkstr,refNum,pos)){
+ if(refNum[1] < refNum[0]) refNum[1] = refNum[0];
+ anctmp.from = refNum[0];
+ anctmp.to = refNum[1];
+ anclist += anctmp;
+ i += pos;
+ }
+
+ i += (pos-1);
+ }
+ }
+
+ ancmapit = m_anclistmap.insert(num,anclist);
+ }
+ /* end parsing */
+
+ for ( AncList::iterator it = (*ancmapit).begin(); it != (*ancmapit).end(); ++it ){
+ if ( target >= (*it).from && target <= (*it).to ) return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/* Get HTML document of res tree.*/
+/* For example,
+
+>>1
+|-->>4
+| |--->>10
+|
+|-->>20
+
+*/
+QString DatInfo::getTreeByRes(const int rootnum, int& num, QString prestr )
+{
+ QString retstr = QString::null ;
+ num = 0;
+ int maxNum = getMaxResNumber();
+ QStringList strlists;
+
+ if(m_spacestr == QString::null){
+ QTextCodec * codec = QTextCodec::codecForName( "utf8" );
+ m_spacestr = ". ";
+ m_framestr1 = codec->toUnicode( KITAUTF8_FRAME1 ); /* | */
+ m_framestr2 = codec->toUnicode( KITAUTF8_FRAME2 ); /* |- */
+ m_framestr3 = codec->toUnicode( KITAUTF8_FRAME3 ); /* L */
+ }
+
+ /* find responses that refer to rootnum */
+ for ( int i = rootnum+1; i <= maxNum; i++ ){
+ if(checkRes(rootnum,i)){
+ num ++;
+ strlists += QString().setNum( i );
+ }
+ }
+
+ /* make HTML document */
+ if(num){
+
+ for ( QStringList::iterator it = strlists.begin(); it != strlists.end(); ++it ){
+ QString tmpstr;
+ if((*it) == strlists.last()) tmpstr = m_framestr3;
+ else tmpstr = m_framestr2;
+ retstr += prestr + tmpstr + "<a href=\"#" + (*it) + "\">>>" + (*it) + "</a><br>";
+
+ /* call myself recursively */
+ if((*it) == strlists.last()) tmpstr = prestr + m_spacestr + m_spacestr + m_spacestr;
+ else tmpstr = prestr + m_framestr1 + m_spacestr;
+ int tmpnum;
+ retstr += getTreeByRes((*it).toInt(),tmpnum,tmpstr);
+ num += tmpnum;
+ }
+ }
+
+ return retstr;
+}
+
/*---------------------------------------------------*/
-/* DatManager manages *.dat. */
-/* Call
- Kita::DatManager::getHtml ,or
- Kita::DatManager::getDat
- in order to obtain data. */
+/* DatManager manages all information about *.dat. */
DatInfoList DatManager::m_datInfo;
QSemaphore DatManager::m_semap( 1 );
/* public */
-int DatManager::getNumByID( const KURL& url, QString strid )
+int DatManager::getNumByID( const KURL& url, const QString& strid )
{
DatInfo * datInfo = getDatInfo( url );
if ( datInfo == NULL ) return QString::null;
QString retstr = QString::null ;
- bool showAddr = KitaConfig::showMailAddress();
-
- for ( int num = startnum; num <= endnum; num++ ) {
-
- QString line = datInfo->getDat( num );
-
- if ( line != QString::null ) {
- Kita::Comment comment( line );
-
- /* check abone */
- if ( checkAbone( datInfo->getId( num ), ABONECHK_BY_ID ) ) continue;
- if ( checkAbone( comment.getName(), ABONECHK_BY_NAME ) ) continue;
- if ( checkAbone( comment.getBody(), ABONECHK_BY_WORD ) ) continue;
-
- retstr += comment.toHtml( num, showAddr );
- }
- }
+ for(int num = startnum; num <= endnum; num++)
+ retstr += datInfo->getHtml(num);
return retstr;
}
return FALSE;
}
+
+
+/* public */
+QString DatManager::getHtmlByID(const KURL& url, const QString& strid, int &num ){
+
+ DatInfo* datInfo = getDatInfo(url);
+ if(datInfo == NULL) return QString::null;
+
+ QString retstr = QString::null ;
+ num = 0;
+ int maxNum = datInfo->getMaxResNumber();
+
+ for ( int i = 1; i <= maxNum; i++ ) {
+ if(datInfo->getId(i) == strid){
+ num ++;
+ retstr += datInfo->getHtml(i);
+ }
+ }
+
+ return retstr;
+}
+
+
+/* public */
+bool DatManager::checkID(const KURL& url, const QString& strid, int num ){
+
+ DatInfo* datInfo = getDatInfo(url);
+ if(datInfo == NULL) return FALSE;
+
+ if(datInfo->getId(num) == strid) return TRUE;
+
+ return FALSE;
+}
+
+
+/* check keywords */ /* public */
+bool DatManager::checkWord(const KURL& url,
+ QStringList& stlist, int num,
+ bool checkOR /* AND or OR search */
+ )
+{
+ DatInfo* datInfo = getDatInfo(url);
+ if(datInfo == NULL) return FALSE;
+
+ QString str_text = datInfo->getDat(num);
+ if(str_text == QString::null) return FALSE;
+
+ for ( QStringList::iterator it = stlist.begin(); it != stlist.end(); ++it ) {
+
+ if ( checkOR ) { /* OR */
+ if ( str_text.find( ( *it ), 0, FALSE ) != -1 ) {
+ return TRUE;
+ }
+ } else { /* AND */
+ if ( str_text.find( ( *it ), 0, FALSE ) == -1 ) return FALSE;
+ }
+ }
+
+ if ( checkOR ) return FALSE;
+
+ return TRUE;
+}
+
+
+/*------------------------------------------*/
+/* parsing function for anchor (>>number) */
+/*------------------------------------------*/ /* public */
+
+/* This fuction parses res-anchor.
+
+ For example, if cdat = ">12-20", then
+
+ linkstr = ">12-20",
+ refNum[0] = 12,
+ refNum[1] = 20,
+ pos = 9.
+
+ This function is also called in KitaDomTree::createResAnchor. */
+
+bool DatManager::parseResAnchor(
+
+ /* input */
+ const QChar *cdat, const unsigned int length,
+
+ /* output */
+ QString& linkstr, int* refNum, unsigned int& pos ){
+
+ struct LocalFunc {
+ static bool isHYPHEN( unsigned short c )
+ {
+
+ /* UTF-16 */
+ if ( c == '-'
+ || ( c >= 0x2010 && c <= 0x2015 )
+ || ( c == 0x2212 )
+ || ( c == 0xFF0D ) /* UTF8: 0xEFBC8D */
+ ) {
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+ };
+
+ bool ret = FALSE;
+ int i;
+
+ linkstr = QString::null;
+ refNum[0] = 0;
+ refNum[1] = 0;
+ pos = 0;
+
+ /* check '>' twice */
+ for ( i = 0;i < 2;i++ ) {
+
+ if ( cdat[ pos ].unicode() == UTF16_BRACKET ) {
+ linkstr += cdat[ pos ];
+ pos++;
+ } else if ( cdat[ pos ] == '&' && cdat[ pos + 1 ] == 'g' /* > */
+ && cdat[ pos + 2 ] == 't' && cdat[ pos + 3 ] == ';' ) {
+ linkstr += ">";
+ pos += 4;
+ }
+
+ }
+
+ /* check ',' */
+ if ( !pos ) {
+ if ( cdat[ pos ] == ',' || cdat[ pos ].unicode() == UTF16_COMMA ) {
+ linkstr += ",";
+ pos ++;
+ }
+ }
+
+ /* check '=' */
+ if ( !pos ) {
+ if ( cdat[ pos ] == '=' || cdat[ pos ].unicode() == UTF16_EQ ) {
+ linkstr += "=";
+ pos ++;
+ }
+ }
+
+ /* check numbers */
+ int hyphen = 0;
+
+ if( pos ){
+
+ for ( i = 0 ; i < KITA_RESDIGIT + 1 && pos < length ; i++, pos++, ret = TRUE ) {
+
+ unsigned short c = cdat[ pos ].unicode();
+
+ if ( ( c < UTF16_0 || c > UTF16_9 )
+ && ( c < '0' || c > '9' )
+ && ( !LocalFunc::isHYPHEN( c )
+ || ( i == 0 && LocalFunc::isHYPHEN( c ) )
+ || ( hyphen && LocalFunc::isHYPHEN( c ) ) )
+ ) break;
+
+ linkstr += cdat[ pos ];
+
+ if ( LocalFunc::isHYPHEN( c ) ) {
+ hyphen = 1;
+ i = -1;
+ } else {
+ if ( c >= UTF16_0 ) c = '0' + cdat[ pos ].unicode() - UTF16_0;
+ refNum[hyphen] *= 10;
+ refNum[hyphen] += c - '0';
+ }
+ }
+ }
+
+ return ret;
+}
+
+/* public */
+bool DatManager::checkRes(const KURL& url,const int target,const int num )
+{
+ DatInfo* datInfo = getDatInfo(url);
+ if(datInfo == NULL) return FALSE;
+
+ return datInfo->checkRes(target,num);
+}
+
+
+/* public */
+QString DatManager::getTreeByRes(const KURL& url, const int resNum, int &num ){
+
+ DatInfo* datInfo = getDatInfo(url);
+ if(datInfo == NULL) return QString::null;
+
+ QString retstr = QString::null ;
+ num = 0;
+
+ QString tmp = QString().setNum( resNum );
+ retstr = "<a href=\"#" + tmp + "\">>>" + tmp + "</a><br>";
+ retstr += datInfo->getTreeByRes(resNum,num,"");
+
+ return retstr;
+}
+
#include <qstringlist.h>
#include <kurl.h>
+#include <qmap.h>
class QSemaphore;
ABONECHK_BY_WORD
};
+/* Database for anchor information */
+/* For example, 5-th res has anchors >>2-3 and >>4, then,
+
+ m_anclistmap[5].at(0).from = 2,
+ m_anclistmap[5].at(0).to = 3,
+ m_anclistmap[5].at(1).from = 4,
+ m_anclistmap[5].at(1).from = 4.
+
+*/
+struct ANCNUM{
+ int from;
+ int to;
+};
+typedef QValueList<ANCNUM> AncList;
+typedef QMap<int,AncList> AncListMap;
+
/*-----------------------*/
class DatInfo
QString m_subject;
QStringList m_linedat;
QStringList m_idlist;
+ AncListMap m_anclistmap;
+ QString m_spacestr;
+ QString m_framestr1; /* '|' */
+ QString m_framestr2; /* '|-' */
+ QString m_framestr3; /* 'L' */
+
public:
DatInfo();
DatInfo( const KURL& url );
const QString& getSubject() { return m_subject;}
KURL& url() { return m_url;};
int getMaxResNumber() { return m_maxNum;}
+ QString getHtml(int num);
+ bool checkRes(const int target, const int num );
+ QString getTreeByRes(const int rootnum, int& num, QString prestr );
};
/*-----------------------*/
static const QString& getDat( const KURL& url, int num );
static const QString& getSubject( const KURL& url );
static QString getHtml( const KURL& url, int startnum, int endnum );
- static int getNumByID( const KURL& url, QString strid );
static int getMaxResNumber( const KURL& url );
+ static int getNumByID(const KURL& url, const QString& strid );
+ static QString getHtmlByID(const KURL& url, const QString& strid, int &num );
+ static QString getTreeByRes(const KURL& url, const int resNum, int &num );
+ static bool checkID(const KURL& url, const QString& strid, int num );
+ static bool checkWord(const KURL& url,QStringList& stlist, int num, bool checkOR);
+ static bool checkRes(const KURL& url, const int target,const int num );
static bool checkAbone( const QString& str, int mode );
-
+ static bool parseResAnchor(const QChar *cdat,const unsigned int length,QString& linkstr,int* refNum,unsigned int& pos);
private:
static DatInfo* getDatInfo( const KURL& url );
};
#define KITAUTF8_MAE100 "前100"
#define KITAUTF8_SAIGO "最後"
#define KITAUTF8_KOWARE "ここは壊れています。"
+#define KITAUTF8_FRAME1 "│"
+#define KITAUTF8_FRAME2 "├"
+#define KITAUTF8_FRAME3 "└"
#define KITAUTF8_HEART "♥"
#define KITAUTF8_DIA "♦"
#include "kitaconfig.h"
#include "kitadomtree.h"
#include "kitathreadview.h"
+#include "libkita/datmanager.h"
/* UTF-16 */
#define KITADOM_BRACKET 0xFF1E /* > */
const QChar *chpt = str.unicode();
QString replacestr;
QTextCodec *codec = QTextCodec::codecForName( "utf-8" );
-
+ bool bBodyisA = ( bodynode.nodeName().string() == "a" );
+
DOM::Element tmpelm;
m_linestr = "";
index = tail + 1;
i = index;
- while ( createResAnchor( bodynode, str, chpt, i, index ) );
+ while ( createResAnchor( bodynode, str, chpt, i, index,bBodyisA ) );
}
break;
i2 = 0;
if ( LocalFunc::isEqual( chpt + i + 1, "gt;", 4 ) )
- while ( createResAnchor( bodynode, str, chpt, i, index ) );
+ while ( createResAnchor( bodynode, str, chpt, i, index,bBodyisA ) );
else if ( ( i2 = LocalFunc::isEqual( chpt + i + 1, "lt;", 4 ) ) )
replacestr = "<";
/* unicode '>' */
case KITADOM_BRACKET:
- while ( createResAnchor( bodynode, str, chpt, i, index ) );
+ while ( createResAnchor( bodynode, str, chpt, i, index,bBodyisA ) );
break;
}
}
/*---------------------------------*/
bool KitaDomTree::createResAnchor(
DOM::Element &bodynode, QString &str, const QChar *chpt,
- unsigned int &i, unsigned int &index )
+ unsigned int &i, unsigned int &index, bool bBodyisA )
{
-
- struct LocalFunc {
- static bool isHYPHEN( unsigned short c )
- {
-
- /* UTF-16 */
- if ( c == '-'
- || ( c >= 0x2010 && c <= 0x2015 )
- || ( c == 0x2212 )
- || ( c == 0xFF0D ) /* UTF8: 0xEFBC8D */
- ) {
- return TRUE;
- }
-
- return FALSE;
- }
- };
-
- unsigned int newi;
- unsigned int strlng = str.length();
- int i2, i3;
- QString qstrlink = "";
- char strlink[ KITADOM_RESDIGIT + 1 ];
- DOM::Element tmpelm;
- bool bCreateNode = FALSE;
- bool bBodyisA = ( bodynode.nodeName().string() == "a" );
-
- newi = i;
-
- /* check '>' twice */
- for ( i2 = 0;i2 < 2;i2++ ) {
- if ( chpt[ newi ].unicode() == KITADOM_BRACKET ) {
- qstrlink += chpt[ newi ];
- newi++;
- } else if ( chpt[ newi ] == '&' && chpt[ newi + 1 ] == 'g' /* > */
- && chpt[ newi + 2 ] == 't' && chpt[ newi + 3 ] == ';' ) {
- qstrlink += ">";
- bCreateNode = TRUE;
- newi += 4;
- }
- }
-
- /* check ',' */
- if ( i == newi ) {
- if ( chpt[ newi ] == ',' || chpt[ newi ].unicode() == KITADOM_COMMA ) {
- qstrlink += ",";
- newi ++;
- }
- }
-
- /* check '=' */
- if ( i == newi ) {
- if ( chpt[ newi ] == '=' || chpt[ newi ].unicode() == KITADOM_EQ ) {
- qstrlink += "=";
- newi ++;
- }
- }
-
- if ( i == newi ) {
- index = newi;
- i--;
- return FALSE;
- }
-
- /* check numbers */
- bool hyphen = FALSE;
- for ( i2 = 0 , i3 = 0; i2 < KITADOM_RESDIGIT + 1 && newi + i3 < strlng ;i2++, i3++ ) {
-
- unsigned short c = chpt[ newi + i3 ].unicode();
-
- if ( ( c < KITADOM_0 || c > KITADOM_9 )
- && ( c < '0' || c > '9' )
- && ( !LocalFunc::isHYPHEN( c )
- || ( i2 == 0 && LocalFunc::isHYPHEN( c ) )
- || ( hyphen && LocalFunc::isHYPHEN( c ) ) )
- ) break;
-
- qstrlink += chpt[ newi + i3 ];
- if ( LocalFunc::isHYPHEN( c ) ) {
- strlink[ i3 ] = '-';
- hyphen = TRUE;
- i2 = -1;
- } else if ( c >= KITADOM_0 )
- strlink[ i3 ] = '0' + chpt[ newi + i3 ].unicode() - KITADOM_0;
- else strlink[ i3 ] = c;
- }
-
- strlink[ i3 ] = '\0';
-
- if ( i3 == 0
- || bBodyisA ) { /* If body element is A, return here */
-
- if ( bCreateNode ) { /* replace > with '>' without link */
- m_linestr += str.mid( index, i - index ) + qstrlink;
- index = newi + i3;
- i = index - 1;
- }
-
- return FALSE;
+ QString linkstr;
+ int refNum[2];
+ unsigned int pos;
+ unsigned int length = str.length();
+
+ bool ret = Kita::DatManager::parseResAnchor(chpt+i,length-i,linkstr,refNum,pos);
+
+ if ( !ret || bBodyisA ) { /* If body element is A, return here */
+ m_linestr += str.mid( index, i - index ) + linkstr;
+ index = i + pos;
+ i = index - 1;
+ return FALSE;
}
/* create 'A' element */
m_linestr += str.mid( index, i - index );
bodynode.appendChild( m_hdoc.createTextNode( m_linestr ) );
m_linestr = "";
-
- tmpelm = bodynode.appendChild( m_hdoc.createElement( "A" ) );
+
+ DOM::Element tmpelm = bodynode.appendChild( m_hdoc.createElement( "A" ) );
{
- tmpelm.setAttribute( "href", "#" + QString( strlink ) );
- tmpelm.appendChild( m_hdoc.createTextNode( qstrlink ) );
+ QString tmp = QString("#%1").arg(refNum[0]);
+ if(refNum[1]) tmp += QString("-%1").arg(refNum[1]);
+
+ tmpelm.setAttribute( "href", tmp );
+ tmpelm.appendChild( m_hdoc.createTextNode( linkstr ) );
}
- index = newi + i3;
+ index = i + pos;
i = index; /* call this function again, so, don't set i = index-1 here ! */
return TRUE;
void appendColoredTextNode( DOM::Element &root, QString str, QString style );
bool createResAnchor(
DOM::Element &bodynode, QString &str, const QChar *chpt,
- unsigned int &i, unsigned int &index );
+ unsigned int &i, unsigned int &index, bool bBodyisA );
/* copied from comment.cpp */
void parseDateId( const QString& str ,
{
m_pushctrl = FALSE;
m_pushmidbt = FALSE;
+ m_pushrightbt = FALSE;
+ /* cancel popup */
+ if(e->qmouseEvent()->button() & Qt::RightButton){
+ m_pushrightbt = TRUE;
+ return;
+ }
+
/* check if ctrl key is pushed */
if ( e->url() != NULL ) {
if ( m_pushctrl || m_pushmidbt ) {
KURL kurl;
if ( e->url().string().at( 0 ) == '#' ) {
- kurl = KURL( m_thread->datURL(), e->url().string() );
+ kurl = m_thread->datURL() + e->url().string();
} else {
kurl = KURL( m_thread->boardURL(), e->url().string() );
}
void KitaHTMLPart::khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *e )
{
if ( e->qmouseEvent() ->button() & Qt::RightButton ) {
+ /* popup */
+ if ( e->url().string().left(6) == "#idpop" ||
+ (m_pushrightbt && e->url().string().left(6) == "#write" )) {
+ KURL kurl;
+ kurl = m_thread->datURL() + e->url().string();
+ emit browserExtension() ->openURLRequest( kurl );
+ return ;
+ }
/* popup here & return */
slotPopupMenu( e->url().string(), e->qmouseEvent() ->globalPos() );
KPopupMenu* m_popupMenu;
bool m_pushctrl;
bool m_pushmidbt;
+ bool m_pushrightbt;
KitaDomTree* m_domtree;
KitaThreadView* m_threadView;
Kita::Thread* m_thread;
void setupEx( KitaThreadView* threadView, KitaDomTree* domtree,
Kita::Thread* thread );
void gotoKokoyon();
+ bool isCtrlClick(){return m_pushctrl;}
+ bool isMidClick(){return m_pushmidbt;}
+ bool isRightClick(){return m_pushrightbt;}
protected:
virtual void khtmlMousePressEvent( khtml::MousePressEvent* e );
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;
+ }
KPopupMenu *popupMenu = new KPopupMenu( m_threadPart->view() );
popupMenu->clear();
return ;
}
- if ( m_viewmode != VIEWMODE_PARENT ) return ;
+ /*----------------------------*/
+ /* extract responses by ID */
+
+ if(datURL.ref().left(5) == "idpop"){
+
+ QString strid = datURL.ref().mid(5);
+
+ /* 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 );
+ }
+ return;
+ }
+
/*----------------------------*/
/* next 100 ,before 100 ,etc. */
/*-----------------------------------------*/
void KitaThreadView::showStatusBar( QString info )
{
- if ( m_viewmode != VIEWMODE_PARENT ) return ;
+ int prevNum = 0;
+ int totalNum = 0;
+ bool broken = FALSE;
+ QString infostr = QString::null;
+ QString errstr = QString::null;
+
+ switch( m_viewmode ){
- int prevNum = m_domtree->getKokoyonNum();
- int totalNum = m_domtree->getMaxResNumber();
- bool broken = m_domtree->isBroken();
+ case VIEWMODE_PARENT:
- QString errstr = QString::null;
+ prevNum = m_domtree->getKokoyonNum();
+ totalNum = m_domtree->getMaxResNumber();
+ broken = m_domtree->isBroken();
+
+ errstr = QString::null;
if ( m_rescode != 200 && m_rescode != 206 )
errstr = QString( "Error %1" ).arg( m_rescode );
if ( broken ) info += " This thread is broken.";
if ( totalNum ) {
/* show status bar */
- QString infostr = m_thread->name() +
+ infostr = m_thread->name() +
QString( " [Total: %1 New: %2]" ).arg( totalNum ).arg( totalNum - prevNum )
+ info + " " + errstr;
emit signalChangeStatusbar( errstr );
topLevelWidget() ->setCaption( "" );
}
+ return;
+ break;
+
+ case VIEWMODE_KITANAVI:
+
+ QString infostr = QString( "[%1] %2" ).arg(m_thread->boardName()).arg( m_thread->name() );
+ emit signalChangeStatusbar( infostr );
+
+ return;
+ break;
+ }
}
m_threadPart->view() ->setFocus();
GobackAnchorButton->setEnabled( FALSE );
- writeButton->setEnabled( FALSE );
BookmarkButton->setEnabled( FALSE );
- ReloadButton->setEnabled( FALSE );
- if ( m_viewmode == VIEWMODE_PREVIEW ) {
+ switch( m_viewmode ){
+
+ case VIEWMODE_PREVIEW:
+ writeButton->setEnabled( FALSE );
SearchCombo->setEnabled( FALSE );
SearchButton->setEnabled( FALSE );
HighLightButton->setEnabled( FALSE );
- }
+ ReloadButton->setEnabled( FALSE );
+ break;
+ case VIEWMODE_KITANAVI:
+ writeButton->setEnabled( TRUE );
+ ReloadButton->setEnabled( TRUE );
+ break;
+ }
+
if ( cmbstr != NULL ) SearchCombo->insertItem( cmbstr );
if ( anchor != NULL ) gotoAnchor( anchor );
+
+ showStatusBar( "" );
}