Author: kmachalkova Date: Thu Feb 12 18:55:07 2009 New Revision: 55478 URL: http://svn.opensuse.org/viewcvs/yast?rev=55478&view=rev Log: read sysconfig Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc trunk/ncurses-pkg/src/NCPackageSelector.h trunk/ncurses-pkg/src/NCPkgMenuConfig.cc Modified: trunk/ncurses-pkg/src/NCPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.cc?rev=55478&r1=55477&r2=55478&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPackageSelector.cc (original) +++ trunk/ncurses-pkg/src/NCPackageSelector.cc Thu Feb 12 18:55:07 2009 @@ -55,10 +55,13 @@ #include "NCZypp.h" // tryCastToZyppPkg(), tryCastToZyppPatch() #include <zypp/ui/Selectable.h> +#include <zypp/base/Sysconfig.h> #include "YWidgetID.h" #include "YPackageSelector.h" +#define PATH_TO_YAST_SYSCONFIG "/etc/sysconfig/yast2" + typedef zypp::Patch::Contents ZyppPatchContents; typedef zypp::Patch::Contents::Selectable_iterator ZyppPatchContentsIterator; @@ -90,8 +93,8 @@ , pkgList ( 0 ) , depsMenu( 0 ) , viewMenu( 0 ) - , extrasMenu( 0 ) , configMenu( 0 ) + , extrasMenu( 0 ) , helpMenu( 0 ) , filterMain( 0 ) , actionMenu( 0 ) @@ -110,6 +113,7 @@ { setFlags( modeFlags ); + readSysconfig(); saveState (); diskspacePopup = new NCPkgDiskspace( testMode ); @@ -139,6 +143,20 @@ } +void NCPackageSelector::readSysconfig() +{ + map <string, string> sysconfig = zypp::base::sysconfig::read( PATH_TO_YAST_SYSCONFIG ); + map <string,string>::const_iterator it = sysconfig.find("PKGMGR_ACTION_AT_EXIT"); + + if (it != sysconfig.end()) + { + actionAtExit = it->second; + yuiMilestone() << "Read sysconfig's action at pkg mgr exit value: " << actionAtExit << endl; + } + else + yuiMilestone() << "Smolicek pacholicek" << endl; +} + bool NCPackageSelector::checkNow( bool *ok ) { bool ret = false; Modified: trunk/ncurses-pkg/src/NCPackageSelector.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPackageSelector.h?rev=55478&r1=55477&r2=55478&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPackageSelector.h (original) +++ trunk/ncurses-pkg/src/NCPackageSelector.h Thu Feb 12 18:55:07 2009 @@ -121,6 +121,8 @@ bool testMode; // testing bool repoMgrEnabled; bool autoCheck; + + string actionAtExit; YRpmGroupsTree * _rpmGroupsTree; // rpm groups of the found packages @@ -193,6 +195,8 @@ void setFlags( long modeFlags); + void readSysconfig(); + /** * Create layout for the PackageSelector * @param parent Parent is PackageSelectorStart @@ -232,6 +236,8 @@ bool checkNow( bool *ok ); bool verifySystem( bool *ok ); + string ActionAtExit() { return actionAtExit; } + /** * Fills the package table with YOU patches matching the filter * @param filter Modified: trunk/ncurses-pkg/src/NCPkgMenuConfig.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses-pkg/src/NCPkgMenuConfig.cc?rev=55478&r1=55477&r2=55478&view=diff ============================================================================== --- trunk/ncurses-pkg/src/NCPkgMenuConfig.cc (original) +++ trunk/ncurses-pkg/src/NCPkgMenuConfig.cc Thu Feb 12 18:55:07 2009 @@ -24,6 +24,10 @@ /* Textdomain "ncurses-pkg" */ +string preselect( string s1, string s2) +{ + return (s1 == s2) ? "[x] " : "[ ] "; +} NCPkgMenuConfig::NCPkgMenuConfig (YWidget *parent, string label, NCPackageSelector *pkger) : NCMenuButton( parent, label) @@ -39,6 +43,8 @@ void NCPkgMenuConfig::createLayout() { + string exitAction = pkg->ActionAtExit(); + repoManager = new YMenuItem( _( "Launch Repository Manager") ); onlineUpdate = new YMenuItem( _( "Launch Online Update Configuration" ) ); actionOnExit = new YMenuItem( _( "Action on Exit" ) ); @@ -47,9 +53,11 @@ items.push_back( onlineUpdate ); items.push_back( actionOnExit ); - restart = new YMenuItem( actionOnExit, _( "[x] Close Package Manager" ) ); - close = new YMenuItem( actionOnExit, _( "[ ] Restart Package Manager" ) ); - showSummary = new YMenuItem( actionOnExit, _( "[ ] Show Summary" ) ); + restart = new YMenuItem( actionOnExit, preselect("restart", exitAction) + _( "Close Package Manager" ) ); + close = new YMenuItem( actionOnExit, preselect("close", exitAction) + _( "Restart Package Manager" ) ); + showSummary = new YMenuItem( actionOnExit, preselect("summary", exitAction) + _( "Show Summary" ) ); + + addItems( items ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org