OSDN Git Service

>>958, fix: changed tab's font, don't reflect abone setting, signal refactoring.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 5 Jul 2004 14:48:24 +0000 (14:48 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 5 Jul 2004 14:48:24 +0000 (14:48 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1228 56b19765-1e22-0410-a548-a0f45d66c51a

17 files changed:
kita/src/aboneprefpage.cpp
kita/src/aboneprefpage.h
kita/src/kita.cpp
kita/src/kita.h
kita/src/kitasubjecttabwidget.cpp
kita/src/kitasubjecttabwidget.h
kita/src/kitathreadtabwidget.cpp
kita/src/kitathreadtabwidget.h
kita/src/libkita/signalcollection.h
kita/src/part/kitadomtree.cpp
kita/src/part/kitahtmlpart.cpp
kita/src/part/kitahtmlpart.h
kita/src/part/kitathreadpart.cpp
kita/src/part/kitathreadview.cpp
kita/src/part/kitathreadview.h
kita/src/pref.cpp
kita/src/pref.h

index e3f1257..6bc80cc 100644 (file)
@@ -12,6 +12,7 @@
 #include <ktextedit.h>
 
 #include "libkita/kitaconfig.h"
+#include "libkita/signalcollection.h"
 
 using namespace Kita;
 
@@ -21,28 +22,47 @@ AbonePrefPage::AbonePrefPage( QWidget *parent, const char *name )
     idAboneText->setText( KitaConfig::aboneIDList().join( "\n" ) );
     nameAboneText->setText( KitaConfig::aboneNameList().join( "\n" ) );
     wordAboneText->setText( KitaConfig::aboneWordList().join( "\n" ) );
-    
-    connect( idAboneText, SIGNAL( textChanged() ), SIGNAL( changed() ) );
-    connect( nameAboneText, SIGNAL( textChanged() ), SIGNAL( changed() ) );
-    connect( wordAboneText, SIGNAL( textChanged() ), SIGNAL( changed() ) );
+
+    connect( idAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ));
+    connect( nameAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ));
+    connect( wordAboneText, SIGNAL( textChanged() ), SLOT( slotTextChanged() ));
+
+    Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
+    connect( this, SIGNAL( redrawAllHTMLPart( bool ) ),
+             signalCollection, SIGNAL( redrawAllHTMLPart( bool ) ));
+
+    m_changed = FALSE;
 }
 
 AbonePrefPage::~AbonePrefPage()
 {}
 
+void AbonePrefPage::slotTextChanged()
+{
+    m_changed = TRUE;
+    emit changed();
+}
+
 void AbonePrefPage::apply()
 {
-    QString idText = idAboneText->text();
-    QStringList idList = QStringList::split( '\n', idText );
-    KitaConfig::setAboneIDList( idList );
-    
-    QString nameText = nameAboneText->text();
-    QStringList nameList = QStringList::split( '\n', nameText );
-    KitaConfig::setAboneNameList( nameList );
-    
-    QString wordText = wordAboneText->text();
-    QStringList wordList = QStringList::split( '\n', wordText );
-    KitaConfig::setAboneWordList( wordList );
+    if( m_changed )
+    {
+        QString idText = idAboneText->text();
+        QStringList idList = QStringList::split( '\n', idText );
+        KitaConfig::setAboneIDList( idList );
+
+        QString nameText = nameAboneText->text();
+        QStringList nameList = QStringList::split( '\n', nameText );
+        KitaConfig::setAboneNameList( nameList );
+
+        QString wordText = wordAboneText->text();
+        QStringList wordList = QStringList::split( '\n', wordText );
+        KitaConfig::setAboneWordList( wordList );
+
+        emit redrawAllHTMLPart( FALSE ); /* to all HTMLPart */
+    }
+
+    m_changed = FALSE;
 }
 
 #include "aboneprefpage.moc"
index edc046b..e319d7b 100644 (file)
@@ -20,13 +20,17 @@ namespace Kita
     class AbonePrefPage : public AbonePrefBase
     {
         Q_OBJECT
+        bool m_changed;
     public:
         AbonePrefPage( QWidget *parent = 0, const char *name = 0 );
         ~AbonePrefPage();
     public slots:
         void apply();
+    private slots:
+        void slotTextChanged();
     signals:
         void changed();
+        void redrawAllHTMLPart( bool force );
     };
 }
 
index 37253e1..ba0f109 100644 (file)
@@ -19,7 +19,6 @@
 #include "kitasubjecttabwidget.h"
 #include "kitanavi.h"
 
-#include "libkita/thread.h"
 #include "libkita/favoritethreads.h"
 #include "libkita/kita_misc.h"
 #include "libkita/kitaconfig.h"
@@ -103,8 +102,14 @@ KitaMainWindow::KitaMainWindow()
 
     // allow the view to change the statusbar and caption
     Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
-    connect( signalCollection, SIGNAL( signalChangeStatusbar( const QString& ) ),
-             SLOT( changeStatusbar( const QString& ) ) );
+    connect( signalCollection, SIGNAL( setMainCaption( const QString& ) ),
+             SLOT( slotSetMainCaption( const QString& ) ) );
+
+    connect( signalCollection, SIGNAL( setMainStatusbar( const QString& ) ),
+             SLOT( slotSetMainStatusbar( const QString& ) ) );
+
+    connect( signalCollection, SIGNAL( setMainURLLine( const KURL& ) ),
+             SLOT( setUrl( const KURL& ) ) );
 
     connect( signalCollection, SIGNAL( openBoardRequested( const QString&, bool ) ),
              SLOT( switchSubjectView( const QString&, bool ) ) );
@@ -115,18 +120,9 @@ KitaMainWindow::KitaMainWindow()
     connect( m_subjectTab, SIGNAL( showThreadRequested( const QString&, bool ) ),
              m_threadTab, SLOT( showThread( const QString&, bool ) ) );
 
-    connect( signalCollection, SIGNAL( signalThread( const Kita::Thread* ) ),
-             m_subjectTab, SLOT( updateThread( const Kita::Thread* ) ) );
-
-    connect( signalCollection, SIGNAL( signalThread( const Kita::Thread* ) ),
-             SLOT( slotThread( const Kita::Thread* ) ) );
-
     connect( signalCollection, SIGNAL( writeSucceeded() ),
              SLOT( slotWriteSucceeded() ) );
 
-    connect( signalCollection, SIGNAL( showThreadCompleted( const KURL& ) ),
-             SLOT( setUrl( const KURL& ) ) );
-
     connect( m_threadTab, SIGNAL( sigHideSubject() ),
              SLOT( hideSubject() ) );
 
@@ -141,7 +137,7 @@ KitaMainWindow::KitaMainWindow()
 
     connect( signalCollection, SIGNAL( bookmarked( const QString&, bool ) ),
              SLOT( bookmark( const QString&, bool ) ) );
-             
+
     connect( m_urlLine, SIGNAL( returnPressed() ),
              SLOT( slotURLLine() ) );
 
