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 )
169 QTreeWidgetItem * item = currentItem();
189 actionSetCurrentInstall->setEnabled(
true );
190 actionSetCurrentDontInstall->setEnabled(
true );
191 actionSetCurrentTaboo->setEnabled(
true );
192 actionSetCurrentProtected->setEnabled(
false );
194 actionSetCurrentKeepInstalled->setEnabled(
false );
195 actionSetCurrentDelete->setEnabled(
false );
196 actionSetCurrentUpdate->setEnabled(
false );
201 const zypp::Locale & lang )
228 _debugIsBroken =
false;
229 _debugIsSatisfied =
false;
230 _candidateIsNewer =
false;
231 _installedIsNewer =
false;
233 if ( nameCol() >= 0 )
setText( nameCol(), _zyppLang.code() );
234 if ( summaryCol() >= 0 )
setText( summaryCol(), _zyppLang.name() );
243 if ( zypp::getZYpp()->pool().isRequestedLocale( _zyppLang ) )
252 ZyppStatus oldStatus =
status();
257 if ( ! zypp::getZYpp()->pool().isRequestedLocale( _zyppLang ) )
259 zypp::getZYpp()->pool().addRequestedLocale( _zyppLang );
263 if ( zypp::getZYpp()->pool().isRequestedLocale( _zyppLang ) )
265 zypp::getZYpp()->pool().eraseRequestedLocale( _zyppLang );
272 if ( oldStatus != newStatus )
278 _pkgObjList->updateItemStates();
290 return zypp::getZYpp()->pool().isRequestedLocale( _zyppLang );
297 if ( zypp::getZYpp()->pool().isRequestedLocale( _zyppLang ) )
299 zypp::getZYpp()->pool().eraseRequestedLocale( _zyppLang );
303 zypp::getZYpp()->pool().addRequestedLocale( _zyppLang );
312 int col = treeWidget()->sortColumn();
316 if ( col == nameCol() )
318 return ( strcoll( this->
zyppLang().code().c_str(), other->
zyppLang().code().c_str() ) < 0 );
320 if ( col == summaryCol() )
322 return ( strcoll( this->
zyppLang().name().c_str(), other->
zyppLang().name().c_str() ) < 0 );
326 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