Discussion:
Krusader bookmarks & shortcuts
Gregor Petrin
2010-12-16 12:30:08 UTC
Permalink
Hi,

Today I tried to fix a 'bug' that has been bothering me in Krusader for some
time, although in the process I discovered this might not actually be a bug
so I would appreciate anybody's input.

In the spirit of Total Commander's bookmarks, I used ampersands to define
hotkeys to activate certain bookmarks or folders. So a bookmark with the
name "K&rusader" would be accessible by pressing Ctrl+D,R. But then if I
have a bookmark folder called "Referen&ce" positioned before the Krusader
bookmark, pressing R will open the Reference folder and both R and C in that
word will be underlined. My desired behavior would be for R to only activate
Krusader and C only activate Reference.

So I checked out Krusader from SVN and went exploring. I must also add that
I am a complete KDE noob (source code-wise) and that I have been primarily
working with Java and C# for the last 5 or so years. Ahem :) Anyway, I
discovered that the ampersand-as-shortcut concept isn't defined anywhere
explicitly and the fact that it worked at all might be due to me poorly
simulating an internal KMenu behaviour. However, if I uncomment lines 41 &
42 from KrBookmarkButton.cpp (they call KMenu's setKeyboardShortcutsEnabled
and setKeyboardShortcutsExecute methods with argument true), then the
bookmarks menu does indeed operate the way I would like it to, at the
expense of 'automatic' shortcuts defined by the first letter of a bookmark's
title.

Does anybody else use the ampersand-defines-shortcut method? Is it actually
a hack or desired behaviour?

I can think of several ways to fix this:
- fix KMenu to not use shortcuts that are already taken? (haven't looked
through KMenu source code yet)
- disable automatic shortcuts or make them a configurable option (like
mentioned above, removing two lines acomplishes this)
- fix KMenu in krusader by manually & smartly setting ampersands on all
entries without an ampersand

Of course, I may be alone in wanting this functionality and the correct
answer is just 'leave it alone, fool!' :) Please let me know if I am clear
enough in the description of the problem, and please give me your opinions
on the matter.


Regards,
Gregor
--
You received this message because you are subscribed to the Google Groups "krusader-devel" group.
To post to this group, send email to krusader-devel-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to krusader-devel+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/krusader-devel?hl=en.
Gregor Petrin
2010-12-17 11:59:28 UTC
Permalink
Hi,

I know a little more about the problem from my original post now. I am also
including a screenshot so it might be a bit clearer to people:
Loading Image...

The KMenu has a functionality that I believe is broken. The idea is that you
can search in the menu by using substring searches, in the provided
screenshot I am searching for the substring "Do" and since there are two
matching items, the menu lets me continue the search until the entered term
is unambiguous. However, if I type 'F', the first folder beginning with F
(ftp in this case) will get chosen and I am b0rked.

In the use case I presented before (marking shortcuts with ampersands) seems
to be officially supported by QMenu (though any documentation is hard to
find) and works if I comment out this substring functionality that was added
by KMenu - but if I do not comment it out, then pressing F gets me FTP
again, even though I may have assigned this key to another item.

So maybe KMenu should be fixed - but using the KDE reference search at
http://lxr.kde.org/ it seems only Krusader still actively uses KMenu (there
is another reference there to Kexi but I was led to believe that this is
actually obsolete code)! It seems as though KMenu was actively developed in
KDE 3 and may be obsolete?

What course of action do you recommend? Try to fix KMenu? Turn off the
substring search functionality (does anybody use that) which seems to cause
the problem? Is there a more modern alternative to KMenu? I'm looking for an
opinion from someone with greater KDE chops :)


Regards,
Gregor
Post by Gregor Petrin
Hi,
Today I tried to fix a 'bug' that has been bothering me in Krusader for
some time, although in the process I discovered this might not actually be a
bug so I would appreciate anybody's input.
In the spirit of Total Commander's bookmarks, I used ampersands to define
hotkeys to activate certain bookmarks or folders. So a bookmark with the
name "K&rusader" would be accessible by pressing Ctrl+D,R. But then if I
have a bookmark folder called "Referen&ce" positioned before the Krusader
bookmark, pressing R will open the Reference folder and both R and C in that
word will be underlined. My desired behavior would be for R to only activate
Krusader and C only activate Reference.
So I checked out Krusader from SVN and went exploring. I must also add that
I am a complete KDE noob (source code-wise) and that I have been primarily
working with Java and C# for the last 5 or so years. Ahem :) Anyway, I
discovered that the ampersand-as-shortcut concept isn't defined anywhere
explicitly and the fact that it worked at all might be due to me poorly
simulating an internal KMenu behaviour. However, if I uncomment lines 41 &
42 from KrBookmarkButton.cpp (they call KMenu's setKeyboardShortcutsEnabled
and setKeyboardShortcutsExecute methods with argument true), then the
bookmarks menu does indeed operate the way I would like it to, at the
expense of 'automatic' shortcuts defined by the first letter of a bookmark's
title.
Does anybody else use the ampersand-defines-shortcut method? Is it actually
a hack or desired behaviour?
- fix KMenu to not use shortcuts that are already taken? (haven't looked
through KMenu source code yet)
- disable automatic shortcuts or make them a configurable option (like
mentioned above, removing two lines acomplishes this)
- fix KMenu in krusader by manually & smartly setting ampersands on all
entries without an ampersand
Of course, I may be alone in wanting this functionality and the correct
answer is just 'leave it alone, fool!' :) Please let me know if I am clear
enough in the description of the problem, and please give me your opinions
on the matter.
Regards,
Gregor
--
You received this message because you are subscribed to the Google Groups "krusader-devel" group.
To post to this group, send email to krusader-devel-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to krusader-devel+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/krusader-devel?hl=en.
Loading...