Bug 146547 - UI Editing Editable section in read-only document does not mark document modified
Summary: UI Editing Editable section in read-only document does not mark document modi...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:24.2.0 target:7.6.0.0.beta2
Keywords:
Depends on:
Blocks: Section ModifiedStatus
  Show dependency treegraph
 
Reported: 2022-01-03 14:41 UTC by Gabor Kelemen (allotropia)
Modified: 2024-03-05 18:30 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Example document with sections editable in read-only documents too (9.37 KB, application/vnd.oasis.opendocument.text)
2022-01-03 14:41 UTC, Gabor Kelemen (allotropia)
Details
Screenshot of the example document in current master after editing (263.88 KB, image/png)
2022-01-03 14:42 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2022-01-03 14:41:04 UTC
Created attachment 177284 [details]
Example document with sections editable in read-only documents too

Attached example document has two sections that have the "Editable in read-only document" section property set (see at the Format - Sections dialog).
When they are opened they can be edited, but this does not mark the document as changed.
Closing the document loses the text entered in the sections without a query about saving.

1, Download the attached document
2, Make sure to have Read-only set on it on the file system level.
3, Open the attached document, the "This document is open in read-only mode" infobar should appear.
4, Enter a few words in the yellow sections.
5, Close the document.

The document is closed without asking whether you want to save your changes.

Writer should be asking if you want to save your document.

Happens in:
Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: c13db6e792cc347ffff4585f23866f195651f21f
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: threaded

and older versions as well back to
LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d5373
Comment 1 Gabor Kelemen (allotropia) 2022-01-03 14:42:35 UTC
Created attachment 177285 [details]
Screenshot of the example document in current master after editing
Comment 2 Aron Budea 2022-01-03 15:27:42 UTC
That's an unusual concept... why would you want to allow editing in an actual read-only file? I can understand the idea of editing parts of a document that's mostly locked for editing, but this is different.

Anyway, confirmed using LO 7.4.0.0.alpha0+ (c13db6e792cc347ffff4585f23866f195651f21f) / Ubuntu.
Comment 3 Gabor Kelemen (allotropia) 2023-03-22 10:20:31 UTC
(In reply to Aron Budea from comment #2)
> That's an unusual concept... why would you want to allow editing in an
> actual read-only file? 

Sections have this checkbox in the Edit Sections dialog: "Editable in read-only document" and apparently a customer started to utilize this feature.

I can understand the idea of editing parts of a
> document that's mostly locked for editing, but this is different.

Another option to reach this UX would be File - Properties - Security -> Open file read-only. 
But if I tick that box, save & reload, then the same isssue happens - file opens RO, only the yellow sections are editable (until Edit - Edit Mode is used) BUT: typing into them does not put the document into modified state and Writer lets you close it without any question.
Comment 4 Commit Notification 2023-05-22 12:30:33 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e7e9991fd06ba2e0484ae5e6b6acc323ab8bf66b

tdf#146547 Mark read-only docs as modified

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Gabor Kelemen (allotropia) 2023-05-23 08:13:52 UTC
Verified in 

Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: e7e9991fd06ba2e0484ae5e6b6acc323ab8bf66b
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: hu-HU
Calc: threaded

Typing into the editable sections marks the document as modified.
Comment 6 Commit Notification 2023-06-06 19:42:33 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4d5fe05d3926d8106f47cac2cfdefac8ec7b36d7

Revert "tdf#146547 Mark read-only docs as modified"

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Julien Nabet 2023-06-06 19:43:28 UTC
Removing target since the patch has been reverted.
Indeed, it caused tdf#155638 "Form couldn't be closed after it has been opened"
Comment 8 Julien Nabet 2023-06-06 19:44:18 UTC
Samuel: I reassign you by default but there's no obligation of course! :-)
Comment 9 Commit Notification 2023-06-16 14:52:51 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/aca32a55456aa4e907b216fb490b3c15d26c3d55

tdf#146547 sfx2: allow read-only documents to be modified

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Michael Stahl (allotropia) 2023-06-16 14:57:32 UTC
i've tweaked the fix a bit.
Comment 11 Commit Notification 2023-06-23 20:49:14 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/bde746141f9b382156a5ce79ebf82c5e32fc455b

tdf#146547 sfx2: allow read-only documents to be modified

It will be available in 7.6.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2023-06-28 09:23:40 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/79241a1fd32ab03cd2bb34fb303ce7f2fa93e57e

tdf#146547 sfx2: preserve modified state from read-only to editable

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2023-06-28 10:51:53 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/5aa1fee57e362a08d65dd814f5a29e680d3ea24b

tdf#146547 sfx2: preserve modified state from read-only to editable

It will be available in 7.6.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.