You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdevelop/parts/documentation/protocols/chm/kchmpart.cpp

124 lines
3.0 KiB

/* This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kchmpart.h"
#include <tqstring.h>
#include <kinstance.h>
#include <tdeglobal.h>
#include <kdebug.h>
#include <tdelocale.h>
#include <kstandarddirs.h>
#include <tdeaboutdata.h>
extern "C"
{
void* init_libkchmpart()
{
return new KChmPartFactory;
}
}
TDEInstance* KChmPartFactory::s_instance = 0L;
TDEAboutData* KChmPartFactory::s_about = 0L;
KChmPartFactory::KChmPartFactory( TQObject* parent, const char* name )
: KParts::Factory( parent, name )
{
}
KChmPartFactory::~KChmPartFactory()
{
delete s_instance;
s_instance = 0L;
delete s_about;
}
KParts::Part* KChmPartFactory::createPartObject( TQWidget *parentWidget, const char *, TQObject *,
const char *name, const char *, const TQStringList & )
{
KChmPart* part = new KChmPart( parentWidget, name );
return part;
}
TDEInstance* KChmPartFactory::instance()
{
if( !s_instance )
{
s_about = new TDEAboutData( "kchmpart",
I18N_NOOP( "KChm" ), "1.0pre" );
s_instance = new TDEInstance( s_about );
}
return s_instance;
}
KChmPart::KChmPart( TQWidget * parent, const char * name )
: KDevHTMLPart( ), m_job(0)
{
TDEInstance * instance = new TDEInstance( "kchmpart" );
setInstance( instance );
m_extension=new KParts::BrowserExtension(this);
setOptions(-1);
}
bool KChmPart::openURL( const KURL &url )
{
KURL chmURL = url;
chmURL.setProtocol("ms-its");
chmURL.addPath("/");
return KDevHTMLPart::openURL(chmURL);
}
void KChmPart::slotDuplicate()
{
}
void KChmPart::slotOpenInNewWindow(const KURL &url)
{
}
/*
bool KChmPart::openFile()
{
if (m_job!=0)
m_job->kill();
m_htmlData.truncate(0);
m_job = TDEIO::get( TQString("chm:")+m_file+"/", true, false );
connect( m_job, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray &) ), TQT_SLOT( readData( TDEIO::Job *, const TQByteArray &) ) );
connect( m_job, TQT_SIGNAL( result( TDEIO::Job * ) ), TQT_SLOT( jobDone( TDEIO::Job * ) ) );
return true;
}
void KChmPart::readData(TDEIO::Job * , const TQByteArray & data)
{
m_htmlData += data;
}
void KChmPart::jobDone( TDEIO::Job *)
{
m_job=0;
begin();
write(TQString::fromLocal8Bit(m_htmlData));
end();
}
*/
#include "kchmpart.moc"