Author: lslezak
Date: Mon Jan 14 14:46:18 2008
New Revision: 43579
URL: http://svn.opensuse.org/viewcvs/yast?rev=43579&view=rev
Log:
- GPG key manager: display details of the selected key to import,
import the keys at Write()
Modified:
trunk/packager/src/include/key_manager_dialogs.ycp
trunk/packager/src/modules/KeyManager.ycp
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=43579&r1=43578&r2=43579&view=diff
==============================================================================
--- trunk/packager/src/include/key_manager_dialogs.ycp (original)
+++ trunk/packager/src/include/key_manager_dialogs.ycp Mon Jan 14 14:46:18 2008
@@ -18,6 +18,7 @@
import "Popup";
import "KeyManager";
import "String";
+import "FileUtils";
boolean gpg_mgr_standalone_mode = false;
@@ -156,6 +157,25 @@
// the details are displayed in NewKeySummary()
map added_key = $[];
+void refreshNewKeyDetails(string file)
+{
+ map key = $[];
+
+ // at first check whether the file exists at all
+ if (FileUtils::Exists(file))
+ {
+ // check whether the file contains a valid GPG key
+ key = Pkg::CheckGPGKeyFile(file);
+ y2milestone("File content: %1", key);
+ }
+
+ UI::ChangeWidget(`id(`key_id), `Value, key["id"]:"");
+ UI::ChangeWidget(`id(`key_name), `Value, key["name"]:"");
+ UI::ChangeWidget(`id(`key_fp), `Value, key["fingerprint"]:"");
+ UI::ChangeWidget(`id(`key_creadted), `Value, key["created"]:"");
+ UI::ChangeWidget(`id(`key_expires), `Value, key["expires"]:"");
+}
+
/**
* Display a dialog for adding a GPG key
*/
@@ -166,7 +186,7 @@
`MarginBox(1, 0.3,
`VBox(
`HBox(
- `TextEntry(`id(`file), Label::FileName()),
+ `TextEntry(`id(`file), `opt(`notify,`immediate), Label::FileName()),
`VBox(
`Label(""),
`PushButton(`id(`browse), Label::BrowseButton())
@@ -177,6 +197,29 @@
`VSpacing(0.3)
)
)
+ ),
+ `VSpacing(1),
+ `Frame(_("Properties of the GPG Key"),
+ `MarginBox(1, 0.3,
+ `HBox(
+ `HSquash(
+ `VBox(
+ `Left(`Label(_("Key ID: "))),
+ `Left(`Label(_("Name: "))),
+ `Left(`Label(_("Finger Print: "))),
+ `Left(`Label(_("Created: "))),
+ `Left(`Label(_("Expires: ")))
+ )
+ ),
+ `VBox(
+ `Label(`id(`key_id), `opt(`hstretch), ""),
+ `Label(`id(`key_name), `opt(`hstretch), ""),
+ `Label(`id(`key_fp), `opt(`hstretch), ""),
+ `Label(`id(`key_creadted), `opt(`hstretch), ""),
+ `Label(`id(`key_expires), `opt(`hstretch), "")
+ )
+ )
+ )
)
);
@@ -202,22 +245,34 @@
{
ret = (symbol) UI::UserInput();
+ y2debug("UserInput: %1", ret);
+
if (ret == `browse)
{
string currentfile = (string) UI::QueryWidget(`id(`file), `Value);
// header in file selection popup
- string newfile = (string) UI::AskForExistingFile(currentfile, "*", _("Select the GPG Key To Import"));
+ string newfile = (string) UI::AskForExistingFile(currentfile, "*", _("Select a GPG Key To Import"));
if (newfile != nil)
{
UI::ChangeWidget(`id(`file), `Value, newfile);
+ refreshNewKeyDetails(newfile);
}
}
+ else if (ret == `file)
+ {
+ string keyfile = (string) UI::QueryWidget(`id(`file), `Value);
+
+ y2debug("The file has changed: %1", keyfile);
+
+ // refresh the information
+ refreshNewKeyDetails(keyfile);
+ }
else if (ret == `next)
{
// validate the entered file
string keyfile = (string) UI::QueryWidget(`id(`file), `Value);
- y2internal("Entered: %1", keyfile);
+ y2milestone("Selected file: %1", keyfile);
if (keyfile == nil || keyfile == "")
{
@@ -329,7 +384,15 @@
'%2'?"), key_id, key["name"]:"")))
{
KeyManager::DeleteKey(key_id);
+ // refresh the table
SetItems(nil);
+
+ // hack - refresh (clear) the rich text part of the dialog
+ // TODO: fix a bug in WizardHW?
+ if (size(KeyManager::GetKeys()) == 0)
+ {
+ SetItems("");
+ }
}
}
}
@@ -347,8 +410,7 @@
map aliases = $[
"summary" : ``(KeySummary()),
- "add" : [``(AddGPGKey()), true ],
- "new_key_summary" : [``(NewKeySummary()), true ]
+ "add" : [``(AddGPGKey()), true ]
];
map sequence = $[
@@ -359,10 +421,6 @@
`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=43579&r1=43578&r2=43579&view=diff
==============================================================================
--- trunk/packager/src/modules/KeyManager.ycp (original)
+++ trunk/packager/src/modules/KeyManager.ycp Mon Jan 14 14:46:18 2008
@@ -23,8 +23,8 @@
// keys to delete
list