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 , actionShowCurrentSolverInfo(0)
85 , actionSetListInstall(0)
86 , actionSetListDontInstall(0)
87 , actionSetListKeepInstalled(0)
88 , actionSetListDelete(0)
89 , actionSetListUpdate(0)
90 , actionSetListUpdateForce(0)
91 , actionSetListTaboo(0)
92 , actionSetListProtected(0)
102 _instVersionCol = -42;
105 _brokenIconCol = -42;
106 _satisfiedIconCol = -42;
113 connect(
this, SIGNAL( columnClicked (
int, QTreeWidgetItem *,
int,
const QPoint & ) ),
114 this, SLOT (
pkgObjClicked (
int, QTreeWidgetItem *,
int,
const QPoint & ) ) );
116 connect(
this, SIGNAL( columnDoubleClicked (
int, QTreeWidgetItem *,
int,
const QPoint & ) ),
117 this, SLOT (
pkgObjClicked (
int, QTreeWidgetItem *,
int,
const QPoint & ) ) );
122 connect(
this, SIGNAL(customContextMenuRequested(
const QPoint &)),
125 setIconSize( QSize( 22, 16 ) );
127 setContextMenuPolicy(Qt::CustomContextMenu);
136 if ( _excludedItems )
137 delete _excludedItems;
146 yuiError() <<
"Null zypp::ui::Selectable!" << endl;
157 const QString & summary,
160 QY2ListViewItem * item =
new QY2ListViewItem(
this, QString::null );
164 if ( nameCol() >= 0 && ! name.isEmpty() ) item->setText( nameCol(), name );
165 if ( summaryCol() >= 0 && ! summary.isEmpty() ) item->setText( summaryCol(), summary );
166 if ( sizeCol() >= 0 && size > 0L )
168 QString sizeStr = size.form().c_str();
169 item->setText( sizeCol(), sizeStr );
177 QTreeWidgetItem * listViewItem,
186 if ( button == Qt::LeftButton )
188 if ( col == statusCol() )
214 _excludedItems->
clear();
215 QY2ListView::clear();
222 QPixmap icon = YQIconPool::pkgNoInst();
228 case S_Del: icon = YQIconPool::pkgDel();
break;
229 case S_Install: icon = YQIconPool::pkgInstall();
break;
230 case S_KeepInstalled: icon = YQIconPool::pkgKeepInstalled();
break;
231 case S_NoInst: icon = YQIconPool::pkgNoInst();
break;
232 case S_Protected: icon = YQIconPool::pkgProtected();
break;
233 case S_Taboo: icon = YQIconPool::pkgTaboo();
break;
234 case S_Update: icon = YQIconPool::pkgUpdate();
break;
236 case S_AutoDel: icon = YQIconPool::pkgAutoDel();
break;
237 case S_AutoInstall: icon = YQIconPool::pkgAutoInstall();
break;
238 case S_AutoUpdate: icon = YQIconPool::pkgAutoUpdate();
break;
248 case S_Del: icon = YQIconPool::disabledPkgDel();
break;
249 case S_Install: icon = YQIconPool::disabledPkgInstall();
break;
250 case S_KeepInstalled: icon = YQIconPool::disabledPkgKeepInstalled();
break;
251 case S_NoInst: icon = YQIconPool::disabledPkgNoInst();
break;
252 case S_Protected: icon = YQIconPool::disabledPkgProtected();
break;
253 case S_Taboo: icon = YQIconPool::disabledPkgTaboo();
break;
254 case S_Update: icon = YQIconPool::disabledPkgUpdate();
break;
256 case S_AutoDel: icon = YQIconPool::disabledPkgAutoDel();
break;
257 case S_AutoInstall: icon = YQIconPool::disabledPkgAutoInstall();
break;
258 case S_AutoUpdate: icon = YQIconPool::disabledPkgAutoUpdate();
break;
274 case S_AutoDel:
return _(
"Autodelete" );
275 case S_AutoInstall:
return _(
"Autoinstall" );
276 case S_AutoUpdate:
return _(
"Autoupdate" );
277 case S_Del:
return _(
"Delete" );
278 case S_Install:
return _(
"Install" );
279 case S_KeepInstalled:
return _(
"Keep" );
280 case S_NoInst:
return _(
"Do Not Install" );
281 case S_Protected:
return _(
"Protected -- Do Not Modify" );
282 case S_Taboo:
return _(
"Taboo -- Never Install" );
283 case S_Update:
return _(
"Update" );
286 return QString::null;
293 QTreeWidgetItem * listViewItem = currentItem();
295 if ( ! listViewItem )
302 if ( newStatus != item->
status() )
320 if ( doSelectNextItem )
328 QTreeWidgetItem * listViewItem = currentItem();
330 if ( ! listViewItem )
348 YQUI::ui()->busyCursor();
349 QTreeWidgetItemIterator it(
this );
357 if ( newStatus == S_Update )
382 emit updateItemStates();
385 YQUI::ui()->normalCursor();
393 QTreeWidgetItemIterator it(
this);
394 QTreeWidgetItem * item;
396 while ( (item = *it) != NULL )
401 setCurrentItem( *it );
410 actionSetCurrentInstall =
createAction( S_Install,
"[+]" );
411 actionSetCurrentDontInstall =
createAction( S_NoInst,
"[-]" );
412 actionSetCurrentKeepInstalled =
createAction( S_KeepInstalled,
"[<], [-]" );
414 actionSetCurrentUpdate =
createAction( S_Update,
"[>], [+]" );
420 actionSetCurrentProtected =
createAction( S_Protected,
"[*]" );
422 actionShowCurrentSolverInfo =
createAction( _(
"Show solver information" ));
424 actionSetListInstall =
createAction( S_Install,
"",
true );
425 actionSetListDontInstall =
createAction( S_NoInst,
"",
true );
426 actionSetListKeepInstalled =
createAction( S_KeepInstalled,
"",
true );
428 actionSetListProtected =
createAction( S_Protected,
"",
true );
430 actionSetListUpdate =
createAction( _(
"Update if newer version available" ),
436 actionSetListUpdateForce =
createAction( _(
"Update unconditionally" ),
444 connect( actionSetCurrentInstall, &QAction::triggered,
this, &YQPkgObjList::setCurrentInstall );
445 connect( actionSetCurrentDontInstall, &QAction::triggered,
this, &YQPkgObjList::setCurrentDontInstall );
446 connect( actionSetCurrentKeepInstalled, &QAction::triggered,
this, &YQPkgObjList::setCurrentKeepInstalled );
447 connect( actionSetCurrentDelete, &QAction::triggered,
this, &YQPkgObjList::setCurrentDelete );
448 connect( actionSetCurrentUpdate, &QAction::triggered,
this, &YQPkgObjList::setCurrentUpdate );
449 connect( actionSetCurrentUpdateForce, &QAction::triggered,
this, &YQPkgObjList::setCurrentUpdateForce );
450 connect( actionSetCurrentTaboo, &QAction::triggered,
this, &YQPkgObjList::setCurrentTaboo );
451 connect( actionSetCurrentProtected, &QAction::triggered,
this, &YQPkgObjList::setCurrentProtected );
452 connect( actionShowCurrentSolverInfo, &QAction::triggered,
this, &YQPkgObjList::showCurrentSolverInfo );
453 connect( actionSetListInstall, &QAction::triggered,
this, &YQPkgObjList::setListInstall );
454 connect( actionSetListDontInstall, &QAction::triggered,
this, &YQPkgObjList::setListDontInstall );
455 connect( actionSetListKeepInstalled, &QAction::triggered,
this, &YQPkgObjList::setListKeepInstalled );
456 connect( actionSetListDelete, &QAction::triggered,
this, &YQPkgObjList::setListDelete );
457 connect( actionSetListUpdate, &QAction::triggered,
this, &YQPkgObjList::setListUpdate );
458 connect( actionSetListUpdateForce, &QAction::triggered,
this, &YQPkgObjList::setListUpdateForce );
459 connect( actionSetListTaboo, &QAction::triggered,
this, &YQPkgObjList::setListTaboo );
460 connect( actionSetListProtected, &QAction::triggered,
this, &YQPkgObjList::setListProtected );
470 zypp::Target_Ptr target = zypp::getZYpp()->getTarget();
471 if ( ! target || ( target->root() !=
"/" ) )
476 if ( ! _plugin.success() )
479 yuiMilestone() <<
"Disabling solver info plugin: not available and no target or target is not /" << endl;
480 actionShowCurrentSolverInfo->setVisible(
false);
484 yuiMilestone() <<
"target not available or target or target is not /. Solver info plugin available anyway." << endl;
504 const QPixmap & icon,
505 const QPixmap & insensitiveIcon,
509 QString label = text;
511 if ( ! key.isEmpty() )
515 QIcon iconSet ( icon );
517 if ( ! insensitiveIcon.isNull() )
519 iconSet.addPixmap( insensitiveIcon,
523 QAction * action =
new QAction( label,
525 Q_CHECK_PTR( action );
526 action->setEnabled( enabled );
527 action->setIcon( iconSet );
536 _notInstalledContextMenu =
new QMenu(
this );
537 Q_CHECK_PTR( _notInstalledContextMenu );
539 _notInstalledContextMenu->addAction( actionSetCurrentInstall );
540 _notInstalledContextMenu->addAction( actionSetCurrentDontInstall );
541 _notInstalledContextMenu->addAction( actionSetCurrentTaboo );
542 _notInstalledContextMenu->addAction( actionShowCurrentSolverInfo );
551 _installedContextMenu =
new QMenu(
this );
552 Q_CHECK_PTR( _installedContextMenu );
554 _installedContextMenu->addAction( actionSetCurrentKeepInstalled );
555 _installedContextMenu->addAction( actionSetCurrentDelete );
556 _installedContextMenu->addAction( actionSetCurrentUpdate );
557 _installedContextMenu->addAction( actionSetCurrentUpdateForce );
558 _installedContextMenu->addAction( actionShowCurrentSolverInfo );
567 QMenu * submenu =
new QMenu( menu );
568 Q_CHECK_PTR( submenu );
570 submenu->addAction( actionSetListInstall );
571 submenu->addAction( actionSetListDontInstall );
572 submenu->addAction( actionSetListKeepInstalled );
573 submenu->addAction( actionSetListDelete );
574 submenu->addAction( actionSetListUpdate );
575 submenu->addAction( actionSetListUpdateForce );
576 submenu->addAction( actionSetListTaboo );
578 QAction *action = menu->addMenu( submenu );
579 action->setText( _(
"&All in This List" ) );
588 if ( ! _notInstalledContextMenu )
591 return _notInstalledContextMenu;
598 if ( ! _installedContextMenu )
601 return _installedContextMenu;
615 if ( selectable->hasInstalledObj() )
617 actionSetCurrentInstall->setEnabled(
false );
618 actionSetCurrentDontInstall->setEnabled(
false );
619 actionSetCurrentTaboo->setEnabled(
false );
620 actionSetCurrentProtected->setEnabled(
true );
622 actionSetCurrentKeepInstalled->setEnabled(
true );
623 actionSetCurrentDelete->setEnabled(
true );
624 actionSetCurrentUpdate->setEnabled( selectable->hasCandidateObj() );
625 actionSetCurrentUpdateForce->setEnabled( selectable->hasCandidateObj() );
629 actionSetCurrentInstall->setEnabled( selectable->hasCandidateObj() );
630 actionSetCurrentDontInstall->setEnabled(
true );
631 actionSetCurrentTaboo->setEnabled(
true );
632 actionSetCurrentProtected->setEnabled(
false );
634 actionSetCurrentKeepInstalled->setEnabled(
false );
635 actionSetCurrentDelete->setEnabled(
false );
636 actionSetCurrentUpdate->setEnabled(
false );
637 actionSetCurrentUpdateForce->setEnabled(
false );
639 actionShowCurrentSolverInfo->setEnabled(
true );
643 actionSetCurrentInstall->setEnabled(
false );
644 actionSetCurrentDontInstall->setEnabled(
false );
645 actionSetCurrentTaboo->setEnabled(
false );
647 actionSetCurrentKeepInstalled->setEnabled(
false );
648 actionSetCurrentDelete->setEnabled(
false );
649 actionSetCurrentUpdate->setEnabled(
false );
650 actionSetCurrentUpdateForce->setEnabled(
false );
651 actionSetCurrentProtected->setEnabled(
false );
653 actionShowCurrentSolverInfo->setEnabled(
false );
664 Qt::KeyboardModifiers special_combo = ( Qt::ControlModifier | Qt::ShiftModifier | Qt::AltModifier );
666 if ( ( event->modifiers() & special_combo ) == special_combo )
668 if ( event->key() == Qt::Key_Q )
671 yuiMilestone() <<
"Debug mode: " << _debug << endl;
675 QTreeWidgetItem * selectedListViewItem = currentItem();
677 if ( selectedListViewItem )
686 installed = item->
selectable()->hasInstalledObj();
690 ZyppStatus status = item->
status();
692 switch( event->key() )
703 ZyppStatus newStatus = S_KeepInstalled;
706 newStatus = S_Update;
727 case Qt::Key_Asterisk:
734 case Qt::Key_Greater:
743 if ( status == S_Update ||
744 status == S_AutoUpdate )
755 item->toggleDebugIsBroken();
765 item->toggleDebugIsSatisfied();
774 QY2ListView::keyPressEvent( event );
781 QY2ListViewItem * item =
new QY2ListViewItem(
this );
784 item->setText( nameCol() >= 0 ? nameCol() : 0, text );
791 _excludeRules.push_back( rule );
799 QTreeWidgetItemIterator listView_it(
this );
801 while ( *listView_it )
803 QTreeWidgetItem * current_item = *listView_it;
813 ExcludedItems::iterator excluded_it = _excludedItems->
begin();
815 while ( excluded_it != _excludedItems->
end() )
817 QTreeWidgetItem * current_item = (*excluded_it).first;
834 if ( _excludedItems->
size() > 0 )
836 yuiMilestone() << _excludedItems->
size() <<
" packages excluded" << endl;
838 for ( ExcludeRuleList::iterator rule_it = _excludeRules.begin();
839 rule_it != _excludeRules.end();
846 yuiMilestone() <<
"Active exclude rule: \"" 847 << rule->
regexp().pattern() <<
"\"" 862 #if VERBOSE_EXCLUDE_RULES 866 for ( ExcludeRuleList::iterator rule_it = _excludeRules.begin();
867 rule_it != _excludeRules.end() && !
exclude;
872 if ( rule->
match( item ) )
875 #if VERBOSE_EXCLUDE_RULES 883 this->
exclude( item, exclude );
885 #if VERBOSE_EXCLUDE_RULES 888 yuiDebug() <<
"Rule \"" << matchingRule->
regexp().pattern()
889 <<
"\" matches: Excluding " << item->
zyppObj()->name()
894 yuiDebug() <<
"Un-excluding " << item->
zyppObj()->name() << endl;
910 QTreeWidgetItem * parentItem = item->parent();
913 parentItem->setHidden(exclude);
915 item->setHidden(exclude);
917 _excludedItems->
add( item, parentItem );
926 : QY2ListViewItem( pkgObjList )
927 , _pkgObjList( pkgObjList )
928 , _selectable( selectable )
929 , _zyppObj( zyppObj )
938 QY2ListViewItem * parent,
941 : QY2ListViewItem( parent )
942 , _pkgObjList( pkgObjList )
943 , _selectable( selectable )
944 , _zyppObj( zyppObj )
953 : QY2ListViewItem( pkgObjList )
954 , _pkgObjList( pkgObjList )
972 if ( _zyppObj == 0 && _selectable )
973 _zyppObj = _selectable->theObj();
975 _debugIsBroken =
false;
976 _debugIsSatisfied =
false;
977 _candidateIsNewer =
false;
978 _installedIsNewer =
false;
980 const ZyppObj candidate =
selectable()->candidateObj();
981 const ZyppObj installed =
selectable()->installedObj();
983 if ( candidate && installed )
985 if ( candidate->edition() < installed->edition() )
986 _installedIsNewer =
true;
987 else if ( installed->edition() < candidate->edition() )
988 _candidateIsNewer =
true;
991 if ( installed && ! candidate )
992 _installedIsNewer =
true;
995 if ( summaryCol() >= 0 )
setText( summaryCol(),
zyppObj()->summary() );
997 if ( sizeCol() >= 0 )
999 zypp::ByteCount size =
zyppObj()->installSize();
1002 setText( sizeCol(), size.asString() );
1005 if ( versionCol() == instVersionCol() )
1007 if ( versionCol() >= 0 )
1011 if (
zyppObj() != installed &&
1014 setText( versionCol(), QString().sprintf(
"%s",
zyppObj()->edition().c_str() ) );
1018 if ( candidate && installed->edition() != candidate->edition() )
1021 QString().sprintf(
"%s (%s)",
1022 installed->edition().c_str(),
1023 candidate->edition().c_str() ) );
1028 QString().sprintf(
"%s", installed->edition().c_str() ) );
1035 setText( versionCol(), QString().sprintf(
"(%s)", candidate->edition().c_str() ) );
1040 if ( _installedIsNewer )
1041 setTextColor( versionCol(), Qt::red);
1042 else if ( _candidateIsNewer )
1043 setTextColor( versionCol(), Qt::blue);
1048 if ( instVersionCol() >= 0 )
1052 setText( instVersionCol(), installed->edition() );
1054 if ( _installedIsNewer )
1055 setTextColor( instVersionCol(), Qt::red);
1056 else if ( _candidateIsNewer )
1057 setTextColor( instVersionCol(), Qt::blue);
1061 if ( versionCol() >= 0 )
1063 if (
zyppObj() != installed &&
1068 else if ( candidate )
1070 setText( versionCol(), candidate->edition() );
1072 if ( _installedIsNewer )
1073 setTextColor( versionCol(), Qt::red);
1074 else if ( _candidateIsNewer )
1075 setTextColor( versionCol(), Qt::blue);
1094 QTreeWidgetItem::setText( column, fromUTF8( text.c_str() ) );
1101 setText( column, edition.asString() );
1110 yuiError() <<
"No selectable" << endl;
1121 zypp::ResStatus::TransactByValue modifiedBy =
selectable()->modifiedBy();
1123 return ( modifiedBy == zypp::ResStatus::APPL_LOW ||
1124 modifiedBy == zypp::ResStatus::APPL_HIGH );
1132 ZyppStatus oldStatus =
selectable()->status();
1141 _pkgObjList->updateItemStates();
1153 zypp::getZYpp()->resolver()->resolvePool();
1168 if ( statusCol() >= 0 )
1175 if ( brokenIconCol() >= 0 )
1178 setIcon( brokenIconCol(), QPixmap() );
1181 if ( satisfiedIconCol() >= 0 )
1187 setIcon( satisfiedIconCol(),
isSatisfied() ? YQIconPool::pkgSatisfied() : QPixmap() );
1190 if ( brokenIconCol() >= 0 )
1197 setIcon( brokenIconCol(), YQIconPool::warningSign() );
1199 yuiWarning() <<
"Broken object: " << _selectable->theObj()->name()
1200 <<
" - " << _selectable->theObj()->summary()
1210 if ( _debugIsSatisfied )
1213 if ( _selectable->hasInstalledObj() )
1216 return _selectable->candidateObj().isSatisfied();
1222 if ( _debugIsBroken )
1225 if ( ! _selectable->hasInstalledObj() )
1230 case S_KeepInstalled:
1233 return _selectable->installedObj().isBroken();
1247 yuiError() <<
"Expected uninstalled zyppObj" << endl;
1251 yuiError() <<
"Should never get here" << endl;
1259 if ( ! _editable || ! _pkgObjList->
editable() )
1262 ZyppStatus oldStatus =
status();
1263 ZyppStatus newStatus = oldStatus;
1265 switch ( oldStatus )
1268 newStatus = S_NoInst;
1272 newStatus =
selectable()->hasCandidateObj() ?
1273 S_KeepInstalled: S_NoInst;
1277 newStatus =
selectable()->hasInstalledObj() ?
1278 S_KeepInstalled : S_NoInst;
1281 case S_KeepInstalled:
1282 newStatus =
selectable()->hasCandidateObj() ?
1291 newStatus = S_KeepInstalled;
1296 newStatus = S_KeepInstalled;
1302 newStatus = S_Install;
1306 yuiWarning() <<
"No candidate for " <<
selectable()->theObj()->name() << endl;
1307 newStatus = S_NoInst;
1314 newStatus = S_NoInst;
1318 if ( oldStatus != newStatus )
1350 text =
selectable()->candidateObj()->insnotify();
1357 text =
selectable()->candidateObj()->delnotify();
1363 if ( ! text.empty() )
1365 yuiDebug() <<
"Showing notify text" << endl;
1389 switch ( sel->status() )
1396 if ( sel->hasLicenceConfirmed() )
1399 if ( sel->candidateObj() )
1400 licenseText = sel->candidateObj()->licenseToConfirm();
1403 default:
return true;
1406 if ( licenseText.empty() )
1409 yuiDebug() <<
"Showing license agreement for " << sel->name() << endl;
1416 yuiMilestone() <<
"User confirmed license agreement for " << sel->name() << endl;
1417 sel->setLicenceConfirmed(
true );
1424 switch ( sel->status() )
1429 yuiWarning() <<
"User rejected license agreement for " << sel->name()
1430 <<
" - setting to TABOO" 1433 sel->setStatus( S_Taboo );
1440 yuiWarning() <<
"User rejected license agreement for " << sel->name()
1441 <<
" - setting to PROTECTED" 1444 sel->setStatus( S_Protected );
1460 if ( col == statusCol() )
1472 tip +=
"\n" + _(
"(by a software selection)" );
1474 tip +=
"\n" + _(
"(by dependencies)" );
1485 if ( col == brokenIconCol() )
1490 return _(
"Dependencies broken" );
1495 if ( col == satisfiedIconCol() )
1500 return _(
"All dependencies satisfied" );
1503 return QString::null;
1511 int col = treeWidget()->sortColumn();
1515 if ( col == nameCol() )
1517 return ( strcasecmp( this->
zyppObj()->name().c_str(), other->
zyppObj()->name().c_str() ) < 0 );
1519 if ( col == summaryCol() )
1522 return ( strcoll( this->
zyppObj()->summary().c_str(), other->
zyppObj()->summary().c_str() ) < 0 );
1524 if ( col == sizeCol() )
1528 return ( this->
zyppObj()->installSize() < other->
zyppObj()->installSize() );
1530 else if ( col == statusCol() )
1543 else if ( col == instVersionCol() ||
1544 col == versionCol() )
1559 if (thisPoints == otherPoints )
1560 return ( QString (this->
zyppObj()->edition().c_str() ) <
1561 QString (other->
zyppObj()->edition().c_str() ) );
1563 return ( thisPoints < otherPoints );
1568 return QY2ListViewItem::operator<( otherListViewItem );
1579 if (
selectable()->hasInstalledObj() ) points += 10;
1580 if (
selectable()->hasCandidateObj() ) points += 1;
1593 const QRegExp & regexp,
1609 #if VERBOSE_EXCLUDE_RULES 1610 yuiDebug() << ( enable ?
"Enabling" :
"Disabling" )
1611 <<
" exclude rule " << _regexp.pattern()
1637 QString text = item->text( _column );
1639 if ( text.isEmpty() )
1642 return _regexp.exactMatch( text );
1651 : _pkgObjList( parent )
1664 _excludeMap.insert( ItemPair( item, oldParent ) );
1670 ItemMap::iterator it = _excludeMap.find( item );
1672 if ( it != _excludeMap.end() )
1674 _excludeMap.erase( it );
1681 for ( ItemMap::iterator it = _excludeMap.begin();
1682 it != _excludeMap.end();
1688 _excludeMap.clear();
1694 return ( _excludeMap.find( item ) != _excludeMap.end() );
1703 updateActions( item );
1708 QMenu * contextMenu =
1713 contextMenu->popup( viewport()->mapToGlobal( pos ) );
1720 ItemMap::iterator it = _excludeMap.find( item );
1722 if ( it == _excludeMap.end() )
1730 #include "YQPkgObjList.moc" ZyppSel selectable() const
Returns the original selectable within the package manager backend.
int size() const
Returns the number of items.
ZyppObj zyppObj() const
Returns the original object within the package manager backend.
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 ...
void addExcludeRule(YQPkgObjList::ExcludeRule *rule)
Add an exclude rule to this list.
virtual void createInstalledContextMenu()
Create the context menu for installed items.
void setAllItemStatus(ZyppStatus newStatus, bool force=false)
Sets the status of all (toplevel) list items to 'newStatus', if possible.
bool candidateIsNewer() const
Check if the candidate is newer than the installed version.
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.
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.
virtual void updateActions(YQPkgObjListItem *item=0)
Update the internal actions for the currently selected item ( if any ).
void showSolverInfo()
Show solver information about the current selected item.
void sendStatusChanged()
Emit a statusChanged() signal for the specified zypp::ResObject.
void exclude(YQPkgObjListItem *item, bool exclude)
Exclude or include an item, i.e.
bool editable() const
Return whether or not items in this list are generally editable, i.e.
int versionPoints() const
Calculate a numerical value to compare versions, based on version relations:
void selectNextItem()
Select the next item, i.e.
bool isExcluded() const
Returns 'true' if this item is excluded.
virtual bool createZyppSolverDialog(const zypp::PoolItem item)
Create and show a QZyppDialog widget.
void updatePackages()
Emitted when it's time to update displayed package information, e.g., package states.
virtual bool operator<(const QTreeWidgetItem &other) const
sorting function
iterator end()
Returns an iterator that points after the last excluded item.
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'.
void clear()
Clear the excluded items.
ExcludedItems(YQPkgObjList *parent)
Constructor.
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...
virtual void applyChanges()
Apply changes hook.
QRegExp regexp() const
Returns the regexp.
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...
virtual QMenu * addAllInListSubMenu(QMenu *menu)
Add a submenu "All in this list..." to 'menu'.
bool isBroken() const
Check if this item is "broken": If it is installed, but any of its dependencies are no longer satisfi...
virtual QString statusText(ZyppStatus status) const
Returns a short (one line) descriptive text for a zypp::ResObject status.
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.
YQPkgObjList * parent() const
Returns this exclude rule's parent YQPkgObjList.
virtual void createNotInstalledContextMenu()
Create the context menu for items that are not installed.
bool isSatisfied() const
Check if this item is satisfied, even though it is not installed.
virtual QMenu * installedContextMenu()
Returns the context menu for items that are not installed.
bool installedIsNewer() const
Check if the installed version is newer than the candidate.
int column() const
Returns the column number.
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.
virtual ZyppStatus status() const
Returns the (binary RPM) package status.
bool isEnabled() const
Returns 'true' if this exclude rule is enabled, 'false' otherwise.
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.
virtual ~YQPkgObjListItem()
Destructor.
virtual void setStatusIcon()
Set a status icon according to the package's status.
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.
bool editable() const
Return whether or not this items is editable, i.e.