OSDN Git Service

kakiko preview
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Thu, 29 Apr 2004 02:57:47 +0000 (02:57 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Thu, 29 Apr 2004 02:57:47 +0000 (02:57 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1006 56b19765-1e22-0410-a548-a0f45d66c51a

ChangeLog
kita/src/kitasubjectview.cpp
kita/src/part/kitathreadview.cpp
kita/src/part/kitathreadview.h
kita/src/part/kitawritedialog.cpp
kita/src/part/kitawritedialog.h
kita/src/part/kitawritedialogbase.ui

index 74ac38c..037d2bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-04-29  Hideki Ikemoto  <ikemo@users.sourceforge.jp>
+
+       * kakiko preview. thanks >> 421
+
 2004-04-27  Hideki Ikemoto  <ikemo@users.sourceforge.jp>
 
        * replace URL of favorites.
index d93c73c..eacb2b1 100644 (file)
@@ -155,7 +155,7 @@ void KitaSubjectView::loadBoard( const Kita::Board* board )
                 item->setText( Col_MarkOrder, "3" );
             }
         } else if ( since.secsTo( currentdat ) < 3600*24 ){
-            item->setText( Col_Mark, "N" );
+            item->setPixmap( Col_Mark, SmallIcon( "newthread" ) );
             item->setText( Col_MarkOrder, "2" );
         } else {
             item->setText( Col_MarkOrder, "1" );
index bf60908..3e70c89 100644 (file)
@@ -260,6 +260,8 @@ void KitaThreadView::slotShowErrorDialog( const QString& input, const KURL& )
             dialog->postMessage();
         } else {
             KitaWriteDialog* dialog = openDialog( m_postInfo );
+            dialog->setupEx( m_thread, m_access, m_viewparent, m_domtreeparent,
+                             m_domtreeparent->getMaxResNumber() + 1 );
             dialog->show();
         }
         break;
@@ -307,6 +309,8 @@ void KitaThreadView::slotWriteButtonClickedCore( QString resstr )
     info.mail = m_mailaddr;
 
     KitaWriteDialog* dialog = openDialog( info );
+    dialog->setupEx( m_thread, m_access, m_viewparent, m_domtreeparent,
+                     m_domtreeparent->getMaxResNumber() + 1 );
     dialog->show(); // work asynchronus.
 }
 
