OSDN Git Service

remove useless code.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Tue, 19 Jun 2007 13:43:20 +0000 (13:43 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Tue, 19 Jun 2007 13:43:20 +0000 (13:43 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1977 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/thread/popuppart.cpp

index 851d2e7..3998435 100644 (file)
@@ -76,12 +76,6 @@ void KitaPopupPart::clearPart()
     m_domtree = NULL;
 
     /* update ViewPos */
-    if ( m_mode == POPUPPART_MODE_MAINPART && !m_updatedKokoyon && !m_datURL.isEmpty() ) {
-        int readNum = Kita::DatManager::getReadNum( m_datURL );
-        if ( readNum ) {
-            Kita::DatManager::setViewPos( m_datURL, readNum );
-        }
-    }
     m_updatedKokoyon = FALSE;
 
     /* clear variables */
@@ -94,18 +88,6 @@ void KitaPopupPart::clearPart()
 
         /* don't forget to unlock previous datURL here. */
         Kita::DatManager::unlock( m_datURL );
-
-        if ( m_mode == POPUPPART_MODE_MAINPART ) { /* This part is on the main thread view. */
-
-            /* tell Thread class that "thread is closed" */
-            Kita::DatManager::setMainThreadOpened( m_datURL, FALSE );
-
-            /* emit "deactivated all thread view" SIGNAL */
-            emit activateThreadView( QString::null );
-
-            /*  update subject tab. */
-            emit updateSubjectTab( m_datURL );
-        }
     }
     m_datURL = QString::null;
     m_mode = POPUPPART_MODE_KHTML;
@@ -123,32 +105,12 @@ bool KitaPopupPart::setup( int mode, const KURL& url )
     m_datURL = Kita::getDatURL( url );
     m_mode = mode;
 
-    if ( m_mode == POPUPPART_MODE_MAINPART ) { /* This part is on the main thread view. */
-
-        /* create DatInfo explicitly to open new thread.   */
-        /* Usually, DatInfo is NOT created if ReadNum == 0.*/
-        /* See also DatManager::createDatInfo() and        */
-        /*          DatManager::getDatInfo().              */
-        Kita::DatManager::createDatInfo( m_datURL );
-
-        /* tell Thread class that "thread is opend" */
-        Kita::DatManager::setMainThreadOpened( m_datURL, TRUE );
-
-        /* reset abone */
-        Kita::DatManager::resetAbone( m_datURL );
-    }
-
     /* Lock datURL. Don't forget to unlock it later ! */
     Kita::DatManager::lock ( m_datURL );
 
     /* create HTML Document */
     createHTMLDocument();
 
-    /* create DOM manager */
-    if ( m_mode == POPUPPART_MODE_MAINPART ) {
-        m_domtree = new KitaDomTree( htmlDocument(), m_datURL );
-    }
-
     return TRUE;
 }
 
@@ -303,12 +265,6 @@ void KitaPopupPart::updateScreen( bool showHeaderEtc, bool clock )
         m_domtree->appendFooterAndHeader();
     }
 
-    /* change color of number of the res which is responsed. */
-    if ( m_mode == POPUPPART_MODE_MAINPART ) {
-
-        if ( Kita::Config::checkResponsed() ) m_domtree->changeColorOfAllResponsedNumber();
-    }
-
     /*----------------------------*/
 
     /* update display */
@@ -409,17 +365,7 @@ bool KitaPopupPart::load( int centerNum )
     m_centerNum = centerNum;
     m_jumpNumAfterLoading = 0;
 
-    if ( m_mode != POPUPPART_MODE_MAINPART ) return FALSE;
-    if ( !m_domtree ) return FALSE;
-    if ( Kita::DatManager::getReadNum( m_datURL ) == 0 ) return FALSE;
-
-    int endNum = Kita::DatManager::getReadNum( m_datURL );
-    showResponses( 1, endNum );
-    updateScreen( TRUE , FALSE );
-    gotoAnchor( QString().setNum( m_centerNum ), FALSE );
-    view() ->setFocus();
-
-    return TRUE;
+    return FALSE;
 }
 
 
