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