Author: aschnell Date: Mon Jul 27 17:42:43 2009 New Revision: 58178 URL: http://svn.opensuse.org/viewcvs/yast?rev=58178&view=rev Log: - work on proposal UI for lvm encryption Modified: trunk/storage/VERSION trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/custom_part_dialogs.ycp trunk/storage/storage/src/inst_disk_proposal.ycp trunk/storage/storage/src/inst_target_part.ycp Modified: trunk/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=58178&r1=58177&r2=58178&view=diff ============================================================================== --- trunk/storage/VERSION (original) +++ trunk/storage/VERSION Mon Jul 27 17:42:43 2009 @@ -1 +1 @@ -2.18.16 +2.18.17 Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=58178&r1=58177&r2=58178&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Mon Jul 27 17:42:43 2009 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Jul 27 17:41:31 CEST 2009 - aschnell@suse.de + +- work on proposal UI for LVM encryption (fate #305633) +- 2.18.17 + +------------------------------------------------------------------- Thu Jul 23 17:15:51 CEST 2009 - aschnell@suse.de - allow user to ignore some consistency checks respecting manual Modified: trunk/storage/storage/src/include/custom_part_dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/custom_part_dialogs.ycp?rev=58178&r1=58177&r2=58178&view=diff ============================================================================== --- trunk/storage/storage/src/include/custom_part_dialogs.ycp (original) +++ trunk/storage/storage/src/include/custom_part_dialogs.ycp Mon Jul 27 17:42:43 2009 @@ -30,6 +30,7 @@ import "Arch"; import "Label"; import "Popup"; + import "StorageProposal"; include "partitioning/custom_part_helptexts.ycp"; @@ -99,10 +100,8 @@ `HSpacing(4) ), `VSpacing(3), - `HBox( - // Ok button + `ButtonBox( `PushButton(`id("ok"), `opt(`default), Label::OKButton()), - // Cancel button `PushButton(`id("cancel"), Label::CancelButton()) ), `VSpacing(0.5) @@ -110,75 +109,114 @@ ) )); - string ret = ""; - boolean input_is_ok = false; - string pw1 = ""; - string pw2 = ""; + string password = ""; + symbol widget = nil; repeat { // Clear password fields on every round. - UI::ChangeWidget(`id("pw1"), `Value, ""); - UI::ChangeWidget(`id("pw2"), `Value, ""); - - UI::SetFocus(`id("pw1")); + UI::ChangeWidget(`id(`pw1), `Value, ""); + UI::ChangeWidget(`id(`pw2), `Value, ""); - ret = (string) UI::UserInput(); + UI::SetFocus(`id(`pw1)); + widget = (symbol) UI::UserInput(); - if (ret != "cancel") + switch (widget) { - pw1 = (string)UI::QueryWidget(`id("pw1"), `Value); - pw2 = (string)UI::QueryWidget(`id("pw2"), `Value); + case `ok: - if ( pw1 != pw2 ) - { - // popup text - Popup::Message(_("The first and the second version\nof the password do not match!\nPlease try again.")); + password = (string) UI::QueryWidget(`id(`pw1), `Value); + string tmp = (string) UI::QueryWidget(`id(`pw2), `Value); + + if (!Storage::CheckEncryptionPasswords(password, tmp, minpwlen, tmpcrypt)) + widget = `again; + + break; } - else if( pw1=="" && !tmpcrypt ) + + } until (widget == `cancel || widget == `ok); + + UI::CloseDialog(); + + if (widget == `ok) { - // popup text - Popup::Message(_("You did not enter a password. -Try again. -")); + return password; } - else if( size(pw1) < minpwlen && !tmpcrypt ) + else { - // popup text - Popup::Message(sformat(_("The password must have at least %1 characters. -Try again. -"),minpwlen)); + return ""; } - else if( size(pw1)>=minpwlen || tmpcrypt ) + } + + + boolean QueryProposalPassword() { - any ret2 = findfirstnotof( pw1, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#* ,.;:._-+!$%&/|\?{[()]}@^\\<>" ); - if ( ret2 != nil && size(pw1)>0 ) + if (!isempty(StorageProposal::GetProposalPassword())) + return true; + + UI::OpenDialog(`VBox( + `Label(_("Enter your password for the proposal encryption.")), + `MinWidth(40, + `Password(`id(`pw1), + // Label: get password for user root + // Please use newline if label is longer than 40 characters + _("Password:"), "")), + `VSpacing(0.5), + `MinWidth(40, + `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:"), "")), + `Label(_("Don't forget what you enter here!")), + `ButtonBox( + `PushButton(`id(`ok), `opt(`default), Label::OKButton()), + `PushButton(`id(`cancel), Label::CancelButton()) + ) + )); + + string password = ""; + symbol widget = nil; + + repeat { - // popup text - Popup::Message(_("The password may only contain the following characters: - 0..9, a..z, A..Z, and any of \"@#* ,.;:._-+!$%&/|\?{[()]}^\\<>\". -Try again.")); - } - else + // Clear password fields on every round. + UI::ChangeWidget(`id(`pw1), `Value, ""); + UI::ChangeWidget(`id(`pw2), `Value, ""); + + UI::SetFocus(`id(`pw1)); + + widget = (symbol) UI::UserInput(); + + switch (widget) { - input_is_ok = true; + case `ok: + + password = (string) UI::QueryWidget(`id(`pw1), `Value); + string tmp = (string) UI::QueryWidget(`id(`pw2), `Value); + + if (!Storage::CheckEncryptionPasswords(password, tmp, 8, false)) + widget = `again; + + break; } - } - } - } until ( input_is_ok || ret == "cancel" ); + } until (widget == `cancel || widget == `ok); UI::CloseDialog(); - if (ret == "cancel") + if (widget == `ok) { - pw1 = ""; + StorageProposal::SetProposalPassword(password); + return true; } - y2milestone( "DlgCreateCryptFs size(ret):%1", size(pw1) ); - return( pw1 ); + else + { + return false; } + } + ////////////////////////////////////////////////////////////////////////////// // Dialog Password for Crypted FS Update @@ -1479,5 +1517,4 @@ return(go_on); }; - } Modified: trunk/storage/storage/src/inst_disk_proposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_disk_proposal.ycp?rev=58178&r1=58177&r2=58178&view=diff ============================================================================== --- trunk/storage/storage/src/inst_disk_proposal.ycp (original) +++ trunk/storage/storage/src/inst_disk_proposal.ycp Mon Jul 27 17:42:43 2009 @@ -34,6 +34,9 @@ import "Stage"; + include "partitioning/custom_part_dialogs.ycp"; + + define boolean AskOverwriteChanges() ``{ boolean ret = true; @@ -282,8 +285,23 @@ break; case `encrypt: - StorageProposal::SetProposalEncrypt((boolean) UI::QueryWidget(`id(`encrypt), `Value)); - StorageProposal::SetProposalPassword("12345678"); // TODO + + if ((boolean) UI::QueryWidget(`id(`encrypt), `Value)) + { + if (QueryProposalPassword()) + { + StorageProposal::SetProposalEncrypt(true); + } + else + { + UI::ChangeWidget(`id(`encrypt), `Value, false); + continue; + } + } + else + { + StorageProposal::SetProposalEncrypt(false); + } break; } @@ -339,12 +357,13 @@ UI::ChangeWidget( `id("richtext"), `Value, changes ); if( ret==`detailed ) { - if( StorageProposal::GetProposalLvm() ) - UI::ChangeWidget( `id("prop_mode"), `CurrentButton, `lvm ); - else - UI::ChangeWidget( `id("prop_mode"), `CurrentButton, `part ); + UI::ChangeWidget(`id(`part), `Value, !StorageProposal::GetProposalLvm()); + UI::ChangeWidget(`id(`lvm), `Value, StorageProposal::GetProposalLvm()); + UI::ChangeWidget(`id(`encrypt), `Enabled, StorageProposal::GetProposalLvm()); + UI::ChangeWidget(`id(`encrypt), `Value, StorageProposal::GetProposalEncrypt()); } } + } until ( ret == `next || ret == `back || ret == `cancel ); } Storage::SaveExitKey( ret ); Modified: trunk/storage/storage/src/inst_target_part.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_target_part.ycp?rev=58178&r1=58177&r2=58178&view=diff ============================================================================== --- trunk/storage/storage/src/inst_target_part.ycp (original) +++ trunk/storage/storage/src/inst_target_part.ycp Mon Jul 27 17:42:43 2009 @@ -55,6 +55,7 @@ include "partitioning/auto_part_prepare.ycp"; include "partitioning/auto_part_ui.ycp"; include "partitioning/auto_part_create.ycp"; + include "partitioning/custom_part_dialogs.ycp"; // Displays a popup with the message (can be dismissed with OK). // After that only `abort or `back is allowed @@ -228,12 +229,18 @@ { break; } - else if (ret == `lvm) { UI::ChangeWidget(`id(`encrypt), `Enabled, (boolean) UI::QueryWidget(`id(`lvm), `Value)); } - + else if (ret == `encrypt) + { + if ((boolean) UI::QueryWidget(`id(`encrypt), `Value)) + { + if (!QueryProposalPassword()) + UI::ChangeWidget(`id(`encrypt), `Value, false); + } + } else if (ret == `full) { // Set all checkboxes @@ -398,20 +405,15 @@ y2milestone ("partitions '%1'", partitions); - // Check selection for plausability - string reason = nil; StorageProposal::SetProposalHome( (boolean)UI::QueryWidget( `id(`home), `Value )); - if( (boolean)UI::QueryWidget( `id(`lvm), `Value )==true ) - StorageProposal::SetProposalLvm(true); - else - StorageProposal::SetProposalLvm(false); + StorageProposal::SetProposalLvm((boolean) UI::QueryWidget(`id(`lvm), `Value)); StorageProposal::SetProposalEncrypt((boolean) UI::QueryWidget(`id(`encrypt), `Value)); - StorageProposal::SetProposalPassword("12345678"); // TODO + ok = create_partitions( targetMap, target, partitions ); StorageProposal::SetProposalDefault(true); if( !ok ) { - reason = _("Too few partitions are marked for removal + string reason = _("Too few partitions are marked for removal or the disk is too small. To install Linux, select more partitions to remove or select a larger disk."); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org