Mailinglist Archive: yast-commit (953 mails)

< Previous Next >
[yast-commit] r49747 - in /trunk/ncurses-pkg/src: Makefile.am NCPackageSelector.cc NCPackageSelector.h NCPkgFilterInstSummary.cc NCPkgFilterInstSummary.h
  • From: kmachalkova@xxxxxxxxxxxxxxxx
  • Date: Wed, 06 Aug 2008 08:28:48 -0000
  • Message-id: <20080806082848.A8CDD24BB0@xxxxxxxxxxxxxxxx>
Author: kmachalkova
Date: Wed Aug 6 10:28:48 2008
New Revision: 49747

URL: http://svn.opensuse.org/viewcvs/yast?rev=49747&view=rev
Log:
Filtering packages by status (#384085)

Added:
trunk/ncurses-pkg/src/NCPkgFilterInstSummary.cc
trunk/ncurses-pkg/src/NCPkgFilterInstSummary.h
Modified:
trunk/ncurses-pkg/src/Makefile.am
trunk/ncurses-pkg/src/NCPackageSelector.cc
trunk/ncurses-pkg/src/NCPackageSelector.h

Modified: trunk/ncurses-pkg/src/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/Makefile.am?rev=49747&r1=49746&r2=49747&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/Makefile.am (original)
+++ trunk/ncurses-pkg/src/Makefile.am Wed Aug 6 10:28:48 2008
@@ -39,6 +39,7 @@
NCPkgFilterPattern.h \
NCPkgFilterLocale.h \
NCPkgFilterRPMGroups.h \
+ NCPkgFilterInstSummary.h \
NCPkgStrings.h \
NCZypp.h

@@ -68,6 +69,7 @@
NCPkgFilterPattern.cc \
NCPkgFilterLocale.cc \
NCPkgFilterRPMGroups.cc \
+ NCPkgFilterInstSummary.cc \
NCPkgStrings.cc



Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.cc?rev=49747&r1=49746&r2=49747&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPackageSelector.cc (original)
+++ trunk/ncurses-pkg/src/NCPackageSelector.cc Wed Aug 6 10:28:48 2008
@@ -878,10 +878,11 @@
}
case Summary:
{
- placeholder = new NCEmpty( replPoint );
- placeholder->setSize( oldSize.Sze.W, oldSize.Sze.H );
- placeholder->Redraw();
+ inst_summary = new NCPkgFilterInstSummary( replPoint, _("&Packages
with Status"), this );
+ inst_summary->setSize( oldSize.Sze.W, oldSize.Sze.H );
+ inst_summary->Redraw();
pkgList->fillSummaryList(NCPkgTable::L_Changes);
+ break;
}
default:
yuiError() << "zatim nic" << endl;

Modified: trunk/ncurses-pkg/src/NCPackageSelector.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.h?rev=49747&r1=49746&r2=49747&view=diff
==============================================================================
--- trunk/ncurses-pkg/src/NCPackageSelector.h (original)
+++ trunk/ncurses-pkg/src/NCPackageSelector.h Wed Aug 6 10:28:48 2008
@@ -39,6 +39,7 @@

#include "NCPkgFilterRPMGroups.h"
#include "NCPkgFilterSearch.h"
+#include "NCPkgFilterInstSummary.h"
#include "NCPkgTable.h"
#include "NCEmpty.h"
#include "NCPkgMenuFilter.h"
@@ -57,6 +58,7 @@
class NCPkgDiskspace;
class NCPkgFilterRPMGroups;
class NCPkgFilterSearch;
+class NCPkgFilterInstSummary;
class NCPkgPopupFile;
class NCPkgMenuExtras;
class NCPkgMenuDeps;
@@ -111,6 +113,7 @@
NCPkgDiskspace * diskspacePopup; // the popup showing the disk usage

NCPkgFilterSearch * searchPopup; // the package search popup
+ NCPkgFilterInstSummary *inst_summary;

bool youMode; // YOU
bool updateMode; // Update
@@ -146,7 +149,6 @@
YReplacePoint * replacePoint; // replace point for info text
YReplacePoint * replPoint;
YReplacePoint * replPoint2; //tohle pak urcite prejmenuj, Bublino
- NCEmpty *placeholder;

NCPkgTable * versionsList; // list of available package versions
// information about patches

Added: trunk/ncurses-pkg/src/NCPkgFilterInstSummary.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgFilterInstSummary.cc?rev=49747&view=auto
==============================================================================
--- trunk/ncurses-pkg/src/NCPkgFilterInstSummary.cc (added)
+++ trunk/ncurses-pkg/src/NCPkgFilterInstSummary.cc Wed Aug 6 10:28:48 2008
@@ -0,0 +1,158 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCPkgFilterInstSummary.cc
+
+ Author: Hedgehog Painter <kmachalkova@xxxxxxx>
+
+/-*/
+
+#include "NCPkgFilterInstSummary.h"
+
+/*
+ Textdomain "ncurses-pkg"
+*/
+
+NCPkgFilterInstSummary::NCPkgFilterInstSummary ( YWidget *parent, string
label, NCPackageSelector *pkger)
+ : NCMultiSelectionBox ( parent, label)
+ , pkg( pkger )
+{
+ //setNotify(true);
+ createLayout();
+}
+
+NCPkgFilterInstSummary::~NCPkgFilterInstSummary()
+{
+
+}
+
+void NCPkgFilterInstSummary::createLayout()
+{
+ del = new YItem ( _( "Delete" ), true);
+ items.push_back (del);
+ inst = new YItem ( _( "Install" ), true);
+ items.push_back (inst);
+ update = new YItem ( _( "Update" ), true);
+ items.push_back (update);
+ taboo = new YItem ( _( "Taboo" ), true);
+ items.push_back (taboo);
+ protect = new YItem ( _( "Protected" ), true);
+ items.push_back (protect);
+ keep = new YItem ( _( "Keep" ));
+ items.push_back (keep);
+ dontinstall = new YItem ( _( "Do not install" ));
+ items.push_back (dontinstall);
+
+ addItems( items );
+}
+
+bool NCPkgFilterInstSummary::check( ZyppObj opkg, ZyppSel slb )
+{
+ if (!slb)
+ return false;
+
+ bool show = false;
+
+ switch ( slb->status() )
+ {
+ //group these two together, due to lack of space
+ case S_Del:
+ case S_AutoDel: show = del->selected(); break;
+ case S_Install:
+ case S_AutoInstall: show = inst->selected(); break;
+ case S_KeepInstalled: show = keep->selected(); break;
+ case S_NoInst: show = dontinstall->selected(); break;
+ case S_Protected: show = protect->selected(); break;
+ case S_Taboo: show = taboo->selected(); break;
+ case S_Update:
+ case S_AutoUpdate: show = update->selected(); break;
+ }
+
+ if ( show )
+ {
+ ZyppPkg pkg = tryCastToZyppPkg (opkg);
+
+ if ( !pkg )
+ return false;
+ }
+
+ return show;
+}
+
+bool NCPkgFilterInstSummary::showInstSummaryPackages()
+{
+
+ NCPkgTable * packageList = pkg->PackageList();
+
+ if ( !packageList )
+ {
+ yuiError() << "No valid NCPkgTable widget" << endl;
+ return false;
+ }
+
+ // clear the package table
+ packageList->itemsCleared ();
+
+
+ for_( listIt, zyppPkgBegin(), zyppPkgEnd() )
+ {
+ ZyppSel selectable = *listIt;
+ ZyppObj obj = selectable->candidateObj();
+
+ if (!obj)
+ {
+ // If there is neither an installed nor a candidate package, check
+ // any other instance.
+ ( selectable->installedObj() ) ? (obj = selectable->installedObj())
+ : ( obj = selectable->theObj() );
+ }
+
+ if( check( obj, selectable ) )
+ {
+ ZyppPkg pkg = tryCastToZyppPkg (obj);
+ packageList->createListEntry( pkg, selectable);
+ }
+
+ }
+
+ // show the package list
+ packageList->setCurrentItem( 0 );
+ packageList->drawList();
+ packageList->showInformation();
+
+ yuiMilestone() << "Fill package list" << endl;
+
+ return true;
+
+}
+
+NCursesEvent NCPkgFilterInstSummary::wHandleInput( wint_t ch )
+{
+ NCursesEvent ret = NCursesEvent::none;
+
+ //treat this like any other MultiSelBox input ...
+ NCMultiSelectionBox::wHandleInput( ch ) ;
+ switch ( ch )
+ {
+ //special case for toggling item status
+ case KEY_SPACE:
+ case KEY_RETURN: {
+ showInstSummaryPackages();
+ }
+ }
+
+ //... but do not return to the main loop
+ ret = NCursesEvent::handled;
+
+ return ret;
+}
+

Added: trunk/ncurses-pkg/src/NCPkgFilterInstSummary.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgFilterInstSummary.h?rev=49747&view=auto
==============================================================================
--- trunk/ncurses-pkg/src/NCPkgFilterInstSummary.h (added)
+++ trunk/ncurses-pkg/src/NCPkgFilterInstSummary.h Wed Aug 6 10:28:48 2008
@@ -0,0 +1,60 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: NCPkgFilterMain.h
+
+ Author: Hedgehog Painter <kmachalkova@xxxxxxx>
+
+/-*/
+
+#ifndef NCPkgFilterInstSummary_h
+#define NCPkgFilterInstSummary_h
+
+#include <string>
+
+#include "NCurses.h"
+#include "NCi18n.h"
+#include "NCPackageSelector.h"
+#include "NCPkgTable.h"
+#include "NCMultiSelectionBox.h"
+#include "NCZypp.h"
+
+class NCPkgFilterInstSummary : public NCMultiSelectionBox {
+
+ NCPkgFilterInstSummary & operator=( const NCPkgFilterInstSummary & );
+ NCPkgFilterInstSummary ( const NCPkgFilterInstSummary & );
+
+ bool check (ZyppObj opkg, ZyppSel slb);
+ NCPackageSelector *pkg;
+
+public:
+
+ YItemCollection items;
+ YItem *del;
+ YItem *inst;
+ YItem *update;
+ YItem *taboo;
+ YItem *protect;
+ YItem *keep;
+ YItem *dontinstall;
+
+
+ NCPkgFilterInstSummary (YWidget *parent, string label, NCPackageSelector
*pkg);
+ virtual ~NCPkgFilterInstSummary();
+
+ void createLayout();
+ bool showInstSummaryPackages();
+ NCursesEvent wHandleInput( wint_t ch );
+
+};
+
+#endif

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages