kio Library API Documentation

KDataToolInfo Class Reference

This is a convenience class for KService. More...

#include <kdatatool.h>

List of all members.

Public Methods

 KDataToolInfo ()
 Create an invalid KDataToolInfo.

 KDataToolInfo (const KService::Ptr &service, KInstance *instance)
 Create a valid KDataToolInfo.

 KDataToolInfo (const KDataToolInfo &info)
 Copy constructor.

KDataToolInfo & operator= (const KDataToolInfo &info)
 Assignment operator.

QString dataType () const
QStringList mimeTypes () const
bool isReadOnly () const
QPixmap icon () const
QPixmap miniIcon () const
QString iconName () const
QStringList userCommands () const
QStringList commands () const
KDataToolcreateTool (QObject *parent=0, const char *name=0) const
 Creates the data tool described by this KDataToolInfo.

bool isValid () const
 A DataToolInfo may be invalid if the KService passed to its constructor does not feature the service type "KDataTool".


Static Public Methods

QValueList< KDataToolInfo > query (const QString &datatype, const QString &mimetype, KInstance *instance)
 Queries the KTrader about installed KDataTool implementations.


Detailed Description

This is a convenience class for KService.

You can use it if you have a KService describing a KDataTool. In this case the KDataToolInfo class is more convenient to work with.

Especially useful is the method createTool which creates the datatool described by the service.

Definition at line 46 of file kdatatool.h.


Constructor & Destructor Documentation

KDataToolInfo::KDataToolInfo  
 

Create an invalid KDataToolInfo.

Definition at line 38 of file kdatatool.cpp.

Referenced by query().

KDataToolInfo::KDataToolInfo const KService::Ptr &    service,
KInstance   instance
 

Create a valid KDataToolInfo.

Definition at line 43 of file kdatatool.cpp.

References KNotifyClient::instance().

KDataToolInfo::KDataToolInfo const KDataToolInfo &    info
 

Copy constructor.

Definition at line 56 of file kdatatool.cpp.

References instance(), and service().


Member Function Documentation

KDataToolInfo & KDataToolInfo::operator= const KDataToolInfo &    info
 

Assignment operator.

Definition at line 62 of file kdatatool.cpp.

References instance(), and service().

QString KDataToolInfo::dataType  
 

Returns:
the C++ data type that this DataTool accepts. For example "QString" or "QImage" or something more complicated.

Definition at line 69 of file kdatatool.cpp.

QStringList KDataToolInfo::mimeTypes  
 

Returns:
the mime types accepted by this DataTool. For example "image/gif" or "text/plain". In some cases the dataType determines the accepted type of data perfectly. In this cases this list may be empty.
The mimetypes are only used if the dataType can be used to store different mimetypes. For example in a "QString" you could save "text/plain" or "text/html" or "text/xml".

Definition at line 77 of file kdatatool.cpp.

bool KDataToolInfo::isReadOnly  
 

Returns:
TRUE if the DataTool does not modify the data passed to it by KDataTool::run.

Definition at line 85 of file kdatatool.cpp.

QPixmap KDataToolInfo::icon  
 

Returns:
a large pixmap for the DataTool.
Deprecated:
, use iconName()

Definition at line 93 of file kdatatool.cpp.

References KGlobal::dirs(), QPixmap::load(), and KStandardDirs::resourceDirs().

QPixmap KDataToolInfo::miniIcon  
 

Returns:
a mini pixmap for the DataTool.
Deprecated:
, use iconName()

Definition at line 107 of file kdatatool.cpp.

References KGlobal::dirs(), QPixmap::load(), and KStandardDirs::resourceDirs().

QString KDataToolInfo::iconName  
 

Returns:
the name of the icon for the DataTool

Definition at line 121 of file kdatatool.cpp.

QStringList KDataToolInfo::userCommands  
 

Returns:
a list if strings that you can put in a QPopupMenu item, for example to offer the DataTools services to the user. The returned value is usually something like "Spell checking", "Shrink Image", "Rotate Image" or something like that.
This list comes from the Comment field of the tool's desktop file (so that it can be translated).

Each of the strings returned corresponds to a string in the list returned by commands.

Definition at line 136 of file kdatatool.cpp.

References QStringList::split().

QStringList KDataToolInfo::commands  
 

Returns:
the list of commands the DataTool can execute. The application passes the command to the KDataTool::run method.
This list comes from the Commands field of the tool's desktop file.

Each of the strings returned corresponds to a string in the list returned by userCommands.

Definition at line 128 of file kdatatool.cpp.

KDataTool * KDataToolInfo::createTool QObject   parent = 0,
const char *    name = 0
const
 

Creates the data tool described by this KDataToolInfo.

Returns:
a pointer to the created data tool or 0 on error.

Definition at line 144 of file kdatatool.cpp.

References KLibFactory::create(), QFile::encodeName(), KLibLoader::factory(), QObject::inherits(), KLibLoader::self(), and KDataTool::setInstance().

bool KDataToolInfo::isValid  
 

A DataToolInfo may be invalid if the KService passed to its constructor does not feature the service type "KDataTool".

Definition at line 216 of file kdatatool.cpp.

QValueList< KDataToolInfo > KDataToolInfo::query const QString   datatype,
const QString   mimetype,
KInstance   instance
[static]
 

Queries the KTrader about installed KDataTool implementations.

Parameters:
datatype  a type that the application can 'export' to the tools (e.g. QString)
mimetype  the mimetype of the data (e.g. text/plain)
instance  the application (or the part)'s instance (to check if a tool is excluded from this part, and also used if the tool wants to read its configuration in the app's config file).

Definition at line 170 of file kdatatool.cpp.

References QValueList::append(), QValueList::begin(), QValueList::end(), QString::fromLatin1(), KNotifyClient::instance(), KInstance::instanceName(), QString::isEmpty(), KDataToolInfo(), KIO::mimetype(), KTrader::query(), and KTrader::self().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:34 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001