KParts::BrowserOpenOrSaveQuestion

Search for usage in LXR

KParts::BrowserOpenOrSaveQuestion Class Reference

#include <KParts/BrowserOpenOrSaveQuestion>

Public Types

enum  AskEmbedOrSaveFlags { InlineDisposition = 0, AttachmentDisposition = 1 }
 
enum  Feature { BasicFeatures = 0, ServiceSelection = 1 }
 
typedef QFlags< FeatureFeatures
 
enum  Result { Save, Open, Embed, Cancel }
 

Public Member Functions

 BrowserOpenOrSaveQuestion (QWidget *parent, const QUrl &url, const QString &mimeType)
 
Result askEmbedOrSave (int flags=0)
 
Result askOpenOrSave ()
 
KService::Ptr selectedService () const
 
void setFeatures (Features features)
 
void setSuggestedFileName (const QString &suggestedFileName)
 

Detailed Description

This class shows the dialog that asks the user whether to save a url or open a url in another application.

It also has the variant which asks "save or embed" (e.g. into konqueror).

Since
4.4

Definition at line 30 of file browseropenorsavequestion.h.

Member Typedef Documentation

◆ Features

Stores a combination of Feature values.

Definition at line 61 of file browseropenorsavequestion.h.

Member Enumeration Documentation

◆ AskEmbedOrSaveFlags

◆ Feature

Set of features that should be enabled in this dialog.

This allows to add features before making all applications ready for those features (e.g. applications need to read selectedService() otherwise the dialog should not show the service selection button)

See also
Features
Enumerator
BasicFeatures 

Only the basic save, open, embed, cancel button.

ServiceSelection 

Shows "Open With..." with the associated applications for the mimetype.

Definition at line 54 of file browseropenorsavequestion.h.

Constructor & Destructor Documentation

◆ BrowserOpenOrSaveQuestion()

BrowserOpenOrSaveQuestion::BrowserOpenOrSaveQuestion ( QWidget parent,
const QUrl url,
const QString mimeType 
)

Constructor, for all kinds of dialogs shown in this class.

Parameters
urlthe URL in question
mimeTypethe mimetype of the URL

Definition at line 203 of file browseropenorsavequestion.cpp.

Member Function Documentation

◆ askEmbedOrSave()

BrowserOpenOrSaveQuestion::Result BrowserOpenOrSaveQuestion::askEmbedOrSave ( int  flags = 0)

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

Parameters
flagsset to AttachmentDisposition if suggested by the server This is used because by default text/html files are opened embedded in browsers, not saved. But if the server said "attachment", it means the user is download a file for saving it.
Returns
Save, Embed or Cancel.

Definition at line 308 of file browseropenorsavequestion.cpp.

◆ askOpenOrSave()

BrowserOpenOrSaveQuestion::Result BrowserOpenOrSaveQuestion::askOpenOrSave ( )

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

Returns
Save, Open or Cancel.

Definition at line 222 of file browseropenorsavequestion.cpp.

◆ selectedService()

KService::Ptr BrowserOpenOrSaveQuestion::selectedService ( ) const
Returns
the service that was selected during askOpenOrSave, if it returned Open. In all other cases (no associated application, Save or Cancel selected), this returns 0.

Requires setFeatures(BrowserOpenOrSaveQuestion::ServiceSelection).

Definition at line 274 of file browseropenorsavequestion.cpp.

◆ setFeatures()

void BrowserOpenOrSaveQuestion::setFeatures ( Features  features)

Enables the given features in the dialog.

Definition at line 328 of file browseropenorsavequestion.cpp.

◆ setSuggestedFileName()

void BrowserOpenOrSaveQuestion::setSuggestedFileName ( const QString suggestedFileName)

Sets the suggested filename, shown in the dialog.

Parameters
suggestedFileNameoptional file name suggested by the server (HTTP Content-Disposition)

Definition at line 333 of file browseropenorsavequestion.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:53:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.