MCPcopy Create free account
hub / github.com/KDE/kdevelop / setupActions

Method setupActions

kdevplatform/shell/documentcontroller.cpp:598–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596DocumentController::~DocumentController() = default;
597
598void DocumentController::setupActions()
599{
600 Q_D(DocumentController);
601
602 KActionCollection* ac = Core::self()->uiControllerInternal()->defaultMainWindow()->actionCollection();
603
604 QAction* action;
605
606 action = ac->addAction( QStringLiteral("file_open") );
607 action->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
608 ac->setDefaultShortcut(action, Qt::CTRL | Qt::Key_O);
609 action->setText(i18nc("@action", "&Open..." ) );
610 connect(action, &QAction::triggered,
611 this, [this] { Q_D(DocumentController); d->chooseDocument(); } );
612 action->setToolTip( i18nc("@info:tooltip", "Open file" ) );
613 action->setWhatsThis( i18nc("@info:whatsthis", "Opens a file for editing." ) );
614
615 d->fileOpenRecent = KStandardAction::openRecent(this,
616 SLOT(slotOpenDocument(QUrl)), ac);
617 d->fileOpenRecent->setWhatsThis(i18nc("@info:whatsthis", "This lists files which you have opened recently, and allows you to easily open them again."));
618 d->fileOpenRecent->loadEntries(KConfigGroup(KSharedConfig::openConfig(), QStringLiteral("Recent Files")));
619
620 action = d->saveAll = ac->addAction( QStringLiteral("file_save_all") );
621 action->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
622 action->setText(i18nc("@action", "Save Al&l" ) );
623 connect( action, &QAction::triggered, this, &DocumentController::slotSaveAllDocuments );
624 action->setToolTip( i18nc("@info:tooltip", "Save all open documents" ) );
625 action->setWhatsThis( i18nc("@info:whatsthis", "Save all open documents, prompting for additional information when necessary." ) );
626 ac->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::Key_L));
627 action->setEnabled(false);
628
629 action = d->revertAll = ac->addAction( QStringLiteral("file_revert_all") );
630 action->setIcon(QIcon::fromTheme(QStringLiteral("document-revert")));
631 action->setText(i18nc("@action", "Reload All" ) );
632 connect( action, &QAction::triggered, this, &DocumentController::reloadAllDocuments );
633 action->setToolTip( i18nc("@info:tooltip", "Revert all open documents" ) );
634 action->setWhatsThis( i18nc("@info:whatsthis", "Revert all open documents, returning to the previously saved state." ) );
635 action->setEnabled(false);
636
637 action = d->close = ac->addAction( QStringLiteral("file_close") );
638 action->setIcon(QIcon::fromTheme(QStringLiteral("document-close")));
639 ac->setDefaultShortcut(action, Qt::CTRL | Qt::Key_W);
640 action->setText( i18nc("@action", "&Close" ) );
641 connect( action, &QAction::triggered, this, &DocumentController::fileClose );
642 action->setToolTip( i18nc("@info:tooltip", "Close file" ) );
643 action->setWhatsThis( i18nc("@info:whatsthis", "Closes current file." ) );
644 action->setEnabled(false);
645
646 action = d->closeAll = ac->addAction( QStringLiteral("file_close_all") );
647 action->setIcon(QIcon::fromTheme(QStringLiteral("document-close")));
648 action->setText(i18nc("@action", "Clos&e All" ) );
649 connect( action, &QAction::triggered, this, &DocumentController::closeAllDocuments );
650 action->setToolTip( i18nc("@info:tooltip", "Close all open documents" ) );
651 action->setWhatsThis( i18nc("@info:whatsthis", "Close all open documents, prompting for additional information when necessary." ) );
652 action->setEnabled(false);
653
654 action = d->closeAllOthers = ac->addAction( QStringLiteral("file_closeother") );
655 action->setIcon(QIcon::fromTheme(QStringLiteral("document-close")));

Callers

nothing calls this directly

Calls 10

defaultMainWindowMethod · 0.80
uiControllerInternalMethod · 0.80
setIconMethod · 0.80
chooseDocumentMethod · 0.80
setToolTipMethod · 0.80
KConfigGroupClass · 0.70
actionCollectionMethod · 0.45
addActionMethod · 0.45
setTextMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected