Bug 449662 - request: restore undo/redo buttons missing in KF5 build
Summary: request: restore undo/redo buttons missing in KF5 build
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-05 17:15 UTC by Jessica
Modified: 2022-02-19 08:20 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.33.80 (KDE releases 22.03.80)
Sentry Crash Report:


Attachments
logfile from `strace -e trace=file umbrello` on a KF5 build (958.67 KB, text/x-log)
2022-02-18 11:53 UTC, Oliver Kellogg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jessica 2022-02-05 17:15:08 UTC
I see there is a "command history" tabpage . Unfortunately I don't find what feature this windows offers.
You can't click anything or perform any action.

Would it be possible, because this history is already made, to make an undo feature based on this?

SOFTWARE/OS VERSIONS
Windows 10
git
Comment 1 Jessica 2022-02-05 17:17:14 UTC
You could right click an item in "command history" to undo it (not sure if you can undo an item which is NOT the last one)
Or File -> Undo removes last added command
Comment 2 Oliver Kellogg 2022-02-14 20:42:13 UTC
Quite mysterious.
Umbrello used to have an undo feature when I was last active (2014) but sometime between then and now is seems to have got lost.
Ralf, could you shed some light on this?
Comment 3 Ralf Habacker 2022-02-15 09:48:39 UTC
(In reply to Oliver Kellogg from comment #2)
> Quite mysterious.
> Umbrello used to have an undo feature when I was last active (2014) but
> sometime between then and now is seems to have got lost.

The undo feature is present and functional for many drawing objects, but is not 100% complete.
Comment 4 Oliver Kellogg 2022-02-15 09:54:28 UTC
(In reply to Ralf Habacker from comment #3)
> (In reply to Oliver Kellogg from comment #2)
> > Quite mysterious.
> > Umbrello used to have an undo feature when I was last active (2014) but
> > sometime between then and now is seems to have got lost.
> 
> The undo feature is present and functional for many drawing objects, but is
> not 100% complete.

So then the bug is that the Undo button got lost.
Comment 5 Oliver Kellogg 2022-02-18 07:02:58 UTC
(In reply to Oliver Kellogg from comment #4)
> (In reply to Ralf Habacker from comment #3)
> > (In reply to Oliver Kellogg from comment #2)
> [...]
> So then the bug is that the Undo button got lost.

We are talking about the toolbar between the main menu bar (File, Edit, Diagram, Code, Settings, Help)
and the work toolbar with the arrow and the UML symbols (Note, Anchor, Label(XYZ) etc).

In the Qt4/KDE4 build of git master, the Undo/Redo icons are present in that toolbar:

New, Open, Save, Print, Print Preview, Undo, Redo, Cut, Copy, Paste, Find.

In the Qt5/KF5 build, the Undo/Redo icons are missing completely, i.e. there are not even fallback icons in those positions.

How this has been working in KDE4 I do not know.
The only mentions I find are:

1) In umbrello/umbrelloui.rc.cmake the line
<ToolBar name="mainToolBar" fullWidth="true" newline="true">

2) in umbrello/uml.cpp
function UMLApp::saveOptions() :
    toolBar(QLatin1String("mainToolBar"))->saveSettings(cg);
function UMLApp::readOptions() :
    toolBar(QLatin1String("mainToolBar"))->applySettings(m_config->group("toolbar"));

How that toolbar is filled with icons is not visible from the source code.
I must be missing something.
Comment 6 Ralf Habacker 2022-02-18 10:35:13 UTC
> In the Qt5/KF5 build, the Undo/Redo icons are missing completely,

> 1) In umbrello/umbrelloui.rc.cmake the line

This is probably caused by KF5 expecting that file on a different path as it is installed. You may try to run umbrello with 'strace -e trace=file' to see, where it is expected.
Comment 7 Oliver Kellogg 2022-02-18 11:53:57 UTC
Created attachment 146906 [details]
logfile from `strace -e trace=file umbrello` on a KF5 build

(In reply to Ralf Habacker from comment #6)
> > In the Qt5/KF5 build, the Undo/Redo icons are missing completely,
> 
> > 1) In umbrello/umbrelloui.rc.cmake the line
> 
> This is probably caused by KF5 expecting that file on a different path as it
> is installed. You may try to run umbrello with 'strace -e trace=file' to
> see, where it is expected.

I tried that and to my amazement, on KF5 it isn't even trying to look up the icon file (see attachment).

On the KDE4 build, I get lines like this:

stat("/usr/share/icons/oxygen/16x16/actions/edit-undo.png", {st_mode=S_IFREG|0644, st_size=866, ...}) = 0
stat("/usr/share/icons/oxygen/22x22/actions/edit-undo.png", {st_mode=S_IFREG|0644, st_size=1220, ...}) = 0
stat("/usr/share/icons/oxygen/32x32/actions/edit-undo.png", {st_mode=S_IFREG|0644, st_size=2020, ...}) = 0
stat("/usr/share/icons/oxygen/48x48/actions/edit-undo.png", {st_mode=S_IFREG|0644, st_size=3440, ...}) = 0
stat("/usr/share/icons/oxygen/22x22/actions/edit-undo.png", {st_mode=S_IFREG|0644, st_size=1220, ...}) = 0
open("/usr/share/icons/oxygen/22x22/actions/edit-undo.png", O_RDONLY|O_CLOEXEC) = 13

In your KF5 build, do you get the Undo/Redo buttons?
Comment 8 Oliver Kellogg 2022-02-18 12:21:27 UTC
(In reply to Oliver Kellogg from comment #7)
> [...]
> On the KDE4 build, I get lines like this:
> 
> stat("/usr/share/icons/oxygen/16x16/actions/edit-undo.png",
> {st_mode=S_IFREG|0644, st_size=866, ...}) = 0

I forgot to write: On my KF5 system, these are the actually installed icons,

/usr/share/icons/Adwaita/32x32/legacy/edit-undo.png
/usr/share/icons/Adwaita/22x22/legacy/edit-undo.png
/usr/share/icons/Adwaita/48x48/legacy/edit-undo.png
/usr/share/icons/Adwaita/16x16/legacy/edit-undo.png
/usr/share/icons/Adwaita/24x24/legacy/edit-undo.png
/usr/share/icons/oxygen/base/32x32/actions/edit-undo.png
/usr/share/icons/oxygen/base/22x22/actions/edit-undo.png
/usr/share/icons/oxygen/base/48x48/actions/edit-undo.png
/usr/share/icons/oxygen/base/16x16/actions/edit-undo.png
/usr/share/icons/breeze/actions/16/edit-undo.svg
/usr/share/icons/breeze/actions/24/edit-undo.svg
/usr/share/icons/breeze/actions/22/edit-undo.svg
/usr/share/icons/breeze/actions/32/edit-undo.svg
/usr/share/icons/breeze-dark/actions/16/edit-undo.svg
/usr/share/icons/breeze-dark/actions/24/edit-undo.svg
/usr/share/icons/breeze-dark/actions/22/edit-undo.svg
/usr/share/icons/breeze-dark/actions/32/edit-undo.svg
/usr/share/icons/HighContrast/16x16/actions/edit-undo.png
/usr/share/icons/HighContrast/22x22/actions/edit-undo.png
/usr/share/icons/HighContrast/24x24/actions/edit-undo.png
/usr/share/icons/HighContrast/256x256/actions/edit-undo.png
/usr/share/icons/HighContrast/32x32/actions/edit-undo.png
/usr/share/icons/HighContrast/48x48/actions/edit-undo.png
/usr/share/icons/HighContrast/scalable/actions/edit-undo.svg
Comment 9 Oliver Kellogg 2022-02-18 17:40:13 UTC
(In reply to Oliver Kellogg from comment #7)
> [...]
> I tried that and to my amazement, on KF5 it isn't even trying to look up the
> icon file (see attachment).

After some debugging, I guess this may have to do with QIcon caching.
Apparently, Qt somehow manages to fabricate an icon, e.g. for "edit-undo", without searching for icon files in that moment.

For better understanding, I patched UMLApp::readOptions() as follows:

diff --git a/umbrello/uml.cpp b/umbrello/uml.cpp
index 7d094290b..6a81139d1 100644
--- a/umbrello/uml.cpp
+++ b/umbrello/uml.cpp
@@ -1131,7 +1132,12 @@ void UMLApp::saveOptions()
 void UMLApp::readOptions()
 {
     // bar status settings
-    toolBar(QLatin1String("mainToolBar"))->applySettings(m_config->group("toolbar"));
+    KToolBar *mainToolBar = toolBar(QLatin1String("mainToolBar"));
+    mainToolBar->applySettings(m_config->group("toolbar"));
+    QIcon qi = QIcon::fromTheme(QLatin1String("edit-undo"));
+    editUndo->setIcon(qi);
+    mainToolBar->addAction(editUndo);
+
     // do config for work toolbar
     m_toolsbar->applySettings(m_config->group("workbar"));
     fileOpenRecent->loadEntries(m_config->group("Recent Files"));

... and with that patch, the Undo icon does appear!

IMHO the Undo/Redo actions are no longer automatically filled into toolBar(QLatin1String("mainToolBar")) as they were in KDE4.
BTW, if the editUndo->setIcon(qi) call is left out then instead of the Undo icon there appears the text "Undo".
Comment 10 Jessica 2022-02-18 18:25:22 UTC
*** Removed by KDE Sysadmin for violation of the KDE Community Code of Conduct ***
Comment 11 Oliver Kellogg 2022-02-19 08:20:48 UTC
Git commit 23349c46cc5f9c3b0e8ef090e518ba50dcda826d by Oliver Kellogg.
Committed on 19/02/2022 at 08:20.
Pushed by okellogg into branch 'master'.

Fix "request: restore undo/redo buttons missing in KF5 build"

umbrello/uml.cpp
- In constructor, for symmetry with other members pre-initialize member
  m_undoEnabled.
- In function readOptions :
  - Factor toolBar(QLatin1String("mainToolBar")) into local mainToolBar
    pointer to KToolBar.
  - If QT_VERSION major is 5 or larger then
    - add seperator in mainToolBar;
    - set "edit-undo" / "edit-redo" in local QStrings undoIconName and
      redoIconName;
    - set local QIcons undoIcon and redoIcon using QIcon::fromTheme()
      with undoIconName and redoIconName;
    - set undoIcon in editUndo and set redoIcon in editRedo;
    - call mainToolBar->addAction() with argument editUndo and editRedo.
FIXED-IN:2.33.80 (KDE releases 22.03.80)

M  +23   -2    umbrello/uml.cpp

https://invent.kde.org/sdk/umbrello/commit/23349c46cc5f9c3b0e8ef090e518ba50dcda826d