OSDN Git Service

refactoring.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Tue, 3 Jul 2007 14:03:47 +0000 (14:03 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Tue, 3 Jul 2007 14:03:47 +0000 (14:03 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1985 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/bbs/bbsview.cpp
kita/src/bbs/bbsview.h
kita/src/libkita/signalcollection.h
kita/src/mainwindow.cpp
kita/src/mainwindow.h
kita/src/write/newthreadwriteview.cpp
kita/src/write/newthreadwriteview.h

index 7bb9294..a9c6f04 100644 (file)
@@ -107,6 +107,7 @@ KitaBBSView::KitaBBSView( QWidget *parent, const char *name )
     connect( Kita::FavoriteBoards::getInstance(), SIGNAL( changed() ), SLOT( refreshFavoriteBoards() ) );
     connect( this, SIGNAL( openURLRequestExt( const KURL&, const KParts::URLArgs&, QString, int, const KURL& ) ),
              signalCollection, SIGNAL( openURLRequestExt( const KURL& , const KParts::URLArgs&, QString, int, const KURL& ) ) );
+    connect( this, SIGNAL( openBoard( const KURL& ) ), signalCollection, SIGNAL( openBoard( const KURL& ) ) );
     connect( SearchCombo, SIGNAL( textChanged( const QString& ) ),
              SLOT( filter( const QString& ) ) );
 }
@@ -471,7 +472,7 @@ void KitaBBSView::loadBoard( QListViewItem* item )
         return ;
     }
 
-    emit openURLRequestExt( boardURL, KParts::URLArgs(), "kita_open_2chboard", 1 );
+    emit openBoard( boardURL );
 }
 
 void KitaBBSView::setFont( const QFont& font )
@@ -523,7 +524,7 @@ void KitaBBSView::slotContextMenuRequested( QListViewItem* item, const QPoint& p
         emit openURLRequestExt( boardURL, KParts::URLArgs(), "text/html" );
         break;
     case Menu_OpenWithNewTab:
-        emit openURLRequestExt( boardURL, KParts::URLArgs(), "kita_open_2chboard", 1 );
+        emit openBoard( boardURL );
         break;
     case Menu_CopyURL:
         clipboard->setText( boardURL_upToDate.prettyURL(), QClipboard::Clipboard );
@@ -559,10 +560,10 @@ void KitaBBSView::slotMouseButtonClicked( int button, QListViewItem* item )
 
     switch ( button ) {
     case MidButton:
-        emit openURLRequestExt( boardURL, KParts::URLArgs(), "kita_open_2chboard", 1 );
+        emit openBoard( boardURL );
         break;
     case LeftButton:
-        emit openURLRequestExt( boardURL, KParts::URLArgs(), "kita_open_2chboard", 1 );
+        emit openBoard( boardURL );
         break;
     }
 }
index d0f1576..63f7b14 100644 (file)
@@ -82,6 +82,7 @@ private:
     bool downloadBoardList();
 
 signals:
+    void openBoard( const KURL& url );
     void openURLRequestExt( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs(),
                             QString mimetype = QString::null,
                             int usr1 = 0,
index 1e0a6bd..23fdf95 100644 (file)
@@ -35,13 +35,13 @@ namespace Kita
 
         /* to : KitaMainWindow */
         void bookmarked( const QString& datURL, bool on );
+        void openBoard( const KURL& url );
         void openURLRequest( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs() );
         /**
          *
          * @param url URL to open.
          * @param args arguments of URL. @see KParts::URLArgs
          * @param mimetype MIME Type to open.
-         *     "kita_open_2chboard" : open the board.
          *     "kita_open_2chthread" : open the thread.
          *     "text/html" : open url with web browser. 
          *     QString::null : use KIO::NetAccess::mimetype to decide mime type of url.
index 0171686..2046261 100644 (file)
@@ -148,6 +148,7 @@ KitaMainWindow::KitaMainWindow()
     // allow the view to change the statusbar and caption
     Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
 
+    connect( signalCollection, SIGNAL( openBoard( const KURL& ) ), SLOT( slotOpenBoard( const KURL& ) ) );
     connect( signalCollection, SIGNAL( openURLRequest( const KURL&, const KParts::URLArgs& ) ),
              SLOT( slotOpenURLRequest( const KURL&, const KParts::URLArgs& ) ) );
 
@@ -395,6 +396,10 @@ void KitaMainWindow::slotOpenURLRequest( const KURL& url, const KParts::URLArgs&
     slotOpenURLRequestExt( url, args );
 }
 
+void KitaMainWindow::slotOpenBoard( const KURL& url )
+{
+    m_boardTab->loadBoard( url );
+}
 
 /* open url */
 /*
@@ -425,13 +430,6 @@ void KitaMainWindow::slotOpenURLRequestExt(
     .arg( args.newTab() ? "yes" : "no" )
     .arg( args.reload ? "yes" : "no" ) << endl;
 
-    /* open 2ch board */
-    /* if usr1 == 1, open the board with new tab. */
-    if ( mimetype == "kita_open_2chboard" ) {
-        m_boardTab->loadBoard( url );
-        return ;
-    }
-
     /* open 2ch thread */
     /* if usr1 == 1, open the thread with new tab. */
     if ( mimetype == "kita_open_2chthread" ) {
index ecd46a9..ed28522 100644 (file)
@@ -75,6 +75,7 @@ private slots:
     void slotCheckSubjectToggleAction( bool check );
     void slotCheckWriteToggleAction( bool check );
     void slotEditCopy();
+    void slotOpenBoard( const KURL& url );
     void slotOpenURLRequest( const KURL& url, const KParts::URLArgs& );
     void slotOpenURLRequestExt( const KURL& url, const KParts::URLArgs& args,
                                 QString mimetype = QString::null,
index 1e87b0e..4871779 100644 (file)
@@ -8,6 +8,7 @@
  *   (at your option) any later version.                                   *
  ***************************************************************************/
 #include "newthreadwriteview.h"
+#include "libkita/signalcollection.h"
 #include "libkita/qcp932codec.h"
 #include "libkita/boardmanager.h"
 #include "libkita/datmanager.h"
@@ -39,6 +40,9 @@ KitaNewThreadWriteView::KitaNewThreadWriteView( QWidget* parent, const KURL& url
 
     initUI();
     initThreadNameField( newThreadName );
+
+    connect( this, SIGNAL( openBoard( const KURL& ) ),
+        Kita::SignalCollection::getInstance(), SIGNAL( openBoard( const KURL& ) ) );
 }
 
 
@@ -158,7 +162,7 @@ void KitaNewThreadWriteView::processPostFinished()
 
             /* reload board */
             QString board = Kita::BoardManager::boardURL( m_datURL );
-            emit openURLRequestExt( board, KParts::URLArgs(), "kita_open_2chboard", 0 );
+            emit openBoard( board );
 
             emit closeCurrentTab(); /* to KitaWriteTabWidget */
         }
index 8d17a63..3ff986b 100644 (file)
@@ -17,6 +17,8 @@
 */
 class KitaNewThreadWriteView : public KitaWriteView
 {
+    Q_OBJECT
+
     QString getPostStr();
     QString getMachiBBSPostStr();
     QString getJBBSPostStr();
@@ -31,6 +33,8 @@ public:
 
     ~KitaNewThreadWriteView();
 
+signals:
+    void openBoard( const KURL& url );
 };
 
 #endif