OSDN Git Service

use pointer
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Fri, 2 Jan 2004 12:33:10 +0000 (12:33 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Fri, 2 Jan 2004 12:33:10 +0000 (12:33 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@767 56b19765-1e22-0410-a548-a0f45d66c51a

17 files changed:
kita/src/favoritelistview.cpp
kita/src/favoritelistview.h
kita/src/kita.cpp
kita/src/kita.h
kita/src/kitasubjecttabwidget.cpp
kita/src/kitasubjecttabwidget.h
kita/src/kitasubjectview.cpp
kita/src/kitasubjectview.h
kita/src/kitathreadtabwidget.cpp
kita/src/kitathreadtabwidget.h
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/part/kitawritedialog.cpp
kita/src/part/kitawritedialog.h

index 8818711..b097f00 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #include "favoritelistview.h"
 
 #include <kdebug.h>
 #include <klistview.h>
 
-FavoriteListView::FavoriteListView(QWidget* parent, const char *name)
: Kita::ThreadListView(parent, name)
+FavoriteListView::FavoriteListView( QWidget* parent, const char* name )
       : Kita::ThreadListView( parent, name )
 {
-  connect( subjectList, SIGNAL( clicked( QListViewItem* ) ),
-                 SLOT( loadThread( QListViewItem* ) ) );
-  connect( subjectList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
-                 SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) );
+    connect( subjectList, SIGNAL( clicked( QListViewItem* ) ),
+             SLOT( loadThread( QListViewItem* ) ) );
+    connect( subjectList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
+             SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) );
 }
 
 FavoriteListView::~FavoriteListView()
-{
-}
+{}
 
 void FavoriteListView::update()
 {
-  // FIXME: KitaSubjectView::loadBoard()¤Ë¥³¥Ô¡¼
-  {
-    m_hitList.clear();
-    m_nextHitIndex = 0;
-    m_prevquery = "";
-  }
-  
-  const QDict<Kita::Thread>& threads = FavoriteThreads::getInstance()->threads();
-//  FavoriteThreads::const_iterator it;
-
-  subjectList->clear();
-
-  KitaThreadInfo* cache = KitaThreadInfo::getInstance();
-
-  QDictIterator<Kita::Thread> it( threads );
-  for(; it.current(); ++it) {
-    const Kita::Thread* thread = it.current();
-
-    int readNum = cache->readNum( thread->datURL() );
-    int resNum = cache->resNum( thread->datURL() );  // TODO unused variables.
-
-    KListViewItem* item = new KListViewItem( subjectList );
-    item->setText( Row_Board, thread->boardName() );
-    item->setText( Row_Subject, thread->name() );
-    item->setText( Row_Read, QString("%1").arg( readNum, 4 ) );
-    item->setText( Row_DatName, KURL( thread->datURL() ).fileName() );
-    item->setText( Row_DatURL, thread->datURL() );
-  }
+    // FIXME: KitaSubjectView::loadBoard()¤Ë¥³¥Ô¡¼
+    {
+        m_hitList.clear();
+        m_nextHitIndex = 0;
+        m_prevquery = "";
+    }
+
+    const QDict<Kita::Thread>& threads = FavoriteThreads::getInstance() ->threads();
+    //  FavoriteThreads::const_iterator it;
+
+    subjectList->clear();
+
+    KitaThreadInfo* cache = KitaThreadInfo::getInstance();
+
+    QDictIterator<Kita::Thread> it( threads );
+    for ( ; it.current(); ++it ) {
+        const Kita::Thread* thread = it.current();
+
+        int readNum = cache->readNum( thread->datURL() );
+        int resNum = cache->resNum( thread->datURL() );  // TODO unused variables.
+
+        KListViewItem* item = new KListViewItem( subjectList );
+        item->setText( Row_Board, thread->boardName() );
+        item->setText( Row_Subject, thread->name() );
+        item->setText( Row_Read, QString( "%1" ).arg( readNum, 4 ) );
+        item->setText( Row_DatName, KURL( thread->datURL() ).fileName() );
+        item->setText( Row_DatURL, thread->datURL() );
+    }
 }
 
 void FavoriteListView::loadThread( QListViewItem* item )
 {
-  if( ! item ) return;
+    if ( ! item ) return ;
 
-  const QDict<Kita::Thread>& threads = FavoriteThreads::getInstance()->threads();
-//  FavoriteThreads::const_iterator it;
+    const QDict<Kita::Thread>& threads = FavoriteThreads::getInstance() ->threads();
+    //  FavoriteThreads::const_iterator it;
 
-  QDictIterator<Kita::Thread> it( threads );
-  for(; it.current(); ++it) {
-    const Kita::Thread* thread = it.current();
+    QDictIterator<Kita::Thread> it( threads );
+    for ( ; it.current(); ++it ) {
+        const Kita::Thread* thread = it.current();
 
-    if( thread->datURL() == item->text( Row_DatURL ) ) {
-      emit signalShowThread( *thread );
+        if ( thread->datURL() == item->text( Row_DatURL ) ) {
+            emit signalShowThread( thread );
+        }
     }
-  }
 }
 
-void FavoriteListView::updateThread( const Kita::Thread& updated_thread )
+void FavoriteListView::updateThread( const Kita::Thread* updated_thread )
 {
-  for( QListViewItem* item = subjectList->firstChild(); item; item = item->nextSibling() ) {
-    if( item->text( Row_DatURL ) == updated_thread.datURL() ) {
-      item->setText( Row_ResNum, QString("%1").arg( updated_thread.resNum(), 4 ) );
+    for ( QListViewItem * item = subjectList->firstChild(); item; item = item->nextSibling() ) {
+        if ( item->text( Row_DatURL ) == updated_thread->datURL() ) {
+            item->setText( Row_ResNum, QString( "%1" ).arg( updated_thread->resNum(), 4 ) );
+        }
     }
-  }
 }
 
 // TODO: KitaSubjectView¥¯¥é¥¹¤ÎƱ¥á¥½¥Ã¥É¤È¤Û¤È¤ó¤ÉƱ¤¸
 void FavoriteListView::slotContextMenuRequested( QListViewItem* item, const QPoint& point, int )
 {
-  if( item == 0 ) {
-    return;
-  }
-
-  KPopupMenu popup( 0 );
-  popup.insertItem( i18n("Open with Web Browser"), 0 );
-  popup.insertItem( i18n("Open with new tab"), 1 );
-  popup.insertItem( i18n("Copy title and URL"), 2 );
-
-  QString datName = item->text(Row_DatName);
-  KURL datURL = KURL( item->text(Row_DatURL) );
-
-  Kita::Thread thread( datURL.url() );
-  thread.setName( item->text( Row_Subject ) );
-  thread.setResNum( item->text( Row_Read ).toInt() );
-
-  QClipboard* clipboard = QApplication::clipboard();
-
-  switch( popup.exec( point ) ) {
-  case 0:
-    KRun::runURL( thread.url(), "text/html" );
-    break;
-  case 1:
-    emit signalShowThreadWithNewTab( thread );
-    break;
-  case 2:
-    clipboard->setText( thread.name() + "\n" + thread.url() );
-    break;
-  default:
-    break;
-  }
+    if ( item == 0 ) {
+        return ;
+    }
+
+    KPopupMenu popup( 0 );
+    popup.insertItem( i18n( "Open with Web Browser" ), 0 );
+    popup.insertItem( i18n( "Open with new tab" ), 1 );
+    popup.insertItem( i18n( "Copy title and URL" ), 2 );
+
+    QString datName = item->text( Row_DatName );
+    KURL datURL = KURL( item->text( Row_DatURL ) );
+
+    Kita::Thread* thread = new Kita::Thread( datURL.url() );
+    thread->setName( item->text( Row_Subject ) );
+    thread->setResNum( item->text( Row_Read ).toInt() );
+
+    QClipboard* clipboard = QApplication::clipboard();
+
+    switch ( popup.exec( point ) ) {
+    case 0:
+        KRun::runURL( thread->url(), "text/html" );
+        break;
+    case 1:
+        emit signalShowThreadWithNewTab( thread );
+        break;
+    case 2:
+        clipboard->setText( thread->name() + "\n" + thread->url() );
+        break;
+    default:
+        break;
+    }
 }
index bf985a3..d137144 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #ifndef FAVORITELISTVIEW_H
 #define FAVORITELISTVIEW_H
  **/
 class FavoriteListView : public Kita::ThreadListView
 {
-  Q_OBJECT
+    Q_OBJECT
 
 public:
-  /**
-   * Constructor
-   *
-   * @param parent parent widget.
-   * @param name widget name.
-   */
-  FavoriteListView( QWidget* parent = 0, const char *name = 0 );
+    /**
+     * Constructor
+     *
+     * @param parent parent widget.
+     * @param name widget name.
+     */
+    FavoriteListView( QWidget* parent = 0, const char* name = 0 );
 
-  /**
-   * Destructor
-   */
-  ~FavoriteListView();
+    /**
+     * Destructor
+     */
+    ~FavoriteListView();
 
-  /**
-   *
-   */
-  void update();
+    /**
+     *
+     */
+    void update();
 
 public slots:
-  void updateThread( const Kita::Thread& updated_thread );
+    void updateThread( const Kita::Thread* updated_thread );
 
 private slots:
 
-  /**
-   * @param item clicked item.
-   */
-  void loadThread( QListViewItem* item );
-  void slotContextMenuRequested( QListViewItem*, const QPoint&, int );
+    /**
+     * @param item clicked item.
+     */
+    void loadThread( QListViewItem* item );
+    void slotContextMenuRequested( QListViewItem*, const QPoint&, int );
 
 signals:
 
-  /**
-   * @param thread É½¼¨¤¹¤ë¥¹¥ì
-   */
-  void signalShowThread( const Kita::Thread& thread );
-  void signalShowThreadWithNewTab( const Kita::Thread& thread );
+    /**
+     * @param thread É½¼¨¤¹¤ë¥¹¥ì
+     */
+    void signalShowThread( const Kita::Thread* thread );
+    void signalShowThreadWithNewTab( const Kita::Thread* thread );
 };
 
 #endif
index 36dabc2..d6ec32b 100644 (file)
@@ -66,9 +66,9 @@ KitaMainWindow::KitaMainWindow()
 
     // load completion
     loadCompletion();
-    
+
     // and a status bar
-    statusBar()->show();
+    statusBar() ->show();
 
     readDockConfig( KGlobal::config() );
 
@@ -89,21 +89,21 @@ KitaMainWindow::KitaMainWindow()
     connect( m_boardView, SIGNAL( openBoardRequested( const Kita::Board*, bool ) ),
              m_subjectView, SLOT( loadBoardWithNewTab( const Kita::Board* ) ) );
 
-    connect( m_subjectView, SIGNAL( signalShowThread( const Kita::Thread& ) ),
-             m_threadView, SLOT( showThread( const Kita::Thread& ) ) );
+    connect( m_subjectView, SIGNAL( signalShowThread( const Kita::Thread* ) ),
+             m_threadView, SLOT( showThread( const Kita::Thread* ) ) );
 
     // ad-hoc
-    connect( m_subjectView, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread& ) ),
-             m_threadView, SLOT( showThreadWithNewTab( const Kita::Thread& ) ) );
+    connect( m_subjectView, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread* ) ),
+             m_threadView, SLOT( showThreadWithNewTab( const Kita::Thread* ) ) );
 
-    connect( m_threadView, SIGNAL( thread( const Kita::Thread& ) ),
-             SLOT( updateThreadCache( const Kita::Thread& ) ) );
+    connect( m_threadView, SIGNAL( thread( const Kita::Thread* ) ),
+             SLOT( updateThreadCache( const Kita::Thread* ) ) );
 
-    connect( m_threadView, SIGNAL( thread( const Kita::Thread& ) ),
-             m_subjectView, SLOT( updateThread( const Kita::Thread& ) ) );
+    connect( m_threadView, SIGNAL( thread( const Kita::Thread* ) ),
+             m_subjectView, SLOT( updateThread( const Kita::Thread* ) ) );
 
-    connect( m_threadView, SIGNAL( thread( const Kita::Thread& ) ),
-             SLOT( slotThread( const Kita::Thread& ) ) );
+    connect( m_threadView, SIGNAL( thread( const Kita::Thread* ) ),
+             SLOT( slotThread( const Kita::Thread* ) ) );
 
     connect( m_threadView, SIGNAL( writeSucceeded() ),
              SLOT( slotWriteSucceeded() ) );
@@ -114,14 +114,14 @@ KitaMainWindow::KitaMainWindow()
     connect( m_subjectView, SIGNAL( loadBoardCompleted( const KURL& ) ),
              SLOT( setUrl( const KURL& ) ) );
 
-    connect( m_threadView, SIGNAL( bookmarked( const Kita::Thread&, bool ) ),
-             SLOT( bookmark( const Kita::Thread&, bool ) ) );
+    connect( m_threadView, SIGNAL( bookmarked( const Kita::Thread*, bool ) ),
+             SLOT( bookmark( const Kita::Thread*, bool ) ) );
 
-    QPopupMenu* popup = static_cast<QPopupMenu *>( factory()->container( "window", this ) );
+    QPopupMenu* popup = static_cast<QPopupMenu *>( factory() ->container( "window", this ) );
     connect( popup, SIGNAL( aboutToShow() ),
              SLOT( windowMenuAboutToShow() ) );
 
-    QPopupMenu* settingsPopup = static_cast<QPopupMenu *>( factory()->container( "settings", this ) );
+    QPopupMenu* settingsPopup = static_cast<QPopupMenu *>( factory() ->container( "settings", this ) );
     connect( settingsPopup, SIGNAL( aboutToShow() ),
              SLOT( settingsMenuAboutToShow() ) );
 
