20#include "tdepartsdesignerplugin.h"
22#include <tdeparts/componentfactory.h>
23#include <tdeparts/part.h>
26#include <tdeapplication.h>
29KPartsGenericPart::KPartsGenericPart( TQWidget* parentWidget, const char* name )
30 : TQWidget( parentWidget, name ), m_part( 0 )
32 TQVBoxLayout* layout = new TQVBoxLayout( this );
33 layout->setAutoAdd( true );
36void KPartsGenericPart::load()
38 if ( m_mimetype.isEmpty() || m_url.isEmpty() )
44 TQString mimetype = m_mimetype;
45 if ( mimetype == "auto" )
46 mimetype == KMimeType::findByURL( m_url )->name();
51 m_part = KParts::ComponentFactory::createPartInstanceFromQuery<KParts::ReadOnlyPart>( mimetype, TQString(), this, 0, this, 0 );
53 m_part->openURL( m_url );
54 m_part->widget()->show();
60static const char* mykey = "KPartsGenericPart";
62TQStringList KPartsWidgetPlugin::keys() const {
63 return TQStringList() << mykey;
66TQWidget * KPartsWidgetPlugin::create( const TQString & key, TQWidget * parent, const char * name ) {
72TQString KPartsWidgetPlugin::group( const TQString & key ) const {
74 return "Display (KDE)";
79TQIconSet KPartsWidgetPlugin::iconSet( const TQString & key ) const {
84TQString KPartsWidgetPlugin::includeFile( const TQString & key ) const {
86 return "partplugin.h";
90TQString KPartsWidgetPlugin::toolTip( const TQString & key ) const {
92 return "Generic KParts viewer";
96TQString KPartsWidgetPlugin::whatsThis( const TQString & key ) const {
98 return "A widget to embed any KParts viewer, given a url and optionally a mimetype";
102bool KPartsWidgetPlugin::isContainer( const TQString & ) const {
107#ifndef TDE_EXPORT_PLUGIN
108#define TDE_EXPORT_PLUGIN(PLUGIN) \
109 TQ_EXTERN_C TDE_EXPORT const char* qt_ucm_query_verification_data(); \
110 TQ_EXTERN_C TDE_EXPORT TQUnknownInterface* ucm_instantiate(); \
111 TQ_EXPORT_PLUGIN(PLUGIN)
116#include "tdepartsdesignerplugin.moc"
Generic part loader, able to view any kind of file for which a KParts::ReadOnlyPart is available.
|