@@ -543,7 +547,7 @@ void KitaThreadView::showThread( const Kita::Thread* thread )
         m_access = NULL;
     }
     setupEx( thread ,
-             m_access,       /* = NULL */
+             m_access,        /* = NULL */
              this,
              m_domtree,
              VIEWMODE_PARENT /* parent mode */
@@ -835,7 +839,7 @@ KURL KitaThreadView::filterReadCGICore( const KURL& url, Kita::Thread* thread )
 /* ex) if url = ..../12345.dat#5-10 */
 /* then refNum = 5, refNum2 = 10    */
 /*----------------------------------*/  /* !!! public & static !!! */
-void KitaThreadView::getRefNumber( const KURL& url, Kita::Thread* thread,       /* input */
+void KitaThreadView::getRefNumber( const KURL& url, Kita::Thread* thread,        /* input */
                                    int& refNum, int& refNum2 /* output */
                                  )
 {
@@ -928,7 +932,7 @@ void KitaThreadView::update_readCache()
 
     /* get log from cahce & copy to dom */
     QString logline = m_access->getcache();
-    if ( logline.length() ){
+    if ( logline.length() ) {
         update_copydata( logline, 1 );
         m_domtree->parseAllRes();
     }
@@ -1249,3 +1253,77 @@ void KitaThreadView::slotSearchButton()
     SearchCombo->setFocus();
 }
 // vim:sw=2:
+
+
+
+/*--------------------------------------------------------*/
+/* These public functions are used for KitaNavi & preview */
+/*--------------------------------------------------------*/
+
+/*---------------------*/
+/* set data & parse it */
+/*---------------------*/ /* public */
+void KitaThreadView::domAppendData( QString& str, int bufnum , int num )
+{
+    m_domtree->setDat( str , bufnum );
+    m_domtree->parseRes( bufnum, num );
+    m_domtree->appendRes( bufnum, FALSE );
+}
+
+
+/* public */
+void KitaThreadView::domDeleteRes( int bufnum )
+{
+    m_domtree->removeRes( bufnum );
+}
+
+
+/* public */
+void KitaThreadView::domAppendBelt( QString idstr )
+{
+    m_domtree->createBeltNode( idstr );
+}
+
+/* public */
+void KitaThreadView::domAppendHTML( QString& url, QString& html )
+{
+
+    m_threadPart->begin( url );
+    m_threadPart->write( html );
+    m_threadPart->end();
+    m_threadPart->show();
+
+}
+
+/* public */
+void KitaThreadView::domApplyChange( QString lbstr,
+                                     QString hstr,
+                                     QString fstr,
+                                     QString anchor,
+                                     QString cmbstr )
+{
+
+    /* label, header & footer */
+    if ( hstr != NULL ) m_domtree->createCommentNode( hstr, "header", 0, 2, TRUE );
+    if ( fstr != NULL ) m_domtree->createCommentNode( fstr, "footer", 0, 0, FALSE );
+    if ( lbstr != NULL ) subjectLabel->setText( lbstr );
+
+    /* update display */
+    m_threadPart->htmlDocument().applyChanges();
+    m_threadPart->view() ->layout();
+    m_threadPart->view() ->setVScrollBarMode( QScrollView::AlwaysOn );
+    m_threadPart->view() ->setFocus();
+
+    GobackAnchorButton->setEnabled( FALSE );
+    writeButton->setEnabled( FALSE );
+    BookmarkButton->setEnabled( FALSE );
+    ReloadButton->setEnabled( FALSE );
+    if ( m_viewmode == VIEWMODE_PREVIEW ) {
+        SearchCombo->setEnabled( FALSE );
+        SearchButton->setEnabled( FALSE );
+        HighLightButton->setEnabled( FALSE );
+    }
+
+    if ( cmbstr != NULL ) SearchCombo->insertItem( cmbstr );
+    if ( anchor != NULL ) gotoAnchor( anchor );
+}
index 8c9e5f7..942f21e 100644 (file)
@@ -81,6 +81,13 @@ public:
     static void getRefNumber( const KURL& url, Kita::Thread* thread,
                               int& renNum, int& refNum2 );
 
+    /* for preview and KitaNavi */    
+    void domAppendData(QString& str,int bufnum,int num );
+    void domDeleteRes(int bufnum);
+    void domAppendBelt(QString idstr);
+    void domAppendHTML(QString& url,QString& html);
+    void domApplyChange(QString lbstr,QString hstr,QString fstr,QString anchor,QString cmbstr);
+    
 public slots:
     void showThread( const Kita::Thread* thread );
     void setFont( const QFont& font );
index 963ea8d..9960330 100644 (file)
@@ -215,3 +215,64 @@ void KitaWriteDialog::reject()
 }
 
 // vim:sw=2:
+
+/*------------------------------------------------------------------*/
+/*------------------------------------------------------------------*/
+
+/* SHOBON extension for preview */
+
+#include <qtabwidget.h>
+#include "kitathreadview.h"
+#include "kitadomtree.h"
+#include "libkita/access.h"
+
+
+void KitaWriteDialog::setupEx(
+    Kita::Thread* thread,
+    Kita::Access* access,
+    KitaThreadView* viewparent,
+    KitaDomTree* domtreeparent,
+    int num
+)
+{
+
+    int wd = width() + 100;
+    int ht = height() + 100;
+    resize( wd, ht );
+
+    connect( qtw, SIGNAL( currentChanged ( QWidget * ) ),
+             this, SLOT( slotCurrentChanged ( QWidget * ) ) );
+
+    m_preview = new KitaThreadView( qtw );
+    qtw->addTab( m_preview, "preview" );
+
+    m_preview->setupEx( thread , access, viewparent, domtreeparent,
+                        VIEWMODE_PREVIEW );
+
+    m_bufnum = 0;
+    m_resnum = num;
+}
+
+
+/*-------------------------------------------------*/
+
+void KitaWriteDialog::slotCurrentChanged ( QWidget * w )
+{
+    if ( w == bodyText ) return ;
+
+    m_preview->domDeleteRes( m_bufnum );
+    m_bufnum++;
+
+    QDateTime now = QDateTime::currentDateTime();
+    QString bodystr = body();
+    bodystr.replace( ">", "&gt;" ).replace( "\n", " <br> " );
+    QString namestr = name();
+    if ( namestr == NULL || namestr.length() == 0 ) namestr = "(default name)";
+    QString str = namestr + "<>" + mail() + "<>"
+                  + now.toString( "yy/MM/dd hh:mm" )
+                  + "<> " + bodystr + " <>";
+
+    m_preview->domAppendData( str, m_bufnum, m_resnum );
+    m_preview->domApplyChange( QString::null,
+                               QString::null, QString::null, QString::null, QString::null );
+}
index 955c62e..7879df1 100644 (file)
 template <class type> class QPtrList;
 class KitaWriteDialogPrivate;
 class KitaWriteDialog;
+class KitaThreadView;
+class KitaDomTree;
+namespace Kita
+{
+    class Access;
+    class Thread;
+};
 
 /**
  * 
@@ -37,10 +44,20 @@ public:
     virtual bool error() { return false; };
 
     static KitaWriteDialog* open( const Kita::PostInfo& info, const Kita::Thread* thread );
+    void setupEx(
+        Kita::Thread* thread,
+        Kita::Access* access,
+        KitaThreadView* viewparent,
+        KitaDomTree* domtreeparent,
+        int num
+    );
 
 public slots:
     void postMessage();
 
+private slots:
+    void slotCurrentChanged ( QWidget * w );
+
 signals:
     void postStarted( KIO::Job*, const Kita::PostInfo& );
     void postFinished( KIO::Job* );
@@ -58,6 +75,9 @@ private:
     QCString m_array;
     bool m_error;
     static KitaWriteDialogPrivate* s_private;
+    KitaThreadView *m_preview;
+    int m_bufnum;
+    int m_resnum;
 
 private slots:
     void slotRecieveData( KIO::Job*, const QByteArray& );
index 4f6c400..6bab302 100644 (file)
                 </widget>
             </hbox>
         </widget>
+       <widget class="QTabWidget">
+            <property name="name">
+                <cstring>qtw</cstring>
+            </property>
         <widget class="QTextEdit">
             <property name="name">
                 <cstring>bodyText</cstring>
             </property>
+         <attribute name="title">
+                <string>body</string>
+            </attribute>
+        </widget>
         </widget>
         <widget class="QLayoutWidget">
             <property name="name">