Bug 384448

Summary: No KTextEditor::Document::mimeTypeChanged signal available
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Friedrich W. H. Kossebau <kossebau>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: christoph
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=384449
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 384971, 384972, 384973    

Description Friedrich W. H. Kossebau 2017-09-06 21:38:51 UTC
The mimetype property of a KTextEditor::Document object is not fixed for its lifetime, at least in the implementation of KTextEditor::DocumentPrivate.

In that code it is depending on the outcome of the queries to QMimeDatabase, which itself depends on the current initial 4k bytes and/or the path of the url which is set to the document. So the mimetype can be different over the lifetime of the document instance (e.g. when saving under another filename or when editing a new file and switching between Markdown and Asciidoc during initial work).

Watchers of a document instance, like the preview plugin, could be happy to be informed about changes of the mimetype, so they can adapt to it.
Comment 1 Christoph Cullmann 2022-01-08 16:35:31 UTC
Given the preview plugin is more or less unmaintained and no other use case was brought up so far, I will close this.
If somebody really needs this in the future, patches are welcome.