• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

Public Types | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
KUrlComboBox Class Reference

#include <kurlcombobox.h>

Inheritance diagram for KUrlComboBox:
KComboBox QComboBox KCompletionBase

Public Types

enum  Mode { Files = -1 , Directories = 1 , Both = 0 }
 
enum  OverLoadResolving { RemoveTop , RemoveBottom }
 
- Public Types inherited from KCompletionBase
typedef QMap< KeyBindingType, KShortcut > KeyBindingMap
 
enum  KeyBindingType
 

Signals

void urlActivated (const KUrl &url)
 
- Signals inherited from KComboBox
void aboutToShowContextMenu (QMenu *p)
 
void completion (const QString &)
 
void completionModeChanged (KGlobalSettings::Completion)
 
void returnPressed ()
 
void returnPressed (const QString &)
 
void substringCompletion (const QString &)
 
void textRotation (KCompletionBase::KeyBindingType)
 

Public Member Functions

 KUrlComboBox (Mode mode, bool rw, QWidget *parent=0)
 
 KUrlComboBox (Mode mode, QWidget *parent=0)
 
 ~KUrlComboBox ()
 
void addDefaultUrl (const KUrl &url, const QIcon &icon, const QString &text=QString())
 
void addDefaultUrl (const KUrl &url, const QString &text=QString())
 
int maxItems () const
 
void removeUrl (const KUrl &url, bool checkDefaultURLs=true)
 
virtual void setCompletionObject (KCompletion *compObj, bool hsig=true)
 
void setDefaults ()
 
void setMaxItems (int)
 
void setUrl (const KUrl &url)
 
void setUrls (const QStringList &urls)
 
void setUrls (const QStringList &urls, OverLoadResolving remove)
 
QStringList urls () const
 
- Public Member Functions inherited from KComboBox
 KComboBox (bool rw, QWidget *parent=0)
 
 KComboBox (QWidget *parent=0)
 
virtual ~KComboBox ()
 
void addUrl (const KUrl &url)
 
void addUrl (const QIcon &icon, const KUrl &url)
 
bool autoCompletion () const
 
void changeURL (const KUrl &url, int index)
 
void changeURL (const QPixmap &pixmap, const KUrl &url, int index)
 
void changeUrl (int index, const KUrl &url)
 
void changeUrl (int index, const QIcon &icon, const KUrl &url)
 
KCompletionBox * completionBox (bool create=true)
 
bool contains (const QString &text) const
 
int cursorPosition () const
 
virtual bool eventFilter (QObject *, QEvent *)
 
void insertURL (const KUrl &url, int index=-1)
 
void insertURL (const QPixmap &pixmap, const KUrl &url, int index=-1)
 
void insertUrl (int index, const KUrl &url)
 
void insertUrl (int index, const QIcon &icon, const KUrl &url)
 
virtual void setAutoCompletion (bool autocomplete)
 
virtual void setContextMenuEnabled (bool showMenu)
 
void setEditable (bool editable)
 
void setEditUrl (const KUrl &url)
 
virtual void setLineEdit (QLineEdit *)
 
void setTrapReturnKey (bool trap)
 
void setUrlDropsEnabled (bool enable)
 
bool trapReturnKey () const
 
bool urlDropsEnabled () const
 
- Public Member Functions inherited from KCompletionBase
 KCompletionBase ()
 
virtual ~KCompletionBase ()
 
KGlobalSettings::Completion completionMode () const
 
KCompletion * completionObject (bool hsig=true)
 
KCompletion * compObj () const
 
bool emitSignals () const
 
KShortcut getKeyBinding (KeyBindingType item) const
 
bool handleSignals () const
 
bool isCompletionObjectAutoDeleted () const
 
void setAutoDeleteCompletionObject (bool autoDelete)
 
virtual void setCompletedItems (const QStringList &items, bool autoSuggest=true)=0
 
virtual void setCompletedText (const QString &text)=0
 
virtual void setCompletionMode (KGlobalSettings::Completion mode)
 
virtual void setCompletionObject (KCompletion *compObj, bool hsig=true)
 
void setEnableSignals (bool enable)
 
virtual void setHandleSignals (bool handle)
 
bool setKeyBinding (KeyBindingType item, const KShortcut &key)
 
void useGlobalKeyBindings ()
 

Protected Member Functions

virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void mousePressEvent (QMouseEvent *event)
 
- Protected Member Functions inherited from KComboBox
virtual void create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
virtual QSize minimumSizeHint () const
 
virtual void setCompletedText (const QString &, bool)
 
virtual void wheelEvent (QWheelEvent *ev)
 
- Protected Member Functions inherited from KCompletionBase
KCompletionBase * delegate () const
 
KeyBindingMap getKeyBindings () const
 
void setDelegate (KCompletionBase *delegate)
 
virtual void virtual_hook (int id, void *data)
 

Properties

int maxItems
 
QStringList urls
 
