# class KUrlRequester

###

Module | kio
Namespace |
Class | KUrlRequester
Inherits | KHBox

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() or setFilter().

A widget to request a filename/url from the user Author Carsten Pfeiffer <pfeiffer@kde.org>

### methods

- KUrlRequester (parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 0

  Constructs a KUrlRequester widget.

- KUrlRequester (url, parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |
  parent | QWidget | 0

  Constructs a KUrlRequester widget with the initial URL url.

- KUrlRequester (editWidget, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  editWidget | QWidget |
  parent | QWidget |

  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.

- KUrlRequester (a0)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KUrlRequester |

- KUrlRequester (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget | 0

- KUrlRequester (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | KUrl |
  a1 | QWidget | 0

- button ( )

  returns KPushButton

  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.

- changeEvent (e)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  e | QEvent |

- clear ( )

  returns Nothing

  Clears the lineedit/combobox.

- comboBox ( )

  returns KComboBox

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

- completionObject ( )

  returns KUrlCompletion

  Returns the KUrlCompletion object used in the lineedit/combobox.

- customEditor ( )

  returns KEditListBox.CustomEditor

  Returns an object, suitable for use with KEditListBox. It allows you to put this KUrlRequester into a KEditListBox. Basically, do it like this:

      KUrlRequester *req = new KUrlRequester( someWidget );
      [...]
      KEditListBox *editListBox = new KEditListBox( i18n("Some Title"), req->customEditor(), someWidget );

- eventFilter (obj, ev)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  obj | QObject |
  ev | QEvent |

- fileDialog ( )

  returns KFileDialog

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

  Remove in KDE4? KUrlRequester should use KDirSelectDialog for (mode & KFile.Directory) && !(mode & KFile.File)

- filter ( )

  returns QString

  Returns the current filter for the file dialog.

  See also KFileDialog.filter()

- lineEdit ( )

  returns KLineEdit

  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.

- mode ( )

  returns KFile.Modes

  Returns the current mode

  See also KFileDialog.mode()

- openFileDialog (a0)

  returns Nothing
  SIGNAL ("openFileDialog (KUrlRequester*)")

  Argument | Type | Default
  --- | --- | ---
  a0 | KUrlRequester |

  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 ( )

  returns Nothing
  SIGNAL ("returnPressed ()")

  Emitted when return or enter was pressed in the lineedit.

- returnPressed (a0)

  returns Nothing
  SIGNAL ("returnPressed (const QString&)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |

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

- setFilter (filter)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  filter | QString |

  Sets the filter for the file dialog.

  See also KFileDialog.setFilter()

- setMode (m)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  m | KFile.Modes |

  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()

- setPath (path)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  path | QString |

  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)

- setUrl (url)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |

  Sets the url in the lineedit to url.

- textChanged (a0)

  returns Nothing
  SIGNAL ("textChanged (const QString&)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |

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

- url ( )

  returns KUrl

  Returns the current url in the lineedit. May be malformed, if the user entered something weird. ~user or environment variables are substituted for local files.

- urlSelected (a0)

  returns Nothing
  SIGNAL ("urlSelected (const KUrl&)")

  Argument | Type | Default
  --- | --- | ---
  a0 | KUrl |

  Emitted when the user changed the URL via the file dialog. The parameter contains the contents of the lineedit.