libyui-qt-pkg
YQPkgTextDialog.h
1 /**************************************************************************
2 Copyright (C) 2000 - 2010 Novell, Inc.
3 All Rights Reserved.
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 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19 **************************************************************************/
20 
21 
22 /*---------------------------------------------------------------------\
23 | |
24 | __ __ ____ _____ ____ |
25 | \ \ / /_ _/ ___|_ _|___ \ |
26 | \ V / _` \___ \ | | __) | |
27 | | | (_| |___) || | / __/ |
28 | |_|\__,_|____/ |_| |_____| |
29 | |
30 | core system |
31 | (C) SuSE GmbH |
32 \----------------------------------------------------------------------/
33 
34  File: YQPkgTextDialog.h
35 
36  Author: Stefan Hundhammer <shundhammer.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgTextDialog_h
42 #define YQPkgTextDialog_h
43 
44 #include "YQZypp.h"
45 #include <QDialog>
46 #include <QEvent>
47 #include <zypp/ResObject.h>
48 
49 class QPushButton;
50 class QTextBrowser;
51 
52 using std::string;
53 
54 
58 class YQPkgTextDialog: public QDialog
59 {
60  Q_OBJECT
61 
62 public:
63 
73  YQPkgTextDialog( const QString & text,
74  QWidget * parent,
75  const QString & acceptButtonLabel,
76  const QString & rejectButtonLabel );
85  YQPkgTextDialog( const QString & text, QWidget * parent );
86 
90  virtual ~YQPkgTextDialog();
91 
96  virtual QSize sizeHint() const;
97 
101  static void showText( QWidget * parent, const QString & text );
102 
106  static void showText( QWidget * parent,
107  ZyppSel selectable,
108  const string & text );
109 
114  static bool confirmText( QWidget * parent,
115  const QString & text,
116  const QString & acceptButtonLabel,
117  const QString & rejectButtonLabel );
118 
123  static bool confirmText( QWidget * parent, const QString & text );
124  static bool confirmText( QWidget * parent, const char * text );
125 
131  static bool confirmText( QWidget * parent,
132  ZyppSel selectable,
133  const string & text );
134 
140  static QString htmlParagraphs( const string & rawText );
141 
145  static QString htmlHeading( const QString & text );
146 
151  static QString htmlHeading( ZyppSel selectable );
152 
161  static QString htmlEscape( const QString & plainText );
162 
163 
164 public slots:
165 
169  void setText( const QString & text );
170  void setText( const string & text );
171 
175  void setText( ZyppSel selectable,
176  const string & text );
177 
178 protected:
179 
183  void buildDialog( const QString & text,
184  QWidget * parent,
185  const QString & acceptButtonLabel,
186  const QString & rejectButtonLabel = "" );
191  bool eventFilter( QObject * obj, QEvent * ev );
192 
193 
194  // Data members
195 
196  QPushButton * _acceptButton;
197  QPushButton * _rejectButton;
198  QTextBrowser * _textBrowser;
199 };
200 
201 
202 
203 #endif // ifndef YQPkgTextDialog_h
virtual ~YQPkgTextDialog()
Definition: YQPkgTextDialog.cc:86
bool eventFilter(QObject *obj, QEvent *ev)
Definition: YQPkgTextDialog.cc:174
static bool confirmText(QWidget *parent, const QString &text, const QString &acceptButtonLabel, const QString &rejectButtonLabel)
Definition: YQPkgTextDialog.cc:239
void buildDialog(const QString &text, QWidget *parent, const QString &acceptButtonLabel, const QString &rejectButtonLabel="")
Definition: YQPkgTextDialog.cc:92
static void showText(QWidget *parent, const QString &text)
Definition: YQPkgTextDialog.cc:222
static QString htmlParagraphs(const string &rawText)
Definition: YQPkgTextDialog.cc:296
YQPkgTextDialog(const QString &text, QWidget *parent, const QString &acceptButtonLabel, const QString &rejectButtonLabel)
Definition: YQPkgTextDialog.cc:76
static QString htmlHeading(const QString &text)
Definition: YQPkgTextDialog.cc:314
void setText(const QString &text)
Definition: YQPkgTextDialog.cc:203
Dialog that shows a scrolled (HTML) text.
Definition: YQPkgTextDialog.h:58
static QString htmlEscape(const QString &plainText)
Definition: YQPkgTextDialog.cc:281
virtual QSize sizeHint() const
Definition: YQPkgTextDialog.cc:167