Mailinglist Archive: yast-commit (870 mails)

< Previous Next >
[yast-commit] r49272 - in /branches/tmp/aschnell/part-redesign/storage/src/include: ep-loop-dialogs.ycp ep-loop-lib.ycp
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Mon, 21 Jul 2008 12:29:22 -0000
  • Message-id: <20080721122922.897D127490@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Mon Jul 21 14:29:22 2008
New Revision: 49272

URL: http://svn.opensuse.org/viewcvs/yast?rev=49272&view=rev
Log:
- work on creating crypt files

Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-dialogs.ycp
branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-lib.ycp

Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-dialogs.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-dialogs.ycp?rev=49272&r1=49271&r2=49272&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-dialogs.ycp
(original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-dialogs.ycp
Mon Jul 21 14:29:22 2008
@@ -8,10 +8,121 @@
textdomain "storage";


+ symbol MiniWorkflowStepLoopNameSize(map<string, any> &data)
+ {
+ y2milestone("MiniWorkflowStepLoopNameSize data:%1", data);
+
+ integer min_size_k = 1024;
+ integer size_k = data["size_k"]:(50 * 1024);
+ string fpath = data["fpath"]:"";
+ boolean create_file = data["create_file"]:false;
+
+ term contents = `HVSquash(
+ `VBox(
+ `InputField(`id(`fpath), _("Path Name of Loop File"), fpath),
+ Mode::normal() ? `Left(`PushButton(`id(`browse),
_("Browse..."))) : `Empty(),
+ `VSpacing(0.75),
+ `LeftCheckBoxWithAttachment(`id(`create_file), `opt(`notify),
_("Create Loop File"),
+ `MinWidth(15,
`InputField(`id(`size), `opt(`shrinkable), _("Size"),
+
Storage::KByteToHumanString(size_k))))
+ )
+ );
+
+ MiniWorkflow::SetContents(Greasemonkey::Transform(contents), "TODO
help");
+ MiniWorkflow::SetLastStep(false);
+
+ UI::ChangeWidget(`id(`create_file), `Value, create_file);
+ UI::ChangeWidget(`id(`size), `Enabled, create_file);
+
+ symbol widget = nil;
+
+ repeat
+ {
+ widget = MiniWorkflow::UserInput();
+
+ switch (widget)
+ {
+ case `browse:
+ string tmp = UI::AskForExistingFile("/", "*", "");
+ if (tmp != nil)
+ fpath = tmp;
+ UI::ChangeWidget(`id(`fpath), `Value, fpath);
+
+ // TODO: file existence -> set create
+
+ break;
+
+ case `create_file:
+ create_file = (boolean) UI::QueryWidget(`id(`create_file),
`Value);
+ UI::ChangeWidget(`id(`size), `Enabled, create_file);
+ break;
+
+ case `next:
+ fpath = (string) UI::QueryWidget(`id(`fpath), `Value);
+
+ if (create_file)
+ {
+ string tmp = (string) UI::QueryWidget(`id(`size),
`Value);
+ if (!Storage::HumanStringToKByte(tmp, size_k))
+ {
+ Error(_("The size entered is invalid. Enter a value
like \"500MB\" or \"1GB\"."));
+ widget = `again;
+ }
+ else if (size_k < min_size_k)
+ {
+ Error(sformat(_("The size entered is invalid. Enter
a size above %1."),
+
Storage::KByteToHumanString(min_size_k)));
+ widget = `again;
+ }
+ }
+
+ // TODO checks
+
+ break;
+ }
+ }
+ until (widget == `abort || widget == `back || widget == `next);
+
+ if (widget == `next)
+ {
+ data["fpath"] = fpath;
+ data["create_file"] = create_file;
+ data["size_k"] = size_k;
+ }
+
+ y2milestone("MiniWorkflowStepLoopNameSize data:%1 ret:%2", data,
widget);
+
+ return widget;
+ }
+
+
+ boolean DlgCreateLoop(map<string, any> &data)
+ {
+ map<string, any> aliases = $[
+ "NameSize" : ``(MiniWorkflowStepLoopNameSize(data)),
+ "FormatMount" : ``(MiniWorkflowStepFormatMount(data)),
+ "Password" : ``(MiniWorkflowStepPassword(data))
+ ];
+
+ map<string, any> sequence = $[
+ "NameSize" : $[ `next : "FormatMount" ],
+ "FormatMount" : $[ `next : "Password",
+ `finish : `finish ],
+ "Password" : $[ `finish : `finish ]
+ ];
+
+ string title = _("Add Crypt File");
+
+ symbol widget = MiniWorkflow::Run(title, lvm_lv_icon, aliases,
sequence, "NameSize");
+
+ return widget == `finish;
+ }
+
+
boolean DlgEditLoop(map<string, any> &data)
{
string device = data["device"]:"error";
-
+
map<string, any> aliases = $[
"FormatMount" : ``(MiniWorkflowStepFormatMount(data)),
"Password" : ``(MiniWorkflowStepPassword(data))

Modified:
branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-lib.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-lib.ycp?rev=49272&r1=49271&r2=49272&view=diff
==============================================================================
--- branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-lib.ycp
(original)
+++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-loop-lib.ycp Mon
Jul 21 14:29:22 2008
@@ -10,11 +10,32 @@

void EpCreateLoop()
{
+ map<string, any> data = $[ "new" : true,
+ "create" : true ];
+
+ if (DlgCreateLoop(data))
+ {
+ Debug("create loop from data", data);
+
+ // TODO
+
+ Storage::ChangeVolumeProperties(data);
+
+ UpdateNavigationTree(nil);
+ TreePanel::Create();
+ UpdateTableFocus(data["device"]:"error");
+ }
}


void EpEditLoop(string device)
{
+ if (device == nil)
+ {
+ Error(_("No crypt file selected."));
+ return;
+ }
+
map<string, map> target_map = Storage::GetTargetMap();
map<string, any> data = Storage::GetPartition(target_map, device);

@@ -42,7 +63,7 @@
{
if (device == nil)
{
- Error(_("No Crypt File selected."));
+ Error(_("No crypt file selected."));
return;
}


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

< Previous Next >
This Thread
  • No further messages