KURLBar Class Reference
KURLBar is a widget that displays icons together with a description. A URL-bar widget, as used in the KFileDialog. More...
#include <kurlbar.h>
Inheritance diagram for KURLBar:

Public Slots | |
virtual void | setCurrentItem (const KURL &url) |
Makes the item with the url url the current item. | |
Signals | |
void | activated (const KURL &url) |
This signal is emitted when the user activated an item, e.g by clicking on it. | |
Public Methods | |
KURLBar (bool useGlobalItems, QWidget *parent=0, const char *name=0, WFlags f=0) | |
Constructs a KURLBar. | |
~KURLBar () | |
Destroys the KURLBar. | |
virtual KURLBarItem * | insertItem (const KURL &url, const QString &description, bool applicationLocal=true, const QString &icon=QString::null, KIcon::Group group=KIcon::Panel) |
Inserts a new item into the KURLBar and returns the created KURLBarItem. | |
virtual void | setOrientation (Qt::Orientation orient) |
The items can be arranged either vertically in one column or horizontally in one row. | |
Orientation | orientation () const |
virtual void | setListBox (KURLBarListBox *) |
Allows to set a custom KURLBarListBox. | |
KURLBarListBox * | listBox () const |
virtual void | setIconSize (int size) |
Sets the default iconsize to be used for items inserted with insertItem. | |
int | iconSize () const |
virtual void | clear () |
Clears the view, removes all items. | |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
@reimpl | |
virtual void | readConfig (KConfig *config, const QString &itemGroup) |
Call this method to read a saved configuration from config , inside the group itemGroup . | |
virtual void | writeConfig (KConfig *config, const QString &itemGroup) |
Call this method to save the current configuration into config , inside the group iconGroup . | |
virtual void | readItem (int i, KConfig *config, bool applicationLocal) |
Called from readConfig() to read the i'th from config . | |
virtual void | writeItem (KURLBarItem *item, int i, KConfig *, bool global) |
Called from writeConfig() to save the KURLBarItem item as the i'th entry in the config-object. | |
KURLBarItem * | currentItem () const |
KURL | currentURL () const |
bool | isModified () const |
bool | isVertical () const |
Protected Slots | |
virtual void | slotContextMenuRequested (QListBoxItem *, const QPoint &pos) |
Reimplemented to show a contextmenu, allowing the user to add, edit or remove items, or change the iconsize. | |
virtual void | slotSelected (QListBoxItem *) |
Called when an item has been selected. | |
virtual void | slotDropped (QDropEvent *) |
Called when a url was dropped onto the bar to show a KURLBarItemDialog. | |
Protected Methods | |
virtual bool | addNewItem () |
Pops up a KURLBarItemDialog to let the user add a new item. | |
virtual bool | editItem (KURLBarItem *item) |
Pops up a KURLBarItemDialog to let the user edit the properties of item . | |
virtual void | resizeEvent (QResizeEvent *) |
@reimpl | |
Protected Attributes | |
KURLBarItem * | m_activeItem |
The currently active item. | |
bool | m_useGlobal:1 |
Whether we support global entries or just local ones. | |
bool | m_isModified:1 |
Whether the urlbar was modified by the user (e.g. |
Detailed Description
KURLBar is a widget that displays icons together with a description. A URL-bar widget, as used in the KFileDialog.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
|
Constructs a KURLBar.
Set Definition at line 228 of file kurlbar.cpp. References QWhatsThis::add(), isVertical(), and setListBox(). |
|
Destroys the KURLBar.
Definition at line 248 of file kurlbar.cpp. |
Member Function Documentation
|
Inserts a new item into the KURLBar and returns the created KURLBarItem.
Definition at line 252 of file kurlbar.cpp. References KStdAccel::description(), KIcon::Group, QListBox::insertItem(), and KURLBarItem::setApplicationLocal(). Referenced by readItem(), and slotDropped(). |
|
The items can be arranged either vertically in one column or horizontally in one row.
Definition at line 262 of file kurlbar.cpp. References isVertical(), and KURLBarListBox::setOrientation(). Referenced by setListBox(). |
|
Definition at line 273 of file kurlbar.cpp. References KURLBarListBox::orientation(). Referenced by isVertical(). |
|
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.
Definition at line 278 of file kurlbar.cpp. References QPalette::color(), QPalette::setColor(), setOrientation(), QListBox::setSelectionMode(), slotContextMenuRequested(), slotDropped(), and slotSelected(). Referenced by KURLBar(). |
|
|
|
Sets the default iconsize to be used for items inserted with insertItem. By default KIcon::SizeMedium.
Definition at line 314 of file kurlbar.cpp. References QListBox::firstItem(), KURLBarItem::icon(), KURLBarItem::iconGroup(), KURLBarItem::setIcon(), and sizeHint(). Referenced by slotContextMenuRequested(). |
|
Definition at line 265 of file kurlbar.h. Referenced by KURLBarItem::sizeHint(). |
|
Clears the view, removes all items.
Definition at line 332 of file kurlbar.cpp. References QListBox::clear(). |
|
Definition at line 343 of file kurlbar.cpp. References QListBox::firstItem(), QSize::height(), isVertical(), KURLBarItem::sizeHint(), and QSize::width(). Referenced by minimumSizeHint(), and setIconSize(). |
|
@reimpl
Definition at line 385 of file kurlbar.cpp. References QSize::height(), sizeHint(), and QSize::width(). |
|
Call this method to read a saved configuration from All items in there will be restored. The reading of every item is delegated to the readItem() method. Definition at line 452 of file kurlbar.cpp. References KGlobal::config(), and readItem(). |
|
Call this method to save the current configuration into The writeItem() method is used to save each item. Definition at line 489 of file kurlbar.cpp. References KURLBarItem::applicationLocal(), QListBox::firstItem(), m_isModified, m_useGlobal, and writeItem(). |
|
Called from readConfig() to read the i'th from
After reading a KURLBarItem is created and initialized with the read values (as well as the given Definition at line 473 of file kurlbar.cpp. References insertItem(), KProtocolInfo::isKnownProtocol(), KURL::isMalformed(), QString::number(), and KIO::number(). Referenced by readConfig(). |
|
Called from writeConfig() to save the KURLBarItem
Definition at line 535 of file kurlbar.cpp. References KURLBarItem::description(), KURLBarItem::icon(), KURLBarItem::iconGroup(), QString::number(), KIO::number(), KURL::prettyURL(), and KURLBarItem::url(). Referenced by writeConfig(). |
|
Definition at line 438 of file kurlbar.cpp. References QListBox::currentItem(), and QListBox::item(). Referenced by currentURL(). |
|
Definition at line 446 of file kurlbar.cpp. References currentItem(), and KURLBarItem::url(). |
|
Definition at line 328 of file kurlbar.h. References m_isModified. |
|
Definition at line 333 of file kurlbar.h. References orientation(). Referenced by KURLBar(), setOrientation(), and sizeHint(). |
|
Makes the item with the url Does nothing if no item with that url is available.
Definition at line 412 of file kurlbar.cpp. References QListBox::clearSelection(), QListBox::firstItem(), m_activeItem, QListBoxItem::next(), QListBox::setCurrentItem(), QListBox::setSelected(), KURLBarItem::url(), and KURL::url(). Referenced by slotContextMenuRequested(). |
|
This signal is emitted when the user activated an item, e.g by clicking on it.
Referenced by slotSelected(). |
|
Pops up a KURLBarItemDialog to let the user add a new item. Uses editItem() to do the job.
Definition at line 624 of file kurlbar.cpp. References editItem(), QDir::homeDirPath(), QListBox::insertItem(), and KURL::setPath(). Referenced by slotContextMenuRequested(). |
|
Pops up a KURLBarItemDialog to let the user edit the properties of Invoked e.g. by addNewItem(), when the user drops a url onto the bar or from the contextmenu.
Definition at line 639 of file kurlbar.cpp. References KURLBarItem::applicationLocal(), KURLBarItem::description(), KStdAccel::description(), KURLBarItemDialog::getInformation(), KURLBarItem::icon(), m_isModified, m_useGlobal, KURLBarItem::setApplicationLocal(), KURLBarItem::setDescription(), KURLBarItem::setIcon(), KURLBarItem::setURL(), QListBox::triggerUpdate(), and KURLBarItem::url(). Referenced by addNewItem(), and slotContextMenuRequested(). |
|
@reimpl
Reimplemented from QFrame. Definition at line 337 of file kurlbar.cpp. References QFrame::resizeEvent(). |
|
Reimplemented to show a contextmenu, allowing the user to add, edit or remove items, or change the iconsize.
Definition at line 575 of file kurlbar.cpp. References addNewItem(), editItem(), QPopupMenu::exec(), QPopupMenu::insertItem(), QPopupMenu::insertSeparator(), m_activeItem, m_isModified, setCurrentItem(), setIconSize(), QPopupMenu::setItemEnabled(), KIcon::SizeMedium, KIcon::SizeSmall, QListBox::triggerUpdate(), and KURLBarItem::url(). Referenced by setListBox(). |
|
Called when an item has been selected. Emits the activated() signal. Definition at line 401 of file kurlbar.cpp. References activated(), m_activeItem, QListBox::setCurrentItem(), and KURLBarItem::url(). Referenced by setListBox(). |
|
Called when a url was dropped onto the bar to show a KURLBarItemDialog.
Definition at line 551 of file kurlbar.cpp. References KURLDrag::decode(), KStdAccel::description(), KURLBarItemDialog::getInformation(), insertItem(), m_isModified, and m_useGlobal. Referenced by setListBox(). |
Member Data Documentation
|
The currently active item.
Definition at line 374 of file kurlbar.h. Referenced by setCurrentItem(), slotContextMenuRequested(), and slotSelected(). |
|
Whether we support global entries or just local ones.
Definition at line 378 of file kurlbar.h. Referenced by editItem(), slotDropped(), and writeConfig(). |
|
Whether the urlbar was modified by the user (e.g. by editing/adding/removing an item). Definition at line 384 of file kurlbar.h. Referenced by editItem(), isModified(), slotContextMenuRequested(), slotDropped(), and writeConfig(). |
The documentation for this class was generated from the following files: