OSDN Git Service

>>740, change color for responsed num.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sat, 25 Dec 2004 04:20:52 +0000 (04:20 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sat, 25 Dec 2004 04:20:52 +0000 (04:20 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1602 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/libkita/datinfo.cpp
kita/src/libkita/datinfo.h
kita/src/libkita/kitaconfig.cpp
kita/src/libkita/kitaconfig.h
kita/src/part/kitadomtree.cpp
kita/src/part/kitadomtree.h
kita/src/part/kitahtmlpart.cpp

index 24d315b..85ed7ce 100644 (file)
@@ -143,6 +143,7 @@ void DatInfo::resetResDat( RESDAT& resdat )
     resdat.anclist.clear();
     resdat.checkAbone = FALSE;
     resdat.abone = FALSE;
+    resdat.isResponsed = FALSE;
 }
 
 
@@ -255,6 +256,28 @@ bool DatInfo::copyOneLineToResDat( const QString& line )
     /* get subject */
     if( num == 1 ) parseDat( num );
 
+    /* search all responses which are responsed by this line. */
+    if( KitaConfig::checkResponsed() ){
+
+        if ( parseDat( num ) && !checkAbonePrivate( num ) ){ /* parse line here to get AncList */
+            
+            const int maxRange = 10;
+
+            AncList& anclist = m_resDatVec[ num ].anclist;
+            for ( AncList::iterator it = anclist.begin(); it != anclist.end(); ++it ) {
+
+                int fromNum = ( *it ).from;
+                int toNum = QMIN( num - 1, ( *it ).to );
+                if( toNum - fromNum +1 > maxRange ) continue;
+
+                for( int i = fromNum; i <= toNum; ++i ){
+            
+                    if( !checkAbonePrivate( i ) )  m_resDatVec[ i ].isResponsed = TRUE;
+                }
+            }
+        }
+    }
+    
     return TRUE;
 }
 
@@ -734,6 +757,13 @@ int DatInfo::getDatSize()
 
 
 /* public */
+const bool DatInfo::isResponsed( int num ) const
+{
+    return m_resDatVec[ num ].isResponsed;
+}
+
+
+/* public */
 bool DatInfo::isResValid( int num )
 {
     QMutexLocker locker( &m_mutex );
index a286327..9584df9 100644 (file)
@@ -80,6 +80,9 @@ struct RESDAT
 
     bool checkAbone; /* Is abone checked ? */
     bool abone;
+
+    /* Is this res responsed by other one? */
+    bool isResponsed;
 };
 typedef QValueVector<RESDAT> ResDatVec;
 
@@ -173,6 +176,7 @@ namespace Kita
         int getDatSize();
 
         /* several informations */
+        const bool isResponsed ( int num ) const;
         bool isResValid( int num );
         bool isBroken();
         bool isResBroken( int num );
index 4e0f227..0e141e8 100644 (file)
@@ -53,6 +53,7 @@ KitaConfig::KitaConfig()
         m_partMimeList( KitaConfig::defaultPartMimeList() ),
         m_userID( KitaConfig::defaultUserID() ),
         m_password( KitaConfig::defaultPassword() ),
+        m_checkResponsed( KitaConfig::defaultCheckResponsed() ),
         m_autoLogin( KitaConfig::defaultAutoLogin() )
 {}
 
@@ -79,6 +80,7 @@ void KitaConfig::writeConfig( KConfig* config )
     config->writeEntry( "UseStyleSheet", KitaConfig::useStyleSheet() );
     config->writeEntry( "PartMimeList", KitaConfig::partMimeList() );
     config->writeEntry( "AboneChain", KitaConfig::aboneChain() );
+    config->writeEntry( "CheckResponsed", KitaConfig::checkResponsed() );    
 
     config->setGroup( "Color" );
     config->writeEntry( "Thread", KitaConfig::threadColor() );
@@ -128,6 +130,7 @@ void KitaConfig::readConfig( KConfig* config )
     KitaConfig::setUseKitaNavi( config->readBoolEntry( "UseKitaNavi", KitaConfig::defaultUseKitaNavi() ) );
     KitaConfig::setUseStyleSheet( config->readBoolEntry( "UseStyleSheet", KitaConfig::defaultUseStyleSheet() ) );
     KitaConfig::setAboneChain( config->readBoolEntry( "AboneChain", KitaConfig::defaultAboneChain() ) );
+    KitaConfig::setCheckResponsed( config->readBoolEntry( "CheckResponsed", KitaConfig::defaultCheckResponsed() ) );
     {
         // MIME list
         QStringList mimeList = config->readListEntry( "PartMimeList" );
@@ -209,6 +212,11 @@ QString KitaConfig::defaultStyleSheetText()
                "body,\n"
                "body.pop {\n"
                "}\n"
+
+               "a.coloredLink:link\n"
+               "{\n"
+               " color: magenta;"
+               "}\n"               
               
                "div.res_title,\n"
                "div.pop_res_title {\n"
index 5088f00..d4dcc01 100644 (file)
@@ -61,6 +61,7 @@ private:
     QString m_userID;
     QString m_password;
     bool m_autoLogin;
+    bool m_checkResponsed;
 
     KitaConfig();
     virtual ~KitaConfig();
@@ -200,6 +201,10 @@ public:
     static bool autoLogin() { return getInstance() ->m_autoLogin; }
     static void setAutoLogin( bool value ) { getInstance() ->m_autoLogin = value; }
     static bool defaultAutoLogin() { return false; }
+
+    static bool checkResponsed() { return getInstance() ->m_checkResponsed; }
+    static void setCheckResponsed( bool value ) { getInstance() ->m_checkResponsed = value; }
+    static bool defaultCheckResponsed() { return true; }
 };
 
 #endif
index 1dc273d..d213d67 100644 (file)
@@ -83,6 +83,7 @@ bool KitaDomTree::createResElement( int num )
        m_bodyElm.resize( m_bufLng );       
        m_resshown.resize( m_bufLng, FALSE );
        m_resStatus.resize( m_bufLng, KITA_HTML_NOTPARSED );
+        m_coloredNum.resize( m_bufLng, FALSE );
     }
 
     /* cleate elements */
@@ -167,6 +168,20 @@ void KitaDomTree::redraw( bool force )
 }
 
 
+/* change color of number of the res which is responsed. */
+/* See also KitaDomTree::changeColorOfNumber() ,
+   DatInfo::copyOneLineToResDat(),
+   and DatInfo::collectResponsedRes().                   */ /* public */
+void KitaDomTree::changeColorOfAllResponsedNumber()
+{
+    for( int i = 1; i <= m_bottomNum; ++i ){
+        
+        if( m_resshown[ i ] && m_datInfo->isResponsed( i ) ) changeColorOfNumber( i );
+    }
+}
+
+
+
 /*-----------------------------------------------------------------*/
 
 /* public information */
@@ -599,3 +614,22 @@ void KitaDomTree::createMae100()
 
     m_mae100 = rootnode;
 }
+
+/* change color of number */ 
+/*
+   specify color like this:  "a.coloredLink:link{ color: red; }"   */ /* private */
+
+void KitaDomTree::changeColorOfNumber( int num )
+{
+    if ( ! m_datInfo ) return ;
+    if ( m_hdoc == NULL ) return ;
+    if ( m_coloredNum[ num ] ) return;
+    if ( !m_resshown[ num ] ) return;
+
+    m_coloredNum[ num ] = TRUE;
+    DOM::Node node = m_titleElm[ num ];
+    node = node.firstChild();
+    while( node.nodeName().string() != "a" ) node = node.firstChild();  /* table tag is used. */
+
+    static_cast< DOM::HTMLElement> ( node ).setAttribute( "class", "coloredLink" );
+}
index 5daaa00..dcb1226 100644 (file)
@@ -43,6 +43,7 @@ class KitaDomTree
     int m_headerMaxNum;
     QValueVector < bool > m_resshown; /* the res is shown */
     QValueVector < int > m_resStatus; /* return val of DatInfo::getHTML(). See datinfo.h */    
+    QValueVector < bool > m_coloredNum; /* colored number */
 
     /* DOM elements */
     DOM::HTMLDocument m_hdoc; /* root node of document*/
@@ -66,6 +67,7 @@ public:
     bool createResElement( int num );
     bool appendRes( int num );
     void redraw( bool force );
+    void changeColorOfAllResponsedNumber();
 
     /* information */
 
@@ -100,6 +102,7 @@ private:
     void createKokoyon();
     void createTugi100();
     void createMae100();
+    void changeColorOfNumber( int num );
 };
 
 
index 15f87a0..3887137 100644 (file)
@@ -370,6 +370,12 @@ void KitaHTMLPart::updateScreen( bool showHeaderEtc, bool clock )
         m_domtree->appendFooterAndHeader();
     }
 
+    /* change color of number of the res which is responsed. */
+    if ( m_mode == HTMLPART_MODE_MAINPART || m_mode == HTMLPART_MODE_NAVI ) {
+        
+        if( KitaConfig::checkResponsed() ) m_domtree->changeColorOfAllResponsedNumber();
+    }
+
     /*----------------------------*/
 
     /* update display */