@@ -432,21 +378,10 @@ bool KitaPopupPart::load( int centerNum )
 bool KitaPopupPart::reload( int jumpNum )
 {
     if ( !m_domtree ) return FALSE;
-    if ( m_mode != POPUPPART_MODE_MAINPART ) {
-        /* If this is not MainPart, then open MainPart.  */
-        emit openURLRequestExt( m_datURL );
-        return FALSE;
-    }
 
-    m_firstReceive = TRUE;
-    if ( m_centerNum == 0 ) m_centerNum = m_domtree->getBottomResNumber();
-    m_jumpNumAfterLoading = jumpNum;
-
-    /* DatManager will call back slotReceiveData and slotFinishLoad. */
-    Kita::DatManager::updateCache( m_datURL , this );
-    view() ->setFocus();
-
-    return TRUE;
+    /* If this is not MainPart, then open MainPart.  */
+    emit openURLRequestExt( m_datURL );
+    return FALSE;
 }
 
 
@@ -456,29 +391,6 @@ bool KitaPopupPart::reload( int jumpNum )
    received new data, and emits receiveData()  */ /* !!! "public" slot !!! */
 void KitaPopupPart::slotReceiveData()
 {
-    const int delta = 20;
-
-    if ( m_mode != POPUPPART_MODE_MAINPART ) return ;
-    if ( !m_domtree ) return ;
-
-    int readNum = Kita::DatManager::getReadNum( m_datURL );
-    int bottom = m_domtree->getBottomResNumber();
-
-    /* parsing */
-    parseResponses( bottom + 1, readNum );
-
-    /* rendering */
-    if ( m_firstReceive || bottom + delta < readNum ) {
-        showResponses( bottom + 1, readNum );
-        updateScreen( TRUE, FALSE );
-    }
-
-    if ( m_firstReceive && m_centerNum < readNum ) {
-        gotoAnchor( QString().setNum( m_centerNum ), FALSE );
-        m_firstReceive = FALSE;
-    }
-
-    emit receiveData();
 }
 
 
@@ -488,21 +400,6 @@ void KitaPopupPart::slotReceiveData()
    and emits finishReload()                   */ /* !!! "public" slot !!! */
 void KitaPopupPart::slotFinishLoad()
 {
-    if ( m_mode != POPUPPART_MODE_MAINPART ) return ;
-    if ( !m_domtree ) return ;
-
-    int bottom = m_domtree->getBottomResNumber();
-    int shownNum = m_centerNum + 5000;
-
-    showResponses( bottom + 1, shownNum );
-    updateScreen( TRUE, FALSE );
-    //    m_domtree->parseAllRes();
-    m_centerNum = 0;
-
-    if ( m_jumpNumAfterLoading ) gotoAnchor( QString().setNum( m_jumpNumAfterLoading ), FALSE );
-    m_jumpNumAfterLoading = 0;
-
-    emit finishReload();
 }
 
 
@@ -517,32 +414,8 @@ void KitaPopupPart::slotFinishLoad()
 bool KitaPopupPart::gotoAnchor( const QString& anc, bool pushPosition )
 {
     if ( anc == QString::null ) return FALSE;
-    if ( !m_domtree || m_mode == POPUPPART_MODE_KHTML || m_mode == POPUPPART_MODE_POPUP )
-        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 KitaPopupPart::customEvent() */
-    GotoAnchorEvent * e = new GotoAnchorEvent( ancstr );
-    QApplication::postEvent( this, e );  // Qt will delete it when done
-
-    return TRUE;
+    return KHTMLPart::gotoAnchor( anc );
 }
 
 
