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

KDEUI

Public Slots | Signals | Public Member Functions | Properties | List of all members
KRecentFilesAction Class Reference

#include <krecentfilesaction.h>

Inheritance diagram for KRecentFilesAction:
Inheritance graph
[legend]

Public Slots

virtual void clear ()
 

Signals

void recentListCleared ()
 
void urlSelected (const KUrl &url)
 
- Signals inherited from KSelectAction
void triggered (QAction *action)
 
void triggered (int index)
 
void triggered (const QString &text)
 
- Signals inherited from KAction
void authorized (KAuth::Action *action)
 
void globalShortcutChanged (const QKeySequence &)
 
void triggered (Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
 

Public Member Functions

 KRecentFilesAction (QObject *parent)
 
 KRecentFilesAction (const QString &text, QObject *parent)
 
 KRecentFilesAction (const KIcon &icon, const QString &text, QObject *parent)
 
virtual ~KRecentFilesAction ()
 
void addAction (QAction *action, const KUrl &url, const QString &name)
 
void addUrl (const KUrl &url, const QString &name=QString())
 
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
 
- Public Member Functions inherited from KSelectAction
 KSelectAction (QObject *parent)
 
 KSelectAction (const QString &text, QObject *parent)
 
 KSelectAction (const KIcon &icon, const QString &text, QObject *parent)
 
virtual ~KSelectAction ()
 
QAction * action (int index) const
 
QAction * action (const QString &text, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 
QList< QAction * > actions () const
 
virtual void addAction (QAction *action)
 
KAction * addAction (const QString &text)
 
KAction * addAction (const KIcon &icon, const QString &text)
 
void changeItem (int index, const QString &text)
 
void clear ()
 
int comboWidth () const
 
QAction * currentAction () const
 
int currentItem () const
 
QString currentText () const
 
bool isEditable () const
 
QStringList items () const
 
bool menuAccelsEnabled () const
 
void removeAllActions ()
 
QActionGroup * selectableActionGroup () const
 
void setComboWidth (int width)
 
bool setCurrentAction (QAction *action)
 
bool setCurrentAction (const QString &text, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 
bool setCurrentItem (int index)
 
void setEditable (bool)
 
void setItems (const QStringList &lst)
 
void setMaxComboViewCount (int n)
 
void setMenuAccelsEnabled (bool b)
 
void setToolBarMode (ToolBarMode mode)
 
void setToolButtonPopupMode (QToolButton::ToolButtonPopupMode mode)
 
ToolBarMode toolBarMode () const
 
QToolButton::ToolButtonPopupMode toolButtonPopupMode () const
 
- Public Member Functions inherited from KAction
 KAction (QObject *parent)
 
 KAction (const QString &text, QObject *parent)
 
 KAction (const KIcon &icon, const QString &text, QObject *parent)
 
virtual ~KAction ()
 
KAuth::Action * authAction () const
 
bool event (QEvent *)
 
void forgetGlobalShortcut ()
 
const KShortcut & globalShortcut (ShortcutTypes type=ActiveShortcut) const
 
bool globalShortcutAllowed () const
 
bool isGlobalShortcutEnabled () const
 
bool isShortcutConfigurable () const
 
KRockerGesture rockerGesture (ShortcutTypes type=ActiveShortcut) const
 
void setAuthAction (KAuth::Action *action)
 
void setAuthAction (const QString &actionName)
 
void setGlobalShortcut (const KShortcut &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut), GlobalShortcutLoading loading=Autoloading)
 
void setGlobalShortcutAllowed (bool allowed, GlobalShortcutLoading loading=Autoloading)
 
void setHelpText (const QString &text)
 
void setRockerGesture (const KRockerGesture &gest, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
void setShapeGesture (const KShapeGesture &gest, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
void setShortcut (const KShortcut &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
void setShortcut (const QKeySequence &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
void setShortcutConfigurable (bool configurable)
 
void setShortcuts (const QList< QKeySequence > &shortcuts, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
KShapeGesture shapeGesture (ShortcutTypes type=ActiveShortcut) const
 
KShortcut shortcut (ShortcutTypes types=ActiveShortcut) const
 

Properties

int maxItems
 
- Properties inherited from KSelectAction
int comboWidth
 
QAction currentAction
 
int currentItem
 
QString currentText
 
bool editable
 
QStringList items
 
ToolBarMode toolBarMode
 
QToolButton::ToolButtonPopupMode toolButtonPopupMode
 
- Properties inherited from KAction
KShortcut globalShortcut
 
bool globalShortcutAllowed
 
bool globalShortcutEnabled
 
KShortcut shortcut
 
bool shortcutConfigurable
 

Additional Inherited Members

- Public Types inherited from KSelectAction
enum  ToolBarMode { MenuMode, ComboBoxMode }
 
- Public Types inherited from KAction
enum  GlobalShortcutLoading { Autoloading = 0x0, NoAutoloading = 0x4 }
 
enum  ShortcutType { ActiveShortcut = 0x1, DefaultShortcut = 0x2 }
 
- Protected Slots inherited from KSelectAction
virtual void actionTriggered (QAction *action)
 
void slotToggled (bool)
 
- Protected Member Functions inherited from KSelectAction
 KSelectAction (KSelectActionPrivate &dd, QObject *parent)
 
virtual QWidget * createWidget (QWidget *parent)
 
virtual void deleteWidget (QWidget *widget)
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
- Protected Attributes inherited from KSelectAction
KSelectActionPrivate * d_ptr
 

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
parentThe parent of this action.

Definition at line 47 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.

"&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
textThe text that will be displayed.
parentThe parent of this action.

Definition at line 54 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.

"&Option" creates a shortcut with key O )

This is the other common KAction used. Use it when you do have a corresponding icon.

Parameters
iconThe icon to display.
textThe text that will be displayed.
parentThe parent of this action.

Definition at line 64 of file krecentfilesaction.cpp.

KRecentFilesAction::~KRecentFilesAction ( )
virtual

Destructor.

Definition at line 91 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 200 of file krecentfilesaction.cpp.

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

Add URL to recent files list.

Parameters
urlThe URL of the file
nameThe 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 150 of file krecentfilesaction.cpp.

void KRecentFilesAction::clear ( )
virtualslot

Clears the recent files list.

Note that there is also an action shown to the user for clearing the list.

Definition at line 247 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 265 of file krecentfilesaction.cpp.

int KRecentFilesAction::maxItems ( ) const

Returns the maximum of items in the recent files list.

void KRecentFilesAction::recentListCleared ( )
signal

This signal gets emitted when the user clear list.

So when user store url in specific config file it can saveEntry.

Since
4.3
QAction * KRecentFilesAction::removeAction ( QAction *  action)
virtual

Reimplemented for internal reasons.

Reimplemented from KSelectAction.

Definition at line 220 of file krecentfilesaction.cpp.

void KRecentFilesAction::removeUrl ( const KUrl &  url)

Remove an URL from the recent files list.

Parameters
urlThe URL of the file

Definition at line 231 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 322 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 107 of file krecentfilesaction.cpp.

KUrl::List KRecentFilesAction::urls ( ) const

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

Definition at line 241 of file krecentfilesaction.cpp.

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

This signal gets emitted when the user selects an URL.

Parameters
urlThe URL thats the user selected.

Property Documentation

int KRecentFilesAction::maxItems
readwrite

Definition at line 49 of file krecentfilesaction.h.


The documentation for this class was generated from the following files:
  • krecentfilesaction.h
  • krecentfilesaction.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal