Bug 395954

Summary: Broken KDE activities integration
Product: [Applications] kate Reporter: Simone <s.scalabrino9>
Component: applicationAssignee: Simone <s.scalabrino9>
Status: RESOLVED FIXED    
Severity: minor CC: nate
Priority: NOR    
Version: 18.04.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=348012
Latest Commit: Version Fixed In:
Attachments: This is a patch I created that fixes the problem.

Description Simone 2018-06-28 08:50:36 UTC
This is an annoying "bug" that appears when you use Plasma activities.

How to reproduce:
* Create two activities in Plasma, A and B
* Switch to A
* Open an instance of Kate
* Switch to B
* Open Dolphin (or any other file manager)
* Open a text file (e.g., "text.txt")

Expected result:
Kate opens a new instance in B with "text.txt"

Actual result:
Kate opens "text.txt" in the already opened window in A, and the activity is switched.

At the moment I have to manually open a new instance of kate in B before opening the file, but when I forget it is annoying, because I have to close the tab in A, switch back to B, open a new instance and, finally, open my file.
Comment 1 Simone 2018-07-01 11:06:27 UTC
Created attachment 113672 [details]
This is a patch I created that fixes the problem.

The attached patch fixes the problem. I tested it in my environment (Plasma 15.13), but I think it should be tested also (i) in Wayland (without activities) and (ii) in a different DE. 

What I did is the following:
1) added a QDBus service to get the activities linked to a kate instance
2) added a check in the main in which, after all the other checks, if it still wants not to create a new instance, it makes sure that at least one of the currently running instances is in the current activity. If no instance is in the current activity, it forces a new instance.
Comment 2 Christoph Feck 2018-07-30 23:30:26 UTC
Thanks for the patch Simone! Could you please add it to Phabricator so developers can review it?

https://phabricator.kde.org/differential/diff/create/
Comment 3 Nate Graham 2018-07-31 02:54:02 UTC
I believe he did: https://phabricator.kde.org/D13826
Comment 4 Christoph Cullmann 2018-08-13 00:10:56 UTC
Git commit cdb3da47ccda1c0600bbeb6c6a73180b9a3b9754 by Christoph Cullmann, on behalf of Simone Scalabrino.
Committed on 12/08/2018 at 11:42.
Pushed by cullmann into branch 'master'.

Support activities when opening files

Differential Revision: https://phabricator.kde.org/D13826

M  +15   -0    kate/kateapp.cpp
M  +7    -0    kate/kateapp.h
M  +4    -0    kate/kateappadaptor.cpp
M  +7    -0    kate/kateappadaptor.h
M  +37   -1    kate/main.cpp

https://commits.kde.org/kate/cdb3da47ccda1c0600bbeb6c6a73180b9a3b9754