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

KParts

KParts::BrowserRun

KParts::BrowserRun Class Reference

#include <browserrun.h>

Inheritance diagram for KParts::BrowserRun:

Inheritance graph
[legend]

List of all members.


Detailed Description

This class extends KRun to provide additional functionality for browsers:
  • "save or open" dialog boxes
  • "save" functionality
  • support for HTTP POST (including saving the result to a temp file if opening a separate application)
  • warning before launching executables off the web
  • custom error handling (i.e.

treating errors as HTML pages)

  • generation of SSL metadata depending on the previous URL shown by the part
    Author:
    David Faure <faure@kde.org>

Definition at line 39 of file browserrun.h.


Public Types

enum  AskEmbedOrSaveFlags { InlineDisposition = 0, AttachmentDisposition = 1 }
enum  AskSaveResult { Save, Open, Cancel }

Public Member Functions

KParts::OpenUrlArguments & arguments ()
KParts::BrowserArguments & browserArguments ()
 BrowserRun (const KUrl &url, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs, KParts::ReadOnlyPart *part, QWidget *window, bool removeReferrer, bool trustedSource, bool hideErrorDialog=false)
QString contentDisposition () const
bool hideErrorDialog () const
KParts::ReadOnlyPart * part () const
virtual void save (const KUrl &url, const QString &suggestedFileName)
bool serverSuggestsSave () const
KUrl url () const
virtual ~BrowserRun ()

Static Public Member Functions

static bool allowExecution (const QString &mimeType, const KUrl &url)
static AskSaveResult askEmbedOrSave (const KUrl &url, const QString &mimeType, const QString &suggestedFileName=QString(), int flags=0)
static AskSaveResult askSave (const KUrl &url, KService::Ptr offer, const QString &mimeType, const QString &suggestedFileName=QString())
static bool isTextExecutable (const QString &mimeType)
static void simpleSave (const KUrl &url, const QString &suggestedFileName, QWidget *window=0)

Protected Types

enum  NonEmbeddableResult { Handled, NotHandled, Delayed }

Protected Slots

void slotBrowserMimetype (KIO::Job *job, const QString &type)
void slotBrowserScanFinished (KJob *job)
void slotCopyToTempFileResult (KJob *job)
virtual void slotStatResult (KJob *job)

Protected Member Functions

virtual void handleError (KJob *job)
NonEmbeddableResult handleNonEmbeddable (const QString &mimeType)
virtual void init ()
virtual void scanFile ()

Member Enumeration Documentation

enum KParts::BrowserRun::AskEmbedOrSaveFlags

Enumerator:
InlineDisposition 
AttachmentDisposition 

Definition at line 88 of file browserrun.h.

enum KParts::BrowserRun::AskSaveResult

Enumerator:
Save 
Open 
Cancel 

Definition at line 77 of file browserrun.h.

enum KParts::BrowserRun::NonEmbeddableResult [protected]

NotHandled means that foundMimeType should call KRun::foundMimeType, i.e.

launch an external app.

Enumerator:
Handled 
NotHandled 
Delayed 

Definition at line 134 of file browserrun.h.


Constructor & Destructor Documentation

BrowserRun::BrowserRun ( const KUrl &  url,
const KParts::OpenUrlArguments &  args,
const KParts::BrowserArguments &  browserArgs,
KParts::ReadOnlyPart *  part,
QWidget *  window,
bool  removeReferrer,
bool  trustedSource,
bool  hideErrorDialog = false 
)

Parameters:
url the URL we're probing

Parameters:
args URL args - includes reload, metaData, etc.
browserArgs browser-related args - includes data for a HTTP POST, etc.
part the part going to open this URL - can be 0 if not created yet
window the mainwindow - passed to KIO::Job::setWindow()
removeReferrer if true, the "referrer" metadata from args isn't passed on
trustedSource if false, a warning will be shown before launching an executable. Always pass false for trustedSource, except for local directory views.
hideErrorDialog if true, no dialog will be shown in case of errors.

Definition at line 53 of file browserrun.cpp.

BrowserRun::~BrowserRun (  )  [virtual]

Definition at line 69 of file browserrun.cpp.


Member Function Documentation

