43 #define YUILogComponent "qt-pkg" 47 #include <QHeaderView> 50 #include "YQPkgLangList.h" 52 #include "zypp/sat/LocaleSupport.h" 62 yuiDebug() <<
"Creating language list" << endl;
66 headers <<
""; _statusCol = numCol++;
70 headers << _(
"Code" ); _nameCol = numCol++;
73 headers << _(
"Language"); _summaryCol = numCol++;
74 setAllColumnsShowFocus(
true );
75 setHeaderLabels(headers);
76 header()->setSectionResizeMode( _nameCol, QHeaderView::ResizeToContents );
77 header()->setSectionResizeMode( _summaryCol, QHeaderView::Stretch );
80 setSortingEnabled(
true );
81 header()->setSortIndicatorShown(
true );
82 header()->setSectionsClickable(
true );
84 sortByColumn( nameCol(), Qt::AscendingOrder );
91 resizeColumnToContents(_statusCol);
93 yuiDebug() <<
"Creating language list done" << endl;
107 yuiDebug() <<
"Filling language list" << endl;
109 zypp::LocaleSet locales = zypp::getZYpp()->pool().getAvailableLocales();
111 for ( zypp::LocaleSet::const_iterator it = locales.begin();
118 yuiDebug() <<
"Language list filled" << endl;
142 zypp::sat::LocaleSupport myLocale( lang );
143 for_( it, myLocale.selectableBegin(), myLocale.selectableEnd() )
145 ZyppPkg zyppPkg = tryCastToZyppPkg( (*it)->theObj() );
148 if ( (*it)->installedSize() > 0 )
174 QTreeWidgetItem * item = currentItem();
194 actionSetCurrentInstall->setEnabled(
true );
195 actionSetCurrentDontInstall->setEnabled(
true );
196 actionSetCurrentTaboo->setEnabled(
true );
197 actionSetCurrentProtected->setEnabled(
false );
199 actionSetCurrentKeepInstalled->setEnabled(
false );
200 actionSetCurrentDelete->setEnabled(
false );
201 actionSetCurrentUpdate->setEnabled(
false );
206 const zypp::Locale & lang )
233 _debugIsBroken =
false;
234 _debugIsSatisfied =
false;
235 _candidateIsNewer =
false;
236 _installedIsNewer =
false;
238 if ( nameCol() >= 0 )
setText( nameCol(), _zyppLang.code() );
239 if ( summaryCol() >= 0 )
setText( summaryCol(), _zyppLang.name() );
248 if ( zypp::getZYpp()->pool().isRequestedLocale( _zyppLang ) )
257 ZyppStatus oldStatus =
status();
262 if ( ! zypp::getZYpp()->pool().isRequestedLocale( _zyppLang ) )
264 zypp::getZYpp()->pool().addRequestedLocale( _zyppLang );
268 if ( zypp::getZYpp()->pool().isRequestedLocale( _zyppLang ) )
270 zypp::getZYpp()->pool().eraseRequestedLocale( _zyppLang );
277 if ( oldStatus != newStatus )
283 _pkgObjList->updateItemStates();
295 return zypp::getZYpp()->pool().isRequestedLocale( _zyppLang );
302 if ( zypp::getZYpp()->pool().isRequestedLocale( _zyppLang ) )
304 zypp::getZYpp()->pool().eraseRequestedLocale( _zyppLang );
308 zypp::getZYpp()->pool().addRequestedLocale( _zyppLang );
317 int col = treeWidget()->sortColumn();
321 if ( col == nameCol() )
323 return ( strcoll( this->
zyppLang().code().c_str(), other->
zyppLang().code().c_str() ) < 0 );
325 if ( col == summaryCol() )
327 return ( strcoll( this->
zyppLang().name().c_str(), other->
zyppLang().name().c_str() ) < 0 );
331 return QY2ListViewItem::operator<( otherListViewItem );
Abstract base class to display a list of zypp::ResObjects.
void setText(int column, const string text)
Set a column text via STL string.
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...
void filterIfVisible()
Same as filter(), but only if this widget is currently visible.
virtual void cycleStatus()
Cycle the package status to the next valid value.
virtual bool operator<(const QTreeWidgetItem &other) const
Sorting function.
virtual ~YQPkgLangListItem()
Destructor.
void filter()
Filter according to the view's rules and current selection.
virtual void clear()
Reimplemented from QY2ListView: Emit currentItemChanged() signal after clearing the list...
zypp::Locale zyppLang() const
Returns the original object within the package manager backend.
void sendStatusChanged()
Emit a statusChanged() signal for the specified zypp::ResObject.
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.
YQPkgLangListItem * selection() const
Returns the currently selected item or 0 if there is none.
virtual ZyppStatus status() const
override this two as we don't have a real selectable and the status depends on the language ...
virtual void setStatus(ZyppStatus newStatus, bool sendSignals=true)
Set the (binary RPM) package status.
void currentItemChanged(ZyppSel selectable)
Emitted when a zypp::ui::Selectable is selected.
void filterFinished()
Emitted when filtering is finished.
void addLangItem(const zypp::Locale &lang)
Add a selection to the list.
Display a list of zypp::Selection objects.
void sendUpdatePackages()
Emit an updatePackages() signal.
YQPkgLangListItem(YQPkgLangList *pkgSelList, const zypp::Locale &lang)
Constructor.
void solveResolvableCollections()
Do a "small" solver run for all "resolvable collections", i.e., for selections, patterns, languages, patches.
void filterStart()
Emitted when the filtering starts.
virtual ~YQPkgLangList()
Destructor.
virtual void setStatusIcon()
Set a status icon according to the package's status.
virtual void applyChanges()
Propagate status changes in this list to other lists: Have the solver transact all languages...
virtual void init()
overloaded