kdeui Library API Documentation

KStdAction Namespace Reference

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


Enumerations

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,
  FullScreen, Clear, PasteText
}

Functions

QStringList stdNames ()
KActioncreate (StdAction id, const char *name, const QObject *recvr, const char *slot, KActionCollection *parent)
const char * name (StdAction id)
KActionopenNew (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionopen (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KRecentFilesActionopenRecent (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionsave (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionsaveAs (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionrevert (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionprint (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionprintPreview (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionclose (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionmail (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionquit (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionundo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionredo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActioncut (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActioncopy (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionpaste (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionpasteText (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionclear (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionselectAll (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActiondeselect (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionfind (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionfindNext (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionfindPrev (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionreplace (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionactualSize (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionfitToPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionfitToWidth (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionfitToHeight (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionzoomIn (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionzoomOut (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionzoom (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionredisplay (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionup (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionback (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionforward (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionhome (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionprior (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionnext (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActiongoTo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActiongotoPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActiongotoLine (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionfirstPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionlastPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionaddBookmark (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActioneditBookmarks (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionspelling (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KToggleActionshowMenubar (const QObject *recvr, const char *slot, KActionCollection *parent, const char *_name)
KToggleActionshowToolbar (const QObject *recvr, const char *slot, KActionCollection *parent, const char *_name)
KToggleToolBarActionshowToolbar (const char *toolBarName, KActionCollection *parent, const char *_name)
KToggleActionshowStatusbar (const QObject *recvr, const char *slot, KActionCollection *parent, const char *_name)
KToggleFullScreenActionfullScreen (const QObject *recvr, const char *slot, KActionCollection *parent, QWidget *window, const char *name)
KActionsaveOptions (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionkeyBindings (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionpreferences (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionconfigureToolbars (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionconfigureNotifications (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionhelp (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionhelpContents (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionwhatsThis (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActiontipOfDay (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionreportBug (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionaboutApp (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActionaboutKDE (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name)
KActioncreate (StdAction id, const QObject *recvr, const char *slot, KActionCollection *parent)
KActionaction (StdAction act_enum, const QObject *recvr, const char *slot, KActionCollection *parent, const char *name=0L)
const char * stdName (StdAction act_enum)
const KStdActionInfo * infoPtr (StdAction id)
QStringList internal_stdNames ()

Variables

const KStdActionInfo g_rgActionInfo []


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

See also:
http://developer.kde.org/documentation/standards/kde/style/basics/index.html .
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());

Author:
Kurt Granroth <granroth@kde.org>


Enumeration Type Documentation

enum KStdAction::StdAction
 

The standard menubar and toolbar actions.

Enumeration values:
TipofDay 
Since:
3.1
FullScreen 
Since:
3.2
Clear 
Since:
3.2
PasteText 
Since:
3.2

Definition at line 120 of file kstdaction.h.


Function Documentation

QStringList KStdAction::stdNames  ) 
 

Returns a list of all standard names.

Used by KAccelManager to give those heigher weight.

Since:
3.1

Definition at line 38 of file kstdaction.cpp.

KAction * KStdAction::create StdAction  id,
const char *  name,
const QObject recvr,
const char *  slot,
KActionCollection parent
 

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

Definition at line 43 of file kstdaction.cpp.

References KInstance::aboutData(), QString::fromLatin1(), KGlobal::instance(), kdDebug(), PasteText, KAboutData::programName(), QApplication::reverseLayout(), KToggleFullScreenAction::setChecked(), KToggleAction::setChecked(), and KStdAccel::shortcut().

Referenced by aboutApp(), aboutKDE(), action(), actualSize(), addBookmark(), back(), clear(), close(), configureNotifications(), configureToolbars(), copy(), cut(), deselect(), editBookmarks(), find(), findNext(), findPrev(), firstPage(), fitToHeight(), fitToPage(), fitToWidth(), forward(), fullScreen(), goTo(), gotoLine(), gotoPage(), help(), helpContents(), home(), keyBindings(), lastPage(), mail(), next(), open(), openNew(), openRecent(), paste(), pasteText(), preferences(), print(), printPreview(), prior(), quit(), redisplay(), redo(), replace(), reportBug(), revert(), save(), saveAs(), saveOptions(), selectAll(), spelling(), tipOfDay(), undo(), up(), whatsThis(), zoom(), zoomIn(), and zoomOut().

const char * KStdAction::name StdAction  id  ) 
 

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

Definition at line 127 of file kstdaction.cpp.

Referenced by showMenubar(), showStatusbar(), showToolbar(), and stdName().

KAction * KStdAction::openNew const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Create a new document or window.

Definition at line 133 of file kstdaction.cpp.

References create().

KAction * KStdAction::open const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Open an existing file.

Definition at line 135 of file kstdaction.cpp.

References create().

KRecentFilesAction * KStdAction::openRecent const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Open a recently used document.

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

Definition at line 137 of file kstdaction.cpp.

References create().

KAction * KStdAction::save const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Save the current document.

Definition at line 139 of file kstdaction.cpp.

References create().

KAction * KStdAction::saveAs const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Save the current document under a different name.

Definition at line 141 of file kstdaction.cpp.

References create().

KAction * KStdAction::revert const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

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

Definition at line 143 of file kstdaction.cpp.

References create().

KAction * KStdAction::print const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Print the current document.

Definition at line 145 of file kstdaction.cpp.

References create().

KAction * KStdAction::printPreview const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Show a print preview of the current document.

Definition at line 147 of file kstdaction.cpp.

References create().

KAction * KStdAction::close const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Close the current document.

Definition at line 149 of file kstdaction.cpp.

References create().

KAction * KStdAction::mail const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Mail this document.

Definition at line 151 of file kstdaction.cpp.

References create().

KAction * KStdAction::quit const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Quit the program.

Definition at line 153 of file kstdaction.cpp.

References create().

Referenced by KSystemTray::KSystemTray().

KAction * KStdAction::undo const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Undo the last operation.

Definition at line 155 of file kstdaction.cpp.

References create().

Referenced by KCommandHistory::KCommandHistory().

KAction * KStdAction::redo const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Redo the last operation.

Definition at line 157 of file kstdaction.cpp.

References create().

Referenced by KCommandHistory::KCommandHistory().

KAction * KStdAction::cut const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Cut selected area and store it in the clipboard.

Definition at line 159 of file kstdaction.cpp.

References create().

KAction * KStdAction::copy const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Copy the selected area into the clipboard.

Definition at line 161 of file kstdaction.cpp.

References create().

KAction * KStdAction::paste const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

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

Definition at line 163 of file kstdaction.cpp.

References create().

KAction * KStdAction::pasteText const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

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

Provide a button on the toolbar with the clipboard history menu if Klipper is running.

Since:
3.2

Definition at line 165 of file kstdaction.cpp.

References create(), and PasteText.

KAction * KStdAction::clear const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Clear the content of the focus widget

Since:
3.2.

Definition at line 167 of file kstdaction.cpp.

References Clear, and create().

KAction * KStdAction::selectAll const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Select all elements in the current document.

Definition at line 169 of file kstdaction.cpp.

References create().

KAction * KStdAction::deselect const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Deselect any selected elements in the current document.

Definition at line 171 of file kstdaction.cpp.

References create().

KAction * KStdAction::find const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Initiate a 'find' request in the current document.

Definition at line 173 of file kstdaction.cpp.

References create().

KAction * KStdAction::findNext const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Find the next instance of a stored 'find'.

Definition at line 175 of file kstdaction.cpp.

References create().

KAction * KStdAction::findPrev const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Find a previous instance of a stored 'find'.

Definition at line 177 of file kstdaction.cpp.

References create().

KAction * KStdAction::replace const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Find and replace matches.

Definition at line 179 of file kstdaction.cpp.

References create().

KAction * KStdAction::actualSize const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

View the document at its actual size.

Definition at line 181 of file kstdaction.cpp.

References create().

KAction * KStdAction::fitToPage const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

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

Definition at line 183 of file kstdaction.cpp.

References create().

KAction * KStdAction::fitToWidth const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

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

Definition at line 185 of file kstdaction.cpp.

References create().

KAction * KStdAction::fitToHeight const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

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

Definition at line 187 of file kstdaction.cpp.

References create().

KAction * KStdAction::zoomIn const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Zoom in.

Definition at line 189 of file kstdaction.cpp.

References create().

KAction * KStdAction::zoomOut const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Zoom out.

Definition at line 191 of file kstdaction.cpp.

References create().

KAction * KStdAction::zoom const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Popup a zoom dialog.

Definition at line 193 of file kstdaction.cpp.

References create().

KAction * KStdAction::redisplay const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Redisplay or redraw the document.

Definition at line 195 of file kstdaction.cpp.

References create().

KAction * KStdAction::up const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Move up (web style menu).

Definition at line 197 of file kstdaction.cpp.

References create().

KAction * KStdAction::back const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Move back (web style menu).

Definition at line 199 of file kstdaction.cpp.

References create().

KAction * KStdAction::forward const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Move forward (web style menu).

Definition at line 201 of file kstdaction.cpp.

References create().

KAction * KStdAction::home const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Go to the "Home" position or document.

Definition at line 203 of file kstdaction.cpp.

References create().

KAction * KStdAction::prior const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Scroll up one page.

Definition at line 205 of file kstdaction.cpp.

References create().

KAction * KStdAction::next const QObject recvr,
const char *  slot,
KActionCollection parent,
const char *  name = 0
 

Scroll down one page.

Definition at line 207 of file kstdaction.cpp.

References create().

KAction * KStdAction::goTo