[Bug 134854] Add indicator for read-only files
ClosedPublic

Authored by apuzio on Jan 11 2016, 10:23 PM.

Details

Summary

This fixes the Bug 134854
If current file is read-only (checked with ReadWritePart::isReadWrite()) the window title changes - "(read only)" is added.
To check if the read-only status changed KTextEditor::Document::readWriteChanged signal is used.
Note: chmod-ing a file won't make in read only for ReadWritePart::isReadWrite().

Test Plan

Seams to work fine.

Diff Detail

Repository
R33 KDevPlatform
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apuzio updated this revision to Diff 1887.Jan 11 2016, 10:23 PM
apuzio retitled this revision from to Add indicator for read-only files.
apuzio updated this object.
apuzio edited the test plan for this revision. (Show Details)
apuzio added a reviewer: kfunk.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptJan 11 2016, 10:23 PM
apuzio updated this revision to Diff 1888.Jan 11 2016, 10:26 PM
  • Fixed style
kfunk edited edge metadata.Jan 12 2016, 10:24 PM

Generally, I like the idea.

Lean and mean.

shell/mainwindow.cpp
379

Move that new block after line 386, then you can just do += i18n(" (read only)")

And better be safe than sorry: Check whether activeDocument() returns null, too

apuzio retitled this revision from Add indicator for read-only files to [Bug 134854] Add indicator for read-only files.Jan 14 2016, 10:21 AM
apuzio updated this object.
apuzio edited edge metadata.
kfunk added inline comments.Jan 14 2016, 10:42 PM
shell/mainwindow.cpp
379

@apuzio: ^ Seen that comment?

apuzio updated this revision to Diff 1986.Jan 16 2016, 8:21 PM
apuzio updated this object.
Simplified code that adds text to window caption
apuzio marked 2 inline comments as done.Jan 16 2016, 8:22 PM

@kfunk Sorry for the late reaction.

kfunk accepted this revision.Jan 19 2016, 9:12 PM
kfunk edited edge metadata.

Will test & push that patch.

Thanks!

shell/mainwindow.cpp
379

Still not checking whether activeDocument() is null, but I'll fix that locally.

This revision is now accepted and ready to land.Jan 19 2016, 9:12 PM
This revision was automatically updated to reflect the committed changes.