Review Request 121265: Make modified flag work for KMainWindow::setCaption(QString, bool)
Friedrich W. H. Kossebau
kossebau at kde.org
Thu Nov 27 03:10:29 UTC 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121265/
-----------------------------------------------------------
Review request for KDE Frameworks.
Repository: kxmlgui
Description
-------
The API dox of KMainWindow::setCaption(const QString &caption, bool modified) claims that the flag modified specifies "whether the document is modified. This displays an additional sign in the title bar, usually "*"."
See http://api.kde.org/frameworks-api/frameworks5-apidocs/kxmlgui/html/classKMainWindow.html#aa78364d5eeb1c1f5bd333c733378741d
Currently that is not true. Instead a warning is shown on the console:
"QWidgetPrivate::setWindowModified_helper: QWidget::setWindowModified: The window title does not contain a '[*]' placeholder"
When 'KDialog::setCaption(QString, bool)' was moved to 'KMainWindow::setCaption(QString, bool)' for kf5, it was dumped that the old code also called ' makeStandardCaption(...)' which would add a custom "[modified]" string if the 'modified' flag was set. See http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/kdialog_8cpp_source.html#l00475
Now KMainWindow uses the 'windowModified' property of 'QWidget', and if doing so, the windowtitle needs a placeholder where to put the modified marker, by the form of "[*]". See https://qt-project.org/doc/qt-5/qwidget.html#windowTitle-prop
This patch proposes to comply to the API and to add that placeholder, so the method behaves as expected. It does not use "[modified]" flag like the kde4libs variant of the code did, but by using the Qt placeholder perhaps can even integrate better into the platform (not sure if there is a hook yet).
Diffs
-----
src/kmainwindow.cpp 9562318
Diff: https://git.reviewboard.kde.org/r/121265/diff/
Testing
-------
Modified is now properly marked to Off or On in the window title, when 'KMainWindow::setCaption(QString,bool)' is used. Tested with Okteta.
Thanks,
Friedrich W. H. Kossebau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20141127/506ed61c/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list