+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.
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" );
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;
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.
}
m_access = NULL;
}
setupEx( thread ,
- m_access, /* = NULL */
+ m_access, /* = NULL */
this,
m_domtree,
VIEWMODE_PARENT /* parent mode */
/* 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 */
)
{
/* 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();
}
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 );
+}
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 );
}
// 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( ">", ">" ).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 );
+}
template <class type> class QPtrList;
class KitaWriteDialogPrivate;
class KitaWriteDialog;
+class KitaThreadView;
+class KitaDomTree;
+namespace Kita
+{
+ class Access;
+ class Thread;
+};
/**
*
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* );
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& );
</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">