Author: lslezak
Date: Thu Jan 10 15:51:56 2008
New Revision: 43535
URL: http://svn.opensuse.org/viewcvs/yast?rev=43535&view=rev
Log:
- implemented GPG key importing (incl. key file validation)
Modified:
trunk/packager/src/clients/repositories.ycp
trunk/packager/src/include/key_manager_dialogs.ycp
trunk/packager/src/modules/KeyManager.ycp
Modified: trunk/packager/src/clients/repositories.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/repositories.ycp?rev=43535&r1=43534&r2=43535&view=diff
==============================================================================
--- trunk/packager/src/clients/repositories.ycp (original)
+++ trunk/packager/src/clients/repositories.ycp Thu Jan 10 15:51:56 2008
@@ -1065,7 +1065,7 @@
],
"keymgr" : $[
`next : "summary",
- `abort : `abort
+ `abort : "summary"
],
"type" : $[
`next : "edit",
Modified: trunk/packager/src/include/key_manager_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/include/key_manager_dialogs.ycp?rev=43535&r1=43534&r2=43535&view=diff
==============================================================================
--- trunk/packager/src/include/key_manager_dialogs.ycp (original)
+++ trunk/packager/src/include/key_manager_dialogs.ycp Thu Jan 10 15:51:56 2008
@@ -84,7 +84,7 @@
`Left(`Label(sformat(_("Key ID: %1"), key["id"]:""))),
`Left(`Label(sformat(_("Name: %1"), key["name"]:""))),
`VSpacing(0.3),
- `Left(`CheckBox(`id(`trusted), _("&Trusted"), key["trusted"]:false)),
+ `Left(`CheckBox(`id(`trusted), _("&The Key is Trusted"), key["trusted"]:false)),
`VSpacing(0.2)
)
),
@@ -118,16 +118,18 @@
return ret;
}
+// remember the details about the added key from AddGPGKey(),
+// the details are displayed in NewKeySummary()
+map added_key = $[];
+
symbol AddGPGKey()
{
- string filename = "";
-
term contents = `VBox(
`Frame(`id(`fr), _("Select a GPG Key"),
`MarginBox(1, 0.3,
`VBox(
`HBox(
- `TextEntry(`id(`file), Label::FileName(), filename),
+ `TextEntry(`id(`file), Label::FileName()),
`VBox(
`Label(""),
`PushButton(`id(`browse), Label::BrowseButton())
@@ -150,17 +152,10 @@
help_text = help_text + _("<p>
<b>Adding a New GPG Key</b><br>
-To add a new GPG key, use <b>Add</b> and specify the path to the key file.
+To add a new GPG key specify the path to the key file.
+Check the <B>Trusted</B> check box if the key is trusted.
</p>");
- // help, continued
- help_text = help_text + _("<p>
-<b>Modifying a GPG Key Status</b>
-To modify the trusted flag, use <b>Edit</b>. To remove a GPG key, use
-<b>Delete</b>.
-</p>
-");
-
Wizard::SetNextButton(`next, Label::OKButton());
Wizard::SetContents(title, contents, help_text, true, true);
@@ -183,12 +178,25 @@
}
else if (ret == `next)
{
- // TODO: validate the entered file
+ // validate the entered file
+ string keyfile = (string) UI::QueryWidget(`id(`file), `Value);
+ y2internal("Entered: %1", keyfile);
- boolean trusted = (boolean) UI::QueryWidget(`id(`trusted), `Value);
+ if (keyfile == nil || keyfile == "")
+ {
+ Report::Error(_("Enter a filename"));
+ UI::SetFocus(`id(`file));
+ ret = `_dummy;
+ continue;
+ }
- // TODO: add the key
+ boolean trusted = (boolean) UI::QueryWidget(`id(`trusted), `Value);
+ added_key = KeyManager::ImportFromFile(keyfile, trusted);
+ if (added_key == nil || size(added_key) == 0)
+ {
+ ret = `_dummy;
+ }
}
}
@@ -199,6 +207,13 @@
return ret;
}
+// display details about the imported GPG key
+symbol NewKeySummary()
+{
+ // TODO FIXME
+ return `next;
+}
+
symbol KeySummary()
{
@@ -296,7 +311,8 @@
map aliases = $[
"summary" : ``(KeySummary()),
- "add" : [``(AddGPGKey()), true ]
+ "add" : [``(AddGPGKey()), true ],
+ "new_key_summary" : [``(NewKeySummary()), true ]
];
map sequence = $[
@@ -307,6 +323,10 @@
`add : "add"
],
"add" : $[
+ `next : "new_key_summary",
+ `abort : `abort
+ ],
+ "new_key_summary" : $[
`next : "summary",
`abort : `abort
]
Modified: trunk/packager/src/modules/KeyManager.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/KeyManager.ycp?rev=43535&r1=43534&r2=43535&view=diff
==============================================================================
--- trunk/packager/src/modules/KeyManager.ycp (original)
+++ trunk/packager/src/modules/KeyManager.ycp Thu Jan 10 15:51:56 2008
@@ -13,6 +13,10 @@
textdomain "packager";
module "KeyManager";
+import "Report";
+import "Directory";
+import "String";
+
// the current state
list