+2003-11-26 Hideki Ikemoto <ikemo@users.sourceforge.jp>
+
+ * write kakiko to $KDEHOME/share/apps/kita/log.txt
+
2003-11-24 Hideki Ikemoto <ikemo@users.sourceforge.jp>
* add --enable-xdg-menu switch.
KitaWriteDialog* KitaThreadView::openDialog( const Kita::PostInfo& info )
{
- KitaWriteDialog* new_dialog = KitaWriteDialog::open( info, m_thread.boardName(), m_thread.name() );
+ KitaWriteDialog* new_dialog = KitaWriteDialog::open( info, m_thread.boardName(), m_thread.name(), m_thread.url() );
connect( new_dialog, SIGNAL( postStarted( KIO::Job *, const Kita::PostInfo& ) ),
this, SLOT( slotPostStarted( KIO::Job*, const Kita::PostInfo&) ) );
connect( new_dialog, SIGNAL( postResponse(const QString&, const KURL&) ),
#include "kitawritedialog.h"
#include "libkita/qcp932codec.h"
#include "kitaconfig.h"
+#include "kita2ch.h"
#include <ksqueezedtextlabel.h>
#include <klocale.h>
#include <kdebug.h>
+#include <kstandarddirs.h>
#include <qlineedit.h>
#include <qtextedit.h>
#include <qlabel.h>
#include <qcombobox.h>
#include <qeucjpcodec.h>
+#include <qfile.h>
#include <kio/job.h>
storage->body = body();
}
-KitaWriteDialog* KitaWriteDialog::open( const Kita::PostInfo& info, const QString& boardName, const QString& threadName )
+// TODO: Thread¥¯¥é¥¹¤ò»È¤¦¤è¤¦¤Ë½ñ¤´¹¤¨¤ë
+KitaWriteDialog* KitaWriteDialog::open( const Kita::PostInfo& info, const QString& boardName, const QString& threadName, const KURL& threadURL )
{
if ( ! info.check() ) return 0;
if ( ! s_private ) {
new_dlg->boardNameLabel->setText( boardName );
new_dlg->threadNameLabel->setText( threadName );
+ new_dlg->threadURLLabel->setText( threadURL.url() );
new_dlg->setCaption( i18n("Write in %1").arg( threadName ) );
return new_dlg;
}
+static void logPostMessage( const Kita::PostInfo& postInfo,
+ const QString& boardName,
+ const QString& threadName,
+ const QString& threadURL )
+{
+ QDateTime now = QDateTime::currentDateTime();
+ QString logPath = locateLocal( "appdata", "log.txt" );
+
+ QFile file( logPath );
+ if ( file.open( IO_WriteOnly | IO_Append ) ) {
+ QTextStream stream( &file );
+ stream.setEncoding( QTextStream::UnicodeUTF8 );
+
+ stream << "Date : " << now.toString( "yyyy/MM/dd hh:mm:ss" ) << endl; // ¸½ºß»þ¹ï
+ stream << "Board : " << boardName << endl;
+ stream << "Thread : " << threadName << endl;
+ stream << "URL : " << threadURL << endl;
+ stream << "Name : " << postInfo.name << endl;
+ stream << "Mail : " << postInfo.mail << endl << endl;
+ stream << postInfo.body << endl;
+ stream << "----------------------------------------" << endl;
+
+ file.close();
+ }
+}
+
void KitaWriteDialog::postMessage()
{
fetchPostInfo( &m_postInfo );
if ( ! m_postInfo.cookie.isEmpty() )
job->addMetaData("cookie", m_postInfo.cookie.prepend("Cookie: "));
+ // TODO: rewrite!
+ logPostMessage( m_postInfo, boardNameLabel->text(), threadNameLabel->text(), threadURLLabel->text() );
+
emit postStarted( job, m_postInfo );
connect( job, SIGNAL( data(KIO::Job*, const QByteArray&) ),
virtual bool error(){ return false; };
- static KitaWriteDialog * open( const Kita::PostInfo& info, const QString&, const QString& );
+ static KitaWriteDialog * open( const Kita::PostInfo& info, const QString&, const QString&, const KURL& threadURL );
public slots:
void postMessage();
</property>
<widget class="QLayoutWidget">
<property name="name">
- <cstring>layout4</cstring>
+ <cstring>layout8</cstring>
</property>
- <grid>
+ <hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="KSqueezedTextLabel" row="0" column="1">
- <property name="name">
- <cstring>boardNameLabel</cstring>
- </property>
- <property name="text">
- <string>board name</string>
- </property>
- </widget>
- <widget class="QLabel" row="1" column="0">
- <property name="name">
- <cstring>textLabel1_2</cstring>
- </property>
- <property name="text">
- <string>Thread Name:</string>
- </property>
- </widget>
- <widget class="QLabel" row="0" column="0">
+ <widget class="QLayoutWidget">
<property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Board Name:</string>
- </property>
+ <cstring>layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Board Name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Thread Name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Thread URL:</string>
+ </property>
+ </widget>
+ </vbox>
</widget>
- <widget class="KSqueezedTextLabel" row="1" column="1">
+ <widget class="QLayoutWidget">
<property name="name">
- <cstring>threadNameLabel</cstring>
- </property>
- <property name="text">
- <string>thread name</string>
- </property>
+ <cstring>layout7</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KSqueezedTextLabel">
+ <property name="name">
+ <cstring>boardNameLabel</cstring>
+ </property>
+ <property name="text">
+ <string>board name</string>
+ </property>
+ </widget>
+ <widget class="KSqueezedTextLabel">
+ <property name="name">
+ <cstring>threadNameLabel</cstring>
+ </property>
+ <property name="text">
+ <string>thread name</string>
+ </property>
+ </widget>
+ <widget class="KSqueezedTextLabel">
+ <property name="name">
+ <cstring>threadURLLabel</cstring>
+ </property>
+ <property name="text">
+ <string>thread url</string>
+ </property>
+ </widget>
+ </vbox>
</widget>
- </grid>
+ </hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<includehints>
<includehint>ksqueezedtextlabel.h</includehint>
<includehint>ksqueezedtextlabel.h</includehint>
+ <includehint>ksqueezedtextlabel.h</includehint>
</includehints>
</UI>