libyui-qt-pkg  2.47.5
YQPkgProductList.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: YQPkgProductList.h
35 
36  Author: Stefan Hundhammer <sh@suse.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgProductList_h
42 #define YQPkgProductList_h
43 
44 #include <string>
45 #include "YQPkgObjList.h"
46 
47 using std::string;
48 
50 
51 
52 /**
53  * @short Display a list of zypp::Product objects.
54  **/
56 {
57  Q_OBJECT
58 
59 public:
60 
61  /**
62  * Constructor
63  **/
64  YQPkgProductList( QWidget * parent );
65 
66  /**
67  * Destructor
68  **/
69  virtual ~YQPkgProductList();
70 
71 
72 public slots:
73 
74  /**
75  * Add a product to the list. Connect a filter's filterMatch() signal to
76  * this slot. Remember to connect filterStart() to clear() (inherited from
77  * QListView).
78  **/
79  void addProductItem( ZyppSel selectable,
80  ZyppProduct zyppProduct );
81 
82  /**
83  * Fill the product list.
84  **/
85  void fillList();
86 
87 
88 public:
89 
90  /**
91  * Returns the currently selected item or 0 if there is none.
92  **/
94 
95  /**
96  * Returns the column for the product's vendor.
97  **/
98  int vendorCol() const { return _vendorCol; }
99 
100 
101 protected:
102 
103 
104  // Data members
105 
106  int _vendorCol;
107 };
108 
109 
110 
112 {
113 public:
114 
115  /**
116  * Constructor. Creates a YQPkgProductList item that corresponds to
117  * zyppProduct.
118  **/
119  YQPkgProductListItem( YQPkgProductList * productList,
120  ZyppSel selectable,
121  ZyppProduct zyppProduct );
122 
123  /**
124  * Destructor
125  **/
126  virtual ~YQPkgProductListItem();
127 
128  /**
129  * Returns the original zyppProduct object.
130  **/
131  ZyppProduct zyppProduct() const { return _zyppProduct; }
132 
133 
134  // Columns
135 
136  int statusCol() const { return _productList->statusCol(); }
137  int summaryCol() const { return _productList->summaryCol(); }
138  int versionCol() const { return _productList->versionCol(); }
139  int vendorCol() const { return _productList->vendorCol(); }
140 
141 
142 protected:
143 
144  /**
145  * Propagate status changes in this list to other lists:
146  * Have the solver transact all products, patterns, etc.
147  *
148  * Reimplemented from YQPkgObjListItem.
149  **/
150  virtual void applyChanges();
151 
152 
153  // Data members
154 
155  YQPkgProductList * _productList;
156  ZyppProduct _zyppProduct;
157 };
158 
159 
160 #endif // ifndef YQPkgProductList_h
virtual void applyChanges()
Propagate status changes in this list to other lists: Have the solver transact all products...
Abstract base class to display a list of zypp::ResObjects.
Definition: YQPkgObjList.h:66
virtual ~YQPkgProductList()
Destructor.
YQPkgProductListItem(YQPkgProductList *productList, ZyppSel selectable, ZyppProduct zyppProduct)
Constructor.
void fillList()
Fill the product list.
int vendorCol() const
Returns the column for the product&#39;s vendor.
YQPkgProductList(QWidget *parent)
Constructor.
ZyppProduct zyppProduct() const
Returns the original zyppProduct object.
virtual ~YQPkgProductListItem()
Destructor.
ZyppSel selectable() const
Returns the original selectable within the package manager backend.
Definition: YQPkgObjList.h:452
Display a list of zypp::Product objects.
YQPkgProductListItem * selection() const
Returns the currently selected item or 0 if there is none.
void addProductItem(ZyppSel selectable, ZyppProduct zyppProduct)
Add a product to the list.