]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/pkg/YQPkgProductList.h
don't create QObjects in ycp thread - make timeouts work
[duncan/yast2-qt4.git] / src / pkg / YQPkgProductList.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQPkgProductList.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQPkgProductList_h
21 #define YQPkgProductList_h
22
23 #include <string>
24 #include "YQPkgObjList.h"
25
26 using std::string;
27
28 class YQPkgProductListItem;
29
30
31 /**
32  * @short Display a list of zypp::Product objects.
33  **/
34 class YQPkgProductList : public YQPkgObjList
35 {
36     Q_OBJECT
37
38 public:
39
40     /**
41      * Constructor
42      **/
43     YQPkgProductList( QWidget * parent );
44
45     /**
46      * Destructor
47      **/
48     virtual ~YQPkgProductList();
49
50
51 public slots:
52
53     /**
54      * Add a product to the list. Connect a filter's filterMatch() signal to
55      * this slot. Remember to connect filterStart() to clear() (inherited from
56      * QListView).
57      **/
58     void addProductItem( ZyppSel        selectable,
59                          ZyppProduct    zyppProduct );
60
61     /**
62      * Fill the product list.
63      **/
64     void fillList();
65
66
67 public:
68
69     /**
70      * Returns the currently selected item or 0 if there is none.
71      **/
72     YQPkgProductListItem * selection() const;
73
74     /**
75      * Returns the column for the product's vendor.
76      **/
77     int vendorCol() const { return _vendorCol; }
78
79
80 protected:
81
82
83     // Data members
84
85     int _vendorCol;
86 };
87
88
89
90 class YQPkgProductListItem: public YQPkgObjListItem
91 {
92 public:
93
94     /**
95      * Constructor. Creates a YQPkgProductList item that corresponds to
96      * zyppProduct.
97      **/
98     YQPkgProductListItem( YQPkgProductList *    productList,
99                           ZyppSel               selectable,
100                           ZyppProduct           zyppProduct );
101
102     /**
103      * Destructor
104      **/
105     virtual ~YQPkgProductListItem();
106
107     /**
108      * Returns the original zyppProduct object.
109      **/
110     ZyppProduct zyppProduct() const { return _zyppProduct; }
111
112
113     // Columns
114
115     int statusCol()     const   { return _productList->statusCol();     }
116     int summaryCol()    const   { return _productList->summaryCol();    }
117     int versionCol()    const   { return _productList->versionCol();    }
118     int vendorCol()     const   { return _productList->vendorCol();     }
119
120
121 protected:
122
123     /**
124      * Propagate status changes in this list to other lists:
125      * Have the solver transact all products, patterns, etc.
126      *
127      * Reimplemented from YQPkgObjListItem.
128      **/
129     virtual void applyChanges();
130
131
132     // Data members
133
134     YQPkgProductList *  _productList;
135     ZyppProduct         _zyppProduct;
136 };
137
138
139 #endif // ifndef YQPkgProductList_h