KDELibs4Support

kdatatool.h
1 /* This file is part of the KDE project
2  Copyright (C) 1998, 1999, 2000 Torben Weis <[email protected]>
3  Copyright (C) 2001 David Faure <[email protected]>
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 <kdelibs4support_export.h>
25 #include <QObject>
26 #include <QString>
27 
28 #include <QAction>
29 
30 #include <kservice.h>
31 
32 class KDataTool;
33 class QPixmap;
34 class QStringList;
35 class KActionCollection;
36 
37 // If you're only looking at implementing a data-tool, skip directly to the last
38 // class definition, KDataTool.
39 
49 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KDataToolInfo
50 {
51 public:
55  KDataToolInfo();
61  KDataToolInfo(const KService::Ptr &service, const QString &componentName);
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 
105  QString iconName() const;
119  QStringList userCommands() const;
131  QStringList commands() const;
132 
138  KDataTool *createTool(QObject *parent = nullptr) const;
139 
144  KService::Ptr service() const;
145 
150  QString componentName() const;
151 
157  bool isValid() const;
158 
167  static QList<KDataToolInfo> query(const QString &datatype, const QString &mimetype, const QString &componentName);
168 
169 private:
170  class KDataToolInfoPrivate;
171  KDataToolInfoPrivate *const d;
172 };
173 
184 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KDataToolAction : public QAction
185 {
186  Q_OBJECT
187 public:
197  KDataToolAction(const QString &text, const KDataToolInfo &info, const QString &command, QObject *parent);
198 
202  ~KDataToolAction();
203 
215  static QList<QAction *> dataToolActionList(const QList<KDataToolInfo> &tools, const QObject *receiver, const char *slot, KActionCollection *parent);
216 
217 Q_SIGNALS:
223  void toolActivated(const KDataToolInfo &info, const QString &command);
224 
225 protected:
226  virtual void slotActivated();
227 
228 private:
229  class KDataToolActionPrivate;
230  KDataToolActionPrivate *const d;
231 
232 };
233 
245 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KDataTool : public QObject
246 {
247  Q_OBJECT
248 public:
254  KDataTool(QObject *parent = nullptr);
255 
259  ~KDataTool();
260 
264  void setComponentName(const QString &componentName);
265 
271  QString componentName() const;
272 
286  virtual bool run(const QString &command, void *data, const QString &datatype, const QString &mimetype) = 0;
287 
288 private:
289  class KDataToolPrivate;
290  KDataToolPrivate *const d;
291 };
292 
293 #endif
This class helps applications implement support for KDataTool.
Definition: kdatatool.h:184
This is a convenience class for KService.
Definition: kdatatool.h:49
A generic tool that processes data.
Definition: kdatatool.h:245
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jun 6 2020 22:41:39 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.