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 () |
KAction * | create (StdAction id, const char *name, const QObject *recvr, const char *slot, KActionCollection *parent) |
const char * | name (StdAction id) |
KAction * | openNew (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | open (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KRecentFilesAction * | openRecent (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | save (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | saveAs (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | revert (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | print (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | printPreview (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | close (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | mail (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | quit (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | undo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | redo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | cut (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | copy (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | paste (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | pasteText (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | clear (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | selectAll (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | deselect (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | find (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | findNext (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | findPrev (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | replace (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | actualSize (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | fitToPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | fitToWidth (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | fitToHeight (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | zoomIn (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | zoomOut (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | zoom (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | redisplay (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | up (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | back (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | forward (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | home (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | prior (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | next (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | goTo (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | gotoPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | gotoLine (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | firstPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | lastPage (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | addBookmark (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | editBookmarks (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | spelling (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KToggleAction * | showMenubar (const QObject *recvr, const char *slot, KActionCollection *parent, const char *_name) |
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) |
KToggleFullScreenAction * | fullScreen (const QObject *recvr, const char *slot, KActionCollection *parent, QWidget *window, const char *name) |
KAction * | saveOptions (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | keyBindings (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | preferences (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | configureToolbars (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | configureNotifications (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | help (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | helpContents (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | whatsThis (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | tipOfDay (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | reportBug (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | aboutApp (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | aboutKDE (const QObject *recvr, const char *slot, KActionCollection *parent, const char *name) |
KAction * | create (StdAction id, const QObject *recvr, const char *slot, KActionCollection *parent) |
KAction * | action (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
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:
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 120 of file kstdaction.h. |
Function Documentation
|
Returns a list of all standard names. Used by KAccelManager to give those heigher weight.
Definition at line 38 of file kstdaction.cpp. References stdNames(). Referenced by stdNames(). |
|
|
This will return the internal name of a given standard action.
Definition at line 127 of file kstdaction.cpp. |
|
Create a new document or window.
Definition at line 133 of file kstdaction.cpp. References create(). |
|
Open an existing file.
Definition at line 135 of file kstdaction.cpp. References create(). |
|
Open a recently used document. The signature of the slot being called is of the form slotURLSelected( const KURL & ).
Definition at line 137 of file kstdaction.cpp. References create(), and openRecent(). Referenced by openRecent(). |
|
Save the current document.
Definition at line 139 of file kstdaction.cpp. References create(). |
|
Save the current document under a different name.
Definition at line 141 of file kstdaction.cpp. References create(), and saveAs(). Referenced by saveAs(). |
|
Revert the current document to the last saved version (essentially will undo all changes).
Definition at line 143 of file kstdaction.cpp. References create(), and revert(). Referenced by revert(). |
|
Print the current document.
Definition at line 145 of file kstdaction.cpp. References create(). |
|
Show a print preview of the current document.
Definition at line 147 of file kstdaction.cpp. References create(), and printPreview(). Referenced by printPreview(). |
|
Close the current document.
Definition at line 149 of file kstdaction.cpp. References create(). |
|
Mail this document.
Definition at line 151 of file kstdaction.cpp. References create(), and mail(). Referenced by mail(). |
|
Quit the program.
Definition at line 153 of file kstdaction.cpp. References create(). Referenced by KSystemTray::KSystemTray(). |
|
Undo the last operation.
Definition at line 155 of file kstdaction.cpp. References create(). Referenced by KCommandHistory::KCommandHistory(). |
|
Redo the last operation.
Definition at line 157 of file kstdaction.cpp. References create(). Referenced by KCommandHistory::KCommandHistory(). |
|
Cut selected area and store it in the clipboard.
Definition at line 159 of file kstdaction.cpp. References create(). |
|
Copy the selected area into the clipboard.
Definition at line 161 of file kstdaction.cpp. References create(). |
|
Paste the contents of clipboard at the current mouse or cursor position.
Definition at line 163 of file kstdaction.cpp. References create(). |
|
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.
Definition at line 165 of file kstdaction.cpp. References create(), PasteText, and pasteText(). Referenced by pasteText(). |
|
Clear the content of the focus widget
Definition at line 167 of file kstdaction.cpp. References Clear, clear(), and create(). Referenced by clear(). |
|
Select all elements in the current document.
Definition at line 169 of file kstdaction.cpp. References create(). |
|
Deselect any selected elements in the current document.
Definition at line 171 of file kstdaction.cpp. References create(), and deselect(). Referenced by deselect(). |
|
Initiate a 'find' request in the current document.
Definition at line 173 of file kstdaction.cpp. References create(). |
|
Find the next instance of a stored 'find'.
Definition at line 175 of file kstdaction.cpp. References create(). |
|
Find a previous instance of a stored 'find'.
Definition at line 177 of file kstdaction.cpp. References create(). |
|
Find and replace matches.
Definition at line 179 of file kstdaction.cpp. References create(). |
|
View the document at its actual size.
Definition at line 181 of file kstdaction.cpp. References actualSize(), and create(). Referenced by actualSize(). |
|
Fit the document view to the size of the current window.
Definition at line 183 of file kstdaction.cpp. References create(), and fitToPage(). Referenced by fitToPage(). |
|
Fit the document view to the width of the current window.
Definition at line 185 of file kstdaction.cpp. References create(), and fitToWidth(). Referenced by fitToWidth(). |
|
Fit the document view to the height of the current window.
Definition at line 187 of file kstdaction.cpp. References create(), and fitToHeight(). Referenced by fitToHeight(). |
|
Zoom in.
Definition at line 189 of file kstdaction.cpp. References create(). |
|
Zoom out.
Definition at line 191 of file kstdaction.cpp. References create(). |
|
Popup a zoom dialog.
Definition at line 193 of file kstdaction.cpp. References create(), and zoom(). Referenced by zoom(). |
|
Redisplay or redraw the document.
Definition at line 195 of file kstdaction.cpp. References create(), and redisplay(). Referenced by redisplay(). |
|
Move up (web style menu).
Definition at line 197 of file kstdaction.cpp. References create(). |
|
Move back (web style menu).
Definition at line 199 of file kstdaction.cpp. References create(). |
|
Move forward (web style menu).
Definition at line 201 of file kstdaction.cpp. References create(). |
|
Go to the "Home" position or document.
Definition at line 203 of file kstdaction.cpp. References create(). |
|
Scroll up one page.
Definition at line 205 of file kstdaction.cpp. References create(). |
|
Scroll down one page.
Definition at line 207 of file kstdaction.cpp. References create(). |
|
Go to somewhere in general.
Definition at line 209 of file kstdaction.cpp. References create(), and goTo(). Referenced by goTo(). |
|
Go to a specific page (dialog).
Definition at line 211 of file kstdaction.cpp. References create(), and gotoPage(). Referenced by gotoPage(). |
|
Go to a specific line (dialog).
Definition at line 213 of file kstdaction.cpp. References create(). |
|
Jump to the first page.
Definition at line 215 of file kstdaction.cpp. References create(), and firstPage(). Referenced by firstPage(). |
|
Jump to the last page.
Definition at line 217 of file kstdaction.cpp. References create(), and lastPage(). Referenced by lastPage(). |
|
Add the current page to the bookmarks tree.
Definition at line 219 of file kstdaction.cpp. References create(). |
|
Edit the application bookmarks.
Definition at line 221 of file kstdaction.cpp. References create(), and editBookmarks(). Referenced by editBookmarks(). |
|
Pop up the spell checker.
Definition at line 223 of file kstdaction.cpp. References create(), and spelling(). Referenced by spelling(). |
|
Show/Hide the menubar.
Definition at line 226 of file kstdaction.cpp. References KToggleAction::setChecked(), KToggleAction::setCheckedState(), and KAction::setWhatsThis(). |
|
Definition at line 242 of file kstdaction.cpp. References KToggleAction::setChecked(), and showToolbar(). Referenced by showToolbar(). |
|
Definition at line 253 of file kstdaction.cpp. References showToolbar(). |
|
Show/Hide the statusbar.
Definition at line 261 of file kstdaction.cpp. References KToggleAction::setChecked(), KToggleAction::setCheckedState(), KAction::setWhatsThis(), and showStatusbar(). Referenced by KMainWindow::createStandardStatusBarAction(), and showStatusbar(). |
|
Switch to/from full screen mode
Definition at line 278 of file kstdaction.cpp. References create(), FullScreen, and KToggleFullScreenAction::setWindow(). |
|
Display the save options dialog.
Definition at line 287 of file kstdaction.cpp. References create(), and saveOptions(). Referenced by saveOptions(). |
|
Display the configure key bindings dialog. Note that you might be able to use the pre-built KXMLGUIFactory's fuction: KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection()); Definition at line 289 of file kstdaction.cpp. References create(), and keyBindings(). Referenced by keyBindings(), and KMainWindow::setupGUI(). |
|
Display the preferences/options dialog.
Definition at line 291 of file kstdaction.cpp. References create(), and preferences(). Referenced by preferences(). |
|
The Customize Toolbar dialog.
Definition at line 293 of file kstdaction.cpp. References configureToolbars(), and create(). Referenced by configureToolbars(), and KMainWindow::setupGUI(). |
|
The Configure Notifications dialo
Definition at line 295 of file kstdaction.cpp. References configureNotifications(), and create(). Referenced by configureNotifications(). |
|
Display the help.
Definition at line 297 of file kstdaction.cpp. References create(). |
|
Display the help contents.
Definition at line 299 of file kstdaction.cpp. References create(), and helpContents(). Referenced by helpContents(), and KHelpMenu::KHelpMenu(). |
|
Trigger the What's This cursor.
Definition at line 301 of file kstdaction.cpp. References create(). Referenced by KHelpMenu::KHelpMenu(). |
|
Display "Tip of the Day"
Definition at line 303 of file kstdaction.cpp. References create(), TipofDay, and tipOfDay(). Referenced by tipOfDay(). |
|
Open up the Report Bug dialog.
Definition at line 305 of file kstdaction.cpp. References create(), and reportBug(). Referenced by KHelpMenu::KHelpMenu(), and reportBug(). |
|
Display the application's About box.
Definition at line 307 of file kstdaction.cpp. References aboutApp(), and create(). Referenced by aboutApp(), and KHelpMenu::KHelpMenu(). |
|
Display the About KDE dialog.
Definition at line 309 of file kstdaction.cpp. References aboutKDE(), and create(). Referenced by aboutKDE(), and KHelpMenu::KHelpMenu(). |
|
Definition at line 178 of file kstdaction.h. References create(). |
|
Definition at line 189 of file kstdaction.h. References stdName(). Referenced by stdName(). |