OSDN Git Service

write kakiko to log.txt
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Wed, 26 Nov 2003 14:43:39 +0000 (14:43 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Wed, 26 Nov 2003 14:43:39 +0000 (14:43 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@561 56b19765-1e22-0410-a548-a0f45d66c51a

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

index fd6e9b2..e86dec5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+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.
index eaf3c6c..a86a5fb 100644 (file)
@@ -306,7 +306,7 @@ void KitaThreadView::slotShowErrorDialog( const QString& input, const KURL& )
 
 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&) ),
index c62488f..601138b 100644 (file)
 #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>
@@ -22,6 +24,7 @@
 #include <qlabel.h>
 #include <qcombobox.h>
 #include <qeucjpcodec.h>
+#include <qfile.h>
 
 #include <kio/job.h>
 
@@ -94,7 +97,8 @@ void KitaWriteDialog::fetchPostInfo( Kita::PostInfo * storage ) const
   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 ) {
@@ -117,11 +121,38 @@ KitaWriteDialog* KitaWriteDialog::open( const Kita::PostInfo& info, const QStrin
 
   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 );
@@ -146,6 +177,9 @@ void KitaWriteDialog::postMessage()
   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&) ),
index 80fd535..573793a 100644 (file)
@@ -36,7 +36,7 @@ public:
 
   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();
index fd911e6..3afb42b 100644 (file)
         </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>