bool BrowserRun::allowExecution ( const QString &  mimeType,
const KUrl &  url 
) [static]

Definition at line 293 of file browserrun.cpp.

KParts::OpenUrlArguments & KParts::BrowserRun::arguments (  ) 

Definition at line 551 of file browserrun.cpp.

BrowserRun::AskSaveResult BrowserRun::askEmbedOrSave ( const KUrl &  url,
const QString &  mimeType,
const QString &  suggestedFileName = QString(),
int  flags = 0 
) [static]

Similar to askSave but for the case where the current application is able to embed the url itself (instead of passing it to another app).

Parameters:
url the URL in question
mimeType the mimetype of the URL
suggestedFileName optional filename suggested by the server
flags set to AttachmentDisposition if suggested by the server
Returns:
Save, Open or Cancel.

Definition at line 352 of file browserrun.cpp.

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

Ask the user whether to save or open a url in another application.

Parameters:
url the URL in question
offer the application that will be used to open the URL
mimeType the mimetype of the URL
suggestedFileName optional file name suggested by the server
Returns:
Save, Open or Cancel.

Definition at line 328 of file browserrun.cpp.

KParts::BrowserArguments & KParts::BrowserRun::browserArguments (  ) 

Definition at line 556 of file browserrun.cpp.

QString BrowserRun::contentDisposition (  )  const

Returns:
Suggested disposition by the server (e.g.

HTTP content-disposition)

Definition at line 547 of file browserrun.cpp.

void BrowserRun::handleError ( KJob *  job  )  [protected, virtual]

Called when an error happens.

NOTE: job could be 0L, if you passed hideErrorDialog=true. The default implementation shows a message box, but only when job != 0 .... It is strongly recommended to reimplement this method if you passed hideErrorDialog=true.

Definition at line 469 of file browserrun.cpp.

BrowserRun::NonEmbeddableResult BrowserRun::handleNonEmbeddable ( const QString &  mimeType  )  [protected]

Helper for foundMimeType: call this if the mimetype couldn't be embedded.

Definition at line 226 of file browserrun.cpp.

bool BrowserRun::hideErrorDialog (  )  const

Definition at line 542 of file browserrun.cpp.

void BrowserRun::init (  )  [protected, virtual]

Reimplemented from KRun.

Reimplemented from KRun.

Definition at line 84 of file browserrun.cpp.

bool BrowserRun::isTextExecutable ( const QString &  mimeType  )  [static]

Definition at line 536 of file browserrun.cpp.

KParts::ReadOnlyPart * BrowserRun::part (  )  const

Definition at line 74 of file browserrun.cpp.

void BrowserRun::save ( const KUrl &  url,
const QString &  suggestedFileName 
) [virtual]

Definition at line 391 of file browserrun.cpp.

void BrowserRun::scanFile (  )  [protected, virtual]

Reimplemented from KRun.

Reimplemented from KRun.

Definition at line 112 of file browserrun.cpp.

bool KParts::BrowserRun::serverSuggestsSave (  )  const [inline]

Definition at line 75 of file browserrun.h.

void BrowserRun::simpleSave ( const KUrl &  url,
const QString &  suggestedFileName,
QWidget *  window = 0 
) [static]

Definition at line 397 of file browserrun.cpp.

void BrowserRun::slotBrowserMimetype ( KIO::Job *  job,
const QString &  type 
) [protected, slot]

Definition at line 194 of file browserrun.cpp.

void BrowserRun::slotBrowserScanFinished ( KJob *  job  )  [protected, slot]

Definition at line 171 of file browserrun.cpp.

void BrowserRun::slotCopyToTempFileResult ( KJob *  job  )  [protected, slot]

Definition at line 523 of file browserrun.cpp.

void BrowserRun::slotStatResult ( KJob *  job  )  [protected, virtual, slot]

Reimplemented from KRun.

Definition at line 460 of file browserrun.cpp.

KUrl BrowserRun::url (  )  const

Reimplemented from KRun.

Definition at line 79 of file browserrun.cpp.


The documentation for this class was generated from the following files:
  • browserrun.h
  • browserrun.cpp

KParts

Skip menu "KParts"
  • 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