00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef KFeedback_h
00015 #define KFeedback_h
00016
00017 #ifdef HAVE_CONFIG_H
00018 #include <config.h>
00019 #endif
00020
00021 #include <ntqlistview.h>
00022 #include <ntqvbox.h>
00023 #include <kdialogbase.h>
00024
00025
00026 #ifndef NOT_USED
00027 # define NOT_USED(PARAM) ( (void) (PARAM) )
00028 #endif
00029
00030
00031 class KFeedbackForm;
00032 class KFeedbackQuestionList;
00033 class KFeedbackQuestion;
00034 class KFeedbackAnswer;
00035 class TQMultiLineEdit;
00036
00037
00042 class KFeedbackDialog: public KDialogBase
00043 {
00044 Q_OBJECT
00045
00046 public:
00047
00051 KFeedbackDialog( const TQString & feedbackMailAddress,
00052 const TQString & helpTopic = TQString::null );
00053
00054
00058 virtual ~KFeedbackDialog();
00059
00060
00064 KFeedbackForm *form() { return _form; }
00065
00066
00067 public slots:
00068
00073 void checkSendButton();
00074
00075
00076 signals:
00083 void mailSent();
00084
00085
00086 protected:
00087
00088 KFeedbackForm * _form;
00089 };
00090
00091
00098 class KFeedbackForm: public TQVBox
00099 {
00100 Q_OBJECT
00101
00102 public:
00106 KFeedbackForm( const TQString & feedbackMailAddress,
00107 TQWidget * parent );
00108
00112 virtual ~KFeedbackForm();
00113
00114
00115 public slots:
00116
00128 virtual void sendMail();
00129
00130
00131 public:
00132
00137 virtual bool readyToSend();
00138
00142 KFeedbackQuestionList * questionList() { return _questionList; }
00143
00144
00145 signals:
00152 void mailSent();
00153
00159 void checkComplete();
00160
00161
00162 protected slots:
00166 void slotCheckComplete();
00167
00168
00169 protected:
00170
00174 TQString formatComment();
00175
00176
00177 TQString _feedbackMailAddress;
00178 KFeedbackQuestionList * _questionList;
00179 TQMultiLineEdit * _comment;
00180 };
00181
00182
00183
00187 class KFeedbackQuestionList: public TQListView
00188 {
00189 Q_OBJECT
00190
00191 public:
00192
00196 KFeedbackQuestionList( TQWidget *parent );
00197
00201 virtual ~KFeedbackQuestionList();
00202
00207 virtual bool isComplete();
00208
00212 TQString result();
00213
00231 KFeedbackQuestion * addQuestion( const TQString & text,
00232 const TQString & id,
00233 bool exclusiveAnswer = true,
00234 bool required = false );
00235
00239 void addYesNoQuestion( const TQString & text,
00240 const TQString & id,
00241 bool required = false );
00242
00247 KFeedbackQuestion * firstQuestion() const
00248 { return (KFeedbackQuestion *) TQListView::firstChild(); }
00249
00255 void questionAnswered();
00256
00262 void questionAdded( KFeedbackQuestion * question );
00263
00264 signals:
00268 void checkComplete();
00269 };
00270
00271
00275 class KFeedbackQuestion: public TQCheckListItem
00276 {
00277 public:
00278
00300 KFeedbackQuestion( KFeedbackQuestionList * parent,
00301 const TQString & text,
00302 const TQString & id,
00303 bool exclusiveAnswer = true,
00304 bool required = false,
00305 bool open = true );
00306
00313 void addAnswer( const TQString & text,
00314 const TQString & id );
00315
00319 bool isRequired() { return _required; }
00320
00324 bool isAnswered();
00325
00334 TQString result();
00335
00339 TQString id() { return _id; }
00340
00344 TQString text();
00345
00349 bool exclusiveAnswer() { return _exclusiveAnswer; }
00350
00351
00357 virtual TQString key( int column, bool ascending ) const;
00358
00362 KFeedbackQuestion * nextQuestion() const
00363 { return (KFeedbackQuestion *) TQListViewItem::nextSibling(); }
00364
00369 KFeedbackAnswer * firstAnswer() const
00370 { return (KFeedbackAnswer *) TQListViewItem::firstChild(); }
00371
00376 KFeedbackQuestionList * questionList() const;
00377
00378
00379 protected:
00380
00381 TQString _id;
00382 bool _exclusiveAnswer;
00383 bool _required;
00384 int _no;
00385 };
00386
00387
00388 class KFeedbackAnswer: public TQCheckListItem
00389 {
00390 public:
00397 KFeedbackAnswer( KFeedbackQuestion * parent,
00398 const TQString & text,
00399 const TQString & id,
00400 bool exclusive = true );
00401
00405 TQString id() { return _id; }
00406
00410 TQString text();
00411
00415 bool isExclusive() { return _exclusive; }
00416
00420 bool isChecked() { return TQCheckListItem::isOn(); }
00421
00425 KFeedbackAnswer * nextAnswer() const
00426 { return (KFeedbackAnswer *) TQListViewItem::nextSibling(); }
00427
00431 KFeedbackQuestion * question() const
00432 { return (KFeedbackQuestion *) TQListViewItem::parent(); }
00433
00439 virtual TQString key( int column, bool ascending ) const;
00440
00441
00449 virtual void stateChange( bool newState );
00450
00451 protected:
00452
00453 TQString _id;
00454 bool _exclusive;
00455 int _no;
00456 };
00457
00458
00459
00460 #endif // KFeedback_h
00461
00462
00463