• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • kio
kdatatool.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
3 Copyright (C) 2001 David Faure <faure@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KDATATOOL_H
22#define KDATATOOL_H
23
24#include <kio/kio_export.h>
25#include <QtCore/QObject>
26#include <QtCore/QString>
27
28#include <kaction.h>
29#include <kservice.h>
30#include <kcomponentdata.h>
31
32class KDataTool;
33class QPixmap;
34class QStringList;
35class KActionCollection;
36
37// If you're only looking at implementing a data-tool, skip directly to the last
38// class definition, KDataTool.
39
49class KIO_EXPORT KDataToolInfo
50{
51public:
55 KDataToolInfo();
61 KDataToolInfo(const KService::Ptr& service, const KComponentData &instance);
65 ~KDataToolInfo();
69 KDataToolInfo( const KDataToolInfo& info );
73 KDataToolInfo& operator= ( const KDataToolInfo& info );
74
81 QString dataType() const;
93 QStringList mimeTypes() const;
94
99 bool isReadOnly() const;
100
106#ifndef KDE_NO_DEPRECATED
107 KDE_DEPRECATED QPixmap icon() const;
108#endif
114#ifndef KDE_NO_DEPRECATED
115 KDE_DEPRECATED QPixmap miniIcon() const;
116#endif
121 QString iconName() const;
135 QStringList userCommands() const;
147 QStringList commands() const;
148
154 KDataTool* createTool( QObject* parent = 0 ) const;
155
160 KService::Ptr service() const;
161
166 KComponentData componentData() const;
167
173 bool isValid() const;
174
183 static QList<KDataToolInfo> query(const QString& datatype, const QString& mimetype, const KComponentData &instance);
184
185private:
186 class KDataToolInfoPrivate;
187 KDataToolInfoPrivate * const d;
188};
189
190
201class KIO_EXPORT KDataToolAction : public KAction
202{
203 Q_OBJECT
204public:
214 KDataToolAction( const QString & text, const KDataToolInfo & info, const QString & command, QObject *parent );
215
219 ~KDataToolAction();
220
232 static QList<QAction*> dataToolActionList( const QList<KDataToolInfo> & tools, const QObject *receiver, const char* slot, KActionCollection* parent );
233
234Q_SIGNALS:
240 void toolActivated( const KDataToolInfo & info, const QString & command );
241
242protected:
243 virtual void slotActivated();
244
245private:
246 class KDataToolActionPrivate;
247 KDataToolActionPrivate * const d;
248
249};
250
262class KIO_EXPORT KDataTool : public QObject
263{
264 Q_OBJECT
265public:
271 KDataTool( QObject* parent = 0 );
272
276 ~KDataTool();
277
281 void setComponentData(const KComponentData &componentData);
282
288 const KComponentData &componentData() const;
289
303 virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype) = 0;
304
305private:
306 class KDataToolPrivate;
307 KDataToolPrivate * const d;
308};
309
310#endif
KActionCollection
KAction::KAction
KAction(const KIcon &icon, const QString &text, QObject *parent)
KComponentData
KDataToolAction::dataToolActionList
static QList< QAction * > dataToolActionList(const QList< KDataToolInfo > &tools, const QObject *receiver, const char *slot, KActionCollection *parent)
Creates a list of actions from a list of information about data-tools.
Definition kdatatool.cpp:274
KDataToolAction::slotActivated
virtual void slotActivated()
Definition kdatatool.cpp:269
KDataToolAction::toolActivated
void toolActivated(const KDataToolInfo &info, const QString &command)
Emitted when a tool has been activated.
KDataToolAction::KDataToolAction
KDataToolAction(const QString &text, const KDataToolInfo &info, const QString &command, QObject *parent)
Constructs a new KDataToolAction.
Definition kdatatool.cpp:254
KDataToolInfo
This is a convenience class for KService.
Definition kdatatool.h:50
KDataToolInfo::service
KService::Ptr service() const
The KDataToolInfo's service that is represented by this class.
Definition kdatatool.cpp:178
KDataToolInfo::isValid
bool isValid() const
A DataToolInfo may be invalid if the KService passed to its constructor does not feature the service ...
Definition kdatatool.cpp:235
KDataToolInfo::iconName
QString iconName() const
Returns the icon name for this DataTool.
Definition kdatatool.cpp:144
KDataToolInfo::createTool
KDataTool * createTool(QObject *parent=0) const
Creates the data tool described by this KDataToolInfo.
Definition kdatatool.cpp:167
KDataToolInfo::userCommands
QStringList userCommands() const
Returns a list of strings that you can put in a QPopupMenu item, for example to offer the DataTools s...
Definition kdatatool.cpp:159
KDataToolInfo::mimeTypes
QStringList mimeTypes() const
Returns a list of mime type that will be accepted by the DataTool.
Definition kdatatool.cpp:96
KDataToolInfo::commands
QStringList commands() const
Returns the list of commands the DataTool can execute.
Definition kdatatool.cpp:151
KDataToolInfo::icon
QPixmap icon() const
Returns the icon of this data tool.
Definition kdatatool.cpp:113
KDataToolInfo::isReadOnly
bool isReadOnly() const
Checks whether the DataTool is read-only.
Definition kdatatool.cpp:104
KDataToolInfo::miniIcon
QPixmap miniIcon() const
Returns the mini icon of this data tool.
Definition kdatatool.cpp:129
KDataToolInfo::query
static QList< KDataToolInfo > query(const QString &datatype, const QString &mimetype, const KComponentData &instance)
Queries the KServiceTypeTrader about installed KDataTool implementations.
Definition kdatatool.cpp:188
KDataToolInfo::dataType
QString dataType() const
Returns the data type that the DataTool can accept.
Definition kdatatool.cpp:88
KDataToolInfo::KDataToolInfo
KDataToolInfo()
Create an invalid KDataToolInfo.
Definition kdatatool.cpp:50
KDataToolInfo::componentData
KComponentData componentData() const
The instance of the service.
Definition kdatatool.cpp:183
KDataTool
A generic tool that processes data.
Definition kdatatool.h:263
KDataTool::setComponentData
void setComponentData(const KComponentData &componentData)
Definition kdatatool.cpp:333
KDataTool::componentData
const KComponentData & componentData() const
Returns the instance of the part that created this tool.
Definition kdatatool.cpp:338
KDataTool::run
virtual bool run(const QString &command, void *data, const QString &datatype, const QString &mimetype)=0
Interface for 'running' this tool.
KDataTool::KDataTool
KDataTool(QObject *parent=0)
Constructor The data-tool is only created when a menu-item, that relates to it, is activated.
Definition kdatatool.cpp:323
KService::Ptr
KSharedPtr< KService > Ptr
QList
QObject
kaction.h
kcomponentdata.h
kio_export.h
kservice.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.14.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal