KIO
kdatatool.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org> 00003 Copyright (C) 2001 David Faure <faure@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KDATATOOL_H 00022 #define KDATATOOL_H 00023 00024 #include <kio/kio_export.h> 00025 #include <QtCore/QObject> 00026 #include <QtCore/QString> 00027 00028 #include <kaction.h> 00029 #include <kservice.h> 00030 #include <kcomponentdata.h> 00031 00032 class KDataTool; 00033 class QPixmap; 00034 class QStringList; 00035 class KActionCollection; 00036 00037 // If you're only looking at implementing a data-tool, skip directly to the last 00038 // class definition, KDataTool. 00039 00049 class KIO_EXPORT KDataToolInfo 00050 { 00051 public: 00055 KDataToolInfo(); 00061 KDataToolInfo(const KService::Ptr& service, const KComponentData &instance); 00065 ~KDataToolInfo(); 00069 KDataToolInfo( const KDataToolInfo& info ); 00073 KDataToolInfo& operator= ( const KDataToolInfo& info ); 00074 00081 QString dataType() const; 00093 QStringList mimeTypes() const; 00094 00099 bool isReadOnly() const; 00100 00106 #ifndef KDE_NO_DEPRECATED 00107 KDE_DEPRECATED QPixmap icon() const; 00108 #endif 00109 00114 #ifndef KDE_NO_DEPRECATED 00115 KDE_DEPRECATED QPixmap miniIcon() const; 00116 #endif 00117 00121 QString iconName() const; 00135 QStringList userCommands() const; 00147 QStringList commands() const; 00148 00154 KDataTool* createTool( QObject* parent = 0 ) const; 00155 00160 KService::Ptr service() const; 00161 00166 KComponentData componentData() const; 00167 00173 bool isValid() const; 00174 00183 static QList<KDataToolInfo> query(const QString& datatype, const QString& mimetype, const KComponentData &instance); 00184 00185 private: 00186 class KDataToolInfoPrivate; 00187 KDataToolInfoPrivate * const d; 00188 }; 00189 00190 00201 class KIO_EXPORT KDataToolAction : public KAction 00202 { 00203 Q_OBJECT 00204 public: 00214 KDataToolAction( const QString & text, const KDataToolInfo & info, const QString & command, QObject *parent ); 00215 00219 ~KDataToolAction(); 00220 00232 static QList<QAction*> dataToolActionList( const QList<KDataToolInfo> & tools, const QObject *receiver, const char* slot, KActionCollection* parent ); 00233 00234 Q_SIGNALS: 00240 void toolActivated( const KDataToolInfo & info, const QString & command ); 00241 00242 protected: 00243 virtual void slotActivated(); 00244 00245 private: 00246 class KDataToolActionPrivate; 00247 KDataToolActionPrivate * const d; 00248 00249 }; 00250 00262 class KIO_EXPORT KDataTool : public QObject 00263 { 00264 Q_OBJECT 00265 public: 00271 KDataTool( QObject* parent = 0 ); 00272 00276 ~KDataTool(); 00277 00281 void setComponentData(const KComponentData &componentData); 00282 00288 const KComponentData &componentData() const; 00289 00303 virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype) = 0; 00304 00305 private: 00306 class KDataToolPrivate; 00307 KDataToolPrivate * const d; 00308 }; 00309 00310 #endif
KDE 4.6 API Reference