File indexing completed on 2024-05-05 07:54:26
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 1999, 2000 Kurt Granroth <granroth@kde.org> 0004 SPDX-FileCopyrightText: 2001, 2002 Ellis Whitehead <ellis@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-only 0007 */ 0008 #ifndef KSTANDARDACTION_H 0009 #define KSTANDARDACTION_H 0010 0011 #include <QAction> 0012 #include <QList> 0013 #include <QStringList> 0014 0015 #include <KStandardShortcut> 0016 #include <KToggleAction> 0017 #include <kconfigwidgets_export.h> 0018 #include <khamburgermenu.h> 0019 #include <krecentfilesaction.h> 0020 #include <ktogglefullscreenaction.h> 0021 0022 #include <optional> 0023 #include <type_traits> 0024 0025 class QObject; 0026 class QWidget; 0027 class QAction; 0028 class KToggleAction; 0029 class KToggleFullScreenAction; 0030 0031 /** 0032 * Convenience methods to access all standard KDE actions. 0033 * 0034 * These actions should be used instead of hardcoding menubar and 0035 * toolbar items. Using these actions helps your application easily 0036 * conform to the <a href="https://develop.kde.org/hig/">KDE Human Interface Guidelines</a>. 0037 * 0038 * All of the documentation for QAction holds for KStandardAction 0039 * also. When in doubt on how things work, check the QAction 0040 * documentation first. 0041 * Please note that calling any of these methods automatically adds the action 0042 * to the actionCollection() of the QObject given by the 'parent' parameter. 0043 * 0044 * <b>Simple Example:</b>\n 0045 * 0046 * In general, using standard actions should be a drop in replacement 0047 * for regular actions. For example, if you previously had: 0048 * @code 0049 * QAction *newAct = new QAction(i18n("&New"), 0050 * QIcon::fromTheme("document-new"), 0051 * KStandardShortcut::shortcut(KStandardShortcut::New), 0052 * this, 0053 * &ClassFoo::fileNew, 0054 * actionCollection()); 0055 * @endcode 0056 * 0057 * You can replace it with: 0058 * @code 0059 * QAction *newAct = KStandardAction::openNew(this, &ClassFoo::fileNew, actionCollection()); 0060 * @endcode 0061 * 0062 * <b>Non-standard Usages</b>\n 0063 * 0064 * It is possible to use the standard actions in various 0065 * non-recommended ways. Say, for instance, you wanted to have a 0066 * standard action (with the associated correct text and icon and 0067 * accelerator, etc) but you didn't want it to go in the standard 0068 * place (this is not recommended, by the way). One way to do this is 0069 * to simply not use the XML UI framework and plug it into wherever 0070 * you want. If you do want to use the XML UI framework (good!), then 0071 * it is still possible. 0072 * 0073 * Basically, the XML building code matches names in the XML code with 0074 * the internal names of the actions. You can find out the internal 0075 * names of each of the standard actions by using the name 0076 * method like so: KStandardAction::name(KStandardAction::Cut) would return 0077 * 'edit_cut'. The XML building code will match 'edit_cut' to the 0078 * attribute in the global XML file and place your action there. 0079 * 0080 * However, you can change the internal name. In this example, just 0081 * do something like: 0082 * 0083 * \code 0084 * (void)KStandardAction::cut(this, SLOT(editCut()), actionCollection(), "my_cut"); 0085 * \endcode 0086 * 0087 * Now, in your local XML resource file (e.g., yourappui.rc), simply 0088 * put 'my_cut' where you want it to go. 0089 * 0090 * Another non-standard usage concerns getting a pointer to an 0091 * existing action if, say, you want to enable or disable the action. 0092 * You could do it the recommended way and just grab a pointer when 0093 * you instantiate it as in the 'openNew' example above... or you 0094 * could do it the hard way: 0095 * 0096 * \code 0097 * QAction *cut = actionCollection()->action(KStandardAction::name(KStandardAction::Cut)); 0098 * \endcode 0099 * 0100 * Another non-standard usage concerns instantiating the action in the 0101 * first place. Usually, you would use the member functions as 0102 * shown above (e.g., KStandardAction::cut(this, SLOT, parent)). You 0103 * may, however, do this using the enums provided. This author can't 0104 * think of a reason why you would want to, but, hey, if you do, 0105 * here's how: 0106 * 0107 * \code 0108 * (void)KStandardAction::action(KStandardAction::New, this, SLOT(fileNew()), actionCollection()); 0109 * (void)KStandardAction::action(KStandardAction::Cut, this, SLOT(editCut()), actionCollection()); 0110 * \endcode 0111 * 0112 * @author Kurt Granroth <granroth@kde.org> 0113 */ 0114 namespace KStandardAction 0115 { 0116 /** 0117 * The standard menubar and toolbar actions. 0118 */ 0119 enum StandardAction { 0120 ActionNone, 0121 // File Menu 0122 New, ///< Create a new document or window. 0123 Open, ///< Open an existing file. 0124 OpenRecent, ///< Open a recently used document. 0125 Save, ///< Save the current document. 0126 SaveAs, ///< Save the current document under a different name. 0127 Revert, ///< Revert the current document to the last saved version. 0128 Close, ///< Close the current document. 0129 Print, ///< Print the current document. 0130 PrintPreview, ///< Show a print preview of the current document. 0131 Mail, ///< Send the current document by mail. 0132 Quit, ///< Quit the program. 0133 // Edit Menu 0134 Undo, ///< Undo the last operation. 0135 Redo, ///< Redo the last operation. 0136 Cut, ///< Cut selected area and store it in the clipboard. 0137 Copy, ///< Copy selected area and store it in the clipboard. 0138 Paste, ///< Paste the contents of clipboard at the current mouse or cursor. 0139 SelectAll, ///< Select all elements in the current document. 0140 Deselect, ///< Deselect any selected elements in the current document. 0141 Find, ///< Initiate a 'find' request in the current document. 0142 FindNext, ///< Find the next instance of a stored 'find' 0143 FindPrev, ///< Find a previous instance of a stored 'find'. 0144 Replace, ///< Find and replace matches. 0145 // View Menu 0146 ActualSize, ///< View the document at its actual size. 0147 FitToPage, ///< Fit the document view to the size of the current window. 0148 FitToWidth, ///< Fit the document view to the width of the current window. 0149 FitToHeight, ///< Fit the document view to the height of the current window. 0150 ZoomIn, ///< Zoom in the current document. 0151 ZoomOut, ///< Zoom out the current document. 0152 Zoom, ///< Select the current zoom level. 0153 Redisplay, ///< Redisplay or redraw the document. 0154 // Go Menu 0155 Up, ///< Move up (web style menu). 0156 Back, ///< Move back (web style menu). 0157 Forward, ///< Move forward (web style menu). 0158 Home, ///< Go to the "Home" position or document. 0159 Prior, ///< Scroll up one page. 0160 Next, ///< Scroll down one page. 0161 Goto, ///< Jump to some specific location in the document. 0162 GotoPage, ///< Go to a specific page. 0163 GotoLine, ///< Go to a specific line. 0164 FirstPage, ///< Jump to the first page. 0165 LastPage, ///< Jump to the last page. 0166 DocumentBack, ///< Move back (document style menu). 0167 DocumentForward, ///< Move forward (document style menu). 0168 // Bookmarks Menu 0169 AddBookmark, ///< Add the current page to the bookmarks tree. 0170 EditBookmarks, ///< Edit the application bookmarks. 0171 // Tools Menu 0172 Spelling, ///< Pop up the spell checker. 0173 // Settings Menu 0174 ShowMenubar, ///< Show/Hide the menubar. 0175 ShowToolbar, ///< Show/Hide the toolbar. 0176 ShowStatusbar, ///< Show/Hide the statusbar. 0177 KeyBindings, ///< Display the configure key bindings dialog. 0178 Preferences, ///< Display the preferences/options dialog. 0179 ConfigureToolbars, ///< Display the toolbar configuration dialog. 0180 // Help Menu 0181 HelpContents, ///< Display the handbook of the application. 0182 WhatsThis, ///< Trigger the What's This cursor. 0183 ReportBug, ///< Open up the Report Bug dialog. 0184 AboutApp, ///< Display the application's About box. 0185 AboutKDE, ///< Display the About KDE dialog. 0186 // Other standard actions 0187 ConfigureNotifications, ///< Display the notifications configuration dialog. 0188 FullScreen, ///< Switch to/from full screen mode. 0189 Clear, ///< Clear the content of the focus widget. 0190 SwitchApplicationLanguage, ///< Display the Switch Application Language dialog. 0191 DeleteFile, ///< Permanently deletes files or folders. @since 5.25 0192 RenameFile, ///< Renames files or folders. @since 5.25 0193 MoveToTrash, ///< Moves files or folders to the trash. @since 5.25 0194 Donate, ///< Open donation page on kde.org. @since 5.26 0195 HamburgerMenu ///< Opens a menu that substitutes the menubar. @since 5.81 0196 }; 0197 0198 /** 0199 * Creates an action corresponding to one of the 0200 * KStandardAction::StandardAction actions, which is connected to the given 0201 * object and @p slot, and is owned by @p parent. 0202 * 0203 * The signal that is connected to @p slot is triggered(bool), except for the case of 0204 * OpenRecent standard action, which uses the urlSelected(const QUrl &) signal of 0205 * KRecentFilesAction. 0206 * 0207 * @param id The StandardAction identifier to create a QAction for. 0208 * @param recvr The QObject to receive the signal, or @c nullptr if no notification 0209 * is needed. 0210 * @param slot The slot to connect the signal to (remember to use the SLOT() macro). 0211 * @param parent The QObject that should own the created QAction, or @c nullptr if no parent will 0212 * own the QAction returned (ensure you delete it manually in this case). 0213 */ 0214 KCONFIGWIDGETS_EXPORT QAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent); 0215 0216 /** 0217 * @internal 0218 */ 0219 KCONFIGWIDGETS_EXPORT QAction *_k_createInternal(StandardAction id, QObject *parent); 0220 0221 /** 0222 * This overloads create() to allow using the new connect syntax 0223 * @note if you use @c OpenRecent as @p id, you should manually connect to the urlSelected(const QUrl &) 0224 * signal of the returned KRecentFilesAction instead or use KStandardAction::openRecent(Receiver *, Func). 0225 * 0226 * If not explicitly specified, @p connectionType will be AutoConnection for all actions 0227 * except for ConfigureToolbars it will be QueuedConnection. 0228 * 0229 * @see create(StandardAction, const QObject *, const char *, QObject *) 0230 * @since 5.23 (The connectionType argument was added in 5.95) 0231 */ 0232 #ifdef K_DOXYGEN 0233 inline QAction *create(StandardAction id, const QObject *recvr, Func slot, QObject *parent, std::optional<Qt::ConnectionType> connectionType = std::nullopt) 0234 #else 0235 template<class Receiver, class Func> 0236 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, QAction>::type * 0237 create(StandardAction id, const Receiver *recvr, Func slot, QObject *parent, std::optional<Qt::ConnectionType> connectionType = std::nullopt) 0238 #endif 0239 { 0240 QAction *action = _k_createInternal(id, parent); 0241 // ConfigureToolbars is special because of bug #200815 0242 const Qt::ConnectionType defaultConnectionType = (id == ConfigureToolbars) ? Qt::QueuedConnection : Qt::AutoConnection; 0243 QObject::connect(action, &QAction::triggered, recvr, slot, connectionType.value_or(defaultConnectionType)); 0244 return action; 0245 } 0246 0247 /** 0248 * This will return the internal name of a given standard action. 0249 */ 0250 KCONFIGWIDGETS_EXPORT QString name(StandardAction id); 0251 0252 /** 0253 * Returns a list of all standard names. Used by KAccelManager 0254 * to give those higher weight. 0255 */ 0256 KCONFIGWIDGETS_EXPORT QStringList stdNames(); 0257 0258 /** 0259 * Returns a list of all actionIds. 0260 * 0261 * @since 4.2 0262 */ 0263 KCONFIGWIDGETS_EXPORT QList<StandardAction> actionIds(); 0264 0265 /** 0266 * Returns the standardshortcut associated with @a actionId. 0267 * 0268 * @param id The identifier whose associated shortcut is wanted. 0269 * 0270 * @since 4.2 0271 */ 0272 KCONFIGWIDGETS_EXPORT KStandardShortcut::StandardShortcut shortcutForActionId(StandardAction id); 0273 0274 // clang-format off 0275 // we have to disable the templated function for const char* as Func, since it is ambiguous otherwise 0276 // TODO: KF6: unify const char* version and new style by removing std::enable_if 0277 #ifdef K_DOXYGEN 0278 #define KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(name, enumValue) \ 0279 inline QAction *name(const QObject *recvr, Func slot, QObject *parent); 0280 #else 0281 #define KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(name, enumValue) \ 0282 template<class Receiver, class Func> \ 0283 inline typename std::enable_if<!std::is_convertible<Func, const char*>::value, QAction>::type *name(const Receiver *recvr, Func slot, QObject *parent) \ 0284 { return create(enumValue, recvr, slot, parent); } 0285 #endif 0286 // clang-format on 0287 0288 /** 0289 * Create a new document or window. 0290 */ 0291 KCONFIGWIDGETS_EXPORT QAction *openNew(const QObject *recvr, const char *slot, QObject *parent); 0292 0293 /** 0294 * Create a new document or window. 0295 * @since 5.23 0296 */ 0297 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(openNew, New) 0298 0299 /** 0300 * Open an existing file. 0301 */ 0302 KCONFIGWIDGETS_EXPORT QAction *open(const QObject *recvr, const char *slot, QObject *parent); 0303 0304 /** 0305 * Open an existing file. 0306 * @since 5.23 0307 */ 0308 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(open, Open) 0309 0310 /** 0311 * Open a recently used document. The signature of the slot being called 0312 * is of the form slotURLSelected( const QUrl & ). 0313 * @param recvr object to receive slot 0314 * @param slot The SLOT to invoke when a URL is selected. The slot's 0315 * signature is slotURLSelected( const QUrl & ). 0316 * @param parent parent widget 0317 */ 0318 KCONFIGWIDGETS_EXPORT KRecentFilesAction *openRecent(const QObject *recvr, const char *slot, QObject *parent); 0319 0320 /** 0321 * The same as openRecent(const QObject *, const char *, QObject *), but using new-style connect syntax 0322 * @see openRecent(const QObject *, const char *, QObject *) 0323 * @since 5.23 0324 */ 0325 #ifdef K_DOXYGEN 0326 inline KRecentFilesAction *openRecent(const QObject *recvr, Func slot, QObject *parent) 0327 #else 0328 template<class Receiver, class Func> 0329 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, KRecentFilesAction>::type * 0330 openRecent(const Receiver *recvr, Func slot, QObject *parent) 0331 #endif 0332 { 0333 QAction *action = _k_createInternal(OpenRecent, parent); 0334 KRecentFilesAction *recentAction = qobject_cast<KRecentFilesAction *>(action); 0335 Q_ASSERT(recentAction); 0336 QObject::connect(recentAction, &KRecentFilesAction::urlSelected, recvr, slot); 0337 return recentAction; 0338 } 0339 0340 /** 0341 * Save the current document. 0342 */ 0343 KCONFIGWIDGETS_EXPORT QAction *save(const QObject *recvr, const char *slot, QObject *parent); 0344 0345 /** 0346 * Save the current document. 0347 * @since 5.23 0348 */ 0349 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(save, Save) 0350 0351 /** 0352 * Save the current document under a different name. 0353 */ 0354 KCONFIGWIDGETS_EXPORT QAction *saveAs(const QObject *recvr, const char *slot, QObject *parent); 0355 0356 /** 0357 * Save the current document under a different name. 0358 * @since 5.23 0359 */ 0360 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(saveAs, SaveAs) 0361 0362 /** 0363 * Revert the current document to the last saved version 0364 * (essentially will undo all changes). 0365 */ 0366 KCONFIGWIDGETS_EXPORT QAction *revert(const QObject *recvr, const char *slot, QObject *parent); 0367 0368 /** 0369 * Revert the current document to the last saved version 0370 * (essentially will undo all changes). 0371 * @since 5.23 0372 */ 0373 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(revert, Revert) 0374 0375 /** 0376 * Close the current document. 0377 */ 0378 KCONFIGWIDGETS_EXPORT QAction *close(const QObject *recvr, const char *slot, QObject *parent); 0379 0380 /** 0381 * Close the current document. 0382 * @since 5.23 0383 */ 0384 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(close, Close) 0385 0386 /** 0387 * Print the current document. 0388 */ 0389 KCONFIGWIDGETS_EXPORT QAction *print(const QObject *recvr, const char *slot, QObject *parent); 0390 0391 /** 0392 * Print the current document. 0393 * @since 5.23 0394 */ 0395 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(print, Print) 0396 0397 /** 0398 * Show a print preview of the current document. 0399 */ 0400 KCONFIGWIDGETS_EXPORT QAction *printPreview(const QObject *recvr, const char *slot, QObject *parent); 0401 0402 /** 0403 * Show a print preview of the current document. 0404 * @since 5.23 0405 */ 0406 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(printPreview, PrintPreview) 0407 0408 /** 0409 * Send the current document by mail. 0410 */ 0411 KCONFIGWIDGETS_EXPORT QAction *mail(const QObject *recvr, const char *slot, QObject *parent); 0412 0413 /** 0414 * Mail this document. 0415 * @since 5.23 0416 */ 0417 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(mail, Mail) 0418 0419 /** 0420 * Quit the program. 0421 * 0422 * Note that you probably want to connect this action to either QWidget::close() 0423 * or QApplication::closeAllWindows(), but not QApplication::quit(), so that 0424 * KMainWindow::queryClose() is called on any open window (to warn the user 0425 * about unsaved changes for example). 0426 */ 0427 KCONFIGWIDGETS_EXPORT QAction *quit(const QObject *recvr, const char *slot, QObject *parent); 0428 0429 /** 0430 * Quit the program. 0431 * @see quit(const QObject *recvr, const char *slot, QObject *parent) 0432 * @since 5.23 0433 */ 0434 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(quit, Quit) 0435 0436 /** 0437 * Undo the last operation. 0438 */ 0439 KCONFIGWIDGETS_EXPORT QAction *undo(const QObject *recvr, const char *slot, QObject *parent); 0440 0441 /** 0442 * Undo the last operation. 0443 * @since 5.23 0444 */ 0445 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(undo, Undo) 0446 0447 /** 0448 * Redo the last operation. 0449 */ 0450 KCONFIGWIDGETS_EXPORT QAction *redo(const QObject *recvr, const char *slot, QObject *parent); 0451 0452 /** 0453 * Redo the last operation. 0454 * @since 5.23 0455 */ 0456 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(redo, Redo) 0457 0458 /** 0459 * Cut selected area and store it in the clipboard. 0460 * Calls cut() on the widget with the current focus. 0461 */ 0462 KCONFIGWIDGETS_EXPORT QAction *cut(QObject *parent); 0463 0464 /** 0465 * Copy selected area and store it in the clipboard. 0466 * Calls copy() on the widget with the current focus. 0467 */ 0468 KCONFIGWIDGETS_EXPORT QAction *copy(QObject *parent); 0469 0470 /** 0471 * Paste the contents of clipboard at the current mouse or cursor 0472 * Calls paste() on the widget with the current focus. 0473 */ 0474 KCONFIGWIDGETS_EXPORT QAction *paste(QObject *parent); 0475 0476 /** 0477 * Clear selected area. Calls clear() on the widget with the current focus. 0478 * Note that for some widgets, this may not provide the intended behavior. For 0479 * example if you make use of the code above and a K3ListView has the focus, clear() 0480 * will clear all of the items in the list. If this is not the intended behavior 0481 * and you want to make use of this slot, you can subclass K3ListView and reimplement 0482 * this slot. For example the following code would implement a K3ListView without this 0483 * behavior: 0484 * 0485 * \code 0486 * class MyListView : public K3ListView { 0487 * Q_OBJECT 0488 * public: 0489 * MyListView( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ) : K3ListView( parent, name, f ) {} 0490 * virtual ~MyListView() {} 0491 * public Q_SLOTS: 0492 * virtual void clear() {} 0493 * }; 0494 * \endcode 0495 */ 0496 KCONFIGWIDGETS_EXPORT QAction *clear(QObject *parent); 0497 0498 /** 0499 * Calls selectAll() on the widget with the current focus. 0500 */ 0501 KCONFIGWIDGETS_EXPORT QAction *selectAll(QObject *parent); 0502 0503 /** 0504 * Cut selected area and store it in the clipboard. 0505 */ 0506 KCONFIGWIDGETS_EXPORT QAction *cut(const QObject *recvr, const char *slot, QObject *parent); 0507 0508 /** 0509 * Cut selected area and store it in the clipboard. 0510 * @since 5.23 0511 */ 0512 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(cut, Cut) 0513 0514 /** 0515 * Copy the selected area into the clipboard. 0516 */ 0517 KCONFIGWIDGETS_EXPORT QAction *copy(const QObject *recvr, const char *slot, QObject *parent); 0518 0519 /** 0520 * Copy the selected area into the clipboard. 0521 * @since 5.23 0522 */ 0523 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(copy, Copy) 0524 0525 /** 0526 * Paste the contents of clipboard at the current mouse or cursor 0527 * position. 0528 */ 0529 KCONFIGWIDGETS_EXPORT QAction *paste(const QObject *recvr, const char *slot, QObject *parent); 0530 0531 /** 0532 * Paste the contents of clipboard at the current mouse or cursor 0533 * position. 0534 * @since 5.23 0535 */ 0536 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(paste, Paste) 0537 0538 /** 0539 * Clear the content of the focus widget 0540 */ 0541 KCONFIGWIDGETS_EXPORT QAction *clear(const QObject *recvr, const char *slot, QObject *parent); 0542 0543 /** 0544 * Clear the content of the focus widget 0545 * @since 5.23 0546 */ 0547 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(clear, Clear) 0548 0549 /** 0550 * Select all elements in the current document. 0551 */ 0552 KCONFIGWIDGETS_EXPORT QAction *selectAll(const QObject *recvr, const char *slot, QObject *parent); 0553 0554 /** 0555 * Select all elements in the current document. 0556 * @since 5.23 0557 */ 0558 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(selectAll, SelectAll) 0559 0560 /** 0561 * Deselect any selected elements in the current document. 0562 */ 0563 KCONFIGWIDGETS_EXPORT QAction *deselect(const QObject *recvr, const char *slot, QObject *parent); 0564 0565 /** 0566 * Deselect any selected elements in the current document. 0567 * @since 5.23 0568 */ 0569 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(deselect, Deselect) 0570 0571 /** 0572 * Initiate a 'find' request in the current document. 0573 */ 0574 KCONFIGWIDGETS_EXPORT QAction *find(const QObject *recvr, const char *slot, QObject *parent); 0575 0576 /** 0577 * Initiate a 'find' request in the current document. 0578 * @since 5.23 0579 */ 0580 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(find, Find) 0581 0582 /** 0583 * Find the next instance of a stored 'find'. 0584 */ 0585 KCONFIGWIDGETS_EXPORT QAction *findNext(const QObject *recvr, const char *slot, QObject *parent); 0586 0587 /** 0588 * Find the next instance of a stored 'find'. 0589 * @since 5.23 0590 */ 0591 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(findNext, FindNext) 0592 0593 /** 0594 * Find a previous instance of a stored 'find'. 0595 */ 0596 KCONFIGWIDGETS_EXPORT QAction *findPrev(const QObject *recvr, const char *slot, QObject *parent); 0597 0598 /** 0599 * Find a previous instance of a stored 'find'. 0600 * @since 5.23 0601 */ 0602 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(findPrev, FindPrev) 0603 0604 /** 0605 * Find and replace matches. 0606 */ 0607 KCONFIGWIDGETS_EXPORT QAction *replace(const QObject *recvr, const char *slot, QObject *parent); 0608 0609 /** 0610 * Find and replace matches. 0611 * @since 5.23 0612 */ 0613 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(replace, Replace) 0614 0615 /** 0616 * View the document at its actual size. 0617 */ 0618 KCONFIGWIDGETS_EXPORT QAction *actualSize(const QObject *recvr, const char *slot, QObject *parent); 0619 0620 /** 0621 * View the document at its actual size. 0622 * @since 5.23 0623 */ 0624 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(actualSize, ActualSize) 0625 0626 /** 0627 * Fit the document view to the size of the current window. 0628 */ 0629 KCONFIGWIDGETS_EXPORT QAction *fitToPage(const QObject *recvr, const char *slot, QObject *parent); 0630 0631 /** 0632 * Fit the document view to the size of the current window. 0633 * @since 5.23 0634 */ 0635 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(fitToPage, FitToPage) 0636 0637 /** 0638 * Fit the document view to the width of the current window. 0639 */ 0640 KCONFIGWIDGETS_EXPORT QAction *fitToWidth(const QObject *recvr, const char *slot, QObject *parent); 0641 0642 /** 0643 * Fit the document view to the width of the current window. 0644 * @since 5.23 0645 */ 0646 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(fitToWidth, FitToWidth) 0647 0648 /** 0649 * Fit the document view to the height of the current window. 0650 */ 0651 KCONFIGWIDGETS_EXPORT QAction *fitToHeight(const QObject *recvr, const char *slot, QObject *parent); 0652 0653 /** 0654 * Fit the document view to the height of the current window. 0655 * @since 5.23 0656 */ 0657 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(fitToHeight, FitToHeight) 0658 0659 /** 0660 * Zoom in the current document view. 0661 */ 0662 KCONFIGWIDGETS_EXPORT QAction *zoomIn(const QObject *recvr, const char *slot, QObject *parent); 0663 0664 /** 0665 * Zoom in the current document view. 0666 * @since 5.23 0667 */ 0668 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(zoomIn, ZoomIn) 0669 0670 /** 0671 * Zoom out the current document view. 0672 */ 0673 KCONFIGWIDGETS_EXPORT QAction *zoomOut(const QObject *recvr, const char *slot, QObject *parent); 0674 0675 /** 0676 * Zoom out the current document view. 0677 * @since 5.23 0678 */ 0679 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(zoomOut, ZoomOut) 0680 0681 /** 0682 * Select the current zoom level. 0683 */ 0684 KCONFIGWIDGETS_EXPORT QAction *zoom(const QObject *recvr, const char *slot, QObject *parent); 0685 0686 /** 0687 * Select the current zoom level. 0688 * @since 5.23 0689 */ 0690 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(zoom, Zoom) 0691 0692 /** 0693 * Redisplay or redraw the document. 0694 */ 0695 KCONFIGWIDGETS_EXPORT QAction *redisplay(const QObject *recvr, const char *slot, QObject *parent); 0696 0697 /** 0698 * Redisplay or redraw the document. 0699 * @since 5.23 0700 */ 0701 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(redisplay, Redisplay) 0702 0703 /** 0704 * Move up (web style menu). 0705 */ 0706 KCONFIGWIDGETS_EXPORT QAction *up(const QObject *recvr, const char *slot, QObject *parent); 0707 0708 /** 0709 * Move up (web style menu). 0710 * @since 5.23 0711 */ 0712 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(up, Up) 0713 0714 /** 0715 * Move back (web style menu). 0716 */ 0717 KCONFIGWIDGETS_EXPORT QAction *back(const QObject *recvr, const char *slot, QObject *parent); 0718 0719 /** 0720 * Move back (web style menu). 0721 * @since 5.23 0722 */ 0723 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(back, Back) 0724 0725 /** 0726 * Move forward (web style menu). 0727 */ 0728 KCONFIGWIDGETS_EXPORT QAction *forward(const QObject *recvr, const char *slot, QObject *parent); 0729 0730 /** 0731 * Move forward (web style menu). 0732 * @since 5.23 0733 */ 0734 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(forward, Forward) 0735 0736 /** 0737 * Go to the "Home" position or document. 0738 */ 0739 KCONFIGWIDGETS_EXPORT QAction *home(const QObject *recvr, const char *slot, QObject *parent); 0740 0741 /** 0742 * Go to the "Home" position or document. 0743 * @since 5.23 0744 */ 0745 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(home, Home) 0746 0747 /** 0748 * Scroll up one page. 0749 */ 0750 KCONFIGWIDGETS_EXPORT QAction *prior(const QObject *recvr, const char *slot, QObject *parent); 0751 0752 /** 0753 * Scroll up one page. 0754 * @since 5.23 0755 */ 0756 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(prior, Prior) 0757 0758 /** 0759 * Scroll down one page. 0760 */ 0761 KCONFIGWIDGETS_EXPORT QAction *next(const QObject *recvr, const char *slot, QObject *parent); 0762 0763 /** 0764 * Scroll down one page. 0765 * @since 5.23 0766 */ 0767 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(next, Next) 0768 0769 /** 0770 * Jump to some specific location in the document. 0771 */ 0772 KCONFIGWIDGETS_EXPORT QAction *goTo(const QObject *recvr, const char *slot, QObject *parent); 0773 0774 /** 0775 * Jump to some specific location in the document. 0776 * @since 5.23 0777 */ 0778 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(goTo, Goto) 0779 0780 /** 0781 * Go to a specific page. 0782 */ 0783 KCONFIGWIDGETS_EXPORT QAction *gotoPage(const QObject *recvr, const char *slot, QObject *parent); 0784 0785 /** 0786 * Go to a specific page. 0787 * @since 5.23 0788 */ 0789 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(gotoPage, GotoPage) 0790 0791 /** 0792 * Go to a specific line. 0793 */ 0794 KCONFIGWIDGETS_EXPORT QAction *gotoLine(const QObject *recvr, const char *slot, QObject *parent); 0795 0796 /** 0797 * Go to a specific line. 0798 * @since 5.23 0799 */ 0800 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(gotoLine, GotoLine) 0801 0802 /** 0803 * Jump to the first page. 0804 */ 0805 KCONFIGWIDGETS_EXPORT QAction *firstPage(const QObject *recvr, const char *slot, QObject *parent); 0806 0807 /** 0808 * Jump to the first page. 0809 * @since 5.23 0810 */ 0811 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(firstPage, FirstPage) 0812 0813 /** 0814 * Jump to the last page. 0815 */ 0816 KCONFIGWIDGETS_EXPORT QAction *lastPage(const QObject *recvr, const char *slot, QObject *parent); 0817 0818 /** 0819 * Jump to the last page. 0820 * @since 5.23 0821 */ 0822 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(lastPage, LastPage) 0823 0824 /** 0825 * Move back (document style menu). 0826 */ 0827 KCONFIGWIDGETS_EXPORT QAction *documentBack(const QObject *recvr, const char *slot, QObject *parent); 0828 0829 /** 0830 * Move back (document style menu). 0831 * @since 5.23 0832 */ 0833 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(documentBack, DocumentBack) 0834 0835 /** 0836 * Move forward (document style menu). 0837 */ 0838 KCONFIGWIDGETS_EXPORT QAction *documentForward(const QObject *recvr, const char *slot, QObject *parent); 0839 0840 /** 0841 * Move forward (document style menu). 0842 * @since 5.23 0843 */ 0844 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(documentForward, DocumentForward) 0845 0846 /** 0847 * Add the current page to the bookmarks tree. 0848 */ 0849 KCONFIGWIDGETS_EXPORT QAction *addBookmark(const QObject *recvr, const char *slot, QObject *parent); 0850 0851 /** 0852 * Add the current page to the bookmarks tree. 0853 * @since 5.23 0854 */ 0855 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(addBookmark, AddBookmark) 0856 0857 /** 0858 * Edit the application bookmarks. 0859 */ 0860 KCONFIGWIDGETS_EXPORT QAction *editBookmarks(const QObject *recvr, const char *slot, QObject *parent); 0861 0862 /** 0863 * Edit the application bookmarks. 0864 * @since 5.23 0865 */ 0866 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(editBookmarks, EditBookmarks) 0867 0868 /** 0869 * Pop up the spell checker. 0870 */ 0871 KCONFIGWIDGETS_EXPORT QAction *spelling(const QObject *recvr, const char *slot, QObject *parent); 0872 0873 /** 0874 * Pop up the spell checker. 0875 * @since 5.23 0876 */ 0877 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(spelling, Spelling) 0878 0879 /** 0880 * Show/Hide the menubar. 0881 */ 0882 KCONFIGWIDGETS_EXPORT KToggleAction *showMenubar(const QObject *recvr, const char *slot, QObject *parent); 0883 0884 /** 0885 * The same as showMenubar(const QObject *, const char *, QObject *), but using new-style connect syntax 0886 * @see showMenubar(const QObject *, const char *, QObject *) 0887 * @since 5.23 0888 */ 0889 #ifdef K_DOXYGEN 0890 inline KToggleAction *showMenubar(const QObject *recvr, Func slot, QObject *parent) 0891 #else 0892 template<class Receiver, class Func> 0893 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, KToggleAction>::type * 0894 showMenubar(const Receiver *recvr, Func slot, QObject *parent) 0895 #endif 0896 { 0897 QAction *ret = create(ShowMenubar, recvr, slot, parent); 0898 Q_ASSERT(qobject_cast<KToggleAction *>(ret)); 0899 return static_cast<KToggleAction *>(ret); 0900 } 0901 0902 /** 0903 * Show/Hide the statusbar. 0904 */ 0905 KCONFIGWIDGETS_EXPORT KToggleAction *showStatusbar(const QObject *recvr, const char *slot, QObject *parent); 0906 0907 /** 0908 * Show/Hide the statusbar. 0909 * @since 5.23 0910 */ 0911 #ifdef K_DOXYGEN 0912 inline KToggleAction *showStatusbar(const QObject *recvr, Func slot, QObject *parent) 0913 #else 0914 template<class Receiver, class Func> 0915 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, KToggleAction>::type * 0916 showStatusbar(const Receiver *recvr, Func slot, QObject *parent) 0917 #endif 0918 { 0919 QAction *ret = create(ShowStatusbar, recvr, slot, parent); 0920 Q_ASSERT(qobject_cast<KToggleAction *>(ret)); 0921 return static_cast<KToggleAction *>(ret); 0922 } 0923 0924 /** 0925 * Switch to/from full screen mode 0926 */ 0927 KCONFIGWIDGETS_EXPORT KToggleFullScreenAction *fullScreen(const QObject *recvr, const char *slot, QWidget *window, QObject *parent); 0928 0929 /** 0930 * Switch to/from full screen mode 0931 * @since 5.23 0932 */ 0933 #ifdef K_DOXYGEN 0934 inline KToggleFullScreenAction *fullScreen(const QObject *recvr, Func slot, QWidget *window, QObject *parent) 0935 #else 0936 template<class Receiver, class Func> 0937 inline typename std::enable_if<!std::is_convertible<Func, const char *>::value, KToggleFullScreenAction>::type * 0938 fullScreen(const Receiver *recvr, Func slot, QWidget *window, QObject *parent) 0939 #endif 0940 { 0941 QAction *a = create(FullScreen, recvr, slot, parent); 0942 Q_ASSERT(qobject_cast<KToggleFullScreenAction *>(a)); 0943 KToggleFullScreenAction *ret = static_cast<KToggleFullScreenAction *>(a); 0944 ret->setWindow(window); 0945 return ret; 0946 } 0947 0948 /** 0949 * Display the configure keyboard shortcuts dialog. 0950 * 0951 * Note that you might be able to use the pre-built KXMLGUIFactory's function: 0952 * @code 0953 * KStandardAction::keyBindings(guiFactory(), &KXMLGUIFactory::showConfigureShortcutsDialog, actionCollection()); 0954 * @endcode 0955 * 0956 */ 0957 KCONFIGWIDGETS_EXPORT QAction *keyBindings(const QObject *recvr, const char *slot, QObject *parent); 0958 0959 /** 0960 * Display the configure key bindings dialog. 0961 * @see keyBindings(const QObject *recvr, const char *slot, QObject *parent) 0962 * @since 5.23 0963 */ 0964 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(keyBindings, KeyBindings) 0965 0966 /** 0967 * Display the preferences/options dialog. 0968 */ 0969 KCONFIGWIDGETS_EXPORT QAction *preferences(const QObject *recvr, const char *slot, QObject *parent); 0970 0971 /** 0972 * Display the preferences/options dialog. 0973 * @since 5.23 0974 */ 0975 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(preferences, Preferences) 0976 0977 /** 0978 * Display the toolbar configuration dialog. 0979 */ 0980 KCONFIGWIDGETS_EXPORT QAction *configureToolbars(const QObject *recvr, const char *slot, QObject *parent); 0981 0982 /** 0983 * Display the toolbar configuration dialog. 0984 * @since 5.23 0985 */ 0986 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(configureToolbars, ConfigureToolbars) 0987 0988 /** 0989 * Display the notifications configuration dialog. 0990 */ 0991 KCONFIGWIDGETS_EXPORT QAction *configureNotifications(const QObject *recvr, const char *slot, QObject *parent); 0992 0993 /** 0994 * Display the notifications configuration dialog. 0995 * @since 5.23 0996 */ 0997 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(configureNotifications, ConfigureNotifications) 0998 0999 /** 1000 * Display the Switch Application Language dialog. 1001 * @since 5.67 1002 */ 1003 KCONFIGWIDGETS_EXPORT QAction *switchApplicationLanguage(const QObject *recvr, const char *slot, QObject *parent); 1004 1005 /** 1006 * Display the Switch Application Language dialog. 1007 * @since 5.67 1008 */ 1009 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(switchApplicationLanguage, SwitchApplicationLanguage) 1010 1011 /** 1012 * Display the handbook of the application. 1013 */ 1014 KCONFIGWIDGETS_EXPORT QAction *helpContents(const QObject *recvr, const char *slot, QObject *parent); 1015 1016 /** 1017 * Display the handbook of the application. 1018 * @since 5.23 1019 */ 1020 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(helpContents, HelpContents) 1021 1022 /** 1023 * Trigger the What's This cursor. 1024 */ 1025 KCONFIGWIDGETS_EXPORT QAction *whatsThis(const QObject *recvr, const char *slot, QObject *parent); 1026 1027 /** 1028 * Trigger the What's This cursor. 1029 * @since 5.23 1030 */ 1031 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(whatsThis, WhatsThis) 1032 1033 /** 1034 * Open up the Report Bug dialog. 1035 */ 1036 KCONFIGWIDGETS_EXPORT QAction *reportBug(const QObject *recvr, const char *slot, QObject *parent); 1037 1038 /** 1039 * Open up the Report Bug dialog. 1040 * @since 5.23 1041 */ 1042 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(reportBug, ReportBug) 1043 1044 /** 1045 * Display the application's About box. 1046 */ 1047 KCONFIGWIDGETS_EXPORT QAction *aboutApp(const QObject *recvr, const char *slot, QObject *parent); 1048 1049 /** 1050 * Display the application's About box. 1051 * @since 5.23 1052 */ 1053 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(aboutApp, AboutApp) 1054 1055 /** 1056 * Display the About KDE dialog. 1057 */ 1058 KCONFIGWIDGETS_EXPORT QAction *aboutKDE(const QObject *recvr, const char *slot, QObject *parent); 1059 1060 /** 1061 * Display the About KDE dialog. 1062 * @since 5.23 1063 */ 1064 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(aboutKDE, AboutKDE) 1065 1066 /** 1067 * Permanently deletes files or folders. 1068 * @since 5.25 1069 */ 1070 KCONFIGWIDGETS_EXPORT QAction *deleteFile(const QObject *recvr, const char *slot, QObject *parent); 1071 1072 /** 1073 * Permanently deletes files or folders. 1074 * @since 5.25 1075 */ 1076 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(deleteFile, DeleteFile) 1077 1078 /** 1079 * Renames files or folders. 1080 * @since 5.25 1081 */ 1082 KCONFIGWIDGETS_EXPORT QAction *renameFile(const QObject *recvr, const char *slot, QObject *parent); 1083 1084 /** 1085 * Renames files or folders. 1086 * @since 5.25 1087 */ 1088 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(renameFile, RenameFile) 1089 1090 /** 1091 * Moves files or folders to the trash. 1092 * @since 5.25 1093 */ 1094 KCONFIGWIDGETS_EXPORT QAction *moveToTrash(const QObject *recvr, const char *slot, QObject *parent); 1095 1096 /** 1097 * Moves files or folders to the trash. 1098 * @since 5.25 1099 */ 1100 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(moveToTrash, MoveToTrash) 1101 1102 /** 1103 * Open donation page on kde.org. 1104 * @since 5.26 1105 */ 1106 KCONFIGWIDGETS_EXPORT QAction *donate(const QObject *recvr, const char *slot, QObject *parent); 1107 1108 /** 1109 * Open donation page on kde.org. 1110 * @since 5.26 1111 */ 1112 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(donate, Donate) 1113 1114 /** 1115 * Opens a menu that substitutes the menubar. 1116 * @since 5.81 1117 */ 1118 KCONFIGWIDGETS_EXPORT KHamburgerMenu *hamburgerMenu(const QObject *recvr, const char *slot, QObject *parent); 1119 1120 /** 1121 * Opens a menu that substitutes the menubar. 1122 * @since 5.81 1123 */ 1124 KSTANDARDACTION_WITH_NEW_STYLE_CONNECT(hamburgerMenu, HamburgerMenu) 1125 1126 } 1127 1128 #endif // KSTDACTION_H