@@ -550,11 +423,6 @@ bool KitaPopupPart::gotoAnchor( const QString& anc, bool pushPosition )
 /* jump to kokomade yonda */ /* public slot */
 void KitaPopupPart::slotGotoKokoyon()
 {
-    if ( !m_domtree ) return ;
-    if ( m_mode != POPUPPART_MODE_MAINPART ) return ;
-
-    int kokoyon = Kita::DatManager::getViewPos( m_datURL );
-    gotoAnchor( QString().setNum( kokoyon ), FALSE );
 }
 
 
@@ -593,22 +461,7 @@ QString KitaPopupPart::getCurrentIDofNode()
 /* public slot */
 void KitaPopupPart::slotClickGotoFooter()
 {
-    if ( !m_domtree
-            || m_mode != POPUPPART_MODE_MAINPART
-       ) {
-        gotoAnchor( "footer", FALSE );
-        return ;
-    }
-
-    int bottom = m_domtree->getBottomResNumber();
-    int readNum = Kita::DatManager::getReadNum( m_datURL );
-
-    if ( readNum != bottom ) {
-        showResponses( bottom + 1, readNum );
-        updateScreen( TRUE, TRUE );
-    }
-
-    gotoAnchor( "footer", FALSE );
+     gotoAnchor( "footer", FALSE );
 }
 
 
@@ -630,118 +483,6 @@ void KitaPopupPart::findTextInit()
 /* public */
 bool KitaPopupPart::findText( const QString &query, bool reverse )
 {
-    if ( m_mode != POPUPPART_MODE_MAINPART ) return FALSE;
-
-    QRegExp regexp( query );
-    regexp.setCaseSensitive( FALSE );
-
-    /* init */
-    if ( m_findNode.isNull() ) {
-
-        m_findNode = htmlDocument().body();
-        m_find_y = 0;
-
-        /* move to the last child node */
-        if ( reverse ) {
-            while ( !m_findNode.lastChild().isNull() ) m_findNode = m_findNode.lastChild();
-            m_find_y = view() ->contentsHeight();
-        }
-    }
-
-    while ( 1 ) {
-
-        if ( m_findNode.nodeType() == DOM::Node::TEXT_NODE
-                || m_findNode.nodeType() == DOM::Node::CDATA_SECTION_NODE ) {
-
-            /* find the word in the current node */
-            DOM::DOMString nodeText = m_findNode.nodeValue();
-            QString nodestr = nodeText.string();
-            if ( reverse && m_findPos != -1 ) nodestr.setLength( m_findPos );
-
-            if ( reverse ) m_findPos = nodestr.findRev( regexp, m_findPos );
-            else m_findPos = nodestr.find( regexp, m_findPos + 1 );
-
-            /* scroll & select & return */
-            if ( m_findPos != -1 ) {
-
-                int matchLen = regexp.matchedLength();
-
-                QRect qr = m_findNode.getRect();
-                view() ->setContentsPos( qr.left() - 50, m_find_y - 100 );
-                DOM::Range rg( m_findNode, m_findPos, m_findNode, m_findPos + matchLen );
-                setSelection( rg );
-
-                return TRUE;
-            }
-
-        }
-
-        /*------------------------*/
-        else if ( m_findNode.nodeName().string() == "table" ) {
-
-            QRect qr = m_findNode.getRect();
-
-            m_find_y = qr.bottom();
-        }
-
-        /*------------------------*/
-        else if ( m_findNode.nodeName().string() == "div" ) {
-
-            QRect qr = m_findNode.getRect();
-
-            if ( reverse ) m_find_y = qr.bottom();
-            else m_find_y = qr.top();
-        }
-
-        /*------------------------*/
-        else if ( m_findNode.nodeName().string() == "br" ) {
-
-            DOM::Node tmpnode = m_findNode.previousSibling();
-
-            if ( tmpnode != NULL ) {
-
-                QRect qr = tmpnode.getRect();
-                if ( reverse ) m_find_y -= qr.bottom() - qr.top();
-                else m_find_y += qr.bottom() - qr.top();
-            }
-        }
-
-        /*------------------------*/
-
-        m_findPos = -1;
-        DOM::Node next;
-
-        /* move to the next node */
-        if ( !reverse ) {
-
-            next = m_findNode.firstChild();
-            if ( next.isNull() ) next = m_findNode.nextSibling();
-
-            while ( !m_findNode.isNull() && next.isNull() ) {
-                m_findNode = m_findNode.parentNode();
-                if ( !m_findNode.isNull() ) next = m_findNode.nextSibling();
-            }
-        }
-        /* revearse */
-        else {
-
-            next = m_findNode.lastChild();
-            if ( next.isNull() ) next = m_findNode.previousSibling();
-
-            while ( !m_findNode.isNull() && next.isNull() ) {
-                m_findNode = m_findNode.parentNode();
-                if ( !m_findNode.isNull() ) next = m_findNode.previousSibling();
-            }
-        }
-
-        m_findNode = next;
-        if ( m_findNode.isNull() ) {
-            m_findNode = NULL;
-            return FALSE;
-        }
-    }
-
-    return FALSE;
 }
 
 
@@ -790,65 +531,6 @@ void KitaPopupPart::showPopupMenu( const KURL& kurl )
 
     popupMenu->clear();
 
-    /*------*/
-    /* jump */
-    if ( m_domtree &&
-            ( m_mode == POPUPPART_MODE_MAINPART ) ) {
-
-        showppm = TRUE;
-
-        /* back */
-        if ( !m_anchorStack.empty() ) {
-            backSubMenu = new KPopupMenu( view() );
-            backSubMenu->clear();
-
-            int i = m_anchorStack.size();
-            QStringList::iterator it;
-            for ( it = m_anchorStack.begin(); it != m_anchorStack.end(); it++, i-- ) {
-                str = ( *it ) + "   " + Kita::DatManager::getPlainBody( m_datURL, ( *it ).toInt() ).left( 10 );
-                backSubMenu->insertItem( str, ID_Back_Link + ( i - 1 ), 0 );
-            }
-
-            popupMenu->insertItem( i18n( "Back" ), backSubMenu );
-            popupMenu->insertSeparator();
-        }
-
-        /* mark */
-        int readNum = Kita::DatManager::getReadNum( m_datURL );
-        for ( int i = 1; i <= readNum ; i++ ) {
-            if ( Kita::DatManager::isMarked( m_datURL, i ) ) {
-                if ( !markSubMenu ) {
-                    markSubMenu = new KPopupMenu( view() );
-                    markSubMenu->clear();
-                    popupMenu->insertItem( i18n( "Mark" ), markSubMenu );
-                    popupMenu->insertSeparator();
-                }
-
-                str = QString().setNum( i ) + "   " + Kita::DatManager::getPlainBody( m_datURL, i ).left( 10 );
-                markSubMenu->insertItem( str, ID_Goto_Mark + i );
-            }
-        }
-
-        /* home */
-        popupMenu->insertItem( i18n( "Start" ), ID_Home_Link );
-
-
-        /* template */
-        if ( m_mode == POPUPPART_MODE_MAINPART ) {
-
-            int kokoyon = Kita::DatManager::getViewPos( m_datURL );
-            if ( kokoyon ) {
-                str = i18n( "Kokomade Yonda (%1)" ).arg( kokoyon );
-                popupMenu->insertItem( str, ID_Koko_Link );
-            }
-        }
-
-
-        /* end */
-        popupMenu->insertItem( i18n( "End" ), ID_End_Link );
-    }
-
-
     /*--------------*/
     /* copy & abone */
     if ( hasSelection() ) {
@@ -1084,15 +766,6 @@ void KitaPopupPart::clickAnchor( const KURL& urlin )
     if ( m_pushrightbt && startMultiPopup() ) return ;
 
 
-    /*----------------------------*/
-    /* next 100 ,before 100 ,etc. */
-    if ( m_mode == POPUPPART_MODE_MAINPART ) {
-        if ( refstr.left( 7 ) == "tosaigo" ) {
-            slotClickGotoFooter();
-            return;
-        }
-    }
-
     /*-------------------------------*/
     /* open Kita Navi or goto anchor */
 
@@ -1107,9 +780,7 @@ void KitaPopupPart::clickAnchor( const KURL& urlin )
 
     if ( !refNum ) return ;
 
-    if ( m_mode == POPUPPART_MODE_KHTML || m_mode == POPUPPART_MODE_POPUP ) {
-        emit openURLRequestExt( urlin );
-    } else gotoAnchor( QString().setNum( refNum ), TRUE );
+    emit openURLRequestExt( urlin );
 }
 
 
@@ -1158,15 +829,6 @@ void KitaPopupPart::showWritePopupMenu( const QString& refstr )
     KPopupMenu *popupMenu = new KPopupMenu( view() );
     popupMenu->clear();
 
-    /* write */
-    if ( m_mode == POPUPPART_MODE_MAINPART ) {
-
-        popupMenu->insertItem( i18n( "write response" ), WRITEMENU_RES );
-        popupMenu->insertItem( i18n( "quote this" ), WRITEMENU_QUOTE );
-        popupMenu->insertSeparator();
-
-    }
-
     /* mark */
     popupMenu->insertItem( i18n( "Mark" ), WRITEMENU_MARK );
     popupMenu->setItemChecked( WRITEMENU_MARK, Kita::DatManager::isMarked( m_datURL, resNum ) );
@@ -1187,12 +849,6 @@ void KitaPopupPart::showWritePopupMenu( const QString& refstr )
     popupMenu->insertItem( i18n( "Copy title and URL" ), WRITEMENU_COPYTHREADNAME );
     popupMenu->insertItem( i18n( "copy" ), WRITEMENU_COPY );
 
-    /* kokkoma de yonda */
-    if ( m_domtree && m_mode == POPUPPART_MODE_MAINPART ) {
-        popupMenu->insertSeparator();
-        popupMenu->insertItem( i18n( "set Kokomade Yonda" ), WRITEMENU_SETKOKOYON );
-    }
-
     /* abone */
     popupMenu->insertSeparator();
     popupMenu->insertItem( i18n( "add name to abone list" ), WRITEMENU_ABONENAME );
@@ -1502,7 +1158,7 @@ void KitaPopupPart::slotLeave()
     hidePopup();
 
     /* emit signal to have parent hide this if this is popup . */
-    if ( m_mode == POPUPPART_MODE_POPUP && !isUnderMouse( 0, 0 ) ) emit hideChildPopup();
+    if ( !isUnderMouse( 0, 0 ) ) emit hideChildPopup();
 }
 
 
@@ -1517,7 +1173,7 @@ void KitaPopupPart::slotVSliderReleased()
     hidePopup();
 
     /* emit signal to have parent hide this if this is popup . */
-    if ( m_mode == POPUPPART_MODE_POPUP && !isUnderMouse( mrg, 0 ) ) emit hideChildPopup();
+    if ( !isUnderMouse( mrg, 0 ) ) emit hideChildPopup();
 }
 
 
@@ -1532,7 +1188,7 @@ void KitaPopupPart::slotHSliderReleased()
     hidePopup();
 
     /* emit signal to have parent hide this if this is popup . */
-    if ( m_mode == POPUPPART_MODE_POPUP && !isUnderMouse( 0, mrg ) ) emit hideChildPopup();
+    if ( !isUnderMouse( 0, mrg ) ) emit hideChildPopup();
 }
 
 
@@ -1543,7 +1199,7 @@ void KitaPopupPart::slotHideChildPopup()
     hidePopup();
 
     /* emit signal to have parent hide this if this is popup . */
-    if ( m_mode == POPUPPART_MODE_POPUP && !isUnderMouse( 0, 0 ) ) emit hideChildPopup();
+    if ( !isUnderMouse( 0, 0 ) ) emit hideChildPopup();
 }