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

Using the kde file choser

Tags: None
(comma "," separated)
xErath
Registered Member
Posts
14
Karma
0
OS

Using the kde file choser

Sun Oct 18, 2009 8:49 pm
Hi there!

I'm participating in an app with some level of cross desktop environment compatibility. One of the things is that it uses each DE's default file chooser, so if I'm in gnome it uses the gnome file chooser, while if I'm in KDE, I'll use the KDE one. The binary cannot, obviously, have any static dependencies. Everything is detected at runtime, and everything is working fine, with the exception of the kde file chooser which is not implemented.

So, some first questions.
- which shared object do I need to dlopen ? will libkdeui be enough ?
- considering kde is c++ and therefore name decoration is an issue, how can I inspect the exported symbols of the .so file, so I know what to import ? Are there functions exported with C naming ?

Any recommendations or pointers would be appreciated. Thank you
xErath
Registered Member
Posts
14
Karma
0
OS

Re: Using the kde file choser

Sun Oct 18, 2009 9:50 pm
It seems I can read the contents of the so files using "readelf -s -W file". But there's too much info there, and difficult to sort out.
Kryten2X4B
Registered Member
Posts
911
Karma
4
OS

Re: Using the kde file choser  Topic is solved

Sun Oct 18, 2009 11:08 pm
One approach could be to, once the app has determined it is running in KDE, to do something as simple as launching a cli app from within the program to display the file-selector.

I.e kdialog --getopenfilename /home

Opens the file-selector, starting in /home.


OpenSUSE 11.4, 64-bit with KDE 4.6.4
Proud to be a member of KDE forums since 2008-Oct.
xErath
Registered Member
Posts
14
Karma
0
OS

Re: Using the kde file choser

Mon Oct 19, 2009 1:09 am
Wow, that's nice ! It works. Have to check if it's acceptable per the app's achitecture :)
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS

Re: Using the kde file choser

Mon Oct 19, 2009 7:53 am
In this case be sure you use the --attach command line argument to make the dialog transient for the window calling it.

This relationship information is used by window manager to decide whether to bring a window to the foreground when it shows (focus stealing prevention).

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
xErath
Registered Member
Posts
14
Karma
0
OS

Re: Using the kde file choser

Mon Oct 19, 2009 10:10 pm
It seems using kdialog is good ! Thank you very much :)
pipo
Registered Member
Posts
2
Karma
0
OS
Hi there,

I'd love to combine kdialog/kde file chosser within fortran.

In g95 I can call kdialog like this:

call system('kdialog --getopenfilename /home/memyself/ filter')

But how can I assign the return value/file name to a fortran variable ?
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS

Re: Using the kde file choser

Mon Nov 02, 2009 2:43 pm
pipo wrote:But how can I assign the return value/file name to a fortran variable ?


That's more a Fortran question than anything else.

In C, system() also just executes the command without any output, but there is another function called popen() which executes a command and gives you an inpu/output handle for it.

Maybe something similar exists in Fortran as well

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
pipo
Registered Member
Posts
2
Karma
0
OS

Re: Using the kde file choser

Mon Nov 02, 2009 3:20 pm
OK, here is a (somewhat clumsy) solution:

the answer=selected_file_name is written to file: answer_file which then can be read:

call system('kdialog --getopenfilename /home/memyself/ filter > answer_file')
andrewsam
Registered Member
Posts
2
Karma
0
OS

Re: Using the kde file choser

Tue Dec 01, 2009 5:52 pm
Can this be done for Opera. currently Opera either uses QT file choser or if i change the values in opera:config, it uses the GTK file picker..

any idea how this can be accomplished in Opera 10.10
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Using the kde file choser

Wed Dec 02, 2009 8:26 pm
Are you using the shared Qt 4 builds of Opera? By default they forward you to Qt 3, or the static Qt 4 builds, which are unable to use the KDE 4 file picker.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
andrewsam
Registered Member
Posts
2
Karma
0
OS

Re: Using the kde file choser

Mon Dec 07, 2009 10:50 am
Hi there.. thanks for your query.. I'm using the qt4 build and not the shared one!

In my recent figetting around, I found something.

When using OpenSUSE 11.2 with KDE 4.4 beta1, there is a "window specific" behavior which is added in the "windows" option of "Appearance" option under system settings.

When I added (opera) to the list of applications there, it seemed to work perfectly. The KDE file picker was shown and it worked well.

I tried doing something like that in Kubuntu, but I'm not that big a techie.. any help there?


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]