libyui-qt-pkg
YQPkgChangesDialog.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 | \ \ / /_ _/ ___|_ _|___ \ |
27 | \ V / _` \___ \ | | __) | |
28 | | | (_| |___) || | / __/ |
29 | |_|\__,_|____/ |_| |_____| |
30 | |
31 | core system |
32 | (C) SuSE GmbH |
33 \----------------------------------------------------------------------/
34 
35  File: YQPkgChangesDialog.h
36 
37  Author: Stefan Hundhammer <shundhammer.de>
38 
39 /-*/
40 
41 
42 #ifndef YQPkgChangesDialog_h
43 #define YQPkgChangesDialog_h
44 
45 #include <QDialog>
46 #include <QComboBox>
47 #include <QRegExp>
48 #include <QFlags>
49 
50 #include "YQZypp.h"
51 
52 
53 class YQPkgList;
54 
60 class YQPkgChangesDialog : public QDialog
61 {
62  Q_OBJECT
63 
64 public:
65 
70  {
71  FilterIndexAll = 0,
72  FilterIndexUser = 1,
73  FilterIndexAutomatic = 2
74  };
75 
79  enum Filter
80  {
81  FilterNone = 0x0,
82  FilterUser = 0x1,
83  FilterAutomatic = 0x2,
84  FilterAll = 0x1 | 0x2
85  };
86  Q_DECLARE_FLAGS(Filters, Filter);
87 
91  enum Option
92  {
93  OptionNone = 0x0,
94  OptionAutoAcceptIfEmpty = 0x1
95  };
96  Q_DECLARE_FLAGS(Options, Option);
97 
103  void setFilter( Filters f );
104 
110  void setFilter( const QRegExp &regexp, Filters f );
111 
124  static bool showChangesDialog( QWidget * parent,
125  const QString & message,
126  const QString & acceptButtonLabel,
127  const QString & rejectButtonLabel = QString(),
128  Filters f = FilterAutomatic,
129  Options o = OptionAutoAcceptIfEmpty );
130 
144  static bool showChangesDialog( QWidget * parent,
145  const QString & message,
146  const QRegExp & regexp,
147  const QString & acceptButtonLabel,
148  const QString & rejectButtonLabel = QString(),
149  Filters f = FilterAutomatic,
150  Options o = OptionAutoAcceptIfEmpty );
151 
157  virtual QSize sizeHint () const;
158 
159 protected slots:
163  void slotFilterChanged( int index );
164 
165 protected:
177  YQPkgChangesDialog( QWidget * parent,
178  const QString & message,
179  const QString & acceptButtonLabel,
180  const QString & rejectButtonLabel = QString() );
181 
188  void filter( Filters f = FilterAutomatic );
189 
196  void filter( const QRegExp & regexp, Filters f = FilterAutomatic );
197 
201  virtual bool extraFilter( ZyppSel sel, ZyppPkg pkg );
202 
207  bool isEmpty() const;
208 
209 
210  // Data members
211  QComboBox *_filter;
212  YQPkgList * _pkgList;
213 };
214 
215 Q_DECLARE_OPERATORS_FOR_FLAGS(YQPkgChangesDialog::Filters);
216 Q_DECLARE_METATYPE(YQPkgChangesDialog::Filters);
217 
218 
220 {
221 public:
233  YQPkgUnsupportedPackagesDialog( QWidget * parent,
234  const QString &message,
235  const QString &acceptButtonLabel,
236  const QString &rejectButtonLabel = QString() );
237 
250  static bool showUnsupportedPackagesDialog( QWidget * parent,
251  const QString & message,
252  const QString & acceptButtonLabel,
253  const QString & rejectButtonLabel = QString(),
254  Filters f = FilterAutomatic,
255  Options o = OptionAutoAcceptIfEmpty );
256 protected:
260  virtual bool extraFilter( ZyppSel sel, ZyppPkg pkg );
261 
262 };
263 
264 
265 #endif // ifndef YQPkgChangesDialog_h
Filter
Definition: YQPkgChangesDialog.h:79
void setFilter(Filters f)
Definition: YQPkgChangesDialog.cc:194
FilterIndex
Definition: YQPkgChangesDialog.h:69
static bool showUnsupportedPackagesDialog(QWidget *parent, const QString &message, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString(), Filters f=FilterAutomatic, Options o=OptionAutoAcceptIfEmpty)
Definition: YQPkgChangesDialog.cc:396
virtual bool extraFilter(ZyppSel sel, ZyppPkg pkg)
Definition: YQPkgChangesDialog.cc:305
void slotFilterChanged(int index)
Definition: YQPkgChangesDialog.cc:176
Definition: YQPkgChangesDialog.h:60
bool isEmpty() const
Definition: YQPkgChangesDialog.cc:311
YQPkgUnsupportedPackagesDialog(QWidget *parent, const QString &message, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString())
Definition: YQPkgChangesDialog.cc:378
static bool showChangesDialog(QWidget *parent, const QString &message, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString(), Filters f=FilterAutomatic, Options o=OptionAutoAcceptIfEmpty)
Definition: YQPkgChangesDialog.cc:325
virtual QSize sizeHint() const
Definition: YQPkgChangesDialog.cc:318
Display a list of zypp::Package objects.
Definition: YQPkgList.h:54
Definition: YQPkgChangesDialog.h:219
Option
Definition: YQPkgChangesDialog.h:91
virtual bool extraFilter(ZyppSel sel, ZyppPkg pkg)
Definition: YQPkgChangesDialog.cc:386
YQPkgChangesDialog(QWidget *parent, const QString &message, const QString &acceptButtonLabel, const QString &rejectButtonLabel=QString())
Definition: YQPkgChangesDialog.cc:73
void filter(Filters f=FilterAutomatic)
Definition: YQPkgChangesDialog.cc:170