kparts Library API Documentation

browserrun.h

00001 /* This file is part of the KDE project
00002  *
00003  * Copyright (C) 2002 David Faure <faure@kde.org>
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License version 2, as published by the Free Software Foundation.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Library General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Library General Public License
00014  * along with this library; see the file COPYING.LIB.  If not, write to
00015  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016  * Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef kparts_browserrun_h
00020 #define kparts_browserrun_h
00021 
00022 #include <krun.h>
00023 #include <kservice.h>
00024 #include <kparts/browserextension.h>
00025 
00026 namespace KParts {
00027 
00039     class BrowserRun : public KRun
00040     {
00041         Q_OBJECT
00042     public:
00052         BrowserRun( const KURL& url, const KParts::URLArgs& args,
00053                     KParts::ReadOnlyPart *part, QWidget *window,
00054                     bool removeReferrer, bool trustedSource );
00055 
00056         // BIC: merge with above constructor
00067         BrowserRun( const KURL& url, const KParts::URLArgs& args,
00068                     KParts::ReadOnlyPart *part, QWidget *window,
00069                     bool removeReferrer, bool trustedSource, bool hideErrorDialog );
00070 
00071         virtual ~BrowserRun();
00072 
00073         //KParts::URLArgs urlArgs() const { return m_args; }
00074         //KParts::ReadOnlyPart* part() const { return m_part; }
00075         KURL url() const { return m_strURL; }
00076 
00077         bool hideErrorDialog() const;
00078 
00079         enum AskSaveResult { Save, Open, Cancel };
00080         static AskSaveResult askSave( const KURL & url, KService::Ptr offer, const QString& mimeType, const QString & suggestedFilename = QString::null );
00081 
00082         // virtual so that KHTML can implement differently (HTML cache)
00083         virtual void save( const KURL & url, const QString & suggestedFilename );
00084         // static so that it can be called from other classes
00085         static void simpleSave( const KURL & url, const QString & suggestedFilename );
00086 
00087         static bool allowExecution( const QString &serviceType, const KURL &url );
00088 
00089         static bool isExecutable( const QString &serviceType );
00090         static bool isTextExecutable( const QString &serviceType );
00091 
00092     protected:
00096         virtual void scanFile();
00100         virtual void init();
00108         virtual void handleError( KIO::Job * job );
00109 
00114         enum NonEmbeddableResult { Handled, NotHandled, Delayed };
00118         NonEmbeddableResult handleNonEmbeddable( const QString& mimeType );
00119 
00120     protected slots:
00121         void slotBrowserScanFinished(KIO::Job *job);
00122         void slotBrowserMimetype(KIO::Job *job, const QString &type);
00123         void slotCopyToTempFileResult(KIO::Job *job);
00124         virtual void slotStatResult( KIO::Job *job );
00125 
00126     protected:
00127         KParts::URLArgs m_args;
00128         KParts::ReadOnlyPart *m_part; // QGuardedPtr?
00129         QWidget *m_window;            // QGuardedPtr?
00130         QString m_suggestedFilename;
00131         QString m_sMimeType;
00132         bool m_bRemoveReferrer;
00133         bool m_bTrustedSource;
00134     private:
00135         class BrowserRunPrivate;
00136         BrowserRunPrivate* d;
00137 
00138     };
00139 }
00140 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:44 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001