OSDN Git Service

refactoring.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 22 Jul 2007 14:40:44 +0000 (14:40 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 22 Jul 2007 14:40:44 +0000 (14:40 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@2052 56b19765-1e22-0410-a548-a0f45d66c51a

19 files changed:
kita/src/bbsview.cpp
kita/src/bbsview.h
kita/src/htmlpart.cpp
kita/src/htmlpart.h
kita/src/kitaui/tabwidgetbase.cpp
kita/src/kitaui/tabwidgetbase.h
kita/src/libkita/signalcollection.h
kita/src/mainwindow.cpp
kita/src/mainwindow.h
kita/src/previewpart.cpp
kita/src/previewpart.h
kita/src/threadlistview.cpp
kita/src/threadlistview.h
kita/src/threadview.cpp
kita/src/threadview.h
kita/src/viewmediator.cpp
kita/src/viewmediator.h
kita/src/writeview.cpp
kita/src/writeview.h

index f397eba..d2ec8c9 100644 (file)
@@ -106,8 +106,6 @@ KitaBBSView::KitaBBSView( QWidget *parent, const char *name )
     connect( m_boardList, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
              SLOT( slotContextMenuRequested( QListViewItem*, const QPoint&, int ) ) );
     connect( Kita::FavoriteBoards::getInstance(), SIGNAL( changed() ), SLOT( refreshFavoriteBoards() ) );
-    connect( this, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
-             signalCollection, SIGNAL( openURLRequestExt( const KURL&, const QString ) ) );
     connect( SearchCombo, SIGNAL( textChanged( const QString& ) ),
              SLOT( filter( const QString& ) ) );
 }
index d62f835..f57c58f 100644 (file)
@@ -79,9 +79,6 @@ public slots:
 private:
     void loadExtBoard();
     bool downloadBoardList();
-
-signals:
-    void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
 };
 
 #endif
index dd0b5ff..5a16cf5 100644 (file)
@@ -166,10 +166,6 @@ void KitaHTMLPart::connectSignals()
     connect( view(), SIGNAL( horizontalSliderReleased() ), SLOT( slotHSliderReleased() ) );
 
     connect( signalCollection, SIGNAL( windowDeactivated() ), SLOT( slotHideChildPopup() ) );
-
-    /* click */
-    connect( this, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
-             signalCollection, SIGNAL( openURLRequestExt( const KURL&, const QString ) ) );
 }
 
 
@@ -373,7 +369,7 @@ bool KitaHTMLPart::reload( int jumpNum )
     if ( !m_domtree ) return FALSE;
     if ( m_mode != HTMLPART_MODE_MAINPART ) {
         /* If this is not MainPart, then open MainPart.  */
-        emit openURLRequestExt( m_datURL );
+        ViewMediator::getInstance()->openURL( m_datURL );
         return FALSE;
     }
 
@@ -984,7 +980,7 @@ void KitaHTMLPart::clickAnchor( const KURL& urlin )
         }
         /* right click */
 
-        emit openURLRequestExt( urlin );
+        ViewMediator::getInstance()->openURL( urlin );
         return ;
     }
 
@@ -1047,7 +1043,7 @@ void KitaHTMLPart::clickAnchor( const KURL& urlin )
     if ( !refNum ) return ;
 
     if ( m_mode == HTMLPART_MODE_POPUP ) {
-        emit openURLRequestExt( urlin );
+        ViewMediator::getInstance()->openURL( urlin );
     } else {
         gotoAnchor( QString().setNum( refNum ), TRUE );
     }
index 07d8f2c..e5c2046 100644 (file)
@@ -180,7 +180,6 @@ private slots:
 
 
 signals:
-    void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
     void mousePressed(); /* to KitaThreadView */
 
     /* cache */
index c436260..8f3ee3f 100644 (file)
@@ -174,14 +174,8 @@ KParts::Part* KitaTabWidgetBase::findPartFromWidget( QWidget* w )
 /* private */
 void KitaTabWidgetBase::connectSignals()
 {
-    /* connect signals */
-    Kita::SignalCollection * signalCollection = Kita::SignalCollection::getInstance();
-
     connect( this, SIGNAL( currentChanged ( QWidget * ) ),
              SLOT( slotCurrentChanged ( QWidget * ) ) );
-
-    connect( this, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
-             signalCollection, SIGNAL( openURLRequestExt( const KURL&, const QString ) ) );
 }
 
 
