42 #define YUILogComponent "qt-pkg" 45 #include <QHeaderView> 54 #include "YQPkgObjList.h" 55 #include "YQPkgTextDialog.h" 57 #include "YQIconPool.h" 60 #include "zypp/ZYppFactory.h" 67 #define VERBOSE_EXCLUDE_RULES 0 68 #define EXTRA_SOLVE_COLLECTIONS 0 72 : QY2ListView( parent )
74 , _installedContextMenu(0)
75 , _notInstalledContextMenu(0)
76 , actionSetCurrentInstall(0)
77 , actionSetCurrentDontInstall(0)
78 , actionSetCurrentKeepInstalled(0)
79 , actionSetCurrentDelete(0)
80 , actionSetCurrentUpdate(0)
81 , actionSetCurrentUpdateForce(0)
82 , actionSetCurrentTaboo(0)
83 , actionSetCurrentProtected(0)
84 , actionSetListInstall(0)
85 , actionSetListDontInstall(0)
86 , actionSetListKeepInstalled(0)
87 , actionSetListDelete(0)
88 , actionSetListUpdate(0)
89 , actionSetListUpdateForce(0)
90 , actionSetListTaboo(0)
91 , actionSetListProtected(0)
101 _instVersionCol = -42;
104 _brokenIconCol = -42;
105 _satisfiedIconCol = -42;
112 connect(
this, SIGNAL( columnClicked (
int, QTreeWidgetItem *,
int,
const QPoint & ) ),
113 this, SLOT (
pkgObjClicked (
int, QTreeWidgetItem *,
int,
const QPoint & ) ) );
115 connect(
this, SIGNAL( columnDoubleClicked (
int, QTreeWidgetItem *,
int,
const QPoint & ) ),
116 this, SLOT (
pkgObjClicked (
int, QTreeWidgetItem *,
int,
const QPoint & ) ) );
121 connect(
this, SIGNAL(customContextMenuRequested(
const QPoint &)),
124 setIconSize( QSize( 16, 16 ) );
126 setContextMenuPolicy(Qt::CustomContextMenu);
135 if ( _excludedItems )
136 delete _excludedItems;
145 yuiError() <<
"Null zypp::ui::Selectable!" << endl;
156 const QString & summary,
159 QY2ListViewItem * item =
new QY2ListViewItem(
this, QString::null );
163 if ( nameCol() >= 0 && ! name.isEmpty() ) item->setText( nameCol(), name );
164 if ( summaryCol() >= 0 && ! summary.isEmpty() ) item->setText( summaryCol(), summary );
165 if ( sizeCol() >= 0 && size > 0L )
167 QString sizeStr = size.form().c_str();
168 item->setText( sizeCol(), sizeStr );
176 QTreeWidgetItem * listViewItem,
185 if ( button == Qt::LeftButton )
187 if ( col == statusCol() )
213 _excludedItems->
clear();
214 QY2ListView::clear();
221 QPixmap icon = YQIconPool::pkgNoInst();
227 case S_Del: icon = YQIconPool::pkgDel();
break;
228 case S_Install: icon = YQIconPool::pkgInstall();
break;
229 case S_KeepInstalled: icon = YQIconPool::pkgKeepInstalled();
break;
230 case S_NoInst: icon = YQIconPool::pkgNoInst();
break;
231 case S_Protected: icon = YQIconPool::pkgProtected();
break;
232 case S_Taboo: icon = YQIconPool::pkgTaboo();
break;
233 case S_Update: icon = YQIconPool::pkgUpdate();
break;
235 case S_AutoDel: icon = YQIconPool::pkgAutoDel();
break;
236 case S_AutoInstall: icon = YQIconPool::pkgAutoInstall();
break;
237 case S_AutoUpdate: icon = YQIconPool::pkgAutoUpdate();
break;
247 case S_Del: icon = YQIconPool::disabledPkgDel();
break;
248 case S_Install: icon = YQIconPool::disabledPkgInstall();
break;
249 case S_KeepInstalled: icon = YQIconPool::disabledPkgKeepInstalled();
break;
250 case S_NoInst: icon = YQIconPool::disabledPkgNoInst();
break;
251 case S_Protected: icon = YQIconPool::disabledPkgProtected();
break;
252 case S_Taboo: icon = YQIconPool::disabledPkgTaboo();
break;
253 case S_Update: icon = YQIconPool::disabledPkgUpdate();
break;
255 case S_AutoDel: icon = YQIconPool::disabledPkgAutoDel();
break;
256 case S_AutoInstall: icon = YQIconPool::disabledPkgAutoInstall();
break;
257 case S_AutoUpdate: icon = YQIconPool::disabledPkgAutoUpdate();
break;
273 case S_AutoDel:
return _(
"Autodelete" );
274 case S_AutoInstall:
return _(
"Autoinstall" );
275 case S_AutoUpdate:
return _(
"Autoupdate" );
276 case S_Del:
return _(
"Delete" );
277 case S_Install:
return _(
"Install" );
278 case S_KeepInstalled:
return _(
"Keep" );
279 case S_NoInst:
return _(
"Do Not Install" );
280 case S_Protected:
return _(
"Protected -- Do Not Modify" );
281 case S_Taboo:
return _(
"Taboo -- Never Install" );
282 case S_Update:
return _(
"Update" );
285 return QString::null;
292 QTreeWidgetItem * listViewItem = currentItem();
294 if ( ! listViewItem )
301 if ( newStatus != item->
status() )
319 if ( doSelectNextItem )
330 YQUI::ui()->busyCursor();
331 QTreeWidgetItemIterator it(
this );
339 if ( newStatus == S_Update )
364 emit updateItemStates();
367 YQUI::ui()->normalCursor();
375 QTreeWidgetItemIterator it(
this);
376 QTreeWidgetItem * item;
378 while ( (item = *it) != NULL )
383 setCurrentItem( *it );
392 actionSetCurrentInstall =
createAction( S_Install,
"[+]" );
393 actionSetCurrentDontInstall =
createAction( S_NoInst,
"[-]" );
394 actionSetCurrentKeepInstalled =
createAction( S_KeepInstalled,
"[<], [-]" );
396 actionSetCurrentUpdate =
createAction( S_Update,
"[>], [+]" );
398 actionSetCurrentUpdateForce =
createAction( _(
"Update unconditionally" ),
407 actionSetCurrentProtected =
createAction( S_Protected,
"[*]" );
409 actionSetListInstall =
createAction( S_Install,
"",
true );
410 actionSetListDontInstall =
createAction( S_NoInst,
"",
true );
411 actionSetListKeepInstalled =
createAction( S_KeepInstalled,
"",
true );
413 actionSetListProtected =
createAction( S_Protected,
"",
true );
415 actionSetListUpdate =
createAction( _(
"Update if newer version available" ),
421 actionSetListUpdateForce =
createAction( _(
"Update unconditionally" ),
429 connect( actionSetCurrentInstall, &QAction::triggered,
this, &YQPkgObjList::setCurrentInstall );
430 connect( actionSetCurrentDontInstall, &QAction::triggered,
this, &YQPkgObjList::setCurrentDontInstall );
431 connect( actionSetCurrentKeepInstalled, &QAction::triggered,
this, &YQPkgObjList::setCurrentKeepInstalled );
432 connect( actionSetCurrentDelete, &QAction::triggered,
this, &YQPkgObjList::setCurrentDelete );
433 connect( actionSetCurrentUpdate, &QAction::triggered,
this, &YQPkgObjList::setCurrentUpdate );
434 connect( actionSetCurrentUpdateForce, &QAction::triggered,
this, &YQPkgObjList::setCurrentUpdateForce );
435 connect( actionSetCurrentTaboo, &QAction::triggered,
this, &YQPkgObjList::setCurrentTaboo );
436 connect( actionSetCurrentProtected, &QAction::triggered,
this, &YQPkgObjList::setCurrentProtected );
437 connect( actionSetListInstall, &QAction::triggered,
this, &YQPkgObjList::setListInstall );
438 connect( actionSetListDontInstall, &QAction::triggered,
this, &YQPkgObjList::setListDontInstall );
439 connect( actionSetListKeepInstalled, &QAction::triggered,
this, &YQPkgObjList::setListKeepInstalled );
440 connect( actionSetListDelete, &QAction::triggered,
this, &YQPkgObjList::setListDelete );
441 connect( actionSetListUpdate, &QAction::triggered,
this, &YQPkgObjList::setListUpdate );
442 connect( actionSetListUpdateForce, &QAction::triggered,
this, &YQPkgObjList::setListUpdateForce );
443 connect( actionSetListTaboo, &QAction::triggered,
this, &YQPkgObjList::setListTaboo );
444 connect( actionSetListProtected, &QAction::triggered,
this, &YQPkgObjList::setListProtected );
462 const QPixmap & icon,
463 const QPixmap & insensitiveIcon,
467 QString label = text;
469 if ( ! key.isEmpty() )
473 QIcon iconSet ( icon );
475 if ( ! insensitiveIcon.isNull() )
477 iconSet.addPixmap( insensitiveIcon,
481 QAction * action =
new QAction( label,
483 Q_CHECK_PTR( action );
484 action->setEnabled( enabled );
485 action->setIcon( iconSet );
494 _notInstalledContextMenu =
new QMenu(
this );
495 Q_CHECK_PTR( _notInstalledContextMenu );
497 _notInstalledContextMenu->addAction( actionSetCurrentInstall );
498 _notInstalledContextMenu->addAction( actionSetCurrentDontInstall );
499 _notInstalledContextMenu->addAction( actionSetCurrentTaboo );
508 _installedContextMenu =
new QMenu(
this );
509 Q_CHECK_PTR( _installedContextMenu );
511 _installedContextMenu->addAction( actionSetCurrentKeepInstalled );
512 _installedContextMenu->addAction( actionSetCurrentDelete );
513 _installedContextMenu->addAction( actionSetCurrentUpdate );
514 _installedContextMenu->addAction( actionSetCurrentUpdateForce );
523 QMenu * submenu =
new QMenu( menu );
524 Q_CHECK_PTR( submenu );
526 submenu->addAction( actionSetListInstall );
527 submenu->addAction( actionSetListDontInstall );
528 submenu->addAction( actionSetListKeepInstalled );
529 submenu->addAction( actionSetListDelete );
530 submenu->addAction( actionSetListUpdate );
531 submenu->addAction( actionSetListUpdateForce );
532 submenu->addAction( actionSetListTaboo );
534 QAction *action = menu->addMenu( submenu );
535 action->setText( _(
"&All in This List" ) );
544 if ( ! _notInstalledContextMenu )
547 return _notInstalledContextMenu;
554 if ( ! _installedContextMenu )
557 return _installedContextMenu;
571 if ( selectable->hasInstalledObj() )
573 actionSetCurrentInstall->setEnabled(
false );
574 actionSetCurrentDontInstall->setEnabled(
false );
575 actionSetCurrentTaboo->setEnabled(
false );
576 actionSetCurrentProtected->setEnabled(
true );
578 actionSetCurrentKeepInstalled->setEnabled(
true );
579 actionSetCurrentDelete->setEnabled(
true );
580 actionSetCurrentUpdate->setEnabled( selectable->hasCandidateObj() );
581 actionSetCurrentUpdateForce->setEnabled( selectable->hasCandidateObj() );
585 actionSetCurrentInstall->setEnabled( selectable->hasCandidateObj() );
586 actionSetCurrentDontInstall->setEnabled(
true );
587 actionSetCurrentTaboo->setEnabled(
true );
588 actionSetCurrentProtected->setEnabled(
false );
590 actionSetCurrentKeepInstalled->setEnabled(
false );
591 actionSetCurrentDelete->setEnabled(
false );
592 actionSetCurrentUpdate->setEnabled(
false );
593 actionSetCurrentUpdateForce->setEnabled(
false );
598 actionSetCurrentInstall->setEnabled(
false );
599 actionSetCurrentDontInstall->setEnabled(
false );
600 actionSetCurrentTaboo->setEnabled(
false );
602 actionSetCurrentKeepInstalled->setEnabled(
false );
603 actionSetCurrentDelete->setEnabled(
false );
604 actionSetCurrentUpdate->setEnabled(
false );
605 actionSetCurrentUpdateForce->setEnabled(
false );
606 actionSetCurrentProtected->setEnabled(
false );
617 Qt::KeyboardModifiers special_combo = ( Qt::ControlModifier | Qt::ShiftModifier | Qt::AltModifier );
619 if ( ( event->modifiers() & special_combo ) == special_combo )
621 if ( event->key() == Qt::Key_Q )
624 yuiMilestone() <<
"Debug mode: " << _debug << endl;
628 QTreeWidgetItem * selectedListViewItem = currentItem();
630 if ( selectedListViewItem )
639 installed = item->
selectable()->hasInstalledObj();
643 ZyppStatus status = item->
status();
645 switch( event->key() )
656 ZyppStatus newStatus = S_KeepInstalled;
659 newStatus = S_Update;
680 case Qt::Key_Asterisk:
687 case Qt::Key_Greater:
696 if ( status == S_Update ||
697 status == S_AutoUpdate )
708 item->toggleDebugIsBroken();
718 item->toggleDebugIsSatisfied();
727 QY2ListView::keyPressEvent( event );
734 QY2ListViewItem * item =
new QY2ListViewItem(
this );
737 item->setText( nameCol() >= 0 ? nameCol() : 0, text );
744 _excludeRules.push_back( rule );
752 QTreeWidgetItemIterator listView_it(
this );
754 while ( *listView_it )
756 QTreeWidgetItem * current_item = *listView_it;
766 ExcludedItems::iterator excluded_it = _excludedItems->
begin();
768 while ( excluded_it != _excludedItems->
end() )
770 QTreeWidgetItem * current_item = (*excluded_it).first;
787 if ( _excludedItems->
size() > 0 )
789 yuiMilestone() << _excludedItems->
size() <<
" packages excluded" << endl;
791 for ( ExcludeRuleList::iterator rule_it = _excludeRules.begin();
792 rule_it != _excludeRules.end();
799 yuiMilestone() <<
"Active exclude rule: \"" 800 << rule->
regexp().pattern() <<
"\"" 816 #if VERBOSE_EXCLUDE_RULES 820 for ( ExcludeRuleList::iterator rule_it = _excludeRules.begin();
821 rule_it != _excludeRules.end() && !
exclude;
826 if ( rule->
match( item ) )
829 #if VERBOSE_EXCLUDE_RULES 839 #if VERBOSE_EXCLUDE_RULES 842 yuiDebug() <<
"Rule \"" << matchingRule->
regexp().pattern()
843 <<
"\" matches: Excluding " << item->
zyppObj()->name()
848 yuiDebug() <<
"Un-excluding " << item->
zyppObj()->name() << endl;
864 QTreeWidgetItem * parentItem = item->parent();
867 parentItem->setHidden(
exclude);
871 _excludedItems->
add( item, parentItem );
880 : QY2ListViewItem( pkgObjList )
881 , _pkgObjList( pkgObjList )
882 , _selectable( selectable )
883 , _zyppObj( zyppObj )
892 QY2ListViewItem * parent,
895 : QY2ListViewItem( parent )
896 , _pkgObjList( pkgObjList )
897 , _selectable( selectable )
898 , _zyppObj( zyppObj )
907 : QY2ListViewItem( pkgObjList )
908 , _pkgObjList( pkgObjList )
926 if ( _zyppObj == 0 && _selectable )
927 _zyppObj = _selectable->theObj();
929 _debugIsBroken =
false;
930 _debugIsSatisfied =
false;
931 _candidateIsNewer =
false;
932 _installedIsNewer =
false;
934 const ZyppObj candidate =
selectable()->candidateObj();
935 const ZyppObj installed =
selectable()->installedObj();
937 if ( candidate && installed )
939 if ( candidate->edition() < installed->edition() )
940 _installedIsNewer =
true;
941 else if ( installed->edition() < candidate->edition() )
942 _candidateIsNewer =
true;
945 if ( installed && ! candidate )
946 _installedIsNewer =
true;
949 if ( summaryCol() >= 0 )
setText( summaryCol(),
zyppObj()->summary() );
951 if ( sizeCol() >= 0 )
953 zypp::ByteCount size =
zyppObj()->installSize();
956 setText( sizeCol(), size.asString() );
959 if ( versionCol() == instVersionCol() )
961 if ( versionCol() >= 0 )
968 setText( versionCol(), QString().sprintf(
"%s",
zyppObj()->edition().c_str() ) );
972 if ( candidate && installed->edition() != candidate->edition() )
975 QString().sprintf(
"%s (%s)",
976 installed->edition().c_str(),
977 candidate->edition().c_str() ) );
982 QString().sprintf(
"%s", installed->edition().c_str() ) );
989 setText( versionCol(), QString().sprintf(
"(%s)", candidate->edition().c_str() ) );
994 if ( _installedIsNewer )
995 setTextColor( versionCol(), Qt::red);
996 else if ( _candidateIsNewer )
997 setTextColor( versionCol(), Qt::blue);
1002 if ( instVersionCol() >= 0 )
1006 setText( instVersionCol(), installed->edition() );
1008 if ( _installedIsNewer )
1009 setTextColor( instVersionCol(), Qt::red);
1010 else if ( _candidateIsNewer )
1011 setTextColor( instVersionCol(), Qt::blue);
1015 if ( versionCol() >= 0 )
1017 if (
zyppObj() != installed &&
1022 else if ( candidate )
1024 setText( versionCol(), candidate->edition() );
1026 if ( _installedIsNewer )
1027 setTextColor( versionCol(), Qt::red);
1028 else if ( _candidateIsNewer )
1029 setTextColor( versionCol(), Qt::blue);
1048 QTreeWidgetItem::setText( column, fromUTF8( text.c_str() ) );
1055 setText( column, edition.asString() );
1064 yuiError() <<
"No selectable" << endl;
1075 zypp::ResStatus::TransactByValue modifiedBy =
selectable()->modifiedBy();
1077 return ( modifiedBy == zypp::ResStatus::APPL_LOW ||
1078 modifiedBy == zypp::ResStatus::APPL_HIGH );
1086 ZyppStatus oldStatus =
selectable()->status();
1095 _pkgObjList->updateItemStates();
1107 zypp::getZYpp()->resolver()->resolvePool();
1122 if ( statusCol() >= 0 )
1129 if ( brokenIconCol() >= 0 )
1132 setIcon( brokenIconCol(), QPixmap() );
1135 if ( satisfiedIconCol() >= 0 )
1141 setIcon( satisfiedIconCol(),
isSatisfied() ? YQIconPool::pkgSatisfied() : QPixmap() );
1144 if ( brokenIconCol() >= 0 )
1151 setIcon( brokenIconCol(), YQIconPool::warningSign() );
1153 yuiWarning() <<
"Broken object: " << _selectable->theObj()->name()
1154 <<
" - " << _selectable->theObj()->summary()
1164 if ( _debugIsSatisfied )
1167 if ( _selectable->hasInstalledObj() )
1170 return _selectable->candidateObj().isSatisfied();
1176 if ( _debugIsBroken )
1179 if ( ! _selectable->hasInstalledObj() )
1184 case S_KeepInstalled:
1187 return _selectable->installedObj().isBroken();
1201 yuiError() <<
"Expected uninstalled zyppObj" << endl;
1205 yuiError() <<
"Should never get here" << endl;
1213 if ( ! _editable || ! _pkgObjList->
editable() )
1216 ZyppStatus oldStatus =
status();
1217 ZyppStatus newStatus = oldStatus;
1219 switch ( oldStatus )
1222 newStatus = S_NoInst;
1226 newStatus =
selectable()->hasCandidateObj() ?
1227 S_KeepInstalled: S_NoInst;
1231 newStatus =
selectable()->hasInstalledObj() ?
1232 S_KeepInstalled : S_NoInst;
1235 case S_KeepInstalled:
1236 newStatus =
selectable()->hasCandidateObj() ?
1245 newStatus = S_KeepInstalled;
1250 newStatus = S_KeepInstalled;
1256 newStatus = S_Install;
1260 yuiWarning() <<
"No candidate for " <<
selectable()->theObj()->name() << endl;
1261 newStatus = S_NoInst;
1268 newStatus = S_NoInst;
1272 if ( oldStatus != newStatus )
1304 text =
selectable()->candidateObj()->insnotify();
1311 text =
selectable()->candidateObj()->delnotify();
1317 if ( ! text.empty() )
1319 yuiDebug() <<
"Showing notify text" << endl;
1343 switch ( sel->status() )
1350 if ( sel->hasLicenceConfirmed() )
1353 if ( sel->candidateObj() )
1354 licenseText = sel->candidateObj()->licenseToConfirm();
1357 default:
return true;
1360 if ( licenseText.empty() )
1363 yuiDebug() <<
"Showing license agreement for " << sel->name() << endl;
1370 yuiMilestone() <<
"User confirmed license agreement for " << sel->name() << endl;
1371 sel->setLicenceConfirmed(
true );
1378 switch ( sel->status() )
1383 yuiWarning() <<
"User rejected license agreement for " << sel->name()
1384 <<
" - setting to TABOO" 1387 sel->setStatus( S_Taboo );
1394 yuiWarning() <<
"User rejected license agreement for " << sel->name()
1395 <<
" - setting to PROTECTED" 1398 sel->setStatus( S_Protected );
1414 if ( col == statusCol() )
1426 tip +=
"\n" + _(
"(by a software selection)" );
1428 tip +=
"\n" + _(
"(by dependencies)" );
1439 if ( col == brokenIconCol() )
1444 return _(
"Dependencies broken" );
1449 if ( col == satisfiedIconCol() )
1454 return _(
"All dependencies satisfied" );
1457 return QString::null;
1465 int col = treeWidget()->sortColumn();
1469 if ( col == nameCol() )
1471 return ( strcasecmp( this->
zyppObj()->name().c_str(), other->
zyppObj()->name().c_str() ) < 0 );
1473 if ( col == summaryCol() )
1476 return ( strcoll( this->
zyppObj()->summary().c_str(), other->
zyppObj()->summary().c_str() ) < 0 );
1478 if ( col == sizeCol() )
1482 return ( this->
zyppObj()->installSize() < other->
zyppObj()->installSize() );
1484 else if ( col == statusCol() )
1497 else if ( col == instVersionCol() ||
1498 col == versionCol() )
1513 if (thisPoints == otherPoints )
1514 return ( QString (this->
zyppObj()->edition().c_str() ) <
1515 QString (other->
zyppObj()->edition().c_str() ) );
1517 return ( thisPoints < otherPoints );
1522 return QY2ListViewItem::operator<( otherListViewItem );
1533 if (
selectable()->hasInstalledObj() ) points += 10;
1534 if (
selectable()->hasCandidateObj() ) points += 1;
1547 const QRegExp & regexp,
1563 #if VERBOSE_EXCLUDE_RULES 1564 yuiDebug() << ( enable ?
"Enabling" :
"Disabling" )
1565 <<
" exclude rule " << _regexp.pattern()
1591 QString text = item->text( _column );
1593 if ( text.isEmpty() )
1596 return _regexp.exactMatch( text );
1605 : _pkgObjList( parent )
1618 _excludeMap.insert( ItemPair( item, oldParent ) );
1624 ItemMap::iterator it = _excludeMap.find( item );
1626 if ( it != _excludeMap.end() )
1628 _excludeMap.erase( it );
1635 for ( ItemMap::iterator it = _excludeMap.begin();
1636 it != _excludeMap.end();
1642 _excludeMap.clear();
1648 return ( _excludeMap.find( item ) != _excludeMap.end() );
1662 QMenu * contextMenu =
1667 contextMenu->popup( viewport()->mapToGlobal( pos ) );
1674 ItemMap::iterator it = _excludeMap.find( item );
1676 if ( it == _excludeMap.end() )
bool installedIsNewer() const
Check if the installed version is newer than the candidate.
bool candidateIsNewer() const
Check if the candidate is newer than the installed version.
bool isExcluded() const
Returns 'true' if this item is excluded.
Abstract base class to display a list of zypp::ResObjects.
void statusChanged()
Emitted when the status of a zypp::ResObject is changed.
void setText(int column, const string text)
Set a column text via STL string.
void setExcluded(bool exclude=true)
Set this item's exclude flag.
virtual QPixmap statusIcon(ZyppStatus status, bool enabled=true, bool bySelection=false)
Returns the suitable icon for a zypp::ResObject status - the regular icon if 'enabled' is 'true' or t...
void addPkgObjItem(ZyppSel selectable, ZyppObj zyppObj=0)
Add a zypp::ResObject to the list.
YQPkgObjListItem(YQPkgObjList *pkgObjList, ZyppSel selectable, ZyppObj zyppObj=0)
Constructor for root items: Creates a YQPkgObjList item that corresponds to the ZYPP selectable that ...
virtual bool operator<(const QTreeWidgetItem &other) const
sorting function
void addExcludeRule(YQPkgObjList::ExcludeRule *rule)
Add an exclude rule to this list.
virtual void createInstalledContextMenu()
Create the context menu for installed items.
virtual QString statusText(ZyppStatus status) const
Returns a short (one line) descriptive text for a zypp::ResObject status.
void setAllItemStatus(ZyppStatus newStatus, bool force=false)
Sets the status of all (toplevel) list items to 'newStatus', if possible.
virtual QMenu * notInstalledContextMenu()
Returns the context menu for items that are installed.
bool showLicenseAgreement()
Display this item's license agreement (if there is any) that corresponds to its current status (S_Ins...
iterator begin()
Returns an iterator that points to the first excluded item.
virtual void updateData()
Update this item's data completely.
virtual void clear()
Reimplemented from QY2ListView: Emit currentItemChanged() signal after clearing the list...
void setColumn(int column=0)
Change the column number to check against after creation.
virtual void message(const QString &text)
Display a one-line message in the list.
static bool confirmText(QWidget *parent, const QString &text, const QString &acceptButtonLabel, const QString &rejectButtonLabel)
Let the user confirm a text.
virtual void updateStatus()
Update this item's status.
void addPassiveItem(const QString &name, const QString &summary=QString::null, FSize size=-1)
Add a purely passive list item that has a name and optional summary and size.
ExcludeRule(YQPkgObjList *parent, const QRegExp ®exp, int column=0)
Constructor: Creates a new exclude rule with a regular expression to check against the text of the sp...
void createActions()
Create the actions for the context menus.
virtual void setStatus(ZyppStatus newStatus, bool sendSignals=true)
Set the (binary RPM) package status.
QRegExp regexp() const
Returns the regexp.
QAction * createAction(ZyppStatus status, const QString &key=QString::null, bool enabled=false)
Create an action based on a zypp::ResObject status - automatically retrieve the corresponding status ...
virtual void pkgObjClicked(int button, QTreeWidgetItem *item, int col, const QPoint &pos)
Dispatcher slot for mouse click: cycle status depending on column.
void enable(bool enable=true)
Enable or disable this exclude rule.
void logExcludeStatistics()
Write statistics about excluded items to the log, if there are any.
virtual void currentItemChangedInternal(QTreeWidgetItem *item)
Dispatcher slot for selection change - internal only.
bool isBroken() const
Check if this item is "broken": If it is installed, but any of its dependencies are no longer satisfi...
bool editable() const
Return whether or not this items is editable, i.e.
virtual void updateActions(YQPkgObjListItem *item=0)
Update the internal actions for the currently selected item ( if any ).
void sendStatusChanged()
Emit a statusChanged() signal for the specified zypp::ResObject.
void exclude(YQPkgObjListItem *item, bool exclude)
Exclude or include an item, i.e.
void selectNextItem()
Select the next item, i.e.
void updatePackages()
Emitted when it's time to update displayed package information, e.g., package states.
iterator end()
Returns an iterator that points after the last excluded item.
virtual ZyppStatus status() const
Returns the (binary RPM) package status.
bool match(QTreeWidgetItem *item)
Check a list item against this exclude rule.
static void showText(QWidget *parent, const QString &text)
Show a text and wait until the user confirmed with 'OK'.
bool editable() const
Return whether or not items in this list are generally editable, i.e.
void clear()
Clear the excluded items.
ExcludedItems(YQPkgObjList *parent)
Constructor.
virtual void applyChanges()
Apply changes hook.
void applyExcludeRules()
Apply all exclude rules of this list to all items, including those that are currently excluded...
bool contains(QTreeWidgetItem *item)
Returns 'true' if the specified item is in the excluded items.
void setRegexp(const QRegExp ®exp)
Change the regular expression after creation.
QTreeWidgetItem * oldParentItem(QTreeWidgetItem *item)
Returns the old parent of this item so it can be reparented or 0 if it was a root item...
int size() const
Returns the number of items.
virtual QMenu * addAllInListSubMenu(QMenu *menu)
Add a submenu "All in this list..." to 'menu'.
ZyppSel selectable() const
Returns the original selectable within the package manager backend.
bool isSatisfied() const
Check if this item is satisfied, even though it is not installed.
void currentItemChanged(ZyppSel selectable)
Emitted when a zypp::ui::Selectable is selected.
void slotCustomContextMenu(const QPoint &pos)
slot that shows context menu when requested
void setCurrentStatus(ZyppStatus newStatus, bool selectNextItem=false, bool ifNewerOnly=false)
Sets the currently selected item's status.
void sendUpdatePackages()
Emit an updatePackages() signal.
virtual void createNotInstalledContextMenu()
Create the context menu for items that are not installed.
virtual QMenu * installedContextMenu()
Returns the context menu for items that are not installed.
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...
bool isEnabled() const
Returns 'true' if this exclude rule is enabled, 'false' otherwise.
virtual QString toolTip(int column)
Returns a tool tip text for a specific column of this item.
void solveResolvableCollections()
Do a "small" solver run for all "resolvable collections", i.e., for selections, patterns, languages, patches.
virtual ~YQPkgObjList()
Destructor.
void showNotifyTexts(ZyppStatus status)
Display this item's notify text (if there is any) that corresponds to the specified status (S_Install...
virtual void keyPressEvent(QKeyEvent *ev)
Event handler for keyboard input.
YQPkgObjList(QWidget *parent)
Constructor.
virtual ~ExcludedItems()
Destructor.
static bool showLicenseAgreement(ZyppSel sel)
Display a selectable's license agreement (if there is any) that corresponds to its current status (S_...
void add(QTreeWidgetItem *item, QTreeWidgetItem *oldParent)
Add a list item to the excluded items and transfer ownership to this class.
int versionPoints() const
Calculate a numerical value to compare versions, based on version relations:
virtual ~YQPkgObjListItem()
Destructor.
virtual void setStatusIcon()
Set a status icon according to the package's status.
ZyppObj zyppObj() const
Returns the original object within the package manager backend.
virtual void cycleStatus()
Cycle the package status to the next valid value.
void init()
Initialize internal data and set fields accordingly.
void remove(QTreeWidgetItem *item)
Remove a list item from the excluded items and transfer ownership back to the caller.