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

KIO

KUrlRequester Class Reference

#include <kurlrequester.h>

Inheritance diagram for KUrlRequester:

Inheritance graph
[legend]

List of all members.


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

kurlrequester.png

KDE URL Requester

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

Definition at line 53 of file kurlrequester.h.


Public Slots

void clear ()
void setPath (const QString &path)
void setUrl (const KUrl &url)

Signals

void openFileDialog (KUrlRequester *)
void returnPressed (const QString &)
void returnPressed ()
void textChanged (const QString &)
void urlSelected (const KUrl &)

Public Member Functions

KPushButton * button () const
KComboBox * comboBox () const
KUrlCompletion * completionObject () const
const KEditListBox::CustomEditor & customEditor ()
virtual KFileDialog * fileDialog () const
QString filter () const
 KUrlRequester (QWidget *editWidget, QWidget *parent)
 KUrlRequester (const KUrl &url, QWidget *parent=0)
 KUrlRequester (QWidget *parent=0)
KLineEdit * lineEdit () const
KFile::Modes mode () const
void setFilter (const QString &filter)
void setMode (KFile::Modes m)
KUrl url () const
 ~KUrlRequester ()

Protected Member Functions

virtual void changeEvent (QEvent *e)
bool eventFilter (QObject *obj, QEvent *ev)

Properties

QString filter
KFile::Modes mode
KUrl url

Constructor & Destructor Documentation

KUrlRequester::KUrlRequester ( QWidget *  parent = 0  )  [explicit]

Constructs a KUrlRequester widget.

Definition at line 196 of file kurlrequester.cpp.

KUrlRequester::KUrlRequester ( const KUrl &  url,
QWidget *  parent = 0 
) [explicit]

Constructs a KUrlRequester widget with the initial URL url.

Definition at line 203 of file kurlrequester.cpp.

KUrlRequester::KUrlRequester ( QWidget *  editWidget,
QWidget *  parent 
)

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 181 of file kurlrequester.cpp.

KUrlRequester::~KUrlRequester (  ) 

Destructs the KUrlRequester.

Definition at line 211 of file kurlrequester.cpp.


Member Function Documentation

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 396 of file kurlrequester.cpp.

void KUrlRequester::changeEvent ( QEvent *  e  )  [protected, virtual]

Definition at line 265 of file kurlrequester.cpp.

void KUrlRequester::clear (  )  [slot]

Clears the lineedit/combobox.

Definition at line 364 of file kurlrequester.cpp.

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 374 of file kurlrequester.cpp.

KUrlCompletion * KUrlRequester::completionObject (  )  const

Returns:
the KUrlCompletion object used in the lineedit/combobox.

Definition at line 401 of file kurlrequester.cpp.

const KEditListBox::CustomEditor & KUrlRequester::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 );

Definition at line 406 of file kurlrequester.cpp.

bool KUrlRequester::eventFilter ( QObject *  obj,
QEvent *  ev 
) [protected]

Definition at line 385 of file kurlrequester.cpp.

KFileDialog * KUrlRequester::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.

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

Definition at line 351 of file kurlrequester.cpp.

QString KUrlRequester::filter (  )  const

Returns the current filter for the file dialog.

See also:
KFileDialog::filter()

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 369 of file kurlrequester.cpp.

KFile::Modes KUrlRequester::mode (  )  const

Returns the current mode.

See also:
KFileDialog::mode()

void KUrlRequester::openFileDialog ( KUrlRequester *   )  [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.

void KUrlRequester::returnPressed ( const QString &   )  [signal]

Emitted when return or enter was pressed in the lineedit.

The parameter contains the contents of the lineedit.

void KUrlRequester::returnPressed (  )  [signal]

Emitted when return or enter was pressed in the lineedit.

void KUrlRequester::setFilter ( const QString &  filter  ) 

Sets the filter for the file dialog.

See also:
KFileDialog::setFilter()

Definition at line 338 of file kurlrequester.cpp.

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 321 of file kurlrequester.cpp.

void KUrlRequester::setPath ( const QString &  path  )  [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|KFileExistingOnly|KFileLocalOnly)

Definition at line 260 of file kurlrequester.cpp.

void KUrlRequester::setUrl ( const KUrl &  url  )  [slot]

Sets the url in the lineedit to url.

Definition at line 255 of file kurlrequester.cpp.

void KUrlRequester::textChanged ( const QString &   )  [signal]

Emitted when the text in the lineedit changes.

The parameter contains the contents of the lineedit.

KUrl KUrlRequester::url (  )  const

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.

void KUrlRequester::urlSelected ( const KUrl &   )  [signal]

Emitted when the user changed the URL via the file dialog.

The parameter contains the contents of the lineedit.


Property Documentation

QString KUrlRequester::filter [read, write]

Definition at line 57 of file kurlrequester.h.

KFile::Modes KUrlRequester::mode [read, write]

Definition at line 59 of file kurlrequester.h.

KUrl KUrlRequester::url [read, write]

Definition at line 56 of file kurlrequester.h.


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

KIO

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