@@ -203,7 +203,7 @@ void KitaMainWindow::setupActions()
                        i18n( "URL Line" ),
                        0,
                        this,
-                       SLOT( slotUrlLine() )  /* dummy */,
+                       SLOT( slotUrlLine() )   /* dummy */,
                        actionCollection(), "url_line_action" );
 
     KStdAction::keyBindings( this, SLOT( optionsConfigureKeys() ), actionCollection() );
@@ -428,7 +428,7 @@ void KitaMainWindow::optionsPreferences()
 void KitaMainWindow::changeStatusbar( const QString& text )
 {
     // display the text on the statusbar
-    statusBar()->message( text );
+    statusBar() ->message( text );
 }
 
 void KitaMainWindow::changeCaption( const QString& text )
@@ -439,7 +439,7 @@ void KitaMainWindow::changeCaption( const QString& text )
 
 void KitaMainWindow::setupView()
 {
-    KDockWidget* mainDock;
+    KDockWidget * mainDock;
     mainDock = createDockWidget( "main", 0L, 0L, i18n( "main" ) );
     m_threadView = new KitaThreadTabWidget( mainDock );
     mainDock->setWidget( m_threadView );
@@ -471,15 +471,15 @@ void KitaMainWindow::slotOpenURLRequest( const KURL& url, const KParts::URLArgs&
     new KRun( url );
 }
 
-void KitaMainWindow::updateThreadCache( const Kita::Thread& thread )
+void KitaMainWindow::updateThreadCache( const Kita::Thread* thread )
 {
-    KitaThreadInfo::setReadNum( thread.datURL(), thread.resNum() );
-    KitaThreadInfo::setResNum( thread.datURL(), thread.resNum() );
+    KitaThreadInfo::setReadNum( thread->datURL(), thread->resNum() );
+    KitaThreadInfo::setResNum( thread->datURL(), thread->resNum() );
 }
 
 void KitaMainWindow::loadCache()
 {
-    KitaThreadInfo* cache = KitaThreadInfo::getInstance();
+    KitaThreadInfo * cache = KitaThreadInfo::getInstance();
     QString cacheConfigPath = locateLocal( "appdata", "cache" );
     QFile file( cacheConfigPath );
     if ( file.open( IO_ReadOnly ) ) {
@@ -490,7 +490,7 @@ void KitaMainWindow::loadCache()
 
 void KitaMainWindow::saveCache()
 {
-    KitaThreadInfo* cache = KitaThreadInfo::getInstance();
+    KitaThreadInfo * cache = KitaThreadInfo::getInstance();
     QString cacheConfigPath = locateLocal( "appdata", "cache" );
     QFile file( cacheConfigPath );
     if ( file.open( IO_WriteOnly ) ) {
@@ -518,7 +518,7 @@ void KitaMainWindow::setThreadFont( const QFont& font )
 
 void KitaMainWindow::slotWriteSucceeded()
 {
-    statusBar()->message( i18n( "posting succeeded." ) );
+    statusBar() ->message( i18n( "posting succeeded." ) );
 }
 
 void KitaMainWindow::setUrl( const KURL& url )
@@ -526,16 +526,15 @@ void KitaMainWindow::setUrl( const KURL& url )
     m_urlLine->setText( url.url() );
 }
 
-void KitaMainWindow::bookmark( const Kita::Thread& thread, bool on )
+void KitaMainWindow::bookmark( const Kita::Thread* thread, bool on )
 {
-    Kita::Thread* t = new Kita::Thread( thread.datURL(), thread.name() );
-    KitaThreadInfo::setResNum( thread.datURL(), thread.resNum() );
+    KitaThreadInfo::setResNum( thread->datURL(), thread->resNum() );
     FavoriteThreads* favorite = FavoriteThreads::getInstance();
 
     if ( on ) {
-        favorite->insert( t );
+        favorite->insert( thread );
     } else {
-        favorite->remove( t->datURL() );
+        favorite->remove( thread->datURL() );
     }
 }
 
@@ -572,18 +571,18 @@ void KitaMainWindow::saveCompletion()
     QString configPath = locateLocal( "appdata", "completion" );
     KSimpleConfig config( configPath );
 
-    config.writeEntry( "name", KitaConfig::nameCompletion()->items() );
+    config.writeEntry( "name", KitaConfig::nameCompletion() ->items() );
     config.sync();
 }
 
-void KitaMainWindow::slotThread( const Kita::Thread& thread )
+void KitaMainWindow::slotThread( const Kita::Thread* thread )
 {
-    setCaption( thread.name() );
+    setCaption( thread->name() );
 }
 
 void KitaMainWindow::slotEditCopy()
 {
-    QWidget* widget = kapp->focusWidget();
+    QWidget * widget = kapp->focusWidget();
 
     if ( widget ) {
         QKeyEvent e( QEvent::KeyPress, Key_C, 'C', ControlButton );
index efc6b61..9679eb0 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #ifndef _KITA_H_
 #define _KITA_H_
@@ -30,8 +30,9 @@ class KitaBoardView;
 class KitaSubjectTabWidget;
 class KLineEdit;
 
-namespace KParts{
-  class URLArgs;
+namespace KParts
+{
+    class URLArgs;
 };
 
 /**
@@ -60,30 +61,30 @@ public:
     /**
      * Use this method to load whatever file/URL you have
      */
-    void load(const KURL& url);
+    void load( const KURL& url );
 
 protected:
     /**
      * Overridden virtuals for Qt drag 'n drop (XDND)
      */
-    virtual void dragEnterEvent(QDragEnterEvent *event);
-    virtual void dropEvent(QDropEvent *event);
+    virtual void dragEnterEvent( QDragEnterEvent* event );
+    virtual void dropEvent( QDropEvent* event );
 
     /**
      * This function is called when it is time for the app to save its
      * properties for session management purposes.
      */
-    void saveProperties(KConfig *);
+    void saveProperties( KConfig* );
 
     /**
      * This function is called when this app is restored.  The KConfig
      * object points to the session management config file that was saved
      * with @ref saveProperties
      */
-    void readProperties(KConfig *);
+    void readProperties( KConfig* );
 
-    void readConfig(KConfig *);
-    void writeConfig(KConfig *);
+    void readConfig( KConfig* );
+    void writeConfig( KConfig* );
 
 private slots:
     void fileNew();
@@ -102,17 +103,17 @@ private slots:
     void slotEditFind();
     void slotViewReload();
 
-    void changeStatusbar(const QString& text);
-    void changeCaption(const QString& text);
-    void slotOpenURLRequest(const KURL& url, const KParts::URLArgs&);
-    void updateThreadCache( const Kita::Thread& thread );
+    void changeStatusbar( const QString& text );
+    void changeCaption( const QString& text );
+    void slotOpenURLRequest( const KURL& url, const KParts::URLArgs& );
+    void updateThreadCache( const Kita::Thread* thread );
     void setFont( const QFont& font );
     void setThreadFont( const QFont& font );
     void slotWriteSucceeded();
     void slotUrlLine();
-    void setUrl(const KURL& url);
-    void bookmark( const Kita::Thread& thread, bool on );
-    void slotThread( const Kita::Thread& thread );
+    void setUrl( const KURL& url );
+    void bookmark( const Kita::Thread* thread, bool on );
+    void slotThread( const Kita::Thread* thread );
 
 private:
     KitaThreadTabWidget* m_threadView;
@@ -120,7 +121,7 @@ private:
     KitaSubjectTabWidget* m_subjectView;
     KLineEdit* m_urlLine;
 
-    KPrinter   *m_printer;
+    KPrinter *m_printer;
     KToggleAction *m_toolbarAction;
     KToggleAction *m_statusbarAction;
     KToggleAction *m_boardListAction;
index e225c9e..c30952c 100644 (file)
@@ -1,48 +1,47 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #include "kitasubjecttabwidget.h"
 
-KitaSubjectTabWidget::KitaSubjectTabWidget(QWidget *parent, const char *name, WFlags f)
: QTabWidget(parent, name, f)
+KitaSubjectTabWidget::KitaSubjectTabWidget( QWidget* parent, const char* name, WFlags f )
       : QTabWidget( parent, name, f )
 {
-  KitaSubjectView* view = new KitaSubjectView( this );
-  addTab( view, "        " );
-  m_latestView = view;
+    KitaSubjectView * view = new KitaSubjectView( this );
+    addTab( view, "        " );
+    m_latestView = view;
 
-  m_favoriteList = new FavoriteListView( this, "favoriteTab" );
-  addTab( m_favoriteList, "Favorite" );
+    m_favoriteList = new FavoriteListView( this, "favoriteTab" );
+    addTab( m_favoriteList, "Favorite" );
 
-  connectSignals( m_favoriteList );
-  connectSignals( view );
+    connectSignals( m_favoriteList );
+    connectSignals( view );
 
-  connect( this, SIGNAL( currentChanged( QWidget* ) ),
-                 SLOT( slotCurrentChanged( QWidget* ) ) );
+    connect( this, SIGNAL( currentChanged( QWidget* ) ),
+             SLOT( slotCurrentChanged( QWidget* ) ) );
 }
 
 KitaSubjectTabWidget::~KitaSubjectTabWidget()
-{
-}
+{}
 
 // FIXME: loadBoardWithNewTab¤È¤Þ¤È¤á¤ë¤³¤È
 void KitaSubjectTabWidget::loadBoard( const Kita::Board* board )
 {
-  m_latestView->loadBoard( board );
-  showPage( m_latestView );
-  setTabLabel( m_latestView, board->name() );
+    m_latestView->loadBoard( board );
+    showPage( m_latestView );
+    setTabLabel( m_latestView, board->name() );
 }
 
 // FIXME: loadBoard¤È¤Þ¤È¤á¤ë¤³¤È
 void KitaSubjectTabWidget::loadBoardWithNewTab( const Kita::Board* board )
 {
-    KitaSubjectView* view = new KitaSubjectView( this );
+    KitaSubjectView * view = new KitaSubjectView( this );
     insertTab( view, board->name(), count() - 1 );
     m_latestView = view;
     m_latestView->loadBoard( board );
@@ -50,44 +49,44 @@ void KitaSubjectTabWidget::loadBoardWithNewTab( const Kita::Board* board )
     showPage( m_latestView );
 }
 
-void KitaSubjectTabWidget::updateThread( const Kita::Thread& thread )
+void KitaSubjectTabWidget::updateThread( const Kita::Thread* thread )
 {
-  for( int i=0; i<count(); i++ ) {
-    QWidget* widget = page( i );
-    // TODO: class¤ÇȽÄꤷ¤è¤¦¡£
-    if( QString::compare( widget->name(), "favoriteTab" ) == 0 ) {
-      static_cast<FavoriteListView*>( widget )->updateThread( thread );
-    } else {
-      static_cast<KitaSubjectView*>( widget )->updateThread( thread );
+    for ( int i = 0; i < count(); i++ ) {
+        QWidget* widget = page( i );
+        // TODO: class¤ÇȽÄꤷ¤è¤¦¡£
+        if ( QString::compare( widget->name(), "favoriteTab" ) == 0 ) {
+            static_cast<FavoriteListView*>( widget ) ->updateThread( thread );
+        } else {
+            static_cast<KitaSubjectView*>( widget ) ->updateThread( thread );
+        }
     }
-  }
 }
 
 void KitaSubjectTabWidget::connectSignals( FavoriteListView* view )
 {
-  connect( view, SIGNAL( signalShowThread( const Kita::Thread& ) ),
-           this, SIGNAL( signalShowThread( const Kita::Thread& ) ) );
-  connect( view, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread& ) ),
-           this, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread& ) ) );
-//  connect( view, SIGNAL( loadBoardCompleted( const KURL& ) ),
-//           this, SIGNAL( loadBoardCompleted( const KURL& ) ) );
+    connect( view, SIGNAL( signalShowThread( const Kita::Thread* ) ),
+             this, SIGNAL( signalShowThread( const Kita::Thread* ) ) );
+    connect( view, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread* ) ),
+             this, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread* ) ) );
+    //  connect( view, SIGNAL( loadBoardCompleted( const KURL& ) ),
+    //           this, SIGNAL( loadBoardCompleted( const KURL& ) ) );
 }
 
 void KitaSubjectTabWidget::connectSignals( KitaSubjectView* view )
 {
-  connect( view, SIGNAL( signalShowThread( const Kita::Thread& ) ),
-           this, SIGNAL( signalShowThread( const Kita::Thread& ) ) );
-  connect( view, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread& ) ),
-           this, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread& ) ) );
-  connect( view, SIGNAL( loadBoardCompleted( const KURL& ) ),
-           this, SIGNAL( loadBoardCompleted( const KURL& ) ) );
+    connect( view, SIGNAL( signalShowThread( const Kita::Thread* ) ),
+             this, SIGNAL( signalShowThread( const Kita::Thread* ) ) );
+    connect( view, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread* ) ),
+             this, SIGNAL( signalShowThreadWithNewTab( const Kita::Thread* ) ) );
+    connect( view, SIGNAL( loadBoardCompleted( const KURL* ) ),
+             this, SIGNAL( loadBoardCompleted( const KURL* ) ) );
 }
 
-void KitaSubjectTabWidget::slotCurrentChanged(QWidget* widget)
+void KitaSubjectTabWidget::slotCurrentChanged( QWidget* widget )
 {
-  if( QString::compare(widget->name(), "favoriteTab") == 0 ) {
-    m_favoriteList->update();
-  } else {
-    m_latestView = static_cast<KitaSubjectView*>( widget );
-  }
+    if ( QString::compare( widget->name(), "favoriteTab" ) == 0 ) {
+        m_favoriteList->update();
+    } else {
+        m_latestView = static_cast<KitaSubjectView*>( widget );
+    }
 }
index 6d81b2f..efb902e 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #ifndef KITASUBJECTTABWIDGET_H
 #define KITASUBJECTTABWIDGET_H
 */
 class KitaSubjectTabWidget : public QTabWidget
 {
-  Q_OBJECT
+    Q_OBJECT
 
 public:
-  KitaSubjectTabWidget(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
-  ~KitaSubjectTabWidget();
+    KitaSubjectTabWidget( QWidget* parent = 0, const char* name = 0, WFlags f = 0 );
+    ~KitaSubjectTabWidget();
 
 public slots:
-  void loadBoard( const Kita::Board* );
-  void loadBoardWithNewTab( const Kita::Board* );
-  void updateThread( const Kita::Thread& );
+    void loadBoard( const Kita::Board* );
+    void loadBoardWithNewTab( const Kita::Board* );
+    void updateThread( const Kita::Thread* );
 
 private:
-  FavoriteListView* m_favoriteList;
-  KitaSubjectView* m_latestView;
-  void connectSignals( FavoriteListView* );
-  void connectSignals( KitaSubjectView* );
+    FavoriteListView* m_favoriteList;
+    KitaSubjectView* m_latestView;
+    void connectSignals( FavoriteListView* );
+    void connectSignals( KitaSubjectView* );
 
 private slots:
-  void slotCurrentChanged(QWidget* widget);
+    void slotCurrentChanged( QWidget* widget );
 
 signals:
-  void signalShowThread( const Kita::Thread& );
-  void signalShowThreadWithNewTab( const Kita::Thread& );
-  void loadBoardCompleted( const KURL& );
+    void signalShowThread( const Kita::Thread* );
+    void signalShowThreadWithNewTab( const Kita::Thread* );
+    void loadBoardCompleted( const KURL& );
 };
 
 #endif
index 5ee2d05..8530973 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 // include files for Qt
 #include <qtoolbutton.h>
 #include "libkita/thread.h"
 #include "libkita/kita_misc.h"
 
-KitaSubjectView::KitaSubjectView(QWidget *parent, const char *name)
-  : Kita::ThreadListView(parent, name)
+KitaSubjectView::KitaSubjectView( QWidget* parent, const char* name )
+        : Kita::ThreadListView( parent, name )
 {
-  connect( subjectList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
-                        SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) );
-  connect( subjectList, SIGNAL( clicked( QListViewItem* ) ),
-                        SLOT( loadThread( QListViewItem* ) ) );
-  connect( subjectList, SIGNAL( returnPressed( QListViewItem* ) ),
-                        SLOT( loadThread( QListViewItem* ) ) );
+    connect( subjectList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
+             SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) );
+    connect( subjectList, SIGNAL( clicked( QListViewItem* ) ),
+             SLOT( loadThread( QListViewItem* ) ) );
+    connect( subjectList, SIGNAL( returnPressed( QListViewItem* ) ),
+             SLOT( loadThread( QListViewItem* ) ) );
 }
 
 KitaSubjectView::~KitaSubjectView()
-{
-}
+{}
 
 void KitaSubjectView::reloadSubject()
-{
-}
+{}
 
 void KitaSubjectView::loadThread( QListViewItem* item )
 {
-  if( ! item ) return;
+    if ( ! item ) return ;
 
-  QString datName = item->text(Row_DatName);
-  KURL datURL = m_board->url();
-  datURL.addPath("/dat/" + datName);
+    QString datName = item->text( Row_DatName );
+    KURL datURL = m_board->url();
+    datURL.addPath( "/dat/" + datName );
 
-  Kita::Board::setName( Kita::datToBoard( datURL.url() ), m_board->name() );
-  Kita::Thread* thread = new Kita::Thread( datURL.url(),
-                                           item->text( Row_Subject ) );
+    Kita::Board::setName( Kita::datToBoard( datURL.url() ), m_board->name() );
+    Kita::Thread* thread = new Kita::Thread( datURL.url(),
+                           item->text( Row_Subject ) );
 
-  KitaThreadInfo::setResNum( datURL.url(), item->text( Row_Read ).toInt() );
-  emit signalShowThread( *thread );
+    KitaThreadInfo::setResNum( datURL.url(), item->text( Row_Read ).toInt() );
+    emit signalShowThread( thread );
 }
 
-void KitaSubjectView::loadBoard(const Kita::Board* board)
+void KitaSubjectView::loadBoard( const Kita::Board* board )
 {
-  // reset member variables.
-  // FIXME: FavoriteListView::update()¤Ë¥³¥Ô¡¼
-  {
-    m_hitList.clear();
-    m_nextHitIndex = 0;
-    m_prevquery = "";
-  }
-
-  m_board = board;
-
-  KitaThreadInfo* cache = KitaThreadInfo::getInstance();
-  QPtrList<Kita::Thread> threadList = m_board->getThreadList();
-
-  // clear list
-  subjectList->clear();
-
-  for(unsigned i=0; i<threadList.count(); i++) {
-    Kita::Thread* thread = threadList.at(i);
-
-    int readNum = cache->readNum( thread->datURL() );
-    int resNum = thread->resNum();
-
-    KListViewItem* item = new KListViewItem( subjectList );
-    item->setText( Row_ID, QString("%1").arg(i+1, 4) );
-    item->setText( Row_Subject, thread->name() );
-    item->setText( Row_ResNum, QString("%1").arg( resNum, 4 ) );
-    item->setText( Row_Read, (readNum > 0) ? QString("%1").arg( readNum, 4 ) : QString("") );
-    item->setText( Row_Unread, (readNum > 0 && resNum != readNum) ? QString("%1").arg( resNum - readNum, 4 ) : QString("") );
-    item->setText( Row_Board, thread->boardName() );
-    item->setText( Row_DatName, KURL( thread->datURL() ).fileName() );
-    item->setText( Row_DatURL, thread->datURL() );
-
-    if ( readNum > 0 && resNum != readNum ) {
-      // Ì¤Æɤ¢¤ê
-      item->setPixmap( Row_Mark, SmallIcon( "unread" ) );
-    } else if ( readNum > 0 ) {
-      // ´ûÆÉ
-      item->setPixmap( Row_Mark, SmallIcon( "read" ) );
+    // reset member variables.
+    // FIXME: FavoriteListView::update()¤Ë¥³¥Ô¡¼
+    {
+        m_hitList.clear();
+        m_nextHitIndex = 0;
+        m_prevquery = "";
+    }
+
+    m_board = board;
+
+    KitaThreadInfo* cache = KitaThreadInfo::getInstance();
+    QPtrList<Kita::Thread> threadList = m_board->getThreadList();
+
+    // clear list
+    subjectList->clear();
+
+    for ( unsigned i = 0; i < threadList.count(); i++ ) {
+        Kita::Thread* thread = threadList.at( i );
+
+        int readNum = cache->readNum( thread->datURL() );
+        int resNum = thread->resNum();
+
+        KListViewItem* item = new KListViewItem( subjectList );
+        item->setText( Row_ID, QString( "%1" ).arg( i + 1, 4 ) );
+        item->setText( Row_Subject, thread->name() );
+        item->setText( Row_ResNum, QString( "%1" ).arg( resNum, 4 ) );
+        item->setText( Row_Read, ( readNum > 0 ) ? QString( "%1" ).arg( readNum, 4 ) : QString( "" ) );
+        item->setText( Row_Unread, ( readNum > 0 && resNum != readNum ) ? QString( "%1" ).arg( resNum - readNum, 4 ) : QString( "" ) );
+        item->setText( Row_Board, thread->boardName() );
+        item->setText( Row_DatName, KURL( thread->datURL() ).fileName() );
+        item->setText( Row_DatURL, thread->datURL() );
+
+        if ( readNum > 0 && resNum != readNum ) {
+            // Ì¤Æɤ¢¤ê
+            item->setPixmap( Row_Mark, SmallIcon( "unread" ) );
+        } else if ( readNum > 0 ) {
+            // ´ûÆÉ
+            item->setPixmap( Row_Mark, SmallIcon( "read" ) );
+        }
     }
-  }
 
-  if( HideButton->isOn() ) {
-    HideButton->toggle();
-  }
-  emit loadBoardCompleted(m_board->url());
+    if ( HideButton->isOn() ) {
+        HideButton->toggle();
+    }
+    emit loadBoardCompleted( m_board->url() );
 
-  subjectList->setFocus();
+    subjectList->setFocus();
 }
 
 void KitaSubjectView::setFont( const QFont& font )
 {
-  subjectList->setFont(font);
+    subjectList->setFont( font );
 }
 
-void KitaSubjectView::updateThread(const Kita::Thread& updated_thread)
+void KitaSubjectView::updateThread( const Kita::Thread* updated_thread )
 {
-  for(QListViewItem* item = subjectList->firstChild(); item; item = item->nextSibling() ) {
-    if( item->text(Row_DatURL) == updated_thread.datURL() ) {
-      int resNum = item->text( Row_ResNum ).toInt();
-      int readNum = updated_thread.resNum();
-      item->setText( Row_Read, QString("%1").arg( readNum, 4 ) );
-      item->setText( Row_Unread, readNum > 0 && resNum != readNum ? QString("%1").arg( resNum - readNum, 4 ) : QString(""));
+    for ( QListViewItem * item = subjectList->firstChild(); item; item = item->nextSibling() ) {
+        if ( item->text( Row_DatURL ) == updated_thread->datURL() ) {
+            int resNum = item->text( Row_ResNum ).toInt();
+            int readNum = updated_thread->resNum();
+            item->setText( Row_Read, QString( "%1" ).arg( readNum, 4 ) );
+            item->setText( Row_Unread, readNum > 0 && resNum != readNum ? QString( "%1" ).arg( resNum - readNum, 4 ) : QString( "" ) );
+        }
     }
-  }
 }
 
 void KitaSubjectView::slotContextMenuRequested( QListViewItem* item, const QPoint& point, int )
 {
-  if( item == 0 ) {
-    return;
-  }
-
-  KPopupMenu popup( 0 );
-  popup.insertItem( i18n("Open with Web Browser"), 0 );
-  popup.insertItem( i18n("Open with new tab"), 1 );
-  popup.insertItem( i18n("Copy title and URL"), 2 );
-
-  QString datName = item->text(Row_DatName);
-  KURL datURL = m_board->url();
-  datURL.addPath("/dat/" + datName);
-
-  Kita::Board::setName( Kita::datToBoard( datURL.url() ), m_board->name() );
-  Kita::Thread thread( datURL.url() );
-  thread.setName( item->text( Row_Subject ) );
-  thread.setResNum( item->text( Row_Read ).toInt() );
-
-  QClipboard* clipboard = QApplication::clipboard();
-
-  switch( popup.exec( point ) ) {
-  case 0:
-    KRun::runURL( thread.url(), "text/html" );
-    break;
-  case 1:
-    emit signalShowThreadWithNewTab( thread );
-    break;
-  case 2:
-    clipboard->setText( thread.name() + "\n" + thread.url() );
-    break;
-  default:
-    break;
-  }
+    if ( item == 0 ) {
+        return ;
+    }
+
+    KPopupMenu popup( 0 );
+    popup.insertItem( i18n( "Open with Web Browser" ), 0 );
+    popup.insertItem( i18n( "Open with new tab" ), 1 );
+    popup.insertItem( i18n( "Copy title and URL" ), 2 );
+
+    QString datName = item->text( Row_DatName );
+    KURL datURL = m_board->url();
+    datURL.addPath( "/dat/" + datName );
+
+    Kita::Board::setName( Kita::datToBoard( datURL.url() ), m_board->name() );
+    Kita::Thread* thread = new Kita::Thread( datURL.url() );
+    thread->setName( item->text( Row_Subject ) );
+    thread->setResNum( item->text( Row_Read ).toInt() );
+
+    QClipboard* clipboard = QApplication::clipboard();
+
+    switch ( popup.exec( point ) ) {
+    case 0:
+        KRun::runURL( thread->url(), "text/html" );
+        break;
+    case 1:
+        emit signalShowThreadWithNewTab( thread );
+        break;
+    case 2:
+        clipboard->setText( thread->name() + "\n" + thread->url() );
+        break;
+    default:
+        break;
+    }
 }
index 3fe73dc..3ddf7d8 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #ifndef _KITASUBJECTVIEW_H_
 #define _KITASUBJECTVIEW_H_
@@ -25,29 +25,29 @@ class KListViewItem;
  **/
 class KitaSubjectView : public Kita::ThreadListView
 {
-  Q_OBJECT
+    Q_OBJECT
 
 public:
-  KitaSubjectView( QWidget *parent, const char *name=0 );
-  ~KitaSubjectView();
+    KitaSubjectView( QWidget* parent, const char* name = 0 );
+    ~KitaSubjectView();
 
 public slots:
-  void reloadSubject();
-  void loadBoard( const Kita::Board* board );
-  void setFont( const QFont& font );
-  void updateThread( const Kita::Thread& thread );
+    void reloadSubject();
+    void loadBoard( const Kita::Board* board );
+    void setFont( const QFont& font );
+    void updateThread( const Kita::Thread* thread );
 
 private:
-  const Kita::Board* m_board;
+    const Kita::Board* m_board;
 
 private slots:
-  void loadThread( QListViewItem* item );
-  void slotContextMenuRequested( QListViewItem*, const QPoint&, int );
+    void loadThread( QListViewItem* item );
+    void slotContextMenuRequested( QListViewItem*, const QPoint&, int );
 
 signals:
-  void loadBoardCompleted(const KURL&);
-  void signalShowThread( const Kita::Thread& thread );
-  void signalShowThreadWithNewTab( const Kita::Thread& thread );
+    void loadBoardCompleted( const KURL& );
+    void signalShowThread( const Kita::Thread* thread );
+    void signalShowThreadWithNewTab( const Kita::Thread* thread );
 };
 
 #endif
index 37a6398..8b3e5ba 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #include "kitathreadtabwidget.h"
 
 
 #define MAX_TABLABEL_LEN 20
 
-KitaThreadTabWidget::KitaThreadTabWidget(QWidget *parent, const char *name, WFlags f)
: QTabWidget(parent, name, f)
+KitaThreadTabWidget::KitaThreadTabWidget( QWidget* parent, const char* name, WFlags f )
       : QTabWidget( parent, name, f )
 {
-  setTabBar( new KitaThreadTabBar( this ) );
-  connect( tabBar(), SIGNAL( deleteMenuSelected( KitaThreadView* ) ),
-                     SLOT( deleteView( KitaThreadView* ) ) );
+    setTabBar( new KitaThreadTabBar( this ) );
+    connect( tabBar(), SIGNAL( deleteMenuSelected( KitaThreadView* ) ),
+             SLOT( deleteView( KitaThreadView* ) ) );
 
-  KGlobal::locale()->insertCatalogue( "kitapart" );
-  KitaThreadView* view = createView();
+    KGlobal::locale() ->insertCatalogue( "kitapart" );
+    KitaThreadView* view = createView();
 
-  if( view ) {
-    addTab( view, "thread" );
-    connectSignals( view );
-  }
+    if ( view ) {
+        addTab( view, "thread" );
+        connectSignals( view );
+    }
 }
 
 KitaThreadTabWidget::~KitaThreadTabWidget()
-{
-}
+{}
 
-void KitaThreadTabWidget::showThread( const Kita::Thread& thread )
+void KitaThreadTabWidget::showThread( const Kita::Thread* thread )
 {
-  // TODO: ¥¹¥ì¤¬¤É¤³¤«¤Î¥¿¥Ö¤Ë¤¹¤Ç¤Ë¤¢¤ë¤È¤­¤Ï¤½¤ì¤ò»È¤¦
-  static_cast<KitaThreadView *>( currentPage() )->showThread( thread );
+    // TODO: ¥¹¥ì¤¬¤É¤³¤«¤Î¥¿¥Ö¤Ë¤¹¤Ç¤Ë¤¢¤ë¤È¤­¤Ï¤½¤ì¤ò»È¤¦
+    static_cast<KitaThreadView *>( currentPage() ) ->showThread( thread );
 
-  // FIXME: showThreadWithNewTab()¤Ø¥³¥Ô¡¼
-  setTabLabel( currentPage(), thread.name().left( MAX_TABLABEL_LEN ) );
-  setTabToolTip( currentPage(), thread.name() );
+    // FIXME: showThreadWithNewTab()¤Ø¥³¥Ô¡¼
+    setTabLabel( currentPage(), thread->name().left( MAX_TABLABEL_LEN ) );
+    setTabToolTip( currentPage(), thread->name() );
 }
 
 KitaThreadView* KitaThreadTabWidget::createView()
 {
-  KLibFactory* factory = KLibLoader::self()->factory( "libkitapart" );
-  if( ! factory ) {
-    QMessageBox::critical( parentWidget(),
-                           i18n( "Load Error" ),
-                           i18n( "can't load libkitapart." ) );
-    return 0;
-  }
-  KitaThreadPart* part = static_cast<KitaThreadPart *>( factory->create( this, "thread", "KitaThreadPart" ) );
-  KitaThreadView* view = static_cast<KitaThreadView *>( part->widget() );
-
-  return view;
+    KLibFactory * factory = KLibLoader::self() ->factory( "libkitapart" );
+    if ( ! factory ) {
+        QMessageBox::critical( parentWidget(),
+                               i18n( "Load Error" ),
+                               i18n( "can't load libkitapart." ) );
+        return 0;
+    }
+    KitaThreadPart* part = static_cast<KitaThreadPart *>( factory->create( this, "thread", "KitaThreadPart" ) );
+    KitaThreadView* view = static_cast<KitaThreadView *>( part->widget() );
+
+    return view;
 }
 
-void KitaThreadTabWidget::showThreadWithNewTab( const Kita::Thread& thread )
+void KitaThreadTabWidget::showThreadWithNewTab( const Kita::Thread* thread )
 {
-  KitaThreadView* view = createView();
+    KitaThreadView * view = createView();
 
-  if( view ) {
-    addTab( view, thread.name().left( MAX_TABLABEL_LEN ) );
-    setTabToolTip( view, thread.name() );
+    if ( view ) {
+        addTab( view, thread->name().left( MAX_TABLABEL_LEN ) );
+        setTabToolTip( view, thread->name() );
 
-    connectSignals( view );
-    view->showThread( thread );
-    showPage( view );
+        connectSignals( view );
+        view->showThread( thread );
+        showPage( view );
 
-    QString threadName = view->threadName();
+        QString threadName = view->threadName();
 
-    // FIXME: showThread()¤«¤é¥³¥Ô¡¼
-    setTabLabel( currentPage(), threadName.left( MAX_TABLABEL_LEN ) );
-    setTabToolTip( currentPage(), threadName );
-  }
+        // FIXME: showThread()¤«¤é¥³¥Ô¡¼
+        setTabLabel( currentPage(), threadName.left( MAX_TABLABEL_LEN ) );
+        setTabToolTip( currentPage(), threadName );
+    }
 }
 
 void KitaThreadTabWidget::connectSignals( KitaThreadView* view )
 {
-  connect( view, SIGNAL( openURLRequest( const KURL&, const KParts::URLArgs& ) ),
-           this, SLOT( slotOpenURLRequest( const KURL&, const KParts::URLArgs& ) ) );
-  connect( view, SIGNAL( signalChangeStatusbar( const QString& ) ),
-           this, SIGNAL( signalChangeStatusbar( const QString& ) ) );
-  connect( view, SIGNAL( thread( const Kita::Thread& ) ),
-           this, SIGNAL( thread( const Kita::Thread& ) ) );
-  connect( view, SIGNAL( writeSucceeded() ),
-           this, SIGNAL( writeSucceeded() ) );
-  connect( view, SIGNAL( bookmarked( const Kita::Thread&, bool ) ),
-           this, SIGNAL( bookmarked( const Kita::Thread&, bool ) ) );
-  connect( view, SIGNAL( showThreadCompleted( const KURL& ) ),
-           this, SIGNAL( showThreadCompleted( const KURL& ) ) );
+    connect( view, SIGNAL( openURLRequest( const KURL&, const KParts::URLArgs& ) ),
+             this, SLOT( slotOpenURLRequest( const KURL&, const KParts::URLArgs& ) ) );
+    connect( view, SIGNAL( signalChangeStatusbar( const QString& ) ),
+             this, SIGNAL( signalChangeStatusbar( const QString& ) ) );
+    connect( view, SIGNAL( thread( const Kita::Thread* ) ),
+             this, SIGNAL( thread( const Kita::Thread* ) ) );
+    connect( view, SIGNAL( writeSucceeded() ),
+             this, SIGNAL( writeSucceeded() ) );
+    connect( view, SIGNAL( bookmarked( const Kita::Thread*, bool ) ),
+             this, SIGNAL( bookmarked( const Kita::Thread*, bool ) ) );
+    connect( view, SIGNAL( showThreadCompleted( const KURL& ) ),
+             this, SIGNAL( showThreadCompleted( const KURL& ) ) );
 }
 
 void KitaThreadTabWidget::deleteView( KitaThreadView* view )
 {
-  kdDebug() << "deleteView(" << static_cast<void*>( view ) << ")" << endl;
-  removePage( view );
-  delete view;
+    kdDebug() << "deleteView(" << static_cast<void*>( view ) << ")" << endl;
+    removePage( view );
+    delete view;
 
-  if( count() == 0 ) {
-    KitaThreadView* view = createView();
+    if ( count() == 0 ) {
+        KitaThreadView * view = createView();
 
-    if( view ) {
-      addTab( view, "thread" );
-      connectSignals( view );
+        if ( view ) {
+            addTab( view, "thread" );
+            connectSignals( view );
 
-      showPage( view );
+            showPage( view );
+        }
     }
-  }
 }
 
 void KitaThreadTabWidget::slotOpenURLRequest( const KURL& url, const KParts::URLArgs& args )
 {
     // TODO: ¥¹¥ì¤ÎURL¤«¤É¤¦¤«¤â¤Ã¤È¸·Ì©¤Ê¥Á¥§¥Ã¥¯¤ò¤¹¤ë¤³¤È
     QRegExp regexp( "http://([^/]*)/([^/]*)/dat/(.*)\\.dat" );
-    if( regexp.search( url.url() ) == -1 ) {
+    if ( regexp.search( url.url() ) == -1 ) {
         emit openURLRequest( url, args );
     } else {
-        Kita::Thread thread( url.url() );
+        Kita::Thread* thread = new Kita::Thread( url.url() );
         showThreadWithNewTab( thread );
     }
 }
 
 void KitaThreadTabWidget::focusSearchCombo()
 {
-    static_cast<KitaThreadView *>( currentPage() )->focusSearchCombo();
+    static_cast<KitaThreadView *>( currentPage() ) ->focusSearchCombo();
 }
 
 void KitaThreadTabWidget::reloadThread()
 {
-    static_cast<KitaThreadView *>( currentPage() )->slotReloadButton();
+    static_cast<KitaThreadView *>( currentPage() ) ->slotReloadButton();
 }
 
 void KitaThreadTabWidget::closeCurrentTab()
@@ -152,38 +151,36 @@ void KitaThreadTabWidget::closeCurrentTab()
 }
 
 KitaThreadTabBar::KitaThreadTabBar( QWidget* parent, const char* name )
- : QTabBar( parent, name )
-{
-}
+        : QTabBar( parent, name )
+{}
 
 KitaThreadTabBar::~KitaThreadTabBar()
-{
-}
+{}
 
 void KitaThreadTabBar::contextMenuEvent( QContextMenuEvent* e )
 {
-  KPopupMenu popup( 0 );
-  popup.insertItem( i18n("Open with Web Browser"), 0 );
-  popup.insertItem( i18n("Copy title and URL"), 1 );
-  popup.insertItem( i18n("Close this tab"), 2 );
-
-  QTabWidget* parent = static_cast<QTabWidget*>( parentWidget() );
-  KitaThreadView* threadView = static_cast<KitaThreadView*>( parent->currentPage() );
-  QClipboard* clipboard = QApplication::clipboard();
-
-  switch( popup.exec( e->globalPos() ) ) {
-  case 0:
-    KRun::runURL( threadView->threadURL(), "text/html" );
-    break;
-  case 1:
-    clipboard->setText( threadView->threadName() + "\n" + threadView->threadURL().url() );
-    break;
-  case 2:
-    emit deleteMenuSelected( threadView );
-    break;
-  default:
-    break;
-  }
-
-  kdDebug() << "currentPage = " << tab( currentTab() )->text() << endl;
+    KPopupMenu popup( 0 );
+    popup.insertItem( i18n( "Open with Web Browser" ), 0 );
+    popup.insertItem( i18n( "Copy title and URL" ), 1 );
+    popup.insertItem( i18n( "Close this tab" ), 2 );
+
+    QTabWidget* parent = static_cast<QTabWidget*>( parentWidget() );
+    KitaThreadView* threadView = static_cast<KitaThreadView*>( parent->currentPage() );
+    QClipboard* clipboard = QApplication::clipboard();
+
+    switch ( popup.exec( e->globalPos() ) ) {
+    case 0:
+        KRun::runURL( threadView->threadURL(), "text/html" );
+        break;
+    case 1:
+        clipboard->setText( threadView->threadName() + "\n" + threadView->threadURL().url() );
+        break;
+    case 2:
+        emit deleteMenuSelected( threadView );
+        break;
+    default:
+        break;
+    }
+
+    kdDebug() << "currentPage = " << tab( currentTab() ) ->text() << endl;
 }
index cbeb2af..863bead 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #ifndef KITATHREADTABWIDGET_H
 #define KITATHREADTABWIDGET_H
@@ -19,8 +19,9 @@ class KitaThreadPart;
 class KitaThreadView;
 class KURL;
 
-namespace Kita {
-  class Thread;
+namespace Kita
+{
+    class Thread;
 };
 
 /**
@@ -28,49 +29,49 @@ namespace Kita {
 */
 class KitaThreadTabWidget : public QTabWidget
 {
-  Q_OBJECT
-  
+    Q_OBJECT
+
 public:
-    KitaThreadTabWidget(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
+    KitaThreadTabWidget( QWidget* parent = 0, const char* name = 0, WFlags f = 0 );
     ~KitaThreadTabWidget();
     void focusSearchCombo();
     void reloadThread();
     void closeCurrentTab();
 
 public slots:
-  void showThread( const Kita::Thread& thread );
-  void showThreadWithNewTab( const Kita::Thread& thread ); // ad-hoc
-  void deleteView( KitaThreadView* );
+    void showThread( const Kita::Thread* thread );
+    void showThreadWithNewTab( const Kita::Thread* thread ); // ad-hoc
+    void deleteView( KitaThreadView* );
 
 private:
-  void connectSignals( KitaThreadView* );
-  KitaThreadView* createView();
+    void connectSignals( KitaThreadView* );
+    KitaThreadView* createView();
 
 private slots:
-  void slotOpenURLRequest( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs() );
+    void slotOpenURLRequest( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs() );
 
 signals:
-  void openURLRequest( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
-  void signalChangeStatusbar( const QString& );
-  void thread( const Kita::Thread& );
-  void writeSucceeded();
-  void bookmarked( const Kita::Thread&, bool on );
-  void showThreadCompleted( const KURL& threadUrl );
+    void openURLRequest( const KURL& url, const KParts::URLArgs &args = KParts::URLArgs() );
+    void signalChangeStatusbar( const QString& );
+    void thread( const Kita::Thread* );
+    void writeSucceeded();
+    void bookmarked( const Kita::Thread*, bool on );
+    void showThreadCompleted( const KURL& threadUrl );
 };
 
 class KitaThreadTabBar : public QTabBar
 {
-  Q_OBJECT
+    Q_OBJECT
 
 public:
-  KitaThreadTabBar( QWidget* parent = 0, const char* name = 0 );
-  ~KitaThreadTabBar();
+    KitaThreadTabBar( QWidget* parent = 0, const char* name = 0 );
+    ~KitaThreadTabBar();
 
 protected:
-  virtual void contextMenuEvent( QContextMenuEvent* e );
+    virtual void contextMenuEvent( QContextMenuEvent* e );
 
 signals:
-  void deleteMenuSelected( KitaThreadView* );
+    void deleteMenuSelected( KitaThreadView* );
 };
 
 #endif
index 2aceb8d..2c5fba3 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #include "kitahtmlpart.h"
 
 #include "libkita/thread.h"
 
 enum {
-  ID_Copy_Link
+    ID_Copy_Link
 };
 
-KitaHTMLPart::KitaHTMLPart( QWidget *parent, const char *name )
- : KHTMLPart( new KitaHTMLView( this, parent, name ) )
, m_parent(parent)
+KitaHTMLPart::KitaHTMLPart( QWidget* parent, const char* name )
       : KHTMLPart( new KitaHTMLView( this, parent, name ) )
       , m_parent( parent )
 {
-  connect( this, SIGNAL( popupMenu( const QString&, const QPoint& ) ),
-           SLOT( slotPopupMenu( const QString&, const QPoint& ) ) );
+    connect( this, SIGNAL( popupMenu( const QString&, const QPoint& ) ),
+             SLOT( slotPopupMenu( const QString&, const QPoint& ) ) );
 
-  m_popupMenu = new KPopupMenu( view() );
+    m_popupMenu = new KPopupMenu( view() );
 }
 
 
 KitaHTMLPart::~KitaHTMLPart()
-{
-}
+{}
 
 void KitaHTMLPart::reset()
 {
-  m_prevQuery = "";
-  m_nextHit = -1;
-  m_hitCount = 0;
-  m_contents = "";
-  m_pointStack.clear();
+    m_prevQuery = "";
+    m_nextHit = -1;
+    m_hitCount = 0;
+    m_contents = "";
+    m_pointStack.clear();
 }
 
-void KitaHTMLPart::highLightenNodes( DOM::NodeList nodes, const QStringList &query )
+void KitaHTMLPart::highLightenNodes( DOM::NodeList nodes, const QStringListquery )
 {
-  for ( unsigned int count = 0; count < nodes.length(); ++count ) {
-    DOM::HTMLElement dd = nodes.item(count);
-    QStringList lt_gt_split = lt_gt_spliter( dd.innerHTML().string() );
-
-    QProgressDialog progress(m_parent);
-    progress.setLabelText("Searching...");
-    progress.setTotalSteps( lt_gt_split.size() );
-    progress.show();
-    int step = 0;
-    int divide = lt_gt_split.size() / ( 100 / 5 );
-    int next = divide;
-
-    //loop order not optimized. Need optim. that also needs any codes & members?
-    QStringList::iterator it_msg = lt_gt_split.begin();
-    for( ; it_msg != lt_gt_split.end(); ++it_msg )
-    {
-      QStringList::const_iterator it = query.begin();
-      for( ; it != query.end(); ++it )
-      {
-       int pos = 1;
-       QString message = *it_msg;
-       if( message.at(0) == '<' ) continue;
-       while ( (pos = (*it_msg).find(*it, pos, false)) != -1 ) {
-         QString replace = QString("<font class=\"highlight\" id=\"highlighten%2\">").arg( m_hitCount );
-//       replace += *it;
-          replace += message.mid( pos, (*it).length() );
-         replace += "</font>";
-         message.replace(pos, (*it).length(), replace);
-         pos += replace.length();
-         lt_gt_split.insert( it_msg, message );
-         it_msg = lt_gt_split.remove( it_msg );
-         --it_msg;
-         ++m_hitCount;
-       }
-      }
-      if( ++step > next ) {
-       progress.setProgress( step );
-       next += divide;
-      }
-    }
+    for ( unsigned int count = 0; count < nodes.length(); ++count ) {
+        DOM::HTMLElement dd = nodes.item( count );
+        QStringList lt_gt_split = lt_gt_spliter( dd.innerHTML().string() );
+
+        QProgressDialog progress( m_parent );
+        progress.setLabelText( "Searching..." );
+        progress.setTotalSteps( lt_gt_split.size() );
+        progress.show();
+        int step = 0;
+        int divide = lt_gt_split.size() / ( 100 / 5 );
+        int next = divide;
+
+        //loop order not optimized. Need optim. that also needs any codes & members?
+        QStringList::iterator it_msg = lt_gt_split.begin();
+        for ( ; it_msg != lt_gt_split.end(); ++it_msg ) {
+            QStringList::const_iterator it = query.begin();
+            for ( ; it != query.end(); ++it ) {
+                int pos = 1;
+                QString message = *it_msg;
+                if ( message.at( 0 ) == '<' ) continue;
+                while ( ( pos = ( *it_msg ).find( *it, pos, false ) ) != -1 ) {
+                    QString replace = QString( "<font class=\"highlight\" id=\"highlighten%2\">" ).arg( m_hitCount );
+                    //   replace += *it;
+                    replace += message.mid( pos, ( *it ).length() );
+                    replace += "</font>";
+                    message.replace( pos, ( *it ).length(), replace );
+                    pos += replace.length();
+                    lt_gt_split.insert( it_msg, message );
+                    it_msg = lt_gt_split.remove( it_msg );
+                    --it_msg;
+                    ++m_hitCount;
+                }
+            }
+            if ( ++step > next ) {
+                progress.setProgress( step );
+                next += divide;
+            }
+        }
+
+        dd.setInnerHTML( lt_gt_split.join( " " ) );
 
-    dd.setInnerHTML( lt_gt_split.join(" ") );
-
-  }
+    }
 }
 
-QStringList KitaHTMLPart::lt_gt_spliter( const QString & input )
+QStringList KitaHTMLPart::lt_gt_spliter( const QString& input )
 {
-  QStringList lt_gt_splitted;
-  QRegExp lt_gt("[<>]");
-  int start = 0;
-  int end = 0;
-  while ( (end = input.find(lt_gt, end+1)) != -1 ) {
-    if ( input.at(end) == '<' ) {
-      lt_gt_splitted += input.mid( start, end-start );
-      start = end;
-    } else
-    if ( input.at(end) == '>' ) {
-      lt_gt_splitted += input.mid( start, end+1-start );
-      start = end + 1;
-    } else QMessageBox::warning( 0, "", "KitaThreadView::lt_gt_spliter()\n !!Bug!! Not Match.\n Will you contact with authors?");
-  }
-  lt_gt_splitted += input.mid( start );
-  return lt_gt_splitted;
+    QStringList lt_gt_splitted;
+    QRegExp lt_gt( "[<>]" );
+    int start = 0;
+    int end = 0;
+    while ( ( end = input.find( lt_gt, end + 1 ) ) != -1 ) {
+        if ( input.at( end ) == '<' ) {
+            lt_gt_splitted += input.mid( start, end - start );
+            start = end;
+        } else
+            if ( input.at( end ) == '>' ) {
+                lt_gt_splitted += input.mid( start, end + 1 - start );
+                start = end + 1;
+            } else QMessageBox::warning( 0, "", "KitaThreadView::lt_gt_spliter()\n !!Bug!! Not Match.\n Will you contact with authors?" );
+    }
+    lt_gt_splitted += input.mid( start );
+    return lt_gt_splitted;
 }
 
 void KitaHTMLPart::displayContents( const QString& input, const KURL& url )
 {
-  m_contents = input;
-  m_url = url;
+    m_contents = input;
+    m_url = url;
 
-  begin( url );
-  write( input );
-  end();
-  if ( ! url.isEmpty() ) emit setLocationBarURL(url.url());
+    begin( url );
+    write( input );
+    end();
+    if ( ! url.isEmpty() ) emit setLocationBarURL( url.url() );
 
-  view()->setFocus();
+    view() ->setFocus();
 }
 
-void KitaHTMLPart::gotoURL( const Kita::Thread& thread, int prevResNum )
+void KitaHTMLPart::gotoURL( const Kita::Thread* thread, int prevResNum )
 {
-  if ( KURL( thread.datURL() ).hasRef() ) {
-    if ( ! gotoAnchor( KURL( thread.datURL() ).encodedHtmlRef()) )
-      gotoAnchor( KURL( thread.datURL() ).htmlRef() );
-  } else {
-    gotoAnchor( QString().setNum( prevResNum ) );
-  }
-  clearPosition();
-  pushCurrentPosition();
+    if ( KURL( thread->datURL() ).hasRef() ) {
+        if ( ! gotoAnchor( KURL( thread->datURL() ).encodedHtmlRef() ) )
+            gotoAnchor( KURL( thread->datURL() ).htmlRef() );
+    } else {
+        gotoAnchor( QString().setNum( prevResNum ) );
+    }
+    clearPosition();
+    pushCurrentPosition();
 }
 
 void KitaHTMLPart::pushCurrentPosition()
 {
-  m_pointStack.push( QPoint( view()->contentsX(), view()->contentsY() ) );
+    m_pointStack.push( QPoint( view() ->contentsX(), view() ->contentsY() ) );
 }
 
 bool KitaHTMLPart::gobackAnchor()
 {
-  QPoint p = m_pointStack.pop();
-  if ( m_pointStack.isEmpty() ) {
-    m_pointStack.push( p );
-  }
-  view()->setContentsPos( p.x(), p.y() );
+    QPoint p = m_pointStack.pop();
+    if ( m_pointStack.isEmpty() ) {
+        m_pointStack.push( p );
+    }
+    view() ->setContentsPos( p.x(), p.y() );
 
-  return true;
+    return true;
 }
 
 bool KitaHTMLPart::gotoAnchor( const QString& name )
 {
-  pushCurrentPosition();
-  return KHTMLPart::gotoAnchor( name );
+    pushCurrentPosition();
+    return KHTMLPart::gotoAnchor( name );
 }
 
 int KitaHTMLPart::nextHit()
 {
-  m_nextHit++;
-  if ( m_nextHit >= m_hitCount ) m_nextHit = 0;
+    m_nextHit++;
+    if ( m_nextHit >= m_hitCount ) m_nextHit = 0;
 
-  return m_nextHit;
+    return m_nextHit;
 }
 
 void KitaHTMLPart::slotPopupMenu( const QString& url, const QPoint& point )
 {
-  m_popupMenu->clear();
-  m_popupMenu->insertItem( i18n("Copy Link Location"), ID_Copy_Link );
-
-  QClipboard* clipboard = QApplication::clipboard();
-
-  switch( m_popupMenu->exec( point ) ) {
-  case ID_Copy_Link:
-    clipboard->setText( url );
-    break;
-  default:
-    break;
-  }
+    m_popupMenu->clear();
+    m_popupMenu->insertItem( i18n( "Copy Link Location" ), ID_Copy_Link );
+
+    QClipboard* clipboard = QApplication::clipboard();
+
+    switch ( m_popupMenu->exec( point ) ) {
+    case ID_Copy_Link:
+        clipboard->setText( url );
+        break;
+    default:
+        break;
+    }
 }
 
-void KitaHTMLPart::highLighten( bool yes, const QStringList &query )
+void KitaHTMLPart::highLighten( bool yes, const QStringListquery )
 {
-  if ( ! yes ) {
-    setUserStyleSheet( QString("") );
-    return;
-  }
-
-  // Use style sheet to highlighten.
-  QString highlightCSS( ".highlight { color: %1; background: %2; } ");
-  highlightCSS = highlightCSS.arg( "yellow" ).arg( "black" );
-
-  if ( prevQuery() != query && !query.isEmpty() ) {
-    m_prevQuery = query;
-    displayContents( contents(), m_url );
-    DOM::NodeList nodes;
-    resetHit();
-    m_hitCount = 0;
-    nodes = document().getElementsByTagName("body");
-    highLightenNodes( nodes, query );
-  }
-  setUserStyleSheet( highlightCSS );
+    if ( ! yes ) {
+        setUserStyleSheet( QString( "" ) );
+        return ;
+    }
+
+    // Use style sheet to highlighten.
+    QString highlightCSS( ".highlight { color: %1; background: %2; } " );
+    highlightCSS = highlightCSS.arg( "yellow" ).arg( "black" );
+
+    if ( prevQuery() != query && !query.isEmpty() ) {
+        m_prevQuery = query;
+        displayContents( contents(), m_url );
+        DOM::NodeList nodes;
+        resetHit();
+        m_hitCount = 0;
+        nodes = document().getElementsByTagName( "body" );
+        highLightenNodes( nodes, query );
+    }
+    setUserStyleSheet( highlightCSS );
 }
index a29367a..155972d 100644 (file)
@@ -1,28 +1,27 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #ifndef KITAHTMLPART_H
 #define KITAHTMLPART_H
 
 #include <kurl.h>
-
 #include <khtml_part.h>
 
 #include <qstringlist.h>
 
 #include <qvaluestack.h> // for gcc-2.9x
-template<class T> class QValueStack;
+template <class T> class QValueStack;
 
 namespace Kita
 {
-  class Thread;
+    class Thread;
 }
 
 class KPopupMenu;
@@ -32,46 +31,46 @@ class KPopupMenu;
 */
 class KitaHTMLPart : public KHTMLPart
 {
-  Q_OBJECT
+    Q_OBJECT
 
-  KURL m_url;
-  QWidget* m_parent;
-  int m_hitCount;
-  QStringList m_prevQuery;
-  QString m_contents;
-  int m_nextHit;
-  QValueStack<QPoint> m_pointStack;
-  KPopupMenu* m_popupMenu;
+    KURL m_url;
+    QWidget* m_parent;
+    int m_hitCount;
+    QStringList m_prevQuery;
+    QString m_contents;
+    int m_nextHit;
+    QValueStack<QPoint> m_pointStack;
+    KPopupMenu* m_popupMenu;
 
 public:
-  int nextHit();
-  void resetHit() { m_nextHit = -1; }
-  const QStringList prevQuery() const { return m_prevQuery; }
-  void pushCurrentPosition();
-  void reset();
-  bool gotoAnchor( const QString& name );
+    int nextHit();
+    void resetHit() { m_nextHit = -1; }
+    const QStringList prevQuery() const { return m_prevQuery; }
+    void pushCurrentPosition();
+    void reset();
+    bool gotoAnchor( const QString& name );
 
 public:
-  KitaHTMLPart( QWidget *parent, const char *name = 0 );
-  ~KitaHTMLPart();
-  void highLighten( bool yes, const QStringList &query );
-  void highLightenNodes( DOM::NodeList nodes, const QStringList &query );
-  static QStringList lt_gt_spliter( const QString & input );
-  void gotoURL( const Kita::Thread& thread, int prevResNum );
-  void displayContents( const QString& input, const KURL& urlOfInput = 0 );
+    KitaHTMLPart( QWidget* parent, const char* name = 0 );
+    ~KitaHTMLPart();
+    void highLighten( bool yes, const QStringList& query );
+    void highLightenNodes( DOM::NodeList nodes, const QStringList& query );
+    static QStringList lt_gt_spliter( const QString& input );
+    void gotoURL( const Kita::Thread* thread, int prevResNum );
+    void displayContents( const QString& input, const KURL& urlOfInput = 0 );
 
 public slots:
-  bool gobackAnchor();
+    bool gobackAnchor();
 
 private:
-  const QString contents() const { return m_contents; }
-  void clearPosition() { m_pointStack.clear(); }
+    const QString contents() const { return m_contents; }
+    void clearPosition() { m_pointStack.clear(); }
 
 private slots:
-  void slotPopupMenu( const QString& url, const QPoint& point );
+    void slotPopupMenu( const QString& url, const QPoint& point );
 
 signals:
-  void setLocationBarURL( const QString &url );
+    void setLocationBarURL( const QString &url );
 };
 
 #endif
index d3e0bb7..087a1d8 100644 (file)
@@ -8,32 +8,32 @@
 #include "libkita/board.h"
 
 //static const char * version = $VERSION$;
-static const char * version = "1.0";
+static const char* version = "1.0";
 
 typedef KParts::GenericFactory<KitaThreadPart> KitaThreadFactory;
- K_EXPORT_COMPONENT_FACTORY( libkitapart, KitaThreadFactory );
+K_EXPORT_COMPONENT_FACTORY( libkitapart, KitaThreadFactory );
 
-KAboutData * KitaThreadPart::createAboutData() // needed by GenericFactory
+KAboutData* KitaThreadPart::createAboutData()    // needed by GenericFactory
 {
-    KAboutData * about = new KAboutData( 
-            "kitapart",
-            I18N_NOOP("Kitapart plug-in"),
-            version,
-            "2ch thread dat viewer plugin.",
-            KAboutData::License_GPL,
-            "(C) 2003 Konqueror-plugin no hito, (C) 2003 Hideki Ikemoto",
-            "http://pc.2ch.net/linux/",
-            "no-mail"
-            );
+    KAboutData * about = new KAboutData(
+                             "kitapart",
+                             I18N_NOOP( "Kitapart plug-in" ),
+                             version,
+                             "2ch thread dat viewer plugin.",
+                             KAboutData::License_GPL,
+                             "(C) 2003 Konqueror-plugin no hito, (C) 2003 Hideki Ikemoto",
+                             "http://pc.2ch.net/linux/",
+                             "no-mail"
+                         );
     about->addAuthor( "Hideki Ikemoto", "Initial widget writer", "ikemo@wakaba.jp", 0 );
     about->addAuthor( "Konqueror-plugin no hito", "Kparts & some hacks.", 0, "http://pc.2ch.net/linux" );
     return about; // will be passed to GenericFactory.
 }
 
-KitaThreadPart::KitaThreadPart(  QWidget *parentWidget, const char *, QObject *parent, const char *name, const QStringList& )
-  : KParts::ReadOnlyPart( parent, name )
-  , m_threadview( 0 )
-  , m_extension( 0 )
+KitaThreadPart::KitaThreadPart( QWidget* parentWidget, const char*, QObject* parent, const char* name, const QStringList& )
+        : KParts::ReadOnlyPart( parent, name )
+        , m_threadview( 0 )
+        , m_extension( 0 )
 {
     m_threadview = new KitaThreadView( parentWidget ); // auto delete
     setInstance( KitaThreadFactory::instance() );
@@ -51,7 +51,7 @@ KitaThreadPart::~KitaThreadPart()
     }
 }
 
-KParts::BrowserExtension * KitaThreadPart::browserExtension() const
+KParts::BrowserExtension* KitaThreadPart::browserExtension() const
 {
     return m_extension;
 }
@@ -61,44 +61,43 @@ bool KitaThreadPart::openURL( const KURL& _url )
     kdDebug() << "KitaThreadPart::openURL _url: " << _url.url() << endl;
     m_url = _url;
     emit setWindowCaption( m_url.url() );
-    connect( m_threadview, SIGNAL( showThreadCompleted(const KURL&) ),
+    connect( m_threadview, SIGNAL( showThreadCompleted( const KURL& ) ),
              this, SLOT( slotOpenURLResult() ) );
 
-    m_threadview->showThread( Kita::Thread( m_url.url() ) );
+    m_threadview->showThread( new Kita::Thread( m_url.url() ) );
     emit started( 0 );
     return true;
 }
 
 bool KitaThreadPart::closeURL()
 {
-  m_threadview->killJob();
-  return true;
+    m_threadview->killJob();
+    return true;
 }
 
 void KitaThreadPart::slotOpenURLResult()
 {
-    disconnect( m_threadview, SIGNAL( showThreadCompleted(const KURL&) ),
-             this, SLOT( slotOpenURLResult() ) );
+    disconnect( m_threadview, SIGNAL( showThreadCompleted( const KURL& ) ),
+                this, SLOT( slotOpenURLResult() ) );
     emit setWindowCaption( m_threadview->threadName() );
     emit completed();
 }
 
-void KitaThreadPart::guiActivateEvent ( KParts::GUIActivateEvent *event )
+void KitaThreadPart::guiActivateEvent ( KParts::GUIActivateEventevent )
 {
     //KParts::ReadOnlyPart::guiActivateEvent( event );
     if ( event->activated() )
         emit setWindowCaption( m_threadview->threadName() );
 }
 
-KitaThreadBrowserExtension::KitaThreadBrowserExtension( KitaThreadPart * parent )
-  : KParts::BrowserExtension( parent, "KitaThreadBrowserExtension" )
+KitaThreadBrowserExtension::KitaThreadBrowserExtension( KitaThreadPart* parent )
+        : KParts::BrowserExtension( parent, "KitaThreadBrowserExtension" )
 {
-    // DND Drop enable: 1st stage. 
+    // DND Drop enable: 1st stage.
     setURLDropHandlingEnabled( true ); // default: false
 }
 
 KitaThreadBrowserExtension::~KitaThreadBrowserExtension()
-{
-}
+{}
 
 // vim:sw=4:
index e94b32e..3ff52d4 100644 (file)
@@ -124,12 +124,12 @@ KitaThreadView::~KitaThreadView()
 
 const QString KitaThreadView::threadName() const
 {
-    return m_thread.name();
+    return m_thread->name();
 }
 
 const KURL KitaThreadView::threadURL() const
 {
-    return m_thread.url();
+    return m_thread->url();
 }
 
 void KitaThreadView::slotDOMNodeActivated( const DOM::Node& node )
@@ -143,15 +143,15 @@ void KitaThreadView::slotDOMNodeActivated( const DOM::Node& node )
     } // end of Anchor tags.
 }
 
-void KitaThreadView::showThread( const Kita::Thread& thread )
+void KitaThreadView::showThread( const Kita::Thread* thread )
 {
     { //reset member variables associated with a thread.
         m_threadPart->reset();
     }
 
-    m_thread = thread;
+    m_thread = const_cast<Kita::Thread *>( thread );
 
-    m_access = new Kita::ThreadAccess( thread );
+    m_access = new Kita::ThreadAccess( *thread );
     connect( m_access, SIGNAL( redirection( const QString& ) ),
              SIGNAL( setLocationBarURL( const QString& ) ) );
     QString result = m_access->get();
@@ -181,7 +181,7 @@ void KitaThreadView::update( const QString& result )
     int step = 0;
     int divide = total / ( 100 / 5 );
     int next = divide;
-    int prevResNum = m_thread.resNum();
+    int prevResNum = m_thread->resNum();
     QProgressDialog* progress = new QProgressDialog( parentWidget() );
     progress->setTotalSteps( static_cast<int>( total * 0.7 ) );
     progress->setLabelText( "Parse DAT file....." );
@@ -209,12 +209,12 @@ void KitaThreadView::update( const QString& result )
 
         num++;
         if ( num == 1 ) {
-            m_thread.setName( comment.getSubject() );
+            m_thread->setName( comment.getSubject() );
         }
         text += comment.toHtml( num );
 
         if ( prevResNum == num ) {
-            QTextCodec* codec = QTextCodec::codecForName( "euc-jp" );
+            QTextCodec * codec = QTextCodec::codecForName( "euc-jp" );
             text += codec->toUnicode( kokomade_yonda );
         }
 
@@ -225,20 +225,20 @@ void KitaThreadView::update( const QString& result )
     }
     delete progress;
 
-    m_thread.setResNum( num );
+    m_thread->setResNum( num );
     emit thread( m_thread );
 
-    setSubjectLabel( m_thread.boardName(), m_thread.name() );
+    setSubjectLabel( m_thread->boardName(), m_thread->name() );
 
     text += footer( prevResNum );
     text += "</body></html>";
 
-    m_threadPart->displayContents( text, m_thread.datURL() );
+    m_threadPart->displayContents( text, m_thread->datURL() );
     // FIXME: ¤â¤¦¤Á¤ç¤Ã¤È¤Þ¤È¤â¤ÊÊýË¡¤ò»È¤¦¤³¤È
-    m_threadPart->gotoURL( m_thread, QMIN( prevResNum + 1, m_thread.resNum() ) );
+    m_threadPart->gotoURL( m_thread, QMIN( prevResNum + 1, m_thread->resNum() ) );
     updateButton();
 
-    emit showThreadCompleted( m_thread.url() );
+    emit showThreadCompleted( m_thread->url() );
 }
 
 void KitaThreadView::updateButton()
@@ -250,7 +250,7 @@ void KitaThreadView::updateButton()
     if ( HighLightButton->isOn() ) {
         HighLightButton->toggle();
     }
-    if ( FavoriteThreads::getInstance() ->contains( m_thread.datURL() ) ) {
+    if ( FavoriteThreads::getInstance() ->contains( m_thread->datURL() ) ) {
         BookmarkButton->setOn( true );
     } else {
         BookmarkButton->setOn( false );
@@ -261,7 +261,7 @@ const QString KitaThreadView::footer( int prevResNum ) const
 {
     QString text;
     int target;
-    for ( target = 1; target < m_thread.resNum(); target += 100 ) {
+    for ( target = 1; target < m_thread->resNum(); target += 100 ) {
         text += QString( " <a href=\"#%1\">%3</a> " ).arg( target ).arg( target );
     }
     text += QString( " <a href=\"#%1\">New</a> " ).arg( prevResNum + 1 );
@@ -294,7 +294,7 @@ void KitaThreadView::slotShowErrorDialog( const QString& input, const KURL& )
         if ( KMessageBox::questionYesNo( 0, eucjpCodec->toUnicode( cookie_message ),
                                          eucjpCodec->toUnicode( cookie_title ) )
                 == KMessageBox::Yes ) {
-            KitaWriteDialog* dialog = openDialog( m_postInfo );
+            KitaWriteDialog * dialog = openDialog( m_postInfo );
             dialog->postMessage();
         } else {
             KitaWriteDialog* dialog = openDialog( m_postInfo );
@@ -308,7 +308,7 @@ void KitaThreadView::slotShowErrorDialog( const QString& input, const KURL& )
 
 KitaWriteDialog* KitaThreadView::openDialog( const Kita::PostInfo& info )
 {
-    KitaWriteDialog* new_dialog = KitaWriteDialog::open( info, m_thread );
+    KitaWriteDialog * new_dialog = KitaWriteDialog::open( info, m_thread );
     connect( new_dialog, SIGNAL( postStarted( KIO::Job*, const Kita::PostInfo& ) ),
              this, SLOT( slotPostStarted( KIO::Job*, const Kita::PostInfo& ) ) );
     connect( new_dialog, SIGNAL( postResponse( const QString&, const KURL& ) ),
@@ -325,13 +325,13 @@ void KitaThreadView::slotWriteButtonClicked()
         kdError() << __func__ << ": m_access is null" << endl;
         return ;
     }
-    KURL bbscgiURL = KURL( m_thread.boardURL(), "../test/bbs.cgi" );
+    KURL bbscgiURL = KURL( m_thread->boardURL(), "../test/bbs.cgi" );
     bbscgiURL.setProtocol( "http" );
 
     Kita::PostInfo info;
     info.host = bbscgiURL.host();
-    info.bbs = m_thread.boardID();
-    info.key = m_thread.datID();
+    info.bbs = m_thread->boardID();
+    info.key = m_thread->datID();
     info.time = QString( "%1" ).arg( m_access->serverTime() );
 
     KitaWriteDialog* dialog = openDialog( info );
@@ -403,7 +403,7 @@ void KitaThreadView::slotOnURL( const QString& url )
 
     // TODO: enterEvent()¤ò¼ÂÁõ¤·¤Æ¡¢Æþ¤Ã¤Æ¤­¤¿¤È¤­¤Ëtip¤òɽ¼¨¤¹¤ë¤³¤È¡£
     if ( ! url.isEmpty() ) {
-        KHTMLView* view = m_threadPart->view();
+        KHTMLView * view = m_threadPart->view();
 
         if ( m_popup ) {
             delete m_popup;
@@ -416,7 +416,7 @@ void KitaThreadView::slotOnURL( const QString& url )
         if ( url.at( 0 ) == '#' ) {
             refNum = url.mid( 1 ).toInt();
         } else {
-            KURL filteredURL = filterReadCGI( KURL( m_thread.datURL(), url ) );
+            KURL filteredURL = filterReadCGI( KURL( m_thread->datURL(), url ) );
             refNum = filteredURL.ref().toInt();
         }
 
@@ -448,7 +448,7 @@ void KitaThreadView::hidePopup()
 
 void KitaThreadView::slotPopupMenu( KXMLGUIClient* client, const QPoint& global, const KURL& url, const QString& mimeType, mode_t mode )
 {
-    KActionCollection* collection = client->actionCollection();
+    KActionCollection * collection = client->actionCollection();
     KAction* action;
     action = new KAction( i18n( "goback anchor" ), SmallIcon( "idea" ), KShortcut(), m_threadPart, SLOT( gobackAnchor() ), collection, "goback_anchor" );
     emit popupMenu( client, global, url, mimeType, mode );
@@ -461,8 +461,8 @@ void KitaThreadView::slotOpenURLRequest( const KURL& url, const KParts::URLArgs&
         return ;
     }
     KURL datURL = filterReadCGI( url );
-    if ( datURL.host() == KURL( m_thread.datURL() ).host()
-            && datURL.path() == KURL( m_thread.datURL() ).path() ) {
+    if ( datURL.host() == KURL( m_thread->datURL() ).host()
+            && datURL.path() == KURL( m_thread->datURL() ).path() ) {
         if ( datURL.hasRef() )
             m_threadPart->gotoAnchor( datURL.ref() );
         return ;
@@ -479,7 +479,7 @@ KURL KitaThreadView::filterReadCGI( const KURL& url )
 {
     KURL newURL = url;
     if ( url.path().contains( "/test/read.cgi" ) ) {
-        newURL.setProtocol( KURL( m_thread.datURL() ).protocol() );
+        newURL.setProtocol( KURL( m_thread->datURL() ).protocol() );
         QString tmp = url.path().section( "/test/read.cgi", 1 );
 
         QString newPath = QString( "/%1/dat/%2.dat" )
@@ -537,39 +537,39 @@ void KitaThreadView::focusSearchCombo()
 namespace Kita
 {
 
-PopupTextBrowser::PopupTextBrowser( QFrame* frame )
-        : QTextBrowser( frame )
-{
-    zoomOut( static_cast<int>( pointSize() * 0.3 ) );
-    setWordWrap( QTextEdit::NoWrap );
-    setResizePolicy( QScrollView::AutoOne );
-    setFont( KitaConfig::threadFont() );
-    setPaletteForegroundColor( KitaConfig::popupColor() );
-    setPaletteBackgroundColor( KitaConfig::popupBackgroundColor() );
-}
+    PopupTextBrowser::PopupTextBrowser( QFrame* frame )
+            : QTextBrowser( frame )
+    {
+        zoomOut( static_cast<int>( pointSize() * 0.3 ) );
+        setWordWrap( QTextEdit::NoWrap );
+        setResizePolicy( QScrollView::AutoOne );
+        setFont( KitaConfig::threadFont() );
+        setPaletteForegroundColor( KitaConfig::popupColor() );
+        setPaletteBackgroundColor( KitaConfig::popupBackgroundColor() );
+    }
 
-PopupTextBrowser::~ PopupTextBrowser()
-{}
+    PopupTextBrowser::~ PopupTextBrowser()
+    {}
 
-ResPopup::ResPopup( KHTMLView* view )
-        : QFrame( view, "res_popup", WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WType_TopLevel | WX11BypassWM )
-{
-    m_browser = new Kita::PopupTextBrowser( this );
-}
+    ResPopup::ResPopup( KHTMLView* view )
+            : QFrame( view, "res_popup", WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WType_TopLevel | WX11BypassWM )
+    {
+        m_browser = new Kita::PopupTextBrowser( this );
+    }
 
-ResPopup::~ ResPopup()
-{}
+    ResPopup::~ ResPopup()
+    {}
 
-void ResPopup::setText( QString& str )
-{
-    m_browser->setText( str );
-}
+    void ResPopup::setText( QString& str )
+    {
+        m_browser->setText( str );
+    }
 
-void ResPopup::adjustSize()
-{
-    m_browser->resize( m_browser->contentsWidth() + 10, m_browser->contentsHeight() );
-    QFrame::adjustSize();
-}
+    void ResPopup::adjustSize()
+    {
+        m_browser->resize( m_browser->contentsWidth() + 10, m_browser->contentsHeight() );
+        QFrame::adjustSize();
+    }
 
 };
 // vim:sw=2:
index a61b5f3..01d39f7 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #ifndef _KITATHREADVIEW_H_
 #define _KITATHREADVIEW_H_
@@ -26,7 +26,7 @@ class KitaHTMLPart;
 class KitaWriteDialog;
 
 #include <qvaluestack.h> // for gcc-2.9x
-template<class T> class QValueStack;
+template <class T> class QValueStack;
 
 namespace Kita
 {
@@ -50,7 +50,7 @@ class KitaThreadView : public KitaThreadViewBase
     Q_OBJECT
 
 public:
-    KitaThreadView( QWidget* parent, const char* name=0 );
+    KitaThreadView( QWidget* parent, const char* name = 0 );
     ~KitaThreadView();
     const QString threadName() const;
     const KURL threadURL() const;
@@ -59,7 +59,7 @@ public:
     void focusSearchCombo();
 
 public slots:
-    void showThread( const Kita::Thread& thread );
+    void showThread( const Kita::Thread* thread );
     void setFont( const QFont& font );
     void slotReloadButton();
 
@@ -68,9 +68,9 @@ protected slots:
     void slotPopupMenu( KXMLGUIClient*, const QPoint&, const KURL&, const QString&, mode_t );
     void slotOpenURLRequest( const KURL&, const KParts::URLArgs& );
 
-private: // Private attributes
+private:   // Private attributes
     Kita::ThreadAccess* m_access;
-    Kita::Thread m_thread;
+    Kita::Thread* m_thread;
     KitaHTMLPart* m_threadPart;
     Kita::PostInfo m_postInfo;
     Kita::ResPopup* m_popup;
@@ -105,9 +105,9 @@ 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 thread( const Kita::Thread& );
+    void thread( const Kita::Thread* );
     void writeSucceeded();
-    void bookmarked( const Kita::Thread&, bool on );
+    void bookmarked( const Kita::Thread*, bool on );
 };
 
 namespace Kita
index b861fc7..b26493f 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #include "kitawritedialog.h"
 #include "libkita/qcp932codec.h"
 #include <kio/job.h>
 
 const char* kaomoji[] = {
-  "",
-  "\8e·\8eÀ¨¬¨¬¨¬(\8eߢÏ\8eß)¨¬¨¬¨¬!!!!!",
-  "¡Ê\8eߧÕ\8eß¡Ë\8e³\8eÏ\8e°",
-  "(+§Õ+)\8eÏ\8e½\8eÞ\8e°",
-  "((((((¡¨\8eߧ¥\8eß))))))\8e\8eÞ\8e¸\8e\8eÞ\8e¸\8eÌ\8eÞ\8eÙ\8eÌ\8eÞ\8eÙ",
-  "(¡­¡¦¦Ø¡¦`)\8e¼\8e®\8eÎ\8eÞ\8e°\8eÝ",
-  "( ¡­_¡µ`)\8eÌ\8e°\8eÝ",
-  "¡³(`§¥¡­)¥Î\8e³\8eÜ\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8eÝ",
-  "¡Ê\8e¥¢Ï\8e¥¡Ë\8e²\8e²!!",
-  "(;¡­§¥`)\8eÊ\8e§\8eÊ\8e§",
+    "",
+    "\8e·\8eÀ¨¬¨¬¨¬(\8eߢÏ\8eß)¨¬¨¬¨¬!!!!!",
+    "¡Ê\8eߧÕ\8eß¡Ë\8e³\8eÏ\8e°",
+    "(+§Õ+)\8eÏ\8e½\8eÞ\8e°",
+    "((((((¡¨\8eߧ¥\8eß))))))\8e\8eÞ\8e¸\8e\8eÞ\8e¸\8eÌ\8eÞ\8eÙ\8eÌ\8eÞ\8eÙ",
+    "(¡­¡¦¦Ø¡¦`)\8e¼\8e®\8eÎ\8eÞ\8e°\8eÝ",
+    "( ¡­_¡µ`)\8eÌ\8e°\8eÝ",
+    "¡³(`§¥¡­)¥Î\8e³\8eÜ\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8e§\8eÝ",
+    "¡Ê\8e¥¢Ï\8e¥¡Ë\8e²\8e²!!",
+    "(;¡­§¥`)\8eÊ\8e§\8eÊ\8e§",
 //  "(\8eß?\8eß)\8e²\8e×\8eÈ",
-  "(\8eߧ¥\8eß)\8eÊ\8e§?",
-  "\8e¡\8e¥\8eß\8e¥(\8eɧ¥`)\8e¥\8eß\8e¥\8e¡\8e³\8e´\8e´\8eª\8eª\8eÝ",
-  "(¡¡\8eߧÕ\8eß)\8eÎ\8eß\8e\8e°\8eÝ",
-  "¡Ê¡¦¢Ï¡¦¡Ë\8e\8e´\8eÚ!!",
-  "(¡­-`).\8e¡£ï£Ï()",
-  "(¦Ò¡¦¢Ï¡¦)¦Ò\8e¹\8eÞ\8e¯\8eÂ",
-  NULL
+    "(\8eߧ¥\8eß)\8eÊ\8e§?",
+    "\8e¡\8e¥\8eß\8e¥(\8eɧ¥`)\8e¥\8eß\8e¥\8e¡\8e³\8e´\8e´\8eª\8eª\8eÝ",
+    "(¡¡\8eߧÕ\8eß)\8eÎ\8eß\8e\8e°\8eÝ",
+    "¡Ê¡¦¢Ï¡¦¡Ë\8e\8e´\8eÚ!!",
+    "(¡­-`).\8e¡£ï£Ï()",
+    "(¦Ò¡¦¢Ï¡¦)¦Ò\8e¹\8eÞ\8e¯\8eÂ",
+    NULL
 };
 
-KitaWriteDialogPrivate * KitaWriteDialog::s_private = 0;
+KitaWriteDialogPrivate* KitaWriteDialog::s_private = 0;
 
-KitaWriteDialog::KitaWriteDialog(QWidget *parent, const char *name)
-  : KitaWriteDialogBase(parent, name)
+KitaWriteDialog::KitaWriteDialog( QWidget* parent, const char* name )
+        : KitaWriteDialogBase( parent, name )
 {
-  QFont font = KitaConfig::font();
-  bodyText->setFont( font );
-  nameLine->setFont( font );
-  nameLabel->setFont( font );
-  mailLine->setFont( font );
-  mailLabel->setFont( font );
-
-  faceCombo->clear();
-  int i=0;
-  while( kaomoji[i] ) {
-    QEucJpCodec codec;
-    QString str = codec.toUnicode( kaomoji[i], strlen( kaomoji[i] ) );
-    faceCombo->insertItem( str );
-    i++;
-  }
+    QFont font = KitaConfig::font();
+    bodyText->setFont( font );
+    nameLine->setFont( font );
+    nameLabel->setFont( font );
+    mailLine->setFont( font );
+    mailLabel->setFont( font );
+
+    faceCombo->clear();
+    int i = 0;
+    while ( kaomoji[ i ] ) {
+        QEucJpCodec codec;
+        QString str = codec.toUnicode( kaomoji[ i ], strlen( kaomoji[ i ] ) );
+        faceCombo->insertItem( str );
+        i++;
+    }
 }
 
 KitaWriteDialog::~KitaWriteDialog()
-{
-}
+{}
 
 const QString KitaWriteDialog::name() const
 {
-  return nameLine->text();
+    return nameLine->text();
 }
 
 const QString KitaWriteDialog::mail() const
 {
-  return mailLine->text();
+    return mailLine->text();
 }
 
 const QString KitaWriteDialog::body() const
 {
-  return bodyText->text();
+    return bodyText->text();
 }
 
-void KitaWriteDialog::fetchPostInfo( Kita::PostInfo * storage ) const
+void KitaWriteDialog::fetchPostInfo( Kita::PostInfo* storage ) const
 {
-  storage->name = name();
-  storage->mail = mail();
-  storage->body = body();
+    storage->name = name();
+    storage->mail = mail();
+    storage->body = body();
 }
 
 // TODO: Thread¥¯¥é¥¹¤ò»È¤¦¤è¤¦¤Ë½ñ¤­´¹¤¨¤ë
 KitaWriteDialog* KitaWriteDialog::open( const Kita::PostInfo& info,
-                                        const Kita::Thread& thread )
+                                        const Kita::Thread* thread )
 {
-  if ( ! info.check() ) return 0;
-  if ( ! s_private ) {
-    s_private = new KitaWriteDialogPrivate;
-    if ( ! s_private ) return 0;
-  }
+    if ( ! info.check() ) return 0;
+    if ( ! s_private ) {
+        s_private = new KitaWriteDialogPrivate;
+        if ( ! s_private ) return 0;
+    }
 
-  KitaWriteDialog * new_dlg = new KitaWriteDialog;
-  if ( ! new_dlg ) return 0;
+    KitaWriteDialog* new_dlg = new KitaWriteDialog;
+    if ( ! new_dlg ) return 0;
 
-  new_dlg->m_postInfo = info;
-  s_private->m_heaplist.append( new_dlg );
+    new_dlg->m_postInfo = info;
+    s_private->m_heaplist.append( new_dlg );
 
-  new_dlg->connect( new_dlg->buttonOk, SIGNAL( clicked() ), new_dlg, SLOT( postMessage() ) );
+    new_dlg->connect( new_dlg->buttonOk, SIGNAL( clicked() ),
+                      new_dlg, SLOT( postMessage() ) );
 
-  // set fields
-  new_dlg->nameLine->setText(info.name);
-  new_dlg->mailLine->setText(info.mail);
-  new_dlg->bodyText->setText(info.body);
+    // set fields
+    new_dlg->nameLine->setText( info.name );
+    new_dlg->mailLine->setText( info.mail );
+    new_dlg->bodyText->setText( info.body );
 
-  new_dlg->boardNameLabel->setText( thread.boardName() );
-  new_dlg->threadNameLabel->setText( thread.name() );
-  new_dlg->threadURLLabel->setText( thread.url() );
+    new_dlg->boardNameLabel->setText( thread->boardName() );
+    new_dlg->threadNameLabel->setText( thread->name() );
+    new_dlg->threadURLLabel->setText( thread->url() );
 
-  KCompletion* comp = KitaConfig::nameCompletion();
-  new_dlg->nameLine->setCompletionObject( comp );
+    KCompletion* comp = KitaConfig::nameCompletion();
+    new_dlg->nameLine->setCompletionObject( comp );
 
-  new_dlg->setCaption( i18n("Write in %1").arg( thread.name() ) );
-  return new_dlg;
+    new_dlg->setCaption( i18n( "Write in %1" ).arg( thread->name() ) );
+    return new_dlg;
 }
 
 static void logPostMessage( const Kita::PostInfo& postInfo,
@@ -137,87 +137,87 @@ static void logPostMessage( const Kita::PostInfo& postInfo,
                             const QString& threadName,
                             const QString& threadURL )
 {
-  QDateTime now = QDateTime::currentDateTime();
-  QString logPath = locateLocal( "appdata", "log.txt" );
-
-  QFile file( logPath );
-  if ( file.open( IO_WriteOnly | IO_Append ) ) {
-    QTextStream stream( &file );
-    stream.setEncoding( QTextStream::UnicodeUTF8 );
-
-    stream << "Date   : " << now.toString( "yyyy/MM/dd hh:mm:ss" ) << endl; // ¸½ºß»þ¹ï
-    stream << "Board  : " << boardName << endl;
-    stream << "Thread : " << threadName << endl;
-    stream << "URL    : " << threadURL << endl;
-    stream << "Name   : " << postInfo.name << endl;
-    stream << "Mail   : " << postInfo.mail << endl << endl;
-    stream << postInfo.body << endl;
-    stream << "----------------------------------------" << endl;
-
-    file.close();
-  }
+    QDateTime now = QDateTime::currentDateTime();
+    QString logPath = locateLocal( "appdata", "log.txt" );
+
+    QFile file( logPath );
+    if ( file.open( IO_WriteOnly | IO_Append ) ) {
+        QTextStream stream( &file );
+        stream.setEncoding( QTextStream::UnicodeUTF8 );
+
+        stream << "Date   : " << now.toString( "yyyy/MM/dd hh:mm:ss" ) << endl; // ¸½ºß»þ¹ï
+        stream << "Board  : " << boardName << endl;
+        stream << "Thread : " << threadName << endl;
+        stream << "URL    : " << threadURL << endl;
+        stream << "Name   : " << postInfo.name << endl;
+        stream << "Mail   : " << postInfo.mail << endl << endl;
+        stream << postInfo.body << endl;
+        stream << "----------------------------------------" << endl;
+
+        file.close();
+    }
 }
 
 void KitaWriteDialog::postMessage()
 {
-  fetchPostInfo( &m_postInfo );
-  if ( ! m_postInfo.check() )
-       return ;
+    fetchPostInfo( &m_postInfo );
+    if ( ! m_postInfo.check() )
+        return ;
 
 
-  KitaConfig::addNameCompletionItem( m_postInfo.name );
+    KitaConfig::addNameCompletionItem( m_postInfo.name );
 
-  KURL bbscgi;
-  bbscgi.setProtocol( "http" );
-  bbscgi.setHost( m_postInfo.host );
-  bbscgi.setPath( m_postInfo.bbscgi );
+    KURL bbscgi;
+    bbscgi.setProtocol( "http" );
+    bbscgi.setHost( m_postInfo.host );
+    bbscgi.setPath( m_postInfo.bbscgi );
 
-  //int mib = QTextCodec::codecForName("CP932")->mibEnum();
-  QString postStr = m_postInfo.postStr();
+    //int mib = QTextCodec::codecForName("CP932")->mibEnum();
+    QString postStr = m_postInfo.postStr();
 
-  kdDebug() << "query: " << postStr << endl;
-  m_array.resize(0);
+    kdDebug() << "query: " << postStr << endl;
+    m_array.resize( 0 );
 
-  KIO::TransferJob * job = KIO::http_post(bbscgi, postStr.utf8(), true);
-  job->addMetaData("content-type", "Content-type: application/x-www-form-urlencoded");
-  job->addMetaData("referrer", QString("http://%1/%2/").arg(m_postInfo.host).arg(m_postInfo.bbs) );
+    KIO::TransferJob* job = KIO::http_post( bbscgi, postStr.utf8(), true );
+    job->addMetaData( "content-type", "Content-type: application/x-www-form-urlencoded" );
+    job->addMetaData( "referrer", QString( "http://%1/%2/" ).arg( m_postInfo.host ).arg( m_postInfo.bbs ) );
 
-  if ( ! m_postInfo.cookie.isEmpty() )
-         job->addMetaData("cookie", m_postInfo.cookie.prepend("Cookie: "));
+    if ( ! m_postInfo.cookie.isEmpty() )
+        job->addMetaData( "cookie", m_postInfo.cookie.prepend( "Cookie: " ) );
 
-  // TODO: rewrite!
-  logPostMessage( m_postInfo, boardNameLabel->text(), threadNameLabel->text(), threadURLLabel->text() );
+    // TODO: rewrite!
+    logPostMessage( m_postInfo, boardNameLabel->text(), threadNameLabel->text(), threadURLLabel->text() );
 
-  emit postStarted( job, m_postInfo );
+    emit postStarted( job, m_postInfo );
 
-  connect( job, SIGNAL( data(KIO::Job*, const QByteArray&) ),
-          this, SLOT( slotRecieveData(KIO::Job *, const QByteArray &) ) );
-  connect( job, SIGNAL( result(KIO::Job *) ),
-          this, SLOT( slotPostFinished(KIO::Job *) ) );
+    connect( job, SIGNAL( data( KIO::Job*, const QByteArray& ) ),
+             this, SLOT( slotRecieveData( KIO::Job*, const QByteArray& ) ) );
+    connect( job, SIGNAL( result( KIO::Job* ) ),
+             this, SLOT( slotPostFinished( KIO::Job* ) ) );
 }
 
-void KitaWriteDialog::slotRecieveData(KIO::Job *, const QByteArray &data)
+void KitaWriteDialog::slotRecieveData( KIO::Job*, const QByteArray& data )
 {
-  m_array.append( data.data() );
+    m_array.append( data.data() );
 }
 
-void  KitaWriteDialog::slotPostFinished(KIO::Job *job)
+void KitaWriteDialog::slotPostFinished( KIO::Job* job )
 {
-  QString response = QTextCodec::codecForName("sjis")->toUnicode( m_array );
-  QCString output = QTextCodec::codecForName("eucJP")->fromUnicode( response );
-  kdDebug() << "response: '" << output.data() << "'" << endl;
-  emit postFinished( job );
-  KURL bbscgi;
-  bbscgi.setProtocol( "http" );
-  bbscgi.setHost( m_postInfo.host );
-  bbscgi.setPath( m_postInfo.bbscgi );
-  emit postResponse( response, bbscgi );
-
-  m_array.resize(0);
-
-  int idx = s_private->m_heaplist.find( this );
-  if ( idx != -1 ) 
-    delete this;
+    QString response = QTextCodec::codecForName( "sjis" ) ->toUnicode( m_array );
+    QCString output = QTextCodec::codecForName( "eucJP" ) ->fromUnicode( response );
+    kdDebug() << "response: '" << output.data() << "'" << endl;
+    emit postFinished( job );
+    KURL bbscgi;
+    bbscgi.setProtocol( "http" );
+    bbscgi.setHost( m_postInfo.host );
+    bbscgi.setPath( m_postInfo.bbscgi );
+    emit postResponse( response, bbscgi );
+
+    m_array.resize( 0 );
+
+    int idx = s_private->m_heaplist.find( this );
+    if ( idx != -1 )
+        delete this;
 }
 
 // vim:sw=2:
index ad9e1b7..4495225 100644 (file)
@@ -1,12 +1,12 @@
 /***************************************************************************
- *   Copyright (C) 2003 by Hideki Ikemoto                                  *
- *   ikemo@users.sourceforge.jp                                            *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- ***************************************************************************/
+*   Copyright (C) 2003 by Hideki Ikemoto                                  *
+*   ikemo@users.sourceforge.jp                                            *
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+***************************************************************************/
 
 #ifndef _KITAWRITEDIALOG_H_
 #define _KITAWRITEDIALOG_H_
@@ -16,7 +16,7 @@
 #include "kitawritedialogbase.h"
 #include "kita2ch.h"
 
-template<class type> class QPtrList;
+template <class type> class QPtrList;
 class KitaWriteDialogPrivate;
 class KitaWriteDialog;
 
@@ -26,45 +26,45 @@ class KitaWriteDialog;
  **/
 class KitaWriteDialog : public KitaWriteDialogBase
 {
-  Q_OBJECT
+    Q_OBJECT
 public:
-  KitaWriteDialog(QWidget *parent=0, const char *name=0 );
-  virtual ~KitaWriteDialog();
-  const QString name() const;
-  const QString mail() const;
-  const QString body() const;
+    KitaWriteDialog( QWidget* parent = 0, const char* name = 0 );
+    virtual ~KitaWriteDialog();
+    const QString name() const;
+    const QString mail() const;
+    const QString body() const;
 
-  virtual bool error(){ return false; };
+    virtual bool error() { return false; };
 
-  static KitaWriteDialog * open( const Kita::PostInfo& info, const Kita::Thread& thread );
+    static KitaWriteDialog* open( const Kita::PostInfo& info, const Kita::Thread* thread );
 
 public slots:
-  void postMessage();
+    void postMessage();
 
 signals:
-  void postStarted( KIO::Job *, const Kita::PostInfo& );
-  void postFinished( KIO::Job * );
-  void postResponse( const QString& response, const KURL& bbscgi = KURL() );
+    void postStarted( KIO::Job*, const Kita::PostInfo& );
+    void postFinished( KIO::Job* );
+    void postResponse( const QString& response, const KURL& bbscgi = KURL() );
 
 protected:
-  Kita::PostInfo m_postInfo;
+    Kita::PostInfo m_postInfo;
 
 private:
-  void fetchPostInfo( Kita::PostInfo * storage ) const;
+    void fetchPostInfo( Kita::PostInfo* storage ) const;
 
-  QCString m_array;
-  bool m_error;
-  static KitaWriteDialogPrivate * s_private;
+    QCString m_array;
+    bool m_error;
+    static KitaWriteDialogPrivate* s_private;
 
 private slots:
-  void slotRecieveData(KIO::Job *, const QByteArray &);
-  void slotPostFinished(KIO::Job *);
+    void slotRecieveData( KIO::Job*, const QByteArray& );
+    void slotPostFinished( KIO::Job* );
 
 };
 
 class KitaWriteDialogPrivate
 {
 public:
-   QPtrList<KitaWriteDialog> m_heaplist;
+    QPtrList<KitaWriteDialog> m_heaplist;
 };
 #endif