Results 1 to 6 of 6

Thread: MIME and KDE

  1. #1
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default MIME and KDE

    AFAIR, KDE doesn't comply with freedesktop.org standards (at least not yet). However there must be a standard way to do some file association... How do :
    • an app registers itself as an handler for a given filetype?
    • force the desktop to use one handler by default for a given user? for all users ?
    Current Qt projects : QCodeEdit, RotiDeCode

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MIME and KDE

    I'm almost sure there has already been a thread describing this on the forum. Please use search facilities to find it.

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MIME and KDE

    There indeed was a thread on that subject (and I started it actually...) but it did not brought me the answers I was looking for... I need pure Qt way to associate, programatically, file extensions (or mime types) with a given application. I know that freedesktop provides some specs (still being worked on) for that but unfortunately, KDE doesn't comply with them, neither do Mac and M$ Window$... (and I'm not sure about gnome). So my point is to get low-level information about key files that need to be edited so as to achieve a proper file registration, without forcing the user to run some commands or edit anything on its own...

    hmmm...I took another work around in linux...

    for KDE I used "kfmclient"

    for GNOME i used "gnome-open"

    just pass the --help as an arguement to see how to use the system

    Now as for working for associating a file is concerned...you need to do this:

    Quote:
    1. download the latest freedesktop-mime-database.
    2. create your own file following the standard and add it to database
    3. run update-mime-database command
    4. run update-desktop-database command
    so you see there is technically no code snippet just a series of commands...

    now re-read the info-spec i pointed out previously....you'll understand more completely...what i just said will act as a glue to merge all the not-so-clear spec

    Now for Windows: You'll have to play with MFCs/Win32 API for this...look through the docs...am not very well versed this But here is the shortcut....create a custom extension, open it through explorer...and choose app to open that file!!!!....you could also physically do it by setting the "file type" from the tool>options etc....you know the story)

    MAC: hmmmm well MAC was a closed source system...they have now started to release out the API, so try getting your hands on it. I haven't used MAC much, but from what i know, it's a harrowing task to find the API...but i think some googling around would help...

    NOTE: The concept of MIME types is present in all systems (i.e. all systems are merging towards this)...try exploiting this...

    in one of the threads by munna, he asked how to open a a .swf by using the default app...here's the link....someone put a code snippet that was damn good...it could be of use to you...

    here's the link:

    http://www.qtcentre.org/forum/showthread.php?t=2029

    see how the registry is accesed using Qt and you could use it to your benefit!!
    That's what nupul said me the last time I asked the question. As you can see it's not exactly the answer I need... My aim is not to open a file of a given type but to make the desktop open it with my app by default (unless the user doesn't want it of course...). I already grabbed some informations about Window$ registry by investigating it through regedit and Qt examples related to settings but I'm not a specialist of KDE and I must admit I'm a bit puzzled by the different mime-related directories I found in /usr/share... Maybe someone has a more in-depth explanation on how they work and what I shall do to achieve my goal...
    Current Qt projects : QCodeEdit, RotiDeCode

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MIME and KDE

    Quote Originally Posted by fullmetalcoder View Post
    There indeed was a thread on that subject (and I started it actually...) but it did not brought me the answers I was looking for...
    Next time, please, continue the old thread instead creating a new one, especially when your problem wasn't solved completely.

  5. #5
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MIME and KDE

    Sir! Yes sir!

    BTW I found what I was looking for after an in-depth investigation of KDE online manual : http://docs.kde.org/userguide/file-associations.html
    Everything relevant (AFAIC) is here, except one small piece of info : the application .desktop files are stored in /usr/share/applications ...

    Does anyone know in which version KDE plans to bring support of freedesktop standards???
    Last edited by fullmetalcoder; 2nd February 2007 at 20:39.
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #6
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MIME and KDE

    edit : browser quirk caused a post duplication...
    Last edited by fullmetalcoder; 2nd February 2007 at 20:39. Reason: browser quirk caused a post duplication....
    Current Qt projects : QCodeEdit, RotiDeCode

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.