List Info

Thread: Shortcut schemes for any KDE application (specifically for KDevelop, plugins and Kate Part)




Shortcut schemes for any KDE application (specifically for KDevelop, plugins and Kate Part)
country flaguser name
Ukraine
2008-03-02 13:32:45
Hey,
I think I know how we can escape from our shortcuts ghetto.
The solution is 
quite simple - we need to ship shortcut schemes for kate
part (and other 
parts we embed) by ourselves.

To do that, I've implemented the shortcuts schemes support
in xmlgui (see 
patch) and shortcuts dialog in kdelibs. You can apply the
patch, recompile 
kdelibs and restart kdevelop (patch is BC) to try that.
Please try and tell 
me your opinion.

shortcut_scheme.patch - patch for two-week-old kdelibs
new_shortcut_scheme.patch - patch for today's kdelibs


What this patch does:

1) It allows applications to load shortcuts from xml files
named
<component name><scheme name>shortcuts.rc

See, for example, attached kdevelopemacsshortcuts.rc file.
If you copy it 
to .kde4/share/apps/kdevelop (or global dir), KDevelop
shortcuts dialog will 
recognize the "emacs" scheme and will allow to
switch to it.


2) It allows individual xmlgui clients to specify their own
schemes using 
similar xml files.

For example, you can have
.kde4/share/apps/katepart/katepartemacsshortcuts.rc 
file with emacs shortcuts scheme for kate part.


3) It saves user-configured shortcuts separately for each
scheme

For example, the user can have custom shortcuts for emacs
scheme and for 
default scheme (in .kde4/share/apps/kdevelop/kdevelopui.rc)
 <ActionProperties>
  <Action shortcut="Ctrl+W"
name="file_close" />
 </ActionProperties>
 <ActionProperties scheme="emacs" >
  <Action shortcut="Ctrl+X,K"
name="file_close" />
 </ActionProperties>


4) It has GUI to add new shortcut schemes, delete them and
export (note, 
delete doesn't work now);

Just launch shortcuts dialog and see the "details"
button.


What we can do with shortcuts schemes:

1) we can create a scheme for known kate part shortcuts and
ship it. If the 
user selects our scheme and then updates kate part, unknown
actions (no in 
the scheme) will have no shortcuts at all so clashes should
not exist.

2) we can ship our own shortcuts scheme without clashes and
possibly an emacs 
shortcut scheme (or let the users create it)

PS: I'm not a fan of emacs shortcuts  They are
just used as an example of 
what can be done. 

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

  
  
  
Re: Shortcut schemes for any KDE application (specifically for KDevelop, plugins and Kate Pa
user name
2008-03-04 17:28:11
On 02.03.08 21:32:45, Alexander Dymo wrote:
> Hey,
> I think I know how we can escape from our shortcuts
ghetto. The solution is 
> quite simple - we need to ship shortcut schemes for
kate part (and other 
> parts we embed) by ourselves.

I like the idea very much and its something that benefits
basically all
apps. Users like to have scheme's especially for shortcuts
and this way
they can even exchange them.

> To do that, I've implemented the shortcuts schemes
support in xmlgui (see 
> patch) and shortcuts dialog in kdelibs. You can apply
the patch, recompile 
> kdelibs and restart kdevelop (patch is BC) to try that.
Please try and tell 
> me your opinion.

Works basically, but I noticed a few things:

a) Creating a new scheme, changing two shortcuts. Then
switching back to
Default and again to the new scheme the dialog is empty and
apparently
thats also what the scheme file stores as cancelling and
re-opening the
dialog doesn't bring up any shortcuts

b) cancel doesn't undo a scheme change, i.e. choosing a
different scheme
from the combobox and then cancelling should revert back to
the
previously selected scheme

c) the "export to file" doesn't do anything for
me

d) what does the "save these shortcuts as default for
this theme" thing
do? Doesn't it automatically store any changes to the
shortcuts editor
in the scheme? IMHO it should

e) The combobox is empty initially, shouldn't it have the
"Default"
entry? (or is this because I removed the existing scheme
files and
restarted kate? I didn't find any other place to change
back)

I guess thats enough for starters 

Andreas

PS: I didn't look at the patch itself, I trust you to do
proper coding
or getting hit over with a bat on k-c-d once you post it
there ;)

-- 
Excellent time to become a missing person.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: Shortcut schemes for any KDE application (specifically for KDevelop, plugins and Kate Pa
country flaguser name
Ukraine
2008-03-05 02:10:34
On Wednesday 05 March 2008 01:28:11 Andreas Pakulat wrote:
> a) Creating a new scheme, changing two shortcuts. Then
switching back to
> Default and again to the new scheme the dialog is empty
and apparently
> thats also what the scheme file stores as cancelling
and re-opening the
> dialog doesn't bring up any shortcuts

