Mailinglist Archive: yast-commit (595 mails)

< Previous Next >
[yast-commit] r53812 - /trunk/network/src/services/dns.ycp
  • From: kmachalkova@xxxxxxxxxxxxxxxx
  • Date: Tue, 02 Dec 2008 13:43:34 -0000
  • Message-id: <20081202134334.6E161B184E@xxxxxxxxxxxxxxxx>
Author: kmachalkova
Date: Tue Dec 2 14:43:34 2008
New Revision: 53812

URL: http://svn.opensuse.org/viewcvs/yast?rev=53812&view=rev
Log:
Allow changing hostname even if NM is in control
( + some changes to enabling/disabling widgets)
(#444967)

Modified:
trunk/network/src/services/dns.ycp

Modified: trunk/network/src/services/dns.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/network/src/services/dns.ycp?rev=53812&r1=53811&r2=53812&view=diff
==============================================================================
--- trunk/network/src/services/dns.ycp (original)
+++ trunk/network/src/services/dns.ycp Tue Dec 2 14:43:34 2008
@@ -123,7 +123,6 @@
define void InitHnWidget (string key) {
any value = hn_settings[key]:nil;
UI::ChangeWidget (`id (key), `Value, value);
- if (disableItemsIfNM([], false)) UI::ChangeWidget(`id (key),`Enabled,
false);
}


@@ -146,11 +145,11 @@
* @return nil so that the dialog loops on
*/
define void InitDhcpHostname (string key) {
- if (!disableItemsIfNM([], false))
- UI::ChangeWidget (`id("DHCP_HOSTNAME"), `Enabled, has_dhcp);
+ UI::ChangeWidget (`id("DHCP_HOSTNAME"), `Enabled, has_dhcp);
if (!has_dhcp) UI::ReplaceWidget(`id ("dh_host_text"),`Label(_("No
interface with dhcp")));
// the hostname dialog proposes to update it by DHCP on a
laptop (#326102)
- else UI::ChangeWidget(`id("DHCP_HOSTNAME"), `Value,
hn_settings["DHCP_HOSTNAME"]:true);
+ else
+ UI::ChangeWidget(`id("DHCP_HOSTNAME"), `Value,
hn_settings["DHCP_HOSTNAME"]:true);
return nil;
}

@@ -162,9 +161,11 @@
* @return nil so that the dialog loops on
*/
define symbol HandleResolverData (string key, map event) {
- if (!disableItemsIfNM([], false))
+ //if this one is disabled, it means NM is in charge (see also
initModifyResolvPolicy())
+ if ( (boolean) UI::QueryWidget(`id("MODIFY_RESOLV"),`Enabled ))
+ //thus, we should not re-enable already disabled widgets
UI::ChangeWidget (`id (key), `Enabled, resolver_modifiable);
- return nil;
+ return nil;
}

/**
@@ -246,26 +247,24 @@


void initPolicy(string key) {
-
- y2milestone("initPolicy: %1", UI::QueryWidget(`id("MODIFY_RESOLV"), `Value));
- if (!disableItemsIfNM([], false)){
- if(UI::QueryWidget(`id("MODIFY_RESOLV"), `Value) == `custom)
+ //first initialize correctly
+ y2milestone("initPolicy: %1", UI::QueryWidget(`id("MODIFY_RESOLV"),
`Value));
+ if(UI::QueryWidget(`id("MODIFY_RESOLV"), `Value) == `custom)
+ {
+ UI::ChangeWidget(`id("PLAIN_POLICY"), `Enabled, true);
+ if (UI::QueryWidget(`id("PLAIN_POLICY"), `Value) == "")
{
- UI::ChangeWidget(`id("PLAIN_POLICY"), `Enabled, true);
- if (UI::QueryWidget(`id("PLAIN_POLICY"), `Value) == "")
- {
- UI::ChangeWidget(`id("PLAIN_POLICY"), `Value,
DNS::resolv_conf_policy);
- }
+ UI::ChangeWidget(`id("PLAIN_POLICY"), `Value,
DNS::resolv_conf_policy);
}
- else
- {
- UI::ChangeWidget(`id("PLAIN_POLICY"), `Value, "");
- UI::ChangeWidget(`id("PLAIN_POLICY"), `Enabled, false);
- }
- } else {
- UI::ChangeWidget(`id("MODIFY_RESOLV"), `Enabled, false);
- UI::ChangeWidget(`id("PLAIN_POLICY"), `Enabled, false);
- }
+ }
+ else
+ {
+ UI::ChangeWidget(`id("PLAIN_POLICY"), `Value, "");
+ UI::ChangeWidget(`id("PLAIN_POLICY"), `Enabled, false);
+ }
+ //then disable if needed
+ disableItemsIfNM([ "PLAIN_POLICY" ], false);
+
}

symbol handlePolicy(string key, map event) {
@@ -289,7 +288,7 @@
void initModifyResolvPolicy (string key){

y2milestone("initModifyResolvPolicy");
-
+ //first initialize correctly
if(DNS::resolv_conf_policy == nil || DNS::resolv_conf_policy == "")
{
UI::ChangeWidget(`id("MODIFY_RESOLV"), `Value, `id(`nomodify) );
@@ -302,7 +301,8 @@
{
UI::ChangeWidget(`id("MODIFY_RESOLV"), `Value, `id(`custom) );
}
- if (disableItemsIfNM([], false)) UI::ChangeWidget(`id("MODIFY_RESOLV"),
`Enabled, false);
+ //then disable if needed
+ disableItemsIfNM(["MODIFY_RESOLV"], false);
}

symbol handleModifyResolvPolicy (string key, map event){
@@ -326,15 +326,18 @@

void initHostnameGlobal(string key){
// NetworkService::IsManaged () not: #169858, #156830
- has_dhcp = Lan::AnyDHCPDevice ();
+ has_dhcp = Lan::AnyDHCPDevice ();

hn_settings = InitSettings ();
foreach(string key, (list<string>)Map::Keys(hn_settings),{
- InitHnWidget(key);
+ InitHnWidget(key);
});
+ //disable those if NM is in charge
+ disableItemsIfNM(
+ [ "NAMESERVER_1", "NAMESERVER_2", "NAMESERVER_3", "SEARCHLIST_S"],
+ false
+ );

- // TODO make checkbox instead of popup
- // resolver_modifiable = ModifyResolvConfPopup ();
}

void storeHostnameGlobal(string key, map event){

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

< Previous Next >
This Thread
  • No further messages