Author: gs Date: Wed Apr 16 14:43:11 2008 New Revision: 46728 URL: http://svn.opensuse.org/viewcvs/yast?rev=46728&view=rev Log: YOU filter menu added, YOU actions mnd view menus changed Modified: trunk/ncurses-pkg/src/Makefile.am trunk/ncurses-pkg/src/NCPackageSelector.cc trunk/ncurses-pkg/src/NCPackageSelector.h trunk/ncurses-pkg/src/NCPkgMenuAction.cc trunk/ncurses-pkg/src/NCPkgMenuFilter.cc trunk/ncurses-pkg/src/NCPkgMenuFilter.h trunk/ncurses-pkg/src/NCPkgMenuView.cc trunk/ncurses-pkg/src/NCPkgStrings.cc trunk/ncurses-pkg/src/NCPkgTable.cc Modified: trunk/ncurses-pkg/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/Makefile.am?rev=4... ============================================================================== --- trunk/ncurses-pkg/src/Makefile.am (original) +++ trunk/ncurses-pkg/src/Makefile.am Wed Apr 16 14:43:11 2008 @@ -24,10 +24,12 @@ NCPkgMenuView.h \ NCPkgMenuExtras.h \ NCPkgMenuAction.h \ + NCPkgMenuFilter.h \ NCPkgMenuHelp.h \ NCPkgPackageDetails.h \ NCPkgFilterMain.h \ NCPkgPopupDeps.h \ + NCPkgPatchSearch.h \ NCPkgPopupDiskspace.h \ NCPkgPopupDescr.h \ NCPkgPopupTable.h \ @@ -50,10 +52,12 @@ NCPkgMenuView.cc \ NCPkgMenuExtras.cc \ NCPkgMenuAction.cc \ + NCPkgMenuFilter.cc \ NCPkgMenuHelp.cc \ NCPkgPackageDetails.cc \ NCPkgFilterMain.cc \ NCPkgPopupDeps.cc \ + NCPkgPatchSearch.cc \ NCPkgPopupDiskspace.cc \ NCPkgPopupDescr.cc \ NCPkgPopupTable.cc \ Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector... ============================================================================== --- trunk/ncurses-pkg/src/NCPackageSelector.cc (original) +++ trunk/ncurses-pkg/src/NCPackageSelector.cc Wed Apr 16 14:43:11 2008 @@ -114,22 +114,10 @@ // (the eventHandlerMap is obsolete) // Fill the handler map - #if 0 - eventHandlerMap[ NCPkgStrings::Search()->toString() ] = &NCPackageSelector::SearchHandler; - - // Filter - add selectionsItem, if really needed - // eventHandlerMap[ NCPkgStrings::Selections()->toString() ] = &NCPackageSelector::FilterHandler; - // YOU filter - eventHandlerMap[ NCPkgStrings::Recommended()->toString() ] = &NCPackageSelector::FilterHandler; - eventHandlerMap[ NCPkgStrings::Security()->toString() ] = &NCPackageSelector::FilterHandler; - eventHandlerMap[ NCPkgStrings::Optional()->toString() ] = &NCPackageSelector::FilterHandler; - eventHandlerMap[ NCPkgStrings::InstalledPatches()->toString() ] = &NCPackageSelector::FilterHandler; - eventHandlerMap[ NCPkgStrings::AllPatches()->toString() ] = &NCPackageSelector::FilterHandler; - eventHandlerMap[ NCPkgStrings::NewPatches()->toString() ] = &NCPackageSelector::FilterHandler; - eventHandlerMap[ NCPkgStrings::InstalledPatches()->toString() ] = &NCPackageSelector::FilterHandler; - eventHandlerMap[ NCPkgStrings::InstallablePatches()->toString() ] = &NCPackageSelector::FilterHandler; - eventHandlerMap[ NCPkgStrings::YaST2Patches()->toString() ] = &NCPackageSelector::FilterHandler; +#if 0 + eventHandlerMap[ NCPkgStrings::Search()->toString() ] = &NCPackageSelector::SearchHandler; +#endif // Information menu -> DONE @@ -138,9 +126,10 @@ // Etc. menu -> DONE // Help menu +#if 0 eventHandlerMap[ NCPkgStrings::PatchHelp()->toString() ] = &NCPackageSelector::YouHelpHandler; - #endif - +#endif + if ( modeFlags & YPkg_OnlineUpdateMode ) youMode = true; @@ -322,10 +311,7 @@ } else if ( event == NCursesEvent::menu ) { - if ( event.widget == filterMenu ) - // filter out packages/patches - retVal = FilterHandler( event ); - else if ( event.widget == actionMenu ) + if ( event.widget == actionMenu ) // change package/patch status //retVal = StatusHandler( event ); retVal = actionMenu->handleEvent( event ); @@ -338,6 +324,8 @@ retVal = extrasMenu->handleEvent( event ); else if ( event.widget == helpMenu ) retVal = helpMenu->handleEvent( event ); + else if ( event.widget == filterMenu ) + retVal = filterMenu->handleEvent( event ); else if ( event.selection->label().substr(0,4) == "pkg:" ) // handle hyper links retVal = LinkHandler( event.selection->label() ); @@ -1146,56 +1134,6 @@ /////////////////////////////////////////////////////////////////// // -// FilterHandler -// -// Opens the popup with rpm group tree, selections ... and display the -// corresponding package list -// -bool NCPackageSelector::FilterHandler( const NCursesEvent& event ) -{ - // patches -// FIXME - compare event.selection with YMenuItem (see above) - #if 0 - else if ( selId == NCPkgStrings::Recommended()->toString() ) - { - fillPatchList( "recommended" ); // patch kind - } - else if ( selId == NCPkgStrings::Security()->toString() ) - { - fillPatchList( "security" ); // patch kind - } - else if ( selId == NCPkgStrings::Optional()->toString() ) - { - fillPatchList( "optional" ); // patch kind - } - else if ( selId == NCPkgStrings::YaST2Patches()->toString() ) - { - fillPatchList( "YaST2" ); // patch kind - } - else if ( selId == NCPkgStrings::AllPatches()->toString() ) - { - fillPatchList( "all" ); // show all patches - } - else if ( selId == NCPkgStrings::InstalledPatches()->toString() ) - { - fillPatchList( "installed" ); // show installed patches - } - else if ( selId == NCPkgStrings::InstallablePatches()->toString() ) - { - fillPatchList( "installable" ); // show installed patches - } - else if ( selId == NCPkgStrings::NewPatches()->toString() ) - { - fillPatchList( "new" ); // show new patches - } - #endif - // patches end - // return true means: don't leave the event loop in runPkgSelection - return true; -} - -/////////////////////////////////////////////////////////////////// -// // LinkHandler // // Handles hyperlinks in package description. @@ -1774,13 +1712,16 @@ YLayoutBox * hSplit = YUI::widgetFactory()->createHBox( split ); YAlignment * left1 = YUI::widgetFactory()->createLeft( hSplit ); - actionMenu = new NCPkgMenuAction( left1, NCPkgStrings::Actions(), this ); - + filterMenu = new NCPkgMenuFilter( left1, NCPkgStrings::Filter(), this ); + YAlignment * left2 = YUI::widgetFactory()->createLeft( hSplit ); - viewMenu = new NCPkgMenuView( left2, NCPkgStrings::View(), this); + actionMenu = new NCPkgMenuAction( left2, NCPkgStrings::Actions(), this ); YAlignment * left3 = YUI::widgetFactory()->createLeft( hSplit ); - extrasMenu = new NCPkgMenuExtras( left3, NCPkgStrings::Extras(), this); + viewMenu = new NCPkgMenuView( left3, NCPkgStrings::View(), this); + + YAlignment * left4 = YUI::widgetFactory()->createLeft( hSplit ); + extrasMenu = new NCPkgMenuExtras( left4, NCPkgStrings::Extras(), this); // add the package table YTableHeader * tableHeader = new YTableHeader(); @@ -1878,12 +1819,12 @@ YUI_CHECK_NEW( pkgList ); NCPkgStatusStrategy * strategy; - // set the table type + // set table type and status strategy (either 'normal' package list or update list) switch ( type ) { - case NCPkgTable::T_Patches: - strategy = new PatchStatStrategy(); - pkgList->setTableType( NCPkgTable::T_Patches, strategy ); + case NCPkgTable::T_Packages: + strategy = new PackageStatStrategy(); + pkgList->setTableType( NCPkgTable::T_Packages, strategy ); case NCPkgTable::T_Update: strategy = new UpdateStatStrategy(); pkgList->setTableType( NCPkgTable::T_Update, strategy ); @@ -1950,8 +1891,8 @@ fillPatchList( "installable" ); // default: installable patches // set the visible info to long description - - // show the package description of the current item + pkgList->setVisibleInfo(NCPkgTable::I_PatchDescr); + // show the patch description of the current item pkgList->showInformation (); break; } @@ -1959,17 +1900,18 @@ if ( ! zypp::getZYpp()->resolver()->problematicUpdateItems().empty() ) { fillUpdateList(); - // set the visible info to package description - // show the package description of the current item + // set the visible info to technical information + pkgList->setVisibleInfo(NCPkgTable::I_Technical); + // show the package information of the current item pkgList->showInformation (); break; } } case NCPkgTable::T_Packages: { - pkgList->setVisibleInfo(NCPkgTable::I_Descr); + pkgList->setVisibleInfo(NCPkgTable::I_Technical); patternPopup->showContainerPackages(); - // show the package description of the current item + // show the package inforamtion of the current item pkgList->showInformation (); break; } Modified: trunk/ncurses-pkg/src/NCPackageSelector.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector... ============================================================================== --- trunk/ncurses-pkg/src/NCPackageSelector.h (original) +++ trunk/ncurses-pkg/src/NCPackageSelector.h Wed Apr 16 14:43:11 2008 @@ -46,8 +46,8 @@ #include "NCPkgMenuView.h" #include "NCPkgMenuExtras.h" #include "NCPkgMenuHelp.h" -#include "NCPkgMenuView.h" #include "NCPkgMenuAction.h" +#include "NCPkgMenuFilter.h" #include "NCPkgPackageDetails.h" #include "NCPkgPopupDeps.h" #include "NCPkgFilterMain.h" @@ -67,6 +67,7 @@ class NCPkgMenuDeps; class NCPkgMenuAction; class NCPkgMenuView; +class NCPkgMenuFilter; class NCPkgSearchSettings; class NCPkgPackageDetails; class NCPkgFilterMain; @@ -129,9 +130,8 @@ NCPkgMenuHelp *helpMenu; NCPkgFilterMain *filterMain; NCPkgMenuAction *actionMenu; - - // filter menu and items - NCMenuButton * filterMenu; + NCPkgMenuFilter *filterMenu; + // FIXME - add update list to NCPkgFilterMain YMenuItem * updatelistItem; // labels @@ -336,13 +336,6 @@ */ bool CancelHandler ( const NCursesEvent& event ); - /** - * Handler function for the "Filter" menu - * @param event The Ncurses event - * @return bool - */ - bool FilterHandler( const NCursesEvent& event ); - /** * Handler function for the "Help" button in YOU * @param event The Ncurses event Modified: trunk/ncurses-pkg/src/NCPkgMenuAction.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuAction.c... ============================================================================== --- trunk/ncurses-pkg/src/NCPkgMenuAction.cc (original) +++ trunk/ncurses-pkg/src/NCPkgMenuAction.cc Wed Apr 16 14:43:11 2008 @@ -38,34 +38,52 @@ void NCPkgMenuAction::createLayout() { - toggleItem = new YMenuItem( _( "&Toggle [SPACE]" ) ); - items.push_back( toggleItem ); - - installItem = new YMenuItem( _( "&Install [+]" ) ); - items.push_back( installItem ); - - deleteItem = new YMenuItem( _( "&Delete [-]" ) ); - items.push_back( deleteItem ); - - updateItem = new YMenuItem( _( "&Update [>]" ) ); - items.push_back( updateItem ); - - tabooItem = new YMenuItem( _( "T&aboo [!]" ) ); - items.push_back( tabooItem ); - - lockItem = new YMenuItem( _( "&Lock [*]" ) ); - items.push_back( lockItem ); - - allItem = new YMenuItem( _( "All Listed &Packages" ) ); - items.push_back( allItem ); - - installAllItem = new YMenuItem( allItem, _( "Install All" ) ); - deleteAllItem = new YMenuItem( allItem, _( "Delete All" ) ); - keepAllItem = new YMenuItem( allItem, _( "Keep All" ) ); - updateAllItem = new YMenuItem( allItem, _( "Update All Unconditionally") ); - updateNewerItem = new YMenuItem( allItem, _( "Update If Newer Version Available" ) ); + if ( !pkg->isYouMode() ) + { + // Please note: add an appropriate number of whitespaces to get a well + // formated menu (the [ ]s should be in one column) + // begin: Actions menu, toggle the status of a package, e.g. change from installed to delete + toggleItem = new YMenuItem( _( "Toggle [SPACE]" ) ); + installItem = new YMenuItem( _( "Install [+]" ) ); + deleteItem = new YMenuItem( _( "Delete [-]" ) ); + updateItem = new YMenuItem( _( "Update [>]" ) ); + tabooItem = new YMenuItem( _( "Taboo [!]" ) ); + lockItem = new YMenuItem( _( "Lock [*]" ) ); + // end: Actions menu, set status of all packages (title of a submenu) + allItem = new YMenuItem( _( "All Listed Packages" ) ); + + items.push_back( toggleItem ); + items.push_back( installItem ); + items.push_back( deleteItem ); + items.push_back( updateItem ); + items.push_back( tabooItem ); + items.push_back( lockItem ); + items.push_back( allItem ); + + // begin: submenu items actions concerning all packages + installAllItem = new YMenuItem( allItem, _( "Install All" ) ); + deleteAllItem = new YMenuItem( allItem, _( "Delete All" ) ); + keepAllItem = new YMenuItem( allItem, _( "Keep All" ) ); + updateAllItem = new YMenuItem( allItem, _( "Update All Unconditionally") ); + // end: submenu items: actions concerning all packages + updateNewerItem = new YMenuItem( allItem, _( "Update If Newer Version Available" ) ); + + addItems( items ); + } + else + { + toggleItem = new YMenuItem( _( "Toggle [SPACE]" ) ); + installItem = new YMenuItem( _( "Install [+]" ) ); + deleteItem = new YMenuItem( _( "Delete [-]" ) ); + updateItem = new YMenuItem( _( "Update [>]" ) ); + + items.push_back( toggleItem ); + items.push_back( installItem ); + items.push_back( deleteItem ); + items.push_back( updateItem ); - addItems( items ); + addItems( items ); + } } bool NCPkgMenuAction::handleEvent ( const NCursesEvent & event) Modified: trunk/ncurses-pkg/src/NCPkgMenuFilter.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuFilter.c... ============================================================================== --- trunk/ncurses-pkg/src/NCPkgMenuFilter.cc (original) +++ trunk/ncurses-pkg/src/NCPkgMenuFilter.cc Wed Apr 16 14:43:11 2008 @@ -38,16 +38,17 @@ void NCPkgMenuFilter::createLayout() { - // menu items of the filter menu for patches - keep them short + // menu items of the filter menu for patches - keep them short + // and use unique hotkeys from begin: to end: // begin: - installable = new YMenuItem( _( "Installable Patches" ) ); - installed = new YMenuItem( _( "Installed Patches" ) ); - allPatches = new YMenuItem( _( "All Patches" ) ); - recommended = new YMenuItem( _( "Recommended" ) ); - security = new YMenuItem( _( "Security" ) ); - optional = new YMenuItem( _( "Optional" ) ); + installable = new YMenuItem( _( "&Installable Patches" ) ); + installed = new YMenuItem( _( "Installed &Patches" ) ); + allPatches = new YMenuItem( _( "&All Patches" ) ); + recommended = new YMenuItem( _( "&Recommended" ) ); + security = new YMenuItem( _( "&Security" ) ); + optional = new YMenuItem( _( "&Optional" ) ); // end: - search = new YMenuItem( _( "Search" ) ); + search = new YMenuItem( _( "S&earch" ) ); items.push_back( installable ); items.push_back( installed ); @@ -64,20 +65,21 @@ bool NCPkgMenuFilter::handleEvent ( const NCursesEvent & event) { if ( !event.selection) + { + yuiError() << "Menu selection failed" << endl; return false; - - NCPkgTable *pkgList = pkg->PackageList(); - int idx = pkgList->getCurrentItem(); + } - ZyppObj pkgPtr = pkgList->getDataPointer( idx ); - ZyppSel slbPtr = pkgList->getSelPointer( idx ); + NCPkgTable *pkgList = pkg->PackageList(); - if ( !pkgPtr || !slbPtr) - { - yuiError() << "package list empty - no package pointer" << endl; - return true; + if ( !pkgList ) + { + yuiError() << "No package list available" << endl; + return false; } + yuiMilestone() << "Handle event NCPkgMenuFilter" << endl; + // Call the appropriate method from NCPackageSelector for // the selected menu entry. @@ -110,6 +112,7 @@ { yuiMilestone() << "Search is canceled" << endl; } + delete searchPopup; } } Modified: trunk/ncurses-pkg/src/NCPkgMenuFilter.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuFilter.h... ============================================================================== --- trunk/ncurses-pkg/src/NCPkgMenuFilter.h (original) +++ trunk/ncurses-pkg/src/NCPkgMenuFilter.h Wed Apr 16 14:43:11 2008 @@ -12,7 +12,7 @@ File: NCPkgMenuFilter.cc - Author: Gabriele MOhr <gs@suse.de> + Author: Gabriele Mohr <gs@suse.de> /-*/ #ifndef NCPkgMenuFilter_h @@ -39,8 +39,6 @@ NCPackageSelector *pkg; NCPkgPatchSearch *searchPopup; - -public: YItemCollection items; @@ -52,6 +50,8 @@ YMenuItem *optional; YMenuItem *search; +public: + NCPkgMenuFilter (YWidget *parent, string label, NCPackageSelector *pkger); virtual ~NCPkgMenuFilter(); Modified: trunk/ncurses-pkg/src/NCPkgMenuView.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuView.cc?... ============================================================================== --- trunk/ncurses-pkg/src/NCPkgMenuView.cc (original) +++ trunk/ncurses-pkg/src/NCPkgMenuView.cc Wed Apr 16 14:43:11 2008 @@ -40,34 +40,36 @@ { if ( !pkg->isYouMode() ) { - description = new YMenuItem( _("Package Description") ); - items.push_back( description ); + // begin: menu items of the view (package information) menu + // please note: use unique hotkeys until end: + technical = new YMenuItem( _("&Technical data") ); + description = new YMenuItem( _("&Package Description") ); + versions = new YMenuItem( _("Package &Versions") ); + files = new YMenuItem( _("&File List") ); + // end: menu items of the view menu + deps = new YMenuItem( _("&Dependencies") ); - technical = new YMenuItem( _("Technical data") ); items.push_back( technical ); - - versions = new YMenuItem( _("Package Versions") ); + items.push_back( description ); items.push_back( versions ); - - files = new YMenuItem( _("File List") ); items.push_back( files ); - - deps = new YMenuItem( _("Dependencies") ); items.push_back( deps ); - + addItems( items ); } else { + // menu items of the patch view menu - keep them short and + // use unique hotkeys from begin: to end: + // begin: patchDescription = new YMenuItem( _( "&Long Description" ) ); - items.push_back( patchDescription ); - - patchPackages = new YMenuItem( _( "&Package List" )); - items.push_back( patchPackages ); - + patchPackages = new YMenuItem( _( "&Package List" ) ); + // end: menu items of the view menu patchPkgVersions = new YMenuItem( _("&Versions") ); - items.push_back( patchPkgVersions ); + items.push_back( patchDescription ); + items.push_back( patchPackages ); + items.push_back( patchPkgVersions ); addItems( items ); } } @@ -86,7 +88,7 @@ if ( !pkgPtr || !slbPtr) { - yuiError() << "package list empty - no package pointer" << endl; + yuiWarning() << "package list empty - no package pointer" << endl; return true; } Modified: trunk/ncurses-pkg/src/NCPkgStrings.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgStrings.cc?r... ============================================================================== --- trunk/ncurses-pkg/src/NCPkgStrings.cc (original) +++ trunk/ncurses-pkg/src/NCPkgStrings.cc Wed Apr 16 14:43:11 2008 @@ -202,7 +202,7 @@ const string NCPkgStrings::PackageName() { // Label under the pkg table - pkg name follows - static const string value = _( "Package" ); + static const string value = _( "Package: " ); return value; } Modified: trunk/ncurses-pkg/src/NCPkgTable.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgTable.cc?rev... ============================================================================== --- trunk/ncurses-pkg/src/NCPkgTable.cc (original) +++ trunk/ncurses-pkg/src/NCPkgTable.cc Wed Apr 16 14:43:11 2008 @@ -123,7 +123,7 @@ , haveInstalledVersion ( false ) { fillHeader(); - + setVisibleInfo( I_Technical ); // set default yuiDebug() << endl; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org