[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    question about plugins and mimetypes
From:       Stefano Borini <munehiro () ferrara ! linux ! it>
Date:       2003-11-15 22:55:00
[Download RAW message or body]


Hi all,
i have a tricky question about a simple (but really useful in my job)
application i'm developing.  This app should open a set of file types,
lets' call them TypeA, TypeB and TypeC, which can be both text or binary
(unspecified bunch of data) Some of them could also have more than one
block of data which i'm interested to (think two files packed in a tar
archive... sort of)

My need is this: i want to provide plugins for opening the different
filetypes, so to make my application more powerful. Since TypeA,TypeB
and TypeC have different file format but holds similar data, the plugin
arch is perfect. Also, i need to interface with other languages
(fortran) so linking the whole reader code in a single dynamic library
sets a defined edge between my interface and who will write reader plugins,
making it as transparent as possible.

My initial idea was creating a .so file, then dlopen it using QLibrary
class from qt and access symbols to obtain the desidered result. Before
starting this work, i jumped to #kde-devel and asked about this (in
particular way about standard places for these .so files and their
discovery) and i was addressed to KLibrary, KLibFactory and KLibLoader.

So far... i read some informations about them, but i wasn't able to
figure out the complete drawing.
My question are:

1) is absolutely required that i define mimetypes about TypeA,B and C?
(I mean, an alternative way should be to scan every plugin, feed the
opened file and see if a function bool hasTheFileStructureILike()
returns true).
A correlated question: how can i specify the magics for them, since some
of them are simple text files and others are bunch of data?

2) if i understand well, my base class for the plugin should inherit
KParts::plugin, right?
i have not really clear the difference between the KParts::plugin
approach, doing a .so file to open using KLibLoader or opening it with
QLibrary (apart from all the powerful stuff that works on the GUI, of
course)

3) kdevelop 2.1 does support creation of plugin directories into a
project in a transparent way, or should i hack the makefile.am ?

4) is there some really simple code that does approximately what i need,
just to have an example?

sorry for lots of questions, but i'm trying to get the best out of my
code, and i have no practical experience at all with component
programming and shared object access.

Thanks
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic