KRecentFilesAction

Search for usage in LXR

KRecentFilesAction Class Reference

#include <KRecentFilesAction>

Inheritance diagram for KRecentFilesAction:

Properties

int maxItems
 
- Properties inherited from QAction
 autoRepeat
 
 checkable
 
 checked
 
 enabled
 
 font
 
 icon
 
 iconText
 
 iconVisibleInMenu
 
 menuRole
 
 priority
 
 shortcut
 
 shortcutContext
 
 shortcutVisibleInContextMenu
 
 statusTip
 
 text
 
 toolTip
 
 visible
 
 whatsThis
 
- Properties inherited from QObject
 objectName
 

Signals

void recentListCleared ()
 
void urlSelected (const QUrl &url)
 
- Signals inherited from KSelectAction
void actionTriggered (QAction *action)
 
void indexTriggered (int index)
 
void textTriggered (const QString &text)
 

Public Slots

virtual void clear ()
 

Public Member Functions

 KRecentFilesAction (const QIcon &icon, const QString &text, QObject *parent)
 
 KRecentFilesAction (const QString &text, QObject *parent)
 
 KRecentFilesAction (QObject *parent)
 
 ~KRecentFilesAction () override
 
void addAction (QAction *action, const QUrl &url, const QString &name, const QMimeType &mimeType=QMimeType())
 
void addUrl (const QUrl &url, const QString &name=QString())
 
void loadEntries (const KConfigGroup &config)
 
int maxItems () const
 
QActionremoveAction (QAction *action) override
 
void removeUrl (const QUrl &url)
 
void saveEntries (const KConfigGroup &config)
 
void setMaxItems (int maxItems)
 
QList< QUrlurls () const
 
- Public Member Functions inherited from KSelectAction
 KSelectAction (const QIcon &icon, const QString &text, QObject *parent)
 
 KSelectAction (const QString &text, QObject *parent)
 
 KSelectAction (QObject *parent)
 
