Bug 345945 - Clipboard actions fail to trigger automatically or manually
Summary: Clipboard actions fail to trigger automatically or manually
Status: RESOLVED FIXED
Alias: None
Product: klipper
Classification: Applications
Component: plasma-widget (show other bugs)
Version: 5.3.0
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Martin Flöser
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2015-04-07 09:54 UTC by Mariusz Dykierek
Modified: 2015-05-13 00:33 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.3.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mariusz Dykierek 2015-04-07 09:54:34 UTC
In KDE4 the clipboard actions defined in Klipper triggered when the selected item matched a regular expression.
Now they don't. Furthermore, they do not get triggered even with default shortcuts too.
Using clipboard actions are cumbersome. First have to fill the clipboard, then call Clipboard widget in the System Tray and call the action from there.
In my work, I used Klipper actions to quickly call actions that relate to e.g. bug ID.

Reproducible: Always

Steps to Reproduce:
1. Define an action for string that matches e.g. ".*" with a command that e.g. invokes Kate.
2. Make it automatic.
3. Select any text -> no menu, nothing. Use Ctrl+Alt+R -> still nothing.

Actual Results:  
-> no menu, nothing. Use Ctrl+Alt+R -> still nothing.

Expected Results:  
Menu that would allow me to choose from command(s).
Comment 1 David Edmundson 2015-04-30 22:36:07 UTC
Seems to be the case.
Confirming.
Comment 2 Martin Flöser 2015-05-01 09:56:07 UTC
I'm not familiar with this feature. Can you please explain step by step how it's supposed to work?
Comment 3 Mariusz Dykierek 2015-05-01 12:06:10 UTC
https://docs.kde.org/stable/en/kde-workspace/klipper/actions.html

There is a few predefined for URLs. In my work I deal with database records with IDs e.g. support cases. What I do is define regex that matches these IDs and query database without need to open entire record.
I luckily found a workaround - disabled clipboard in the plasma shell and launched the good ol' klipper.
Comment 4 themroc 2015-05-01 19:25:51 UTC
Note, if you call an action for the last entry manually, it works principally.
I have attached a short movie for better understanding what I mean:

http://s000.tinyupload.com/index.php?file_id=65806388128628650164
Comment 5 themroc 2015-05-01 20:50:37 UTC
/var/log/syslog after pressing  Ctrl+Alt+R:
...
May  1 22:37:15 draussen org.kde.kglobalaccel[1321]: "Ctrl+Alt+R" = "repeat_action"
...

But in ~/.config/kglobalshortcutsrc are 2 entries:
...
[klipper]
...
repeat_action=,Ctrl+Alt+R,Aktionen der aktuellen Zwischenablage manuell aufrufen
...

..
[plasmashell]
...
repeat_action=Ctrl+Alt+R,Ctrl+Alt+R,Aktionen der aktuellen Zwischenablage manuell aufrufen
...
Comment 6 themroc 2015-05-01 21:33:27 UTC
(In reply to Martin Gräßlin from comment #2)
> I'm not familiar with this feature. Can you please explain step by step how
> it's supposed to work?

No matter where something (automatic or manual) is highlighted, was automatically (or manually by pressing Ctrl + Alt + R) accessed the clipper action, if the regular expression is a match found.

My English is very poor, therefore also in German:

Egal ob auf einer Webseite, oder in einem PDF, oder beim umbenennen einer Datei oder sonst wo: Immer wenn etwas markiert war, wurden die automatischen Klipperaktionen ausgeführt, wenn der reguläre Ausdruck der jeweiligen Aktion passte.
Da das nervt, benutzte man meistens die manuelle Variante (automatisch abgewählt in den Klippersettings) mit Ctrl+Alt+R. Dann ging ein kleines Fenster an der markierten Textstelle auf mit den passenden (= regulärer Ausdruck) Aktionen.

Benutze man als regulären Ausdruck ^* wurde bei Ctrl+Alt+R immer das Klipper-Aktions-Fenster geöffnet. Also die Aktion wird angeboten wobei egal ist was markiert wurde.

Jetzt passiert bei Ctrl+Alt+R nichts!
Comment 7 Martin Flöser 2015-05-11 19:19:42 UTC
I investigated the problem and understand it now. From klipper source code:

m_repeatAction->setVisible(m_mode == KlipperMode::Standalone)

This sets the action as not being shown in the menu. But unfortunately at the same time a not visible action is also not activateable. Thus it got disabled by accident. I'll have to look into why exactly I set them to only visible in standalone mode - it must have had a reason.

As this pattern is applied to may actions, this broke most clipboard actions.
Comment 8 themroc 2015-05-11 19:49:19 UTC
(In reply to Martin Gräßlin from comment #7)
> I investigated the problem and understand it now. From klipper source code:
> 
> m_repeatAction->setVisible(m_mode == KlipperMode::Standalone)
> 
> This sets the action as not being shown in the menu. But unfortunately at
> the same time a not visible action is also not activateable. Thus it got
> disabled by accident. I'll have to look into why exactly I set them to only
> visible in standalone mode - it must have had a reason.

So, your changes are here:
http://quickgit.kde.org/?p=plasma-workspace.git&a=blobdiff&h=20f4ea31fc5237ac338047346a87474552b43e84&hp=2825a33c8bd8478b6b3da9463ab061a5cb8febd1&hb=7661d7ffbe54d6b820f02ed7f06564537ff5d7e8&f=klipper%2Fklipper.cpp

And your explanation was:
"[klipper] Hide Klipper actions which are only relevant in standalone mode

We don't want to show e.g. the Quit button in the popup dialog when
Klipper is part of plasmashell. It would quit plasma. Not the best idea.
The menu now only shows the history items , all other options should be
used from the UI."

I think, you have to modify this changes to get the old functionality:
+    m_toggleURLGrabAction->setVisible(m_mode == KlipperMode::Standalone);
+    m_repeatAction->setVisible(m_mode == KlipperMode::Standalone);

Both actions must be visibly in global mode and not only in in standalone mode.
Just the global availability of these two features had made clipper so powerful in past.
Comment 9 Martin Flöser 2015-05-12 09:39:06 UTC
Git commit 56a5947e3707c104fe9170a51bdda308deee4d13 by Martin Gräßlin.
Committed on 12/05/2015 at 05:27.
Pushed by graesslin into branch 'Plasma/5.3'.

[klipper] Ensure global shortcut actions work

Some actions were set to not-visible in order to not show them in
the popup if not in standalone mode. This has the side effect of
global shortcuts no longer working as global shortcuts do not
trigger for not visible actions.

To fullfill both needs the check is now done to only add the actions
to the popup if it's in standalone mode, but the visibility is not
changed.
FIXED-IN: 5.3.1
REVIEW: 123727

M  +9    -13   klipper/klipper.cpp

http://commits.kde.org/plasma-workspace/56a5947e3707c104fe9170a51bdda308deee4d13