OSDN Git Service

refactoring.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Tue, 19 Jun 2007 11:47:30 +0000 (11:47 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Tue, 19 Jun 2007 11:47:30 +0000 (11:47 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1972 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/write/previewpart.cpp
kita/src/write/previewpart.h

index c446e70..632569f 100644 (file)
@@ -1,45 +1,30 @@
 /***************************************************************************
-*   Copyright (C) 2004 by Kita Developers                                 *
-*   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 <kpopupmenu.h>
-#include <klocale.h>
-#include <khtml_events.h>
-#include <kdebug.h>
+ *   Copyright (C) 2004 by Kita Developers                                 *
+ *   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 <dom/html_element.h>
-#include <dom/html_misc.h>
+#include "previewpart.h"
 
 #include <qcursor.h>
-#include <qapplication.h>
-#include <qclipboard.h>
-#include <qmessagebox.h>
-#include <qregexp.h>
 
-#include "previewpart.h"
+#include <khtml_events.h>
+
+#include <dom/html_misc.h>
 
-#include "thread/domtree.h"
 #include "thread/respopup.h"
 
 #include "kitaui/htmlview.h"
 
 #include "libkita/kitaconfig.h"
 #include "libkita/datmanager.h"
-#include "libkita/boardmanager.h"
-#include "libkita/datinfo.h"
 #include "libkita/kita_misc.h"
 #include "libkita/signalcollection.h"
 #include "libkita/config_xt.h"
-#include "libkita/abone.h"
-
-/*-------------------------------------------*/
-
 
 /*-------------------------------------*/
 /* Don't forget to call setup() later. */
@@ -310,12 +295,6 @@ void KitaPreviewPart::slotDeletePopup()
 /* for convenience */ /* private */
 void KitaPreviewPart::showPopup( const KURL& url, const QString& innerHTML )
 {
-    showPopupCore( url, innerHTML, QCursor::pos() );
-}
-
-/* show popup window   */  /* private */
-void KitaPreviewPart::showPopupCore( const KURL& url, const QString& innerHTML, QPoint point )
-{
     slotDeletePopup();
     m_multiPopup = FALSE;
 
@@ -325,7 +304,7 @@ void KitaPreviewPart::showPopupCore( const KURL& url, const QString& innerHTML,
 
     m_popup->setText( innerHTML );
     m_popup->adjustSize();
-    m_popup->adjustPos( point );
+    m_popup->adjustPos( QCursor::pos() );
     m_popup->show();
 }
 
@@ -346,8 +325,11 @@ bool KitaPreviewPart::startMultiPopup()
 /* Is it multi-popup mode now ? */ /* private */
 bool KitaPreviewPart::isMultiPopupMode()
 {
-    if ( !m_popup ) m_multiPopup = FALSE;
-    else if ( m_popup->isHidden() ) m_multiPopup = FALSE;
+    if ( !m_popup ) {
+        m_multiPopup = FALSE;
+    } else if ( m_popup->isHidden() ) {
+        m_multiPopup = FALSE;
+    }
 
     return m_multiPopup;
 }
@@ -355,7 +337,10 @@ bool KitaPreviewPart::isMultiPopupMode()
 /* private */
 void KitaPreviewPart::hidePopup()
 {
-    if ( m_popup ) m_popup->hide();
+    if ( m_popup ) {
+        m_popup->hide();
+    }
+
     m_multiPopup = FALSE;
 }
 
@@ -363,8 +348,8 @@ void KitaPreviewPart::hidePopup()
 void KitaPreviewPart::slotLeave()
 {
     if ( isMultiPopupMode() ) return ;
-    if ( view() ->isHorizontalSliderPressed() ) return ;
-    if ( view() ->isVerticalSliderPressed () ) return ;
+    if ( view()->isHorizontalSliderPressed() ) return ;
+    if ( view()->isVerticalSliderPressed () ) return ;
 
     hidePopup();
 }
@@ -372,7 +357,7 @@ void KitaPreviewPart::slotLeave()
 /* private slot */
 void KitaPreviewPart::slotVSliderReleased()
 {
-    QScrollBar * bar = view() ->verticalScrollBar();
+    QScrollBar* bar = view()->verticalScrollBar();
     QRect rt = bar->sliderRect();
 
     hidePopup();
@@ -381,7 +366,7 @@ void KitaPreviewPart::slotVSliderReleased()
 /* private slot */
 void KitaPreviewPart::slotHSliderReleased()
 {
-    QScrollBar * bar = view() ->horizontalScrollBar();
+    QScrollBar* bar = view()->horizontalScrollBar();
     QRect rt = bar->sliderRect();
 
     hidePopup();
index 6bf027c..39560d1 100644 (file)
@@ -1,51 +1,26 @@
 /***************************************************************************
-*   Copyright (C) 2004 by Kita Developers                                 *
-*   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) 2004 by Kita Developers                                 *
+ *   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 PREVIEWPART_H
 #define PREVIEWPART_H
 
 #include <khtml_part.h>
-#include <qframe.h>
-#include <qevent.h>
-
-/* mode */
-enum {
-    /* This part is not initialized. This part works as just KHTMLPart */
-    PREVIEWPART_MODE_KHTML,
-
-    /* on main window */
-    PREVIEWPART_MODE_MAINPART,
-
-    /* on popup       */
-    PREVIEWPART_MODE_POPUP
-};
 
 /* ID of user defined event */
 #define EVENT_GotoAnchor ( QEvent::User + 100 )
 
-class KitaDomTree;
-class KURL;
-
 namespace Kita
 {
     class ResPopup;
 }
 
-namespace DOM
-{
-    class Node;
-}
-
-
-/*-------------------------------------------------------------*/
-
 class KitaPreviewPart : public KHTMLPart
 {
     Q_OBJECT
@@ -62,7 +37,6 @@ class KitaPreviewPart : public KHTMLPart
     bool m_multiPopup;
     bool m_kitaIsActive;
 
-
 public:
 
     KitaPreviewPart( QWidget* parent, const char* name = 0 );
@@ -94,7 +68,6 @@ private:
 
     /* res popup */
     void showPopup( const KURL& url, const QString& innerHTML );
-    void showPopupCore( const KURL& url, const QString& innerHTML, QPoint point );
     bool startMultiPopup();
     bool isMultiPopupMode();
     void hidePopup();
@@ -107,7 +80,6 @@ protected:
     /* mouse event */
     virtual void khtmlMousePressEvent( khtml::MousePressEvent* e );
 
-
 private slots:
 
     /* res popup */
@@ -118,7 +90,6 @@ private slots:
     void slotKitaIsActive();
     void slotOnURL( const QString& url );
 
-
 signals:
 
     void openURLRequestExt( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs(),
@@ -128,7 +99,6 @@ signals:
     void mousePressed(); /* to KitaThreadView */
 
     /* res popup */
-    void hideChildPopup();
     void isKitaActive();
 };