QActionaction (const QString &text, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QActionaction (int index) const
 
QList< QAction * > actions () const
 
QActionaddAction (const QIcon &icon, const QString &text)
 
QActionaddAction (const QString &text)
 
void addAction (QAction *action)
 
void changeItem (int index, const QString &text)
 
void clear ()
 
int comboWidth () const
 
QActioncurrentAction () const
 
int currentItem () const
 
QString currentText () const
 
virtual void insertAction (QAction *before, QAction *action)
 
bool isEditable () const
 
QStringList items () const
 
bool menuAccelsEnabled () const
 
void removeAllActions ()
 
QActionGroupselectableActionGroup () const
 
void setComboWidth (int width)
 
bool setCurrentAction (const QString &text, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
bool setCurrentAction (QAction *action)
 
bool setCurrentItem (int index)
 
void setEditable (bool)
 
void setItems (const QStringList &lst)
 
void setMaxComboViewCount (int n)
 
void setMenuAccelsEnabled (bool b)
 
void setToolBarMode (ToolBarMode mode)
 
void setToolButtonPopupMode (QToolButton::ToolButtonPopupMode mode)
 
ToolBarMode toolBarMode () const
 
QToolButton::ToolButtonPopupMode toolButtonPopupMode () const
 
- Public Member Functions inherited from QWidgetAction
 QWidgetAction (QObject *parent)
 
QWidgetdefaultWidget () const const
 
void releaseWidget (QWidget *widget)
 
QWidgetrequestWidget (QWidget *parent)
 
void setDefaultWidget (QWidget *widget)
 
- Public Member Functions inherited from QAction
 QAction (const QIcon &icon, const QString &text, QObject *parent)
 
 QAction (const QString &text, QObject *parent)
 
 QAction (QObject *parent)
 
QActionGroupactionGroup () const const
 
void activate (ActionEvent event)
 
QList< QGraphicsWidget * > associatedGraphicsWidgets () const const
 
QList< QObject * > associatedObjects () const const
 
QList< QWidget * > associatedWidgets () const const
 
bool autoRepeat () const const
 
void changed ()
 
void checkableChanged (bool checkable)
 
QVariant data () const const
 
void enabledChanged (bool enabled)
 
QFont font () const const
 
void hover ()
 
void hovered ()
 
QIcon icon () const const
 
QString iconText () const const
 
bool isCheckable () const const
 
bool isChecked () const const
 
bool isEnabled () const const
 
bool isIconVisibleInMenu () const const
 
bool isSeparator () const const
 
bool isShortcutVisibleInContextMenu () const const
 
bool isVisible () const const
 
QMenumenu () const const
 
MenuRole menuRole () const const
 
QWidgetparentWidget () const const
 
Priority priority () const const
 
void resetEnabled ()
 
void setActionGroup (QActionGroup *group)
 
void setAutoRepeat (bool)
 
void setCheckable (bool)
 
void setChecked (bool)
 
void setData (const QVariant &data)
 
void setDisabled (bool b)
 
void setEnabled (bool)
 
void setFont (const QFont &font)
 
void setIcon (const QIcon &icon)
 
void setIconText (const QString &text)
 
void setIconVisibleInMenu (bool visible)
 
void setMenu (QMenu *menu)
 
void setMenuRole (MenuRole menuRole)
 
void setPriority (Priority priority)
 
void setSeparator (bool b)
 
void setShortcut (const QKeySequence &shortcut)
 
void setShortcutContext (Qt::ShortcutContext context)
 
void setShortcuts (const QList< QKeySequence > &shortcuts)
 
void setShortcuts (QKeySequence::StandardKey key)
 
void setShortcutVisibleInContextMenu (bool show)
 
void setStatusTip (const QString &statusTip)
 
void setText (const QString &text)
 
void setToolTip (const QString &tip)
 
void setVisible (bool)
 
void setWhatsThis (const QString &what)
 
QKeySequence shortcut () const const
 
Qt::ShortcutContext shortcutContext () const const
 
QList< QKeySequenceshortcuts () const const
 
bool showStatusText (QObject *object)
 
QString statusTip () const const
 
QString text () const const
 
void toggle ()
 
void toggled (bool checked)
 
QString toolTip () const const
 
void trigger ()
 
void triggered (bool checked)
 
void visibleChanged ()
 
QString whatsThis () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Public Types inherited from KSelectAction
enum  ToolBarMode
 
- Public Types inherited from QAction
enum  ActionEvent
 
enum  MenuRole
 
enum  Priority
 
- Public Types inherited from QObject
typedef  QObjectList
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from KSelectAction
 ComboBoxMode
 
 MenuMode
 
- Public Attributes inherited from QAction
 AboutQtRole
 
 AboutRole
 
 ApplicationSpecificRole
 
 HighPriority
 
 Hover
 
 LowPriority
 
 NormalPriority
 
 NoRole
 
 PreferencesRole
 
 QuitRole
 
 TextHeuristicRole
 
 Trigger
 
- Protected Slots inherited from KSelectAction
virtual void slotActionTriggered (QAction *action)
 
void slotToggled (bool)
 
- Protected Member Functions inherited from KSelectAction
KWIDGETSADDONS_NO_EXPORT KSelectAction (KSelectActionPrivate &dd, QObject *parent)
 
QWidgetcreateWidget (QWidget *parent) override
 
void deleteWidget (QWidget *widget) override
 
- Protected Member Functions inherited from QWidgetAction
QList< QWidget * > createdWidgets () const const
 
virtual bool event (QEvent *event) override
 
virtual bool eventFilter (QObject *obj, QEvent *event) override
 
- Protected Member Functions inherited from QAction
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

Recent files action.

This class is an action to handle a recent files submenu. The best way to create the action is to use KStandardAction::openRecent. Then you simply need to call loadEntries on startup, saveEntries on shutdown, addURL when your application loads/saves a file.

Author
Michael Koch

Definition at line 40 of file krecentfilesaction.h.

Property Documentation

◆ maxItems

int KRecentFilesAction::maxItems
readwrite

Definition at line 43 of file krecentfilesaction.h.

Constructor & Destructor Documentation

◆ KRecentFilesAction() [1/3]

KRecentFilesAction::KRecentFilesAction ( QObject * parent)
explicit

Constructs an action with the specified parent.

Parameters
parentThe parent of this action.

Definition at line 41 of file krecentfilesaction.cpp.

◆ KRecentFilesAction() [2/3]

KRecentFilesAction::KRecentFilesAction ( const QString & text,
QObject * parent )

Constructs an action with text; a shortcut may be specified by the ampersand character (e.g.

"&Option" creates a shortcut with key O )

This is the most common KAction used when you do not have a corresponding icon (note that it won't appear in the current version of the "Edit ToolBar" dialog, because an action needs an icon to be plugged in a toolbar...).

Parameters
textThe text that will be displayed.
parentThe parent of this action.

Definition at line 49 of file krecentfilesaction.cpp.

◆ KRecentFilesAction() [3/3]

KRecentFilesAction::KRecentFilesAction ( const QIcon & icon,
const QString & text,
QObject * parent )

Constructs an action with text and an icon; a shortcut may be specified by the ampersand character (e.g.

"&Option" creates a shortcut with key O )

This is the other common KAction used. Use it when you do have a corresponding icon.

Parameters
iconThe icon to display.
textThe text that will be displayed.
parentThe parent of this action.

Definition at line 60 of file krecentfilesaction.cpp.

◆ ~KRecentFilesAction()

KRecentFilesAction::~KRecentFilesAction ( )
overridedefault

Destructor.

Member Function Documentation

◆ addAction()

void KRecentFilesAction::addAction ( QAction * action,
const QUrl & url,
const QString & name,
const QMimeType & mimeType = QMimeType() )

Adds action to the list of URLs, with url and title name.

Do not use addAction(QAction*), as no url will be associated, and consequently urlSelected() will not be emitted when action is selected.

Definition at line 257 of file krecentfilesaction.cpp.

◆ addUrl()

void KRecentFilesAction::addUrl ( const QUrl & url,
const QString & name = QString() )

Add URL to the recent files list.

This will enable this action.

Parameters
urlThe URL of the file
nameThe user visible pretty name that appears before the URL
Note
URLs corresponding to local files in the temporary directory (see QDir::tempPath()) are automatically ignored by this method.

Definition at line 189 of file krecentfilesaction.cpp.

◆ clear

void KRecentFilesAction::clear ( )
virtualslot

Clears the recent files list.

Note that there is also an action shown to the user for clearing the list.

Definition at line 300 of file krecentfilesaction.cpp.

◆ loadEntries()

void KRecentFilesAction::loadEntries ( const KConfigGroup & config)

Loads the recent files entries from a given KConfigGroup object.

You can provide the name of the group used to load the entries. If the groupname is empty, entries are loaded from a group called 'RecentFiles'. Local file entries that do not exist anymore are not restored.

Definition at line 317 of file krecentfilesaction.cpp.

◆ maxItems()

int KRecentFilesAction::maxItems ( ) const

Returns the maximum of items in the recent files list.

Definition at line 131 of file krecentfilesaction.cpp.

◆ recentListCleared

void KRecentFilesAction::recentListCleared ( )
signal

This signal gets emitted when the user clear list.

So when user store url in specific config file it can saveEntry.

Since
4.3

◆ removeAction()

QAction * KRecentFilesAction::removeAction ( QAction * action)
overridevirtual

Reimplemented for internal reasons.

Reimplemented from KSelectAction.

Definition at line 264 of file krecentfilesaction.cpp.

◆ removeUrl()

void KRecentFilesAction::removeUrl ( const QUrl & url)

Remove an URL from the recent files list.

Parameters
urlThe URL of the file

Definition at line 273 of file krecentfilesaction.cpp.

◆ saveEntries()

void KRecentFilesAction::saveEntries ( const KConfigGroup & config)

Saves the current recent files entries to a given KConfigGroup object.

You can provide the name of the group used to load the entries. If the groupname is empty, entries are saved to a group called 'RecentFiles'.

Definition at line 376 of file krecentfilesaction.cpp.

◆ setMaxItems()

void KRecentFilesAction::setMaxItems ( int maxItems)

Sets the maximum of items in the recent files list.

The default for this value is 10 set in the constructor.

If this value is lesser than the number of items currently in the recent files list the last items are deleted until the number of items are equal to the new maximum.

Negative values will be normalized to 0.

Definition at line 137 of file krecentfilesaction.cpp.

◆ urls()

QList< QUrl > KRecentFilesAction::urls ( ) const

Retrieve a list of all URLs in the recent files list.

Definition at line 284 of file krecentfilesaction.cpp.

◆ urlSelected

void KRecentFilesAction::urlSelected ( const QUrl & url)
signal

This signal gets emitted when the user selects an URL.

Parameters
urlThe URL that the user selected.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.