index e9e45c6..729eed5 100644 (file)
@@ -88,9 +88,6 @@ public slots:
     void slotCloseRightTab( int idx = -1 );
     void slotCloseLeftTab( int idx = -1 );
     void slotCloseAllTab();
-
-signals:
-    void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
 };
 
 
index b0c847b..3230346 100644 (file)
@@ -31,23 +31,6 @@ namespace Kita
         static SignalCollection* getInstance();
 
     signals:
-        /**
-         *
-         * @param url URL to open.
-         * @param args arguments of URL. @see KParts::URLArgs
-         * @param mimetype MIME Type to open.
-         *     "text/html" : open url with web browser. 
-         *     QString::null : use KIO::NetAccess::mimetype to decide mime type of url.
-         * @param usr1
-         *     1: open with tab(board, thread), image viewer is not hidden.
-         *     2: open by background(thread).
-         * @param usrUrl1 dat's URL(image viewer only)
-         *
-         */
-        void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
-
-        /*--------------------------------*/
-
         /* from: KitaDockWidgetBase            */
         /* to  : KitaHTMLPart                  */
         /* see also KitaHTMLPart::slotOnURL    */
index 07bc821..787821a 100644 (file)
@@ -140,9 +140,6 @@ KitaMainWindow::KitaMainWindow()
     // allow the view to change the statusbar and caption
     Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
 
-    connect( signalCollection, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
-             SLOT( slotOpenURLRequestExt( const KURL&, const QString ) ) );
-
     connect( m_urlLine, SIGNAL( returnPressed() ),
              SLOT( slotURLLine() ) );
 
@@ -334,30 +331,6 @@ void KitaMainWindow::slotEditCopy()
     }
 }
 
-/* open url */
-/*
-  If mimetype == "text/html", open url with web browser.
-  if mimetype == QString::null, use KIO::NetAccess::mimetype to decide mime type of url.
-*/  /* public slot */
-void KitaMainWindow::slotOpenURLRequestExt( const KURL& url, const QString mimetype )
-{
-    /*  open url with web browser, etc. */
-    if ( mimetype != QString::null ) {
-        KRun::runURL( url, mimetype );
-        return ;
-    }
-
-    /* open thread with new thread tab */
-    if ( Kita::DatManager::isThreadEnrolled( url ) ) {
-        m_threadTab->slotShowMainThread( url );
-        return ;
-    }
-
-    QString url_mimetype = KIO::NetAccess::mimetype( url , this );
-    KRun::runURL( url, url_mimetype );
-}
-
 void KitaMainWindow::slotSetMainStatusbar( const QString& statusStr )
 {
     // display the text on the statusbar
index 3c7a347..65e5007 100644 (file)
@@ -74,7 +74,6 @@ private slots:
     void slotCheckSubjectToggleAction( bool check );
     void slotCheckWriteToggleAction( bool check );
     void slotEditCopy();
-    void slotOpenURLRequestExt( const KURL& url, const QString mimetype = QString::null );
     void slotURLLine();
 
 private:
index cb0a4c7..3cf16c4 100644 (file)
@@ -89,10 +89,6 @@ void KitaPreviewPart::connectSignals()
     connect( view(), SIGNAL( horizontalSliderReleased() ), SLOT( slotHSliderReleased() ) );
 
     connect( signalCollection, SIGNAL( windowDeactivated() ), SLOT( slotHideChildPopup() ) );
-
-    /* click */
-    connect( this, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
-             signalCollection, SIGNAL( openURLRequestExt( const KURL&, const QString ) ) );
 }
 
 void KitaPreviewPart::createHTMLDocument()
@@ -201,7 +197,7 @@ void KitaPreviewPart::clickAnchor( const KURL& urlin )
     /* If this is not anchor, then    */
     /* emit openURLRequest and return */
     if ( datURL.host() != m_datURL.host() || datURL.path() != m_datURL.path() ) {
-        emit openURLRequestExt( urlin );
+        ViewMediator::getInstance()->openURL( urlin );
         return ;
     }
 
@@ -226,7 +222,7 @@ void KitaPreviewPart::clickAnchor( const KURL& urlin )
 
     if ( !refNum ) return ;
 
-    emit openURLRequestExt( urlin );
+    ViewMediator::getInstance()->openURL( urlin );
 }
 
 void KitaPreviewPart::slotDeletePopup()
index 385f3ee..6c50793 100644 (file)
@@ -88,8 +88,6 @@ private slots:
     void slotOnURL( const QString& url );
 
 signals:
-
-    void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
     void mousePressed(); /* to KitaThreadView */
 };
 
index c4c79f6..1a7b4cd 100644 (file)
@@ -76,8 +76,6 @@ ThreadListView::ThreadListView( QWidget* parent, const char* name )
              SLOT( slotHideButton( bool ) ) );
     connect( subjectList, SIGNAL( mouseButtonClicked( int, QListViewItem*, const QPoint&, int ) ),
              SLOT( slotMouseButtonClicked( int, QListViewItem* ) ) );
-    connect( this, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
-             Kita::SignalCollection::getInstance(), SIGNAL( openURLRequestExt( const KURL&, const QString ) ) );
 }
 
 ThreadListView::~ThreadListView()
index 0f0e184..fe5e93a 100644 (file)
@@ -58,8 +58,6 @@ namespace Kita
     private slots:
         void slotSearchButton();
 
-    signals:
-        void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
     };
 }
 
index 9d9467c..2400fe3 100644 (file)
@@ -161,10 +161,6 @@ KitaThreadView::KitaThreadView( KitaThreadTabWidget* parent, const char* name )
     connect( closeButton, SIGNAL( clicked() ),
              SLOT( slotCloseButton() ) );
 
-    Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
-    connect( this, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
-             signalCollection, SIGNAL( openURLRequestExt( const KURL&, const QString ) ) );
-
     m_viewmode = VIEWMODE_MAINVIEW;
     m_rescode = 200;
     m_serverTime = 0;
index e9fe67f..d4b04a7 100644 (file)
@@ -121,7 +121,6 @@ private slots:
 signals:
     void popupMenu( KXMLGUIClient*, const QPoint&, const KURL&, const QString&, mode_t );
     void showThreadCompleted(); /* to KitaThreadPart */
-    void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
 };
 
 #endif
index 5d8af4f..478ffb9 100644 (file)
@@ -9,6 +9,11 @@
  ***************************************************************************/
 #include "viewmediator.h"
 
+#include "libkita/datmanager.h"
+
+#include <kio/netaccess.h>
+#include <krun.h>
+
 ViewMediator* ViewMediator::instance = 0;
 
 ViewMediator::ViewMediator()
@@ -121,3 +126,15 @@ void ViewMediator::updateFavoriteListView()
 
     m_favoriteListView->refresh();
 }
+
+void ViewMediator::openURL( const KURL& url )
+{
+    // open thread.
+    if ( Kita::DatManager::isThreadEnrolled( url ) ) {
+        m_threadTabWidget->slotShowMainThread( url );
+        return;
+    }
+
+    QString mimetype = KIO::NetAccess::mimetype( url , m_threadTabWidget );
+    KRun::runURL( url, mimetype );
+}
index dddbf91..e9d068e 100644 (file)
@@ -54,6 +54,7 @@ public:
     void updateThreadView( const KURL& datURL );
     void changeWriteTab( const KURL& datURL );
     void updateFavoriteListView();
+    void openURL( const KURL& url );
 };
 
 #endif
index cbcf655..5ac9f75 100644 (file)
@@ -88,9 +88,6 @@ void KitaWriteView::initUI()
     connect( buttonCancel, SIGNAL( clicked() ),
              SLOT( slotCancel() ) );
 
-    connect( this, SIGNAL( openURLRequestExt( const KURL&, const QString ) ),
-             signalCollection, SIGNAL( openURLRequestExt( const KURL&, const QString ) ) );
-
     connect( faceCombo, SIGNAL( activated( const QString& ) ),
              bodyText, SLOT( insert( const QString& ) ) );
 
index 5516e21..d0c135b 100644 (file)
@@ -93,8 +93,5 @@ private slots:
 protected slots:
     bool slotBodyTextChanged();
 
-signals:
-
-    void openURLRequestExt( const KURL& url, const QString mimetype = QString::null );
 };
 #endif