Hello community, here is the log from the commit of package yast2-qt-pkg checked in at Sat Apr 26 11:43:28 CEST 2008. -------- --- yast2-qt-pkg/yast2-qt-pkg.changes 2008-04-18 12:35:57.000000000 +0200 +++ /mounts/work_src_done/STABLE/yast2-qt-pkg/yast2-qt-pkg.changes 2008-04-25 17:30:00.000000000 +0200 @@ -1,0 +2,24 @@ +Fri Apr 25 12:14:45 CEST 2008 - dmacvicar@suse.de + +- make rpm groups view use packagekit groups + with nice icons. Get rid of useless tree +- add list of suggested and recommended packages + (fate #302039) +- ported search to sat solver search (much faster) + and implemented (fate #120368) to search for keywords + enabled by default. +- 2.16.39 + +------------------------------------------------------------------- +Mon Apr 21 18:05:09 CEST 2008 - dmacvicar@suse.de + +- apply language selections after clicking + (bnc #381994) +- 2.16.38 + +------------------------------------------------------------------- +Mon Apr 21 10:49:58 CEST 2008 - jsrain@suse.cz + +- added missing textdomain + +------------------------------------------------------------------- Old: ---- yast2-qt-pkg-2.16.37.tar.bz2 New: ---- yast2-qt-pkg-2.16.39.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-qt-pkg.spec ++++++ --- /var/tmp/diff_new_pack.Ed1002/_old 2008-04-26 11:43:09.000000000 +0200 +++ /var/tmp/diff_new_pack.Ed1002/_new 2008-04-26 11:43:09.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package yast2-qt-pkg (Version 2.16.37) +# spec file for package yast2-qt-pkg (Version 2.16.39) # # Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,12 +11,12 @@ Name: yast2-qt-pkg -Version: 2.16.37 +Version: 2.16.39 Release: 1 License: GPL v2 or later Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-qt-pkg-2.16.37.tar.bz2 +Source0: yast2-qt-pkg-2.16.39.tar.bz2 BuildRequires: docbook-xsl-stylesheets doxygen libdrm-devel libjpeg-devel libxcrypt-devel BuildRequires: libqt4-devel libxslt perl-XML-Writer sgml-skel update-desktop-files Summary: YaST2 - Graphical User Interface @@ -72,6 +72,21 @@ %_libdir/YaST2/plugin/libpy2qt_pkg.so %changelog +* Fri Apr 25 2008 dmacvicar@suse.de +- make rpm groups view use packagekit groups + with nice icons. Get rid of useless tree +- add list of suggested and recommended packages + (fate #302039) +- ported search to sat solver search (much faster) + and implemented (fate #120368) to search for keywords + enabled by default. +- 2.16.39 +* Mon Apr 21 2008 dmacvicar@suse.de +- apply language selections after clicking + (bnc #381994) +- 2.16.38 +* Mon Apr 21 2008 jsrain@suse.cz +- added missing textdomain * Fri Apr 18 2008 dmacvicar@suse.de - make versions widget work (bnc #354983) - show updates in blue again (bnc #371681) ++++++ yast2-qt-pkg-2.16.37.tar.bz2 -> yast2-qt-pkg-2.16.39.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/package/yast2-qt-pkg.changes new/yast2-qt-pkg-2.16.39/package/yast2-qt-pkg.changes --- old/yast2-qt-pkg-2.16.37/package/yast2-qt-pkg.changes 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/package/yast2-qt-pkg.changes 2008-04-25 17:30:04.000000000 +0200 @@ -1,4 +1,28 @@ ------------------------------------------------------------------- +Fri Apr 25 12:14:45 CEST 2008 - dmacvicar@suse.de + +- make rpm groups view use packagekit groups + with nice icons. Get rid of useless tree +- add list of suggested and recommended packages + (fate #302039) +- ported search to sat solver search (much faster) + and implemented (fate #120368) to search for keywords + enabled by default. +- 2.16.39 + +------------------------------------------------------------------- +Mon Apr 21 18:05:09 CEST 2008 - dmacvicar@suse.de + +- apply language selections after clicking + (bnc #381994) +- 2.16.38 + +------------------------------------------------------------------- +Mon Apr 21 10:49:58 CEST 2008 - jsrain@suse.cz + +- added missing textdomain + +------------------------------------------------------------------- Fri Apr 18 11:41:32 CEST 2008 - dmacvicar@suse.de - make versions widget work (bnc #354983) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/CMakeLists.txt new/yast2-qt-pkg-2.16.39/src/CMakeLists.txt --- old/yast2-qt-pkg-2.16.37/src/CMakeLists.txt 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/CMakeLists.txt 2008-04-25 17:30:04.000000000 +0200 @@ -9,6 +9,7 @@ -DTHEMEDIR=\"${Y2QT_THEMEDIR}\" -DQTLIBDIR=\"${LIB_INSTALL_DIR}\" -DHELPIMAGEDIR=\"${CMAKE_INSTALL_PREFIX}/share/YaST2/images\" + -DPREFIX=\"${CMAKE_INSTALL_PREFIX}\" ) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format-nonliteral -fmessage-length=0" ) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPackageSelector.cc new/yast2-qt-pkg-2.16.39/src/YQPackageSelector.cc --- old/yast2-qt-pkg-2.16.37/src/YQPackageSelector.cc 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPackageSelector.cc 2008-04-25 17:30:04.000000000 +0200 @@ -78,6 +78,7 @@ #include "YQPkgUpdateProblemFilterView.h" #include "YQPkgVersionsView.h" #include "zypp/SysContent.h" +#include "zypp/base/String.h" #include "QY2ComboTabWidget.h" #include "YQDialog.h" @@ -204,6 +205,11 @@ #endif } +std::string +YQPackageSelector::iconPath( const std::string &name, int size ) +{ + return zypp::str::form("%s/share/icons/hicolor/%dx%d/apps/%s.png", PREFIX, size, size, name.c_str()); +} void YQPackageSelector::basicLayout() diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPackageSelector.h new/yast2-qt-pkg-2.16.39/src/YQPackageSelector.h --- old/yast2-qt-pkg-2.16.37/src/YQPackageSelector.h 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPackageSelector.h 2008-04-25 17:30:04.000000000 +0200 @@ -194,7 +194,11 @@ **/ void showProducts(); - +public: + /** + * returns the full path for an icon of a given size + */ + static std::string iconPath( const std::string &name, int size ); protected: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgConflictDialog.cc new/yast2-qt-pkg-2.16.39/src/YQPkgConflictDialog.cc --- old/yast2-qt-pkg-2.16.37/src/YQPkgConflictDialog.cc 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgConflictDialog.cc 2008-04-25 17:30:04.000000000 +0200 @@ -60,6 +60,8 @@ YQPkgConflictDialog::YQPkgConflictDialog( QWidget * parent ) : QDialog( parent ) { + setStyleSheet( QString::null ); + _solveCount = 0; _totalSolveTime = 0.0; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgDescriptionView.cc new/yast2-qt-pkg-2.16.39/src/YQPkgDescriptionView.cc --- old/yast2-qt-pkg-2.16.37/src/YQPkgDescriptionView.cc 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgDescriptionView.cc 2008-04-25 17:30:04.000000000 +0200 @@ -14,6 +14,8 @@ Author: Stefan Hundhammer <sh@suse.de> + Textdomain "qt-pkg" + /-*/ #define YUILogComponent "qt-pkg" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgLangList.cc new/yast2-qt-pkg-2.16.39/src/YQPkgLangList.cc --- old/yast2-qt-pkg-2.16.37/src/YQPkgLangList.cc 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgLangList.cc 2008-04-25 17:30:04.000000000 +0200 @@ -246,6 +246,7 @@ zypp::getZYpp()->pool().addRequestedLocale( _zyppLang ); } setStatusIcon(); + _pkgObjList->sendStatusChanged(); } #include "YQPkgLangList.moc" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgObjList.cc new/yast2-qt-pkg-2.16.39/src/YQPkgObjList.cc --- old/yast2-qt-pkg-2.16.37/src/YQPkgObjList.cc 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgObjList.cc 2008-04-25 17:30:04.000000000 +0200 @@ -794,8 +794,6 @@ { YQPkgObjListItem * item = dynamic_cast<YQPkgObjListItem *>( listViewItem ); - std::cout << "apply exclude rules to item: " << item->zyppObj() << std::endl; - if ( item ) { bool exclude = false; @@ -1064,18 +1062,7 @@ void YQPkgObjListItem::solveResolvableCollections() { -#if EXTRA_SOLVE_COLLECTIONS - zypp::Resolver_Ptr resolver = zypp::getZYpp()->resolver(); - - resolver->transactReset( zypp::ResStatus::APPL_LOW ); - - resolver->transactResKind( zypp::ResTraits<zypp::Product >::kind ); - resolver->transactResKind( zypp::ResTraitszypp::Selection::kind ); - resolver->transactResKind( zypp::ResTraits<zypp::Pattern >::kind ); - resolver->transactResKind( zypp::ResTraits<zypp::Language >::kind ); - resolver->transactResKind( zypp::ResTraits<zypp::Patch >::kind ); - resolver->transactResKind( zypp::ResTraits<zypp::Atom >::kind ); -#endif + zypp::getZYpp()->resolver()->resolvePool(); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgPatternList.cc new/yast2-qt-pkg-2.16.39/src/YQPkgPatternList.cc --- old/yast2-qt-pkg-2.16.37/src/YQPkgPatternList.cc 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgPatternList.cc 2008-04-25 17:30:04.000000000 +0200 @@ -32,6 +32,7 @@ #include "YQi18n.h" #include "utf8.h" +#include "YQPackageSelector.h" #include "YQPkgPatternList.h" #include "YQIconPool.h" #include "YQApplication.h" @@ -464,8 +465,11 @@ if ( icon == zypp::Pathname("yast-system").asString() ) icon = "pattern-generic"; - // FIXME find the icon in a sane way - setIcon(_patternList->iconCol(), QIcon(QString("/usr/share/icons/hicolor/32x32/apps/") + icon.c_str() + QString(".png"))); + std::string iconpath = YQPackageSelector::iconPath(icon, 32); + //std::cout << icon << " | "<< iconpath << std::endl; + + setIcon(_patternList->iconCol(), QIcon(QString(iconpath.c_str()))); + } setStatusIcon(); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgRpmGroupTagsFilterView.cc new/yast2-qt-pkg-2.16.39/src/YQPkgRpmGroupTagsFilterView.cc --- old/yast2-qt-pkg-2.16.37/src/YQPkgRpmGroupTagsFilterView.cc 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgRpmGroupTagsFilterView.cc 2008-04-25 17:30:04.000000000 +0200 @@ -22,27 +22,303 @@ #define YUILogComponent "qt-pkg" #include "YUILog.h" +#include <QApplication> + +#include "YQPackageSelector.h" +#include "zypp/sat/LookupAttr.h" + #include "YQPkgRpmGroupTagsFilterView.h" #include "YQi18n.h" #include "utf8.h" +/** + * translations taken from packagekit + **/ +QString +group_enum_to_localised_text (YPkgGroupEnum group) +{ + QString text; + switch (group) + { + case PK_GROUP_ENUM_ACCESSIBILITY: + text = _("Accessibility"); + break; + case PK_GROUP_ENUM_ACCESSORIES: + text = _("Accessories"); + break; + case PK_GROUP_ENUM_EDUCATION: + text = _("Education"); + break; + case PK_GROUP_ENUM_GAMES: + text = _("Games"); + break; + case PK_GROUP_ENUM_GRAPHICS: + text = _("Graphics"); + break; + case PK_GROUP_ENUM_INTERNET: + text = _("Internet"); + break; + case PK_GROUP_ENUM_OFFICE: + text = _("Office"); + break; + case PK_GROUP_ENUM_OTHER: + text = _("Other"); + break; + case PK_GROUP_ENUM_PROGRAMMING: + text = _("Programming"); + break; + case PK_GROUP_ENUM_MULTIMEDIA: + text = _("Multimedia"); + break; + case PK_GROUP_ENUM_SYSTEM: + text = _("System"); + break; + case PK_GROUP_ENUM_DESKTOP_GNOME: + text = _("GNOME desktop"); + break; + case PK_GROUP_ENUM_DESKTOP_KDE: + text = _("KDE desktop"); + break; + case PK_GROUP_ENUM_DESKTOP_XFCE: + text = _("XFCE desktop"); + break; + case PK_GROUP_ENUM_DESKTOP_OTHER: + text = _("Other desktops"); + break; + case PK_GROUP_ENUM_PUBLISHING: + text = _("Publishing"); + break; + case PK_GROUP_ENUM_SERVERS: + text = _("Servers"); + break; + case PK_GROUP_ENUM_FONTS: + text = _("Fonts"); + break; + case PK_GROUP_ENUM_ADMIN_TOOLS: + text = _("Admin tools"); + break; + case PK_GROUP_ENUM_LEGACY: + text = _("Legacy"); + break; + case PK_GROUP_ENUM_LOCALIZATION: + text = _("Localization"); + break; + case PK_GROUP_ENUM_VIRTUALIZATION: + text = _("Virtualization"); + break; + case PK_GROUP_ENUM_SECURITY: + text = _("Security"); + break; + case PK_GROUP_ENUM_POWER_MANAGEMENT: + text = _("Power management"); + break; + case PK_GROUP_ENUM_COMMUNICATION: + text = _("Communication"); + break; + case PK_GROUP_ENUM_NETWORK: + text = _("Network"); + break; + case PK_GROUP_ENUM_MAPS: + text = _("Maps"); + break; + case PK_GROUP_ENUM_REPOS: + text = _("Software sources"); + break; + case YPKG_GROUP_ALL: + text = _("All packages"); + break; + + case YPKG_GROUP_SUGGESTED: + text = _("Suggested packages"); + break; + + case YPKG_GROUP_RECOMMENDED: + text = _("Recommended packages"); + break; + + case PK_GROUP_ENUM_UNKNOWN: + text = _("Unknown group"); + break; + default: + break; + + } + return text; +} + +std::string +group_enum_to_icon (YPkgGroupEnum group) +{ + std::string text; + switch (group) + { + case PK_GROUP_ENUM_ACCESSIBILITY: + text = "package_main"; + break; + case PK_GROUP_ENUM_ACCESSORIES: + text = "package_applications"; + break; + case PK_GROUP_ENUM_EDUCATION: + text = "package_edutainment"; + break; + case PK_GROUP_ENUM_GAMES: + text = "package_games"; + break; + case PK_GROUP_ENUM_GRAPHICS: + text = "package_graphics"; + break; + case PK_GROUP_ENUM_INTERNET: + text = "package_network"; + break; + case PK_GROUP_ENUM_OFFICE: + text = "package_office_addressbook"; + break; + case PK_GROUP_ENUM_OTHER: + text = "package_main"; + break; + case PK_GROUP_ENUM_PROGRAMMING: + text = "package_development"; + break; + case PK_GROUP_ENUM_MULTIMEDIA: + text = "package_multimedia"; + break; + case PK_GROUP_ENUM_SYSTEM: + text = "yast-system"; + break; + case PK_GROUP_ENUM_DESKTOP_GNOME: + text = "pattern-gnome"; + break; + case PK_GROUP_ENUM_DESKTOP_KDE: + text = "pattern-kde"; + break; + case PK_GROUP_ENUM_DESKTOP_XFCE: + text = "package_utility_desktop"; + break; + case PK_GROUP_ENUM_DESKTOP_OTHER: + text = "package_utility_desktop"; + break; + case PK_GROUP_ENUM_PUBLISHING: + text = "package_main"; + break; + case PK_GROUP_ENUM_SERVERS: + text = "package_editors"; + break; + case PK_GROUP_ENUM_FONTS: + text = "package_main"; + break; + case PK_GROUP_ENUM_ADMIN_TOOLS: + text = "yast-sysconfig"; + break; + case PK_GROUP_ENUM_LEGACY: + text = "package_main"; + break; + case PK_GROUP_ENUM_LOCALIZATION: + text = "yast-language"; + break; + case PK_GROUP_ENUM_VIRTUALIZATION: + text = "yast-create-new-vm"; + break; + case PK_GROUP_ENUM_SECURITY: + text = "yast-security"; + break; + case PK_GROUP_ENUM_POWER_MANAGEMENT: + text = "package_settings_power"; + break; + case PK_GROUP_ENUM_COMMUNICATION: + text = "yast-modem"; + break; + case PK_GROUP_ENUM_NETWORK: + text = "package_network"; + break; + case PK_GROUP_ENUM_MAPS: + text = "package_main"; + break; + case PK_GROUP_ENUM_REPOS: + text = "package_main"; + break; + case YPKG_GROUP_SUGGESTED: + case YPKG_GROUP_RECOMMENDED: + text = "package_edutainment_languages"; + + break; + case PK_GROUP_ENUM_UNKNOWN: + case YPKG_GROUP_ALL: + text = "package_main"; + break; + default: + break; + + } + return text; +} -YRpmGroupsTree * YQPkgRpmGroupTagsFilterView::_rpmGroupsTree = 0; +YPkgGroupEnum +zypp_get_group (const std::string &groupu) +{ + // TODO Look for a faster and nice way to do this conversion + std::string group = zypp::str::toLower(groupu); + + if (group.find ("amusements") != std::string::npos) { + return PK_GROUP_ENUM_GAMES; + } else if (group.find ("development") != std::string::npos) { + return PK_GROUP_ENUM_PROGRAMMING; + } else if (group.find ("hardware") != std::string::npos) { + return PK_GROUP_ENUM_SYSTEM; + } else if (group.find ("archiving") != std::string::npos + || group.find("clustering") != std::string::npos + || group.find("system/monitoring") != std::string::npos + || group.find("databases") != std::string::npos + || group.find("system/management") != std::string::npos) { + return PK_GROUP_ENUM_ADMIN_TOOLS; + } else if (group.find ("graphics") != std::string::npos) { + return PK_GROUP_ENUM_GRAPHICS; + } else if (group.find ("multimedia") != std::string::npos) { + return PK_GROUP_ENUM_MULTIMEDIA; + } else if (group.find ("network") != std::string::npos) { + return PK_GROUP_ENUM_NETWORK; + } else if (group.find ("office") != std::string::npos + || group.find("text") != std::string::npos + || group.find("editors") != std::string::npos) { + return PK_GROUP_ENUM_OFFICE; + } else if (group.find ("publishing") != std::string::npos) { + return PK_GROUP_ENUM_PUBLISHING; + } else if (group.find ("security") != std::string::npos) { + return PK_GROUP_ENUM_SECURITY; + } else if (group.find ("telephony") != std::string::npos) { + return PK_GROUP_ENUM_COMMUNICATION; + } else if (group.find ("gnome") != std::string::npos) { + return PK_GROUP_ENUM_DESKTOP_GNOME; + } else if (group.find ("kde") != std::string::npos) { + return PK_GROUP_ENUM_DESKTOP_KDE; + } else if (group.find ("xfce") != std::string::npos) { + return PK_GROUP_ENUM_DESKTOP_XFCE; + } else if (group.find ("gui/other") != std::string::npos) { + return PK_GROUP_ENUM_DESKTOP_OTHER; + } else if (group.find ("localization") != std::string::npos) { + return PK_GROUP_ENUM_LOCALIZATION; + } else if (group.find ("system") != std::string::npos) { + return PK_GROUP_ENUM_SYSTEM; + } else if (group.find ("scientific") != std::string::npos) { + return PK_GROUP_ENUM_EDUCATION; + } + + return PK_GROUP_ENUM_UNKNOWN; +} YQPkgRpmGroupTagsFilterView::YQPkgRpmGroupTagsFilterView( QWidget * parent ) : QTreeWidget( parent ) -{ + , _selectedGroup(YPKG_GROUP_ALL) +{ + setIconSize(QSize(32,32)); setHeaderLabels( QStringList(_( "Package Groups" )) ); - setRootIsDecorated( true ); - cloneTree( rpmGroupsTree()->root(), 0 ); - - new YQPkgRpmGroupTag( this, _( "zzz All" ), 0 ); - + setRootIsDecorated( false ); + setSortingEnabled( true ); connect( this, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ), this, SLOT ( slotSelectionChanged ( QTreeWidgetItem * ) ) ); - + fillGroups(); + selectSomething(); } @@ -51,64 +327,41 @@ { } - -YRpmGroupsTree * -YQPkgRpmGroupTagsFilterView::rpmGroupsTree() +void YQPkgRpmGroupTagsFilterView::fillGroups() { - if ( ! _rpmGroupsTree ) + if ( _groupsMap.empty() ) { - _rpmGroupsTree = new YRpmGroupsTree(); - Q_CHECK_PTR( _rpmGroupsTree ); + zypp::sat::LookupAttr rpmgroups( zypp::sat::SolvAttr::group ); + for ( zypp::sat::LookupAttr::iterator it = rpmgroups.begin(); + it != rpmgroups.end(); + ++it ) + { + YPkgGroupEnum group; + std::map<std::string, YPkgGroupEnum>::const_iterator itg = _groupsCache.find(it.asString()); + if ( itg == _groupsCache.end() ) + { + group = zypp_get_group( it.asString() ); + _groupsCache[it.asString()] = group; + } + else + { + group = itg->second; + } + + //std::cout << it.asString() << std::endl; + + if ( _groupsMap.find(group) == _groupsMap.end() ) + { + _groupsMap[group] = new YQPkgRpmGroupTag( this, group ); + } + } + _groupsMap[YPKG_GROUP_ALL] = new YQPkgRpmGroupTag( this, YPKG_GROUP_ALL ); + _groupsMap[YPKG_GROUP_RECOMMENDED] = new YQPkgRpmGroupTag( this, YPKG_GROUP_RECOMMENDED ); + _groupsMap[YPKG_GROUP_SUGGESTED] = new YQPkgRpmGroupTag( this, YPKG_GROUP_SUGGESTED ); - fillRpmGroupsTree(); } - - return _rpmGroupsTree; } - -void -YQPkgRpmGroupTagsFilterView::fillRpmGroupsTree() -{ - yuiDebug() << "Filling RPM groups tree" << endl; - - for ( ZyppPoolIterator it = zyppPkgBegin(); - it != zyppPkgEnd(); - ++it ) - { - ZyppPkg zyppPkg = tryCastToZyppPkg( (*it)->theObj() ); - - if ( zyppPkg ) - rpmGroupsTree()->addRpmGroup( zyppPkg->group() ); - } - - yuiDebug() << "Filling RPM groups tree done" << endl; -} - - -void -YQPkgRpmGroupTagsFilterView::cloneTree( YStringTreeItem * parentRpmGroup, - YQPkgRpmGroupTag * parentClone ) -{ - YStringTreeItem * child = parentRpmGroup->firstChild(); - YQPkgRpmGroupTag * clone; - - while ( child ) - { - if ( parentClone ) - clone = new YQPkgRpmGroupTag( this, parentClone, child ); - else - clone = new YQPkgRpmGroupTag( this, child ); - - Q_CHECK_PTR( clone ); - //FIXME clone->setExpanded( clone->depth() < 1 ); - clone->setExpanded( true ); - cloneTree( child, clone ); - child = child->next(); - } -} - - void YQPkgRpmGroupTagsFilterView::selectSomething() { @@ -136,32 +389,32 @@ if ( selection() ) { - for ( ZyppPoolIterator it = zyppPkgBegin(); - it != zyppPkgEnd(); - ++it ) - { - ZyppSel selectable = *it; - - // Multiple instances of this package may or may not be in the same - // RPM group, so let's check both the installed version (if there - // is any) and the candidate version. - // - // Make sure we emit only one filterMatch() signal if both exist - // and both are in the same RPM group. We don't want multiple list - // entries for the same package! - - bool match = - check( selectable, tryCastToZyppPkg( selectable->candidateObj() ) ) || - check( selectable, tryCastToZyppPkg( selectable->installedObj() ) ); - - // If there is neither an installed nor a candidate package, check - // any other instance. - - if ( ! match && - ! selectable->candidateObj() && - ! selectable->installedObj() ) - check( selectable, tryCastToZyppPkg( selectable->theObj() ) ); - } + for ( ZyppPoolIterator it = zyppPkgBegin(); + it != zyppPkgEnd(); + ++it ) + { + ZyppSel selectable = *it; + + // Multiple instances of this package may or may not be in the same + // RPM group, so let's check both the installed version (if there + // is any) and the candidate version. + // + // Make sure we emit only one filterMatch() signal if both exist + // and both are in the same RPM group. We don't want multiple list + // entries for the same package! + + bool match = + check( selectable, tryCastToZyppPkg( selectable->candidateObj() ) ) || + check( selectable, tryCastToZyppPkg( selectable->installedObj() ) ); + + // If there is neither an installed nor a candidate package, check + // any other instance. + + if ( ! match && + ! selectable->candidateObj() && + ! selectable->installedObj() ) + check( selectable, tryCastToZyppPkg( selectable->theObj() ) ); + } } emit filterFinished(); @@ -175,14 +428,22 @@ if ( sel ) { - if ( sel->rpmGroup() ) - _selectedRpmGroup = rpmGroupsTree()->rpmGroup( sel->rpmGroup() ); - else - _selectedRpmGroup = "*"; // "zzz_All" + _selectedGroup = sel->group(); + // for the list of reccommended packages, we need + // to solve first + if ( _selectedGroup == YPKG_GROUP_SUGGESTED || + _selectedGroup == YPKG_GROUP_RECOMMENDED ) + { + // set the busy cursor for the solving + QApplication::setOverrideCursor(Qt::WaitCursor); + zypp::getZYpp()->resolver()->resolvePool(); + QApplication::restoreOverrideCursor(); + } + } else { - _selectedRpmGroup = ""; + _selectedGroup = YPKG_GROUP_ALL; } filter(); @@ -196,20 +457,34 @@ if ( ! pkg || ! selection() ) return false; - if ( selection()->rpmGroup() == 0 ) // Special case: All packages + if ( selection()->group() == YPKG_GROUP_ALL ) // Special case: All packages { - emit filterMatch( selectable, pkg ); - return true; + emit filterMatch( selectable, pkg ); + return true; } - if ( selectedRpmGroup().empty() ) - return false; + YPkgGroupEnum groupn = zypp_get_group(pkg->group()); - if ( pkg->group() == selectedRpmGroup() || // full match? - pkg->group().find( selectedRpmGroup() + "/" ) == 0 ) // starts with selected? + if ( groupn == selectedGroup() ) { - emit filterMatch( selectable, pkg ); - return true; + emit filterMatch( selectable, pkg ); + return true; + } + + if ( selectable->candidateObj() ) + { + if ( selectedGroup() == YPKG_GROUP_RECOMMENDED && + zypp::PoolItem(pkg).status().isRecommended() ) + { + emit filterMatch( selectable, pkg ); + return true; + } + if ( selectedGroup() == YPKG_GROUP_SUGGESTED && + zypp::PoolItem(pkg).status().isSuggested() ) + { + emit filterMatch( selectable, pkg ); + return true; + } } return false; @@ -222,53 +497,39 @@ QTreeWidgetItem * item = currentItem(); if ( ! item ) - return 0; + return 0; return dynamic_cast<YQPkgRpmGroupTag *> ( item ); } - - - - YQPkgRpmGroupTag::YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView, - YStringTreeItem * rpmGroup ) + YPkgGroupEnum group ) : QTreeWidgetItem( parentFilterView ) , _filterView( parentFilterView ) - , _rpmGroup( rpmGroup ) + , _group( group ) { - setText( 0, fromUTF8( _rpmGroup->value().translation() ) ); + QFont f = font(0); + //f.setWeight(QFont::Bold); + f.setPointSize(f.pointSize()+2); + setFont(0, f); + + std::string iconName = group_enum_to_icon(group); + setText( 0, group_enum_to_localised_text(group)); + setIcon(0, QIcon(QString(YQPackageSelector::iconPath(iconName, 32).c_str()))); } - -YQPkgRpmGroupTag::YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView, - YQPkgRpmGroupTag * parentGroupTag, - YStringTreeItem * rpmGroup ) - : QTreeWidgetItem( parentGroupTag ) - , _filterView( parentFilterView ) - , _rpmGroup( rpmGroup ) +YQPkgRpmGroupTag::~YQPkgRpmGroupTag() { - setText( 0, fromUTF8( _rpmGroup->value().translation() ) ); + // NOP } - -YQPkgRpmGroupTag::YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView, - const QString & rpmGroupName, - YStringTreeItem * rpmGroup ) - : QTreeWidgetItem( parentFilterView ) - , _filterView( parentFilterView ) - , _rpmGroup( rpmGroup ) +bool YQPkgRpmGroupTag::operator< ( const QTreeWidgetItem & otherListViewItem ) const { - setText( 0, rpmGroupName ); -} + const YQPkgRpmGroupTag * otherCategoryItem = dynamic_cast<const YQPkgRpmGroupTag *>(&otherListViewItem); - -YQPkgRpmGroupTag::~YQPkgRpmGroupTag() -{ - // NOP + return group() > otherCategoryItem->group(); } - #include "YQPkgRpmGroupTagsFilterView.moc" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgRpmGroupTagsFilterView.h new/yast2-qt-pkg-2.16.39/src/YQPkgRpmGroupTagsFilterView.h --- old/yast2-qt-pkg-2.16.37/src/YQPkgRpmGroupTagsFilterView.h 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgRpmGroupTagsFilterView.h 2008-04-25 17:30:04.000000000 +0200 @@ -20,13 +20,50 @@ #ifndef YQPkgRpmGroupTagsFilterView_h #define YQPkgRpmGroupTagsFilterView_h +#include <map> #include "YQZypp.h" +#include "YRpmGroupsTree.h" #include <QTreeWidget> -#include <YRpmGroupsTree.h> - using std::string; +typedef enum { + /* PackageKit values */ + PK_GROUP_ENUM_ACCESSIBILITY, + PK_GROUP_ENUM_ACCESSORIES, + PK_GROUP_ENUM_EDUCATION, + PK_GROUP_ENUM_GAMES, + PK_GROUP_ENUM_GRAPHICS, + PK_GROUP_ENUM_INTERNET, + PK_GROUP_ENUM_OFFICE, + PK_GROUP_ENUM_OTHER, + PK_GROUP_ENUM_PROGRAMMING, + PK_GROUP_ENUM_MULTIMEDIA, + PK_GROUP_ENUM_SYSTEM, + PK_GROUP_ENUM_DESKTOP_GNOME, + PK_GROUP_ENUM_DESKTOP_KDE, + PK_GROUP_ENUM_DESKTOP_XFCE, + PK_GROUP_ENUM_DESKTOP_OTHER, + PK_GROUP_ENUM_PUBLISHING, + PK_GROUP_ENUM_SERVERS, + PK_GROUP_ENUM_FONTS, + PK_GROUP_ENUM_ADMIN_TOOLS, + PK_GROUP_ENUM_LEGACY, + PK_GROUP_ENUM_LOCALIZATION, + PK_GROUP_ENUM_VIRTUALIZATION, + PK_GROUP_ENUM_SECURITY, + PK_GROUP_ENUM_POWER_MANAGEMENT, + PK_GROUP_ENUM_COMMUNICATION, + PK_GROUP_ENUM_NETWORK, + PK_GROUP_ENUM_MAPS, + PK_GROUP_ENUM_REPOS, + PK_GROUP_ENUM_UNKNOWN, + /* Other values */ + YPKG_GROUP_SUGGESTED, + YPKG_GROUP_RECOMMENDED, + YPKG_GROUP_ALL, +} YPkgGroupEnum; + class YQPkgRpmGroupTag; @@ -64,11 +101,9 @@ ZyppPkg pkg ); /** - * Returns the (untranslated!) currently selected RPM group as string. - * Special case: "*" is returned if "zzz_All" is selected. + * Returns the (untranslated!) currently selected group enum **/ - const string & selectedRpmGroup() const { return _selectedRpmGroup; } - + YPkgGroupEnum selectedGroup() const { return _selectedGroup; } public slots: @@ -93,13 +128,6 @@ **/ void selectSomething(); - /** - * Returns the internal RPM groups tree and fills it - * if it doesn't exist yet. - **/ - static YRpmGroupsTree * rpmGroupsTree(); - - signals: /** @@ -127,58 +155,25 @@ **/ void slotSelectionChanged( QTreeWidgetItem * newSelection ); - protected: - /** - * Fill the internal RPM groups tree with RPM groups of all packages - * currently in the pool - **/ - static void fillRpmGroupsTree(); - - /** - * Recursively clone the RPM group tag tree for the QListView widget: - * Make a deep copy of the tree starting at 'parentRpmGroup' and - * 'parentClone'. - **/ - void cloneTree( YStringTreeItem * parentRpmGroup, - YQPkgRpmGroupTag * parentClone = 0 ); - + void fillGroups(); // // Data members // - string _selectedRpmGroup; - - static YRpmGroupsTree * _rpmGroupsTree; + YPkgGroupEnum _selectedGroup; + std::map<YPkgGroupEnum, YQPkgRpmGroupTag*> _groupsMap; + // map to cache converted groups + std::map<std::string, YPkgGroupEnum> _groupsCache; }; - - class YQPkgRpmGroupTag: public QTreeWidgetItem { public: - /** - * Constructor for toplevel RPM group tags - **/ - YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView, - YStringTreeItem * rpmGroup ); - - /** - * Constructor for RPM group tags that have a parent - **/ - YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView, - YQPkgRpmGroupTag * parentGroupTag, - YStringTreeItem * rpmGroup ); - - /** - * Constructor for toplevel RPM group tags via STL string - * ( for special cases like "zzz All" ) - **/ YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView, - const QString & rpmGroupName, - YStringTreeItem * rpmGroup ); + YPkgGroupEnum group ); /** * Destructor @@ -191,18 +186,15 @@ **/ YQPkgRpmGroupTagsFilterView * filterView() const { return _filterView; } - /** - * Returns the original tree item - **/ - const YStringTreeItem * rpmGroup() const { return _rpmGroup; } - + YPkgGroupEnum group() const { return _group; } + virtual bool operator< ( const QTreeWidgetItem & otherListViewItem ) const; private: // Data members YQPkgRpmGroupTagsFilterView * _filterView; - YStringTreeItem * _rpmGroup; + YPkgGroupEnum _group; }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgSearchFilterView.cc new/yast2-qt-pkg-2.16.39/src/YQPkgSearchFilterView.cc --- old/yast2-qt-pkg-2.16.37/src/YQPkgSearchFilterView.cc 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgSearchFilterView.cc 2008-04-25 17:30:04.000000000 +0200 @@ -29,6 +29,8 @@ #include <QDateTime> #include <QKeyEvent> +#include "zypp/PoolQuery.h" + #define YUILogComponent "qt-pkg" #include "YUILog.h" @@ -208,6 +210,11 @@ // Create a progress dialog that is only displayed if the search takes // longer than a couple of seconds ( default: 4 ). + + zypp::PoolQuery query; + query.addKind(zypp::ResTraitszypp::Package::kind); + query.addString(_searchText->currentText().toUtf8().data()); + QProgressDialog progress( _( "Searching..." ), // text _( "&Cancel" ), // cancelButtonLabel 0, @@ -216,35 +223,58 @@ ); progress.setWindowTitle( "" ); progress.setMinimumDuration( 2000 ); // millisec - QTime timer; - QRegExp regexp( _searchText->currentText() ); - regexp.setCaseSensitivity( _caseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive ); - regexp.setPatternSyntax( (_searchMode->currentIndex() == UseWildcards) ? QRegExp::Wildcard : QRegExp::RegExp); + QTime timer; + query.setCaseSensitive( _caseSensitive->isChecked() ); + + switch ( _searchMode->currentIndex() ) + { + case Contains: + case BeginsWith: + query.setMatchSubstring(); + break; + case ExactMatch: + break; + case UseWildcards: + query.setMatchGlob(); + break; + case UseRegExp: + query.setMatchRegex(); + break; + // Intentionally omitting "default" branch - let gcc watch for unhandled enums + } + + if ( _searchInName->isChecked() ) + query.addAttribute( zypp::sat::SolvAttr::name ); + if ( _searchInDescription->isChecked() ) + query.addAttribute( zypp::sat::SolvAttr::description ); + if ( _searchInSummary->isChecked() ) + query.addAttribute( zypp::sat::SolvAttr::summary ); + if ( _searchInRequires->isChecked() ) + query.addAttribute( zypp::sat::SolvAttr("solvable:requires") ); + if ( _searchInProvides->isChecked() ) + query.addAttribute( zypp::sat::SolvAttr("solvable:provides") ); + + // always look in keywords so FATE #120368 is implemented + // but make this configurable later + query.addAttribute( zypp::sat::SolvAttr::keywords ); timer.start(); - int count = 0; - for ( ZyppPoolIterator it = zyppPkgBegin(); - it != zyppPkgEnd() && ! progress.wasCanceled(); + for ( zypp::PoolQuery::Selectable_iterator it = query.selectableBegin(); + it != query.selectableEnd() && ! progress.wasCanceled(); ++it ) { ZyppSel selectable = *it; + ZyppPkg zyppPkg = tryCastToZyppPkg( selectable->theObj() ); - bool match = - check( selectable, selectable->candidateObj(), regexp ) || - check( selectable, selectable->installedObj(), regexp ); - - // If there is neither an installed nor a candidate package, check - // any other instance. - - if ( ! match && - ! selectable->candidateObj() && - ! selectable->installedObj() ) - check( selectable, selectable->theObj(), regexp ); - + if ( zyppPkg ) + { + _matchCount++; + emit filterMatch( selectable, zyppPkg ); + } progress.setValue( count++ ); @@ -255,7 +285,7 @@ // list change all the time, thus display updates are necessary // each time. - qApp->processEvents(); + //qApp->processEvents(); timer.restart(); } } @@ -267,7 +297,6 @@ emit filterFinished(); } - bool YQPkgSearchFilterView::check( ZyppSel selectable, ZyppObj zyppObj ) @@ -363,6 +392,4 @@ return false; } - - #include "YQPkgSearchFilterView.moc" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/src/YQPkgSearchFilterView.h new/yast2-qt-pkg-2.16.39/src/YQPkgSearchFilterView.h --- old/yast2-qt-pkg-2.16.37/src/YQPkgSearchFilterView.h 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/src/YQPkgSearchFilterView.h 2008-04-25 17:30:04.000000000 +0200 @@ -127,19 +127,26 @@ UseRegExp }; + /** + * Key press event: Execute search upon 'Return' + * Reimplemented from QVBox / QWidget. + **/ + virtual void keyPressEvent( QKeyEvent * event ); + // THESE SHOULD BE DEPRECATED but still used in secondary + // filters /** * Check if pkg matches the search criteria. **/ bool check( ZyppSel selectable, ZyppObj zyppObj, const QRegExp & regexp ); - + /** * Check if a single pkg attribute matches the search criteria. **/ bool check( const string & attribute, const QRegExp & regexp ); - + /** * Check capability like * zypp::Resolvable::dep( zypp::Dep::PROVIDES ), @@ -147,13 +154,6 @@ **/ bool check( const zypp::Capabilities & capSet, const QRegExp & regexp ); - /** - * Key press event: Execute search upon 'Return' - * Reimplemented from QVBox / QWidget. - **/ - virtual void keyPressEvent( QKeyEvent * event ); - - // Data members QComboBox * _searchText; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-qt-pkg-2.16.37/VERSION.cmake new/yast2-qt-pkg-2.16.39/VERSION.cmake --- old/yast2-qt-pkg-2.16.37/VERSION.cmake 2008-04-18 12:35:42.000000000 +0200 +++ new/yast2-qt-pkg-2.16.39/VERSION.cmake 2008-04-25 17:30:04.000000000 +0200 @@ -1,3 +1,3 @@ SET(VERSION_MAJOR "2") SET(VERSION_MINOR "16") -SET(VERSION_PATCH "37") +SET(VERSION_PATCH "39") ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org