# class KRecentFilesAction

###

Module | kdeui
Namespace |
Class | KRecentFilesAction
Inherits | KSelectAction

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

### methods

- KRecentFilesAction (parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QObject |

  Constructs an action with the specified parent.

  parent - The parent of this action.

- KRecentFilesAction (text, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  parent | QObject |

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

  text - The text that will be displayed.

  parent - The parent of this action.

- KRecentFilesAction (icon, text, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  icon | KIcon |
  text | QString |
  parent | QObject |

  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.

  icon - The icon to display.

  text - The text that will be displayed.

  parent - The parent of this action.

- KRecentFilesAction (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QObject |

- addAction (action, url, name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  action | QAction |
  url | KUrl |
  name | QString |

  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.

- addUrl (url, name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |
  name | QString | QString()

  Add URL to recent files list.

  url - The URL of the file

  name - The user visible pretty name that appears before the URL

- clear ( )

  returns Nothing

  Reimplemented for internal reasons.

- loadEntries (config)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  config | KConfigGroup |

  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 load from a group called 'RecentFiles'

- maxItems ( )

  returns int

  Returns the maximum of items in the recent files list.

- removeAction (action)

  returns QAction

  Argument | Type | Default
  --- | --- | ---
  action | QAction |

  Reimplemented for internal reasons.

- removeUrl (url)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |

  Remove an URL from the recent files list.

  url - The URL of the file

- saveEntries (config)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  config | KConfigGroup |

  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'

- setMaxItems (maxItems)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  maxItems | int |

  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.

- urlSelected (url)

  returns Nothing
  SIGNAL ("urlSelected (const KUrl&)")

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |

  This signal gets emitted when the user selects an URL.

  url - The URL thats the user selected.

- urls ( )

  returns KUrl.List

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