namespace KStdAction

Convenience methods to access all standard KDE actions. More...

List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods


Detailed Description

Convenience methods to access all standard KDE actions.

These actions should be used instead of hardcoding menubar and toolbar items. Using these actions helps your application easily conform to the KDE UI Style Guide

All of the documentation for KAction holds for KStdAction also. When in doubt on how things work, check the KAction documention first.

Simple Example:

In general, using standard actions should be a drop in replacement for regular actions. For example, if you previously had:


 KAction *newAct = new KAction(i18n("&New"), QIconSet(BarIcon("filenew")),
                               KStdAccel::key(KStdAccel::New), this,
                               SLOT(fileNew()), actionCollection());

You could drop that and replace it with:


 KAction *newAct = KStdAction::openNew(this, SLOT(fileNew()),
                                       actionCollection());

Non-standard Usages

It is possible to use the standard actions in various non-recommended ways. Say, for instance, you wanted to have a standard action (with the associated correct text and icon and accelerator, etc) but you didn't want it to go in the standard place (this is not recommended, by the way). One way to do this is to simply not use the XML UI framework and plug it into wherever you want. If you do want to use the XML UI framework (good!), then it is still possible.

Basically, the XML building code matches names in the XML code with the internal names of the actions. You can find out the internal names of each of the standard actions by using the stdName action like so: KStdAction::stdName(KStdAction::Cut) would return 'edit_cut'. The XML building code will match 'edit_cut' to the attribute in the global XML file and place your action there.

However, you can change the internal name. In this example, just do something like:


 (void)KStdAction::cut(this, SLOT(editCut()), actionCollection(), "my_cut");

Now, in your local XML resource file (e.g., yourappui.rc), simply put 'my_cut' where you want it to go.

Another non-standard usage concerns getting a pointer to an existing action if, say, you want to enable or disable the action. You could do it the recommended way and just grab a pointer when you instantiate it as in the the 'openNew' example above... or you could do it the hard way:


 KAction *cut = actionCollection()->action(KStdAction::stdName(KStdAction::Cut));

Another non-standard usage concerns instantiating the action in the first place. Usually, you would use the member functions as shown above (e.g., KStdAction::cut(this, SLOT, parent)). You may, however, do this using the enums provided. This author can't think of a reason why you would want to, but, hey, if you do, here's how:


 (void)KStdAction::action(KStdAction::New, this, SLOT(fileNew()), actionCollection());
 (void)KStdAction::action(KStdAction::Cut, this, SLOT(editCut()), actionCollection());

See also: http://developer.kde.org/documentation/standards/kde/style/basics/index.html, .

enum StdAction { ActionNone, New, Open, OpenRecent, Save, SaveAs, Revert, Close, Print, PrintPreview, Mail, Quit, Undo, Redo, Cut, Copy, Paste, SelectAll, Deselect, Find, FindNext, FindPrev, Replace, ActualSize, FitToPage, FitToWidth, FitToHeight, ZoomIn, ZoomOut, Zoom, Redisplay, Up, Back, Forward, Home, Prior, Next, Goto, GotoPage, GotoLine, FirstPage, LastPage, AddBookmark, EditBookmarks, Spelling, ShowMenubar, ShowToolbar, ShowStatusbar, SaveOptions, KeyBindings, Preferences, ConfigureToolbars, Help, HelpContents, WhatsThis, ReportBug, AboutApp, AboutKDE, TipofDay, ConfigureNotifications }

StdAction

The standard menubar and toolbar actions.

KAction*  create ( StdAction id, const char *name, const QObject *recvr, const char *slot, KActionCollection* parent )

create

Creates an action corresponding to the KStdAction::StdAction enum.

inline KAction*  create ( StdAction id, const QObject *recvr, const char *slot, KActionCollection* parent )

create

inline KActionaction (StdAction act_enum, const QObject *recvr, const char *slot, KActionCollection *parent, const char *name = 0L )

action

@obsolete. Creates an action corresponding to the KStdAction::StdAction enum.

const char*  name ( StdAction id )

name

This will return the internal name of a given standard action.

inline const char*  stdName (StdAction act_enum)

stdName

QStringList  stdNames ()

stdNames

Returns a list of all standard names. Used by KAccelManager to give those heigher weight.

