Menu action which provides most recent used items support. More...
#include <QtxMRUAction.h>

Public Types | |
| enum | InsertionMode { MoveFirst , MoveLast , AddFirst , AddLast } |
| Items insertion policy. More... | |
| enum | LinkType { LinkAuto , LinkShort , LinkFull } |
Public Slots | |
| void | clear () |
| Remove all MRU items. More... | |
Signals | |
| void | activated (const QString &) |
| Emitted when user selects any MRU item in the menu. More... | |
Public Member Functions | |
| QtxMRUAction (QObject *=0) | |
| Constructor. More... | |
| QtxMRUAction (const QString &, const QString &, QObject *=0) | |
| Constructor. More... | |
| QtxMRUAction (const QString &, const QIcon &, const QString &, QObject *=0) | |
| Constructor. More... | |
| virtual | ~QtxMRUAction () |
| Destructor. More... | |
| int | insertMode () const |
| Get items insertion policy. More... | |
| void | setInsertMode (const int) |
| Set items insertion policy. More... | |
| int | linkType () const |
| Get the type of link menu name. More... | |
| void | setLinkType (const int) |
| Set the type of link menu name. More... | |
| int | count () const |
| Get number of MRU items. More... | |
| bool | isEmpty () const |
| Check if the MRU items list is empty. More... | |
| int | visibleCount () const |
| Get number of visible MRU items. More... | |
| void | setVisibleCount (const int) |
| Set number of visible MRU items. More... | |
| bool | isClearPossible () const |
| Return visible status of the menu item which clear all MRU items. More... | |
| void | setClearPossible (const bool) |
| Set visible the menu item which clear all MRU items. More... | |
| int | historyCount () const |
| Get number of totally stored MRU items. More... | |
| void | setHistoryCount (const int) |
| Set number of totally stored MRU items. More... | |
| void | remove (const int) |
| Remove MRU item. More... | |
| void | remove (const QString &) |
| Remove MRU item. More... | |
| void | insert (const QString &) |
| Insert MRU item. More... | |
| QString | item (const int) const |
| Get MRU item. More... | |
| int | find (const QString &) const |
| Get MRU item index. More... | |
| bool | contains (const QString &) const |
| Check if MRU item is in the list. More... | |
| virtual void | loadLinks (QtxResourceMgr *, const QString &, const bool=true) |
| Load the MRU items from specified resources section. More... | |
| virtual void | saveLinks (QtxResourceMgr *, const QString &, const bool=true) const |
| Save the MRU items to specified resources section. More... | |
Public Member Functions inherited from QtxAction | |
| QtxAction (QObject *=0, bool=false, const QString &=QString()) | |
| Constructor. More... | |
| QtxAction (QObject *, bool, const QString &, const QString &, const QString &=QString(), const QIcon &=QIcon()) | |
| Constructor. More... | |
| QtxAction (const QString &, const QString &, int, QObject *, bool=false, const QString &=QString()) | |
| Constructor. More... | |
| QtxAction (const QString &, const QString &, const QKeySequence &, QObject *, bool=false, const QString &=QString()) | |
| Constructor. More... | |
| QtxAction (const QString &, const QIcon &, const QString &, int, QObject *, bool=false, const QString &=QString()) | |
| Constructor. More... | |
| QtxAction (const QString &, const QIcon &, const QString &, const QKeySequence &, QObject *, bool=false, const QString &=QString()) | |
| Constructor. More... | |
| virtual | ~QtxAction () |
| Destructor. More... | |
| virtual bool | eventFilter (QObject *, QEvent *) |
| Customize action events. More... | |
| QString | shortcutActionName () const |
| void | setShortcutActionName (const QString &) |
| const QString & | ID () const |
| Unique for the entire application ID. More... | |
| void | setID (const QString &theID) |
Private Slots | |
| void | onActivated () |
| Called when any MRU item is selected by the user. More... | |
| void | onAboutToShow () |
| Prepare MRU items popup menu. More... | |
| void | onCleared (bool) |
Private Member Functions | |
| void | updateMenu () |
| Update MRU items popup menu. More... | |
Private Attributes | |
| QStringList | myLinks |
| most recent used items More... | |
| QAction * | myClear |
| clear item More... | |
| int | myVisCount |
| number of visible MRU items More... | |
| int | myHistoryCount |
| number of stored MRU items More... | |
| int | myLinkType |
| type of link names in menu More... | |
| int | myInsertMode |
| items insertion policy More... | |
Additional Inherited Members | |
Protected Member Functions inherited from QtxAction | |
| virtual void | addedTo (QWidget *) |
| Called when the action is added to the widget. More... | |
| virtual void | removedFrom (QWidget *) |
| Called when the action is removed from the widget. More... | |
| virtual void | customEvent (QEvent *) |
| Process notification events. More... | |
Menu action which provides most recent used items support.
| QtxMRUAction::QtxMRUAction | ( | QObject * | parent = 0 | ) |
| QtxMRUAction::QtxMRUAction | ( | const QString & | text, |
| const QString & | menuText, | ||
| QObject * | parent = 0 |
||
| ) |
Constructor.
| description | (tooltip) text |
| menuText | menu text |
| parent | parent object |
References myClear, onAboutToShow(), and onCleared().
| QtxMRUAction::QtxMRUAction | ( | const QString & | text, |
| const QIcon & | icon, | ||
| const QString & | menuText, | ||
| QObject * | parent = 0 |
||
| ) |
Constructor.
| description | (tooltip) text |
| icon | action icon |
| menuText | menu text |
| parent | parent object |
References myClear, onAboutToShow(), and onCleared().
|
virtual |
Destructor.
|
signal |
Emitted when user selects any MRU item in the menu.
| link | selected MRU item |
|
slot |
Remove all MRU items.
References myLinks.
| bool QtxMRUAction::contains | ( | const QString & | link | ) | const |
Check if MRU item is in the list.
| link | MRU item |
true if specified item is already added to the list References myLinks.
| int QtxMRUAction::count | ( | ) | const |
| int QtxMRUAction::find | ( | const QString & | link | ) | const |
Get MRU item index.
| link | MRU item |
References myLinks.
| int QtxMRUAction::historyCount | ( | ) | const |
Get number of totally stored MRU items.
References myHistoryCount.
| void QtxMRUAction::insert | ( | const QString & | link | ) |
| int QtxMRUAction::insertMode | ( | ) | const |
Get items insertion policy.
References myInsertMode.
| bool QtxMRUAction::isClearPossible | ( | ) | const |
Return visible status of the menu item which clear all MRU items.
References myClear.
| bool QtxMRUAction::isEmpty | ( | ) | const |
| QString QtxMRUAction::item | ( | const int | idx | ) | const |
Get MRU item.
| idx | MRU item index |
References myLinks.
| int QtxMRUAction::linkType | ( | ) | const |
|
virtual |
Load the MRU items from specified resources section.
| resMgr | resources manager |
| section | resources section |
| clear | if true, previous MRU items list is cleared |
References clear(), myLinks, QtxResourceMgr::parameters(), and QtxResourceMgr::stringValue().
|
privateslot |
Prepare MRU items popup menu.
This method is called when the parent menu is shown. Enables or disables sub menu item according to the number of MRU items.
References updateMenu().
|
privateslot |
Called when any MRU item is selected by the user.
Emits signal activated(const QString&) passing selected MRU item as parameter.
References activated(), and myLinks.
|
privateslot |
References clear().
| void QtxMRUAction::remove | ( | const int | idx | ) |
Remove MRU item.
Does nothing if idx is out of range.
| idx | MRU item index |
References myLinks.
| void QtxMRUAction::remove | ( | const QString & | link | ) |
Remove MRU item.
Does nothing if there is no speicified item in the list.
| link | MRU item to be removed |
References myLinks.
|
virtual |
Save the MRU items to specified resources section.
| resMgr | resources manager |
| section | resources section |
| clear | if true, the resources section is first cleared |
References clear(), myHistoryCount, myLinks, QtxResourceMgr::parameters(), QtxResourceMgr::remove(), QtxResourceMgr::setValue(), and QtxResourceMgr::stringValue().
| void QtxMRUAction::setClearPossible | ( | const bool | on | ) |
Set visible the menu item which clear all MRU items.
References myClear.
| void QtxMRUAction::setHistoryCount | ( | const int | num | ) |
Set number of totally stored MRU items.
This option allows setting number of MRU items to be stored in the preferences file.
If num < 0, then number of stored MRU items is not limited.
References myHistoryCount.
| void QtxMRUAction::setInsertMode | ( | const int | mode | ) |
Set items insertion policy.
| mode | insertion policy (QtxMRUAction::InsertionMode) |
References myInsertMode.
| void QtxMRUAction::setLinkType | ( | const int | type | ) |
| void QtxMRUAction::setVisibleCount | ( | const int | num | ) |
Set number of visible MRU items.
This method sets the maximum number of MRU items to be displayed in the popup menu (5 by default).
If num < 1, then all MRU items will be displayed.
| num | visible MRU items number |
References myVisCount.
|
private |
Update MRU items popup menu.
References AddLast, count(), Qtx::file(), insertMode(), isClearPossible(), LinkAuto, LinkFull, LinkShort, linkType(), MoveLast, myClear, myLinks, onActivated(), and visibleCount().
| int QtxMRUAction::visibleCount | ( | ) | const |
Get number of visible MRU items.
References myVisCount.
|
private |
clear item
|
private |
number of stored MRU items
|
private |
items insertion policy
|
private |
most recent used items
|
private |
type of link names in menu
|
private |
number of visible MRU items