summaryrefslogtreecommitdiff
path: root/source/settings/SettingsJob.mc
diff options
context:
space:
mode:
Diffstat (limited to 'source/settings/SettingsJob.mc')
-rw-r--r--source/settings/SettingsJob.mc27
1 files changed, 17 insertions, 10 deletions
diff --git a/source/settings/SettingsJob.mc b/source/settings/SettingsJob.mc
index e6e7bcf..2fc4a3d 100644
--- a/source/settings/SettingsJob.mc
+++ b/source/settings/SettingsJob.mc
@@ -105,24 +105,31 @@ class SettingsJob extends Jobs.Job {
endImport(["Import: waiting import cancelled."] as Array<String>, "Waiting import cancelled", false);
return;
}
- var content = new Forms.Content("import");
- content.add(importMode);
- content.add(locked);
- var text = "";
- for (var i = 1; i <= IMPORT_TEXT_FIELDS; i++) {
- var part = Forms.rawText(_store, "impText" + i);
- content.add(part);
- text += part;
- }
- _hash = Forms.hash(_vault, content);
+ _hash = importHash(importMode, locked);
if (Forms.alreadyApplied(_vault, _hash)) {
endImport(["Import: already applied. Change the text to import again."] as Array<String>, "Already imported", true);
return;
}
+ var text = "";
+ for (var i = 1; i <= IMPORT_TEXT_FIELDS; i++) {
+ text += Forms.rawText(_store, "impText" + i);
+ }
_importStart = System.getTimer();
_importer = new Importer(_vault, text, importMode, locked, _now);
}
+ // The import form's hash. Its own function, so the field bytes it hashes
+ // are freed before the importer makes its copy of the text.
+ private function importHash(importMode as Number, locked as Boolean) as String {
+ var content = new Forms.Content("import");
+ content.add(importMode);
+ content.add(locked);
+ for (var i = 1; i <= IMPORT_TEXT_FIELDS; i++) {
+ content.add(Forms.rawText(_store, "impText" + i));
+ }
+ return Forms.hash(_vault, content);
+ }
+
private function finishImport(importer as Importer) as Void {
_importer = null;
var report = importer.report;