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 #include <kdemacros.h> 00030 00031 class KDataTool; 00032 class QPixmap; 00033 class QStringList; 00034 class KInstance; 00035 00036 // If you're only looking at implementing a data-tool, skip directly to the last 00037 // class definition, KDataTool. 00038 00048 class KDataToolInfo 00049 { 00050 public: 00054 KDataToolInfo(); 00060 KDataToolInfo( const KService::Ptr& service, KInstance* instance ); 00064 KDataToolInfo( const KDataToolInfo& info ); 00068 KDataToolInfo& operator= ( const KDataToolInfo& info ); 00069 00076 QString dataType() const; 00088 QStringList mimeTypes() const; 00089 00094 bool isReadOnly() const; 00095 00101 QPixmap icon() const KDE_DEPRECATED; 00107 QPixmap miniIcon() const KDE_DEPRECATED; 00112 QString iconName() const; 00126 QStringList userCommands() const; 00138 QStringList commands() const; 00139 00146 KDataTool* createTool( QObject* parent = 0, const char* name = 0 ) const; 00147 00152 KService::Ptr service() const; 00153 00158 KInstance* instance() const { return m_instance; } 00159 00165 bool isValid() const; 00166 00175 static QValueList<KDataToolInfo> query( const QString& datatype, const QString& mimetype, KInstance * instance ); 00176 00177 private: 00178 KService::Ptr m_service; 00179 KInstance* m_instance; 00180 private: 00181 class KDataToolInfoPrivate* d; 00182 }; 00183 00184 00195 class KDataToolAction : public KAction 00196 { 00197 Q_OBJECT 00198 public: 00208 KDataToolAction( const QString & text, const KDataToolInfo & info, const QString & command, QObject * parent = 0, const char * name = 0); 00209 00220 static QPtrList<KAction> dataToolActionList( const QValueList<KDataToolInfo> & tools, const QObject *receiver, const char* slot ); 00221 00222 signals: 00228 void toolActivated( const KDataToolInfo & info, const QString & command ); 00229 00230 protected: 00231 virtual void slotActivated(); 00232 00233 private: 00234 QString m_command; 00235 KDataToolInfo m_info; 00236 protected: 00237 virtual void virtual_hook( int id, void* data ); 00238 private: 00239 class KDataToolActionPrivate* d; 00240 00241 }; 00242 00254 class KDataTool : public QObject 00255 { 00256 Q_OBJECT 00257 public: 00264 KDataTool( QObject* parent = 0, const char* name = 0 ); 00265 00269 void setInstance( KInstance* instance ) { m_instance = instance; } 00270 00276 KInstance* instance() const; 00277 00291 virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype) = 0; 00292 00293 private: 00294 KInstance * m_instance; 00295 protected: 00296 virtual void virtual_hook( int id, void* data ); 00297 private: 00298 class KDataToolPrivate; 00299 KDataToolPrivate * d; 00300 }; 00301 00302 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:43:51 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003