1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 1999, 2000 Kurt Granroth <granroth@kde.org>
4 SPDX-FileCopyrightText: 2001, 2002 Ellis Whitehead <ellis@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-only
7*/
8#ifndef KSTANDARDACTION_H
9#define KSTANDARDACTION_H
10
11#include <QAction>
12#include <QList>
13#include <QStringList>
14
15#include <KStandardShortcut>
16#include <KToggleAction>
17#include <kconfigwidgets_export.h>
18#include <khamburgermenu.h>
19#include <krecentfilesaction.h>
20#include <ktogglefullscreenaction.h>
21
22#include <optional>
23#include <type_traits>
24
25class QObject;
26class QWidget;
27class QAction;
28class KToggleFullScreenAction;
29
30/**
31 * Convenience methods to access all standard KDE actions.
32 *
33 * These actions should be used instead of hardcoding menubar and
34 * toolbar items. Using these actions helps your application easily
35 * conform to the <a href="https://develop.kde.org/hig/">KDE Human Interface Guidelines</a>.
36 *
37 * All of the documentation for QAction holds for KStandardAction
38 * also. When in doubt on how things work, check the QAction
39 * documentation first.
40 * Please note that calling any of these methods automatically adds the action
41 * to the actionCollection() of the QObject given by the 'parent' parameter.
42 *
43 * <b>Simple Example:</b>\n
44 *
45 * In general, using standard actions should be a drop in replacement
46 * for regular actions. For example, if you previously had:
47 * @code
48 * QAction *newAct = new QAction(QIcon::fromTheme("document-new"),
49 * i18n("&New"),
50 * this);
51 * newAct->setShortcut(KStandardShortcut::shortcut(KStandardShortcut::New).constFirst());
52 * connect(newAct, &QAction::triggered, this, &ClassFoo::fileNew);
53 * @endcode
54 *
55 * You can replace it with:
56 * @code
57 * QAction *newAct = KStandardAction::openNew(this, &ClassFoo::fileNew, this);
58 * @endcode
59 *
60 * Alternatively you can instantiate the action using the StandardAction enums
61 * provided. This author can't think of a reason why you would want to, but, hey,
62 * if you do, here's how:
63 *
64 * \code
65 * QAction *newAct = KStandardAction::create(KStandardAction::New, this, &ClassFoo::fileNew, this);
66 * \endcode
67 *
68 * <b>Relationship with KActionCollection from KXMLGui</b>\n
69 *
70 * If a KActionCollection is passed as the parent then the action will be
71 * automatically added to that collection:
72 * \code
73 * QAction *cut = KStandardAction::cut(this, &ClassFoo::editCut, actionCollection());
74 * \endcode
75 *
76 * Each action has a unique internal name which can be queried using the
77 * name method. For example KStandardAction::name(KStandardAction::Cut)
78 * would return 'edit_cut'. This name can be used as a unique identifier
79 * for the actions. So if you wanted to add an existing standard action
80 * to an action collection you can do so like this:
81 * \code
82 * QAction *cut = KStandardAction::cut(this, &ClassFoo::editCut, this);
83 * actionCollection()->addAction(KStandardAction::name(KStandardAction::Cut), cut);
84 * \endcode
85 *
86 * You can then get a pointer to the action using
87 * \code
88 * QAction *cutPtr = actionCollection()->action(KStandardAction::name(KStandardAction::Cut));
89 * \endcode
90 *
91 * @author Kurt Granroth <granroth@kde.org>
92 */
93namespace KStandardAction
94{
95/**
96 * The standard menubar and toolbar actions.
97 */
98enum StandardAction {
99 ActionNone,
100 // File Menu
101 New, ///< Create a new document or window.
102 Open, ///< Open an existing file.
103 OpenRecent, ///< Open a recently used document.
104 Save, ///< Save the current document.
105 SaveAs, ///< Save the current document under a different name.
106 Revert, ///< Revert the current document to the last saved version.
107 Close, ///< Close the current document.
108 Print, ///< Print the current document.
109 PrintPreview, ///< Show a print preview of the current document.
110 Mail, ///< Send the current document by mail.
111 Quit, ///< Quit the program.
112 // Edit Menu
113 Undo, ///< Undo the last operation.
114 Redo, ///< Redo the last operation.
115 Cut, ///< Cut selected area and store it in the clipboard.
116 Copy, ///< Copy selected area and store it in the clipboard.
117 Paste, ///< Paste the contents of clipboard at the current mouse or cursor.
118 SelectAll, ///< Select all elements in the current document.
119 Deselect, ///< Deselect any selected elements in the current document.
120 Find, ///< Initiate a 'find' request in the current document.
121 FindNext, ///< Find the next instance of a stored 'find'
122 FindPrev, ///< Find a previous instance of a stored 'find'.
123 Replace, ///< Find and replace matches.
124 // View Menu
125 ActualSize, ///< View the document at its actual size.
126 FitToPage, ///< Fit the document view to the size of the current window.
127 FitToWidth, ///< Fit the document view to the width of the current window.
128 FitToHeight, ///< Fit the document view to the height of the current window.
129 ZoomIn, ///< Zoom in the current document.
130 ZoomOut, ///< Zoom out the current document.
131 Zoom, ///< Select the current zoom level.
132 Redisplay, ///< Redisplay or redraw the document.
133 // Go Menu
134 Up, ///< Move up (web style menu).
135 Back, ///< Move back (web style menu).
136 Forward, ///< Move forward (web style menu).
137 Home, ///< Go to the "Home" position or document.
138 Prior, ///< Scroll up one page.
139 Next, ///< Scroll down one page.
140 Goto, ///< Jump to some specific location in the document.
141 GotoPage, ///< Go to a specific page.
142 GotoLine, ///< Go to a specific line.
143 FirstPage, ///< Jump to the first page.
144 LastPage, ///< Jump to the last page.
145 DocumentBack, ///< Move back (document style menu).
146 DocumentForward, ///< Move forward (document style menu).
147 // Bookmarks Menu
148 AddBookmark, ///< Add the current page to the bookmarks tree.
149 EditBookmarks, ///< Edit the application bookmarks.
150 // Tools Menu
151 Spelling, ///< Pop up the spell checker.
152 // Settings Menu
153 ShowMenubar, ///< Show/Hide the menubar.
154 ShowToolbar, ///< Show/Hide the toolbar.
155 ShowStatusbar, ///< Show/Hide the statusbar.
156 KeyBindings, ///< Display the configure key bindings dialog.
157 Preferences, ///< Display the preferences/options dialog.
158 ConfigureToolbars, ///< Display the toolbar configuration dialog.
159 // Help Menu
160 HelpContents, ///< Display the handbook of the application.
161 WhatsThis, ///< Trigger the What's This cursor.
162 ReportBug, ///< Open up the Report Bug dialog.
163 AboutApp, ///< Display the application's About box.
164 AboutKDE, ///< Display the About KDE dialog.
165 // Other standard actions
166 ConfigureNotifications, ///< Display the notifications configuration dialog.
167 FullScreen, ///< Switch to/from full screen mode.
168 Clear, ///< Clear the content of the focus widget.
169 SwitchApplicationLanguage, ///< Display the Switch Application Language dialog.
170 DeleteFile, ///< Permanently deletes files or folders. @since 5.25
171 RenameFile, ///< Renames files or folders. @since 5.25
172 MoveToTrash, ///< Moves files or folders to the trash. @since 5.25
173 Donate, ///< Open donation page on kde.org. @since 5.26
174 HamburgerMenu ///< Opens a menu that substitutes the menubar. @since 5.81
175};
176
177/**
178 * Creates an action corresponding to one of the
179 * KStandardAction::StandardAction actions, which is connected to the given
180 * object and @p slot, and is owned by @p parent.
181 *
182 * The signal that is connected to @p slot is triggered(bool), except for the case of
183 * OpenRecent standard action, which uses the urlSelected(const QUrl &) signal of
184 * KRecentFilesAction.
185 *
186 * @param id The StandardAction identifier to create a QAction for.
187 * @param recvr The QObject to receive the signal, or @c nullptr if no notification
188 * is needed.
189 * @param slot The slot to connect the signal to (remember to use the SLOT() macro).
190 * @param parent The QObject that should own the created QAction, or @c nullptr if no parent will
191 * own the QAction returned (ensure you delete it manually in this case).
192 */
193KCONFIGWIDGETS_EXPORT QAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent);
194
195/**
196 * @internal
197 */
198KCONFIGWIDGETS_EXPORT QAction *_k_createInternal(StandardAction id, QObject *parent);
199
200/**
201 * This overloads create() to allow using the new connect syntax
202 * @note if you use @c OpenRecent as @p id, you should manually connect to the urlSelected(const QUrl &)
203 * signal of the returned KRecentFilesAction instead or use KStandardAction::openRecent(Receiver *, Func).
204 *
205 * If not explicitly specified, @p connectionType will be AutoConnection for all actions
206 * except for ConfigureToolbars it will be QueuedConnection.
207 *
208 * @see create(StandardAction, const QObject *, const char *, QObject *)
209 * @since 5.23 (The connectionType argument was added in 5.95)
210 */
211#ifdef K_DOXYGEN
212inline QAction *create(StandardAction id, const QObject *recvr, Func slot, QObject *parent, std::optional<Qt::ConnectionType> connectionType = std::nullopt)
213#else
214template<class Receiver, class Func>
215inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, QAction>::type *
216create(StandardAction id, const Receiver *recvr, Func slot, QObject *parent, std::optional<Qt::ConnectionType> connectionType = std::nullopt)
217#endif
218{
219 QAction *action = _k_createInternal(id, parent);
220 // ConfigureToolbars is special because of bug #200815
221 const Qt::ConnectionType defaultConnectionType = (id == ConfigureToolbars) ? Qt::QueuedConnection : Qt::AutoConnection;
222 QObject::connect(action, &QAction::triggered, recvr, slot, connectionType.value_or(u: defaultConnectionType));
223 return action;
224}
225
226/**
227 * This will return the internal name of a given standard action.
228 */
229KCONFIGWIDGETS_EXPORT QString name(StandardAction id);
230
231/**
232 * Returns a list of all standard names. Used by KAccelManager
233 * to give those higher weight.
234 */
235KCONFIGWIDGETS_EXPORT QStringList stdNames();
236
237/**
238 * Returns a list of all actionIds.
239 *
240 * @since 4.2
241 */
242KCONFIGWIDGETS_EXPORT QList<StandardAction> actionIds();
243
244/**
245 * Returns the standardshortcut associated with @a actionId.
246 *
247 * @param id The identifier whose associated shortcut is wanted.
248 *
249 * @since 4.2
250 */
251KCONFIGWIDGETS_EXPORT KStandardShortcut::StandardShortcut shortcutForActionId(StandardAction id);
252
253// clang-format off
254// we have to disable the templated function for const char* as Func, since it is ambiguous otherwise
255// TODO: KF6: unify const char* version and new style by removing std::enable_if
256#ifdef K_DOXYGEN
257#define KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(name, enumValue) \
258 inline QAction *name(const QObject *recvr, Func slot, QObject *parent);
259#else
260#define KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(name, enumValue) \
261 template<class Receiver, class Func> \
262 inline typename std::enable_if<!std::is_convertible<Func, const char*>::value, QAction>::type *name(const Receiver *recvr, Func slot, QObject *parent) \
263 { return create(enumValue, recvr, slot, parent); }
264#endif
265// clang-format on
266
267/**
268 * Create a new document or window.
269 */
270KCONFIGWIDGETS_EXPORT QAction *openNew(const QObject *recvr, const char *slot, QObject *parent);
271
272/**
273 * Create a new document or window.
274 * @since 5.23
275 */
276KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(openNew, New)
277
278/**
279 * Open an existing file.
280 */
281KCONFIGWIDGETS_EXPORT QAction *open(const QObject *recvr, const char *slot, QObject *parent);
282
283/**
284 * Open an existing file.
285 * @since 5.23
286 */
287KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(open, Open)
288
289/**
290 * Open a recently used document. The signature of the slot being called
291 * is of the form slotURLSelected( const QUrl & ).
292 * @param recvr object to receive slot
293 * @param slot The SLOT to invoke when a URL is selected. The slot's
294 * signature is slotURLSelected( const QUrl & ).
295 * @param parent parent widget
296 */
297KCONFIGWIDGETS_EXPORT KRecentFilesAction *openRecent(const QObject *recvr, const char *slot, QObject *parent);
298
299/**
300 * The same as openRecent(const QObject *, const char *, QObject *), but using new-style connect syntax
301 * @see openRecent(const QObject *, const char *, QObject *)
302 * @since 5.23
303 */
304#ifdef K_DOXYGEN
305inline KRecentFilesAction *openRecent(const QObject *recvr, Func slot, QObject *parent)
306#else
307template<class Receiver, class Func>
308inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, KRecentFilesAction>::type *
309openRecent(const Receiver *recvr, Func slot, QObject *parent)
310#endif
311{
312 QAction *action = _k_createInternal(id: OpenRecent, parent);
313 KRecentFilesAction *recentAction = qobject_cast<KRecentFilesAction *>(object: action);
314 Q_ASSERT(recentAction);
315 QObject::connect(recentAction, &KRecentFilesAction::urlSelected, recvr, slot);
316 return recentAction;
317}
318
319/**
320 * Save the current document.
321 */
322KCONFIGWIDGETS_EXPORT QAction *save(const QObject *recvr, const char *slot, QObject *parent);
323
324/**
325 * Save the current document.
326 * @since 5.23
327 */
328KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(save, Save)
329
330/**
331 * Save the current document under a different name.
332 */
333KCONFIGWIDGETS_EXPORT QAction *saveAs(const QObject *recvr, const char *slot, QObject *parent);
334
335/**
336 * Save the current document under a different name.
337 * @since 5.23
338 */
339KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(saveAs, SaveAs)
340
341/**
342 * Revert the current document to the last saved version
343 * (essentially will undo all changes).
344 */
345KCONFIGWIDGETS_EXPORT QAction *revert(const QObject *recvr, const char *slot, QObject *parent);
346
347/**
348 * Revert the current document to the last saved version
349 * (essentially will undo all changes).
350 * @since 5.23
351 */
352KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(revert, Revert)
353
354/**
355 * Close the current document.
356 */
357KCONFIGWIDGETS_EXPORT QAction *close(const QObject *recvr, const char *slot, QObject *parent);
358
359/**
360 * Close the current document.
361 * @since 5.23
362 */
363KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(close, Close)
364
365/**
366 * Print the current document.
367 */
368KCONFIGWIDGETS_EXPORT QAction *print(const QObject *recvr, const char *slot, QObject *parent);
369
370/**
371 * Print the current document.
372 * @since 5.23
373 */
374KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(print, Print)
375
376/**
377 * Show a print preview of the current document.
378 */
379KCONFIGWIDGETS_EXPORT QAction *printPreview(const QObject *recvr, const char *slot, QObject *parent);
380
381/**
382 * Show a print preview of the current document.
383 * @since 5.23
384 */
385KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(printPreview, PrintPreview)
386
387/**
388 * Send the current document by mail.
389 */
390KCONFIGWIDGETS_EXPORT QAction *mail(const QObject *recvr, const char *slot, QObject *parent);
391
392/**
393 * Mail this document.
394 * @since 5.23
395 */
396KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(mail, Mail)
397
398/**
399 * Quit the program.
400 *
401 * Note that you probably want to connect this action to either QWidget::close()
402 * or QApplication::closeAllWindows(), but not QApplication::quit(), so that
403 * KMainWindow::queryClose() is called on any open window (to warn the user
404 * about unsaved changes for example).
405 */
406KCONFIGWIDGETS_EXPORT QAction *quit(const QObject *recvr, const char *slot, QObject *parent);
407
408/**
409 * Quit the program.
410 * @see quit(const QObject *recvr, const char *slot, QObject *parent)
411 * @since 5.23
412 */
413KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(quit, Quit)
414
415/**
416 * Undo the last operation.
417 */
418KCONFIGWIDGETS_EXPORT QAction *undo(const QObject *recvr, const char *slot, QObject *parent);
419
420/**
421 * Undo the last operation.
422 * @since 5.23
423 */
424KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(undo, Undo)
425
426/**
427 * Redo the last operation.
428 */
429KCONFIGWIDGETS_EXPORT QAction *redo(const QObject *recvr, const char *slot, QObject *parent);
430
431/**
432 * Redo the last operation.
433 * @since 5.23
434 */
435KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(redo, Redo)
436
437/**
438 * Cut selected area and store it in the clipboard.
439 * Calls cut() on the widget with the current focus.
440 */
441KCONFIGWIDGETS_EXPORT QAction *cut(QObject *parent);
442
443/**
444 * Copy selected area and store it in the clipboard.
445 * Calls copy() on the widget with the current focus.
446 */
447KCONFIGWIDGETS_EXPORT QAction *copy(QObject *parent);
448
449/**
450 * Paste the contents of clipboard at the current mouse or cursor
451 * Calls paste() on the widget with the current focus.
452 */
453KCONFIGWIDGETS_EXPORT QAction *paste(QObject *parent);
454
455// TODO K3ListView is long gone. Is this still relevant?
456/**
457 * Clear selected area. Calls clear() on the widget with the current focus.
458 * Note that for some widgets, this may not provide the intended behavior. For
459 * example if you make use of the code above and a K3ListView has the focus, clear()
460 * will clear all of the items in the list. If this is not the intended behavior
461 * and you want to make use of this slot, you can subclass K3ListView and reimplement
462 * this slot. For example the following code would implement a K3ListView without this
463 * behavior:
464 *
465 * \code
466 * class MyListView : public K3ListView {
467 * Q_OBJECT
468 * public:
469 * MyListView( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ) : K3ListView( parent, name, f ) {}
470 * virtual ~MyListView() {}
471 * public Q_SLOTS:
472 * virtual void clear() {}
473 * };
474 * \endcode
475 */
476KCONFIGWIDGETS_EXPORT QAction *clear(QObject *parent);
477
478/**
479 * Calls selectAll() on the widget with the current focus.
480 */
481KCONFIGWIDGETS_EXPORT QAction *selectAll(QObject *parent);
482
483/**
484 * Cut selected area and store it in the clipboard.
485 */
486KCONFIGWIDGETS_EXPORT QAction *cut(const QObject *recvr, const char *slot, QObject *parent);
487
488/**
489 * Cut selected area and store it in the clipboard.
490 * @since 5.23
491 */
492KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(cut, Cut)
493
494/**
495 * Copy the selected area into the clipboard.
496 */
497KCONFIGWIDGETS_EXPORT QAction *copy(const QObject *recvr, const char *slot, QObject *parent);
498
499/**
500 * Copy the selected area into the clipboard.
501 * @since 5.23
502 */
503KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(copy, Copy)
504
505/**
506 * Paste the contents of clipboard at the current mouse or cursor
507 * position.
508 */
509KCONFIGWIDGETS_EXPORT QAction *paste(const QObject *recvr, const char *slot, QObject *parent);
510
511/**
512 * Paste the contents of clipboard at the current mouse or cursor
513 * position.
514 * @since 5.23
515 */
516KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(paste, Paste)
517
518/**
519 * Clear the content of the focus widget
520 */
521KCONFIGWIDGETS_EXPORT QAction *clear(const QObject *recvr, const char *slot, QObject *parent);
522
523/**
524 * Clear the content of the focus widget
525 * @since 5.23
526 */
527KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(clear, Clear)
528
529/**
530 * Select all elements in the current document.
531 */
532KCONFIGWIDGETS_EXPORT QAction *selectAll(const QObject *recvr, const char *slot, QObject *parent);
533
534/**
535 * Select all elements in the current document.
536 * @since 5.23
537 */
538KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(selectAll, SelectAll)
539
540/**
541 * Deselect any selected elements in the current document.
542 */
543KCONFIGWIDGETS_EXPORT QAction *deselect(const QObject *recvr, const char *slot, QObject *parent);
544
545/**
546 * Deselect any selected elements in the current document.
547 * @since 5.23
548 */
549KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(deselect, Deselect)
550
551/**
552 * Initiate a 'find' request in the current document.
553 */
554KCONFIGWIDGETS_EXPORT QAction *find(const QObject *recvr, const char *slot, QObject *parent);
555
556/**
557 * Initiate a 'find' request in the current document.
558 * @since 5.23
559 */
560KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(find, Find)
561
562/**
563 * Find the next instance of a stored 'find'.
564 */
565KCONFIGWIDGETS_EXPORT QAction *findNext(const QObject *recvr, const char *slot, QObject *parent);
566
567/**
568 * Find the next instance of a stored 'find'.
569 * @since 5.23
570 */
571KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(findNext, FindNext)
572
573/**
574 * Find a previous instance of a stored 'find'.
575 */
576KCONFIGWIDGETS_EXPORT QAction *findPrev(const QObject *recvr, const char *slot, QObject *parent);
577
578/**
579 * Find a previous instance of a stored 'find'.
580 * @since 5.23
581 */
582KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(findPrev, FindPrev)
583
584/**
585 * Find and replace matches.
586 */
587KCONFIGWIDGETS_EXPORT QAction *replace(const QObject *recvr, const char *slot, QObject *parent);
588
589/**
590 * Find and replace matches.
591 * @since 5.23
592 */
593KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(replace, Replace)
594
595/**
596 * View the document at its actual size.
597 */
598KCONFIGWIDGETS_EXPORT QAction *actualSize(const QObject *recvr, const char *slot, QObject *parent);
599
600/**
601 * View the document at its actual size.
602 * @since 5.23
603 */
604KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(actualSize, ActualSize)
605
606/**
607 * Fit the document view to the size of the current window.
608 */
609KCONFIGWIDGETS_EXPORT QAction *fitToPage(const QObject *recvr, const char *slot, QObject *parent);
610
611/**
612 * Fit the document view to the size of the current window.
613 * @since 5.23
614 */
615KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(fitToPage, FitToPage)
616
617/**
618 * Fit the document view to the width of the current window.
619 */
620KCONFIGWIDGETS_EXPORT QAction *fitToWidth(const QObject *recvr, const char *slot, QObject *parent);
621
622/**
623 * Fit the document view to the width of the current window.
624 * @since 5.23
625 */
626KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(fitToWidth, FitToWidth)
627
628/**
629 * Fit the document view to the height of the current window.
630 */
631KCONFIGWIDGETS_EXPORT QAction *fitToHeight(const QObject *recvr, const char *slot, QObject *parent);
632
633/**
634 * Fit the document view to the height of the current window.
635 * @since 5.23
636 */
637KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(fitToHeight, FitToHeight)
638
639/**
640 * Zoom in the current document view.
641 */
642KCONFIGWIDGETS_EXPORT QAction *zoomIn(const QObject *recvr, const char *slot, QObject *parent);
643
644/**
645 * Zoom in the current document view.
646 * @since 5.23
647 */
648KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(zoomIn, ZoomIn)
649
650/**
651 * Zoom out the current document view.
652 */
653KCONFIGWIDGETS_EXPORT QAction *zoomOut(const QObject *recvr, const char *slot, QObject *parent);
654
655/**
656 * Zoom out the current document view.
657 * @since 5.23
658 */
659KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(zoomOut, ZoomOut)
660
661/**
662 * Select the current zoom level.
663 */
664KCONFIGWIDGETS_EXPORT QAction *zoom(const QObject *recvr, const char *slot, QObject *parent);
665
666/**
667 * Select the current zoom level.
668 * @since 5.23
669 */
670KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(zoom, Zoom)
671
672/**
673 * Redisplay or redraw the document.
674 */
675KCONFIGWIDGETS_EXPORT QAction *redisplay(const QObject *recvr, const char *slot, QObject *parent);
676
677/**
678 * Redisplay or redraw the document.
679 * @since 5.23
680 */
681KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(redisplay, Redisplay)
682
683/**
684 * Move up (web style menu).
685 */
686KCONFIGWIDGETS_EXPORT QAction *up(const QObject *recvr, const char *slot, QObject *parent);
687
688/**
689 * Move up (web style menu).
690 * @since 5.23
691 */
692KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(up, Up)
693
694/**
695 * Move back (web style menu).
696 */
697KCONFIGWIDGETS_EXPORT QAction *back(const QObject *recvr, const char *slot, QObject *parent);
698
699/**
700 * Move back (web style menu).
701 * @since 5.23
702 */
703KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(back, Back)
704
705/**
706 * Move forward (web style menu).
707 */
708KCONFIGWIDGETS_EXPORT QAction *forward(const QObject *recvr, const char *slot, QObject *parent);
709
710/**
711 * Move forward (web style menu).
712 * @since 5.23
713 */
714KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(forward, Forward)
715
716/**
717 * Go to the "Home" position or document.
718 */
719KCONFIGWIDGETS_EXPORT QAction *home(const QObject *recvr, const char *slot, QObject *parent);
720
721/**
722 * Go to the "Home" position or document.
723 * @since 5.23
724 */
725KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(home, Home)
726
727/**
728 * Scroll up one page.
729 */
730KCONFIGWIDGETS_EXPORT QAction *prior(const QObject *recvr, const char *slot, QObject *parent);
731
732/**
733 * Scroll up one page.
734 * @since 5.23
735 */
736KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(prior, Prior)
737
738/**
739 * Scroll down one page.
740 */
741KCONFIGWIDGETS_EXPORT QAction *next(const QObject *recvr, const char *slot, QObject *parent);
742
743/**
744 * Scroll down one page.
745 * @since 5.23
746 */
747KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(next, Next)
748
749/**
750 * Jump to some specific location in the document.
751 */
752KCONFIGWIDGETS_EXPORT QAction *goTo(const QObject *recvr, const char *slot, QObject *parent);
753
754/**
755 * Jump to some specific location in the document.
756 * @since 5.23
757 */
758KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(goTo, Goto)
759
760/**
761 * Go to a specific page.
762 */
763KCONFIGWIDGETS_EXPORT QAction *gotoPage(const QObject *recvr, const char *slot, QObject *parent);
764
765/**
766 * Go to a specific page.
767 * @since 5.23
768 */
769KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(gotoPage, GotoPage)
770
771/**
772 * Go to a specific line.
773 */
774KCONFIGWIDGETS_EXPORT QAction *gotoLine(const QObject *recvr, const char *slot, QObject *parent);
775
776/**
777 * Go to a specific line.
778 * @since 5.23
779 */
780KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(gotoLine, GotoLine)
781
782/**
783 * Jump to the first page.
784 */
785KCONFIGWIDGETS_EXPORT QAction *firstPage(const QObject *recvr, const char *slot, QObject *parent);
786
787/**
788 * Jump to the first page.
789 * @since 5.23
790 */
791KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(firstPage, FirstPage)
792
793/**
794 * Jump to the last page.
795 */
796KCONFIGWIDGETS_EXPORT QAction *lastPage(const QObject *recvr, const char *slot, QObject *parent);
797
798/**
799 * Jump to the last page.
800 * @since 5.23
801 */
802KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(lastPage, LastPage)
803
804/**
805 * Move back (document style menu).
806 */
807KCONFIGWIDGETS_EXPORT QAction *documentBack(const QObject *recvr, const char *slot, QObject *parent);
808
809/**
810 * Move back (document style menu).
811 * @since 5.23
812 */
813KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(documentBack, DocumentBack)
814
815/**
816 * Move forward (document style menu).
817 */
818KCONFIGWIDGETS_EXPORT QAction *documentForward(const QObject *recvr, const char *slot, QObject *parent);
819
820/**
821 * Move forward (document style menu).
822 * @since 5.23
823 */
824KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(documentForward, DocumentForward)
825
826/**
827 * Add the current page to the bookmarks tree.
828 */
829KCONFIGWIDGETS_EXPORT QAction *addBookmark(const QObject *recvr, const char *slot, QObject *parent);
830
831/**
832 * Add the current page to the bookmarks tree.
833 * @since 5.23
834 */
835KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(addBookmark, AddBookmark)
836
837/**
838 * Edit the application bookmarks.
839 */
840KCONFIGWIDGETS_EXPORT QAction *editBookmarks(const QObject *recvr, const char *slot, QObject *parent);
841
842/**
843 * Edit the application bookmarks.
844 * @since 5.23
845 */
846KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(editBookmarks, EditBookmarks)
847
848/**
849 * Pop up the spell checker.
850 */
851KCONFIGWIDGETS_EXPORT QAction *spelling(const QObject *recvr, const char *slot, QObject *parent);
852
853/**
854 * Pop up the spell checker.
855 * @since 5.23
856 */
857KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(spelling, Spelling)
858
859/**
860 * Show/Hide the menubar.
861 */
862KCONFIGWIDGETS_EXPORT KToggleAction *showMenubar(const QObject *recvr, const char *slot, QObject *parent);
863
864/**
865 * The same as showMenubar(const QObject *, const char *, QObject *), but using new-style connect syntax
866 * @see showMenubar(const QObject *, const char *, QObject *)
867 * @since 5.23
868 */
869#ifdef K_DOXYGEN
870inline KToggleAction *showMenubar(const QObject *recvr, Func slot, QObject *parent)
871#else
872template<class Receiver, class Func>
873inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, KToggleAction>::type *
874showMenubar(const Receiver *recvr, Func slot, QObject *parent)
875#endif
876{
877 QAction *ret = create(ShowMenubar, recvr, slot, parent);
878 Q_ASSERT(qobject_cast<KToggleAction *>(ret));
879 return static_cast<KToggleAction *>(ret);
880}
881
882/**
883 * Show/Hide the statusbar.
884 */
885KCONFIGWIDGETS_EXPORT KToggleAction *showStatusbar(const QObject *recvr, const char *slot, QObject *parent);
886
887/**
888 * Show/Hide the statusbar.
889 * @since 5.23
890 */
891#ifdef K_DOXYGEN
892inline KToggleAction *showStatusbar(const QObject *recvr, Func slot, QObject *parent)
893#else
894template<class Receiver, class Func>
895inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, KToggleAction>::type *
896showStatusbar(const Receiver *recvr, Func slot, QObject *parent)
897#endif
898{
899 QAction *ret = create(ShowStatusbar, recvr, slot, parent);
900 Q_ASSERT(qobject_cast<KToggleAction *>(ret));
901 return static_cast<KToggleAction *>(ret);
902}
903
904/**
905 * Switch to/from full screen mode
906 */
907KCONFIGWIDGETS_EXPORT KToggleFullScreenAction *fullScreen(const QObject *recvr, const char *slot, QWidget *window, QObject *parent);
908
909/**
910 * Switch to/from full screen mode
911 * @since 5.23
912 */
913#ifdef K_DOXYGEN
914inline KToggleFullScreenAction *fullScreen(const QObject *recvr, Func slot, QWidget *window, QObject *parent)
915#else
916template<class Receiver, class Func>
917inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, KToggleFullScreenAction>::type *
918fullScreen(const Receiver *recvr, Func slot, QWidget *window, QObject *parent)
919#endif
920{
921 QAction *a = create(FullScreen, recvr, slot, parent);
922 Q_ASSERT(qobject_cast<KToggleFullScreenAction *>(a));
923 KToggleFullScreenAction *ret = static_cast<KToggleFullScreenAction *>(a);
924 ret->setWindow(window);
925 return ret;
926}
927
928/**
929 * Display the configure keyboard shortcuts dialog.
930 *
931 * Note that you might be able to use the pre-built KXMLGUIFactory's function:
932 * @code
933 * KStandardAction::keyBindings(guiFactory(), &KXMLGUIFactory::showConfigureShortcutsDialog, actionCollection());
934 * @endcode
935 *
936 */
937KCONFIGWIDGETS_EXPORT QAction *keyBindings(const QObject *recvr, const char *slot, QObject *parent);
938
939/**
940 * Display the configure key bindings dialog.
941 * @see keyBindings(const QObject *recvr, const char *slot, QObject *parent)
942 * @since 5.23
943 */
944KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(keyBindings, KeyBindings)
945
946/**
947 * Display the preferences/options dialog.
948 */
949KCONFIGWIDGETS_EXPORT QAction *preferences(const QObject *recvr, const char *slot, QObject *parent);
950
951/**
952 * Display the preferences/options dialog.
953 * @since 5.23
954 */
955KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(preferences, Preferences)
956
957/**
958 * Display the toolbar configuration dialog.
959 */
960KCONFIGWIDGETS_EXPORT QAction *configureToolbars(const QObject *recvr, const char *slot, QObject *parent);
961
962/**
963 * Display the toolbar configuration dialog.
964 * @since 5.23
965 */
966KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(configureToolbars, ConfigureToolbars)
967
968/**
969 * Display the notifications configuration dialog.
970 */
971KCONFIGWIDGETS_EXPORT QAction *configureNotifications(const QObject *recvr, const char *slot, QObject *parent);
972
973/**
974 * Display the notifications configuration dialog.
975 * @since 5.23
976 */
977KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(configureNotifications, ConfigureNotifications)
978
979/**
980 * Display the Switch Application Language dialog.
981 * @since 5.67
982 */
983KCONFIGWIDGETS_EXPORT QAction *switchApplicationLanguage(const QObject *recvr, const char *slot, QObject *parent);
984
985/**
986 * Display the Switch Application Language dialog.
987 * @since 5.67
988 */
989KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(switchApplicationLanguage, SwitchApplicationLanguage)
990
991/**
992 * Display the handbook of the application.
993 */
994KCONFIGWIDGETS_EXPORT QAction *helpContents(const QObject *recvr, const char *slot, QObject *parent);
995
996/**
997 * Display the handbook of the application.
998 * @since 5.23
999 */
1000KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(helpContents, HelpContents)
1001
1002/**
1003 * Trigger the What's This cursor.
1004 */
1005KCONFIGWIDGETS_EXPORT QAction *whatsThis(const QObject *recvr, const char *slot, QObject *parent);
1006
1007/**
1008 * Trigger the What's This cursor.
1009 * @since 5.23
1010 */
1011KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(whatsThis, WhatsThis)
1012
1013/**
1014 * Open up the Report Bug dialog.
1015 */
1016KCONFIGWIDGETS_EXPORT QAction *reportBug(const QObject *recvr, const char *slot, QObject *parent);
1017
1018/**
1019 * Open up the Report Bug dialog.
1020 * @since 5.23
1021 */
1022KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(reportBug, ReportBug)
1023
1024/**
1025 * Display the application's About box.
1026 */
1027KCONFIGWIDGETS_EXPORT QAction *aboutApp(const QObject *recvr, const char *slot, QObject *parent);
1028
1029/**
1030 * Display the application's About box.
1031 * @since 5.23
1032 */
1033KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(aboutApp, AboutApp)
1034
1035/**
1036 * Display the About KDE dialog.
1037 */
1038KCONFIGWIDGETS_EXPORT QAction *aboutKDE(const QObject *recvr, const char *slot, QObject *parent);
1039
1040/**
1041 * Display the About KDE dialog.
1042 * @since 5.23
1043 */
1044KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(aboutKDE, AboutKDE)
1045
1046/**
1047 * Permanently deletes files or folders.
1048 * @since 5.25
1049 */
1050KCONFIGWIDGETS_EXPORT QAction *deleteFile(const QObject *recvr, const char *slot, QObject *parent);
1051
1052/**
1053 * Permanently deletes files or folders.
1054 * @since 5.25
1055 */
1056KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(deleteFile, DeleteFile)
1057
1058/**
1059 * Renames files or folders.
1060 * @since 5.25
1061 */
1062KCONFIGWIDGETS_EXPORT QAction *renameFile(const QObject *recvr, const char *slot, QObject *parent);
1063
1064/**
1065 * Renames files or folders.
1066 * @since 5.25
1067 */
1068KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(renameFile, RenameFile)
1069
1070/**
1071 * Moves files or folders to the trash.
1072 * @since 5.25
1073 */
1074KCONFIGWIDGETS_EXPORT QAction *moveToTrash(const QObject *recvr, const char *slot, QObject *parent);
1075
1076/**
1077 * Moves files or folders to the trash.
1078 * @since 5.25
1079 */
1080KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(moveToTrash, MoveToTrash)
1081
1082/**
1083 * Open donation page on kde.org.
1084 * @since 5.26
1085 */
1086KCONFIGWIDGETS_EXPORT QAction *donate(const QObject *recvr, const char *slot, QObject *parent);
1087
1088/**
1089 * Open donation page on kde.org.
1090 * @since 5.26
1091 */
1092KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(donate, Donate)
1093
1094/**
1095 * Opens a menu that substitutes the menubar.
1096 * @since 5.81
1097 */
1098KCONFIGWIDGETS_EXPORT KHamburgerMenu *hamburgerMenu(const QObject *recvr, const char *slot, QObject *parent);
1099
1100/**
1101 * Opens a menu that substitutes the menubar.
1102 * @since 5.81
1103 */
1104KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(hamburgerMenu, HamburgerMenu)
1105
1106}
1107
1108#endif // KSTDACTION_H
1109

source code of kconfigwidgets/src/kstandardaction.h