Author: kmachalkova
Date: Fri Mar 27 17:49:56 2009
New Revision: 56453
URL: http://svn.opensuse.org/viewcvs/yast?rev=56453&view=rev
Log:
Avoid throwing 'no widget with ID foo' exceptions
(#483789) + moved enabling/disabling widgets
away from giant HandlePartWidgetChanges func.
Modified:
trunk/storage/storage/src/include/custom_part_lib.ycp
trunk/storage/storage/src/include/ep-dialogs.ycp
Modified: trunk/storage/storage/src/include/custom_part_lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_lib.ycp?rev=56453&r1=56452&r2=56453&view=diff
==============================================================================
--- trunk/storage/storage/src/include/custom_part_lib.ycp (original)
+++ trunk/storage/storage/src/include/custom_part_lib.ycp Fri Mar 27 17:49:56 2009
@@ -813,25 +813,6 @@
// format partition
new["format"] = format;
- if( UI::WidgetExists( `id(`fs) ))
- {
- UI::ChangeWidget( `id(`fs), `Enabled, format );
- }
- if( UI::WidgetExists( `id(`fs_options) ))
- {
- UI::ChangeWidget( `id(`fs_options), `Enabled,
- format && selected_fs[`options]:[] != [] );
- }
- if( UI::WidgetExists( `id(`crypt_fs) ))
- {
- UI::ChangeWidget( `id(`crypt_fs), `Enabled,
- selected_fs[`crypt]:true );
- }
- if( UI::WidgetExists( `id(`fsid_point) ))
- {
- UI::ChangeWidget( `id(`fsid_point), `Enabled, !format);
- }
-
if( old_format != format )
{
symbol dfs = `unknown;
Modified: trunk/storage/storage/src/include/ep-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-dialogs.ycp?rev=56453&r1=56452&r2=56453&view=diff
==============================================================================
--- trunk/storage/storage/src/include/ep-dialogs.ycp (original)
+++ trunk/storage/storage/src/include/ep-dialogs.ycp Fri Mar 27 17:49:56 2009
@@ -32,6 +32,12 @@
//retrieve all filesystems
map > all_filesystems = FileSystems::GetAllFileSystems(true, true);
+ void ChangeWidgetIfExists( symbol wid, symbol property, any value)
+ {
+ if ( UI::WidgetExists(`id(wid)) )
+ UI::ChangeWidget(`id(wid), property, value);
+ }
+
list <string> ProposeMountpoints( symbol used_fs, string current_mp )
{
map fs_data = all_filesystems[used_fs]: $[];
@@ -50,6 +56,14 @@
}
}
+ // disable Options p.b. if no fs options can be set
+ // disable Encrypt box if fs doesn't support encryption
+ void EnableDisableFsOpts( symbol used_fs )
+ {
+ map fs_data = all_filesystems[used_fs]: $[];
+ UI::ChangeWidget(`id(`fs_options), `Enabled, fs_data[`options]:[] != []);
+ ChangeWidgetIfExists(`crypt_fs, `Enabled, fs_data[`crypt]:true);
+ }
boolean do_format = data["format"]:false;
symbol used_fs = data["used_fs"]:`unknown;
@@ -85,7 +99,6 @@
return true;
}
-
/* MiniWorkflowStepPartitionSize data:
$["create":true,
"cyl_size":8225280,
@@ -179,8 +192,15 @@
UI::ChangeWidget(`id(`format), `Value, do_format ? `do_format : `do_not_format);
UI::ChangeWidget(`id(`do_format_attachment), `Enabled, do_format);
- UI::ChangeWidget(`id(`crypt_fs), `Value, crypt_fs);
- UI::ChangeWidget(`id(`do_not_format_attachment), `Enabled, !do_format);
+ //not there in RAID/LVM/loop configuration (#483789)
+ ChangeWidgetIfExists( `do_not_format_attachment, `Enabled, !do_format );
+
+ if( do_format)
+ EnableDisableFsOpts(used_fs);
+
+ //not there on s390s
+ ChangeWidgetIfExists( `crypt_fs, `Value, crypt_fs );
+
UI::ChangeWidget(`id(`mount), `Value, do_mount ? `do_mount : `do_not_mount);
UI::ChangeWidget(`id(`do_mount_attachment), `Enabled, do_mount);
UI::ChangeWidget(`id(`mount_point), `Value, mount);
@@ -260,7 +280,8 @@
data["used_fs"] = (symbol) UI::QueryWidget(`id(`fs), `Value);
UI::ChangeWidget(`id(`do_format_attachment), `Enabled, true);
- UI::ChangeWidget(`id(`do_not_format_attachment), `Enabled, false);
+ ChangeWidgetIfExists(`do_not_format_attachment, `Enabled, false);
+ EnableDisableFsOpts( data["used_fs"]:`none);
UI::SetFocus(`id(`fs));
MiniWorkflow::SetLastStep(!AskPassword());
break;
@@ -268,7 +289,7 @@
case `do_not_format:
do_format = (boolean) UI::QueryWidget(`id(`do_format), `Value);
UI::ChangeWidget(`id(`do_format_attachment), `Enabled, false);
- UI::ChangeWidget(`id(`do_not_format_attachment), `Enabled, true);
+ ChangeWidgetIfExists(`do_not_format_attachment, `Enabled, true);
MiniWorkflow::SetLastStep(!AskPassword());
break;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org