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 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 bool clearEntriesOldestEntries (int maxEntries)
 
static int maximumItems ()
 
static QList< QUrlrecentUrls ()
 
static void removeApplication (const QString &desktopEntryName)
 
static void removeBookmarksModifiedSince (const QDateTime &since)
 
static void removeFile (const QUrl &url)
 

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.nosp@m.t@kd.nosp@m.e.org
Méven Car meven.nosp@m..car.nosp@m.@kdem.nosp@m.ail..nosp@m.net

Definition at line 41 of file krecentdocument.h.

Member Typedef Documentation

◆ RecentDocumentGroups

QList<KRecentDocument::RecentDocumentGroup> KRecentDocument::RecentDocumentGroups

Definition at line 69 of file krecentdocument.h.

Member Enumeration Documentation

◆ RecentDocumentGroup

enum KRecentDocument::RecentDocumentGroup

Definition at line 50 of file krecentdocument.h.

Member Function Documentation

◆ add() [1/4]

void KRecentDocument::add ( const QUrl & url)
static

Add a new item to the Recent Document menu.

Parameters
urlThe url to add.

Definition at line 485 of file krecentdocument.cpp.

◆ add() [2/4]

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 500 of file krecentdocument.cpp.

◆ add() [3/4]

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

Definition at line 505 of file krecentdocument.cpp.

◆ add() [4/4]

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

Definition at line 490 of file krecentdocument.cpp.

◆ clear()

void KRecentDocument::clear ( )
static

Clear the recent document menu of all entries.

Definition at line 530 of file krecentdocument.cpp.

◆ maximumItems()

int KRecentDocument::maximumItems ( )
static

Returns the maximum amount of recent document entries allowed.

Definition at line 535 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 473 of file krecentdocument.cpp.

◆ removeApplication()

void KRecentDocument::removeApplication ( const QString & desktopEntryName)
static
Since
6.6

Definition at line 597 of file krecentdocument.cpp.

◆ removeBookmarksModifiedSince()

void KRecentDocument::removeBookmarksModifiedSince ( const QDateTime & since)
static

Remove bookmarks whose modification date is after since parameter.

Since
6.6

Definition at line 672 of file krecentdocument.cpp.

◆ removeFile()

void KRecentDocument::removeFile ( const QUrl & url)
static
Since
6.6

Definition at line 541 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-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.