Tutorial: Write your own KFile Plugins
Tuesday, 11 May 2004 | Bhards
If you've ever wanted to get into KDE coding, but reading tens of thousands of lines of code to get familiar with one of the bigger programs was more time than you have, then you might want to check out the tutorial on KFile plugins that I've written.
For those not familiar, a KFile plugin is the meta-data magic that powers the "MetaInfo" tab when you display the properties of a file, and the Info List View in Konqueror. It's easy to write one, and there are a lot of file formats we don't have support for yet. This is a fun way to get into KDE development!
Comments:
Some simple plugins need maintained - George Russell - 2004-05-11
Plugins to display information on BibTex, Python, Java, and LyX files are available at <a href="http://dogma.freebsd-uk.eu.org/~grrussel/">http://dogma.freebsd-uk.eu.org/~grrussel/</a> . The code is small, simple and in need of a maintainer. <br> In general, textual formats are easy to support in konquerer plugins!
Re: Some simple plugins need maintained - Will Stephenson - 2004-05-11
I've been using these for ages, they're very useful. I'd assumed they'd be in kdeaddons by now, is there any reason they are not?
Re: Some simple plugins need maintained - Pieter - 2004-05-11
I would be willing to do the work needed to bring these plugins into some KDE module (kdegraphics?). It seems a waste of time maintaining these modules outside the main source. If the code is not in the main distribution many users would not use the plugins (or even know they existed). George if you want me to do this, contact me by email.
Re: Some simple plugins need maintained - George Russell - 2004-05-11
Two reasons; the Java / Python plugins are hacks that do not parse Java / Python syntax but scan for keywords. Secondly, the code has never been cleanly packaged and I no longer use KDE (its not up to scratch on OSX yet).
Searching based on meta info? - Fred Schättgen - 2004-05-11
Thanks for the tutorial, Brad :] Docs like that are more valuable for KDE than the same amount of C++-code. Wouldn't it be possible to use the meta info data for searching? KDE should really provide an index based search function. The meta data plugins could be utilized to collect data from non-textual files, like jpeg with exif data, pdf etc. Many they could also be used for full-text indexing. In the end it should be something like an extended version of 'locate', which is fast enough to use it just because one is too lazy to click through several folders and with a UI not much more complex as google.
Re: Searching based on meta info? - Anonymous - 2004-05-11
KFind already allows you to search the metainfo sections.
KPlayer 0.5 comes with a KFile plugin - kiriuja - 2004-05-11
For the record, KPlayer 0.5, which is due out in just a few weeks, will come with a KFile plugin that shows metadata for any media file playable with MPlayer. One minor drawback is that it will only show metadata for file that have already been opened with KPlayer. http://kplayer.sf.net/
Great Tutorial - Dominik Seichter - 2004-05-11
Hi, This is a very good tutorial and I hope it brings lot's of new file plugins to KDE. Maybe you could add in the future a chapter how to use KFile plugins in your own application. For example my application, KRename (http://www.krename.net), uses KFile plugins to retrieve various meta informations from all kinds of files and remames them using this pieces of information. With little code I was able to add support for lot's of different file types. CU Dom
Re: Great Tutorial - Brad Hards - 2004-05-11
I'll look to add more usage details (on KFile and KFind, as they relate to the meta-data stuff) in a future version.
Metadata in Tooltips - John Metadata Freak - 2004-05-11
Speaking of metadata, wouldn't it be nice if tooltips separated generic from metadata info somehow? Maybe a small horizontal line between both, or each inside a rectangle? Or at least some blank space?
OT: KDE-Pim Outlook Connector? - Anonymous - 2004-05-11
Given the release of Ximian's Outlook Connector under the GPL (http://lwn.net/Articles/84494/), are there any plans to add Outlook/Exchange support to KMail and Kontact? Just wondering...
Re: OT: KDE-Pim Outlook Connector? - Thorsten Schnebeck - 2004-05-11
Use the Exchange-server-resource of KDEPIM: ls kdepim/kresources/ CVS Makefile Makefile.am Makefile.in egroupware exchange imap I don't know how well evo-exchange-plugin works, but I think kdepim could benefit/learn from there implementation. Bye Thorsten
OT: Novell To Release Ximian Connector Under GPL - ac - 2004-05-11
Novell To Release Ximian Connector Under GPL The code is here: http://ftp.ximian.com/pub/source/evolution/ximian-connector-1.4.7.tar.gz Am I the only one who thinks that Kontact needs to incorporate this?
Re: OT: Novell To Release Ximian Connector Under GPL - anon - 2004-05-11
> Am I the only one who thinks that Kontact needs to incorporate this? I think the kontact developers are already working on exchange support, and this will no doubt help them.,
KDE PIM - Art - 2004-05-12
I need to things to become a happy KDE-full-time user. a) A descent client/server groupware application. I'm wondering, why KDE PIM has no connector for OpenGroupware or Exchange (even if we hate it, it works) b) A way to synchronize my Pocket PC running on Windows Mobile. I know there is synchronisation for Palm, but Pocket PC's are on the market and their market share is quite big. From the day on, when KDE PIM can do groupware I'm switching. On the day, I get my Pocket PC synchronizing, I'm free. (All my Oracle tools work already under Linux :))
Registering multiple mime types - Arun - 2004-05-13
If I am writing a KFile plugin for say Java .class files, there are multiple mime types in use for them - application/java, application/java-byte-code, application/java-vm, application/x-java-class, application/x-java-byte-code - to name a few. How do I register all of them as associated with the same plugin class? Is it by multiple calls to addMimeTypeInfo? How about the .desktop file? Do I add multiple MimeType entries there?
Re: Registering multiple mime types - Arun - 2004-05-17
I figured out the answers to the two questions myself. In the .desktop, all the mime types need to be in the same MimeType entry like this: MimeType=application/java;application/java-byte-code;application/java-vm;application/x-java;application/x-java-class;application/x-java-byte-code I believe regular expressions are also allowed. In the plugin class, multiple calls should be made to addMimeTypeInfo for each type and all the groups, items need to be added to each KFileMimeTypeInfo. I have a small KFile plugin for .class files at http://arun.homeip.net/kdev/kfile_class_src.zip if anyone is interested.