KRecentFilesAction Class Reference
from PyKDE4.kdeui import *
Inherits: KSelectAction → KAction → QWidgetAction → QAction → QObject
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.
Signals | |
recentListCleared () | |
urlSelected (KUrl url) | |
Methods | |
__init__ (self, QObject parent) | |
__init__ (self, QString text, QObject parent) | |
__init__ (self, KIcon icon, QString text, QObject parent) | |
addAction (self, QAction action, KUrl url, QString name) | |
addUrl (self, KUrl url, QString name=QString()) | |
clear (self) | |
loadEntries (self, KConfigGroup config) | |
int | maxItems (self) |
QAction | removeAction (self, QAction action) |
removeUrl (self, KUrl url) | |
saveEntries (self, KConfigGroup config) | |
setMaxItems (self, int maxItems) | |
KUrl.List | urls (self) |
Signal Documentation
recentListCleared | ( | ) |
This signal gets emitted when the user clear list. So when user store url in specific config file it can saveEntry.
- Since:
- 4.3
- Signal syntax:
QObject.connect(source, SIGNAL("recentListCleared()"), target_slot)
urlSelected | ( | KUrl | url | |
) |
This signal gets emitted when the user selects an URL.
- Parameters:
-
url The URL thats the user selected.
- Signal syntax:
QObject.connect(source, SIGNAL("urlSelected(const KUrl&)"), target_slot)
Method Documentation
__init__ | ( | self, | ||
QObject | parent | |||
) |
Constructs an action with the specified parent.
- Parameters:
-
parent The parent of this action.
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:
-
text The text that will be displayed. parent The parent of this action.
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:
-
icon The icon to display. text The text that will be displayed. parent The parent of this action.
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.
Add URL to recent files list.
- Parameters:
-
url The URL of the file name The user visible pretty name that appears before the URL
clear | ( | self ) |
Clears the recent files list. Note that there is also an action shown to the user for clearing the list.
loadEntries | ( | self, | ||
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 load from a group called 'RecentFiles'
int maxItems | ( | self ) |
Returns the maximum of items in the recent files list.
removeUrl | ( | self, | ||
KUrl | url | |||
) |
Remove an URL from the recent files list.
- Parameters:
-
url The URL of the file
saveEntries | ( | self, | ||
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'
setMaxItems | ( | self, | ||
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.
KUrl.List urls | ( | self ) |
Retrieve a list of all URLs in the recent files list.