Bug 379296 - Reloading file hides the annotation toolbar
Summary: Reloading file hides the annotation toolbar
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 1.1.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2017-04-27 21:34 UTC by Oliver Sander
Modified: 2018-11-17 16:13 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Sander 2017-04-27 21:34:56 UTC
1) Open any pdf document
2) Press F6 to open the annotation toolbar
3) Press F5 to reload the document

Result: the annotation toolbar disappears again.

This is more annoying than it may seem, because you can also trigger a reload by saving the file onto itself.  Saving a file onto itself will touch the file; as a consequence, okular will (erroneously) think that it has changed, and reload it.  That is unfortunate, because saving while annotating is a frequent thing to do.

I had a look with the debugger.  Apparently, reloading involves first closing the document, and then opening it again (as can be seen from the backtrace I attach below).  Closing the document hides the annotation toolbar (that sounds reasonable, I guess), but then reopening does not switch it on again.  Any suggestions on how to fix this?

Here is the backtrace: I placed a breakpoint at pageviewutils.cpp:581, and then hit F6 & F5.

#0  PageViewToolBar::hideAndDestroy (this=0x555555f73a80) at /home/sander/okular/ui/pageviewutils.cpp:581
#1  0x00007fffdc2178c0 in PageViewAnnotator::setEnabled (this=0x5555561f7ff0, on=false) at /home/sander/okular/ui/pageviewannotator.cpp:726
#2  0x00007fffdc242a3c in PageView::slotToggleAnnotator (this=0x555555b77830, on=false) at /home/sander/okular/ui/pageview.cpp:4982
#3  0x00007fffdc250fd8 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<bool>, void, void (PageView::*)(bool)>::call (f=(void (PageView::*)(PageView * const, bool)) 0x7fffdc2426e0 <PageView::slotToggleAnnotator(bool)>, o=0x555555b77830, arg=0x7fffffffce70) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:141
#4  0x00007fffdc24fd49 in QtPrivate::FunctionPointer<void (PageView::*)(bool)>::call<QtPrivate::List<bool>, void> (f=(void (PageView::*)(PageView * const, bool)) 0x7fffdc2426e0 <PageView::slotToggleAnnotator(bool)>, o=0x555555b77830, arg=0x7fffffffce70) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:160
#5  0x00007fffdc24c661 in QtPrivate::QSlotObject<void (PageView::*)(bool), QtPrivate::List<bool>, void>::impl (which=1, this_=0x555555cc8a90, r=0x555555b77830, a=0x7fffffffce70, ret=0x0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject_impl.h:120
#6  0x00007ffff3fba95e in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x00007ffff48f7242 in QAction::toggled(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8  0x00007ffff48f9a50 in QAction::setChecked(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff48f9b8c in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007fffdc1b9c07 in QAction::trigger (this=0x555555cc7b40) at /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qaction.h:183
#11 0x00007fffdc22e6cd in PageView::updateActionState (this=0x555555b77830, haspages=false, documentChanged=true, hasformwidgets=false) at /home/sander/okular/ui/pageview.cpp:1145
#12 0x00007fffdc22e07d in PageView::notifySetup (this=0x555555b77830, pageSet=..., setupFlags=1) at /home/sander/okular/ui/pageview.cpp:1063
#13 0x00007fffd7d2571a in Okular::Document::closeDocument (this=0x5555558c2600) at /home/sander/okular/core/document.cpp:2614
#14 0x00007fffdc1b1efa in Okular::Part::closeUrl (this=0x555555939f80, promptToSave=true) at /home/sander/okular/part.cpp:1660
#15 0x00007fffdc1b205c in Okular::Part::closeUrl (this=0x555555939f80) at /home/sander/okular/part.cpp:1681
#16 0x00007fffdc1b2872 in Okular::Part::slotDoFileDirty (this=0x555555939f80) at /home/sander/okular/part.cpp:1805
#17 0x00007fffdc1b70a9 in Okular::Part::slotReload (this=0x555555939f80) at /home/sander/okular/part.cpp:2725
Comment 1 Oliver Sander 2017-05-06 08:42:47 UTC
Before I can think further about this I need help with a basic decision:  Is it better to allow closing the document without hiding the toolbar, or is it better to make reload re-open the toolbar if it was open before?
Comment 2 Albert Astals Cid 2017-05-08 22:13:10 UTC
(In reply to Oliver Sander from comment #1)
> or is it better to make reload re-open the toolbar if it was open before?
I think this is more in line with what we do with other stuff.
Comment 3 Jonathan Verner 2017-05-09 09:33:25 UTC
> Is it better to allow closing the document without hiding the toolbar, or is it 
> better to make reload re-open the toolbar if it was open before?

I would expect the toolbar to remain shown when closing a document...
Comment 4 Jaime Torres 2018-11-17 16:13:59 UTC
In okular 1.6.70, when the annotation toolbar is shown and the document is reloaded (or saved and reloaded), the annotation toolbar is still shown for that document (It has to be shown tab by tab for every document in a tabbed okular, like the other tools that are configured by document, not globally).