khtml Library API Documentation

khtml_run.cpp

00001 /* This file is part of the KDE project
00002  *
00003  * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00004  *                     1999 Lars Knoll <knoll@kde.org>
00005  *                     1999 Antti Koivisto <koivisto@kde.org>
00006  *                     2000 Simon Hausmann <hausmann@kde.org>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Library General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Library General Public License
00019  * along with this library; see the file COPYING.LIB.  If not, write to
00020  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021  * Boston, MA 02111-1307, USA.
00022  */
00023 #include "khtml_run.h"
00024 #include <kio/job.h>
00025 #include <kdebug.h>
00026 #include <klocale.h>
00027 #include "khtml_ext.h"
00028 #include <qwidget.h>
00029 
00030 KHTMLRun::KHTMLRun( KHTMLPart *part, khtml::ChildFrame *child, const KURL &url,
00031                     const KParts::URLArgs &args, bool hideErrorDialog )
00032     : KParts::BrowserRun( url, args, part, part->widget() ? part->widget()->topLevelWidget() : 0,
00033                           false, false, hideErrorDialog ),
00034   m_child( child )
00035 {
00036     // Don't use an external browser for parts of a webpage we are rendering. (iframes at least are one example)
00037     setEnableExternalBrowser(false);
00038 
00039     // get the wheel to start spinning
00040     part->started(0L);
00041 }
00042 
00043 //KHTMLPart *KHTMLRun::htmlPart() const
00044 //{ return static_cast<KHTMLPart *>(m_part); }
00045 
00046 void KHTMLRun::foundMimeType( const QString &_type )
00047 {
00048     Q_ASSERT(!m_bFinished);
00049     QString mimeType = _type; // this ref comes from the job, we lose it when using KIO again
00050     if ( static_cast<KHTMLPart *>(m_part)->processObjectRequest( m_child, m_strURL, mimeType ) )
00051         m_bFinished = true;
00052     else {
00053         if ( m_bFinished ) // abort was called (this happens with the activex fallback for instance)
00054             return;
00055         // Couldn't embed -> call BrowserRun::handleNonEmbeddable()
00056         KParts::BrowserRun::NonEmbeddableResult res = handleNonEmbeddable( mimeType );
00057         if ( res == KParts::BrowserRun::Delayed )
00058             return;
00059         m_bFinished = ( res == KParts::BrowserRun::Handled );
00060         if ( m_bFinished ) // saved or canceled -> stop the wheel
00061             emit static_cast<KHTMLPart *>(m_part)->canceled(QString::null);
00062     }
00063 
00064     if ( m_bFinished )
00065     {
00066         m_timer.start( 0, true );
00067         return;
00068     }
00069 
00070     //kdDebug(6050) << "KHTMLRun::foundMimeType " << _type << " couldn't open" << endl;
00071     KRun::foundMimeType( mimeType );
00072 }
00073 
00074 void KHTMLRun::save( const KURL & url, const QString & suggestedFilename )
00075 {
00076     KHTMLPopupGUIClient::saveURL( m_part->widget(), i18n( "Save As" ), url, m_args.metaData(), QString::null, 0, suggestedFilename );
00077 }
00078 
00079 // KDE4: remove
00080 void KHTMLRun::handleError( KIO::Job *job )
00081 {
00082     KParts::BrowserRun::handleError( job );
00083 }
00084 
00085 #include "khtml_run.moc"
KDE Logo
This file is part of the documentation for khtml Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 4 07:16:21 2005 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003