[yast-commit] r52607 - in /trunk/sudo/src: complex.ycp dialog-cmnd.ycp dialog-host.ycp dialog-runas.ycp dialog-spec.ycp dialog-user.ycp dialogs.ycp
Author: kmachalkova Date: Mon Oct 27 16:35:57 2008 New Revision: 52607 URL: http://svn.opensuse.org/viewcvs/yast?rev=52607&view=rev Log: Disable Edit & Delete buttons if there are no items in the table (#395779, but not only) Modified: trunk/sudo/src/complex.ycp trunk/sudo/src/dialog-cmnd.ycp trunk/sudo/src/dialog-host.ycp trunk/sudo/src/dialog-runas.ycp trunk/sudo/src/dialog-spec.ycp trunk/sudo/src/dialog-user.ycp trunk/sudo/src/dialogs.ycp Modified: trunk/sudo/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/complex.ycp?rev=52607&r1=52606&r2=52607&view=diff ============================================================================== --- trunk/sudo/src/complex.ycp (original) +++ trunk/sudo/src/complex.ycp Mon Oct 27 16:35:57 2008 @@ -48,6 +48,12 @@ integer current_spec_idx = -1; string initial_screen = "user_specs"; +void EnableDisableButtons( string edit_button, string delete_button, list <term> items ) +{ + UI::ChangeWidget(`id(edit_button), `Enabled, (items != []) ); + UI::ChangeWidget(`id(delete_button), `Enabled, (items != []) ); +} + boolean ValidateHost(string hostname) { string netmask = ""; Modified: trunk/sudo/src/dialog-cmnd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/dialog-cmnd.ycp?rev=52607&r1=52606&r2=52607&view=diff ============================================================================== --- trunk/sudo/src/dialog-cmnd.ycp (original) +++ trunk/sudo/src/dialog-cmnd.ycp Mon Oct 27 16:35:57 2008 @@ -17,6 +17,7 @@ } UI::ChangeWidget(`id("cmnd_alias_members"),`Items, items); + EnableDisableButtons("edit_command", "remove_command", items); } Modified: trunk/sudo/src/dialog-host.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/dialog-host.ycp?rev=52607&r1=52606&r2=52607&view=diff ============================================================================== --- trunk/sudo/src/dialog-host.ycp (original) +++ trunk/sudo/src/dialog-host.ycp Mon Oct 27 16:35:57 2008 @@ -21,6 +21,7 @@ }); UI::ChangeWidget(`id("host_alias_members"),`Items, items); + EnableDisableButtons("edit_host", "remove_host", items); } Modified: trunk/sudo/src/dialog-runas.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/dialog-runas.ycp?rev=52607&r1=52606&r2=52607&view=diff ============================================================================== --- trunk/sudo/src/dialog-runas.ycp (original) +++ trunk/sudo/src/dialog-runas.ycp Mon Oct 27 16:35:57 2008 @@ -19,7 +19,9 @@ foreach(string it, members, { items = add(items, `item(`id(it),it)); }); + UI::ChangeWidget(`id("runas_alias_members"),`Items, items); + UI::ChangeWidget(`id("remove_member"), `Enabled, (items != [])); UI::ReplaceWidget(`id("all_run_as_replace"), `ComboBox(`id("all_run_as"),_("Local and System Users"),sort(string s, string t, users, ``( s < t)))); Modified: trunk/sudo/src/dialog-spec.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/dialog-spec.ycp?rev=52607&r1=52606&r2=52607&view=diff ============================================================================== --- trunk/sudo/src/dialog-spec.ycp (original) +++ trunk/sudo/src/dialog-spec.ycp Mon Oct 27 16:35:57 2008 @@ -15,6 +15,7 @@ list <term> items = UpdateCmdList(commands); UI::ChangeWidget(`id("commands"),`Items, items); + EnableDisableButtons("command_edit", "command_remove", items); } } Modified: trunk/sudo/src/dialog-user.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/dialog-user.ycp?rev=52607&r1=52606&r2=52607&view=diff ============================================================================== --- trunk/sudo/src/dialog-user.ycp (original) +++ trunk/sudo/src/dialog-user.ycp Mon Oct 27 16:35:57 2008 @@ -20,6 +20,7 @@ items = add(items, `item(`id(it),it)); }); UI::ChangeWidget(`id("user_alias_members"),`Items, items); + UI::ChangeWidget(`id("remove_member"), `Enabled, (items != [])); UI::ReplaceWidget(`id("all_users_replace"), `ComboBox(`id("all_users"),_("Local and System Users"), sort(string s, string t, users, ``( s < t)))); Modified: trunk/sudo/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/dialogs.ycp?rev=52607&r1=52606&r2=52607&view=diff ============================================================================== --- trunk/sudo/src/dialogs.ycp (original) +++ trunk/sudo/src/dialogs.ycp Mon Oct 27 16:35:57 2008 @@ -58,11 +58,13 @@ if (Sudo::SystemRulePopup( Sudo::GetUserSpecMember(idx), true)) { Sudo::RemoveUserSpec(idx); - UI::ChangeWidget(`id("table_user_spec"), `Items, filter(term tmp, items,{ + items = filter(term tmp, items,{ return tmp[0]:nil != `id(idx); - } )); + } ); + UI::ChangeWidget(`id("table_user_spec"), `Items, items); Sudo::SetModified(); } + EnableDisableButtons("edit_spec", "delete_spec", items); } } @@ -82,6 +84,7 @@ }); UI::ChangeWidget(`id("table_user_spec"),`Items,items); + EnableDisableButtons("edit_spec", "delete_spec", items); } symbol HandleHostAliases(string key, map event) { @@ -107,11 +110,13 @@ if (confirm_delete) { Sudo::RemoveHostAlias(current_alias_name); - UI::ChangeWidget(`id("table_host_aliases"), `Items, filter(term tmp, items, { + items = filter( term tmp, items, { return tmp[0]:nil != `id(current_alias_name); - } )); + } ); + UI::ChangeWidget(`id("table_host_aliases"), `Items, items); Sudo::SetModified(); } + EnableDisableButtons("edit_host_alias", "delete_host_alias", items); } } @@ -125,6 +130,7 @@ }); UI::ChangeWidget(`id("table_host_aliases"),`Items,items); + EnableDisableButtons("edit_host_alias", "delete_host_alias", items); } symbol HandleUserAliases(string key, map event) { @@ -151,11 +157,13 @@ if (confirm_delete) { Sudo::RemoveUserAlias(current_alias_name); - UI::ChangeWidget(`id("table_user_aliases"), `Items, filter(term tmp, items, { + items = filter(term tmp, items, { return tmp[0]:nil != `id(current_alias_name); - })); + }); + UI::ChangeWidget(`id("table_user_aliases"), `Items, items); Sudo::SetModified(); } + EnableDisableButtons("edit_user_alias", "delete_user_alias", items); } } @@ -168,6 +176,7 @@ }); UI::ChangeWidget(`id("table_user_aliases"),`Items,items); + EnableDisableButtons("edit_user_alias", "delete_user_alias", items); } symbol HandleRunAsAliases(string key, map event) { @@ -194,11 +203,13 @@ if (confirm_delete) { Sudo::RemoveRunAsAlias(current_alias_name); - UI::ChangeWidget(`id("table_runas_aliases"), `Items, filter(term tmp, items, { + items = filter(term tmp, items, { return tmp[0]:nil != `id(current_alias_name); - } )); + } ); + UI::ChangeWidget(`id("table_runas_aliases"), `Items, items); Sudo::SetModified(); } + EnableDisableButtons("edit_runas_alias", "delete_runas_alias", items); } } @@ -212,6 +223,7 @@ }); UI::ChangeWidget(`id("table_runas_aliases"),`Items,items); + EnableDisableButtons("edit_runas_alias", "delete_runas_alias", items); } @@ -239,11 +251,13 @@ if (confirm_delete) { Sudo::RemoveCmndAlias(current_alias_name); - UI::ChangeWidget(`id("table_command_aliases"), `Items, filter(term tmp, items, { + items = filter(term tmp, items, { return tmp[0]:nil != `id(current_alias_name); - } )); + } ); + UI::ChangeWidget(`id("table_command_aliases"), `Items, items ); Sudo::SetModified(); } + EnableDisableButtons("edit_command_alias", "delete_command_alias", items); } } @@ -257,6 +271,7 @@ }); UI::ChangeWidget(`id("table_command_aliases"),`Items,items); + EnableDisableButtons("edit_command_alias", "delete_command_alias", items); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
kmachalkova@svn.opensuse.org