KRecentDocument

Search for usage in LXR

#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< QUrlrecentUrls ()
 

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.

Author
Daniel M. Duley mosfe[email protected][email protected][email protected]e.org
Méven Car meven[email protected].car[email protected]@kdem[email protected]ail.[email protected]net

Definition at line 40 of file krecentdocument.h.

Member Function Documentation

◆ add() [1/5]

static void KRecentDocument::add ( const QString documentStr,
bool  isUrl = false 
)
inlinestatic

Add a new item to the Recent Document menu.

Calls add( url ).

Parameters
documentStrThe full path to the document or URL to add.
isURLSet to true if documentStr 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]

void KRecentDocument::add ( const QUrl url)
static

Add a new item to the Recent Document menu.

Parameters
urlThe url to add.

Definition at line 457 of file krecentdocument.cpp.

◆ add() [3/5]

void KRecentDocument::add ( const QUrl url,
const QString desktopEntryName 
)
static

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
urlThe url to add.
desktopEntryNameThe desktopEntryName of the service to use for opening this document.

Definition at line 472 of file krecentdocument.cpp.

◆ add() [4/5]

void KRecentDocument::add ( const QUrl url,
const QString desktopEntryName,
KRecentDocument::RecentDocumentGroups  groups 
)
static
Since
5.93

Definition at line 477 of file krecentdocument.cpp.

◆ add() [5/5]

void KRecentDocument::add ( const QUrl url,
KRecentDocument::RecentDocumentGroups  groups 
)
static
Since
5.93

Definition at line 462 of file krecentdocument.cpp.

◆ clear()

void KRecentDocument::clear ( )
static

Clear the recent document menu of all entries.

Definition at line 554 of file krecentdocument.cpp.

◆ maximumItems()

int KRecentDocument::maximumItems ( )
static

Returns the maximum amount of recent document entries allowed.

Definition at line 564 of file krecentdocument.cpp.

◆ recentDocumentDirectory()

QString KRecentDocument::recentDocumentDirectory ( )
static

Returns the path to the directory where recent document .desktop files are stored.

Definition at line 388 of file krecentdocument.cpp.

◆ recentDocuments()

QStringList KRecentDocument::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()

QList< QUrl > KRecentDocument::recentUrls ( )
static

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:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Dec 6 2022 03:56:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.