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