libyui-qt-pkg  2.45.5
 All Classes Functions Variables Enumerations
YQPkgLangList.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: YQPkgLangList.h
35 
36  Author: Stefan Hundhammer <sh@suse.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgLangList_h
42 #define YQPkgLangList_h
43 
44 #include <YQPkgObjList.h>
45 
46 
47 class YQPkgLangListItem;
48 
49 /**
50  * @short Display a list of zypp::Selection objects.
51  **/
53 {
54  Q_OBJECT
55 
56 public:
57 
58  /**
59  * Constructor
60  **/
61  YQPkgLangList( QWidget * parent );
62 
63  /**
64  * Destructor
65  **/
66  virtual ~YQPkgLangList();
67 
68 
69 public slots:
70 
71  /**
72  * Filter according to the view's rules and current selection.
73  * Emits those signals:
74  * filterStart()
75  * filterMatch() for each pkg that matches the filter
76  * filterFinished()
77  **/
78  void filter();
79 
80  /**
81  * Same as filter(), but only if this widget is currently visible.
82  **/
83  void filterIfVisible();
84 
85 
86  /**
87  * Add a selection to the list. Connect a filter's filterMatch() signal to
88  * this slot. Remember to connect filterStart() to clear() (inherited from
89  * QListView).
90  **/
91  void addLangItem( const zypp::Locale & lang );
92 
93  /**
94  * update from base class to not access selectables
95  **/
96  virtual void updateActions( YQPkgObjListItem * item = 0);
97 
98 public:
99 
100  /**
101  * Returns the currently selected item or 0 if there is none.
102  **/
103  YQPkgLangListItem * selection() const;
104 
105 
106 signals:
107 
108  /**
109  * Emitted when the filtering starts. Use this to clear package lists
110  * etc. prior to adding new entries.
111  **/
112  void filterStart();
113 
114  /**
115  * Emitted during filtering for each pkg that matches the filter.
116  **/
117  void filterMatch( ZyppSel selectable,
118  ZyppPkg pkg );
119 
120  /**
121  * Emitted when filtering is finished.
122  **/
123  void filterFinished();
124 
125 
126 protected slots:
127 
128  /**
129  * Fill the language list.
130  **/
131  void fillList();
132 };
133 
134 
135 
137 {
138 public:
139 
140  /**
141  * Constructor. Creates a YQPkgLangList item that corresponds to the package
142  * manager object that 'pkg' refers to.
143  **/
144  YQPkgLangListItem( YQPkgLangList * pkgSelList,
145  const zypp::Locale & lang );
146 
147  /**
148  * Destructor
149  **/
150  virtual ~YQPkgLangListItem();
151 
152  /**
153  * Returns the original object within the package manager backend.
154  **/
155  zypp::Locale zyppLang() const { return _zyppLang; }
156 
157  /// overloaded
158  virtual void init();
159 
160  // Columns
161 
162  int statusCol() const { return _langList->statusCol(); }
163 
164  /**
165  * override this two as we don't have a real selectable and
166  * the status depends on the language
167  **/
168  virtual ZyppStatus status() const;
169  virtual void setStatus( ZyppStatus newStatus, bool sendSignals = true );
170 
171  /**
172  * Returns 'true' if this selectable's status is set by a selection
173  * (rather than by the user or by the dependency solver).
174  **/
175  virtual bool bySelection() const;
176 
177  /**
178  * Cycle the package status to the next valid value.
179  **/
180  virtual void cycleStatus();
181 
182  /**
183  * Sorting function. Redefined here (bnc#428355) as the one from
184  * parent YQPkgObjList can't be used - it refers to zyppObj's which
185  * are NULL here as zypp::Locale is not zypp::ResObject anymore
186  **/
187  virtual bool operator< ( const QTreeWidgetItem & other ) const;
188 
189 protected:
190 
191  /**
192  * Propagate status changes in this list to other lists:
193  * Have the solver transact all languages.
194  *
195  * Reimplemented from YQPkgObjListItem.
196  **/
197  virtual void applyChanges();
198 
199 
200  // Data members
201 
202  YQPkgLangList * _langList;
203  zypp::Locale _zyppLang;
204 };
205 
206 
207 #endif // ifndef YQPkgLangList_h
Abstract base class to display a list of zypp::ResObjects.
Definition: YQPkgObjList.h:68
void filterIfVisible()
Same as filter(), but only if this widget is currently visible.
virtual ZyppStatus status() const
override this two as we don't have a real selectable and the status depends on the language ...
virtual void cycleStatus()
Cycle the package status to the next valid value.
virtual ~YQPkgLangListItem()
Destructor.
void filter()
Filter according to the view's rules and current selection.
void fillList()
Fill the language list.
virtual void updateActions(YQPkgObjListItem *item=0)
update from base class to not access selectables
void filterMatch(ZyppSel selectable, ZyppPkg pkg)
Emitted during filtering for each pkg that matches the filter.
YQPkgLangList(QWidget *parent)
Constructor.
virtual bool bySelection() const
Returns 'true' if this selectable's status is set by a selection (rather than by the user or by the d...
virtual void setStatus(ZyppStatus newStatus, bool sendSignals=true)
Set the (binary RPM) package status.
void filterFinished()
Emitted when filtering is finished.
YQPkgLangListItem * selection() const
Returns the currently selected item or 0 if there is none.
void addLangItem(const zypp::Locale &lang)
Add a selection to the list.
Display a list of zypp::Selection objects.
Definition: YQPkgLangList.h:52
YQPkgLangListItem(YQPkgLangList *pkgSelList, const zypp::Locale &lang)
Constructor.
void filterStart()
Emitted when the filtering starts.
virtual ~YQPkgLangList()
Destructor.
zypp::Locale zyppLang() const
Returns the original object within the package manager backend.
virtual void applyChanges()
Propagate status changes in this list to other lists: Have the solver transact all languages...
virtual void init()
overloaded
virtual bool operator<(const QTreeWidgetItem &other) const
Sorting function.