Bug 47065 - Notification about document closure for locked readonly opened document
Summary: Notification about document closure for locked readonly opened document
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected)
Master old -3.6
Hardware: Other All
: medium normal
Assignee: Matt K
Keywords: difficultyInteresting, easyHack, skillCpp, topicUI
Depends on:
Blocks: Infobar File-Lock LibO-Enhancements
  Show dependency treegraph
Reported: 2012-03-07 09:54 UTC by Jan Holesovsky
Modified: 2021-02-18 11:05 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Jan Holesovsky 2012-03-07 09:54:44 UTC
This is an "Easy" Hack for somebody who likes more advanced hacking ;-)

When you open a document that is already open by a different user, you get a warning like "Document file '$(ARG1)' is locked for editing by:" (see STR_OPENLOCKED_MSG in uui/source/openlocked.src).  You have the choice to open it read-only, or a copy.  In case of opening it read-only, it would be great to get a notification when the document has been closed by the other person again.

The dialog is effectively created in sfx2/source/doc/docfile.cxx, SfxMedium::ShowLockedDocumentDialog().  In the case that it is opened read-only, you should trigger a thread that will wake up every minute, and check for the presence of the lock file.  If the lock file disappeared, it should create a notification dialog that the file is not in use any more; if possible, with an offer a reload of the file.
Comment 1 benoit.dolives 2012-11-18 10:29:40 UTC
This feature seems really interesting and I would like to give it a try as a first easy (but interesting) hack.

Let me know if you have some advices or objections,

Comment 2 José Guilherme Vanz 2012-12-30 02:31:29 UTC
I start to try this bug. I debug the code to see where is more appropriated to start the thread. I think the SfxMedium::ShowLockedDocumentDialog is inappropriate place to do it. This function only show the user dialog and return the user choose, right?

The function SfxMedium::LockOrigFileOnDemand is appropriated?
Comment 3 José Guilherme Vanz 2013-01-07 14:15:57 UTC
The LibreOffice has some own thread API or can I use pthread.h API?
Comment 4 José Guilherme Vanz 2013-05-18 17:41:12 UTC Comment hidden (obsolete)
Comment 5 José Guilherme Vanz 2013-05-18 18:39:56 UTC Comment hidden (obsolete)
Comment 6 Björn Michaelsen 2013-10-04 18:46:11 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 7 Björn Michaelsen 2015-02-10 09:07:01 UTC
ASSIGNED->NEW: No change since 2013 apparently ...
Comment 8 Robinson Tryon (qubit) 2015-12-14 05:00:15 UTC Comment hidden (obsolete)
Comment 9 Robinson Tryon (qubit) 2016-02-18 14:52:06 UTC Comment hidden (obsolete)
Comment 10 Matt K 2021-02-18 11:05:07 UTC
Assigning to myself.  Will also implement Windows specific behavior for detecting security permissions changes.