/* direct rendering functions */
-/*-----------------*/
-/* show responses */
-
-/* !!! don't forget to call updateScreen() later !!! */ /* public */
-void KitaPreviewPart::showResponses( int startnum, int endnum )
-{
- if ( !m_domtree ) return ;
-
- for ( int i = startnum ; i <= endnum; i++ ) m_domtree->appendRes( i );
-}
-
-/*-------------------*/
-/* update screen */ /* public */
-void KitaPreviewPart::updateScreen( bool showHeaderEtc, bool clock )
-{
- if ( !m_domtree ) {
- view() ->setFocus();
- return ;
- }
-
- /* show clock cursor */
- if ( clock ) {
- QCursor qc; qc.setShape( Qt::WaitCursor );
- QApplication::setOverrideCursor( qc );
- }
-
- /* show header, footer, and kokomadeyonda, etc. */
- if ( showHeaderEtc ) {
- m_domtree->appendKokoyon();
- m_domtree->appendFooterAndHeader();
- }
-
- /* update display */
- htmlDocument().applyChanges();
- view() ->layout();
- view() ->setVScrollBarMode( QScrollView::AlwaysOn );
- view() ->setFocus();
-
- if ( clock ) QApplication::restoreOverrideCursor();
-}
-
-
/* public */
void KitaPreviewPart::setInnerHTML( const QString& innerHTML )
{
/*---------------------------------------------------------------*/
/*---------------------------------------------------------------*/
-/* goto anchor */
-
-
-/* public */
-bool KitaPreviewPart::gotoAnchor( const QString& anc, bool pushPosition )
-{
- if ( anc == QString::null ) return FALSE;
- if ( !m_domtree )
- return KHTMLPart::gotoAnchor( anc );
-
- hidePopup();
-
- QString ancstr = anc;
- int res = ancstr.toInt();
-
- if ( res > 1 ) {
-
- /* is target valid ? */
- if ( !Kita::DatManager::isResValid( m_datURL, res ) ) return FALSE;
-
- ancstr = QString().setNum( res );
- }
-
- if ( res == 1 ) ancstr = "header";
- if ( pushPosition ) pushCurrentPosition();
-
- /* KHTMLPart::gotoAnchor() will fail if the thread is not shown. */
- /* So KHTMLPart::gotoAnchor() should be called via custom event. */
- /* See also KitaPreviewPart::customEvent() */
- GotoAnchorEvent * e = new GotoAnchorEvent( ancstr );
- QApplication::postEvent( this, e ); // Qt will delete it when done
-
- return TRUE;
-}
-
-/* private */
-void KitaPreviewPart::pushCurrentPosition()
-{
- m_anchorStack += getCurrentIDofNode();
-}
-
-
-/* find the id of current node */ /* private */
-QString KitaPreviewPart::getCurrentIDofNode()
-{
- DOM::Node node;
- node = nodeUnderMouse();
- while ( node != NULL && node.nodeName().string() != "div" ) node = node.parentNode();
- if ( node == NULL ) return QString::null;
-
- return static_cast<DOM::Element>( node ).getAttribute( "id" ).string();
-}
-
-/*---------------------------------------------------------------*/
-/*---------------------------------------------------------------*/
/* search */
/* cache */
- bool m_firstReceive;
int m_centerNum;
/* goto anchor */
bool setup( int mode , const KURL& url );
/* rendering */
- void showResponses( int startnum, int endnum );
- void updateScreen( bool showHeaderEtc, bool clock );
void setInnerHTML( const QString& innerHTML );
- /* goto anchor */
- bool gotoAnchor( const QString& anc, bool pushPosition );
-
public slots:
/* rendering */
void connectSignals();
void createHTMLDocument();
- /* goto anchor */
- void pushCurrentPosition();
- QString getCurrentIDofNode();
-
/* popup menu */
void showPopupMenu( const KURL& kurl );