Author: kmachalkova Date: Mon Mar 8 17:17:32 2010 New Revision: 61184 URL: http://svn.opensuse.org/viewcvs/yast?rev=61184&view=rev Log: - Pre-fill hname field with global hostname on switching from dhcp to static - Advise user to fill in some hname (both bnc#583786) Modified: branches/SuSE-Code-11-SP1-Branch/network/src/lan/address.ycp Modified: branches/SuSE-Code-11-SP1-Branch/network/src/lan/address.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/network/src/lan/address.ycp?rev=61184&r1=61183&r2=61184&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/network/src/lan/address.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/network/src/lan/address.ycp Mon Mar 8 17:17:32 2010 @@ -14,6 +14,7 @@ import "Arch"; import "CWM"; import "CWMTab"; +import "DNS"; import "Host"; import "Hostname"; import "IP"; @@ -252,12 +253,19 @@ symbol handleBootProto (string key, map event) { - if (event["EventReason"]:""=="ValueChanged"){ - symbol current = (symbol)UI::QueryWidget(`id(`bootproto), `CurrentButton); - enableDisableBootProto(current); -// if (current == `none) settings["STARTMODE"] = "off"; - } - return nil; + if (event["EventReason"]:""=="ValueChanged"){ + symbol current = (symbol)UI::QueryWidget(`id(`bootproto), `CurrentButton); + enableDisableBootProto(current); + + if (current == `static) { + string one_ip = (string) UI::QueryWidget(`id(`ipaddr), `Value); + if ( size(one_ip) == 0) { + y2milestone("Presetting global hostname"); + UI::ChangeWidget(`id(`hostname), `Value, Hostname::MergeFQ(DNS::hostname, DNS::domain)); + } + } + } + return nil; } @@ -458,12 +466,24 @@ return false; } - string h = (string) UI::QueryWidget(`hostname, `Value ); - if ( h != "" && !Hostname::CheckFQ(h)) { - Popup::Error(_("No valid hostname.")); - UI::SetFocus(`hostname); - return false; + string hname = (string) UI::QueryWidget(`hostname, `Value ); + if ( size(hname) > 0 ) { + if( !Hostname::CheckFQ(hname) ) { + Popup::Error(_("Invalid hostname.")); + UI::SetFocus(`hostname); + return false; + } + } else { + //User doesn't want to define hname for this static IP + if( !Popup::YesNo( _("No hostname has been specified. It is recommended to associate +some hostname with static IP, otherwise the machine name will +not be resolvable without active network connection.\n +Really leave the hostname blank?")) ) { + UI::SetFocus(`hostname); + return false; + } } + // validate duplication if (NetHwDetection::DuplicateIP (ipa)) { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org