Package: zim Version: 0.63-2 Severity: wishlist Tags: patch When sharing a Zim notebook over a sharing/synchronisation system such as Owncloud, several Zim instances can be working on the same notebook. But once a page is loaded in a Zim instance, Zim doesn't notice if it's modified externally until it's too late (the conflict detection system only triggers on save). Here's a patch that forces a reload of a page when the user switches to a new page. It doesn't claim to be a 100% solution (if the remotely-modified page is the same as the one currently open, nothing reloads it), but it should handle a large proportion of cases.
It could probably be submitted upstream, if only for discussion. There's an upstream bug at https://bugs.launchpad.net/zim/+bug/792058 with a different approach for the resolution, but the implementation doesn't address the same problem (doesn't detect file contents changes), and the discussion stalled 3 years ago. Thanks, Roland. -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.1.0-2-amd64 (SMP w/8 CPU cores) Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages zim depends on: ii python 2.7.9-1 ii python-gobject 3.16.2-1 ii python-gtk2 2.24.0-4 ii python-simplejson 3.7.3-1 ii python-xdg 0.25-4 pn python:any <none> Versions of packages zim recommends: pn python-gtkspell <none> Versions of packages zim suggests: ii bzr 2.6.0+bzr6602-3 pn ditaa <none> pn dvipng <none> ii git 1:2.5.1-1 pn gnuplot <none> ii graphviz 2.38.0-10 pn lilypond <none> pn mercurial <none> pn python-zeitgeist <none> pn r-base <none> pn scrot <none> -- no debconf information
>From 4428f3e6add65b63dd24d88690a8f1382584ba15 Mon Sep 17 00:00:00 2001 From: Roland Mas <lola...@debian.org> Date: Thu, 17 Sep 2015 17:38:32 +0200 Subject: [PATCH] Reload pages from storage when opening them --- debian/changelog | 7 +++ debian/patches/0002-Reload-pages.patch | 79 ++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 87 insertions(+) create mode 100644 debian/patches/0002-Reload-pages.patch diff --git a/debian/changelog b/debian/changelog index 3997f03..845e754 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,13 @@ zim (0.63-2) UNRELEASED; urgency=medium -- Raphaƫl Hertzog <hert...@debian.org> Wed, 17 Jun 2015 09:54:09 +0200 +zim (0.63-1+lld) unstable; urgency=medium + + * Reload page content on page switch to allow for notebooks synced + across computers. + + -- Roland Mas <lola...@debian.org> Thu, 17 Sep 2015 17:27:23 +0200 + zim (0.63-1) unstable; urgency=medium * New upstream release. diff --git a/debian/patches/0002-Reload-pages.patch b/debian/patches/0002-Reload-pages.patch new file mode 100644 index 0000000..dd15e38 --- /dev/null +++ b/debian/patches/0002-Reload-pages.patch @@ -0,0 +1,79 @@ +Index: zim/zim/gui/__init__.py +=================================================================== +--- zim.orig/zim/gui/__init__.py ++++ zim/zim/gui/__init__.py +@@ -3184,6 +3184,7 @@ + def do_response_ok(self): + path = self.form['page'] + if path: ++ self.ui.notebook.flush_page_cache(path) + self.ui.open_page(path) + return True + else: +@@ -3296,6 +3297,7 @@ + + page.parse('wiki', file.readlines()) + self.ui.notebook.store_page(page) ++ self.ui.notebook.flush_page_cache(page) + self.ui.open_page(page) + return True + +Index: zim/zim/gui/pageindex.py +=================================================================== +--- zim.orig/zim/gui/pageindex.py ++++ zim/zim/gui/pageindex.py +@@ -549,6 +549,7 @@ + self.emit('page-activated', path) + + def do_page_activated(self, path): ++ self.ui.notebook.flush_page_cache(path) + self.ui.open_page(path) + + def do_key_press_event(self, event): +Index: zim/zim/gui/pageview.py +=================================================================== +--- zim.orig/zim/gui/pageview.py ++++ zim/zim/gui/pageview.py +@@ -5374,6 +5374,7 @@ + if new_window: + self.ui.open_new_window(path) + else: ++ self.ui.notebook.flush_page_cache(path) + self.ui.open_page(path) + elif type == 'file': + path = self.ui.notebook.resolve_file(href, self.page) +Index: zim/zim/gui/pathbar.py +=================================================================== +--- zim.orig/zim/gui/pathbar.py ++++ zim/zim/gui/pathbar.py +@@ -457,6 +457,7 @@ + set_active(self._selected, True) + + def on_button_clicked(self, button): ++ self.ui.notebook.flush_page_cache(button.zim_path) + self.ui.open_page(button.zim_path) + + def do_button_release_event(self, button, event): +Index: zim/zim/gui/recentchangesdialog.py +=================================================================== +--- zim.orig/zim/gui/recentchangesdialog.py ++++ zim/zim/gui/recentchangesdialog.py +@@ -91,5 +91,6 @@ + + def _do_open_page(self, view, path, col): + page = Path( self.get_model()[path][self.NAME_COL].decode('utf-8') ) ++ self.ui.notebook.flush_page_cache(page) + self.ui.open_page(page) + +Index: zim/zim/gui/searchdialog.py +=================================================================== +--- zim.orig/zim/gui/searchdialog.py ++++ zim/zim/gui/searchdialog.py +@@ -221,6 +221,7 @@ + + def _do_open_page(self, view, path, col): + page = Path( self.get_model()[path][0].decode('utf-8') ) ++ self.ui.notebook.flush_page_cache(path) + self.ui.open_page(page) + + # Popup find dialog with same query diff --git a/debian/patches/series b/debian/patches/series index a92cf6a..2e0854d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 0001-Add-filename-parameter-to-Exec-entry-of-desktop-file.patch +0002-Reload-pages.patch -- 2.5.1