kio Library API Documentation

kdatatool.h

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 <david@mandrakesoft.com> 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., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef KDATATOOL_H 00022 #define KDATATOOL_H 00023 00024 #include <qobject.h> 00025 #include <qvaluelist.h> 00026 00027 #include <kaction.h> 00028 #include <kservice.h> 00029 00030 class KDataTool; 00031 class QPixmap; 00032 class QStringList; 00033 class KInstance; 00034 00035 // If you're only looking at implementing a data-tool, skip directly to the last 00036 // class definition, KDataTool. 00037 00047 class KIO_EXPORT KDataToolInfo 00048 { 00049 public: 00053 KDataToolInfo(); 00059 KDataToolInfo( const KService::Ptr& service, KInstance* instance ); 00063 KDataToolInfo( const KDataToolInfo& info ); 00067 KDataToolInfo& operator= ( const KDataToolInfo& info ); 00068 00075 QString dataType() const; 00087 QStringList mimeTypes() const; 00088 00093 bool isReadOnly() const; 00094 00100 QPixmap icon() const KDE_DEPRECATED; 00106 QPixmap miniIcon() const KDE_DEPRECATED; 00111 QString iconName() const; 00125 QStringList userCommands() const; 00137 QStringList commands() const; 00138 00145 KDataTool* createTool( QObject* parent = 0, const char* name = 0 ) const; 00146 00151 KService::Ptr service() const; 00152 00157 KInstance* instance() const { return m_instance; } 00158 00164 bool isValid() const; 00165 00174 static QValueList<KDataToolInfo> query( const QString& datatype, const QString& mimetype, KInstance * instance ); 00175 00176 private: 00177 KService::Ptr m_service; 00178 KInstance* m_instance; 00179 private: 00180 class KDataToolInfoPrivate* d; 00181 }; 00182 00183 00194 class KIO_EXPORT KDataToolAction : public KAction 00195 { 00196 Q_OBJECT 00197 public: 00207 KDataToolAction( const QString & text, const KDataToolInfo & info, const QString & command, QObject * parent = 0, const char * name = 0); 00208 00219 static QPtrList<KAction> dataToolActionList( const QValueList<KDataToolInfo> & tools, const QObject *receiver, const char* slot ); 00220 00221 signals: 00227 void toolActivated( const KDataToolInfo & info, const QString & command ); 00228 00229 protected: 00230 virtual void slotActivated(); 00231 00232 private: 00233 QString m_command; 00234 KDataToolInfo m_info; 00235 protected: 00236 virtual void virtual_hook( int id, void* data ); 00237 private: 00238 class KDataToolActionPrivate* d; 00239 00240 }; 00241 00253 class KIO_EXPORT KDataTool : public QObject 00254 { 00255 Q_OBJECT 00256 public: 00263 KDataTool( QObject* parent = 0, const char* name = 0 ); 00264 00268 void setInstance( KInstance* instance ) { m_instance = instance; } 00269 00275 KInstance* instance() const; 00276 00290 virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype) = 0; 00291 00292 private: 00293 KInstance * m_instance; 00294 protected: 00295 virtual void virtual_hook( int id, void* data ); 00296 private: 00297 class KDataToolPrivate; 00298 KDataToolPrivate * d; 00299 }; 00300 00301 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Apr 12 23:09:08 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003