class KURLBar

A URL-bar widget, as used in the KFileDialog. More...

Definition#include <kurlbar.h>
InheritsQFrame (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Slots

Signals

Protected Methods

Protected Slots

Protected Members


Detailed Description

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.

 KURLBar ( bool useGlobalItems, QWidget *parent = 0, const char *name = 0, WFlags f = 0 )

KURLBar

Constructs a KURLBar. Set useGlobalItems to true if you want to allow global/local item separation.

 ~KURLBar ()

~KURLBar

Destroys the KURLBar.

KURLBarItem *  insertItem ( const KURL& url, const QString& description, bool applicationLocal = true, const QString& icon = QString::null, KIcon::Group group = KIcon::Panel )

insertItem

[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

void  setOrientation ( Qt::Orientation orient )

setOrientation

[virtual]

The items can be arranged either vertically in one column or horizontally in one row.

See also: orientation

Orientation  orientation ()

orientation

[const]

Returns: the current orientation mode.

See also: setOrientation

void  setListBox ( KURLBarListBox * )

setListBox

[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

KURLBarListBoxlistBox ()

listBox

[const]

Returns: the KURLBarListBox that is used.

See also: setListBox

void  setIconSize ( int size )

setIconSize

[virtual]

Sets the default iconsize to be used for items inserted with insertItem. By default KIcon::SizeMedium.

See also: iconsize

int  iconSize ()

iconSize

[const]

Returns: the default iconsize used for items inserted with insertItem. By default KIcon::SizeMedium

See also: setIconSize

void  clear ()

clear

[virtual]

Clears the view, removes all items.

QSize  sizeHint ()

sizeHint

[const virtual]

Returns: a proper sizehint, depending on the orientation and number of items available.

QSize  minimumSizeHint ()

minimumSizeHint

[const virtual]

@reimpl

void  readConfig ( KConfig *config, const QString& itemGroup )

readConfig

[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.

void  writeConfig ( KConfig *config, const QString& itemGroup )

writeConfig

[virtual]

Call this method to save the current configuration into config, inside the group iconGroup. The writeItem() method is used to save each item.

void  readItem ( int i, KConfig *config, bool applicationLocal )

readItem

[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).

void  writeItem ( KURLBarItem *item, int i, KConfig *, bool global )

writeItem

[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 ) ).

KURLBarItem *  currentItem ()

currentItem

[const]

Returns: the current KURLBarItem, or 0L if none.

See also: setCurrentItem, currentURL

KURL  currentURL ()

currentURL

[const]

Returns: the url of the current item or an invalid url, if there is no current item.

See also: currentItem, setCurrentItem

bool  isModified ()

isModified

[const]

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

void  setCurrentItem ( const KURL& url )

setCurrentItem

[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

void  activated ( const KURL& url )

activated

[signal]

This signal is emitted when the user activated an item, e.g by clicking on it.

bool  addNewItem ()

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.

bool  editItem ( KURLBarItem *item )

editItem

[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.

void  resizeEvent ( QResizeEvent * )

resizeEvent

[protected virtual]

@reimpl

bool  isVertical ()

isVertical

[protected const]

Returns: true if the bar is in vertical mode.

KURLBarItem * m_activeItem

m_activeItem

[protected]

bool m_useGlobal

m_useGlobal

[protected]

bool m_isModified

m_isModified

[protected]

void  slotContextMenuRequested ( QListBoxItem *, const QPoint& pos )

slotContextMenuRequested

[protected slots virtual slot]

Reimplemented to show a contextmenu, allowing the user to add, edit or remove items, or change the iconsize.

void  slotSelected ( QListBoxItem * )

slotSelected

[protected slots virtual slot]

Called when an item has been selected. Emits the activated() signal.

void  slotDropped ( QDropEvent * )

slotDropped

[protected slots virtual slot]

Called when a url was dropped onto the bar to show a KURLBarItemDialog.

void  virtual_hook ( int id, void* data )

virtual_hook

[protected virtual]