1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQPkgChangesDialog.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQPkgChangesDialog_h
21 #define YQPkgChangesDialog_h
31 * Changes dialog: Show a dialog with a list of packages that are changed.
32 * By default, only packages with an "auto" status ( not set via selections )
35 class YQPkgChangesDialog : public QDialog
42 * Static convenience method: Post a changes dialog with text
43 * 'message', a list of changed packages and one ( default ) or two buttons.
45 * Returns 'true' if the user accepted ( i.e. clicked the 'accept' button )
46 * and 'false' if the user rejected ( i.e. clicked the 'reject' button or
47 * the window manager close button ).
49 * If the list is empty ( i.e., there are no packages with an "auto"
50 * status ), the dialog is not shown at all ( and returns 'true' ) - unless
51 *'showIfListEmpty' is 'true'.
53 static bool showChangesDialog( const QString & message,
54 const QString & acceptButtonLabel,
55 const QString & rejectButtonLabel = QString::null,
56 bool showIfListEmpty = false );
60 * Static convenience method: Post a changes dialog with text 'message', a
61 * list of changed packages whose names match the specified regular
62 * expression 'regexp' and one ( default ) or two buttons.
64 * Returns 'true' if the user accepted ( i.e. clicked the 'accept' button )
65 * and 'false' if the user rejected ( i.e. clicked the 'reject' button or
66 * the window manager close button ).
68 * If the list is empty ( i.e., there are no packages with an "auto"
69 * status ), the dialog is not shown at all ( and returns 'true' ) - unless
70 *'showIfListEmpty' is 'true'.
72 static bool showChangesDialog( const QString & message,
73 const QRegExp & regexp,
74 const QString & acceptButtonLabel,
75 const QString & rejectButtonLabel = QString::null,
76 bool showIfListEmpty = false );
79 * Returns the preferred size.
81 * Reimplemented from QWidget to limit the dialog to the screen dimensions.
83 virtual QSize sizeHint () const;
88 * Constructor: Creates a changes dialog with text 'message' on
89 * top, a list packages with an "auto" status that is not set via selections
90 * and one ( default ) or two buttons.
92 * Not meant for public use. Applications should use the static
93 * 'showChangesDialog' method instead.
95 * This constructor does not call filter() yet - this is the caller's
98 YQPkgChangesDialog( QWidget * parent,
99 const QString & message,
100 const QString & acceptButtonLabel,
101 const QString & rejectButtonLabel = QString::null );
104 * Apply the filter criteria: Fill the pkg list with pkgs that have a
105 * "modify" status ( install, update, delete ) set by automatic ( i.e. via the
106 * dependency solver ), by application ( i.e. via software selections ) or
107 * manually by the user.
109 void filter( bool byAuto = true,
111 bool byUser = false );
114 * Apply the filter criteria: Fill the pkg list with pkgs that have a
115 * "modify" status ( install, update, delete ) set by automatic ( i.e. via the
116 * dependency solver ), by application ( i.e. via software selections ) or
117 * manually by the user and whose name matches 'regexp'.
119 void filter( const QRegExp & regexp,
122 bool byUser = false );
125 * Returns 'true' if the pkg list is empty.
126 * This is only meaningful after calling 'filter()' !
128 bool isEmpty() const;
133 YQPkgList * _pkgList;
137 #endif // ifndef YQPkgChangesDialog_h