Author: aschnell
Date: Fri Apr 11 12:53:20 2008
New Revision: 46396
URL: http://svn.opensuse.org/viewcvs/yast?rev=46396&view=rev
Log:
- restructured miniworkflow steps
Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-lib.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-lvm-dialogs.ycp
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp?rev=46396&r1=46395&r2=46396&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-dialogs.ycp Fri Apr 11 12:53:20 2008
@@ -9,48 +9,101 @@
textdomain "storage";
- term FrameSize(symbol flavour)
- {
- return `Frame(_("Size"),
- `RadioButtonGroup(`id(`size),
- `VBox(
- `LeftRadioButton(`id(`max_size), "Maximum Size (XX.XX GB)"),
- `LeftRadioButtonWithAttachment(`id(`manual_size), "Manual Size",
- `VBox(
- `MinWidth(15, `InputField(`id(`size), `opt(`shrinkable), "Size")),
- `Left(`Label("Cylinder size is X.XX MB"))))
- ))
- );
- }
+ import "MiniWorkflow";
+ import "Greasemonkey";
- term FrameFormat(symbol flavour)
+ // TODO: y2milestones at begin and end of MiniWorkflowSteps as decorators
+ // or in MiniWorkflow (Sequencer) module?
+
+
+ symbol MiniWorkflowStepSize(map &data)
{
- term tmp = `Empty();
+ y2milestone("MiniWorkflowStepSize data:%1", data);
+
+ symbol flavour = data["flavour"]:`none;
+
+ term cyl = `Empty();
if (flavour == `part)
- tmp = `VBox(FsidComboBox($[], FileSystems::GetAllFileSystems(true, true)));
-
- return `Frame(_("Format"),
- `RadioButtonGroup(`id(`format),
- `VBox(
- `LeftRadioButtonWithAttachment(`id(`do_format), `opt(`notify),
- _("Format the partition"),
- FileSystemsComboBox($[], FileSystems::GetAllFileSystems(true, true))),
- `VSpacing(0.45),
- `LeftRadioButtonWithAttachment(`id(`do_not_format), `opt(`notify),
- _("Do not format the partition"),
- tmp)
- )
- )
- );
+ cyl = `Left(`Label(sformat(_("Cylinder size is %1"), String::FormatSizeWithPrecision(data["cyl_size"]:0, 2, false))));
+
+ term frames = `VStackFrames();
+
+ frames = add(frames,
+ `Frame(_("Size"),
+ `RadioButtonGroup(`id(`size),
+ `VBox(
+ `LeftRadioButton(`id(`max_size), `opt(`notify),
+ sformat(_("Maximum Size (%1)"),
+ String::FormatSizeWithPrecision(data["max_size"]:0, 2, false))),
+ `LeftRadioButtonWithAttachment(`id(`manual_size), `opt(`notify), _("Manual Size"),
+ `VBox(`id(`manual_size_attachment),
+ `MinWidth(15, `InputField(`id(`size), `opt(`shrinkable), _("Size"))),
+ cyl
+ )
+ )
+ )
+ )));
+
+ if (flavour == `lv)
+ {
+ frames = add(frames, `Frame("Stripes",
+ `HBox(
+ `Left(`ComboBox("Number", ["1", "2", "3", "4"])),
+ `Left(`ComboBox("Size", ["4 kB", "8 kB", "16 kB", "32 kB"])),
+ `HStretch())
+ )
+ );
+ }
+
+ term contents = `HVSquash(frames);
+
+ MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help");
+
+ MiniWorkflow::SetLastStep(false);
+
+ symbol widget = nil;
+
+ repeat
+ {
+ widget = (symbol) MiniWorkflow::UserInput();
+
+ if (widget == `max_size)
+ {
+ UI::ChangeWidget(`id(`manual_size_attachment), `Enabled, false);
+ }
+ else if (widget == `manual_size)
+ {
+ UI::ChangeWidget(`id(`manual_size_attachment), `Enabled, true);
+ }
+ }
+ until (widget == `abort || widget == `back || widget == `next);
+
+ if (widget == `next)
+ {
+ // TODO
+ data["manual_size"] = UI::QueryWidget(`id(`size), `Value);
+ }
+
+ y2milestone("MiniWorkflowStepSize data:%1 ret:%2", data, widget);
+
+ return widget;
}
- term FrameMount(symbol flavour)
+ symbol MiniWorkflowStepFormatMount(map &data)
{
+ y2milestone("MiniWorkflowStepFormatMount data:%1", data);
+
+ symbol flavour = data["flavour"]:`none;
+
+ term tmp1 = `Empty();
+ if (flavour == `part)
+ tmp1 = `VBox(`id(`do_not_format_attachment), FsidComboBox($[], FileSystems::GetAllFileSystems(true, true)));
+
map new_val = $[];
- list mountpoints = nil;
+ list mountpoints = nil;
if (mountpoints == nil)
mountpoints = [ "/", "/usr", Partitions::BootMount(), "/var", "/home",
"/opt" , "" ];
@@ -62,41 +115,197 @@
if (!contains(mountpoints, mount))
mountpoints = union([mount], mountpoints);
- return `Frame(_("Mount"),
- `RadioButtonGroup(`id(`mount),
- `VBox(
- `LeftRadioButtonWithAttachment(`id(`do_mount),
- _("Mount partition"),
- `VBox(
- `ComboBox(`id(`mount_point), `opt(`editable, `hstretch, `notify),
- _("Mount Point"), mountpoints),
- `PushButton(`id(`fstab_options), `opt(`hstretch),
- // button text
- _("Fs&tab Options..."))
- )),
- `VSpacing(0.45),
- `LeftRadioButton(`id(`do_not_mount),
- _("Do not mount partition"))
- )
- )
+ term contents = `HVSquash(`VStackFrames(
+ `Frame(_("Format"),
+ `RadioButtonGroup(`id(`format),
+ `VBox(
+ `LeftRadioButtonWithAttachment(`id(`do_format), `opt(`notify),
+ _("Format the partition"),
+ `VBox(`id(`do_format_attachment),
+ FileSystemsComboBox($[], FileSystems::GetAllFileSystems(true, true))
+ )),
+ `VSpacing(0.45),
+ `LeftRadioButtonWithAttachment(`id(`do_not_format), `opt(`notify),
+ _("Do not format the partition"),
+ tmp1)
+ )
+ )
+ ),
+ `Frame(_("Mount"),
+ `RadioButtonGroup(`id(`mount),
+ `VBox(
+ `LeftRadioButtonWithAttachment(`id(`do_mount), `opt(`notify),
+ _("Mount partition"),
+ `VBox(
+ `id(`do_mount_attachment),
+ `ComboBox(`id(`mount_point), `opt(`editable, `hstretch, `notify),
+ _("Mount Point"), mountpoints),
+ `PushButton(`id(`fstab_options), `opt(`hstretch),
+ // button text
+ _("Fs&tab Options..."))
+ )),
+ `VSpacing(0.45),
+ `LeftRadioButton(`id(`do_not_mount), `opt(`notify),
+ _("Do not mount partition"))
+ )
+ )
+ )
+ )
);
+
+ MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help");
+
+ MiniWorkflow::SetLastStep(true);
+
+ symbol widget = nil;
+
+ repeat
+ {
+ widget = (symbol) MiniWorkflow::UserInput();
+
+ if (widget == `crypt_fs)
+ {
+ MiniWorkflow::SetLastStep(UI::QueryWidget(`id(`crypt_fs), `Value) != true);
+ }
+ else if (widget == `fs_options)
+ {
+ FileSystemOptions($[], $[]);
+ }
+ else if (widget == `fstab_options)
+ {
+ FstabOptions($[], $[]);
+ }
+ else if (widget == `do_format)
+ {
+ // can't the UI do that for me?
+ UI::ChangeWidget(`id(`do_format_attachment), `Enabled, true);
+ UI::ChangeWidget(`id(`do_not_format_attachment), `Enabled, false);
+ MiniWorkflow::SetLastStep(UI::QueryWidget(`id(`crypt_fs), `Value) != true);
+ }
+ else if (widget == `do_not_format)
+ {
+ UI::ChangeWidget(`id(`do_format_attachment), `Enabled, false);
+ UI::ChangeWidget(`id(`do_not_format_attachment), `Enabled, true);
+ MiniWorkflow::SetLastStep(true);
+ }
+ else if (widget == `do_mount)
+ {
+ UI::ChangeWidget(`id(`do_mount_attachment), `Enabled, true);
+ }
+ else if (widget == `do_not_mount)
+ {
+ UI::ChangeWidget(`id(`do_mount_attachment), `Enabled, false);
+ }
+ else if (widget == `next)
+ {
+ }
+ }
+ until (widget == `abort || widget == `back || widget == `next);
+
+ if (widget == `next)
+ {
+ }
+
+ y2milestone("MiniWorkflowStepFormatMount data:%1 ret:%2", data, widget);
+
+ return widget;
}
- term FramePassword()
+ symbol MiniWorkflowStepPassword(map &data)
{
- return `Frame(_("Password"),
- `VBox(
- `Password(`id("pw1"),
- // Label: get password for user root
- // Please use newline if label is longer than 40 characters
- _("&Enter a password for your file system:"), ""),
- `Password(`id("pw2"),
- // Label: get same password again for verification
- // Please use newline if label is longer than 40 characters
- _("Reenter the password for &verification:"), "")
- )
+ y2milestone("MiniWorkflowStepPassword data:%1", data);
+
+ integer minpwlen = 8;
+ boolean tmpcrypt = true;
+
+ string label = _("Don't forget what you enter here!");
+ if (tmpcrypt)
+ label = label + "\n" + _("Empty password allowed.");
+
+ term contents = `HVSquash(`Frame(_("Password"),
+ `VBox(
+ `Password(`id(`pw1),
+ // Label: get password for user root
+ // Please use newline if label is longer than 40 characters
+ _("&Enter a password for your file system:"), ""),
+ `Password(`id(`pw2),
+ // Label: get same password again for verification
+ // Please use newline if label is longer than 40 characters
+ _("Reenter the password for &verification:"), ""),
+ `VSpacing(0.5),
+ `Left(`Label(label))
+ )
+ )
);
+
+ MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help");
+
+ MiniWorkflow::SetLastStep(true);
+
+ symbol widget = nil;
+
+ repeat
+ {
+ widget = (symbol) MiniWorkflow::UserInput();
+
+ if (widget == `next)
+ {
+ string pw1 = (string) UI::QueryWidget(`id(`pw1), `Value);
+ string pw2 = (string) UI::QueryWidget(`id(`pw2), `Value);
+
+ if ( pw1 != pw2 )
+ {
+ // popup text
+ Popup::Message(_("The first and the second version\nof the password do not match!\nPlease try again."));
+ widget = `again;
+ }
+ else if( pw1=="" && !tmpcrypt )
+ {
+ // popup text
+ Popup::Message(_("You did not enter a password.
+Try again.
+"));
+ widget = `again;
+ }
+ else if( size(pw1) < minpwlen && !tmpcrypt )
+ {
+ // popup text
+ Popup::Message(sformat(_("The password must have at least %1 characters.
+Try again.
+"), minpwlen));
+ widget = `again;
+ }
+ else if( size(pw1)>=minpwlen || tmpcrypt )
+ {
+ any ret2 = findfirstnotof( pw1, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#* ,.;:._-+!$%&/|\?{[()]}@^\\<>" );
+ if ( ret2 != nil && size(pw1)>0 )
+ {
+ // popup text
+ Popup::Message(_("The password may only contain the following characters:
+0..9, a..z, A..Z, and any of \"@#* ,.;:._-+!$%&/|\?{[()]}^\\<>\".
+Try again."));
+ widget = `again;
+ }
+ }
+ }
+
+ if (widget == `again)
+ {
+ UI::ChangeWidget(`id(`pw1), `Value, "");
+ UI::ChangeWidget(`id(`pw2), `Value, "");
+ }
+ }
+ until (widget == `abort || widget == `back || widget == `next);
+
+ if (widget == `next)
+ {
+ data["password"] = (string) UI::QueryWidget(`id(`pw1), `Value);
+ }
+
+ y2milestone("MiniWorkflowStepPassword data:%1 ret:%2", data, widget);
+
+ return widget;
}
@@ -148,12 +357,12 @@
term content = `Empty();
- if (UI::HasSpecialWidget(`BarGraph) &&
+ if (UI::HasSpecialWidget(`BarGraph) &&
UI::HasSpecialWidget(`Slider))
{
content = `VBox(
`BarGraph(`id(`graph), `opt(`vstretch), [lv_used, total_free] ),
- `Slider(`id(`new_size), `opt(`notify), sformat(_("New Size (in %1)"), unit), vg_min_free,
+ `Slider(`id(`new_size), `opt(`notify), sformat(_("New Size (in %1)"), unit), vg_min_free,
(lv_used + total_free - lv_min_free), lv_used )
);
}
Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp?rev=46396&r1=46395&r2=46396&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp (original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-hd-dialogs.ycp Fri Apr 11 12:53:20 2008
@@ -13,132 +13,71 @@
import "Greasemonkey";
- term FramePartitionType(map possibilities)
- {
+ symbol MiniWorkflowStepPartitionType(map &data)
+ {
+ y2milestone("MiniWorkflowStepPartitionType data:%1", data);
+
+ map possibilities = data["possibilities"]:$[];
+
term tmp = `VBox();
if (possibilities[`primary, `possible]:false)
// radio button text
tmp = add(tmp, `Left(`RadioButton(`id(`primary), _("&Primary Partition"),
- possibilities[`primary, `default]:false)));
+ data["partition_type"]:false)));
if (possibilities[`logical, `possible]:false)
// radio button text
tmp = add(tmp, `Left(`RadioButton(`id(`logical), _("&Logical Partition"),
- possibilities[`logical, `default]:false)));
+ data["partition_type"]:false)));
if (possibilities[`extended, `possible]:false)
// radio button text
tmp = add(tmp, `Left(`RadioButton(`id(`extended), _("&Extended Partition"),
- possibilities[`extended, `default]:false)));
+ data["partition_type"]:false)));
// heading for a frame in a dialog
- return `Frame(_("Partition Type"),
- `RadioButtonGroup(`id(`partition_type), tmp));
- }
+ term contents = `HVSquash(`Frame(_("Partition Type"),
+ `RadioButtonGroup(`id(`partition_type), tmp)));
+ MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "help");
+ MiniWorkflow::SetLastStep(false);
+ symbol widget = nil;
- boolean DlgCreatePartition(map possibilities)
- {
- any StepType()
+ repeat
{
- MiniWorkflow::SetContents(Greasemonkey::Transform(`HVSquash(FramePartitionType(possibilities))),
- "help");
-
- MiniWorkflow::SetLastStep(false);
-
- return MiniWorkflow::UserInput();
+ widget = (symbol) MiniWorkflow::UserInput();
}
+ until (widget == `abort || widget == `back || widget == `next);
- any StepSize()
+ if (widget == `next)
{
- MiniWorkflow::SetContents(Greasemonkey::Transform(`HVSquash(FrameSize(`part))),
- "help");
+ if (UI::QueryWidget(`id(`primary), `Value) == true)
+ data["partition_type"] = `primary;
- MiniWorkflow::SetLastStep(false);
+ if (UI::QueryWidget(`id(`logical), `Value) == true)
+ data["partition_type"] = `logical;
- return MiniWorkflow::UserInput();
+ if (UI::QueryWidget(`id(`extended), `Value) == true)
+ data["partition_type"] = `extended;
}
- any StepFormatMount()
- {
- MiniWorkflow::SetContents(Greasemonkey::Transform(`HVSquash(`VStackFrames(
- FrameFormat(`part),
- FrameMount(`part)
- ))),
- "help");
-
- MiniWorkflow::SetLastStep(true);
-
- any widget = nil;
-
- repeat
- {
- widget = MiniWorkflow::UserInput();
-
- if (widget == `crypt_fs)
- {
- MiniWorkflow::SetLastStep(UI::QueryWidget(`id(`crypt_fs), `Value) != true);
- }
- else if (widget == `fs_options)
- {
- FileSystemOptions($[], $[]);
- }
- else if (widget == `fstab_options)
- {
- FstabOptions($[], $[]);
- }
- else if (widget == `do_format)
- {
- // can't the UI do that for me?
- // some widget RadioButtonWithAttachment (would also obsolete IndentAfterRadioButton)
- UI::ChangeWidget(`id(`huhu1), `Enabled, false);
- UI::ChangeWidget(`id(`huhu2), `Enabled, true);
- }
- else if (widget == `do_not_format)
- {
- UI::ChangeWidget(`id(`huhu1), `Enabled, true);
- UI::ChangeWidget(`id(`huhu2), `Enabled, false);
- }
-
- }
- until (widget == `abort || widget == `back || widget == `next);
-
- if (widget == `next)
- {
- if (UI::QueryWidget(`id(`crypt_fs), `Value) == true)
- return `next;
- else
- return `finish;
- }
-
- return widget;
- }
-
- any StepPassword()
- {
- MiniWorkflow::SetContents(`HVSquash(FramePassword()),
- "help");
-
- MiniWorkflow::SetLastStep(true);
-
- any ret = MiniWorkflow::UserInput();
-
- if (ret == `next)
- return `finish;
+ y2milestone("MiniWorkflowStepPartitionType data:%1 ret:%2", data, widget);
- return ret;
- }
+ return widget;
+ }
+ boolean DlgCreatePartition(map data)
+ {
map