Fix some issues related to MobileOrg encryption

* lisp/org-mobile.el (org-mobile-copy-agenda-files): Encrypt the empty file.
(org-mobile-write-agenda-for-mobile): Use the right name, even if the
file get encrypted.
(org-mobile-move-capture): Only delete tempfile if it does exist.
This commit is contained in:
Carsten Dominik 2010-10-08 09:27:43 +02:00
parent d9e4469c1c
commit f1960677de
1 changed files with 7 additions and 3 deletions

View File

@ -476,7 +476,10 @@ agenda view showing the flagged items."
(and (= (point-min) (point-max)) (insert "\n"))
(save-buffer)
(push (cons org-mobile-capture-file (md5 (buffer-string)))
org-mobile-checksum-files))
org-mobile-checksum-files)
(when org-mobile-use-encryption
(write-file org-mobile-encryption-tempfile)
(org-mobile-encrypt-and-move org-mobile-encryption-tempfile file)))
(kill-buffer buf)))
(defun org-mobile-write-checksums ()
@ -627,7 +630,7 @@ The table of checksums is written to the file mobile-checksums."
(insert " :PROPERTIES:\n :ORIGINAL_ID: " id
"\n :END:\n")))))
(beginning-of-line 2))
(push (cons (file-name-nondirectory file) (md5 (buffer-string)))
(push (cons "agendas.org" (md5 (buffer-string)))
org-mobile-checksum-files))
(message "Agenda written to Org file %s" file)))
@ -692,7 +695,8 @@ If nothing new has been added, return nil."
(capture-buffer
(if (not org-mobile-use-encryption)
(find-file-noselect capture-file)
(delete-file org-mobile-encryption-tempfile)
(if (file-exists-p org-mobile-encryption-tempfile)
(delete-file org-mobile-encryption-tempfile))
(setq encfile (concat org-mobile-encryption-tempfile "_enc"))
(copy-file capture-file encfile)
(org-mobile-decrypt-file encfile org-mobile-encryption-tempfile)