• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

Public Types | Signals | Public Member Functions | Protected Types | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
KURLComboBox Class Reference

#include <kurlcombobox.h>

Inherits KComboBox.

Public Types

enum  Mode { Files = -1 , Directories = 1 , Both = 0 }
 
enum  OverLoadResolving { RemoveTop , RemoveBottom }
 

Signals

void urlActivated (const KURL &url)
 

Public Member Functions

 KURLComboBox (Mode mode, TQWidget *parent=0, const char *name=0)
 
 KURLComboBox (Mode mode, bool rw, TQWidget *parent=0, const char *name=0)
 
 ~KURLComboBox ()
 
void setURL (const KURL &url)
 
void setURLs (TQStringList urls)
 
void setURLs (TQStringList urls, OverLoadResolving remove)
 
TQStringList urls () const
 
void setMaxItems (int)
 
int maxItems () const
 
void addDefaultURL (const KURL &url, const TQString &text=TQString::null)
 
void addDefaultURL (const KURL &url, const TQPixmap &pix, const TQString &text=TQString::null)
 
void setDefaults ()
 
void removeURL (const KURL &url, bool checkDefaultURLs=true)
 

Protected Types

typedef _KURLComboItem KURLComboItem
 

Protected Slots

void slotActivated (int)
 

Protected Member Functions

void init (Mode mode)
 
void insertURLItem (const KURLComboItem *)
 
TQPixmap getPixmap (const KURL &url) const
 
void updateItem (const KURLComboItem *item, int index, const TQPixmap &pix)
 

Protected Attributes

TQPtrList< KURLComboItem > itemList
 
TQPtrList< KURLComboItem > defaultList
 
TQMap< int, const KURLComboItem * > itemMapper
 
TQPixmap opendirPix
 
int firstItemIndex
 

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

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

Definition at line 41 of file kurlcombobox.h.

Member Typedef Documentation

◆ KURLComboItem

typedef _KURLComboItem KURLComboBox::KURLComboItem
protected

Definition at line 192 of file kurlcombobox.h.

Member Enumeration Documentation

◆ Mode

enum KURLComboBox::Mode

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

Definition at line 51 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

Definition at line 59 of file kurlcombobox.h.

Constructor & Destructor Documentation

◆ KURLComboBox() [1/2]

KURLComboBox::KURLComboBox ( Mode  mode,
TQWidget *  parent = 0,
const char *  name = 0 
)

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.
nameThe name of this widget.

Definition at line 41 of file kurlcombobox.cpp.

◆ KURLComboBox() [2/2]

KURLComboBox::KURLComboBox ( Mode  mode,
bool  rw,
TQWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 48 of file kurlcombobox.cpp.

◆ ~KURLComboBox()

KURLComboBox::~KURLComboBox ( )

Destructs the combo box.

Definition at line 56 of file kurlcombobox.cpp.

Member Function Documentation

◆ addDefaultURL() [1/2]

void KURLComboBox::addDefaultURL ( const KURL &  url,
const TQPixmap &  pix,
const TQString &  text = TQString::null 
)

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

◆ addDefaultURL() [2/2]

void KURLComboBox::addDefaultURL ( const KURL &  url,
const TQString &  text = TQString::null 
)

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

◆ getPixmap()

TQPixmap KURLComboBox::getPixmap ( const KURL &  url) const
protected

Uses KMimeType::pixmapForURL() to return a proper pixmap for url.

In directory mode, a folder icon is always returned.

Definition at line 335 of file kurlcombobox.cpp.

◆ init()

void KURLComboBox::init ( Mode  mode)
protected

Definition at line 62 of file kurlcombobox.cpp.

◆ insertURLItem()

void KURLComboBox::insertURLItem ( const KURLComboItem *  item)
protected

Definition at line 278 of file kurlcombobox.cpp.

◆ maxItems()

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

Definition at line 137 of file kurlcombobox.h.

◆ 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 313 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 125 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 287 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 205 of file kurlcombobox.cpp.

◆ setURLs() [1/2]

void KURLComboBox::setURLs ( TQStringList  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 137 of file kurlcombobox.cpp.

◆ setURLs() [2/2]

void KURLComboBox::setURLs ( TQStringList  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 142 of file kurlcombobox.cpp.

◆ slotActivated

void KURLComboBox::slotActivated ( int  index)
protectedslot

Definition at line 267 of file kurlcombobox.cpp.

◆ updateItem()

void KURLComboBox::updateItem ( const KURLComboItem *  item,
int  index,
const TQPixmap &  pix 
)
protected

Updates item with pixmap and sets the url instead of the text of the KURLComboItem.

Also works around a Qt bug.

Definition at line 346 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()

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

Member Data Documentation

◆ defaultList

TQPtrList<KURLComboItem> KURLComboBox::defaultList
protected

Definition at line 194 of file kurlcombobox.h.

◆ firstItemIndex

int KURLComboBox::firstItemIndex
protected

Definition at line 214 of file kurlcombobox.h.

◆ itemList

TQPtrList<KURLComboItem> KURLComboBox::itemList
protected

Definition at line 193 of file kurlcombobox.h.

◆ itemMapper

TQMap<int,const KURLComboItem*> KURLComboBox::itemMapper
protected

Definition at line 195 of file kurlcombobox.h.

◆ opendirPix

TQPixmap KURLComboBox::opendirPix
protected

Definition at line 213 of file kurlcombobox.h.


The documentation for this class was generated from the following files:
  • kurlcombobox.h
  • kurlcombobox.cpp

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.9.4
This website is maintained by Timothy Pearson.