1 /* This file is part of the KDE project
2 Copyright (C) 2002 Alexander Neundorf <neundorf@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
23 #include <kcomponentdata.h>
27 #include <kstandarddirs.h>
28 #include <kaboutdata.h>
29 #include <kdeversion.h>
33 KDE_EXPORT
void* init_libkmanpart()
35 return new KManPartFactory
;
39 KComponentData
*KManPartFactory::s_instance
= 0L;
40 KAboutData
* KManPartFactory::s_about
= 0L;
42 KManPartFactory::KManPartFactory( QObject
* parent
)
43 : KParts::Factory( parent
)
46 KManPartFactory::~KManPartFactory()
53 KParts::Part
* KManPartFactory::createPartObject( QWidget
* parentWidget
, QObject
*,
54 const char* /*className*/,const QStringList
& )
56 KManPart
* part
= new KManPart(parentWidget
);
60 const KComponentData
&KManPartFactory::componentData()
64 s_about
= new KAboutData( "kmanpart", 0,
65 ki18n( "KMan" ), KDE_VERSION_STRING
);
66 s_instance
= new KComponentData(s_about
);
72 KManPart::KManPart( QWidget
* parent
)
76 setComponentData(KComponentData("kmanpart"));
77 m_extension
=new KParts::BrowserExtension(this);
80 bool KManPart::openUrl( const KUrl
&url
)
82 return KParts::ReadOnlyPart::openUrl(url
);
85 bool KManPart::openFile()
93 url
.setProtocol( "man" );
94 url
.setPath( localFilePath() );
96 m_job
= KIO::get( url
, KIO::NoReload
, KIO::HideProgressInfo
);
97 connect( m_job
, SIGNAL( data( KIO::Job
*, const QByteArray
&) ), SLOT( readData( KIO::Job
*, const QByteArray
&) ) );
98 connect( m_job
, SIGNAL( result(KJob
*) ), SLOT( jobDone(KJob
*) ) );
102 void KManPart::readData(KIO::Job
* , const QByteArray
& data
)
104 write(data
,data
.size());
107 void KManPart::jobDone( KJob
*)
113 #include "kmanpart.moc"