KIO
#include <kurlrequester.h>

Public Slots | |
void | clear () |
void | setPath (const QString &path) |
void | setStartDir (const KUrl &startDir) |
void | setText (const QString &text) |
void | setUrl (const KUrl &url) |
Signals | |
void | openFileDialog (KUrlRequester *) |
void | returnPressed () |
void | returnPressed (const QString &) |
void | textChanged (const QString &) |
void | urlSelected (const KUrl &) |
Public Member Functions | |
KUrlRequester (const KUrl &url, QWidget *parent=0) | |
KUrlRequester (QWidget *editWidget, QWidget *parent) | |
KUrlRequester (QWidget *parent=0) | |
~KUrlRequester () | |
KPushButton * | button () const |
QString | clickMessage () const |
KComboBox * | comboBox () const |
KUrlCompletion * | completionObject () const |
const KEditListBox::CustomEditor & | customEditor () |
virtual KFileDialog * | fileDialog () const |
Qt::WindowModality | fileDialogModality () const |
QString | filter () const |
KLineEdit * | lineEdit () const |
KFile::Modes | mode () const |
void | setClickMessage (const QString &msg) |
void | setFileDialogModality (Qt::WindowModality modality) |
void | setFilter (const QString &filter) |
void | setMode (KFile::Modes m) |
KUrl | startDir () const |
QString | text () const |
KUrl | url () const |
![]() | |
KHBox (QWidget *parent=0) | |
~KHBox () | |
virtual QSize | minimumSizeHint () const |
void | setMargin (int margin) |
void | setSpacing (int space) |
void | setStretchFactor (QWidget *widget, int stretch) |
virtual QSize | sizeHint () const |
Protected Member Functions | |
virtual void | changeEvent (QEvent *e) |
bool | eventFilter (QObject *obj, QEvent *ev) |
![]() | |
KHBox (bool vertical, QWidget *parent) | |
virtual void | childEvent (QChildEvent *ev) |
Properties | |
QString | clickMessage |
Qt::WindowModality | fileDialogModality |
QString | filter |
KFile::Modes | mode |
QString | text |
KUrl | url |
Detailed Description
This class is a widget showing a lineedit and a button, which invokes a filedialog.
File name 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 using setMode(), setFilter() and setStartDir().
The default window modality for the file dialog is Qt::ApplicationModal

A widget to request a filename/url from the user
Definition at line 60 of file kurlrequester.h.
Constructor & Destructor Documentation
◆ KUrlRequester() [1/3]
|
explicit |
Constructs a KUrlRequester widget.
Definition at line 225 of file kurlrequester.cpp.
◆ KUrlRequester() [2/3]
Constructs a KUrlRequester widget with the initial URL url
.
Definition at line 232 of file kurlrequester.cpp.
◆ KUrlRequester() [3/3]
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.
Definition at line 210 of file kurlrequester.cpp.
◆ ~KUrlRequester()
KUrlRequester::~KUrlRequester | ( | ) |
Destructs the KUrlRequester.
Definition at line 239 of file kurlrequester.cpp.
Member Function Documentation
◆ button()
KPushButton * KUrlRequester::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.
Definition at line 496 of file kurlrequester.cpp.
◆ changeEvent()
|
protectedvirtual |
Definition at line 311 of file kurlrequester.cpp.
◆ clear
|
slot |
Clears the lineedit/combobox.
Definition at line 464 of file kurlrequester.cpp.
◆ clickMessage()
QString KUrlRequester::clickMessage | ( | ) | const |
- Returns
- the message set with setClickMessage
- Since
- 4.2
Definition at line 512 of file kurlrequester.cpp.
◆ comboBox()
KComboBox * KUrlRequester::comboBox | ( | ) | const |
- Returns
- a pointer to the combobox, in case you have set one using the special constructor. Returns 0L otherwise.
Definition at line 474 of file kurlrequester.cpp.
◆ completionObject()
KUrlCompletion * KUrlRequester::completionObject | ( | ) | const |
- Returns
- the KUrlCompletion object used in the lineedit/combobox.
Definition at line 501 of file kurlrequester.cpp.
◆ customEditor()
const KEditListBox::CustomEditor & KUrlRequester::customEditor | ( | ) |
- Returns
- an object, suitable for use with KEditListWidget. It allows you to put this KUrlRequester into a KEditListWidget. Basically, do it like this: [...]This class is a widget showing a lineedit and a button, which invokes a filedialog.Definition: kurlrequester.h:61const KEditListBox::CustomEditor & customEditor()Definition: kurlrequester.cpp:531
Definition at line 531 of file kurlrequester.cpp.
◆ eventFilter()
|
protected |
Definition at line 485 of file kurlrequester.cpp.
◆ fileDialog()
|
virtual |
- Returns
- a pointer to the filedialog. You can use this to customize the dialog, e.g. to call setLocationLabel or other things which are not accessible in the KUrlRequester API.
Never returns 0. This method creates the file dialog on demand.
Important: in "Directory only" mode, a KDirSelectDialog is used instead, so calling this method is useless.
Definition at line 450 of file kurlrequester.cpp.
◆ fileDialogModality()
Qt::WindowModality KUrlRequester::fileDialogModality | ( | ) | const |
- Returns
- the window modality of the file dialog set with setFileDialogModality
- Since
- 4.4
Definition at line 520 of file kurlrequester.cpp.
◆ filter()
QString KUrlRequester::filter | ( | ) | const |
Returns the current filter for the file dialog.
- See also
- KFileDialog::filter()
Definition at line 445 of file kurlrequester.cpp.
◆ lineEdit()
KLineEdit * KUrlRequester::lineEdit | ( | ) | const |
- Returns
- a pointer to the lineedit, either the default one, or the special one, if you used the special constructor.
It is provided so that you can e.g. set an own completion object (e.g. KShellCompletion) into it.
Definition at line 469 of file kurlrequester.cpp.
◆ mode()
KFile::Modes KUrlRequester::mode | ( | ) | const |
Returns the current mode.
- See also
- KFileDialog::mode()
Definition at line 432 of file kurlrequester.cpp.
◆ openFileDialog
|
signal |
Emitted before the filedialog is going to open.
Connect to this signal to "configure" the filedialog, e.g. set the filefilter, the mode, a preview-widget, etc. It's usually not necessary to set a URL for the filedialog, as it will get set properly from the editfield contents.
If you use multiple KUrlRequesters, you can connect all of them to the same slot and use the given KUrlRequester pointer to know which one is going to open.
◆ returnPressed [1/2]
|
signal |
Emitted when return or enter was pressed in the lineedit.
◆ returnPressed [2/2]
|
signal |
Emitted when return or enter was pressed in the lineedit.
The parameter contains the contents of the lineedit.
◆ setClickMessage()
void KUrlRequester::setClickMessage | ( | const QString & | msg | ) |
◆ setFileDialogModality()
void KUrlRequester::setFileDialogModality | ( | Qt::WindowModality | modality | ) |
Set the window modality for the file dialog to modality
Directory selection dialogs are always modal.
- Since
- 4.4
Definition at line 525 of file kurlrequester.cpp.
◆ setFilter()
void KUrlRequester::setFilter | ( | const QString & | filter | ) |
Sets the filter for the file dialog.
- See also
- KFileDialog::setFilter()
Definition at line 437 of file kurlrequester.cpp.
◆ setMode()
void KUrlRequester::setMode | ( | KFile::Modes | m | ) |
Sets the mode of the file dialog.
Note: you can only select one file with the filedialog, so KFile::Files doesn't make much sense.
- See also
- KFileDialog::setMode()
Definition at line 420 of file kurlrequester.cpp.
◆ setPath
|
slot |
Sets the url in the lineedit to KUrl::fromPath(path)
.
This is only for local paths; do not pass a url here. This method is mostly for "local paths only" url requesters, for instance those set up with setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly)
- Deprecated:
- Use setUrl(KUrl(path)) instead.
Definition at line 293 of file kurlrequester.cpp.
◆ setStartDir
|
slot |
Sets the start dir startDir
.
The start dir is only used when the URL isn't set.
- Since
- 4.3
Definition at line 304 of file kurlrequester.cpp.
◆ setText
|
slot |
Sets the current text in the lineedit or combobox.
This is used for cases where KUrlRequester is used to enter URL-or-something-else, like KOpenWithDialog where you can type a full command with arguments.
- See also
- text
- Since
- 4.3
Definition at line 299 of file kurlrequester.cpp.
◆ setUrl
|
slot |
Sets the url in the lineedit to url
.
Definition at line 287 of file kurlrequester.cpp.
◆ startDir()
KUrl KUrlRequester::startDir | ( | ) | const |
◆ text()
QString KUrlRequester::text | ( | ) | const |
- Returns
- the current text in the lineedit or combobox. This does not do the URL expansion that url() does, it's only provided for cases where KUrlRequester is used to enter URL-or-something-else, like KOpenWithDialog where you can type a full command with arguments.
- Since
- 4.2
Definition at line 331 of file kurlrequester.cpp.
◆ textChanged
|
signal |
Emitted when the text in the lineedit changes.
The parameter contains the contents of the lineedit.
◆ url()
KUrl KUrlRequester::url | ( | ) | const |
- Returns
- the current url in the lineedit. May be malformed, if the user entered something weird. For local files, ~user or environment variables are substituted, relative paths will be resolved against startDir()
Definition at line 321 of file kurlrequester.cpp.
◆ urlSelected
|
signal |
Emitted when the user changed the URL via the file dialog.
The parameter contains the contents of the lineedit.
Property Documentation
◆ clickMessage
|
readwrite |
Definition at line 1 of file kurlrequester.h.
◆ fileDialogModality
|
readwrite |
Definition at line 1 of file kurlrequester.h.
◆ filter
|
readwrite |
Definition at line 1 of file kurlrequester.h.
◆ mode
|
readwrite |
Definition at line 1 of file kurlrequester.h.
◆ text
|
readwrite |
Definition at line 1 of file kurlrequester.h.
◆ url
|
readwrite |
Definition at line 1 of file kurlrequester.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.