[Differential] [Request, 318 lines] D4847: KAuth integration in document saving

Martin Kostolný noreply at phabricator.kde.org
Tue Feb 28 22:45:17 UTC 2017


martinkostolny created this revision.
martinkostolny added a project: KTextEditor.
Restricted Application added subscribers: Frameworks, kwrite-devel.
Restricted Application added a project: Frameworks.

REVISION SUMMARY
  Before this patch: if one opens a write protected document, makes changes and then wants to save, error message occurs about insufficient privileges or disk space.
  
  With this patch kate-part will try to save the document contents with elevated privileges in case the regular save failed. So that KAuth graphical prompt is presented to user. I believe this was suggested by many KDE users as a wanted feature. Please let me know if this isn't the right approach.
  
  I'm in fact quite new to KTextEditor as well as KAuth so feel free to criticize the code. I'll try to fix everything you point at :).
  
  What I basically did:
  
  - created TextBufferSecure class (for dedicated KAuth helper binary)
  - moved most contents of TextBuffer:save() method to this new class' saveInternal() method
  - TextBuffer:save() method now first tries to save with TextBufferSecure::saveInternal() helper method
  - if that fails it will call it again through KAuth action

TEST PLAN
  - editing & saving document in home page
  - editing & saving /etc/hosts
  - tried with Krusader's "internal viewer" which uses ReadWritePart + tried with Kate
  
  But I'm sure there are a lot of other use-cases I didn't think of. Maybe you think of somehting. On my mind is now saving documents with different encoding, eol type, saving huge documents. I'll do that and if problems occur, I'll fix the diff.

REPOSITORY
  R39 KTextEditor

REVISION DETAIL
  https://phabricator.kde.org/D4847

AFFECTED FILES
  src/CMakeLists.txt
  src/buffer/katetextbuffer.cpp
  src/buffer/katetextbuffer_secure.cpp
  src/buffer/katetextbuffer_secure.h
  src/buffer/org.kde.ktexteditor.katetextbuffer.actions

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: martinkostolny, #ktexteditor
Cc: kwrite-devel, #frameworks, head7, cullmann, kfunk, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170228/ee766c2e/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list