KRecentDocument
#include <KRecentDocument>
Public Types | |
enum | RecentDocumentGroup { Development, Office, Database, Email, Presentation, Spreadsheet, WordProcessor, Graphics, TextEditor, Viewer, Archive, Multimedia, Audio, Video, Photo, Application } |
typedef QList< KRecentDocument::RecentDocumentGroup > | RecentDocumentGroups |
Static Public Member Functions | |
static void | add (const QString &documentStr, bool isUrl=false) |
static void | add (const QUrl &url) |
static void | add (const QUrl &url, const QString &desktopEntryName) |
static void | add (const QUrl &url, const QString &desktopEntryName, KRecentDocument::RecentDocumentGroups groups) |
static void | add (const QUrl &url, KRecentDocument::RecentDocumentGroups groups) |
static void | clear () |
static int | maximumItems () |
static QString | recentDocumentDirectory () |
static QStringList | recentDocuments () |
static QList< QUrl > | recentUrls () |
Detailed Description
Manage the "Recent Document Menu" entries displayed by applications such as Kicker and Konqueror.
These entries are automatically generated .desktop files pointing to the current application and document. You should call the static add() method whenever the user opens or saves a new document if you want it to show up in the menu.
It also stores history following xdg specification. Ref: https://www.freedesktop.org/wiki/Specifications/desktop-bookmark-spec This allows cross-framework file history sharing. I.e Gtk Apps can access files recently opened by KDE Apps.
You don't have to worry about this if you are using QFileDialog to open and save documents, as the KDE implementation (KFileWidget) already calls this class. User defined limits on the maximum number of documents to save, etc... are all automatically handled.
Definition at line 40 of file krecentdocument.h.
Member Function Documentation
◆ add() [1/5]
|
inlinestatic |
Add a new item to the Recent Document menu.
Calls add( url ).
- Parameters
-
documentStr The full path to the document or URL to add. isURL Set to true
ifdocumentStr
is an URL and not a local file path.
- Deprecated:
- Since 5.0, call add(QUrl(str)) if isURL=true, and add(QUrl::fromLocalFile(str)) if isURL=false.
Definition at line 120 of file krecentdocument.h.
◆ add() [2/5]
|
static |
Add a new item to the Recent Document menu.
- Parameters
-
url The url to add.
Definition at line 457 of file krecentdocument.cpp.
◆ add() [3/5]
Add a new item to the Recent Document menu, specifying the application to open it with.
The above add() method uses QCoreApplication::applicationName() for the app name, which isn't always flexible enough. This method is used when an application launches another one to open a document.
- Parameters
-
url The url to add. desktopEntryName The desktopEntryName of the service to use for opening this document.
Definition at line 472 of file krecentdocument.cpp.
◆ add() [4/5]
|
static |
- Since
- 5.93
Definition at line 477 of file krecentdocument.cpp.
◆ add() [5/5]
|
static |
- Since
- 5.93
Definition at line 462 of file krecentdocument.cpp.
◆ clear()
|
static |
Clear the recent document menu of all entries.
Definition at line 554 of file krecentdocument.cpp.
◆ maximumItems()
|
static |
Returns the maximum amount of recent document entries allowed.
Definition at line 564 of file krecentdocument.cpp.
◆ recentDocumentDirectory()
|
static |
Returns the path to the directory where recent document .desktop files are stored.
Definition at line 388 of file krecentdocument.cpp.
◆ recentDocuments()
|
static |
Return a list of absolute paths to recent document .desktop files, sorted by date.
Definition at line 424 of file krecentdocument.cpp.
◆ recentUrls()
Return a list of recent URLs.
This includes all the URLs from recentDocuments() as well as URLs from other applications conforming to the XDG desktop-bookmark-spec (e. g. the GTK file dialog).
- Since
- 5.93
Definition at line 394 of file krecentdocument.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 03:55:00 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.