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()->setResizeMode( _nameCol, QHeaderView::ResizeToContents );
77 header()->setResizeMode( _summaryCol, QHeaderView::Stretch );
80 setSortingEnabled(
true );
81 header()->setSortIndicatorShown(
true );
82 header()->setClickable(
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 );
333 #include "YQPkgLangList.moc"
Abstract base class to display a list of zypp::ResObjects. Handles most generic stuff like setting st...
void setText(int column, const string text)
virtual ZyppStatus status() const
virtual void cycleStatus()
virtual ~YQPkgLangListItem()
virtual void updateActions(YQPkgObjListItem *item=0)
void filterMatch(ZyppSel selectable, ZyppPkg pkg)
YQPkgLangList(QWidget *parent)
virtual bool bySelection() const
virtual void setStatus(ZyppStatus newStatus, bool sendSignals=true)
void currentItemChanged(ZyppSel selectable)
YQPkgLangListItem * selection() const
void addLangItem(const zypp::Locale &lang)
Display a list of zypp::Selection objects.
void sendUpdatePackages()
YQPkgLangListItem(YQPkgLangList *pkgSelList, const zypp::Locale &lang)
void solveResolvableCollections()
virtual void setStatusIcon()
zypp::Locale zyppLang() const
virtual void applyChanges()
virtual void init()
overloaded
virtual bool operator<(const QTreeWidgetItem &other) const