class KStdAction

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

Definition#include <kstdaction.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static 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 static 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 { New=1, Open, OpenRecent, Save, SaveAs, Revert, Close, Print, PrintPreview, Mail, Quit, Undo, Redo, Cut, Copy, Paste, SelectAll, 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, NULL1, NULL2, NULL3, NULL4, NULL5, NULL6, NULL7, NULL8, NULL9, NULL10, NULL11, NULL12, NULL13, NULL14, NULL15, NULL16, NULL17, NULL18, NULL19, NULL20 }

StdAction

The standard menubar and toolbar actions.

 KStdAction ()

KStdAction

Constructor.

 ~KStdAction ()

~KStdAction

Destructor.

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

action

[static]

Retrieve the action corresponding to the KStdAction::StdAction enum.

const char*  stdName (StdAction act_enum)

stdName

[static]

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

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

openNew

[static]

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

open

[static]

Open an existing file.

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

openRecent

[static]

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 = 0, const char *slot = 0, QObject *parent = 0, const char *name = 0L )

save

[static]

Save the current document.

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

saveAs

[static]

Save the current document under a different name.

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

revert

[static]

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

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

close

[static]

Close the current document.

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

print

[static]

Print the current document.

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

printPreview

[static]

Show a print preview of the current document.

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

mail

[static]

Mail this document.

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

quit

[static]

Quit the program.

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

undo

[static]

Undo the last operation.

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

redo

[static]

Redo the last operation.

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

cut

[static]

Cut selected area and store it in the clipboard.

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

copy

[static]

Copy the selected area into the clipboard.

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

paste

[static]

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

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

selectAll

[static]

Select all elements in the current document.

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

find

[static]

Initiate a 'find' request in the current document.

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

findNext

[static]

Find the next instance of a stored 'find'.

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

findPrev

[static]

Find a previous instance of a stored 'find'.

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

replace

[static]

Find and replace matches.

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

actualSize

[static]

View the document at its actual size.

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

fitToPage

[static]

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

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

fitToWidth

[static]

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

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

fitToHeight

[static]

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

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

zoomIn

[static]

Zoom in.

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

zoomOut

[static]

Zoom out.

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

zoom

[static]

Popup a zoom dialog.

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

redisplay

[static]

Redisplay or redraw the document.

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

up

[static]

Move up (web style menu).

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

back

[static]

Move back (web style menu).

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

forward

[static]

Move forward (web style menu).

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

home

[static]

Go to the "Home" position or document.

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

prior

[static]

Scroll up one page.

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

next

[static]

Scroll down one page.

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

goTo

[static]

Go to somewhere in general.

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

gotoPage

[static]

Go to a specific page (dialog).

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

gotoLine

[static]

Go to a specific line (dialog).

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

firstPage

[static]

Jump to the first page.

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

lastPage

[static]

Jump to the last page.

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

addBookmark

[static]

Add the current page to the bookmarks tree.

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

editBookmarks

[static]

Edit the application bookmarks.

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

spelling

[static]

Pop up the spell checker.

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

showMenubar

[static]

Show/Hide the menubar.

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

showToolbar

[static]

Show/Hide the primary toolbar.

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

showStatusbar

[static]

Show/Hide the statusbar.

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

saveOptions

[static]

Display the save options dialog.

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

keyBindings

[static]

Display the configure key bindings dialog.

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

preferences

[static]

Display the preferences/options dialog.

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

configureToolbars

[static]

The Customize Toolbar dialog.

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

help

[static]

Display the help.

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

helpContents

[static]

Display the help contents.

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

whatsThis

[static]

Trigger the What's This cursor.

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

reportBug

[static]

Open up the Report Bug dialog.

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

aboutApp

[static]

Display the application's About box.

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

aboutKDE

[static]

Display the About KDE dialog.