KIO
KUrlComboBox Class Reference
#include <kurlcombobox.h>

Detailed Description
This combobox shows a number of recent URLs/directories, as well as some default directories.It will manage the default dirs root-directory, home-directory and Desktop-directory, as well as a number of URLs set via setUrls() and one additional entry to be set via setUrl().
A combo box showing a number of recent URLs/directories
Definition at line 42 of file kurlcombobox.h.
Public Types | |
enum | Mode { Files = -1, Directories = 1, Both = 0 } |
enum | OverLoadResolving { RemoveTop, RemoveBottom } |
Signals | |
void | urlActivated (const KUrl &url) |
Public Member Functions | |
void | addDefaultUrl (const KUrl &url, const QIcon &icon, const QString &text=QString()) |
void | addDefaultUrl (const KUrl &url, const QString &text=QString()) |
KUrlComboBox (Mode mode, bool rw, QWidget *parent=0) | |
KUrlComboBox (Mode mode, QWidget *parent=0) | |
int | maxItems () const |
void | removeUrl (const KUrl &url, bool checkDefaultURLs=true) |
void | setDefaults () |
void | setMaxItems (int) |
void | setUrl (const KUrl &url) |
void | setUrls (const QStringList &urls, OverLoadResolving remove) |
void | setUrls (const QStringList &urls) |
QStringList | urls () const |
~KUrlComboBox () | |
Protected Member Functions | |
virtual void | mouseMoveEvent (QMouseEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
Properties | |
int | maxItems |
QStringList | urls |
Member Enumeration Documentation
enum KUrlComboBox::Mode |
This enum describes which kind of items is shown in the combo box.
Definition at line 52 of file kurlcombobox.h.
This Enumeration is used in setUrl() to determine which items will be removed when the given list is larger than maxItems().
- RemoveTop means that items will be removed from top
- RemoveBottom means, that items will be removed from the bottom
Definition at line 60 of file kurlcombobox.h.
Constructor & Destructor Documentation
Constructs a KUrlComboBox.
- Parameters:
-
mode is either Files, Directories or Both and controls the following behavior: - Files all inserted URLs will be treated as files, therefore the url shown in the combo will never show a trailing / the icon will be the one associated with the file's mimetype.
- Directories all inserted URLs will be treated as directories, will have a trailing slash in the combobox. The current directory will show the "open folder" icon, other directories the "folder" icon.
- Both Don't mess with anything, just show the url as given.
parent The parent object of this widget.
Definition at line 75 of file kurlcombobox.cpp.
Definition at line 82 of file kurlcombobox.cpp.
KUrlComboBox::~KUrlComboBox | ( | ) |
Member Function Documentation
void KUrlComboBox::addDefaultUrl | ( | const KUrl & | url, | |
const QIcon & | icon, | |||
const QString & | text = QString() | |||
) |
Adds a url that will always be shown in the combobox, it can't be "rotated away".
Default urls won't be returned in urls() and don't have to be set via setUrls(). If you don't need to specify a pixmap, use the overloaded method without the pixmap parameter. Default URLs will be inserted into the combobox by setDefaults()
Definition at line 136 of file kurlcombobox.cpp.
Adds a url that will always be shown in the combobox, it can't be "rotated away".
Default urls won't be returned in urls() and don't have to be set via setUrls(). If you want to specify a special pixmap, use the overloaded method with the pixmap parameter. Default URLs will be inserted into the combobox by setDefaults()
Definition at line 130 of file kurlcombobox.cpp.
int KUrlComboBox::maxItems | ( | ) | const |
void KUrlComboBox::mouseMoveEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
Definition at line 414 of file kurlcombobox.cpp.
void KUrlComboBox::mousePressEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
Definition at line 397 of file kurlcombobox.cpp.
Removes any occurrence of url
.
If checkDefaultUrls
is false default-urls won't be removed.
Definition at line 377 of file kurlcombobox.cpp.
void KUrlComboBox::setDefaults | ( | ) |
Clears all items and inserts the default urls into the combo.
Will be called implicitly upon the first call to setUrls() or setUrl()
- See also:
- addDefaultUrl
Definition at line 160 of file kurlcombobox.cpp.
void KUrlComboBox::setMaxItems | ( | int | max | ) |
Sets how many items should be handled and displayed by the combobox.
- See also:
- maxItems
Definition at line 347 of file kurlcombobox.cpp.
void KUrlComboBox::setUrl | ( | const KUrl & | url | ) |
Sets the current url.
This combo handles exactly one url additionally to the default items and those set via setUrls(). So you can call setUrl() as often as you want, it will always replace the previous one set via setUrl(). If url
is already in the combo, the last item will stay there and the existing item becomes the current item. The current item will always have the open-directory-pixmap as icon.
Note that you won't receive any signals, e.g. textChanged(), returnPressed() or activated() upon calling this method.
Definition at line 253 of file kurlcombobox.cpp.
void KUrlComboBox::setUrls | ( | const QStringList & | urls, | |
OverLoadResolving | remove | |||
) |
Inserts urls
into the combobox below the "default urls" (see addDefaultUrl).
If the list of urls contains more items than maxItems, the remove
parameter determines whether the first or last items will be stripped.
Definition at line 177 of file kurlcombobox.cpp.
void KUrlComboBox::setUrls | ( | const QStringList & | urls | ) |
Inserts urls
into the combobox below the "default urls" (see addDefaultUrl).
If the list of urls contains more items than maxItems, the first items will be stripped.
Definition at line 172 of file kurlcombobox.cpp.
void KUrlComboBox::urlActivated | ( | const KUrl & | url | ) | [signal] |
Emitted when an item was clicked at.
- Parameters:
-
url is the url of the now current item. If it is a local url, it won't have a protocol (file:/), otherwise it will.
QStringList KUrlComboBox::urls | ( | ) | const |
- Returns:
- a list of all urls currently handled.
The list contains at most maxItems() items. Use this to save the list of urls in a config-file and reinsert them via setUrls() next time. Note that all default urls set via addDefaultUrl() are not returned, they will automatically be set via setUrls() or setUrl(). You will always get fully qualified urls, i.e. with protocol like file:/
Property Documentation
int KUrlComboBox::maxItems [read, write] |
Definition at line 46 of file kurlcombobox.h.
QStringList KUrlComboBox::urls [read, write] |
Definition at line 45 of file kurlcombobox.h.
The documentation for this class was generated from the following files: