00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef YQPkgTextDialog_h
00023 #define YQPkgTextDialog_h
00024
00025 #include <qdialog.h>
00026 #include <y2pm/PMObject.h>
00027
00028 class QPushButton;
00029 class QTextBrowser;
00030
00031 using std::list;
00032 using std::string;
00033
00034
00038 class YQPkgTextDialog: public QDialog
00039 {
00040 Q_OBJECT
00041
00042 public:
00043
00053 YQPkgTextDialog( const QString & text,
00054 QWidget * parent,
00055 const QString & acceptButtonLabel,
00056 const QString & rejectButtonLabel );
00065 YQPkgTextDialog( const QString & text, QWidget * parent );
00066
00070 virtual ~YQPkgTextDialog();
00071
00076 virtual QSize sizeHint() const;
00077
00081 static void showText( QWidget * parent, const QString & text );
00082 static void showText( QWidget * parent, const string & text );
00083 static void showText( QWidget * parent, const list<string> & text );
00084
00088 static void showText( QWidget * parent,
00089 PMObjectPtr pmObj,
00090 const list<string> & text );
00091 static void showText( QWidget * parent,
00092 PMObjectPtr pmObj,
00093 const string & text );
00094
00099 static bool confirmText( QWidget * parent,
00100 const QString & text,
00101 const QString & acceptButtonLabel,
00102 const QString & rejectButtonLabel );
00103
00108 static bool confirmText( QWidget * parent, const QString & text );
00109
00115 static bool confirmText( QWidget * parent,
00116 PMObjectPtr pmObj,
00117 const list<string> & text );
00118
00119 static bool confirmText( QWidget * parent,
00120 PMObjectPtr pmObj,
00121 const string & text );
00122
00127 static QString htmlParagraphs( const list<string> & text );
00128
00132 static QString htmlHeading( const QString & text );
00133
00138 static QString htmlHeading( PMObjectPtr pmObj );
00139
00148 static QString htmlEscape( const QString & plainText );
00149
00150
00151 public slots:
00152
00156 void setText( const QString & text );
00157 void setText( const string & text );
00158 void setText( const list<string> & text );
00159
00163 void setText( PMObjectPtr pmObj,
00164 const list<string> & text );
00165
00166 protected:
00167
00171 void buildDialog( const QString & text,
00172 QWidget * parent,
00173 const QString & acceptButtonLabel,
00174 const QString & rejectButtonLabel = "" );
00179 bool eventFilter( QObject * obj, QEvent * ev );
00180
00181
00182
00183
00184 QPushButton * _acceptButton;
00185 QPushButton * _rejectButton;
00186 QTextBrowser * _textBrowser;
00187 };
00188
00189
00190
00191 #endif // ifndef YQPkgTextDialog_h