Namespace KStandardAction |
|
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 KStandardAction also. When in doubt on how things work, check the KAction documention first. Please note that calling any of these methods automatically adds the action to the actionCollection() of the QObject given by the 'parent' parameter. Simple Example:\n 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"), KIcon("document-new"), KStandardShortcut.shortcut(KStandardShortcut.New), this, SLOT(fileNew()), actionCollection()); You could drop that and replace it with:
KAction *newAct = KStandardAction.openNew(this, SLOT(fileNew()), actionCollection()); Non-standard Usages\n 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 name method like so: KStandardAction.name(KStandardAction.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)KStandardAction.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(KStandardAction.name(KStandardAction.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., KStandardAction.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)KStandardAction.action(KStandardAction.New, this, SLOT(fileNew()), actionCollection()); (void)KStandardAction.action(KStandardAction.Cut, this, SLOT(editCut()), actionCollection());
Author Kurt Granroth |
|
Display the application's About box. |
|
Display the About KDE dialog. |
|
View the document at its actual size. |
|
Add the current page to the bookmarks tree. |
|
Move back (web style menu). |
|
Clear selected area. Calls clear() on the widget with the current focus.
Note that for some widgets, this may not provide the intended bahavior. For
example if you make use of the code above and a K3ListView has the focus, clear()
will clear all of the items in the list. If this is not the intened behavior
and you want to make use of this slot, you can subclass K3ListView and reimplement
this slot. For example the following code would implement a K3ListView without this
behavior:
class MyListView : public K3ListView { Q_OBJECT public: MyListView( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ) : K3ListView( parent, name, f ) {} virtual ~MyListView() {} public slots: virtual void clear() {} }; |
|
Clear the content of the focus widget |
|
Close the current document. |
|
The Configure Notifications dialog. |
|
The Customize Toolbar dialog. |
|
Copy selected area and store it in the clipboard. Calls copy() on the widget with the current focus. |
|
Copy the selected area into the clipboard. |
|
Creates an action corresponding to the KStandardAction.StandardAction enum. |
|
Cut selected area and store it in the clipboard. Calls cut() on the widget with the current focus. |
|
Cut selected area and store it in the clipboard. |
|
Deselect any selected elements in the current document. |
|
Move back (document style menu). |
|
Move forward (document style menu). |
|
Edit the application bookmarks. |
|
Initiate a 'find' request in the current document. |
|
Find the next instance of a stored 'find'. |
|
Find a previous instance of a stored 'find'. |
|
Jump to the first page. |
|
Fit the document view to the height of the current window. |
|
Fit the document view to the size of the current window. |
|
Fit the document view to the width of the current window. |
|
Move forward (web style menu). |
|
Switch to/from full screen mode |
|
Go to somewhere in general. |
|
Go to a specific line (dialog). |
|
Go to a specific page (dialog). |
|
Display the help. |
|
Display the help contents. |
|
Go to the "Home" position or document. |
|
Display the configure key bindings dialog.
Note that you might be able to use the pre-built KXMLGUIFactory's function: KStandardAction.keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection()); |
|
Jump to the last page. |
|
Mail this document. |
|
This will return the internal name of a given standard action. |
|
Scroll down one page. |
|
Open an existing file. |
|
Create a new document or window. |
|
Open a recently used document. The signature of the slot being called
is of the form slotURLSelected( const KUrl & ).
recvr - object to receive slot slot - The SLOT to invoke when a URL is selected. The slot's signature is slotURLSelected( const KUrl & ). parent - parent widget |
|
Paste the contents of clipboard at the current mouse or cursor Calls paste() on the widget with the current focus. |
|
Paste the contents of clipboard at the current mouse or cursor position. |
|
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. |
|
Display the preferences/options dialog. |
|
Print the current document. |
|
Show a print preview of the current document. |
|
Scroll up one page. |
|
Quit the program.
Note that you probably want to connect this action to either QWidget.close() or QApplication.closeAllWindows(), but not QApplication.quit(), so that KMainWindow.queryClose() is called on any open window (to warn the user about unsaved changes for example). |
|
Redisplay or redraw the document. |
|
Redo the last operation. |
|
Find and replace matches. |
|
Open up the Report Bug dialog. |
|
Revert the current document to the last saved version (essentially will undo all changes). |
|
Save the current document. |
|
Save the current document under a different name. |
|
Display the save options dialog. |
|
Calls selectAll() on the widget with the current focus. |
|
Select all elements in the current document. |
|
Show/Hide the menubar. |
|
Show/Hide the statusbar. |
|
Pop up the spell checker. |
|
@obsolete. Use name() |
|
Returns a list of all standard names. Used by KAccelManager to give those heigher weight. |
|
Display "Tip of the Day" |
|
Undo the last operation. |
|
Move up (web style menu). |
|
Trigger the What's This cursor. |
|
Popup a zoom dialog. |
|
Zoom in. |
|
Zoom out. |
The standard menubar and toolbar actions.
ActionNone | - | - | ||
New | - | - | ||
Open | - | - | ||
OpenRecent | - | - | ||
Save | - | - | ||
SaveAs | - | - | ||
Revert | - | - | ||
Close | - | - | ||
- | - | |||
PrintPreview | - | - | ||
- | - | |||
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 | - | - | ||
DocumentBack | - | - | ||
DocumentForward | - | - | ||
AddBookmark | - | - | ||
EditBookmarks | - | - | ||
Spelling | - | - | ||
ShowMenubar | - | - | ||
ShowToolbar | - | - | ||
ShowStatusbar | - | - | ||
SaveOptions | - | - | ||
KeyBindings | - | - | ||
Preferences | - | - | ||
ConfigureToolbars | - | - | ||
Help | - | - | ||
HelpContents | - | - | ||
WhatsThis | - | - | ||
ReportBug | - | - | ||
AboutApp | - | - | ||
AboutKDE | - | - | ||
TipofDay | - | - | ||
ConfigureNotifications | - | - | ||
FullScreen | - | - | ||
Clear | - | - | ||
PasteText | - | - | ||
SwitchApplicationLanguage | - | - |