diff options
Diffstat (limited to 'readdb.py')
-rw-r--r-- | readdb.py | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -371,11 +371,12 @@ class AnnotationManager: for a in self._annotations: if a.get_id() == annotation_id: - a.set_modified(time.time()) - a.set_note_title(annotitle) - a.set_note_body(annocontent) - self.update_annotation_db_record(a) - break + if ( a.get_note_title() != annotitle ) or ( a.get_note_body() != annocontent ): + a.set_modified(time.time()) + a.set_note_title(annotitle) + a.set_note_body(annocontent) + self.update_annotation_db_record(a) + break @@ -607,8 +608,15 @@ class AnnotationManager: def update_annotation_db_record(self, annotation): + #if a user changes a annotation, it becomes her own + if self._userid == '': + client = gconf.client_get_default() + user = client.get_string("/desktop/sugar/user/nick") + self._userid = self.get_userid_for_username( self.get_user_string( user ) ) + annotation.set_creator( self._userid ) + annotation.make_new_uuid() #(id INTEGER PRIMARY KEY, md5, page, title, content, bodyurl, texttitle, textcreator, created TIMESTAMP, modified TIMESTAMP, creator, annotates, color, local, mimetype, uuid, annotationurl) - t = (annotation.get_filehash(), annotation.get_page(), annotation.get_note_title(), annotation.get_note_body(), annotation.get_bodyurl(), annotation.get_texttitle(), annotation.get_textcreator(), annotation.get_created(), annotation.get_modified(), annotation.get_creator(), annotation.get_annotates(), annotation.get_color().to_string(), annotation.is_local(), annotation.get_mimetype(), annotation.get_uuid(), annotation.get_annotationurl(), annotation.get_id()) + t = (annotation.get_filehash(), annotation.get_page(), annotation.get_note_title(), annotation.get_note_body(), annotation.get_bodyurl(), annotation.get_texttitle(), annotation.get_textcreator(), annotation.get_created(), annotation.get_modified(), self._userid, annotation.get_annotates(), annotation.get_color().to_string(), annotation.is_local(), annotation.get_mimetype(), annotation.get_uuid(), annotation.get_annotationurl(), annotation.get_id()) self._conn.execute('update annotations set md5=?, page=?, title=?, content=?, bodyurl=?, texttitle=?, textcreator=?, created=?, modified=?, creator=?, annotates=?, color=?, local=?, mimetype=?, uuid=?, annotationurl=? where id=?', t) self._conn.commit() self.current_annotation = annotation |