File indexing completed on 2022-01-30 17:41:41

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 1999, 2000 Kurt Granroth <granroth@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #include "kstandardaction.h"
0009 #include "kconfigwidgets_debug.h"
0010 #include "kstandardaction_p.h"
0011 #include "moc_kstandardaction_p.cpp"
0012 
0013 #include <KAboutData>
0014 #include <KAcceleratorManager>
0015 #include <KLocalizedString>
0016 #include <KStandardShortcutWatcher>
0017 #include <QGuiApplication>
0018 #include <QLayout>
0019 #include <QMainWindow>
0020 #include <QMenuBar>
0021 
0022 #include "kpastetextaction.h"
0023 
0024 namespace KStandardAction
0025 {
0026 AutomaticAction::AutomaticAction(const QIcon &icon,
0027                                  const QString &text,
0028                                  KStandardShortcut::StandardShortcut standardShortcut,
0029                                  const char *slot,
0030                                  QObject *parent)
0031     : QAction(parent)
0032 {
0033     setText(text);
0034     setIcon(icon);
0035 
0036     const QList<QKeySequence> shortcut = KStandardShortcut::shortcut(standardShortcut);
0037     setShortcuts(shortcut);
0038     setProperty("defaultShortcuts", QVariant::fromValue(shortcut));
0039     connect(KStandardShortcut::shortcutWatcher(),
0040             &KStandardShortcut::StandardShortcutWatcher::shortcutChanged,
0041             this,
0042             [standardShortcut, this](KStandardShortcut::StandardShortcut id, const QList<QKeySequence> &newShortcut) {
0043                 if (id != standardShortcut) {
0044                     return;
0045                 }
0046                 setShortcuts(newShortcut);
0047                 setProperty("defaultShortcuts", QVariant::fromValue(newShortcut));
0048             });
0049 
0050     connect(this, SIGNAL(triggered()), this, slot);
0051 }
0052 
0053 QStringList stdNames()
0054 {
0055     return internal_stdNames();
0056 }
0057 
0058 QList<StandardAction> actionIds()
0059 {
0060     QList<StandardAction> result;
0061 
0062     for (uint i = 0; g_rgActionInfo[i].id != ActionNone; i++) {
0063         result.append(g_rgActionInfo[i].id);
0064     }
0065 
0066     return result;
0067 }
0068 
0069 KStandardShortcut::StandardShortcut shortcutForActionId(StandardAction id)
0070 {
0071     const KStandardActionInfo *pInfo = infoPtr(id);
0072     return (pInfo) ? pInfo->idAccel : KStandardShortcut::AccelNone;
0073 }
0074 
0075 class ShowMenubarActionFilter : public QObject
0076 {
0077 public:
0078     ShowMenubarActionFilter(QAction *parent)
0079         : QObject(parent)
0080         , wasNative(false)
0081         , wasChecked(false)
0082         , wasVisible(false)
0083     {
0084     }
0085 
0086     bool eventFilter(QObject * /*watched*/, QEvent *e) override
0087     {
0088         if (e->type() == QEvent::Show) {
0089             updateAction();
0090         }
0091         return false;
0092     }
0093 
0094     void updateAction()
0095     {
0096         bool allMenuBarsNative = true;
0097         bool hasAnyMenuBar = false;
0098         const auto lstWidget = qApp->topLevelWidgets();
0099         for (QWidget *w : lstWidget) {
0100             QMainWindow *mw = qobject_cast<QMainWindow *>(w);
0101             if (mw) {
0102                 mw->installEventFilter(this); // this is just in case a new main window appeared
0103                                               // if we were filtering it already it is almost a noop
0104                 if (mw->layout() && mw->layout()->menuBar()) {
0105                     QMenuBar *mb = qobject_cast<QMenuBar *>(mw->layout()->menuBar());
0106                     if (mb) {
0107                         hasAnyMenuBar = true;
0108                         if (!mb->isNativeMenuBar()) {
0109                             allMenuBarsNative = false;
0110                         }
0111                     }
0112                 }
0113             }
0114         }
0115 
0116         if (!hasAnyMenuBar) {
0117             return;
0118         }
0119 
0120         QAction *showMenubarAction = static_cast<QAction *>(parent());
0121         if (allMenuBarsNative && !wasNative) {
0122             wasNative = true;
0123             wasChecked = showMenubarAction->isChecked();
0124             wasVisible = showMenubarAction->isVisible();
0125 
0126             showMenubarAction->setChecked(true);
0127             showMenubarAction->setVisible(false);
0128         } else if (!allMenuBarsNative && wasNative) {
0129             showMenubarAction->setChecked(wasChecked);
0130             showMenubarAction->setVisible(wasVisible);
0131         }
0132     }
0133 
0134     bool wasNative;
0135     bool wasChecked;
0136     bool wasVisible;
0137 };
0138 
0139 QAction *_k_createInternal(StandardAction id, QObject *parent)
0140 {
0141     static bool stdNamesInitialized = false;
0142 
0143     if (!stdNamesInitialized) {
0144         KAcceleratorManager::addStandardActionNames(stdNames());
0145         stdNamesInitialized = true;
0146     }
0147 
0148     QAction *pAction = nullptr;
0149     const KStandardActionInfo *pInfo = infoPtr(id);
0150 
0151     // qCDebug(KCONFIG_WIDGETS_LOG) << "KStandardAction::create( " << id << "=" << (pInfo ? pInfo->psName : (const char*)0) << ", " << parent << " )"; // ellis
0152 
0153     if (pInfo) {
0154         QString sLabel;
0155         QString iconName = pInfo->psIconName;
0156         switch (id) {
0157         case Back:
0158             sLabel = i18nc("go back", "&Back");
0159             if (QGuiApplication::isRightToLeft()) {
0160                 iconName = QStringLiteral("go-next");
0161             }
0162             break;
0163 
0164         case Forward:
0165             sLabel = i18nc("go forward", "&Forward");
0166             if (QGuiApplication::isRightToLeft()) {
0167                 iconName = QStringLiteral("go-previous");
0168             }
0169             break;
0170 
0171         case Home:
0172             sLabel = i18nc("home page", "&Home");
0173             break;
0174 #if KCONFIGWIDGETS_BUILD_DEPRECATED_SINCE(5, 23)
0175         case Help:
0176             sLabel = i18nc("show help", "&Help");
0177             break;
0178 #endif
0179         case Preferences:
0180         case AboutApp:
0181         case HelpContents: {
0182             QString appDisplayName = QGuiApplication::applicationDisplayName();
0183             if (appDisplayName.isEmpty()) {
0184                 appDisplayName = QCoreApplication::applicationName();
0185             }
0186             sLabel = pInfo->psLabel.subs(appDisplayName).toString();
0187         } break;
0188         default:
0189             sLabel = pInfo->psLabel.toString();
0190         }
0191 
0192         if (QGuiApplication::isRightToLeft()) {
0193             switch (id) {
0194             case Prior:
0195                 iconName = QStringLiteral("go-next-view-page");
0196                 break;
0197             case Next:
0198                 iconName = QStringLiteral("go-previous-view-page");
0199                 break;
0200             case FirstPage:
0201                 iconName = QStringLiteral("go-last-view-page");
0202                 break;
0203             case LastPage:
0204                 iconName = QStringLiteral("go-first-view-page");
0205                 break;
0206             case DocumentBack:
0207                 iconName = QStringLiteral("go-next");
0208                 break;
0209             case DocumentForward:
0210                 iconName = QStringLiteral("go-previous");
0211                 break;
0212             default:
0213                 break;
0214             }
0215         }
0216 
0217         if (id == Donate) {
0218             const QString currencyCode = QLocale().currencySymbol(QLocale::CurrencyIsoCode).toLower();
0219             if (!currencyCode.isEmpty()) {
0220                 iconName = QStringLiteral("help-donate-%1").arg(currencyCode);
0221             }
0222         }
0223 
0224         QIcon icon = iconName.isEmpty() ? QIcon() : QIcon::fromTheme(iconName);
0225 
0226         switch (id) {
0227         case OpenRecent:
0228             pAction = new KRecentFilesAction(parent);
0229             break;
0230         case ShowMenubar: {
0231             pAction = new KToggleAction(parent);
0232             pAction->setWhatsThis(
0233                 i18n("Show Menubar<p>"
0234                      "Shows the menubar again after it has been hidden</p>"));
0235             pAction->setChecked(true);
0236 
0237             ShowMenubarActionFilter *mf = new ShowMenubarActionFilter(pAction);
0238             const auto lstWidget = qApp->topLevelWidgets();
0239             for (QWidget *w : lstWidget) {
0240                 if (qobject_cast<QMainWindow *>(w)) {
0241                     w->installEventFilter(mf);
0242                 }
0243             }
0244             mf->updateAction();
0245             break;
0246         }
0247         case ShowToolbar:
0248             pAction = new KToggleAction(parent);
0249             pAction->setChecked(true);
0250             break;
0251         case ShowStatusbar:
0252             pAction = new KToggleAction(parent);
0253             pAction->setWhatsThis(
0254                 i18n("Show Statusbar<p>"
0255                      "Shows the statusbar, which is the bar at the bottom of the window used for status information.</p>"));
0256             pAction->setChecked(true);
0257             break;
0258         case FullScreen:
0259             pAction = new KToggleFullScreenAction(parent);
0260             pAction->setCheckable(true);
0261             break;
0262 #if KCONFIGWIDGETS_BUILD_DEPRECATED_SINCE(5, 39) && defined(QT_DBUS_LIB)
0263         case PasteText:
0264             pAction = new KPasteTextAction(parent);
0265             break;
0266 #endif
0267         // Same as default, but with the app icon
0268         case AboutApp: {
0269             pAction = new QAction(parent);
0270             icon = qApp->windowIcon();
0271 #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 2)
0272             // Using deprecated API for compatibility reasons, remove with KF6
0273             if (icon.isNull()) {
0274                 const KAboutData data = KAboutData::applicationData();
0275                 QT_WARNING_PUSH
0276                 QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations")
0277                 QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
0278                 if (!data.programIconName().isEmpty()) {
0279                     icon = QIcon::fromTheme(data.programIconName());
0280                     QT_WARNING_POP
0281                 }
0282             }
0283 #endif
0284             break;
0285         }
0286         case HamburgerMenu:
0287         {
0288             pAction = new KHamburgerMenu(parent);
0289             break;
0290         }
0291 
0292         default:
0293             pAction = new QAction(parent);
0294             break;
0295         }
0296 
0297         // Set the text before setting the MenuRole, as on OS X setText will do some heuristic role guessing.
0298         // This ensures user menu items get the intended role out of the list below.
0299         pAction->setText(sLabel);
0300 
0301         switch (id) {
0302         case Quit:
0303             pAction->setMenuRole(QAction::QuitRole);
0304             break;
0305 
0306         case Preferences:
0307             pAction->setMenuRole(QAction::PreferencesRole);
0308             break;
0309 
0310         case AboutApp:
0311             pAction->setMenuRole(QAction::AboutRole);
0312             break;
0313 
0314         default:
0315             pAction->setMenuRole(QAction::NoRole);
0316             break;
0317         }
0318 
0319         if (!pInfo->psToolTip.isEmpty()) {
0320             pAction->setToolTip(pInfo->psToolTip.toString());
0321         }
0322         pAction->setIcon(icon);
0323 
0324         QList<QKeySequence> cut = KStandardShortcut::shortcut(pInfo->idAccel);
0325         if (!cut.isEmpty()) {
0326             // emulate KActionCollection::setDefaultShortcuts to allow the use of "configure shortcuts"
0327             pAction->setShortcuts(cut);
0328             pAction->setProperty("defaultShortcuts", QVariant::fromValue(cut));
0329         }
0330         pAction->connect(KStandardShortcut::shortcutWatcher(),
0331                          &KStandardShortcut::StandardShortcutWatcher::shortcutChanged,
0332                          pAction,
0333                          [pAction, shortcut = pInfo->idAccel](KStandardShortcut::StandardShortcut id, const QList<QKeySequence> &newShortcut) {
0334                              if (id != shortcut) {
0335                                  return;
0336                              }
0337                              pAction->setShortcuts(newShortcut);
0338                              pAction->setProperty("defaultShortcuts", QVariant::fromValue(newShortcut));
0339                          });
0340 
0341         pAction->setObjectName(pInfo->psName);
0342     }
0343 
0344     if (pAction && parent && parent->inherits("KActionCollection")) {
0345         QMetaObject::invokeMethod(parent, "addAction", Q_ARG(QString, pAction->objectName()), Q_ARG(QAction *, pAction));
0346     }
0347 
0348     return pAction;
0349 }
0350 
0351 QAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
0352 {
0353     QAction *pAction = _k_createInternal(id, parent);
0354     if (recvr && slot) {
0355         if (id == OpenRecent) {
0356             // FIXME QAction port: probably a good idea to find a cleaner way to do this
0357             // Open Recent is a special case - provide the selected URL
0358             QObject::connect(pAction, SIGNAL(urlSelected(QUrl)), recvr, slot);
0359         } else if (id == ConfigureToolbars) { // #200815
0360             QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot, Qt::QueuedConnection);
0361         } else {
0362             QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot);
0363         }
0364     }
0365     return pAction;
0366 }
0367 
0368 const char *name(StandardAction id)
0369 {
0370     const KStandardActionInfo *pInfo = infoPtr(id);
0371     return (pInfo) ? pInfo->psName : nullptr;
0372 }
0373 
0374 QAction *openNew(const QObject *recvr, const char *slot, QObject *parent)
0375 {
0376     return KStandardAction::create(New, recvr, slot, parent);
0377 }
0378 
0379 QAction *open(const QObject *recvr, const char *slot, QObject *parent)
0380 {
0381     return KStandardAction::create(Open, recvr, slot, parent);
0382 }
0383 
0384 KRecentFilesAction *openRecent(const QObject *recvr, const char *slot, QObject *parent)
0385 {
0386     return (KRecentFilesAction *)KStandardAction::create(OpenRecent, recvr, slot, parent);
0387 }
0388 
0389 QAction *save(const QObject *recvr, const char *slot, QObject *parent)
0390 {
0391     return KStandardAction::create(Save, recvr, slot, parent);
0392 }
0393 
0394 QAction *saveAs(const QObject *recvr, const char *slot, QObject *parent)
0395 {
0396     return KStandardAction::create(SaveAs, recvr, slot, parent);
0397 }
0398 
0399 QAction *revert(const QObject *recvr, const char *slot, QObject *parent)
0400 {
0401     return KStandardAction::create(Revert, recvr, slot, parent);
0402 }
0403 
0404 QAction *print(const QObject *recvr, const char *slot, QObject *parent)
0405 {
0406     return KStandardAction::create(Print, recvr, slot, parent);
0407 }
0408 
0409 QAction *printPreview(const QObject *recvr, const char *slot, QObject *parent)
0410 {
0411     return KStandardAction::create(PrintPreview, recvr, slot, parent);
0412 }
0413 
0414 QAction *close(const QObject *recvr, const char *slot, QObject *parent)
0415 {
0416     return KStandardAction::create(Close, recvr, slot, parent);
0417 }
0418 
0419 QAction *mail(const QObject *recvr, const char *slot, QObject *parent)
0420 {
0421     return KStandardAction::create(Mail, recvr, slot, parent);
0422 }
0423 
0424 QAction *quit(const QObject *recvr, const char *slot, QObject *parent)
0425 {
0426     return KStandardAction::create(Quit, recvr, slot, parent);
0427 }
0428 
0429 QAction *undo(const QObject *recvr, const char *slot, QObject *parent)
0430 {
0431     return KStandardAction::create(Undo, recvr, slot, parent);
0432 }
0433 
0434 QAction *redo(const QObject *recvr, const char *slot, QObject *parent)
0435 {
0436     return KStandardAction::create(Redo, recvr, slot, parent);
0437 }
0438 
0439 QAction *cut(const QObject *recvr, const char *slot, QObject *parent)
0440 {
0441     return KStandardAction::create(Cut, recvr, slot, parent);
0442 }
0443 
0444 QAction *copy(const QObject *recvr, const char *slot, QObject *parent)
0445 {
0446     return KStandardAction::create(Copy, recvr, slot, parent);
0447 }
0448 
0449 QAction *paste(const QObject *recvr, const char *slot, QObject *parent)
0450 {
0451     return KStandardAction::create(Paste, recvr, slot, parent);
0452 }
0453 
0454 #if KCONFIGWIDGETS_BUILD_DEPRECATED_SINCE(5, 39)
0455 QAction *pasteText(const QObject *recvr, const char *slot, QObject *parent)
0456 {
0457     return KStandardAction::create(PasteText, recvr, slot, parent);
0458 }
0459 #endif
0460 
0461 QAction *clear(const QObject *recvr, const char *slot, QObject *parent)
0462 {
0463     return KStandardAction::create(Clear, recvr, slot, parent);
0464 }
0465 
0466 QAction *selectAll(const QObject *recvr, const char *slot, QObject *parent)
0467 {
0468     return KStandardAction::create(SelectAll, recvr, slot, parent);
0469 }
0470 
0471 QAction *deselect(const QObject *recvr, const char *slot, QObject *parent)
0472 {
0473     return KStandardAction::create(Deselect, recvr, slot, parent);
0474 }
0475 
0476 QAction *find(const QObject *recvr, const char *slot, QObject *parent)
0477 {
0478     return KStandardAction::create(Find, recvr, slot, parent);
0479 }
0480 
0481 QAction *findNext(const QObject *recvr, const char *slot, QObject *parent)
0482 {
0483     return KStandardAction::create(FindNext, recvr, slot, parent);
0484 }
0485 
0486 QAction *findPrev(const QObject *recvr, const char *slot, QObject *parent)
0487 {
0488     return KStandardAction::create(FindPrev, recvr, slot, parent);
0489 }
0490 
0491 QAction *replace(const QObject *recvr, const char *slot, QObject *parent)
0492 {
0493     return KStandardAction::create(Replace, recvr, slot, parent);
0494 }
0495 
0496 QAction *actualSize(const QObject *recvr, const char *slot, QObject *parent)
0497 {
0498     return KStandardAction::create(ActualSize, recvr, slot, parent);
0499 }
0500 
0501 QAction *fitToPage(const QObject *recvr, const char *slot, QObject *parent)
0502 {
0503     return KStandardAction::create(FitToPage, recvr, slot, parent);
0504 }
0505 
0506 QAction *fitToWidth(const QObject *recvr, const char *slot, QObject *parent)
0507 {
0508     return KStandardAction::create(FitToWidth, recvr, slot, parent);
0509 }
0510 
0511 QAction *fitToHeight(const QObject *recvr, const char *slot, QObject *parent)
0512 {
0513     return KStandardAction::create(FitToHeight, recvr, slot, parent);
0514 }
0515 
0516 QAction *zoomIn(const QObject *recvr, const char *slot, QObject *parent)
0517 {
0518     return KStandardAction::create(ZoomIn, recvr, slot, parent);
0519 }
0520 
0521 QAction *zoomOut(const QObject *recvr, const char *slot, QObject *parent)
0522 {
0523     return KStandardAction::create(ZoomOut, recvr, slot, parent);
0524 }
0525 
0526 QAction *zoom(const QObject *recvr, const char *slot, QObject *parent)
0527 {
0528     return KStandardAction::create(Zoom, recvr, slot, parent);
0529 }
0530 
0531 QAction *redisplay(const QObject *recvr, const char *slot, QObject *parent)
0532 {
0533     return KStandardAction::create(Redisplay, recvr, slot, parent);
0534 }
0535 
0536 QAction *up(const QObject *recvr, const char *slot, QObject *parent)
0537 {
0538     return KStandardAction::create(Up, recvr, slot, parent);
0539 }
0540 
0541 QAction *back(const QObject *recvr, const char *slot, QObject *parent)
0542 {
0543     return KStandardAction::create(Back, recvr, slot, parent);
0544 }
0545 
0546 QAction *forward(const QObject *recvr, const char *slot, QObject *parent)
0547 {
0548     return KStandardAction::create(Forward, recvr, slot, parent);
0549 }
0550 
0551 QAction *home(const QObject *recvr, const char *slot, QObject *parent)
0552 {
0553     return KStandardAction::create(Home, recvr, slot, parent);
0554 }
0555 
0556 QAction *prior(const QObject *recvr, const char *slot, QObject *parent)
0557 {
0558     return KStandardAction::create(Prior, recvr, slot, parent);
0559 }
0560 
0561 QAction *next(const QObject *recvr, const char *slot, QObject *parent)
0562 {
0563     return KStandardAction::create(Next, recvr, slot, parent);
0564 }
0565 
0566 QAction *goTo(const QObject *recvr, const char *slot, QObject *parent)
0567 {
0568     return KStandardAction::create(Goto, recvr, slot, parent);
0569 }
0570 
0571 QAction *gotoPage(const QObject *recvr, const char *slot, QObject *parent)
0572 {
0573     return KStandardAction::create(GotoPage, recvr, slot, parent);
0574 }
0575 
0576 QAction *gotoLine(const QObject *recvr, const char *slot, QObject *parent)
0577 {
0578     return KStandardAction::create(GotoLine, recvr, slot, parent);
0579 }
0580 
0581 QAction *firstPage(const QObject *recvr, const char *slot, QObject *parent)
0582 {
0583     return KStandardAction::create(FirstPage, recvr, slot, parent);
0584 }
0585 
0586 QAction *lastPage(const QObject *recvr, const char *slot, QObject *parent)
0587 {
0588     return KStandardAction::create(LastPage, recvr, slot, parent);
0589 }
0590 
0591 QAction *documentBack(const QObject *recvr, const char *slot, QObject *parent)
0592 {
0593     return KStandardAction::create(DocumentBack, recvr, slot, parent);
0594 }
0595 
0596 QAction *documentForward(const QObject *recvr, const char *slot, QObject *parent)
0597 {
0598     return KStandardAction::create(DocumentForward, recvr, slot, parent);
0599 }
0600 
0601 QAction *addBookmark(const QObject *recvr, const char *slot, QObject *parent)
0602 {
0603     return KStandardAction::create(AddBookmark, recvr, slot, parent);
0604 }
0605 
0606 QAction *editBookmarks(const QObject *recvr, const char *slot, QObject *parent)
0607 {
0608     return KStandardAction::create(EditBookmarks, recvr, slot, parent);
0609 }
0610 
0611 QAction *spelling(const QObject *recvr, const char *slot, QObject *parent)
0612 {
0613     return KStandardAction::create(Spelling, recvr, slot, parent);
0614 }
0615 
0616 static QAction *buildAutomaticAction(QObject *parent, StandardAction id, const char *slot)
0617 {
0618     const KStandardActionInfo *p = infoPtr(id);
0619     if (!p) {
0620         return nullptr;
0621     }
0622 
0623     AutomaticAction *action = new AutomaticAction(QIcon::fromTheme(p->psIconName), p->psLabel.toString(), p->idAccel, slot, parent);
0624 
0625     action->setObjectName(p->psName);
0626     if (!p->psToolTip.isEmpty()) {
0627         action->setToolTip(p->psToolTip.toString());
0628     }
0629 
0630     if (parent && parent->inherits("KActionCollection")) {
0631         QMetaObject::invokeMethod(parent, "addAction", Q_ARG(QString, action->objectName()), Q_ARG(QAction *, action));
0632     }
0633 
0634     return action;
0635 }
0636 
0637 QAction *cut(QObject *parent)
0638 {
0639     return buildAutomaticAction(parent, Cut, SLOT(cut()));
0640 }
0641 
0642 QAction *copy(QObject *parent)
0643 {
0644     return buildAutomaticAction(parent, Copy, SLOT(copy()));
0645 }
0646 
0647 QAction *paste(QObject *parent)
0648 {
0649     return buildAutomaticAction(parent, Paste, SLOT(paste()));
0650 }
0651 
0652 QAction *clear(QObject *parent)
0653 {
0654     return buildAutomaticAction(parent, Clear, SLOT(clear()));
0655 }
0656 
0657 QAction *selectAll(QObject *parent)
0658 {
0659     return buildAutomaticAction(parent, SelectAll, SLOT(selectAll()));
0660 }
0661 
0662 KToggleAction *showMenubar(const QObject *recvr, const char *slot, QObject *parent)
0663 {
0664     QAction *ret = KStandardAction::create(ShowMenubar, recvr, slot, parent);
0665     Q_ASSERT(qobject_cast<KToggleAction *>(ret));
0666     return static_cast<KToggleAction *>(ret);
0667 }
0668 
0669 KToggleAction *showStatusbar(const QObject *recvr, const char *slot, QObject *parent)
0670 {
0671     QAction *ret = KStandardAction::create(ShowStatusbar, recvr, slot, parent);
0672     Q_ASSERT(qobject_cast<KToggleAction *>(ret));
0673     return static_cast<KToggleAction *>(ret);
0674 }
0675 
0676 KToggleFullScreenAction *fullScreen(const QObject *recvr, const char *slot, QWidget *window, QObject *parent)
0677 {
0678     KToggleFullScreenAction *ret;
0679     ret = static_cast<KToggleFullScreenAction *>(KStandardAction::create(FullScreen, recvr, slot, parent));
0680     ret->setWindow(window);
0681 
0682     return ret;
0683 }
0684 
0685 #if KCONFIGWIDGETS_BUILD_DEPRECATED_SINCE(5, 38)
0686 QAction *saveOptions(const QObject *recvr, const char *slot, QObject *parent)
0687 {
0688     return KStandardAction::create(SaveOptions, recvr, slot, parent);
0689 }
0690 #endif
0691 
0692 QAction *keyBindings(const QObject *recvr, const char *slot, QObject *parent)
0693 {
0694     return KStandardAction::create(KeyBindings, recvr, slot, parent);
0695 }
0696 
0697 QAction *preferences(const QObject *recvr, const char *slot, QObject *parent)
0698 {
0699     return KStandardAction::create(Preferences, recvr, slot, parent);
0700 }
0701 
0702 QAction *configureToolbars(const QObject *recvr, const char *slot, QObject *parent)
0703 {
0704     return KStandardAction::create(ConfigureToolbars, recvr, slot, parent);
0705 }
0706 
0707 QAction *configureNotifications(const QObject *recvr, const char *slot, QObject *parent)
0708 {
0709     return KStandardAction::create(ConfigureNotifications, recvr, slot, parent);
0710 }
0711 
0712 #if KCONFIGWIDGETS_BUILD_DEPRECATED_SINCE(5, 38)
0713 QAction *help(const QObject *recvr, const char *slot, QObject *parent)
0714 {
0715     return KStandardAction::create(Help, recvr, slot, parent);
0716 }
0717 #endif
0718 
0719 QAction *helpContents(const QObject *recvr, const char *slot, QObject *parent)
0720 {
0721     return KStandardAction::create(HelpContents, recvr, slot, parent);
0722 }
0723 
0724 QAction *whatsThis(const QObject *recvr, const char *slot, QObject *parent)
0725 {
0726     return KStandardAction::create(WhatsThis, recvr, slot, parent);
0727 }
0728 
0729 QAction *tipOfDay(const QObject *recvr, const char *slot, QObject *parent)
0730 {
0731     return KStandardAction::create(TipofDay, recvr, slot, parent);
0732 }
0733 
0734 QAction *reportBug(const QObject *recvr, const char *slot, QObject *parent)
0735 {
0736     return KStandardAction::create(ReportBug, recvr, slot, parent);
0737 }
0738 
0739 QAction *switchApplicationLanguage(const QObject *recvr, const char *slot, QObject *parent)
0740 {
0741     return KStandardAction::create(SwitchApplicationLanguage, recvr, slot, parent);
0742 }
0743 
0744 QAction *aboutApp(const QObject *recvr, const char *slot, QObject *parent)
0745 {
0746     return KStandardAction::create(AboutApp, recvr, slot, parent);
0747 }
0748 
0749 QAction *aboutKDE(const QObject *recvr, const char *slot, QObject *parent)
0750 {
0751     return KStandardAction::create(AboutKDE, recvr, slot, parent);
0752 }
0753 
0754 QAction *deleteFile(const QObject *recvr, const char *slot, QObject *parent)
0755 {
0756     return KStandardAction::create(DeleteFile, recvr, slot, parent);
0757 }
0758 
0759 QAction *renameFile(const QObject *recvr, const char *slot, QObject *parent)
0760 {
0761     return KStandardAction::create(RenameFile, recvr, slot, parent);
0762 }
0763 
0764 QAction *moveToTrash(const QObject *recvr, const char *slot, QObject *parent)
0765 {
0766     return KStandardAction::create(MoveToTrash, recvr, slot, parent);
0767 }
0768 
0769 QAction *donate(const QObject *recvr, const char *slot, QObject *parent)
0770 {
0771     return KStandardAction::create(Donate, recvr, slot, parent);
0772 }
0773 
0774 KHamburgerMenu *hamburgerMenu(const QObject *recvr, const char *slot, QObject *parent)
0775 {
0776     return static_cast<KHamburgerMenu *>(KStandardAction::create(HamburgerMenu, recvr, slot, parent));
0777 }
0778 
0779 }