- Properties inherited from KComboBox
bool autoCompletion
 
bool trapReturnKey
 
bool urlDropsEnabled
 

Additional Inherited Members

- Public Slots inherited from KComboBox
void rotateText (KCompletionBase::KeyBindingType type)
 
void setCompletedItems (const QStringList &items, bool autosubject=true)
 
virtual void setCompletedText (const QString &)
 
void setCurrentItem (const QString &item, bool insert=false, int index=-1)
 
- Public Attributes inherited from KCompletionBase
 NextCompletionMatch
 
 PrevCompletionMatch
 
 SubstringCompletion
 
 TextCompletion
 
- Protected Slots inherited from KComboBox
virtual void makeCompletion (const QString &)
 

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

This widget forces the layout direction to be Qt::LeftToRight instead of inheriting the layout direction like a normal widget. This means that even in RTL desktops the widget will be displayed in LTR mode, as generally URLs are LTR by nature.

A combo box showing a number of recent URLs/directories

Author
Carsten Pfeiffer pfeif.nosp@m.fer@.nosp@m.kde.o.nosp@m.rg

Definition at line 47 of file kurlcombobox.h.

Member Enumeration Documentation

◆ Mode

enum KUrlComboBox::Mode

This enum describes which kind of items is shown in the combo box.

Enumerator
Files 
Directories 
Both 

Definition at line 57 of file kurlcombobox.h.

◆ OverLoadResolving

enum KUrlComboBox::OverLoadResolving

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
Enumerator
RemoveTop 
RemoveBottom 

Definition at line 65 of file kurlcombobox.h.

Constructor & Destructor Documentation

◆ KUrlComboBox() [1/2]

KUrlComboBox::KUrlComboBox ( Mode  mode,
QWidget *  parent = 0 
)
explicit

Constructs a KUrlComboBox.

Parameters
modeis 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.
parentThe parent object of this widget.

Definition at line 75 of file kurlcombobox.cpp.

◆ KUrlComboBox() [2/2]

KUrlComboBox::KUrlComboBox ( Mode  mode,
bool  rw,
QWidget *  parent = 0 
)

Definition at line 82 of file kurlcombobox.cpp.

◆ ~KUrlComboBox()

KUrlComboBox::~KUrlComboBox ( )

Destructs the combo box.

Definition at line 89 of file kurlcombobox.cpp.

Member Function Documentation

◆ addDefaultUrl() [1/2]

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 140 of file kurlcombobox.cpp.

◆ addDefaultUrl() [2/2]

void KUrlComboBox::addDefaultUrl ( const KUrl &  url,
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 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 134 of file kurlcombobox.cpp.

◆ maxItems()

int KUrlComboBox::maxItems ( ) const
Returns
the maximum of items the combobox handles.
See also
setMaxItems

Definition at line 350 of file kurlcombobox.cpp.

◆ mouseMoveEvent()

void KUrlComboBox::mouseMoveEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 403 of file kurlcombobox.cpp.

◆ mousePressEvent()

void KUrlComboBox::mousePressEvent ( QMouseEvent *  event)
protectedvirtual

Definition at line 386 of file kurlcombobox.cpp.

◆ removeUrl()

void KUrlComboBox::removeUrl ( const KUrl &  url,
bool  checkDefaultURLs = true 
)

Removes any occurrence of url.

If checkDefaultUrls is false default-urls won't be removed.

Definition at line 355 of file kurlcombobox.cpp.

◆ setCompletionObject()

void KUrlComboBox::setCompletionObject ( KCompletion *  compObj,
bool  hsig = true 
)
virtual

Reimplemented from KComboBox (from KCompletion)

Reimplemented from KCompletionBase.

Definition at line 375 of file kurlcombobox.cpp.

◆ setDefaults()

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 157 of file kurlcombobox.cpp.

◆ setMaxItems()

void KUrlComboBox::setMaxItems ( int  max)

Sets how many items should be handled and displayed by the combobox.

See also
maxItems

Definition at line 329 of file kurlcombobox.cpp.

◆ setUrl()

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 241 of file kurlcombobox.cpp.

◆ setUrls() [1/2]

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 169 of file kurlcombobox.cpp.

◆ setUrls() [2/2]

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 174 of file kurlcombobox.cpp.

◆ urlActivated

void KUrlComboBox::urlActivated ( const KUrl &  url)
signal

Emitted when an item was clicked at.

Parameters
urlis the url of the now current item. If it is a local url, it won't have a protocol (file:/), otherwise it will.

◆ urls()

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:/

Definition at line 114 of file kurlcombobox.cpp.

Property Documentation

◆ maxItems

int KUrlComboBox::maxItems
readwrite

Definition at line 1 of file kurlcombobox.h.

◆ urls

QStringList KUrlComboBox::urls
readwrite

Definition at line 1 of file kurlcombobox.h.


The documentation for this class was generated from the following files:
  • kurlcombobox.h
  • kurlcombobox.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal