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