#include </home/clem/local/src/opie/libopie2/qt3/opieui/ocombobox.h>
Inheritance diagram for OHistoryCombo:


Public Slots | |
| void | addToHistory (const QString &item) |
| void | clearHistory () |
Signals | |
| void | cleared () |
Public Member Functions | |
| OHistoryCombo (QWidget *parent=0L, const char *name=0L) | |
| OHistoryCombo (bool useCompletion, QWidget *parent=0L, const char *name=0L) | |
| ~OHistoryCombo () | |
| void | setHistoryItems (QStringList items) |
| void | setHistoryItems (QStringList items, bool setCompletionList) |
| QStringList | historyItems () const |
| bool | removeFromHistory (const QString &item) |
| void | setPixmapProvider (OPixmapProvider *prov) |
| OPixmapProvider * | pixmapProvider () const |
| void | reset () |
Protected Member Functions | |
| virtual void | keyPressEvent (QKeyEvent *) |
| void | insertItems (const QStringList &items) |
| bool | useCompletion () const |
Properties | |
| QStringList | historyItems |
Private Slots | |
| void | slotReset () |
| void | slotClear () |
| void | addContextMenuItems (QPopupMenu *) |
Private Member Functions | |
| void | init (bool useCompletion) |
Private Attributes | |
| int | myIterateIndex |
| QString | myText |
| bool | myRotated |
| OPixmapProvider * | myPixProvider |
| OHistoryComboPrivate * | d |
A combobox which implements a history like a unix shell. You can navigate through all the items by using the Up or Down arrows (configurable of course). Additionally, weighted completion is available. So you should load and save the completion list to preserve the weighting between sessions.
Definition at line 552 of file ocombobox.h.
|
||||||||||||
|
Constructs a "read-write" combobox. A read-only history combobox doesn't make much sense, so it is only available as read-write. Completion will be used automatically for the items in the combo. The insertion-policy is set to NoInsertion, you have to add the items yourself via the slot addToHistory. If you want every item added, use
connect( combo, SIGNAL( activated( const QString& )),
combo, SLOT( addToHistory( const QString& )));
Use QComboBox::setMaxCount() to limit the history.
Definition at line 409 of file ocombobox.cpp. References OComboBox::init(). |
|
||||||||||||||||
|
Same as the previous constructor, but additionally has the option to specify whether you want to let OHistoryCombo handle completion or not. If set to Definition at line 416 of file ocombobox.cpp. References OComboBox::init(). |
|
|
Destructs the combo, the completion-object and the pixmap-provider Definition at line 439 of file ocombobox.cpp. References myPixProvider. |
|
|
Appends our own context menu entry. Definition at line 482 of file ocombobox.cpp. References slotClear(), text, and tr. Referenced by init(). |
|
|
Adds an item to the end of the history list and to the completion list. If maxCount() is reached, the first item of the list will be removed.
If the last inserted item is the same as
If duplicatesEnabled() is false, any equal existing item will be removed before Note: By using this method and not the Q and OComboBox insertItem() methods, you make sure that the combobox stays in sync with the completion. It would be annoying if completion would give an item not in the combobox, and vice versa.
Definition at line 491 of file ocombobox.cpp. References OCompletionBase::completionObject(), OComboBox::contains(), i, QString::isEmpty(), myPixProvider, text, and useCompletion(). |
|
|
Emitted when the history was cleared by the entry in the popup menu. Referenced by slotClear(). |
|
|
Clears the history and the completion list. Definition at line 475 of file ocombobox.cpp. References OCompletionBase::completionObject(), and useCompletion(). Referenced by slotClear(). |
|
|
Returns the list of history items. Empty, when this is not a read-write combobox.
Referenced by setPixmapProvider(). |
|
|
Definition at line 423 of file ocombobox.cpp. References OComboBox::aboutToShowContextMenu(), addContextMenuItems(), OCompletionBase::completionObject(), myIterateIndex, myPixProvider, myRotated, OComboBox::returnPressed(), slotReset(), and OCompletion::Weighted. |
|
|
Inserts Note: duplicatesEnabled() is not honored here. Called from setHistoryItems() and setPixmapProvider() Definition at line 647 of file ocombobox.cpp. References QValueList< T >::begin(), QValueList< T >::end(), QString::isEmpty(), and myPixProvider. Referenced by setHistoryItems(), and setPixmapProvider(). |
|
|
Handling key-events, the shortcuts to rotate the items. Definition at line 551 of file ocombobox.cpp. References Qt::Key_Down, Qt::Key_Up, myIterateIndex, myRotated, myText, qDebug(), and text. |
|
|
Definition at line 683 of file ocombobox.h. References myPixProvider. |
|
|
Removes all items named
Definition at line 530 of file ocombobox.cpp. References OCompletionBase::completionObject(), i, text, and useCompletion(). |
|
|
Resets the current position of the up/down history. Call this when you manually call setCurrentItem() or clearEdit(). Definition at line 689 of file ocombobox.h. References slotReset(). |
|
||||||||||||
|
Inserts
Set OConfig *config = kapp->config(); QStringList list;
// load the history and completion list after creating the history combo list = config->readListEntry( "Completion list" ); combo->completionObject()->setItems( list ); list = config->readListEntry( "History list" ); combo->setHistoryItems( list );
[...]
// save the history and completion list when the history combo is // destroyed list = combo->completionObject()->items() config->writeEntry( "Completion list", list ); list = combo->historyItems(); config->writeEntry( "History list", list ); Be sure to use different names for saving with OConfig if you have more than one OHistoryCombo.
Note: When
Definition at line 444 of file ocombobox.cpp. References QValueList< T >::begin(), OCompletionBase::completionObject(), QValueList< T >::count(), OCompletion::Insertion, insertItems(), QValueList< T >::isEmpty(), QValueList< T >::remove(), OCompletion::setItems(), OCompletion::setOrder(), useCompletion(), and OCompletion::Weighted. |
|
|
Inserts
Definition at line 600 of file ocombobox.h. |
|
|
Sets a pixmap provider, so that items in the combobox can have a pixmap. OPixmapProvider is just an abstract class with the one pure virtual method OPixmapProvider::pixmapFor(). This method is called whenever an item is added to the OHistoryComboBox. Implement it to return your own custom pixmaps, or use the OURLPixmapProvider from libkio, which uses OMimeType::pixmapForURL to resolve icons.
Set
Definition at line 629 of file ocombobox.cpp. References historyItems(), insertItems(), items, and myPixProvider. |
|
|
Called from the popupmenu, calls clearHistory() and emits cleared() Definition at line 664 of file ocombobox.cpp. References cleared(), and clearHistory(). Referenced by addContextMenuItems(). |
|
|
Resets the iterate index to -1 Definition at line 622 of file ocombobox.cpp. References myIterateIndex, and myRotated. |
|
|
Definition at line 744 of file ocombobox.h. References OCompletionBase::compObj(). Referenced by addToHistory(), clearHistory(), removeFromHistory(), and setHistoryItems(). |
|
|
Reimplemented from OComboBox. Definition at line 784 of file ocombobox.h. |
|
|
The current position (index) in the combobox, used for Up and Down Definition at line 769 of file ocombobox.h. Referenced by init(), keyPressEvent(), and slotReset(). |
|
|
Definition at line 781 of file ocombobox.h. Referenced by addToHistory(), init(), insertItems(), pixmapProvider(), setPixmapProvider(), and ~OHistoryCombo(). |
|
|
Indicates that the user at least once rotated Up through the entire list Needed to allow going back after rotation. Definition at line 780 of file ocombobox.h. Referenced by init(), keyPressEvent(), and slotReset(). |
|
|
The text typed before Up or Down was pressed. Definition at line 774 of file ocombobox.h. Referenced by keyPressEvent(). |
|
|
Definition at line 554 of file ocombobox.h. |
1.4.2