/***************************************************************************
* Copyright (C) 2003 by Hideki Ikemoto *
* ikemo@wakaba.jp *
+ * linuxÈÄ ¥³¥ó¥«¥é¤×¤é¤°¤¤¤ó¤Î¿Í *
* *
* 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 *
#include "qcp932codec.h"
#include <qsjiscodec.h>
#include <qlabel.h>
+#include <qcombobox.h>
#include <time.h>
#include <kmessagebox.h>
#include <krun.h>
+#include <dom/html_element.h>
+#include <dom/html_inline.h>
+
#include "kitathreadview.h"
#include "kitawritedialog.h"
aLayout->addWidget(threadPart->view());
connect(writeButton, SIGNAL(clicked()), SLOT(slotWriteButtonClicked()));
+ connect(threadPart, SIGNAL(nodeActivated(const DOM::Node &)), SLOT(slotDOMNodeActivated(const DOM::Node &)));
connect(threadPart, SIGNAL(onURL(const QString&)), SLOT(slotOnURL(const QString&)));
connect(threadPart->browserExtension(),
SIGNAL(openURLRequest(const KURL&, const KParts::URLArgs&)),
KitaThreadView::~KitaThreadView() {}
+void KitaThreadView::slotDOMNodeActivated(const DOM::Node &node)
+{
+ { //process Anchor tags.
+ DOM::HTMLAnchorElement anchor = node;
+
+ if ( ! anchor.href().isEmpty() )
+ {
+ KURL link;
+ QString boardName = m_datURL.path().section('/', 1, 1);
+ QString datnum = m_datURL.filename().section('.', 0, 0);
+ { // treat link as path.
+ link.setPath( anchor.href().string() );
+ if ( link.path().section('/', -5, -4) == "test/read.cgi"
+ && link.path().section('/', -3, -3) == boardName
+ && link.path().section('/', -2, -2) == datnum )
+ {
+ QString target;
+ bool ok;
+ link.filename().toInt( &ok );
+ if ( ok )
+ target = link.filename();
+ else if ( link.filename().contains('-') ) {
+ target = link.filename().section('-', 0, 0);
+ if( target.isEmpty() ) target = "1";
+ } else if ( link.filename().at(0) == 'l' )
+ target = QString().setNum( m_rescount - link.filename().remove('l').
+toInt() );
+ // do jump to target.
+ if ( ! target.isEmpty() ) threadPart->gotoAnchor( target );
+ }
+ } // end: tread link as path.
+ } // end: anchor.href().isEmpty()
+ } // end of Anchor tags.
+}
+
void KitaThreadView::slotShowThread(const KURL& _datURL, const KURL& _boardURL, const QString& boardName)
{
KIO::SlaveConfig::self()->setConfigData("http", _datURL.host() ,
subjectLabel->setText(QString("[") + m_boardName + QString("] ") + subject);
}
text += "<dl><dt>";
+ text += "<a name=\"";
+ text += QString::number(num);
+ text += "\" />";
text += QString::number(num);
text += " ";
if(address != "") {
num++;
}
+ m_rescount = num - 1;
+
threadPart->begin(KURL(m_threadURL));
threadPart->write(text);
threadPart->end();