• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KHTML

khtml_run.cpp

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022  */
00023 #include "khtmlpart_p.h"
00024 #include "khtml_run.h"
00025 #include <kio/job.h>
00026 #include <kdebug.h>
00027 #include <klocale.h>
00028 #include "khtml_ext.h"
00029 #include <qwidget.h>
00030 
00031 KHTMLRun::KHTMLRun( KHTMLPart *part, khtml::ChildFrame *child, const KURL &url,
00032                     const KParts::URLArgs &args, bool hideErrorDialog )
00033     : KParts::BrowserRun( url, args, part, part->widget() ? part->widget()->topLevelWidget() : 0,
00034                           false, false, hideErrorDialog ),
00035   m_child( child )
00036 {
00037     // Don't use an external browser for parts of a webpage we are rendering. (iframes at least are one example)
00038     setEnableExternalBrowser(false);
00039 
00040     // get the wheel to start spinning
00041     part->started(0L);
00042 }
00043 
00044 //KHTMLPart *KHTMLRun::htmlPart() const
00045 //{ return static_cast<KHTMLPart *>(m_part); }
00046 
00047 void KHTMLRun::foundMimeType( const QString &_type )
00048 {
00049     Q_ASSERT(!m_bFinished);
00050     QString mimeType = _type; // this ref comes from the job, we lose it when using KIO again
00051     if ( static_cast<KHTMLPart *>(m_part)->processObjectRequest( m_child, m_strURL, mimeType ) )
00052         m_bFinished = true;
00053     else {
00054         if ( m_bFinished ) // abort was called (this happens with the activex fallback for instance)
00055             return;
00056         // Couldn't embed -> call BrowserRun::handleNonEmbeddable()
00057         KParts::BrowserRun::NonEmbeddableResult res = handleNonEmbeddable( mimeType );
00058         if ( res == KParts::BrowserRun::Delayed )
00059             return;
00060         m_bFinished = ( res == KParts::BrowserRun::Handled );
00061         if ( m_bFinished ) { // saved or canceled -> flag completed
00062             m_child->m_bCompleted = true;
00063             static_cast<KHTMLPart *>(m_part)->checkCompleted();
00064         }
00065     }
00066 
00067     if ( m_bFinished )
00068     {
00069         m_timer.start( 0, true );
00070         return;
00071     }
00072 
00073     //kdDebug(6050) << "KHTMLRun::foundMimeType " << _type << " couldn't open" << endl;
00074     KRun::foundMimeType( mimeType );
00075 
00076     // "open" is finished -> flag completed
00077     m_child->m_bCompleted = true;
00078     static_cast<KHTMLPart *>(m_part)->checkCompleted();
00079 }
00080 
00081 void KHTMLRun::save( const KURL & url, const QString & suggestedFilename )
00082 {
00083     KHTMLPopupGUIClient::saveURL( m_part->widget(), i18n( "Save As" ), url, m_args.metaData(), QString::null, 0, suggestedFilename );
00084 }
00085 
00086 // KDE4: remove
00087 void KHTMLRun::handleError( KIO::Job *job )
00088 {
00089     KParts::BrowserRun::handleError( job );
00090 }
00091 
00092 #include "khtml_run.moc"

KHTML

Skip menu "KHTML"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal