KMimeTypeChooser

Simon Hausmann hausmann at kde.org
Fri Apr 9 15:08:05 BST 2004


On Friday 09 April 2004 15:19, Anders Lund wrote:
> Hi,
>
> Here is another widget and dialog that I and some other kate developers
> would like to see in kdelibs/kdeui.
>
> It provides a checkable list of all mimetypes to choose from, for the
> purpose of editing mimetype/file pattern lists.
>
> If you want to se an example, launch the katepart config dialog (from kate,
> kdevelop w/katepart, kwrite, ...) and look at the filttype or highlight
> pages. They have a small wizard button next to the "Mime types" lineedits
> which will show the dialog.
>
> Apart from those two dialog pages, it is used in the KTE autobookmark
> plugin (which has a copy of the src code) and Dominik Hauman is looking to
> use it in another plugin. I also heard from a kdevelop developer that he
> wanted something similar.
>
> If adding this to kdeui is acceptable, I will designerify the widget and
> possibly add a method to get a list of KMimeType::Ptr's in addition to the
> stringlists.

Two API nitpicks I have :)

1) The four get methods that return QStringList needs a const.
2) The constructors are inconsistent in the sense that it's common
to have the parent object argument (along with the name, if you
want it) as last argument of a QObject/QWidget constructor.

One idea to beautify the caller code a bit with the 
boolean-argument-sucks pattern would be to have an API that
allows writing something like:

KMimeTypeChooser *chooser = new KMimeTypeChooser( KMimeTypeChooser::HideEditButton | KMimeTypeChooser::HidePattern, this );

instead of the less readable

KMimeTypeChooser *chooser = new KMimeTypeChooser( false, false, this );

Simon




More information about the kde-core-devel mailing list