kio
kdatatool.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
00036
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