KActionopenNew (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

openNew

Create a new document or window.

KActionopen (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

open

Open an existing file.

KRecentFilesActionopenRecent (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

openRecent

Open a recently used document.

Parameters:
slotThe SLOT to invoke when a URL is selected. Its signature is of the form slotURLSelected( const KURL & ).

KActionsave (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

save

Save the current document.

KActionsaveAs (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

saveAs

Save the current document under a different name.

KActionrevert (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

revert

Revert the current document to the last saved version (essentially will undo all changes).

KActionclose (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

close

Close the current document.

KActionprint (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

print

Print the current document.

KActionprintPreview (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

printPreview

Show a print preview of the current document.

KActionmail (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

mail

Mail this document.

KActionquit (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

quit

Quit the program.

KActionundo (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

undo

Undo the last operation.

KActionredo (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

redo

Redo the last operation.

KActioncut (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

cut

Cut selected area and store it in the clipboard.

KActioncopy (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

copy

Copy the selected area into the clipboard.

KActionpaste (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

paste

Paste the contents of clipboard at the current mouse or cursor position.

KActionselectAll (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

selectAll

Select all elements in the current document.

KActiondeselect (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

deselect

Deselect any selected elements in the current document.

KActionfind (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

find

Initiate a 'find' request in the current document.

KActionfindNext (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

findNext

Find the next instance of a stored 'find'.

KActionfindPrev (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

findPrev

Find a previous instance of a stored 'find'.

KActionreplace (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

replace

Find and replace matches.

KActionactualSize (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

actualSize

View the document at its actual size.

KActionfitToPage (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

fitToPage

Fit the document view to the size of the current window.

KActionfitToWidth (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

fitToWidth

Fit the document view to the width of the current window.

KActionfitToHeight (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

fitToHeight

Fit the document view to the height of the current window.

KActionzoomIn (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

zoomIn

Zoom in.

KActionzoomOut (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

zoomOut

Zoom out.

KActionzoom (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

zoom

Popup a zoom dialog.

KActionredisplay (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

redisplay

Redisplay or redraw the document.

KActionup (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

up

Move up (web style menu).

KActionback (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

back

Move back (web style menu).

KActionforward (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

forward

Move forward (web style menu).

KActionhome (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

home

Go to the "Home" position or document.

KActionprior (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

prior

Scroll up one page.

KActionnext (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

next

Scroll down one page.

KActiongoTo (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

goTo

Go to somewhere in general.

KActiongotoPage (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

gotoPage

Go to a specific page (dialog).

KActiongotoLine (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

gotoLine

Go to a specific line (dialog).

KActionfirstPage (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

firstPage

Jump to the first page.

KActionlastPage (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

lastPage

Jump to the last page.

KActionaddBookmark (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

addBookmark

Add the current page to the bookmarks tree.

KActioneditBookmarks (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

editBookmarks

Edit the application bookmarks.

KActionspelling (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

spelling

Pop up the spell checker.

KToggleActionshowMenubar (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

showMenubar

Show/Hide the menubar.

KToggleActionshowToolbar (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

showToolbar

@obsolete. toolbar actions are created automatically now in the Settings menu. Don't use this anymore Show/Hide the primary toolbar.

KToggleToolBarActionshowToolbar (const char* toolBarName, KActionCollection* parent, const char *name = 0 )

showToolbar

@obsolete. toolbar actions are created automatically now in the Settings menu. Don't use this anymore Show/Hide the primary toolbar.

KToggleActionshowStatusbar (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

showStatusbar

Show/Hide the statusbar.

KActionsaveOptions (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

saveOptions

Display the save options dialog.

KActionkeyBindings (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

keyBindings

Display the configure key bindings dialog.

KActionpreferences (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

preferences

Display the preferences/options dialog.

KActionconfigureToolbars (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

configureToolbars

The Customize Toolbar dialog.

KActionconfigureNotifications (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name = 0)

configureNotifications

The Configure Notifications dialo

KActionhelp (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

help

Display the help.

KActionhelpContents (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

helpContents

Display the help contents.

KActionwhatsThis (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

whatsThis

Trigger the What's This cursor.

KActiontipOfDay (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

tipOfDay

Display "Tip of the Day"

KActionreportBug (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

reportBug

Open up the Report Bug dialog.

KActionaboutApp (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

aboutApp

Display the application's About box.

KActionaboutKDE (const QObject *recvr, const char *slot, KActionCollection* parent, const char *name = 0 )

aboutKDE

Display the About KDE dialog.