OSDN Git Service

9aaee5dc13ed6ea7b56e93086301f673cf3932c2
[kita/kita.git] / kita / src / part / kitawriteview.h
1 /***************************************************************************
2 *   Copyright (C) 2004 by Kita Developers                                 *
3 *   ikemo@users.sourceforge.jp                                            *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 ***************************************************************************/
10
11 #ifndef _KITAWRITEDIALOG_H_
12 #define _KITAWRITEDIALOG_H_
13
14 #include <qwidget.h>
15 #include <kio/job.h>
16 #include <kparts/browserextension.h>
17
18 #include "kitawritedialogbase.h"
19
20 class KitaHTMLPart;
21 class QCp932Codec;
22
23 /* mode */
24 enum{
25     WRITEMODE_NORMAL,
26     WRITEMODE_NEWTHREAD
27 };
28
29
30 /**
31  * 
32  * Hideki Ikemoto
33  **/
34 class KitaWriteView : public KitaWriteDialogBase
35 {
36     Q_OBJECT
37
38     QCString m_array;
39     bool m_error;
40     KitaHTMLPart *m_preview;
41     KURL m_datURL;
42     KURL m_bbscgi;
43     int m_bbstype;
44     int m_mode;
45
46     static QCp932Codec* m_cp932Codec;    
47     
48 public:
49     
50     KitaWriteView( QWidget* parent, const char* name, const KURL& url, int mode, const QString& newThreadName = QString::null );
51     virtual ~KitaWriteView();
52     void setMessage( const QString& bodyStr );
53     void insertMessage( const QString& str );
54
55     const QString name() const;
56     const QString mail() const;
57     const QString body() const;
58     const KURL datURL() const;
59     
60 public slots:
61
62     virtual void setFocus();
63     void slotPostMessage();
64     void slotCancel();
65     void slotEnableWriting( bool enable );
66
67
68 private slots:
69     
70     void slotRecieveData( KIO::Job*, const QByteArray& );
71     void slotPostFinished( KIO::Job* );
72     void slotCurrentChanged ( QWidget * w );
73     bool slotBodyTextChanged();
74     
75 private:
76  
77     QString setPostStr();
78     QString setJBBSPostStr();
79     QString setFlashCGIPostStr();
80     void logPostMessage();    
81     int resultCode( const QString& response ) const;
82     QString resultMessage( const QString& response ) const;
83     QString resultTitle( const QString& response ) const;
84
85
86 signals:
87
88     void postFinished( KIO::Job* );
89     void postResponse( const QString& response, const KURL& bbscgi = KURL() );
90     void openURLRequestExt( const KURL& url, const KParts::URLArgs& args = KParts::URLArgs(),
91                             QString mimetype = QString::null,
92                             int usr1 = 0, int usr2 = 0,
93                             const KURL& usrUrl1 = KURL(),
94                             const KURL& usrUrl2 = KURL(),
95                             const QString& usrStr1 = QString::null,
96                             const QString& usrStr2 = QString::null );
97     void closeCurrentTab();
98 };
99 #endif