Author: kmachalkova
Date: Fri Mar 7 16:34:24 2008
New Revision: 45295
URL: http://svn.opensuse.org/viewcvs/yast?rev=45295&view=rev
Log:
Implemented switching between pkg filters
(rpmgroups, patterns and langs so far)
Modified:
branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc
branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h
branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc
branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.h
branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.cc
branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.h
branches/tmp/bubli/ncurses-pkg/src/NCPkgTable.cc
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc?rev=45295&r1=45294&r2=45295&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.cc Fri Mar 7 16:34:24 2008
@@ -122,7 +122,6 @@
, updatelistItem( 0 )
, actionMenu( 0 )
, infoMenu( 0 )
- , versionsItem( 0 )
, patchdescrItem( 0 )
, patchpkgsItem( 0 )
, pkgversionsItem( 0 )
@@ -219,13 +218,13 @@
if ( !youMode )
{
// create the selections popup
- selectionPopup = new NCPkgPopupSelection( wpos( 1, 1 ), this, NCPkgPopupSelection::S_Selection );
+ //selectionPopup = new NCPkgPopupSelection( wpos( 1, 1 ), this, NCPkgPopupSelection::S_Selection );
// create the patterns popup
- patternPopup = new NCPkgPopupSelection( wpos( 1, 1 ), this, NCPkgPopupSelection::S_Pattern );
+ //patternPopup = new NCPkgPopupSelection( , this, NCPkgPopupSelection::S_Pattern );
// create language popup
- languagePopup = new NCPkgPopupSelection( wpos( 1,1 ), this, NCPkgPopupSelection::S_Language );
+ //languagePopup = new NCPkgPopupSelection( wpos( 1,1 ), this, NCPkgPopupSelection::S_Language );
// create repository popup
repoPopup = new NCPkgPopupRepo( wpos( 1,1), this );
@@ -461,6 +460,10 @@
{
retVal = filterPopup->handleEvent();
}
+ else if ( event.widget == filterMain )
+ {
+ retVal = filterMain->handleEvent();
+ }
}
else if ( event == NCursesEvent::menu )
{
@@ -499,64 +502,6 @@
visibleInfo = info;
}
-///////////////////////////////////////////////////////////////////
-//
-// fillAvailableList
-//
-// Fills the package table (on bottom ) with the list of available packages
-//
-bool NCPackageSelector::fillAvailableList( NCPkgTable * pkgTable, ZyppSel selectable )
-{
- bool addInstalled = true;
-
- if ( !pkgTable )
- {
- NCERR << "No table widget for available packages existing" << endl;
- return false;
- }
-
- if ( !selectable )
- {
- NCERR << "Package pointer not valid" << endl;
- return false;
- }
-
- // clear the package table
- pkgTable->itemsCleared ();
-
- NCDBG << "Number of available packages: " << selectable->availableObjs() << endl;
-
- // show all availables
- zypp::ui::Selectable::available_iterator
- b = selectable->availableBegin (),
- e = selectable->availableEnd (),
- it;
- for (it = b; it != e; ++it)
- {
- if ( selectable->installedObj() &&
- selectable->installedObj()->edition() == (*it)->edition() &&
- selectable->installedObj()->arch() == (*it)->arch() )
- // FIXME: In future releases, also the vendor will make a difference
- {
- addInstalled = false;
- }
- pkgTable->createListEntry( tryCastToZyppPkg (*it), selectable );
- }
- if ( selectable->hasInstalledObj() && addInstalled )
- {
- pkgTable->createListEntry( tryCastToZyppPkg (selectable->installedObj()), selectable );
- }
-
- // show the package list
- pkgTable->drawList();
-
- if ( pkgTable->getNumLines() > 0 )
- {
- pkgTable->setCurrentItem( 0 );
- }
-
- return true;
-}
///////////////////////////////////////////////////////////////////
//
@@ -1359,7 +1304,6 @@
if ( replaceChild )
{
oldSize = dynamic_cast(replaceChild)->wGetSize();
- NCINT << "Je to uplne na picu" << endl;
delete replaceChild;
// reset all info widgets
@@ -1390,7 +1334,6 @@
versionsList->fillAvailableList( packageList->getSelPointer( packageList->getCurrentItem() ) );
versionsList->Redraw();
- NCINT << "fakt" << endl;
}
}
// patches
@@ -1458,6 +1401,76 @@
//return true;
}
+void NCPackageSelector::replaceFilter( FilterMode mode)
+{
+ YWidget * replaceChild = replPoint->firstChild();
+ wrect oldSize;
+
+ if ( replaceChild )
+ {
+ oldSize = dynamic_cast(replaceChild)->wGetSize();
+
+ delete replaceChild;
+
+ filterPopup = 0;
+ patternPopup = 0;
+ languagePopup = 0;
+ }
+
+ switch (mode)
+ {
+ case Patterns:
+ {
+ YTableHeader *hhh = new YTableHeader ();
+ patternPopup = new NCPkgPopupSelection( replPoint, hhh, this, NCPkgPopupSelection::S_Pattern );
+ patternPopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
+ patternPopup->Redraw();
+ patternPopup->showSelectionPopup();
+ //setVisibleInfo ( pkginfoItem );
+ //show the package description of the current item
+ pkgList->showInformation ();
+ break;
+ }
+ case Languages:
+ {
+ YTableHeader *hhh = new YTableHeader ();
+ languagePopup = new NCPkgPopupSelection( replPoint, hhh, this, NCPkgPopupSelection::S_Language );
+ languagePopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
+ languagePopup->Redraw();
+ languagePopup->showSelectionPopup();
+ //setVisibleInfo ( pkginfoItem );
+ //show the package description of the current item
+ pkgList->showInformation ();
+ break;
+ }
+
+ case RPMGroups:
+ {
+ filterPopup = new NCPkgPopupTree ( replPoint, " ", this);
+ filterPopup->setSize( oldSize.Sze.W, oldSize.Sze.H );
+ filterPopup->Redraw();
+
+ YStringTreeItem * defaultGroup = filterPopup->getDefaultRpmGroup();
+
+ if ( defaultGroup )
+ {
+ NCMIL << "default RPM group: " << defaultGroup->value().translation() << endl;
+ filterPopup->fillPackageList ( defaultGroup->value().translation(), defaultGroup );
+ // show the package description of the current item
+ pkgList->showInformation ();
+ ///infoText->update( pkgList->getDataPointer(0), pkgList->getSelPointer(0), NCPkgTable::I_Descr );
+ }
+ else
+ {
+ NCERR << "No default RPM group available" << endl;
+ }
+ break;
+ }
+ default:
+ NCINT << "zatim nic" << endl;
+ }
+
+}
///////////////////////////////////////////////////////////////////
//
// FilterHandler
@@ -1494,7 +1507,7 @@
if ( patternPopup )
{
// show the selection popup
- retEvent = patternPopup->showSelectionPopup( );
+ //retEvent = patternPopup->showSelectionPopup( );
}
}
else if ( event.selection == languagesItem )
@@ -1502,7 +1515,7 @@
if ( languagePopup )
{
// show the selection popup
- retEvent = languagePopup->showSelectionPopup( );
+ //retEvent = languagePopup->showSelectionPopup( );
}
}
else if ( event.selection == reposItem )
@@ -1510,7 +1523,7 @@
if ( repoPopup )
{
// show the selection popup
- retEvent = repoPopup->showRepoPopup( );
+ // retEvent = repoPopup->showRepoPopup( );
}
}
else if ( event.selection == searchItem )
@@ -2059,38 +2072,6 @@
///////////////////////////////////////////////////////////////////
//
-// showPackageInformation
-//
-// Shows the package information
-//
-bool NCPackageSelector::showPackageInformation ( ZyppObj pkgPtr, ZyppSel slbPtr )
-{
- if ( !pkgPtr )
- {
- NCERR << "Package not valid" << endl;
- return false;
- }
- if ( !slbPtr )
- {
- NCERR << "Selectable not valid" << endl;
- return false;
- }
-
- if ( visibleInfo == versionsItem )
- {
- if ( versionsList )
- {
- fillAvailableList( versionsList, slbPtr );
- }
- }
-
- NCDBG << "Showing package information: " << visibleInfo << endl;
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////////
-//
// createDescrText
//
#define DOCTYPETAG "<!-- DT:Rich -->"
@@ -2349,8 +2330,12 @@
YFrame * fr = YUI::widgetFactory()->createFrame (vbox_left, "");
YLayoutBox * vv = YUI::widgetFactory()->createVBox( fr );
YAlignment *l = YUI::widgetFactory()->createLeft( vv );
- filterMain = new NCPkgFilterMain (l, _("&Filter") );
- filterPopup = new NCPkgPopupTree ( vv, " ", this);
+ filterMain = new NCPkgFilterMain (l, _("&Filter"), this );
+ //filterPopup = new NCPkgPopupTree ( vv, " ", this);
+
+ replPoint = YUI::widgetFactory()->createReplacePoint( vv );
+ YTableHeader *hhh = new YTableHeader();
+ patternPopup = new NCPkgPopupSelection( replPoint, hhh, this, NCPkgPopupSelection::S_Pattern );
NCLabel *dummy = new NCLabel( vbox_left, " " );
@@ -2451,24 +2436,24 @@
}
}
case NCPkgTable::T_Packages: {
- YStringTreeItem * defaultGroup = filterPopup->getDefaultRpmGroup();
-
- if ( defaultGroup )
- {
- NCMIL << "default RPM group: " << defaultGroup->value().translation() << endl;
- filterPopup->fillPackageList ( defaultGroup->value().translation(), defaultGroup );
+ //YStringTreeItem * defaultGroup = filterPopup->getDefaultRpmGroup();
+ //if ( defaultGroup )
+ //{
+ // NCMIL << "default RPM group: " << defaultGroup->value().translation() << endl;
+ // filterPopup->fillPackageList ( defaultGroup->value().translation(), defaultGroup );
+ patternPopup->showSelectionPopup();
// set the visible info to package description
//setVisibleInfo ( pkginfoItem );
pkgList->setVisibleInfo(NCPkgTable::I_Descr);
// show the package description of the current item
pkgList->showInformation ();
//infoText->update( pkgList->getDataPointer(0), pkgList->getSelPointer(0), NCPkgTable::I_Descr );
- }
- else
- {
+ //}
+ //else
+ //{
NCERR << "No default RPM group available" << endl;
- }
+ //}
break;
}
default:
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h?rev=45295&r1=45294&r2=45295&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPackageSelector.h Fri Mar 7 16:34:24 2008
@@ -62,6 +62,7 @@
class NCPkgMenuAction;
class NCPkgMenuView;
class NCPkgPackageDetails;
+class NCPkgFilterMain;
class NCPushButton;
class YNCursesUI;
class NCMenuButton;
@@ -138,7 +139,6 @@
// information menu and items
NCMenuButton * infoMenu;
- YMenuItem * versionsItem;
// information menu and items YOU
YMenuItem * patchdescrItem;
@@ -163,6 +163,7 @@
// information about packages
NCPkgPackageDetails * infoText; // short/longdecsription, filelist
YReplacePoint * replacePoint; // replace point for info text
+ YReplacePoint * replPoint;
NCPkgTable * versionsList; // list of available package versions
// information about patches
@@ -189,6 +190,15 @@
string getMenuId( YMenuItem *menu );
public:
+ enum FilterMode
+ {
+ Patterns,
+ Languages,
+ Repositories,
+ RPMGroups,
+ Search,
+ Summary
+ };
/**
* The package selector class handles the events and holds the
@@ -262,14 +272,6 @@
bool fillSummaryList( NCPkgTable::NCPkgTableListType type );
/**
- * Fills the list of available packages
- * @param table The table widget
- * @param selectable Show all available versions of this package
- * @return bool
- */
- bool fillAvailableList( NCPkgTable *table, ZyppSel selectable );
-
- /**
* Fills the list of packages belonging to the youPatch
* @param pkgTable The table widget
* @param youPatch Show all packages belonging to the patch
@@ -334,6 +336,7 @@
*/
void replaceInfoText ( bool b );
+ void replaceFilter ( FilterMode mode);
/**
* Handler function for "OK button pressed"
* @param event The Ncurses event
@@ -376,14 +379,6 @@
*/
bool LinkHandler ( string link );
- /**
- * Gets the required package info from package manager and shows it
- * ( called from NCPkgTable )
- * @param pkgPtr the data pointer
- * @return bool
- */
- bool showPackageInformation ( ZyppObj pkgPtr, ZyppSel slbPtr );
-
/**
* Checks and shows the dependencies
* @param doit true: do the check, false: only check if auto check is on
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc?rev=45295&r1=45294&r2=45295&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.cc Fri Mar 7 16:34:24 2008
@@ -18,10 +18,12 @@
#include "Y2Log.h"
#include "NCPkgFilterMain.h"
-NCPkgFilterMain::NCPkgFilterMain (YWidget *parent, string label)
+NCPkgFilterMain::NCPkgFilterMain (YWidget *parent, string label, NCPackageSelector *pkger )
:NCComboBox(parent, label, false)
+ ,pkg (pkger)
{
createLayout();
+ setNotify( true );
}
NCPkgFilterMain::~NCPkgFilterMain()
@@ -31,30 +33,40 @@
void NCPkgFilterMain::createLayout()
{
- patterns = new YMenuItem( _("Patterns") );
+ patterns = new YItem( _("Patterns") );
items.push_back( patterns );
- languages = new YMenuItem( _("Languages") );
+ languages = new YItem( _("Languages") );
items.push_back( languages );
- repositories = new YMenuItem( _("Repositories") );
+ repositories = new YItem( _("Repositories") );
items.push_back( repositories );
- rpmgroups = new YMenuItem( _("RPM Groups") );
+ rpmgroups = new YItem( _("RPM Groups") );
items.push_back( rpmgroups );
- search = new YMenuItem( _("Search") );
+ search = new YItem( _("Search") );
items.push_back( search );
- inst_summary = new YMenuItem( _("Installation Summary") );
+ inst_summary = new YItem( _("Installation Summary") );
items.push_back( inst_summary );
addItems( items );
}
-bool NCPkgFilterMain::handleEvent ( NCursesEvent & event)
+bool NCPkgFilterMain::handleEvent ( )
{
- NCINT << "zatim nic" << endl;
+
+ YItem *currentItem = selectedItem();
+
+ if ( currentItem == rpmgroups )
+ pkg->replaceFilter ( NCPackageSelector::RPMGroups );
+ else if ( currentItem == patterns )
+ pkg->replaceFilter ( NCPackageSelector::Patterns );
+ else if ( currentItem == languages )
+ pkg->replaceFilter ( NCPackageSelector::Languages );
+ else
+ NCINT << "zatim nic" << endl;
return true;
}
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.h?rev=45295&r1=45294&r2=45295&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.h (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPkgFilterMain.h Fri Mar 7 16:34:24 2008
@@ -24,6 +24,7 @@
#include "NCurses.h"
#include "NCi18n.h"
#include "NCComboBox.h"
+#include "NCPackageSelector.h"
#include "NCZypp.h"
class NCPkgFilterMain : public NCComboBox {
@@ -34,20 +35,21 @@
public:
YItemCollection items;
+ NCPackageSelector *pkg;
- YMenuItem *patterns;
- YMenuItem *languages;
- YMenuItem *repositories;
- YMenuItem *rpmgroups;
- YMenuItem *search;
- YMenuItem *inst_summary;
+ YItem *patterns;
+ YItem *languages;
+ YItem *repositories;
+ YItem *rpmgroups;
+ YItem *search;
+ YItem *inst_summary;
- NCPkgFilterMain (YWidget *parent, string label);
+ NCPkgFilterMain (YWidget *parent, string label, NCPackageSelector *pkger );
virtual ~NCPkgFilterMain();
void createLayout();
- bool handleEvent( NCursesEvent & event);
+ bool handleEvent( );
};
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.cc?rev=45295&r1=45294&r2=45295&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.cc (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.cc Fri Mar 7 16:34:24 2008
@@ -48,10 +48,12 @@
//
// DESCRIPTION :
//
-NCPkgPopupSelection::NCPkgPopupSelection( const wpos at, NCPackageSelector * pkg, SelType type )
- : NCPopup( at, false )
- , sel( 0 )
- , okButton( 0 )
+//NCPkgPopupSelection::NCPkgPopupSelection( const wpos at, NCPackageSelector * pkg, SelType type )
+// : NCPopup( at, false )
+NCPkgPopupSelection::NCPkgPopupSelection( YWidget *parent, YTableHeader *header, NCPackageSelector * pkg, SelType type )
+ : NCPkgTable( parent, header )
+ //, sel( 0 )
+ //, okButton( 0 )
, packager( pkg )
, type( type )
{
@@ -59,19 +61,20 @@
{
case S_Pattern:
case S_Selection: {
- createLayout( NCPkgNames::SelectionLabel() );
+ createLayout( parent, NCPkgNames::SelectionLabel() );
break;
}
case S_Language: {
- createLayout( NCPkgNames::LanguageLabel() );
+ createLayout( parent, NCPkgNames::LanguageLabel() );
break;
}
default:
break;
}
-
- fillSelectionList( sel, type );
+ setNotify(true);
+ //fillSelectionList( sel, type );
+ fillSelectionList( type );
}
///////////////////////////////////////////////////////////////////
@@ -95,17 +98,17 @@
//
// DESCRIPTION :
//
-void NCPkgPopupSelection::createLayout( const string & label )
+void NCPkgPopupSelection::createLayout( YWidget *parent, const string & label )
{
// the vertical split is the (only) child of the dialog
- NCLayoutBox * split = new NCLayoutBox( this, YD_VERT );
+ //NCLayoutBox * split = new NCLayoutBox( this, YD_VERT );
- new NCLabel( split, label, true, false ); // isHeading = true
+ //new NCLabel( split, label, true, false ); // isHeading = true
YTableHeader * tableHeader = new YTableHeader();
// add the selection list
- sel = new NCPkgTable( split, tableHeader );
- sel->setPackager( packager );
+ //sel = new NCPkgTable( parent, tableHeader );
+ setPackager( packager );
// set status strategy
NCPkgStatusStrategy * strat = new SelectionStatStrategy();
@@ -113,11 +116,11 @@
switch (type) {
case S_Pattern:
case S_Selection: {
- sel->setTableType( NCPkgTable::T_Selections, strat );
+ setTableType( NCPkgTable::T_Selections, strat );
break;
}
case S_Language: {
- sel->setTableType( NCPkgTable::T_Languages, strat );
+ setTableType( NCPkgTable::T_Languages, strat );
break;
}
default: {
@@ -126,50 +129,119 @@
}
}
- sel->fillHeader();
+ fillHeader();
// a help line for the selction/pattern/language popup
- new NCLabel( split, _( " [+] Select [-] Delete [>] Update " ), false, false );
+ //new NCLabel( split, _( " [+] Select [-] Delete [>] Update " ), false, false );
- new NCSpacing( split, YD_VERT, false, 0.4 );
+ //new NCSpacing( split, YD_VERT, false, 0.4 );
// add an OK button
- okButton = new NCPushButton( split, NCPkgNames::OKLabel() );
- okButton->setFunctionKey(10);
+ //okButton = new NCPushButton( split, NCPkgNames::OKLabel() );
+ //okButton->setFunctionKey(10);
- new NCSpacing( split, YD_VERT, false, 0.4 );
+ //new NCSpacing( split, YD_VERT, false, 0.4 );
}
-///////////////////////////////////////////////////////////////////
-//
-// NCursesEvent & showSelectionPopup ()
-//
-//
-NCursesEvent & NCPkgPopupSelection::showSelectionPopup( )
+bool NCPkgPopupSelection::showMetapackageContent( const set<string> & wanted )
{
- postevent = NCursesEvent();
+ NCPkgTable * packageList = packager->PackageList();
+
+ if ( !packageList )
+ {
+ UIERR << "Widget is not a valid NCPkgTable widget" << endl;
+ return false;
+ }
- if ( !sel )
- return postevent;
+ // clear the package table
+ packageList->itemsCleared ();
- sel->updateTable();
- sel->setKeyboardFocus();
+ set<string>::iterator not_found = wanted.end ();
- // event loop
- do {
- popupDialog();
- } while ( postAgain() );
+ std::vector<ZyppSel> sorted;
+ sorted.reserve (wanted.size ());
- popdownDialog();
+ // find the objects for the names
+ ZyppPoolIterator
+ b = zyppPkgBegin(),
+ e = zyppPkgEnd(),
+ it;
+ for ( it = b; it != e; ++it )
+ {
+ string name = (*it)->name(); // omitted theObj
- if ( !packager )
- return postevent;
+ if ( wanted.find (name) != not_found )
+ {
+ ZyppPkg zyppPkg = tryCastToZyppPkg( (*it)->theObj() );
+ if ( zyppPkg )
+ {
+ sorted.push_back (*it);
+ }
+ }
+ }
- // if OK is clicked get the current item and show the package list
- if ( postevent.detail == NCursesEvent::USERDEF )
+ // sort it and insert it to the list
+ sort (sorted.begin (), sorted.end (), sortByName);
{
- int index = sel->getCurrentItem();
- ZyppObj objPtr = sel->getDataPointer( index );
+ std::vector<ZyppSel>::iterator
+ b = sorted.begin (),
+ e = sorted.end (),
+ it;
+ for ( it = b; it != e; ++it )
+ {
+ ZyppPkg zyppPkg = tryCastToZyppPkg( (*it)->theObj() );
+ // already know that it is valid
+ packageList->createListEntry( zyppPkg, *it );
+ }
+ }
+
+ // show the package table
+ packageList->drawList();
+
+ //if ( ! label.empty() )
+ //{
+ // NCDBG << "Filter: " << label << endl;
+
+ // // show the selected filter label
+ // if ( packageLabel )
+ // {
+ // packageLabel->setLabel( label );
+ // }
+ //}
+
+ return true;
+
+}
+///////////////////////////////////////////////////////////////////
+//
+// NCursesEvent & showSelectionPopup ()
+//
+//
+void NCPkgPopupSelection::showSelectionPopup( )
+{
+// postevent = NCursesEvent();
+//
+// if ( !sel )
+// return postevent;
+//
+// sel->updateTable();
+// sel->setKeyboardFocus();
+//
+// // event loop
+// do {
+// popupDialog();
+// } while ( postAgain() );
+//
+// popdownDialog();
+//
+// if ( !packager )
+// return postevent;
+//
+// // if OK is clicked get the current item and show the package list
+// if ( postevent.detail == NCursesEvent::USERDEF )
+// {
+ int index = getCurrentItem();
+ ZyppObj objPtr = getDataPointer( index );
if ( objPtr )
{
NCMIL << "Current selection: " << getCurrentLine() << endl;
@@ -221,14 +293,15 @@
}
- packager->showSelPackages( getCurrentLine(), packages );
+ //packager->showSelPackages( getCurrentLine(), packages );
+ showMetapackageContent( packages );
// showDiskSpace() moved to NCPkgTable.cc (show/check diskspace
- // on every status change)
- // packager->showDiskSpace();
+// // on every status change)
+// // packager->showDiskSpace();
}
- }
-
- return postevent;
+// }
+//
+// return postevent;
}
@@ -241,11 +314,11 @@
//
string NCPkgPopupSelection::getCurrentLine( )
{
- if ( !sel )
- return "";
+ //if ( !sel )
+// return "";
- int index = sel->getCurrentItem();
- ZyppObj selPtr = sel->getDataPointer(index);
+ int index = getCurrentItem();
+ ZyppObj selPtr = getDataPointer(index);
return ( selPtr?selPtr->summary(LOCALE):"" );
}
@@ -256,24 +329,24 @@
// METHOD NAME : NCPkgPopupSelection::preferredWidth
// METHOD TYPE : int
//
-int NCPkgPopupSelection::preferredWidth()
-{
- return NCurses::cols()*2/3;
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : NCPkgPopupSelection::preferredHeight
-// METHOD TYPE : int
-//
-int NCPkgPopupSelection::preferredHeight()
-{
- if ( NCurses::lines() > 20 )
- return 20;
- else
- return NCurses::lines()-4;
-}
+//int NCPkgPopupSelection::preferredWidth()
+//{
+// return NCurses::cols()*2/3;
+//}
+//
+/////////////////////////////////////////////////////////////////////
+////
+////
+//// METHOD NAME : NCPkgPopupSelection::preferredHeight
+//// METHOD TYPE : int
+////
+//int NCPkgPopupSelection::preferredHeight()
+//{
+// if ( NCurses::lines() > 20 )
+// return 20;
+// else
+// return NCurses::lines()-4;
+//}
///////////////////////////////////////////////////////////////////
@@ -286,10 +359,32 @@
//
NCursesEvent NCPkgPopupSelection::wHandleInput( wint_t ch )
{
- if ( ch == 27 ) // ESC
- return NCursesEvent::cancel;
+// if ( ch == 27 ) // ESC
+// return NCursesEvent::cancel;
+ NCursesEvent ret = NCursesEvent::none;
+
+ // call handleInput of NCPad
+ handleInput( ch );
+
+ switch ( ch )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_NPAGE:
+ case KEY_PPAGE:
+ case KEY_END:
+ case KEY_HOME: {
+ // show the corresponding information
+ ret = NCursesEvent::handled;
+ break;
+ }
- return NCDialog::wHandleInput( ch );
+ default:
+ ret = NCPkgTable::wHandleInput( ch ) ;
+ }
+
+ showSelectionPopup( );
+ return ret;
}
///////////////////////////////////////////////////////////////////
@@ -300,25 +395,25 @@
//
// DESCRIPTION :
//
-bool NCPkgPopupSelection::postAgain( )
-{
- if( !postevent.widget )
- return false;
-
- postevent.detail = NCursesEvent::NODETAIL;
-
- if ( postevent.widget == okButton )
- {
- postevent.detail = NCursesEvent::USERDEF ;
- // return false means: close the popup
- return false;
- }
-
- if (postevent == NCursesEvent::cancel)
- return false;
-
- return true;
-}
+//bool NCPkgPopupSelection::postAgain( )
+//{
+// if( !postevent.widget )
+// return false;
+//
+// postevent.detail = NCursesEvent::NODETAIL;
+//
+// if ( postevent.widget == okButton )
+// {
+// postevent.detail = NCursesEvent::USERDEF ;
+// // return false means: close the popup
+// return false;
+// }
+//
+// if (postevent == NCursesEvent::cancel)
+// return false;
+//
+// return true;
+//}
///////////////////////////////////////////////////////////////////
//
@@ -370,10 +465,10 @@
//
// DESCRIPTION :
//
-bool NCPkgPopupSelection::fillSelectionList( NCPkgTable * sel, SelType type )
+bool NCPkgPopupSelection::fillSelectionList( /*NCPkgTable * sel,*/ SelType type )
{
- if ( !sel )
- return false;
+// if ( !sel )
+// return false;
ZyppPoolIterator i, b, e;
list<ZyppSel> slbList;
@@ -465,7 +560,7 @@
break;
}
- sel->addLine( (*listIt)->status(), // the status
+ addLine( (*listIt)->status(), // the status
pkgLine,
resPtr, // ZyppSelection or ZyppPattern
(*listIt) ); // ZyppSel
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.h?rev=45295&r1=45294&r2=45295&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.h (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPkgPopupSelection.h Fri Mar 7 16:34:24 2008
@@ -22,6 +22,7 @@
#include <iosfwd>
#include <string>
+#include <set>
#include "NCPopup.h"
#include "NCPushButton.h"
@@ -34,7 +35,7 @@
//
// DESCRIPTION :
//
-class NCPkgPopupSelection : public NCPopup {
+class NCPkgPopupSelection : public NCPkgTable {
NCPkgPopupSelection & operator=( const NCPkgPopupSelection & );
NCPkgPopupSelection ( const NCPkgPopupSelection & );
@@ -42,7 +43,7 @@
private:
NCPkgTable *sel; // selection list
- NCPushButton * okButton;
+// NCPushButton * okButton;
NCPackageSelector * packager; // connection to the PackageSelector,
@@ -50,7 +51,7 @@
std::string getCurrentLine();
- virtual bool postAgain();
+ // virtual bool postAgain();
virtual NCursesEvent wHandleInput( wint_t ch );
@@ -63,25 +64,28 @@
S_Unknown
};
- NCPkgPopupSelection( const wpos at, NCPackageSelector * pkg, SelType type );
+ //NCPkgPopupSelection( const wpos at, NCPackageSelector * pkg, SelType type );
+ NCPkgPopupSelection( YWidget *parent, YTableHeader *header, NCPackageSelector * pkg, SelType type );
virtual ~NCPkgPopupSelection();
- virtual int preferredWidth();
- virtual int preferredHeight();
+ //virtual int preferredWidth();
+ //virtual int preferredHeight();
- void createLayout( const string & label );
+ void createLayout( YWidget *parent, const string & label );
/**
* Fills the list with the available selections (and the status info)
* @return bool
*/
- bool fillSelectionList ( NCPkgTable * table, SelType type );
-
+ bool fillSelectionList ( /*NCPkgTable * table,*/ SelType type );
+
+ bool showMetapackageContent( const set<string> & wanted );
+
/**
* Shows the popup with the add ons (package categories).
* @return NCursesEvent
*/
- NCursesEvent & showSelectionPopup( );
+ void showSelectionPopup( );
private:
Modified: branches/tmp/bubli/ncurses-pkg/src/NCPkgTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses-pkg/src/NCPkgTable.cc?rev=45295&r1=45294&r2=45295&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses-pkg/src/NCPkgTable.cc (original)
+++ branches/tmp/bubli/ncurses-pkg/src/NCPkgTable.cc Fri Mar 7 16:34:24 2008
@@ -748,9 +748,8 @@
case T_Packages:
case T_Update:
// show the required package info
- //packager->showPackageInformation( objPtr, slbPtr );
updateInfo( objPtr, slbPtr, VisibleInfo() );
- //packager->PackageLabel()->setLabel( slbPtr->name() );
+ packager->PackageLabel()->setLabel( slbPtr->name() );
break;
case T_Patches:
// show the patch info
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org