#include <ktextedit.h>
#include "libkita/kitaconfig.h"
+#include "libkita/signalcollection.h"
using namespace Kita;
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"
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 );
};
}
#include "kitasubjecttabwidget.h"
#include "kitanavi.h"
-#include "libkita/thread.h"
#include "libkita/favoritethreads.h"
#include "libkita/kita_misc.h"
#include "libkita/kitaconfig.h"
// 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 ) ) );
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() ) );
connect( signalCollection, SIGNAL( bookmarked( const QString&, bool ) ),
SLOT( bookmark( const QString&, bool ) ) );
-
+
connect( m_urlLine, SIGNAL( returnPressed() ),
SLOT( slotURLLine() ) );
saveAboneIDList();
saveAboneNameList();
saveAboneWordList();
-
+
saveAsciiArt();
saveCompletion();
#if 0
// download the contents
- if ( KIO::NetAccess::download( url, target ) ) {
+ if ( KIO::NetAccess::download( url, target ) )
+ {
// set our caption
setCaption( url );
"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" ),
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 );
}
}
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();
{
// 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();
}
}
{
// 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();
}
}
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 );
}
}
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()
/* 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() ),
connect( this, SIGNAL( kitaIsActive() ),
Kita::SignalCollection::getInstance(), SIGNAL( kitaIsActive() ) );
-
+
setView( m_mainDock );
setMainDockWidget( m_mainDock );
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;
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 );
}
}
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;
}
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;
}
m_boardView->setFont( font );
}
-void KitaMainWindow::setThreadFont( const QFont& font )
-{
- m_threadTab->setFont( font );
-}
void KitaMainWindow::slotWriteSucceeded()
{
{
FavoriteThreads * favorite = FavoriteThreads::getInstance();
- if ( on ) {
+ if ( on )
+ {
favorite->insert( datURL );
- } else {
+ }
+ else
+ {
favorite->remove( datURL );
}
emit favoritesUpdated();
{
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 );
{
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();
{
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;
}
}
{
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;
}
}
{
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 );
{
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();
{
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;
}
}
{
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;
}
}
{
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;
}
}
{
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 )
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 );
}
/* 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();
}
class Part;
}
-namespace Kita
-{
- class Thread;
-}
-
/**
* This class serves as the main window for Kita. It handles the
* menus, toolbars, and status bars.
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 );
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()
{
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& ) ),
insertTab( newView, boardName, count() - 1 );
m_latestView = newView;
m_viewList.append( newView );
- } else {
+ }
+ else
+ {
setTabLabel( m_latestView, boardName );
}
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 );
}
}
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
}
}
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¤È¤³¤ì¤À¤±¤Î¤È¤¤Ï²¿¤â¤·¤Ê¤¤
}
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;
public slots:
void loadBoard( const QString&, bool withNewTab = false );
- void updateThread( const Kita::Thread* );
+ void slotUpdateSubjectTab( const KURL& datURL );
void reloadSubjectList();
private:
}
}
-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 )
connectSignals( view );
showPage( view );
- emit signalChangeStatusbar( "" );
- topLevelWidget() ->setCaption( "" );
+ emit setMainStatusbar( "" );
+ emit setMainCaption( "" );
}
}
}
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() ) );
void closeCurrentTab();
void showAlternativeView( const KURL&, const QString&, const QString& );
-
+
private:
void connectSignals( KitaThreadView* );
KitaThreadView* createView();
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();
};
namespace Kita
{
- class Thread;
-
/**
@author Hideki Ikemoto
*/
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();
/* 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();
};
}
if ( ! m_datInfo ) return;
if ( m_hdoc == NULL ) return;
StopParseThread();
+ m_datInfo->resetAbone();
for ( int i = 1; i <= m_maxNum; i++ ){
/* 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& ) ));
/* 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();
+}
/*---------------------------------------------------------------*/
== QMessageBox::Ok ){
KitaConfig::addAboneWord( selectedText() );
- Kita::DatManager::resetAbone( m_datURL );
- emit redrawScreen( m_datURL, FALSE );
+ emit redrawHTMLPart( m_datURL, FALSE );
}
break;
== QMessageBox::Ok ){
KitaConfig::addAboneName( namestr );
- Kita::DatManager::resetAbone( m_datURL );
- emit redrawScreen( m_datURL, FALSE );
+ emit redrawHTMLPart( m_datURL, FALSE );
}
break;
== QMessageBox::Ok ){
KitaConfig::addAboneID( strid );
- Kita::DatManager::resetAbone( m_datURL );
- emit redrawScreen( m_datURL, FALSE );
+ emit redrawHTMLPart( m_datURL, FALSE );
}
break;
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();
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();
{
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 ) );
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();
}
{
//KParts::ReadOnlyPart::guiActivateEvent( event );
if ( event->activated() ){
- emit setWindowCaption( m_threadview->threadName() );
m_threadview->showStatusBar( QString::null );
}
}
#include "libkita/board.h"
#include "libkita/signalcollection.h"
#include "libkita/kita_misc.h"
-#include "libkita/thread.h"
#define MAX_LABEL_LENGTH 60
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;
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;
}
}
+ 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();
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 */
}
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() );
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
#include <qvbox.h>
#include "libkita/kitaconfig.h"
+#include "libkita/signalcollection.h"
#include "kitafontprefbase.h"
#include "debugprefbase.h"
#include "aboneprefpage.h"
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 );
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 );
void KitaPreferences::slotApply()
{
qDebug("activePageIndex = %d", activePageIndex() );
- switch( activePageIndex() ) {
- // TODO: refactoring.
+ switch( activePageIndex() )
+ {
+ // TODO: refactoring.
case 0:
// font
m_fontPage->apply();
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()
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();
{
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;
}
}
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 ;
"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 );
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();
signals:
void fontChanged( const QFont& );
- void threadFontChanged( const QFont& );
+ void setFontOfHTMLPart();
void changed();
};
public:
KitaColorPrefPage( QWidget* parent = 0 );
void apply();
-
+
signals:
void changed();
};
AsciiArtPrefPage( QWidget* parent = 0 );
public slots:
void commit();
-
+
signals:
void changed();
};
public:
UIPrefPage( QWidget* parent = 0 );
void apply();
-
+
signals:
void changed();
};