linux setup: implement UI for encryption

This commit is contained in:
Hylke Bons 2012-05-21 00:57:17 +01:00
parent f206f44ba3
commit 791bea386e
3 changed files with 173 additions and 7 deletions

View file

@ -433,7 +433,7 @@ namespace SparkleShare {
(this.progress_bar.Parent as Container).Remove (this.progress_bar);
VBox bar_wrapper = new VBox (false, 0);
bar_wrapper.PackStart (this.progress_bar, false, false, 0);
bar_wrapper.PackStart (this.progress_bar, false, false, 15);
Add (bar_wrapper);
@ -509,7 +509,172 @@ namespace SparkleShare {
break;
}
case PageType.CryptoSetup: {
Header = "Set up file encryption";
Description = "This project is supposed to be encrypted, but it doesn't yet have a password set. Please provide one below.";
Label password_label = new Label ("<b>" + _("Password:") + "</b>") {
UseMarkup = true,
Xalign = 1
};
Entry password_entry = new Entry () {
Xalign = 0,
Visibility = false
};
CheckButton show_password_check_button = new CheckButton ("Show password") {
Active = false,
Xalign = 0
};
show_password_check_button.Toggled += delegate {
password_entry.Visibility = !password_entry.Visibility;
};
password_entry.Changed += delegate {
Controller.CheckCryptoSetupPage (password_entry.Text);
};
Button continue_button = new Button ("Continue") {
Sensitive = false
};
continue_button.Clicked += delegate {
Controller.CryptoSetupPageCompleted (password_entry.Text);
};
Button cancel_button = new Button ("Cancel");
cancel_button.Clicked += delegate {
Controller.CryptoPageCancelled ();
};
Controller.UpdateCryptoSetupContinueButtonEvent += delegate (bool button_enabled) {
Application.Invoke (delegate {
continue_button.Sensitive = button_enabled;
});
};
Table table = new Table (2, 3, true) {
RowSpacing = 6,
ColumnSpacing = 6
};
table.Attach (password_label, 0, 1, 0, 1);
table.Attach (password_entry, 1, 2, 0, 1);
table.Attach (show_password_check_button, 1, 2, 1, 2);
VBox wrapper = new VBox (false, 9);
wrapper.PackStart (table, true, false, 0);
Image warning_image = new Image (
SparkleUIHelpers.GetIcon ("dialog-information", 24)
);
Label warning_label = new Label () {
Xalign = 0,
Wrap = true,
Text = "This password can't be changed later, and your files can't be recovered if it's forgotten."
};
HBox warning_layout = new HBox (false, 0);
warning_layout.PackStart (warning_image, false, false, 15);
warning_layout.PackStart (warning_label, true, true, 0);
VBox warning_wrapper = new VBox (false, 0);
warning_wrapper.PackStart (warning_layout, false, false, 15);
wrapper.PackStart (warning_wrapper, false, false, 0);
Add (wrapper);
AddButton (cancel_button);
AddButton (continue_button);
break;
}
case PageType.CryptoPassword: {
Header = "This project contains encrypted files";
Description = "Please enter the password to see their contents.";
Label password_label = new Label ("<b>" + _("Password:") + "</b>") {
UseMarkup = true,
Xalign = 1
};
Entry password_entry = new Entry () {
Xalign = 0,
Visibility = false
};
CheckButton show_password_check_button = new CheckButton ("Show password") {
Active = false,
Xalign = 0
};
show_password_check_button.Toggled += delegate {
password_entry.Visibility = !password_entry.Visibility;
};
password_entry.Changed += delegate {
Controller.CheckCryptoPasswordPage (password_entry.Text);
};
Button continue_button = new Button ("Continue") {
Sensitive = false
};
continue_button.Clicked += delegate {
Controller.CryptoPasswordPageCompleted (password_entry.Text);
};
Button cancel_button = new Button ("Cancel");
cancel_button.Clicked += delegate {
Controller.CryptoPageCancelled ();
};
Controller.UpdateCryptoPasswordContinueButtonEvent += delegate (bool button_enabled) {
Application.Invoke (delegate {
continue_button.Sensitive = button_enabled;
});
};
Table table = new Table (2, 3, true) {
RowSpacing = 6,
ColumnSpacing = 6
};
table.Attach (password_label, 0, 1, 0, 1);
table.Attach (password_entry, 1, 2, 0, 1);
table.Attach (show_password_check_button, 1, 2, 1, 2);
VBox wrapper = new VBox (false, 9);
wrapper.PackStart (table, true, false, 0);
Add (wrapper);
AddButton (cancel_button);
AddButton (continue_button);
break;
}
case PageType.Finished: {
UrgencyHint = true;
@ -540,7 +705,7 @@ namespace SparkleShare {
if (warnings.Length > 0) {
Image warning_image = new Image (
SparkleUIHelpers.GetIcon ("dialog-info", 24)
SparkleUIHelpers.GetIcon ("dialog-information", 24)
);
Label warning_label = new Label (warnings [0]) {
@ -549,8 +714,8 @@ namespace SparkleShare {
};
HBox warning_layout = new HBox (false, 0);
warning_layout.PackStart (warning_image, false, false, 0);
warning_layout.PackStart (warning_label, true, true, 15);
warning_layout.PackStart (warning_image, false, false, 15);
warning_layout.PackStart (warning_label, true, true, 0);
VBox warning_wrapper = new VBox (false, 0);
warning_wrapper.PackStart (warning_layout, false, false, 0);

View file

@ -146,9 +146,10 @@ namespace SparkleShare {
if (!string.IsNullOrEmpty (Description)) {
Label description = new Label (Description) {
Xalign = 0,
Wrap = true
LineWrap = true,
LineWrapMode = Pango.WrapMode.WordChar
};
layout_vertical.PackStart (description, false, false, 21);
}

View file

@ -610,7 +610,7 @@ namespace SparkleShare {
case PageType.CryptoSetup: {
Header = "Set up file encryption";
Description = "This project is supposed to be encrypted, but it doesn't yet have a password set. Please provide a password below:";
Description = "This project is supposed to be encrypted, but it doesn't yet have a password set. Please provide one below:";
PasswordLabel = new NSTextField () {