Compare commits
1 Enmetoj
205576d973
...
a1d2314b77
Author | SHA1 | Date | |
---|---|---|---|
Jaidyn Ann | a1d2314b77 |
33
contact.scm
33
contact.scm
|
@ -25,6 +25,7 @@
|
||||||
(chicken string)
|
(chicken string)
|
||||||
(chicken time)
|
(chicken time)
|
||||||
(srfi 1)
|
(srfi 1)
|
||||||
|
(srfi 4)
|
||||||
(srfi 13)
|
(srfi 13)
|
||||||
(srfi 18)
|
(srfi 18)
|
||||||
(prefix getopt-long getopt:)
|
(prefix getopt-long getopt:)
|
||||||
|
@ -209,7 +210,7 @@
|
||||||
;; fields.
|
;; fields.
|
||||||
(define property->formname-alist
|
(define property->formname-alist
|
||||||
'((FN . "name")
|
'((FN . "name")
|
||||||
(ADR . "address")
|
;; (ADR . "address")
|
||||||
(TEL . "homePhone")
|
(TEL . "homePhone")
|
||||||
(TEL . "workPhone")
|
(TEL . "workPhone")
|
||||||
(EMAIL . "eMail")
|
(EMAIL . "eMail")
|
||||||
|
@ -227,9 +228,35 @@
|
||||||
(let* [(formname (alist-ref (car property) property->formname-alist))
|
(let* [(formname (alist-ref (car property) property->formname-alist))
|
||||||
(lineEditName (conc formname "LineEdit"))
|
(lineEditName (conc formname "LineEdit"))
|
||||||
(lineEditWidget (if formname (qt:find window lineEditName) #f))]
|
(lineEditWidget (if formname (qt:find window lineEditName) #f))]
|
||||||
(if lineEditWidget
|
(cond
|
||||||
(set! (qt:property lineEditWidget "text") (last property)))))
|
[lineEditWidget
|
||||||
|
(set! (qt:property lineEditWidget "text") (last property))]
|
||||||
|
[(and (eq? (car property) 'PHOTO)
|
||||||
|
(list? (last property)))
|
||||||
|
(let* [(avatar (qt:find window "avatarLabel"))
|
||||||
|
(old-pixmap (if avatar (qt:property avatar "pixmap")))
|
||||||
|
[new-pixmap (if avatar (u8vector->pixmap (cadr (last property))))]]
|
||||||
|
(when avatar
|
||||||
|
(set! (qt:property avatar "pixmap") new-pixmap)
|
||||||
|
(qt:delete old-pixmap)))])))
|
||||||
vcard-alist))
|
vcard-alist))
|
||||||
|
|
||||||
|
|
||||||
|
;; Given a image bytevector (u8vector), create a corresponding pixmap.
|
||||||
|
(define (u8vector->pixmap vector)
|
||||||
|
(let* ([temp-file (write-temporary-file vector)]
|
||||||
|
[pixmap (qt:pixmap temp-file)])
|
||||||
|
(delete-file* temp-file)
|
||||||
|
pixmap))
|
||||||
|
|
||||||
|
|
||||||
|
;; Given a u8vector for file-contents, create a tempory file and write the
|
||||||
|
;; contents to it. Returns the pathname.
|
||||||
|
(define (write-temporary-file u8vector-contents)
|
||||||
|
(let [(temp-file (create-temporary-file))]
|
||||||
|
(with-output-to-file temp-file
|
||||||
|
(lambda () (map write-byte (u8vector->list u8vector-contents))))
|
||||||
|
temp-file))
|
||||||
|
|
||||||
|
|
||||||
(init)
|
(init)
|
||||||
|
|
Ŝarĝante…
Reference in New Issue