@@ -169,7 +165,7 @@ KitaMainWindow::~KitaMainWindow()
     saveAboneIDList();
     saveAboneNameList();
     saveAboneWordList();
-    
+
     saveAsciiArt();
 
     saveCompletion();
@@ -196,7 +192,8 @@ void KitaMainWindow::load( const KURL& url )
 
 #if 0
     // download the contents
-    if ( KIO::NetAccess::download( url, target ) ) {
+    if ( KIO::NetAccess::download( url, target ) )
+    {
         // set our caption
         setCaption( url );
 
@@ -267,12 +264,12 @@ void KitaMainWindow::setupActions()
                  "reset_win" );
 
     m_toggleViewAction = new KAction(
-        i18n( "&Toggle subject view and thread view" ),
-        KShortcut(Qt::Key_F7),
-        this,
-        SLOT( windowToggleView() ),
-        actionCollection(),
-        "window_toggle_view" );
+                             i18n( "&Toggle subject view and thread view" ),
+                             KShortcut(Qt::Key_F7),
+                             this,
+                             SLOT( windowToggleView() ),
+                             actionCollection(),
+                             "window_toggle_view" );
 
     // action for subjecttabwidget
     new KAction( i18n( "Close Current Thread Tab" ),
@@ -349,12 +346,14 @@ void KitaMainWindow::readConfig( KConfig* config )
     config->setGroup( "Color" );
 
     QColor popupColor = config->readColorEntry( "Popup" );
-    if ( popupColor.isValid() ) {
+    if ( popupColor.isValid() )
+    {
         KitaConfig::setPopupColor( popupColor );
     }
 
     QColor popupBackgroundColor = config->readColorEntry( "PopupBackground" );
-    if ( popupColor.isValid() ) {
+    if ( popupColor.isValid() )
+    {
         KitaConfig::setPopupBackgroundColor( popupBackgroundColor );
     }
 }
@@ -387,7 +386,8 @@ void KitaMainWindow::dropEvent( QDropEvent* event )
     QStrList uri;
 
     // see if we can decode a URI.. if not, just ignore it
-    if ( QUriDrag::decode( event, uri ) ) {
+    if ( QUriDrag::decode( event, uri ) )
+    {
         // okay, we have a URI.. process it
         QString url, target;
         url = uri.first();
@@ -411,9 +411,12 @@ void KitaMainWindow::optionsShowToolbar()
 {
     // this is all very cut and paste code for showing/hiding the
     // toolbar
-    if ( m_toolbarAction->isChecked() ) {
+    if ( m_toolbarAction->isChecked() )
+    {
         toolBar() ->show();
-    } else {
+    }
+    else
+    {
         toolBar() ->hide();
     }
 }
@@ -422,9 +425,12 @@ void KitaMainWindow::optionsShowStatusbar()
 {
     // this is all very cut and paste code for showing/hiding the
     // statusbar
-    if ( m_statusbarAction->isChecked() ) {
+    if ( m_statusbarAction->isChecked() )
+    {
         statusBar() ->show();
-    } else {
+    }
+    else
+    {
         statusBar() ->hide();
     }
 }
@@ -459,18 +465,24 @@ void KitaMainWindow::newToolbarConfig()
 
 void KitaMainWindow::windowShowBoardlist()
 {
-    if ( m_boardListAction->isChecked() ) {
+    if ( m_boardListAction->isChecked() )
+    {
         makeDockVisible( m_boardDock );
-    } else {
+    }
+    else
+    {
         makeDockInvisible( m_boardDock );
     }
 }
 
 void KitaMainWindow::windowShowSubjectlist()
 {
-    if ( m_subjectListAction->isChecked() ) {
+    if ( m_subjectListAction->isChecked() )
+    {
         makeDockVisible( m_subjectDock );
-    } else {
+    }
+    else
+    {
         makeDockInvisible( m_subjectDock );
     }
 }
@@ -532,26 +544,19 @@ void KitaMainWindow::optionsPreferences()
 
     connect( &dlg, SIGNAL( fontChanged( const QFont& ) ),
              SLOT( setFont( const QFont& ) ) );
-    connect( &dlg, SIGNAL( threadFontChanged( const QFont& ) ),
-             SLOT( setThreadFont( const QFont& ) ) );
 
     // XXX
     dlg.setInitialSize( QSize( 600, 400 ) );
-    if ( dlg.exec() ) {
+    if ( dlg.exec() )
+    {
         // redo your settings
     }
 }
 
-void KitaMainWindow::changeStatusbar( const QString& text )
+void KitaMainWindow::slotSetMainStatusbar( const QString& statusStr )
 {
     // display the text on the statusbar
-    statusBar() ->message( text );
-}
-
-void KitaMainWindow::changeCaption( const QString& text )
-{
-    // display the text on the caption
-    setCaption( text );
+    statusBar() ->message( statusStr );
 }
 
 void KitaMainWindow::setupView()
@@ -566,8 +571,8 @@ void KitaMainWindow::setupView()
 
     /* emit when this widget is deactivated */
     connect( this, SIGNAL( windowDeactivated() ),
-            Kita::SignalCollection::getInstance(), SIGNAL( windowDeactivated() ));
-    
+             Kita::SignalCollection::getInstance(), SIGNAL( windowDeactivated() ));
+
     /* If this widget is active and receives
        signal isKitaActive, then emit signal kitaIsActive. */
     connect( Kita::SignalCollection::getInstance(), SIGNAL( isKitaActive() ),
@@ -575,7 +580,7 @@ void KitaMainWindow::setupView()
 
     connect( this, SIGNAL( kitaIsActive() ),
              Kita::SignalCollection::getInstance(), SIGNAL( kitaIsActive() ) );
-    
+
     setView( m_mainDock );
     setMainDockWidget( m_mainDock );
 
@@ -607,22 +612,24 @@ void KitaMainWindow::closeSubjectView()
 
 void KitaMainWindow::closeBoardView()
 {
-   m_boardListAction->setChecked( FALSE );
+    m_boardListAction->setChecked( FALSE );
 }
 
 void KitaMainWindow::slotOpenURLRequest( const KURL& url, const KParts::URLArgs& args )
-{ 
+{
     kdDebug() << QString( "Requested OpenURL: \"%1\"" ).arg( url.url() ) << endl;
     kdDebug() << QString( "content type: \"%1\"" ).arg( args.contentType() ) << endl;
     kdDebug() << QString( "service type: \"%1\"" ).arg( args.serviceType ) << endl;
     kdDebug() << QString( "NewTab: %1, reload: %2" )
-                        .arg( args.newTab() ? "yes" : "no" )
-                        .arg( args.reload ? "yes" : "no" ) << endl;
+    .arg( args.newTab() ? "yes" : "no" )
+    .arg( args.reload ? "yes" : "no" ) << endl;
     QString mimetype = KIO::NetAccess::mimetype( url );
     kdDebug() << QString( "queried MIME type: \"%1\"" ).arg( mimetype ) << endl;
-    if ( mimetype.startsWith( "image/" ) ) {
+    if ( mimetype.startsWith( "image/" ) )
+    {
         KService::Ptr service = KServiceTypeProfile::preferredService( mimetype, "KParts/ReadOnlyPart" );
-        if ( service ) {
+        if ( service )
+        {
             QString libName = QFile::encodeName( service->library() );
             m_threadTab->showAlternativeView( url, libName, mimetype );
             return;
@@ -631,9 +638,12 @@ void KitaMainWindow::slotOpenURLRequest( const KURL& url, const KParts::URLArgs&
     KURL datURL = Kita::ParseMisc::parseURLonly( url );
 
     QRegExp regexp( "http://([^/]*)/([^/]*)/dat/(.*)\\.dat" );
-    if ( regexp.search( datURL.url() ) == -1 ) {
+    if ( regexp.search( datURL.url() ) == -1 )
+    {
         new KRun( url );
-    } else {
+    }
+    else
+    {
         m_threadTab->showThread( url.prettyURL(), true );
     }
 }
@@ -643,7 +653,8 @@ void KitaMainWindow::loadCache()
     KitaThreadInfo * cache = KitaThreadInfo::getInstance();
     QString cacheConfigPath = locateLocal( "appdata", "cache" );
     QFile file( cacheConfigPath );
-    if ( file.open( IO_ReadOnly ) ) {
+    if ( file.open( IO_ReadOnly ) )
+    {
         QDataStream stream( &file );
         stream >> *cache;
     }
@@ -654,7 +665,8 @@ void KitaMainWindow::saveCache()
     KitaThreadInfo * cache = KitaThreadInfo::getInstance();
     QString cacheConfigPath = locateLocal( "appdata", "cache" );
     QFile file( cacheConfigPath );
-    if ( file.open( IO_WriteOnly ) ) {
+    if ( file.open( IO_WriteOnly ) )
+    {
         QDataStream stream( &file );
         stream << *cache;
     }
@@ -670,10 +682,6 @@ void KitaMainWindow::setFont( const QFont& font )
     m_boardView->setFont( font );
 }
 
-void KitaMainWindow::setThreadFont( const QFont& font )
-{
-    m_threadTab->setFont( font );
-}
 
 void KitaMainWindow::slotWriteSucceeded()
 {
@@ -689,9 +697,12 @@ void KitaMainWindow::bookmark( const QString& datURL, bool on )
 {
     FavoriteThreads * favorite = FavoriteThreads::getInstance();
 
-    if ( on ) {
+    if ( on )
+    {
         favorite->insert( datURL );
-    } else {
+    }
+    else
+    {
         favorite->remove( datURL );
     }
     emit favoritesUpdated();
@@ -701,7 +712,8 @@ void KitaMainWindow::loadFavorites()
 {
     QString favoritesConfigPath = locateLocal( "appdata", "favorites.xml" );
     QFile file( favoritesConfigPath );
-    if ( file.open( IO_ReadOnly ) ) {
+    if ( file.open( IO_ReadOnly ) )
+    {
         QTextStream stream( &file );
         stream.setEncoding( QTextStream::UnicodeUTF8 );
 
@@ -714,7 +726,8 @@ void KitaMainWindow::saveFavorites()
 {
     QString favoritesConfigPath = locateLocal( "appdata", "favorites.xml" );
     QFile file( favoritesConfigPath );
-    if ( file.open( IO_WriteOnly ) ) {
+    if ( file.open( IO_WriteOnly ) )
+    {
         QTextStream stream( &file );
         stream.setEncoding( QTextStream::UnicodeUTF8 );
         stream << FavoriteThreads::getInstance() ->toXML();
@@ -742,15 +755,18 @@ void KitaMainWindow::loadAsciiArt()
 {
     QString configPath = locateLocal( "appdata", "asciiart" );
     QFile file( configPath );
-    if ( file.open( IO_ReadOnly ) ) {
+    if ( file.open( IO_ReadOnly ) )
+    {
         QTextStream stream( &file );
         stream.setEncoding( QTextStream::UnicodeUTF8 );
 
         QStringList list;
         QString str;
 
-        while ( ( str = stream.readLine() ) != QString::null ) {
-            if ( ! str.isEmpty() ) {
+        while ( ( str = stream.readLine() ) != QString::null )
+        {
+            if ( ! str.isEmpty() )
+            {
                 list << str;
             }
         }
@@ -762,13 +778,15 @@ void KitaMainWindow::saveAsciiArt()
 {
     QString configPath = locateLocal( "appdata", "asciiart" );
     QFile file( configPath );
-    if ( file.open( IO_WriteOnly ) ) {
+    if ( file.open( IO_WriteOnly ) )
+    {
         QTextStream stream( &file ) ;
         stream.setEncoding( QTextStream::UnicodeUTF8 );
 
         QStringList list = KitaConfig::asciiArtList();
         QStringList::iterator it;
-        for ( it = list.begin(); it != list.end(); ++it ) {
+        for ( it = list.begin(); it != list.end(); ++it )
+        {
             stream << ( *it ) << endl;
         }
     }
@@ -778,7 +796,8 @@ void KitaMainWindow::loadFavoriteBoards()
 {
     QString configPath = locateLocal( "appdata", "favorite_boards.xml" );
     QFile file( configPath );
-    if ( file.open( IO_ReadOnly ) ) {
+    if ( file.open( IO_ReadOnly ) )
+    {
         QTextStream stream( &file );
         stream.setEncoding( QTextStream::UnicodeUTF8 );
 
@@ -791,7 +810,8 @@ void KitaMainWindow::saveFavoriteBoards()
 {
     QString configPath = locateLocal( "appdata", "favorite_boards.xml" );
     QFile file( configPath );
-    if ( file.open( IO_WriteOnly ) ) {
+    if ( file.open( IO_WriteOnly ) )
+    {
         QTextStream stream( &file );
         stream.setEncoding( QTextStream::UnicodeUTF8 );
         stream << Kita::FavoriteBoards::toXML();
@@ -802,15 +822,18 @@ void KitaMainWindow::loadAboneIDList()
 {
     QString configPath = locateLocal( "appdata", "abone_id" );
     QFile file( configPath );
-    if ( file.open( IO_ReadOnly ) ) {
+    if ( file.open( IO_ReadOnly ) )
+    {
         QTextStream stream( &file );
         stream.setEncoding( QTextStream::UnicodeUTF8 );
-        
+
         QStringList list;
         QString str;
-    
-        while ( ( str = stream.readLine() ) != QString::null ) {
-            if ( ! str.isEmpty() ) {
+
+        while ( ( str = stream.readLine() ) != QString::null )
+        {
+            if ( ! str.isEmpty() )
+            {
                 list << str;
             }
         }
@@ -822,31 +845,36 @@ void KitaMainWindow::saveAboneIDList()
 {
     QString configPath = locateLocal( "appdata", "abone_id" );
     QFile file( configPath );
-    if ( file.open( IO_WriteOnly ) ) {
+    if ( file.open( IO_WriteOnly ) )
+    {
         QTextStream stream( &file ) ;
         stream.setEncoding( QTextStream::UnicodeUTF8 );
 
         QStringList list = KitaConfig::aboneIDList();
         QStringList::iterator it;
-        for ( it = list.begin(); it != list.end(); ++it ) {
+        for ( it = list.begin(); it != list.end(); ++it )
+        {
             stream << ( *it ) << endl;
         }
-    }    
+    }
 }
 
 void KitaMainWindow::loadAboneNameList()
 {
     QString configPath = locateLocal( "appdata", "abone_name" );
     QFile file( configPath );
-    if ( file.open( IO_ReadOnly ) ) {
+    if ( file.open( IO_ReadOnly ) )
+    {
         QTextStream stream( &file );
         stream.setEncoding( QTextStream::UnicodeUTF8 );
-        
+
         QStringList list;
         QString str;
-    
-        while ( ( str = stream.readLine() ) != QString::null ) {
-            if ( ! str.isEmpty() ) {
+
+        while ( ( str = stream.readLine() ) != QString::null )
+        {
+            if ( ! str.isEmpty() )
+            {
                 list << str;
             }
         }
@@ -858,31 +886,36 @@ void KitaMainWindow::saveAboneNameList()
 {
     QString configPath = locateLocal( "appdata", "abone_name" );
     QFile file( configPath );
-    if ( file.open( IO_WriteOnly ) ) {
+    if ( file.open( IO_WriteOnly ) )
+    {
         QTextStream stream( &file ) ;
         stream.setEncoding( QTextStream::UnicodeUTF8 );
 
         QStringList list = KitaConfig::aboneNameList();
         QStringList::iterator it;
-        for ( it = list.begin(); it != list.end(); ++it ) {
+        for ( it = list.begin(); it != list.end(); ++it )
+        {
             stream << ( *it ) << endl;
         }
-    }    
+    }
 }
 
 void KitaMainWindow::loadAboneWordList()
 {
     QString configPath = locateLocal( "appdata", "abone_word" );
     QFile file( configPath );
-    if ( file.open( IO_ReadOnly ) ) {
+    if ( file.open( IO_ReadOnly ) )
+    {
         QTextStream stream( &file );
         stream.setEncoding( QTextStream::UnicodeUTF8 );
-        
+
         QStringList list;
         QString str;
-    
-        while ( ( str = stream.readLine() ) != QString::null ) {
-            if ( ! str.isEmpty() ) {
+
+        while ( ( str = stream.readLine() ) != QString::null )
+        {
+            if ( ! str.isEmpty() )
+            {
                 list << str;
             }
         }
@@ -894,16 +927,18 @@ void KitaMainWindow::saveAboneWordList()
 {
     QString configPath = locateLocal( "appdata", "abone_word" );
     QFile file( configPath );
-    if ( file.open( IO_WriteOnly ) ) {
+    if ( file.open( IO_WriteOnly ) )
+    {
         QTextStream stream( &file ) ;
         stream.setEncoding( QTextStream::UnicodeUTF8 );
 
         QStringList list = KitaConfig::aboneWordList();
         QStringList::iterator it;
-        for ( it = list.begin(); it != list.end(); ++it ) {
+        for ( it = list.begin(); it != list.end(); ++it )
+        {
             stream << ( *it ) << endl;
         }
-    }    
+    }
 }
 
 void KitaMainWindow::switchSubjectView( const QString&, bool )
@@ -917,16 +952,17 @@ void KitaMainWindow::switchThreadView( const QString&, bool )
     m_mainDock->makeDockVisible();
 }
 
-void KitaMainWindow::slotThread( const Kita::Thread* thread )
+void KitaMainWindow::slotSetMainCaption( const QString& captionStr )
 {
-    setCaption( thread->name() + QString( " (%1)" ).arg( thread->resNum() ) );
+    setCaption( captionStr );
 }
 
 void KitaMainWindow::slotEditCopy()
 {
     QWidget * widget = kapp->focusWidget();
 
-    if ( widget ) {
+    if ( widget )
+    {
         QKeyEvent e( QEvent::KeyPress, Key_C, 'C', ControlButton );
         QApplication::sendEvent( widget, &e );
     }
@@ -935,11 +971,12 @@ void KitaMainWindow::slotEditCopy()
 /* when window is deactivated, emit signal to popup */ /* protected */
 void KitaMainWindow::windowActivationChange ( bool  )
 {
-   if(!isActiveWindow()) emit windowDeactivated();
+    if(!isActiveWindow()) emit windowDeactivated();
 }
 
 /* private slot */
-void KitaMainWindow::slotIsKitaActive(){
+void KitaMainWindow::slotIsKitaActive()
+{
     if(isActiveWindow()) emit kitaIsActive();
 }
 
index e9b70bf..0470160 100644 (file)
@@ -32,11 +32,6 @@ namespace KParts
     class Part;
 }
 
-namespace Kita
-{
-    class Thread;
-}
-
 /**
  * This class serves as the main window for Kita.  It handles the
  * menus, toolbars, and status bars.
@@ -111,16 +106,14 @@ private slots:
     void closeSubjectView();
     void closeBoardView();
 
-    void changeStatusbar( const QString& text );
-    void changeCaption( const QString& text );
+    void slotSetMainStatusbar( const QString& statusStr );
     void slotOpenURLRequest( const KURL& url, const KParts::URLArgs& );
     void setFont( const QFont& font );
-    void setThreadFont( const QFont& font );
     void slotWriteSucceeded();
     void slotURLLine();
     void setUrl( const KURL& url );
     void bookmark( const QString& datURL, bool on );
-    void slotThread( const Kita::Thread* thread );
+    void slotSetMainCaption( const QString& captionStr );
     void slotIsKitaActive();
     void switchSubjectView( const QString&, bool );
     void switchThreadView( const QString&, bool );
index cc3ff6e..3109c93 100644 (file)
@@ -44,6 +44,8 @@ KitaSubjectTabWidget::KitaSubjectTabWidget( QWidget* parent, const char* name, W
              SLOT( deleteView( KitaSubjectView* ) ) );
     connect( signalCollection, SIGNAL( openBoardRequested( const QString&, bool ) ),
              SLOT( loadBoard( const QString&, bool ) ) );
+    connect( signalCollection, SIGNAL( updateSubjectTab( const KURL& ) ),
+             SLOT( slotUpdateSubjectTab( const KURL& ) ) );
 }
 
 KitaSubjectTabWidget::~KitaSubjectTabWidget()
@@ -53,10 +55,13 @@ void KitaSubjectTabWidget::loadBoard( const QString& boardURL, bool withNewTab )
 {
     KitaSubjectView * view = findView( boardURL );
     QString boardName = Kita::Board::getName( boardURL );
-    if ( view ) {
+    if ( view )
+    {
         m_latestView = view;
         setTabLabel( m_latestView, boardName );
-    } else if ( withNewTab ) {
+    }
+    else if ( withNewTab )
+    {
         KitaSubjectView * newView = new KitaSubjectView( this );
         connectSignals( newView );
         connect( newView, SIGNAL( loadBoardCompleted( const KURL& ) ),
@@ -64,7 +69,9 @@ void KitaSubjectTabWidget::loadBoard( const QString& boardURL, bool withNewTab )
         insertTab( newView, boardName, count() - 1 );
         m_latestView = newView;
         m_viewList.append( newView );
-    } else {
+    }
+    else
+    {
         setTabLabel( m_latestView, boardName );
     }
 
@@ -73,14 +80,19 @@ void KitaSubjectTabWidget::loadBoard( const QString& boardURL, bool withNewTab )
     showPage( m_latestView );
 }
 
-void KitaSubjectTabWidget::updateThread( const Kita::Thread* thread )
+void KitaSubjectTabWidget::slotUpdateSubjectTab( const KURL& datURL )
 {
-    for ( int i = 0; i < count(); i++ ) {
+    Kita::Thread* thread = Kita::Thread::getByURL( datURL.prettyURL() );
+    for ( int i = 0; i < count(); i++ )
+    {
         QWidget* widget = page( i );
         // TODO: class¤ÇȽÄꤷ¤è¤¦¡£
-        if ( QString::compare( widget->name(), "favoriteTab" ) == 0 ) {
+        if ( QString::compare( widget->name(), "favoriteTab" ) == 0 )
+        {
             static_cast<FavoriteListView*>( widget ) ->updateThread( thread );
-        } else {
+        }
+        else
+        {
             static_cast<KitaSubjectView*>( widget ) ->updateThread( thread );
         }
     }
@@ -95,11 +107,14 @@ void KitaSubjectTabWidget::connectSignals( Kita::ThreadListView* view )
 KitaSubjectView* KitaSubjectTabWidget::findView( const QString& boardURL )
 {
     KitaSubjectView * view;
-    for ( view = m_viewList.first(); view; view = m_viewList.next() ) {
-        if ( view->boardURL() == boardURL ) {
+    for ( view = m_viewList.first(); view; view = m_viewList.next() )
+    {
+        if ( view->boardURL() == boardURL )
+        {
             return view;
         }
-        if ( view->boardURL().isEmpty() ) {
+        if ( view->boardURL().isEmpty() )
+        {
             return view;  // default view
         }
     }
@@ -108,16 +123,20 @@ KitaSubjectView* KitaSubjectTabWidget::findView( const QString& boardURL )
 
 void KitaSubjectTabWidget::slotCurrentChanged( QWidget* widget )
 {
-    if ( QString::compare( widget->name(), "favoriteTab" ) == 0 ) {
+    if ( QString::compare( widget->name(), "favoriteTab" ) == 0 )
+    {
         m_favoriteList->update();
-    } else {
+    }
+    else
+    {
         m_latestView = static_cast<KitaSubjectView*>( widget );
     }
 }
 
 void KitaSubjectTabWidget::deleteView( KitaSubjectView* view )
 {
-    if ( count() <= 2 ) {
+    if ( count() <= 2 )
+    {
         return ;
         // favorite¤È¤³¤ì¤À¤±¤Î¤È¤­¤Ï²¿¤â¤·¤Ê¤¤
     }
@@ -153,13 +172,15 @@ void Kita::SubjectTabBar::contextMenuEvent( QContextMenuEvent* e )
 
     QTabWidget* parent = static_cast<QTabWidget *>( parentWidget() );
     // FIXME: ¤Þ¤È¤â¤ÊȽÄê¤ò»È¤¦¤³¤È
-    if ( QString::compare( parent->currentPage() ->name(), "favoriteTab" ) == 0 ) {
+    if ( QString::compare( parent->currentPage() ->name(), "favoriteTab" ) == 0 )
+    {
         return ;
     }
     KitaSubjectView* subjectView = static_cast<KitaSubjectView *>( parent->currentPage() );
     QClipboard* clipboard = QApplication::clipboard();
 
-    switch ( popup.exec( e->globalPos() ) ) {
+    switch ( popup.exec( e->globalPos() ) )
+    {
     case 0:
         KRun::runURL( subjectView->boardURL(), "text/html" );
         break;
index acdcbe3..7829994 100644 (file)
@@ -30,7 +30,7 @@ public:
 
 public slots:
     void loadBoard( const QString&, bool withNewTab = false );
-    void updateThread( const Kita::Thread* );
+    void slotUpdateSubjectTab( const KURL& datURL );
     void reloadSubjectList();
 
 private:
index 4248112..db639f9 100644 (file)
@@ -146,13 +146,15 @@ void KitaThreadTabWidget::showAlternativeView( const KURL& url, const QString& l
     }
 }
 
-void KitaThreadTabWidget::connectSignals( KitaThreadView* view )
+void KitaThreadTabWidget::connectSignals( KitaThreadView* )
 {
     Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
-    connect( this, SIGNAL( signalChangeStatusbar( const QString& ) ),
-             signalCollection, SIGNAL( signalChangeStatusbar( const QString& ) ) );
-    connect( signalCollection, SIGNAL( signalThread( const Kita::Thread* ) ),
-             this, SLOT( slotThread( const Kita::Thread* ) ) );
+    connect( this, SIGNAL( setMainStatusbar( const QString& ) ),
+             signalCollection, SIGNAL( setMainStatusbar( const QString& ) ) );
+    connect( this, SIGNAL( setMainCaption( const QString& ) ),
+             signalCollection, SIGNAL( setMainCaption( const QString& ) ) );
+    connect( signalCollection, SIGNAL( updateThreadTab( const KURL& ) ),
+             this, SLOT( slotUpdateThreadTab( const KURL& ) ) );
 }
 
 KitaThreadView* KitaThreadTabWidget::findView( const QString& threadURL )
@@ -200,8 +202,8 @@ void KitaThreadTabWidget::deleteView( QWidget* v )
             connectSignals( view );
 
             showPage( view );
-            emit signalChangeStatusbar( "" );
-            topLevelWidget() ->setCaption( "" );
+            emit setMainStatusbar( "" );
+            emit setMainCaption( "" );
         }
     }
 }
@@ -275,8 +277,9 @@ const QString KitaThreadTabWidget::getTabLabel( const QString &name )
         return title;
 }
 
-void KitaThreadTabWidget::slotThread( const Kita::Thread* thread )
+void KitaThreadTabWidget::slotUpdateThreadTab( const KURL& datURL )
 {
+    Kita::Thread* thread = Kita::Thread::getByURL( datURL.prettyURL() );
     KitaThreadView * view = findView( thread->url() );
     if ( view )
         setTabLabel( currentPage(), QString( "%1 (%2)" ).arg( getTabLabel( thread->name() ) ).arg( thread->resNum() ) );
index 83e6262..6c81ea4 100644 (file)
@@ -49,7 +49,7 @@ public slots:
     void closeCurrentTab();
     void showAlternativeView( const KURL&, const QString&, const QString& );
 
-    
+
 private:
     void connectSignals( KitaThreadView* );
     KitaThreadView* createView();
@@ -58,10 +58,11 @@ private:
     const QString getTabLabel( const QString &name );
 
 private slots:
-    void slotThread( const Kita::Thread* );
+    void slotUpdateThreadTab( const KURL& datURL );
 
 signals:
-    void signalChangeStatusbar( const QString& );
+    void setMainStatusbar( const QString& );
+    void setMainCaption( const QString& );
     void sigHideSubject();
 };
 
index 8c2b52c..362beb7 100644 (file)
@@ -16,8 +16,6 @@
 
 namespace Kita
 {
-    class Thread;
-
     /**
     @author Hideki Ikemoto
     */
@@ -34,14 +32,22 @@ namespace Kita
     
     signals:
         void openURLRequest( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs() );
-        void signalChangeStatusbar( const QString& );
         void writeSucceeded();
         void bookmarked( const QString& datURL, bool on );
-        void showThreadCompleted( const KURL& threadUrl );
-        void signalThread( const Kita::Thread* );
         void openBoardRequested( const QString& boardURL, bool withNewTab );
         void favoritesUpdated();
 
+       /* to : KitaSubjectTabWidget */
+       void updateSubjectTab( const KURL& datURL );
+
+       /* to : KitaThreadTabWidget */
+       void updateThreadTab( const KURL& datURL );
+       
+       /* to : KitaMainWindow */
+       void setMainURLLine( const KURL& url );
+       void setMainCaption( const QString& captionStr );
+       void setMainStatusbar( const QString& statusStr );
+       
        /* from: KitaMainWindow, KitaNavi, KitaWriteDialog */
        /* to  : KitaHTMLPart                              */
        void windowDeactivated();
@@ -49,10 +55,13 @@ namespace Kita
 
        /* from: KitaHTMLPart                              */
        /* to  : KitaMainWindow, KitaNavi, KitaWriteDialog */
+       /* see also KitaHTMLPart::slotOnURL                */
        void isKitaActive();
 
        /* to : KitaHTMLPart */
-       void redrawScreen( const KURL& url, bool force );
+       void redrawHTMLPart( const KURL& url, bool force );
+       void redrawAllHTMLPart( bool force );
+       void setFontOfHTMLPart();
     };
 
 }
index 6294961..958503d 100644 (file)
@@ -191,6 +191,7 @@ void KitaDomTree::redraw( bool force ){
     if ( ! m_datInfo ) return;
     if ( m_hdoc == NULL ) return;
     StopParseThread();
+    m_datInfo->resetAbone();
     
     for ( int i = 1; i <= m_maxNum; i++ ){
 
index 0457ca9..4b1796c 100644 (file)
@@ -121,8 +121,10 @@ void KitaHTMLPart::connectSignals(){
 
 
     /* rendering */
-    connect( this, SIGNAL( redrawScreen( const KURL&, bool ) ), signalCollection, SIGNAL( redrawScreen( const KURL&, bool ) ));
-    connect( signalCollection, SIGNAL( redrawScreen( const KURL&, bool ) ), SLOT( slotRedrawScreen( const KURL& , bool) ));
+    connect( this, SIGNAL( redrawHTMLPart( const KURL&, bool ) ), signalCollection, SIGNAL( redrawHTMLPart( const KURL&, bool ) ));
+    connect( signalCollection, SIGNAL( redrawHTMLPart( const KURL&, bool ) ), SLOT( slotRedrawHTMLPart( const KURL& , bool) ));
+    connect( signalCollection, SIGNAL( redrawAllHTMLPart( bool ) ), SLOT( slotRedrawAllHTMLPart( bool ) ));
+    connect( signalCollection, SIGNAL( setFontOfHTMLPart() ), SLOT( slotSetFontOfHTMLPart() ));
     
     /* popup */
     connect( this, SIGNAL( onURL( const QString& ) ), SLOT( slotOnURL( const QString& ) ));
@@ -314,16 +316,32 @@ void KitaHTMLPart::setInnerHTML( const QString& innerHTML )
 
 
 /* redraw screen  */
-/* This slot is connected to signalCollection.  */ /* public slot */
-void KitaHTMLPart::slotRedrawScreen( const KURL& datURL, bool force ){
+/* These slots are connected to signalCollection.  */ /* public slot */
+void KitaHTMLPart::slotRedrawHTMLPart( const KURL& datURL, bool force ){
 
     if( m_domtree == NULL ) return;
     if( m_datURL != datURL ) return;
-    
+
+    m_domtree->redraw( force );
+}
+
+/* public slot */
+void KitaHTMLPart::slotRedrawAllHTMLPart( bool force ){
+    if( m_domtree == NULL ) return;
+
     m_domtree->redraw( force );
 }
 
+/* public slot */
+void KitaHTMLPart::slotSetFontOfHTMLPart(){
 
+    QFont font = KitaConfig::threadFont();
+    
+    DOM::CSSStyleDeclaration style = htmlDocument().body().style();
+    style.setProperty( "font-family", font.family(), "" );
+    style.setProperty( "font-size", QString( "%1pt" ).arg( font.pointSize() ), "" );    
+    htmlDocument().applyChanges();
+}
 
 
 /*---------------------------------------------------------------*/
@@ -1016,8 +1034,7 @@ void KitaHTMLPart::showPopupMenu( const KURL& kurl )
                 == QMessageBox::Ok ){
                
                KitaConfig::addAboneWord( selectedText() );
-               Kita::DatManager::resetAbone( m_datURL );
-               emit redrawScreen( m_datURL, FALSE );
+               emit redrawHTMLPart( m_datURL, FALSE );
            }
            
            break;
@@ -1373,8 +1390,7 @@ void KitaHTMLPart::showWritePopupMenu( const QString& refstr)
             == QMessageBox::Ok ){
                
            KitaConfig::addAboneName( namestr );
-           Kita::DatManager::resetAbone( m_datURL );
-           emit redrawScreen( m_datURL, FALSE );
+           emit redrawHTMLPart( m_datURL, FALSE );
        }
        break;
        
@@ -1438,8 +1454,7 @@ void KitaHTMLPart::showIDPopup( const QString& refstr )
                 == QMessageBox::Ok ){
                
                KitaConfig::addAboneID( strid );
-               Kita::DatManager::resetAbone( m_datURL );
-               emit redrawScreen( m_datURL, FALSE );
+               emit redrawHTMLPart( m_datURL, FALSE );
            }
            break;
 
index cf0e8c7..0a5dc27 100644 (file)
@@ -108,7 +108,9 @@ public:
 public slots:
 
     /* rendering */
-    void slotRedrawScreen( const KURL& datURL, bool force );
+    void slotRedrawHTMLPart( const KURL& datURL, bool force );
+    void slotRedrawAllHTMLPart( bool force );
+    void slotSetFontOfHTMLPart();
     
     /* cache */
     void slotReceiveData();
@@ -184,7 +186,7 @@ signals:
 
     void openWriteDialog( QString );
     void openURLRequest( const KURL& url, const KParts::URLArgs &args = KParts::URLArgs() );
-    void redrawScreen( const KURL& url, bool force );
+    void redrawHTMLPart( const KURL& url, bool force );
     
     /* cache */
     void receiveData();
index df75a99..ab7c613 100644 (file)
@@ -100,8 +100,7 @@ bool KitaThreadPart::openURL( const KURL& _url )
 {
     kdDebug() << "KitaThreadPart::openURL _url: " << _url.url() << endl;
     m_url = _url;
-    emit setWindowCaption( m_url.url() );
-    connect( Kita::SignalCollection::getInstance(), SIGNAL( showThreadCompleted( const KURL& ) ),
+    connect( m_threadview, SIGNAL( showThreadCompleted() ),
              this, SLOT( slotOpenURLResult() ) );
 
     m_threadview->showThread( m_url, Kita::DatManager::getKokoyonNum( m_url ) );
@@ -116,9 +115,8 @@ bool KitaThreadPart::closeURL()
 
 void KitaThreadPart::slotOpenURLResult()
 {
-    disconnect( Kita::SignalCollection::getInstance(), SIGNAL( showThreadCompleted( const KURL& ) ),
+    disconnect( m_threadview, SIGNAL( showThreadCompleted() ),
                 this, SLOT( slotOpenURLResult() ) );
-    emit setWindowCaption( m_threadview->threadName() );
     emit completed();
 }
 
@@ -126,7 +124,6 @@ void KitaThreadPart::guiActivateEvent ( KParts::GUIActivateEvent* event )
 {
     //KParts::ReadOnlyPart::guiActivateEvent( event );
     if ( event->activated() ){
-        emit setWindowCaption( m_threadview->threadName() );
        m_threadview->showStatusBar( QString::null );
     }
 }
index ade5575..f224ad9 100644 (file)
@@ -58,7 +58,6 @@
 #include "libkita/board.h"
 #include "libkita/signalcollection.h"
 #include "libkita/kita_misc.h"
-#include "libkita/thread.h"
 
 #define MAX_LABEL_LENGTH 60
 
@@ -127,16 +126,20 @@ KitaThreadView::KitaThreadView( QWidget* parent, const char* name )
              SLOT( slotComboActivated( int ) ) );
 
     Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
-    connect( this, SIGNAL( signalChangeStatusbar( const QString& ) ),
-             signalCollection, SIGNAL( signalChangeStatusbar( const QString& ) ) );
+    connect( this, SIGNAL( setMainStatusbar( const QString& ) ),
+             signalCollection, SIGNAL( setMainStatusbar ( const QString& ) ) );
     connect( this, SIGNAL( bookmarked( const QString&, bool ) ),
              signalCollection, SIGNAL( bookmarked( const QString&, bool ) ) );
-    connect( this, SIGNAL( showThreadCompleted( const KURL& ) ),
-             signalCollection, SIGNAL( showThreadCompleted( const KURL& ) ) );
-    connect( this, SIGNAL( signalThread( const Kita::Thread* ) ),
-             signalCollection, SIGNAL( signalThread( const Kita::Thread* ) ) );
+    connect( this, SIGNAL( setMainURLLine( const KURL& ) ),
+             signalCollection, SIGNAL( setMainURLLine( const KURL& ) ) );
+    connect( this, SIGNAL( updateSubjectTab( const KURL& ) ),
+             signalCollection, SIGNAL( updateSubjectTab( const KURL& ) ));
+    connect( this, SIGNAL( updateThreadTab( const KURL& ) ),
+             signalCollection, SIGNAL( updateThreadTab( const KURL& ) ));
     connect( this, SIGNAL( openBoardRequested( const QString&, bool ) ),
              signalCollection, SIGNAL( openBoardRequested( const QString&, bool ) ) );
+    connect( this, SIGNAL( setMainCaption( const QString& ) ),
+             signalCollection, SIGNAL( setMainCaption( const QString& ) ) );
     
     m_viewmode = VIEWMODE_PARENT;
     m_rescode = 200;
@@ -605,21 +608,14 @@ void KitaThreadView::showStatusBar( QString info )
                   QString( " [Total: %1 New: %2] %3 k" ).arg( totalNum ).arg( totalNum - kokoyonNum ).arg( datSize / 1024 )
                   + info + " " + errstr;
 
-        emit signalChangeStatusbar( infostr );
-        emit showThreadCompleted( Kita::DatManager::threadURL( m_datURL ) );
-        topLevelWidget() ->setCaption( Kita::DatManager::threadName( m_datURL ) );
+        emit setMainStatusbar( infostr );
+        emit setMainURLLine( Kita::DatManager::threadURL( m_datURL ) );
 
         return;
         break;
 
-    case VIEWMODE_KITANAVI:
-
-        QString infostr = QString( "[%1] %2" )
-           .arg( Kita::DatManager::boardName( m_datURL ) )
-           .arg( Kita::DatManager::threadName( m_datURL ) );
-        emit signalChangeStatusbar( infostr );
-
-        return;
+    default:
+       
         break;
     }
 }
@@ -640,7 +636,7 @@ void KitaThreadView::slotUpdateInfo()
                     + QString( " (%1)" )
                     .arg( Kita::DatManager::getMaxResNumber(m_datURL) ),
                     Kita::DatManager::thread_boardURL( m_datURL ) );
-    emit showThreadCompleted( Kita::DatManager::thread_url(m_datURL) );
+    emit setMainURLLine( Kita::DatManager::thread_url(m_datURL) );
     updateButton();
     
     gotoCombo->clear();
@@ -653,8 +649,15 @@ void KitaThreadView::slotUpdateInfo()
     gotoCombo->insertItem( Kita::ParseMisc::utf8ToUnicode( KITAUTF8_SAIGO ) );
     gotoCombo->adjustSize();
     
-    emit signalThread( Kita::Thread::getByURL( m_datURL.prettyURL() ) );
+    emit updateSubjectTab( m_datURL );
+    emit updateThreadTab( m_datURL );
+
+    QString captionStr = Kita::DatManager::thread_name( m_datURL )
+       + QString( " (%1)" ).arg( Kita::DatManager::getMaxResNumber( m_datURL ) );
+    emit setMainCaption( captionStr );    
     showStatusBar( "" );
+
+    emit showThreadCompleted(); /* to KitaThreadPart */
 }
 
 
index 38ff0fd..c215df9 100644 (file)
@@ -117,9 +117,7 @@ private slots:
     void slotDeleteButtonClicked();
 
 signals:
-    void showThreadCompleted( const KURL& threadUrl );
     void datURLRedirected( const KURL& newDatURL );
-    void signalChangeStatusbar( const QString& );
     void postResponse( const QString& response, const KURL& bbscgi = KURL() );
     //re-impl signals of KParts::Browserextension of KHTMLPart
     void openURLRequest( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs() );
@@ -127,9 +125,14 @@ signals:
     void setLocationBarURL( const QString& url );
     void enableAction( const char* name, bool enabled );
     void popupMenu( KXMLGUIClient*, const QPoint&, const KURL&, const QString&, mode_t );
-    void signalThread( const Kita::Thread* );
+    void updateSubjectTab( const KURL& datURL );
+    void updateThreadTab( const KURL& datURL );
+    void setMainURLLine( const KURL& url );
+    void setMainCaption( const QString& captionStr );
+    void setMainStatusbar( const QString& statusStr );
     void bookmarked( const QString& datURL, bool on );
     void openBoardRequested( const QString& URL, bool useTab );
+    void showThreadCompleted(); /* to KitaThreadPart */
 };
 
 namespace Kita
index e4e17de..0ab7264 100644 (file)
@@ -28,6 +28,7 @@
 #include <qvbox.h>
 
 #include "libkita/kitaconfig.h"
+#include "libkita/signalcollection.h"
 #include "kitafontprefbase.h"
 #include "debugprefbase.h"
 #include "aboneprefpage.h"
@@ -49,9 +50,6 @@ KitaPreferences::KitaPreferences()
     connect( m_fontPage, SIGNAL( fontChanged( const QFont& ) ),
              SIGNAL( fontChanged( const QFont& ) ) );
 
-    connect( m_fontPage, SIGNAL( threadFontChanged( const QFont& ) ),
-             SIGNAL( threadFontChanged( const QFont& ) ) );
-
     QVBox * colorFrame = addVBoxPage( i18n( "Color" ), i18n( "Color" ) );
     m_colorPage = new KitaColorPrefPage( colorFrame );
 
@@ -60,7 +58,7 @@ KitaPreferences::KitaPreferences()
 
     QVBox * uiFrame = addVBoxPage( i18n( "User Interface" ), i18n( "User Interface" ) );
     m_uiPage = new Kita::UIPrefPage( uiFrame );
-    
+
     QVBox * aboneFrame = addVBoxPage( i18n( "Abone" ), i18n( "Abone" ) );
     m_abonePage = new Kita::AbonePrefPage( aboneFrame );
 
@@ -77,8 +75,9 @@ KitaPreferences::KitaPreferences()
 void KitaPreferences::slotApply()
 {
     qDebug("activePageIndex = %d", activePageIndex() );
-    switch( activePageIndex() ) {
-    // TODO: refactoring.
+    switch( activePageIndex() )
+    {
+        // TODO: refactoring.
     case 0:
         // font
         m_fontPage->apply();
@@ -119,7 +118,13 @@ KitaFontPrefPage::KitaFontPrefPage( QWidget* parent )
     connect( threadFontButton, SIGNAL( clicked() ),
              SLOT( slotThreadFontButtonClicked() ) );
 
+    Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
+    connect( this, SIGNAL( setFontOfHTMLPart() ),
+             signalCollection, SIGNAL( setFontOfHTMLPart() ));
+
     updateButtons();
+
+    m_threadFontchanged = FALSE;
 }
 
 void KitaPreferences::slotOk()
@@ -131,24 +136,30 @@ void KitaPreferences::slotOk()
     m_abonePage->apply();
 
     KDialogBase::slotOk();
-} 
+}
 
 void KitaFontPrefPage::apply()
 {
     QFont font = fontButton->font();
     KitaConfig::setFont( font );
     emit fontChanged( font );
-    
-    QFont threadFont = threadFontButton->font();
-    KitaConfig::setThreadFont( threadFont );
-    emit threadFontChanged( threadFont );
+
+    if( m_threadFontchanged )
+    {
+        QFont threadFont = threadFontButton->font();
+        KitaConfig::setThreadFont( threadFont );
+        emit setFontOfHTMLPart(); /* to all HTMLPart */
+    }
+
+    m_threadFontchanged = FALSE;
 }
 
 void KitaFontPrefPage::slotFontButtonClicked()
 {
     QFont font = fontButton->font();
 
-    if ( KFontDialog::getFont( font, false, this ) == QDialog::Accepted ) {
+    if ( KFontDialog::getFont( font, false, this ) == QDialog::Accepted )
+    {
         fontButton->setText( font.family() + " " + QString::number( font.pointSize() ) );
         fontButton->setFont( font );
         emit changed();
@@ -159,10 +170,12 @@ void KitaFontPrefPage::slotThreadFontButtonClicked()
 {
     QFont threadFont = threadFontButton->font();
 
-    if ( KFontDialog::getFont( threadFont, false, this ) == QDialog::Accepted ) {
+    if ( KFontDialog::getFont( threadFont, false, this ) == QDialog::Accepted )
+    {
         threadFontButton->setText( threadFont.family() + " " + QString::number( threadFont.pointSize() ) );
         threadFontButton->setFont( threadFont );
         emit changed();
+        m_threadFontchanged = TRUE;
     }
 }
 
@@ -204,7 +217,8 @@ void DebugPrefPage::replace()
     QString fromURL = fromURLLine->text();
     QString toURL = toURLLine->text();
 
-    if ( toURL.find( fromURL ) == 0 ) {
+    if ( toURL.find( fromURL ) == 0 )
+    {
         QMessageBox::critical( this, i18n( "replace" ),
                                i18n( "'To' URL must not contain 'From' URL." ) );;
         return ;
@@ -215,7 +229,8 @@ void DebugPrefPage::replace()
                                      "Please create backups of '~/.kde/share/apps/kita/cache'\n"
                                      "and '~/.kde/share/apps/kita/favorites.xml' before performing.\n"
                                      "Are you ready?" ), QMessageBox::Ok,
-                               QMessageBox::Cancel | QMessageBox::Default | QMessageBox::Escape ) == QMessageBox::Ok ) {
+                               QMessageBox::Cancel | QMessageBox::Default | QMessageBox::Escape ) == QMessageBox::Ok )
+    {
         FavoriteThreads::replace( fromURL, toURL );
         Kita::Thread::replace( fromURL, toURL );
         KitaThreadInfo::replace( fromURL, toURL );
index 8c68820..418d4e7 100644 (file)
@@ -56,16 +56,17 @@ private:
 private slots:
     void slotChanged();
     virtual void slotOk();
-    
+
 signals:
     void fontChanged( const QFont& );
-    void threadFontChanged( const QFont& );
 };
 
 class KitaFontPrefPage : public KitaFontPrefBase
 {
     Q_OBJECT
 
+    bool m_threadFontchanged;
+
 public:
     KitaFontPrefPage( QWidget* parent = 0 );
     void apply();
@@ -79,7 +80,7 @@ private:
 
 signals:
     void fontChanged( const QFont& );
-    void threadFontChanged( const QFont& );
+    void setFontOfHTMLPart();
     void changed();
 };
 
@@ -90,7 +91,7 @@ class KitaColorPrefPage : public KitaColorPrefBase
 public:
     KitaColorPrefPage( QWidget* parent = 0 );
     void apply();
-    
+
 signals:
     void changed();
 };
@@ -115,7 +116,7 @@ namespace Kita
         AsciiArtPrefPage( QWidget* parent = 0 );
     public slots:
         void commit();
-        
+
     signals:
         void changed();
     };
@@ -126,7 +127,7 @@ namespace Kita
     public:
         UIPrefPage( QWidget* parent = 0 );
         void apply();
-        
+
     signals:
         void changed();
     };