This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] Send arguments to a to a process already running (KUniqueApplication)

Tags: None
(comma "," separated)
Spomky
Registered Member
Posts
15
Karma
0
OS
Hi,

My application is a KUniqueApplication.
I run it with some arguments: "myapp --load /path/to/a/file"
And the application loads my file

When I run my application one more time "myapp --load /path/to/another/file", the application does not run ; the process is already running.

I want my second instance sends a command to the first one in order to load that second file.

How to do that?
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
You have to override newInstance()

http://api.kde.org/4.x-api/kdelibs-apid ... 296d95d2cf

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
Spomky
Registered Member
Posts
15
Karma
0
OS
Thanks, it works very well :shade:

But I have another problem now. My app returns
Code: Select all
(8642)/: KUniqueApplication: Registering failed!
(8642)/: Communication problem with  "myapp" , it probably crashed.
Error message was:  "org.freedesktop.DBus.Error.ServiceUnknown" : " "The name org.kde.myapp was not provided by any .service files" "
Spomky
Registered Member
Posts
15
Karma
0
OS
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
If this issue has been resolved, please mark it as solved. Thanks in advance.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
msoeken
Mentor
Posts
300
Karma
4
OS
Spomky wrote:OK solved!


Could you describe how you solved it. If someone is searching for the same error message and gets to this thread he can find a solution.


Image
[size=x-small]code | [url=cia.vc/stats/author/msoeken]cia.vc[/url] | [url=kde.org/support]donating KDE[/url] | [url=tinyurl.com/cto4ns]wishlist[/url][/size]
Musikolo
Registered Member
Posts
27
Karma
0
OS
Just in case someone might be interested, I have found a way to create a unique application instance having a look at KTorrent main.cpp file - http://ktorrent.org/?q=downloads

There will also be available in a few days another example in KVirusTotal code, the program I'm developing - http://kde-apps.org/content/show.php?content=139065

Best regards. ;)


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]