# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# 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
    00046 class KDataToolInfo
    00047 {
    00048 public:
    00052     KDataToolInfo();
    00056     KDataToolInfo( const KService::Ptr& service, KInstance* instance );
    00060     KDataToolInfo( const KDataToolInfo& info );
    00064     KDataToolInfo& operator= ( const KDataToolInfo& info );
    00065
    00071     QString dataType() const;
    00082     QStringList mimeTypes() const;
    00083
    00087     bool isReadOnly() const;
    00088
    00093     QPixmap icon() const;
    00098     QPixmap miniIcon() const;
    00102     QString iconName() const;
    00115     QStringList userCommands() const;
    00125     QStringList commands() const;
    00126
    00131     KDataTool* createTool( QObject* parent = 0, const char* name = 0 ) const;
    00132
    00133     KService::Ptr service() const;
    00134     KInstance* instance() const { return m_instance; }
    00135
    00140     bool isValid() const;
    00141
    00149     static QValueList<KDataToolInfo> query( const QString& datatype, const QString& mimetype, KInstance * instance );
    00150
    00151 private:
    00152     KService::Ptr m_service;
    00153     KInstance* m_instance;
    00154 private:
    00155     class KDataToolInfoPrivate* d;
    00156 };
    00157
    00158
    00169 class KDataToolAction : public KAction
    00170 {
    00171     Q_OBJECT
    00172 public:
    00173     KDataToolAction( const QString & text, const KDataToolInfo & info, const QString & command, QObject * parent = 0, const char * name = 0);
    00174
    00181     static QPtrList<KAction> dataToolActionList( const QValueList<KDataToolInfo> & tools, const QObject *receiver, const char* slot );
    00182
    00183 signals:
    00184     void toolActivated( const KDataToolInfo & info, const QString & command );
    00185
    00186 protected:
    00187     virtual void slotActivated();
    00188
    00189 private:
    00190     QString m_command;
    00191     KDataToolInfo m_info;
    00192 protected:
    00193     virtual void virtual_hook( int id, void* data );
    00194 private:
    00195     class KDataToolActionPrivate* d;
    00196
    00197 };
    00198
    00210 class KDataTool : public QObject
    00211 {
    00212     Q_OBJECT
    00213 public:
    00218     KDataTool( QObject* parent = 0, const char* name = 0 );
    00219
    00223     void setInstance( KInstance* instance ) { m_instance = instance; }
    00224
    00229     KInstance* instance() const;
    00230
    00243     virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype) = 0;
    00244
    00245 private:
    00246     KInstance * m_instance;
    00247 protected:
    00248     virtual void virtual_hook( int id, void* data );
    00249 private:
    00250     class KDataToolPrivate;
    00251     KDataToolPrivate * d;
    00252 };
    00253
    00254 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:13:15 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001