> b) cancel doesn't undo a scheme change, i.e. choosing a
different scheme
> from the combobox and then cancelling should revert
back to the
> previously selected scheme
Agree. But there's one more alternative - we can have
separate scheme 
selection dialog where stuff like this will be easier to
implement. 

The way shortcut dialog works now, I think we can ask the
user if he wants to 
save or cancel his shortcut changes when changing the
scheme. Right now I 
silently cancel the changes. Without save/cancel on scheme
change it's quite 
hard to implement scheme selector inside the dialog.

> c) the "export to file" doesn't do anything
for me
Yep, I haven't implemented it 

> d) what does the "save these shortcuts as default
for this theme" thing
> do? Doesn't it automatically store any changes to the
shortcuts editor
> in the scheme? IMHO it should
Currently scheme can live in:
- <guiclientname><schemename>shortcuts.rc files
(either global or local)
- local <guiclientname>ui.rc file (user settings)

When the user creates the scheme and assigns shortcuts, they
are saved to the 
usual user settings config file (<guiclientname>ui.rc)
in a dedicated xml 
element like:
 <ActionProperties scheme="emacs" >
  <Action shortcut="Ctrl+X,K"
name="file_close" />
 </ActionProperties>

This "save as default" menu moves the contents
from user settings file to the 
local scheme settings file
<guiclientname><schemename>shortcuts.rc.

I'm not sure this is needed at all, but at least until I
implement "export" 
feature, this stuff is the only way to exchange schemes...
Yeah, I 
think "export" should be enough...

> e) The combobox is empty initially, shouldn't it have
the "Default"
> entry? (or is this because I removed the existing
scheme files and
> restarted kate? I didn't find any other place to change
back)

Hmm, how did you get that? You should have seen the
"Default"... I'll try to 
reproduce this in the evening.

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

Re: Shortcut schemes for any KDE application (specifically for KDevelop, plugins and Kate Pa
user name
2008-03-05 03:11:45
On 05.03.08 10:10:34, Alexander Dymo wrote:
> On Wednesday 05 March 2008 01:28:11 Andreas Pakulat
wrote:
> > a) Creating a new scheme, changing two shortcuts.
Then switching back to
> > Default and again to the new scheme the dialog is
empty and apparently
> > thats also what the scheme file stores as
cancelling and re-opening the
> > dialog doesn't bring up any shortcuts
> 
> > b) cancel doesn't undo a scheme change, i.e.
choosing a different scheme
> > from the combobox and then cancelling should
revert back to the
> > previously selected scheme
> Agree. But there's one more alternative - we can have
separate scheme 
> selection dialog where stuff like this will be easier
to implement. 

I don't like that. Having a separate dialog for just a few
buttons is
a waste and its cumbersome then to do changes - possibly
going back and
forth between two dialogs.

> The way shortcut dialog works now, I think we can ask
the user if he wants to 
> save or cancel his shortcut changes when changing the
scheme. Right now I 
> silently cancel the changes. Without save/cancel on
scheme change it's quite 
> hard to implement scheme selector inside the dialog.

Then fix the dialog  Seriously
the shortcut dialog currently undergoes
some changes as far as I can see, so it seems like the best
time to fix
any problems in it that come up while doing the
scheme-stuff.

I agree though that a save/cancel message on changing the
scheme would
be good, however the cancel on the dialog should still undo
any scheme
changes I did (i.e. changing from Default to foobar should
be undone). 

> > e) The combobox is empty initially, shouldn't it
have the "Default"
> > entry? (or is this because I removed the existing
scheme files and
> > restarted kate? I didn't find any other place to
change back)
> 
> Hmm, how did you get that? You should have seen the
"Default"... I'll try to 
> reproduce this in the evening.

Hard to say for sure  I first
started kate, opened the dialog, created
a new scheme. Changed two shortcuts. Hit the "Save as
scheme defaults"
thing, then tried the export. Then I changed back to default
and back
again to foobar. As it was empty I cancelled, quit kate and
went to
$HOME/.kde/share/apps/kate/ removed the two files I found
there
DefaulXXX and foobarXXX and restarted kate. Then I had the
combobox
empty and after opening it the second entry was
"Default". Didn't try to
reproduce that yet.

Andreas

-- 
Is this really happening?

_______________________________________________
KDevelop-devel mailing list
KDevelop-develkdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinf
o/kdevelop-devel

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )