Main Page Modules Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members Related Pages
KURLBar Class Reference
A URL-bar widget, as used in the KFileDialog.
More...
#include <kurlbar.h>
Inheritance diagram for KURLBar:
List of all members.
|
Public Slots |
| virtual void | setCurrentItem (const KURL &url) |
Signals |
| void | activated (const KURL &url) |
Public Methods |
| | KURLBar (bool useGlobalItems, QWidget *parent=0, const char *name=0, WFlags f=0) |
| | ~KURLBar () |
| virtual KURLBarItem * | insertItem (const KURL &url, const QString &description, bool applicationLocal=true, const QString &icon=QString::null, KIcon::Group group=KIcon::Panel) |
| virtual void | setOrientation (Qt::Orientation orient) |
| Orientation | orientation () const |
| virtual void | setListBox (KURLBarListBox *) |
| KURLBarListBox * | listBox () const |
| virtual void | setIconSize (int size) |
| int | iconSize () const |
| virtual void | clear () |
| virtual QSize | sizeHint () const |
| virtual QSize | minimumSizeHint () const |
| virtual void | readConfig (KConfig *config, const QString &itemGroup) |
| virtual void | writeConfig (KConfig *config, const QString &itemGroup) |
| virtual void | readItem (int i, KConfig *config, bool applicationLocal) |
| virtual void | writeItem (KURLBarItem *item, int i, KConfig *, bool global) |
| KURLBarItem * | currentItem () const |
| KURL | currentURL () const |
| bool | isModified () const |
| bool | isImmutable () const |
| bool | isVertical () const |
Protected Slots |
| virtual void | slotContextMenuRequested (QListBoxItem *, const QPoint &pos) |
| virtual void | slotSelected (QListBoxItem *) |
| virtual void | slotDropped (QDropEvent *) |
Protected Methods |
| virtual bool | addNewItem () |
| virtual bool | editItem (KURLBarItem *item) |
| virtual void | resizeEvent (QResizeEvent *) |
Protected Attributes |
| KURLBarItem * | m_activeItem |
| bool | m_useGlobal:1 |
| bool | m_isModified:1 |
| bool | m_isImmutable:1 |
Detailed Description
A URL-bar widget, as used in the KFileDialog.
KURLBar is a widget that displays icons together with a description. They can be arranged either horizontally or vertically. Clicking on an item will make the activated() signal being emitted. The user can edit existing items by choosing "Edit entry" in the contextmenu. He can also remove or add new entries (via drag&drop or the context menu).
KURLBar offers the methods readConfig() and writeConfig() to read and write the configuration of all the entries. It can differentiate between global and local entries -- global entries will be saved in the global configuration (kdeglobals), while local entries will be saved in your application's KConfig object.
Due to the configurability, you usually only insert some default entries once and then solely use the read and writeConfig methods to preserve the user's configuration.
The widget has a "current" item, that is visualized to differentiate it from others.
- Author:
-
Carsten Pfeiffer <pfeiffer@kde.org>
Definition at line 198 of file kurlbar.h.
Constructor & Destructor Documentation
| KURLBar::KURLBar |
( |
bool |
useGlobalItems, |
|
|
QWidget * |
parent = 0, |
|
|
const char * |
name = 0, |
|
|
WFlags |
f = 0 |
|
) |
|
|
|
|
Constructs a KURLBar. Set useGlobalItems to true if you want to allow global/local item separation. |
Member Function Documentation
| void KURLBar::activated |
( |
const KURL & |
url |
) |
[signal] |
|
|
|
This signal is emitted when the user activated an item, e.g by clicking on it. |
| virtual bool KURLBar::addNewItem |
( |
|
) |
[protected, virtual] |
|
|
|
Pops up a KURLBarItemDialog to let the user add a new item. Uses editItem() to do the job. - Returns:
-
false if the user aborted the dialog and no item is added.
|
| virtual void KURLBar::clear |
( |
|
) |
[virtual] |
|
|
|
Clears the view, removes all items. |
| KURL KURLBar::currentURL |
( |
|
) |
|
|
| virtual bool KURLBar::editItem |
( |
KURLBarItem * |
item |
) |
[protected, virtual] |
|
|
|
Pops up a KURLBarItemDialog to let the user edit the properties of item. Invoked e.g. by addNewItem(), when the user drops a url onto the bar or from the contextmenu. - Returns:
-
false if the user aborted the dialog and
item is not changed. |
| int KURLBar::iconSize |
( |
|
) |
const [inline] |
|
| virtual KURLBarItem* KURLBar::insertItem |
( |
const KURL & |
url, |
|
|
const QString & |
description, |
|
|
bool |
applicationLocal = true, |
|
|
const QString & |
icon = QString::null, |
|
|
KIcon::Group |
group = KIcon::Panel |
|
) |
[virtual] |
|
|
|
Inserts a new item into the KURLBar and returns the created KURLBarItem.
url the url of the item description the description of the item (shown in the view) applicationLocal whether this should be a global or a local item icon an icon -- if empty, the default icon for the url will be used group the icon-group for using icon-effects |
| bool KURLBar::isImmutable |
( |
|
) |
const [inline] |
|
|
|
- Returns:
-
true when the urlbar may not be modified by the user
Definition at line 333 of file kurlbar.h.
References m_isImmutable. |
| bool KURLBar::isModified |
( |
|
) |
const [inline] |
|
|
|
- Returns:
-
true when the urlbar was modified by the user (e.g. by editing/adding/removing one or more entries). Will be reset to false after calling writeConfig().
Definition at line 328 of file kurlbar.h.
References m_isModified. |
| bool KURLBar::isVertical |
( |
|
) |
const [inline] |
|
| virtual QSize KURLBar::minimumSizeHint |
( |
|
) |
[virtual] |
|
| Orientation KURLBar::orientation |
( |
|
) |
|
|
| virtual void KURLBar::readConfig |
( |
KConfig * |
config, |
|
|
const QString & |
itemGroup |
|
) |
[virtual] |
|
|
|
Call this method to read a saved configuration from config, inside the group itemGroup. All items in there will be restored. The reading of every item is delegated to the readItem() method. |
| virtual void KURLBar::readItem |
( |
int |
i, |
|
|
KConfig * |
config, |
|
|
bool |
applicationLocal |
|
) |
[virtual] |
|
|
|
Called from readConfig() to read the i'th from config. After reading a KURLBarItem is created and initialized with the read values (as well as the given applicationLocal). |
| virtual void KURLBar::resizeEvent |
( |
QResizeEvent * |
|
) |
[protected, virtual] |
|
| virtual void KURLBar::setCurrentItem |
( |
const KURL & |
url |
) |
[virtual, slot] |
|
|
|
Makes the item with the url url the current item. Does nothing if no item with that url is available. - See also:
-
currentItem , currentURL
|
| virtual void KURLBar::setIconSize |
( |
int |
size |
) |
[virtual] |
|
|
|
Allows to set a custom KURLBarListBox. Note: The previous listbox will be deleted. Items of the previous listbox will not be moved to the new box. - See also:
-
listBox
|
| virtual void KURLBar::setOrientation |
( |
Qt::Orientation |
orient |
) |
[virtual] |
|
|
|
The items can be arranged either vertically in one column or horizontally in one row. - See also:
-
orientation
|
| virtual QSize KURLBar::sizeHint |
( |
|
) |
[virtual] |
|
|
|
- Returns:
-
a proper sizehint, depending on the orientation and number of items available.
|
| virtual void KURLBar::slotContextMenuRequested |
( |
QListBoxItem * |
, |
|
|
const QPoint & |
pos |
|
) |
[protected, virtual, slot] |
|
|
|
Reimplemented to show a contextmenu, allowing the user to add, edit or remove items, or change the iconsize. |
| virtual void KURLBar::slotDropped |
( |
QDropEvent * |
|
) |
[protected, virtual, slot] |
|
| virtual void KURLBar::slotSelected |
( |
QListBoxItem * |
|
) |
[protected, virtual, slot] |
|
|
|
Called when an item has been selected. Emits the activated() signal. |
| virtual void KURLBar::writeConfig |
( |
KConfig * |
config, |
|
|
const QString & |
itemGroup |
|
) |
[virtual] |
|
|
|
Call this method to save the current configuration into config, inside the group iconGroup. The writeItem() method is used to save each item. |
| virtual void KURLBar::writeItem |
( |
KURLBarItem * |
item, |
|
|
int |
i, |
|
|
KConfig * |
, |
|
|
bool |
global |
|
) |
[virtual] |
|
|
|
Called from writeConfig() to save the KURLBarItem item as the i'th entry in the config-object. global tell whether it should be saved in the global configuration or not (using KConfig::writeEntry( key, value, true, global ) ). |
Member Data Documentation
|
|
The currently active item.
Definition at line 379 of file kurlbar.h. |
bool KURLBar::m_isImmutable [protected]
|
|
|
|
Whether the urlbar may be modified by the user. If immutable is true, the urlbar can not be modified.
Definition at line 395 of file kurlbar.h.
Referenced by isImmutable(). |
bool KURLBar::m_isModified [protected]
|
|
|
|
Whether the urlbar was modified by the user (e.g. by editing/adding/removing an item).
Definition at line 389 of file kurlbar.h.
Referenced by isModified(). |
bool KURLBar::m_useGlobal [protected]
|
|
|
|
Whether we support global entries or just local ones.
Definition at line 383 of file kurlbar.h. |
The documentation for this class was generated from the following file:
Generated on Wed Aug 13 23:30:27 2003 for kdelibs by
1.2.18