• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • 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 "khtml_run.h"
00024 #include "khtmlpart_p.h"
00025 #include <kio/job.h>
00026 #include <kdebug.h>
00027 #include <klocale.h>
00028 #include "khtml_ext.h"
00029 #include <QtGui/QImage>
00030 
00031 KHTMLRun::KHTMLRun( KHTMLPart *part, khtml::ChildFrame *child, const KUrl &url,
00032                     const KParts::OpenUrlArguments& args,
00033                     const KParts::BrowserArguments &browserArgs,
00034                     bool hideErrorDialog )
00035     : KParts::BrowserRun( url, args, browserArgs, part, part->widget() ? part->widget()->topLevelWidget() : 0,
00036                           false, false, hideErrorDialog ),
00037   m_child( child )
00038 {
00039     // Don't use an external browser for parts of a webpage we are rendering. (iframes at least are one example)
00040     setEnableExternalBrowser(false);
00041 
00042     // get the wheel to start spinning
00043     part->started(0L);
00044 }
00045 
00046 //KHTMLPart *KHTMLRun::htmlPart() const
00047 //{ return static_cast<KHTMLPart *>(part()); }
00048 
00049 void KHTMLRun::foundMimeType( const QString &_type )
00050 {
00051     //kDebug(6050) << this << _type;
00052     Q_ASSERT(!hasFinished());
00053     QString mimeType = _type; // this ref comes from the job, we lose it when using KIO again
00054 
00055     bool requestProcessed = static_cast<KHTMLPart *>(part())->processObjectRequest( m_child, KRun::url(), mimeType );
00056 
00057     if ( requestProcessed )
00058         setFinished( true );
00059     else {
00060         if ( hasFinished() ) // abort was called (this happens with the activex fallback for instance)
00061             return;
00062         // Couldn't embed -> call BrowserRun::handleNonEmbeddable()
00063         KParts::BrowserRun::NonEmbeddableResult res = handleNonEmbeddable( mimeType );
00064         if ( res == KParts::BrowserRun::Delayed )
00065             return;
00066         setFinished( res == KParts::BrowserRun::Handled );
00067         if ( hasFinished() ) { // saved or canceled -> flag completed
00068             m_child->m_bCompleted = true;
00069             static_cast<KHTMLPart *>(part())->checkCompleted();
00070         }
00071     }
00072 
00073     if ( hasFinished() ) {
00074         kDebug() << "finished";
00075         timer().setSingleShot( true );
00076         timer().start( 0 );
00077         return;
00078     }
00079 
00080     //kDebug(6050) << _type << " couldn't open";
00081     KRun::foundMimeType( mimeType );
00082 
00083     // "open" is finished -> flag completed
00084     m_child->m_bCompleted = true;
00085     static_cast<KHTMLPart *>(part())->checkCompleted();
00086 }
00087 
00088 void KHTMLRun::handleError(KJob* job)
00089 {
00090     // Tell KHTML that loading failed.
00091     static_cast<KHTMLPart *>(part())->processObjectRequest( m_child, KUrl(), QString() );
00092     setJob(0);
00093 }
00094 
00095 void KHTMLRun::save( const KUrl & url, const QString & suggestedFilename )
00096 {
00097     KHTMLPopupGUIClient::saveURL( part()->widget(), i18n( "Save As" ), url, arguments().metaData(), QString(), 0, suggestedFilename );
00098 }
00099 
00100 #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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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