• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

KRecentFilesAction Class Reference

Recent files action. More...

#include <krecentfilesaction.h>

Inheritance diagram for KRecentFilesAction:

Inheritance graph
[legend]

List of all members.


Signals

void urlSelected (const KUrl &url)

Public Member Functions

void addAction (QAction *action, const KUrl &url, const QString &name)
void addUrl (const KUrl &url, const QString &name=QString())
virtual void clear ()
 KRecentFilesAction (const KIcon &icon, const QString &text, QObject *parent)
 KRecentFilesAction (const QString &text, QObject *parent)
 KRecentFilesAction (QObject *parent)
void loadEntries (const KConfigGroup &config)
int maxItems () const
virtual QAction * removeAction (QAction *action)
void removeUrl (const KUrl &url)
void saveEntries (const KConfigGroup &config)
void setMaxItems (int maxItems)
KUrl::List urls () const
virtual ~KRecentFilesAction ()

Properties

int maxItems

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.

Author:
Michael Koch

Definition at line 46 of file krecentfilesaction.h.


Constructor & Destructor Documentation

KRecentFilesAction::KRecentFilesAction ( QObject *  parent  )  [explicit]

Constructs an action with the specified parent.

Parameters:
parent The parent of this action.

Definition at line 46 of file krecentfilesaction.cpp.

KRecentFilesAction::KRecentFilesAction ( const QString &  text,
QObject *  parent 
)

Constructs an action with text; a shortcut may be specified by the ampersand character (e.g.

"&amp;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.

Definition at line 53 of file krecentfilesaction.cpp.

KRecentFilesAction::KRecentFilesAction ( const KIcon &  icon,
const QString &  text,
QObject *  parent 
)

Constructs an action with text and an icon; a shortcut may be specified by the ampersand character (e.g.

"&amp;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.

Definition at line 63 of file krecentfilesaction.cpp.

KRecentFilesAction::~KRecentFilesAction (  )  [virtual]

Destructor.

Definition at line 86 of file krecentfilesaction.cpp.


Member Function Documentation

void KRecentFilesAction::addAction ( QAction *  action,
const KUrl &  url,
const QString &  name 
)

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.

Definition at line 155 of file krecentfilesaction.cpp.

void KRecentFilesAction::addUrl ( const KUrl &  url,
const QString &  name = QString() 
)

Add URL to recent files list.

Parameters:
url The URL of the file
name The user visible pretty name that appears before the URL

Create a deep copy here, because if _url is the parameter from urlSelected() signal, we will delete it in the removeAction() call below. but access it again in the addAction call... => crash

Definition at line 113 of file krecentfilesaction.cpp.

void KRecentFilesAction::clear (  )  [virtual]

Reimplemented for internal reasons.

Reimplemented from KSelectAction.

Definition at line 202 of file krecentfilesaction.cpp.

void KRecentFilesAction::loadEntries ( const 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'

Definition at line 214 of file krecentfilesaction.cpp.

int KRecentFilesAction::maxItems (  )  const

Returns the maximum of items in the recent files list.

QAction * KRecentFilesAction::removeAction ( QAction *  action  )  [virtual]

Reimplemented for internal reasons.

Reimplemented from KSelectAction.

Definition at line 175 of file krecentfilesaction.cpp.

void KRecentFilesAction::removeUrl ( const KUrl &  url  ) 

Remove an URL from the recent files list.

Parameters:
url The URL of the file

Definition at line 186 of file krecentfilesaction.cpp.

void KRecentFilesAction::saveEntries ( const 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'

Definition at line 268 of file krecentfilesaction.cpp.

void KRecentFilesAction::setMaxItems ( 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.

Definition at line 102 of file krecentfilesaction.cpp.

KUrl::List KRecentFilesAction::urls (  )  const

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

Definition at line 196 of file krecentfilesaction.cpp.

void KRecentFilesAction::urlSelected ( const KUrl &  url  )  [signal]

This signal gets emitted when the user selects an URL.

Parameters:
url The URL thats the user selected.


Property Documentation

int KRecentFilesAction::maxItems [read, write]

Definition at line 49 of file krecentfilesaction.h.


The documentation for this class was generated from the following files:
  • krecentfilesaction.h
  • krecentfilesaction.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal