class KURLRequester

A widget to request a filename/url from the user. More...

Definition#include <kurlrequester.h>
InheritsQHBox (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Signals

Protected Methods

Protected Slots

Protected Members


Detailed Description

This class is a widget showing a lineedit and a button, which invokes a filedialog. File completion is available in the lineedit.

The defaults for the filedialog are to ask for one existing local file, i.e. KFileDialog::setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly ) The default filter is "*", i.e. show all files, and the start directory is the current working directory, or the last directory where a file has been selected.

You can change this behavior by obtaining a pointer to the dialog (fileDialog()) and calling the appropriate methods.

 KURLRequester ( QWidget *parent=0, const char *name=0, bool modal = true )

KURLRequester

Constructs a KURLRequester widget

Parameters:
modalspecifies whether the filedialog should be opened as modal or not.

 KURLRequester ( const QString& url, QWidget *parent=0, const char *name=0, bool modal = true )

KURLRequester

Constructs a KURLRequester widget with the default URL url

Parameters:
modalspecifies whether the filedialog should be opened as modal or not.

 KURLRequester ( QWidget *editWidget, QWidget *parent, const char *name=0, bool modal = true )

KURLRequester

Special constructor, which creates a KURLRequester widget with a custom edit-widget. The edit-widget can be either a KComboBox or a KLineEdit (or inherited thereof). Note: for geometry management reasons, the edit-widget is reparented to have the KURLRequester as parent.

Parameters:
modalspecifies whether the filedialog should be opened as modal or not.

 ~KURLRequester ()

~KURLRequester

Destructs the KURLRequester

void  setURL (const QString& url)

setURL

Sets the url in the lineedit to url. Depending on the state of showLocalProtocol(), file:/ on local files will be shown or not.

QString  url ()

url

[const]

Returns: the current url in the lineedit. May be malformed, if the user entered something weird.

void  setShowLocalProtocol ( bool b )

setShowLocalProtocol

Enables/disables showing file:/ in the lineedit, when a local file has been selected in the filedialog or was set via setURL(). Default is false, not showing file:/

See also: showLocalProtocol

bool  showLocalProtocol ()

showLocalProtocol

[const]

Returns: whether local files will be prefixed with file:/ in the lineedit

See also: setShowLocalProtocol

KFileDialog *  fileDialog ()

fileDialog

[const virtual]

Returns: a pointer to the filedialog You can use this to customize the dialog, e.g. to specify a filter. Never returns 0L.

KLineEdit *  lineEdit ()

lineEdit

[const]

It is provided so that you can e.g. set an own completion object (e.g. KShellCompletion) into it.

Returns: a pointer to the lineedit, either the default one, or the special one, if you used the special constructor.

KComboBox *  comboBox ()

comboBox

[const]

Returns: a pointer to the combobox, in case you have set one using the special constructor. Returns 0L otherwise.

QPushButton *  button ()

button

[const]

Returns: a pointer to the pushbutton. It is provided so that you can specify an own pixmap or a text, if you really need to.

void  textChanged (const QString&)

textChanged

[signal]

Emitted when the text in the lineedit changes. The parameter contains the contents of the lineedit.

void  returnPressed ()

returnPressed

[signal]

Emitted when return or enter was pressed in the lineedit.

void  returnPressed ( const QString& )

returnPressed

[signal]

Emitted when return or enter was pressed in the lineedit. The parameter contains the contents of the lineedit.

void  init ()

init

[protected: ]

KLineEdit * myEdit

myEdit

[protected: ]

QPushButton * myButton

myButton

[protected: ]

KURLCompletion * myCompletion

myCompletion

[protected: ]

bool myModal

myModal

[protected: ]

void  slotOpenDialog ()

slotOpenDialog

[protected slots: slot]

Called when the button is pressed to open the filedialog. Also called when KStdAccel::Open (default is Ctrl-O) is pressed.