KStdAction Namespace Reference
Convenience methods to access all standard KDE actions. More...
Enumerations | |
enum | StdAction { , TipofDay } |
The standard menubar and toolbar actions. More... | |
Functions | |
QStringList | stdNames () |
Returns a list of all standard names. | |
KAction * | create (StdAction id, const char *name, const QObject *recvr, const char *slot, KActionCollection *parent) |
Creates an action corresponding to the KStdAction::StdAction enum. | |
const char * | name (StdAction id) |
This will return the internal name of a given standard action. | |
KAction * | openNew (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Create a new document or window. | |
KAction * | open (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Open an existing file. | |
KRecentFilesAction * | openRecent (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Open a recently used document. | |
KAction * | save (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Save the current document. | |
KAction * | saveAs (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Save the current document under a different name. | |
KAction * | revert (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Revert the current document to the last saved version (essentially will undo all changes). | |
KAction * | print (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Print the current document. | |
KAction * | printPreview (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Show a print preview of the current document. | |
KAction * | close (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Close the current document. | |
KAction * | mail (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Mail this document. | |
KAction * | quit (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Quit the program. | |
KAction * | undo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Undo the last operation. | |
KAction * | redo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Redo the last operation. | |
KAction * | cut (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Cut selected area and store it in the clipboard. | |
KAction * | copy (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Copy the selected area into the clipboard. | |
KAction * | paste (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Paste the contents of clipboard at the current mouse or cursor position. | |
KAction * | selectAll (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Select all elements in the current document. | |
KAction * | deselect (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Deselect any selected elements in the current document. | |
KAction * | find (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Initiate a 'find' request in the current document. | |
KAction * | findNext (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Find the next instance of a stored 'find'. | |
KAction * | findPrev (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Find a previous instance of a stored 'find'. | |
KAction * | replace (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Find and replace matches. | |
KAction * | actualSize (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
View the document at its actual size. | |
KAction * | fitToPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Fit the document view to the size of the current window. | |
KAction * | fitToWidth (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Fit the document view to the width of the current window. | |
KAction * | fitToHeight (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Fit the document view to the height of the current window. | |
KAction * | zoomIn (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Zoom in. | |
KAction * | zoomOut (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Zoom out. | |
KAction * | zoom (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Popup a zoom dialog. | |
KAction * | redisplay (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Redisplay or redraw the document. | |
KAction * | up (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Move up (web style menu). | |
KAction * | back (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Move back (web style menu). | |
KAction * | forward (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Move forward (web style menu). | |
KAction * | home (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Go to the "Home" position or document. | |
KAction * | prior (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Scroll up one page. | |
KAction * | next (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Scroll down one page. | |
KAction * | goTo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Go to somewhere in general. | |
KAction * | gotoPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Go to a specific page (dialog). | |
KAction * | gotoLine (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Go to a specific line (dialog). | |
KAction * | firstPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Jump to the first page. | |
KAction * | lastPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Jump to the last page. | |
KAction * | addBookmark (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Add the current page to the bookmarks tree. | |
KAction * | editBookmarks (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Edit the application bookmarks. | |
KAction * | spelling (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Pop up the spell checker. | |
KToggleAction * | showMenubar (const QObject *recvr, const char *slot, KActionCollection *parent, const char *_name) |
Show/Hide the menubar. | |
KToggleAction * | showToolbar (const QObject *recvr, const char *slot, KActionCollection *parent, const char *_name) |
KToggleToolBarAction * | showToolbar (const char *toolBarName, KActionCollection *parent, const char *_name) |
KToggleAction * | showStatusbar (const QObject *recvr, const char *slot, KActionCollection *parent, const char *_name) |
Show/Hide the statusbar. | |
KAction * | saveOptions (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Display the save options dialog. | |
KAction * | keyBindings (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Display the configure key bindings dialog. | |
KAction * | preferences (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Display the preferences/options dialog. | |
KAction * | configureToolbars (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
The Customize Toolbar dialog. | |
KAction * | configureNotifications (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
The Configure Notifications dialo
| |
KAction * | help (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Display the help. | |
KAction * | helpContents (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Display the help contents. | |
KAction * | whatsThis (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Trigger the What's This cursor. | |
KAction * | tipOfDay (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Display "Tip of the Day"
| |
KAction * | reportBug (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Open up the Report Bug dialog. | |
KAction * | aboutApp (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Display the application's About box. | |
KAction * | aboutKDE (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
Display the About KDE dialog. | |
KAction * | action (StdAction act_enum, const QObject *recvr, const char *slot, KActionCollection *parent, const char *name=0L) |
const char * | stdName (StdAction act_enum) |
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());
- Author:
- Kurt Granroth <granroth@kde.org>
Enumeration Type Documentation
|
The standard menubar and toolbar actions.
Definition at line 118 of file kstdaction.h. |
Function Documentation
|
Returns a list of all standard names. Used by KAccelManager to give those heigher weight.
Definition at line 128 of file kstdaction.cpp. |
|
|
This will return the internal name of a given standard action.
Definition at line 202 of file kstdaction.cpp. References StdAction. Referenced by aboutApp(), aboutKDE(), actualSize(), addBookmark(), back(), close(), configureNotifications(), configureToolbars(), copy(), create(), cut(), deselect(), editBookmarks(), find(), findNext(), findPrev(), firstPage(), fitToHeight(), fitToPage(), fitToWidth(), forward(), goTo(), gotoLine(), gotoPage(), help(), helpContents(), home(), keyBindings(), lastPage(), mail(), next(), open(), openNew(), openRecent(), paste(), preferences(), print(), printPreview(), prior(), quit(), redisplay(), redo(), replace(), reportBug(), revert(), save(), saveAs(), saveOptions(), selectAll(), showMenubar(), showStatusbar(), showToolbar(), spelling(), stdName(), tipOfDay(), undo(), up(), whatsThis(), zoom(), zoomIn(), and zoomOut(). |
|
Create a new document or window.
Definition at line 208 of file kstdaction.cpp. |
|
Open an existing file.
Definition at line 210 of file kstdaction.cpp. |
|
Open a recently used document.
Definition at line 212 of file kstdaction.cpp. |
|
Save the current document.
Definition at line 214 of file kstdaction.cpp. |
|
Save the current document under a different name.
Definition at line 216 of file kstdaction.cpp. |
|
Revert the current document to the last saved version (essentially will undo all changes).
Definition at line 218 of file kstdaction.cpp. |
|
Print the current document.
Definition at line 220 of file kstdaction.cpp. |
|
Show a print preview of the current document.
Definition at line 222 of file kstdaction.cpp. |
|
Close the current document.
Definition at line 224 of file kstdaction.cpp. |
|
Mail this document.
Definition at line 226 of file kstdaction.cpp. |
|
Quit the program.
Definition at line 228 of file kstdaction.cpp. References create(), and name(). Referenced by KSystemTray::KSystemTray(). |
|
Undo the last operation.
Definition at line 230 of file kstdaction.cpp. References create(), and name(). Referenced by KCommandHistory::KCommandHistory(). |
|
Redo the last operation.
Definition at line 232 of file kstdaction.cpp. References create(), and name(). Referenced by KCommandHistory::KCommandHistory(). |
|
Cut selected area and store it in the clipboard.
Definition at line 234 of file kstdaction.cpp. References create(), and name(). Referenced by create(). |
|
Copy the selected area into the clipboard.
Definition at line 236 of file kstdaction.cpp. |
|
Paste the contents of clipboard at the current mouse or cursor position.
Definition at line 238 of file kstdaction.cpp. |
|
Select all elements in the current document.
Definition at line 240 of file kstdaction.cpp. |
|
Deselect any selected elements in the current document.
Definition at line 242 of file kstdaction.cpp. References create(), and name(). Referenced by KEdit::cleanWhiteSpace(), KEdit::replace(), KEdit::search(), and KEdit::spellcheck_stop(). |
|
Initiate a 'find' request in the current document.
Definition at line 244 of file kstdaction.cpp. |
|
Find the next instance of a stored 'find'.
Definition at line 246 of file kstdaction.cpp. |
|
Find a previous instance of a stored 'find'.
Definition at line 248 of file kstdaction.cpp. |
|
Find and replace matches.
Definition at line 250 of file kstdaction.cpp. |
|
View the document at its actual size.
Definition at line 252 of file kstdaction.cpp. |
|
Fit the document view to the size of the current window.
Definition at line 254 of file kstdaction.cpp. |
|
Fit the document view to the width of the current window.
Definition at line 256 of file kstdaction.cpp. |
|
Fit the document view to the height of the current window.
Definition at line 258 of file kstdaction.cpp. |
|
Zoom in.
Definition at line 260 of file kstdaction.cpp. |
|
Zoom out.
Definition at line 262 of file kstdaction.cpp. |
|
Popup a zoom dialog.
Definition at line 264 of file kstdaction.cpp. |
|
Redisplay or redraw the document.
Definition at line 266 of file kstdaction.cpp. |
|
Move up (web style menu).
Definition at line 268 of file kstdaction.cpp. |
|
Move back (web style menu).
Definition at line 270 of file kstdaction.cpp. |
|
Move forward (web style menu).
Definition at line 272 of file kstdaction.cpp. |
|
Go to the "Home" position or document.
Definition at line 274 of file kstdaction.cpp. |
|
Scroll up one page.
Definition at line 276 of file kstdaction.cpp. |
|
Scroll down one page.
Definition at line 278 of file kstdaction.cpp. |
|
Go to somewhere in general.
Definition at line 280 of file kstdaction.cpp. |
|
Go to a specific page (dialog).
Definition at line 282 of file kstdaction.cpp. |
|
Go to a specific line (dialog).
Definition at line 284 of file kstdaction.cpp. |
|
Jump to the first page.
Definition at line 286 of file kstdaction.cpp. |
|
Jump to the last page.
Definition at line 288 of file kstdaction.cpp. |
|
Add the current page to the bookmarks tree.
Definition at line 290 of file kstdaction.cpp. |
|
Edit the application bookmarks.
Definition at line 292 of file kstdaction.cpp. |
|
Pop up the spell checker.
Definition at line 294 of file kstdaction.cpp. |
|
Show/Hide the menubar.
Definition at line 297 of file kstdaction.cpp. References name(), and KToggleAction::setChecked(). |
|
Definition at line 306 of file kstdaction.cpp. References name(), and KToggleAction::setChecked(). |
|
Definition at line 316 of file kstdaction.cpp. References name(). |
|
Show/Hide the statusbar.
Definition at line 324 of file kstdaction.cpp. References name(), and KToggleAction::setChecked(). |
|
Display the save options dialog.
Definition at line 334 of file kstdaction.cpp. |
|
Display the configure key bindings dialog.
Definition at line 336 of file kstdaction.cpp. |
|
Display the preferences/options dialog.
Definition at line 338 of file kstdaction.cpp. |
|
The Customize Toolbar dialog.
Definition at line 340 of file kstdaction.cpp. |
|
The Configure Notifications dialo
Definition at line 342 of file kstdaction.cpp. |
|
Display the help.
Definition at line 344 of file kstdaction.cpp. |
|
Display the help contents.
Definition at line 346 of file kstdaction.cpp. References create(), and name(). Referenced by KHelpMenu::KHelpMenu(). |
|
Trigger the What's This cursor.
Definition at line 348 of file kstdaction.cpp. References create(), and name(). Referenced by KHelpMenu::KHelpMenu(). |
|
Display "Tip of the Day"
Definition at line 350 of file kstdaction.cpp. |
|
Open up the Report Bug dialog.
Definition at line 352 of file kstdaction.cpp. References create(), and name(). Referenced by KHelpMenu::KHelpMenu(). |
|
Display the application's About box.
Definition at line 354 of file kstdaction.cpp. References create(), and name(). Referenced by KHelpMenu::KHelpMenu(). |
|
Display the About KDE dialog.
Definition at line 356 of file kstdaction.cpp. References create(), and name(). Referenced by KHelpMenu::KHelpMenu(). |
|
Definition at line 172 of file kstdaction.h. |
|
Definition at line 183 of file kstdaction.h. |