browserrun.h
/* This file is part of the KDE project
*
* Copyright (C) 2002 David Faure <faure@kde.org>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2, as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef kparts_browserrun_h
#define kparts_browserrun_h
#include <krun.h>
#include <kservice.h>
#include <kparts/browserextension.h>
namespace KParts {
class KPARTS_EXPORT BrowserRun : public KRun
{
Q_OBJECT
public:
BrowserRun( const KURL& url, const KParts::URLArgs& args,
KParts::ReadOnlyPart *part, QWidget *window,
bool removeReferrer, bool trustedSource );
// BIC: merge with above constructor
BrowserRun( const KURL& url, const KParts::URLArgs& args,
KParts::ReadOnlyPart *part, QWidget *window,
bool removeReferrer, bool trustedSource, bool hideErrorDialog );
virtual ~BrowserRun();
//KParts::URLArgs urlArgs() const { return m_args; }
//KParts::ReadOnlyPart* part() const { return m_part; }
KURL url() const { return m_strURL; }
bool hideErrorDialog() const;
QString suggestedFilename() const { return m_suggestedFilename; }
QString contentDisposition() const;
bool serverSuggestsSave() const { return contentDisposition() == QString::fromLatin1("attachment"); }
enum AskSaveResult { Save, Open, Cancel };
static AskSaveResult askSave( const KURL & url, KService::Ptr offer, const QString& mimeType, const QString & suggestedFilename = QString::null );
enum AskEmbedOrSaveFlags { InlineDisposition = 0, AttachmentDisposition = 1 };
static AskSaveResult askEmbedOrSave( const KURL & url, const QString& mimeType, const QString & suggestedFilename = QString::null, int flags = 0 );
// virtual so that KHTML can implement differently (HTML cache)
virtual void save( const KURL & url, const QString & suggestedFilename );
// static so that it can be called from other classes
static void simpleSave( const KURL & url, const QString & suggestedFilename,
QWidget* window );
static void simpleSave( const KURL & url, const QString & suggestedFilename );
static bool allowExecution( const QString &serviceType, const KURL &url );
static bool isExecutable( const QString &serviceType );
static bool isTextExecutable( const QString &serviceType );
protected:
virtual void scanFile();
virtual void init();
virtual void handleError( KIO::Job * job );
enum NonEmbeddableResult { Handled, NotHandled, Delayed };
NonEmbeddableResult handleNonEmbeddable( const QString& mimeType );
protected slots:
void slotBrowserScanFinished(KIO::Job *job);
void slotBrowserMimetype(KIO::Job *job, const QString &type);
void slotCopyToTempFileResult(KIO::Job *job);
virtual void slotStatResult( KIO::Job *job );
protected:
KParts::URLArgs m_args;
KParts::ReadOnlyPart *m_part; // QGuardedPtr?
QGuardedPtr<QWidget> m_window;
// Suggested filename given by the server (e.g. HTTP content-disposition)
// When set, we should really be saving instead of embedding
QString m_suggestedFilename;
QString m_sMimeType;
bool m_bRemoveReferrer;
bool m_bTrustedSource;
private:
void redirectToError( int error, const QString& errorText );
class BrowserRunPrivate;
BrowserRunPrivate* d;
};
}
#endif
KParts::BrowserRun::suggestedFilename
QString suggestedFilename() const
Definition: browserrun.h:93
KURL
KParts::BrowserRun
This class extends KRun to provide additional functionality for browsers:
Definition: browserrun.h:42
KParts::BrowserRun::NonEmbeddableResult
NonEmbeddableResult
NotHandled means that foundMimeType should call KRun::foundMimeType, i.e.
Definition: browserrun.h:164
KParts::BrowserRun::url
KURL url() const
Definition: browserrun.h:83
KStdAccel::save
const KShortcut & save()
KParts::URLArgs
URLArgs is a set of arguments bundled into a structure, to allow specifying how a URL should be opene...
Definition: browserextension.h:57
KParts::ReadOnlyPart
Base class for any "viewer" part.
Definition: part.h:338

KDE Home | KDE Accessibility Home | Description of Access Keys