From e857d7803123830fc7c273ef445ee670a9b4b1e0 Mon Sep 17 00:00:00 2001 From: ikemo Date: Tue, 3 Jul 2007 14:03:47 +0000 Subject: [PATCH] refactoring. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1985 56b19765-1e22-0410-a548-a0f45d66c51a --- kita/src/bbs/bbsview.cpp | 9 +++++---- kita/src/bbs/bbsview.h | 1 + kita/src/libkita/signalcollection.h | 2 +- kita/src/mainwindow.cpp | 12 +++++------- kita/src/mainwindow.h | 1 + kita/src/write/newthreadwriteview.cpp | 6 +++++- kita/src/write/newthreadwriteview.h | 4 ++++ 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/kita/src/bbs/bbsview.cpp b/kita/src/bbs/bbsview.cpp index 7bb9294..a9c6f04 100644 --- a/kita/src/bbs/bbsview.cpp +++ b/kita/src/bbs/bbsview.cpp @@ -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; } } diff --git a/kita/src/bbs/bbsview.h b/kita/src/bbs/bbsview.h index d0f1576..63f7b14 100644 --- a/kita/src/bbs/bbsview.h +++ b/kita/src/bbs/bbsview.h @@ -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, diff --git a/kita/src/libkita/signalcollection.h b/kita/src/libkita/signalcollection.h index 1e0a6bd..23fdf95 100644 --- a/kita/src/libkita/signalcollection.h +++ b/kita/src/libkita/signalcollection.h @@ -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. diff --git a/kita/src/mainwindow.cpp b/kita/src/mainwindow.cpp index 0171686..2046261 100644 --- a/kita/src/mainwindow.cpp +++ b/kita/src/mainwindow.cpp @@ -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" ) { diff --git a/kita/src/mainwindow.h b/kita/src/mainwindow.h index ecd46a9..ed28522 100644 --- a/kita/src/mainwindow.h +++ b/kita/src/mainwindow.h @@ -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, diff --git a/kita/src/write/newthreadwriteview.cpp b/kita/src/write/newthreadwriteview.cpp index 1e87b0e..4871779 100644 --- a/kita/src/write/newthreadwriteview.cpp +++ b/kita/src/write/newthreadwriteview.cpp @@ -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 */ } diff --git a/kita/src/write/newthreadwriteview.h b/kita/src/write/newthreadwriteview.h index 8d17a63..3ff986b 100644 --- a/kita/src/write/newthreadwriteview.h +++ b/kita/src/write/newthreadwriteview.h @@ -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 -- 2.11.0