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();
174 return dynamic_cast<YQPkgLangListItem *> (item);
184 litem = dynamic_cast<YQPkgLangListItem *> ( currentItem() );
186 litem = dynamic_cast<YQPkgLangListItem *> ( item );
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 );
311 const YQPkgLangListItem * other = dynamic_cast<const YQPkgLangListItem *> (&otherListViewItem);
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 );