//
//     Copyright 2008 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2007 Jim Bublitz also apply

//                 Generated by twine

// This file is part of PyKDE4.

// PyKDE4 is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.

// PyKDE4 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 General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

namespace KParts
{

class BrowserRun : KRun
{
%TypeHeaderCode
#include <kparts/browserrun.h>
%End


public:
                            BrowserRun (const KUrl& url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs, KParts::ReadOnlyPart* part, QWidget* window, bool removeReferrer, bool trustedSource, bool hideErrorDialog = 0);
    KParts::OpenUrlArguments&  arguments ();
    KParts::BrowserArguments&  browserArguments ();
    KParts::ReadOnlyPart*   part () const;
    KUrl                    url () const;
    bool                    hideErrorDialog () const;
    QString                 contentDisposition () const;
    bool                    serverSuggestsSave () const;

    enum AskSaveResult
    {
        Save,
        Open,
        Cancel
    };

    static KParts::BrowserRun::AskSaveResult  askSave (const KUrl& url, KService::Ptr offer, const QString& mimeType, const QString& suggestedFileName = QString());

    enum AskEmbedOrSaveFlags
    {
        InlineDisposition,
        AttachmentDisposition
    };

    static KParts::BrowserRun::AskSaveResult  askEmbedOrSave (const KUrl& url, const QString& mimeType, const QString& suggestedFileName = QString(), int flags = 0);
    virtual void            save (const KUrl& url, const QString& suggestedFileName);
    static void             simpleSave (const KUrl& url, const QString& suggestedFileName, QWidget* window = 0);
    static bool             allowExecution (const QString& mimeType, const KUrl& url);
    static bool             isTextExecutable (const QString& mimeType);

protected:
    virtual void            scanFile ();
    virtual void            init ();
    virtual void            handleError (KJob* job);

    enum NonEmbeddableResult
    {
        Handled,
        NotHandled,
        Delayed
    };

//ig     KParts::BrowserRun::NonEmbeddableResult  handleNonEmbeddable (const QString& mimeType);
    void                    slotBrowserScanFinished (KJob* job);
    void                    slotBrowserMimetype (KIO::Job* job, const QString& type);
    void                    slotCopyToTempFileResult (KJob* job);
    virtual void            slotStatResult (KJob* job);
};   // BrowserRun

};   // KParts


