forked from qt-creator/qt-creator
		
	Core: Replace new "Action" by an "ActionBuilder"
This needs not be stored somewhere but does its work latest at destruction automatically. Change-Id: If929f5a5ccc15b085f110d8d9db8f72ff2a5fac5 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
		@@ -71,175 +71,164 @@ void PresentationModeHandler::showShortcutPopup(const QString &shortcut)
 | 
			
		||||
 | 
			
		||||
namespace Core {
 | 
			
		||||
 | 
			
		||||
class ActionPrivate
 | 
			
		||||
class ActionBuilderPrivate
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    void ensureCommand()
 | 
			
		||||
    ActionBuilderPrivate(QObject *contextActionParent, const Id actionId)
 | 
			
		||||
        : action(new QAction(contextActionParent))
 | 
			
		||||
        , actionId(actionId)
 | 
			
		||||
    {
 | 
			
		||||
        if (!command) {
 | 
			
		||||
            QTC_ASSERT(actionId.isValid(), return);
 | 
			
		||||
            command = ActionManager::registerAction(&action, actionId, context);
 | 
			
		||||
        }
 | 
			
		||||
        command = ActionManager::createCommand(actionId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QAction action;
 | 
			
		||||
    void registerAction()
 | 
			
		||||
    {
 | 
			
		||||
        QTC_ASSERT(actionId.isValid(), return);
 | 
			
		||||
        ActionManager::registerAction(action, actionId, context);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    QAction *action = nullptr;
 | 
			
		||||
    Command *command = nullptr;
 | 
			
		||||
 | 
			
		||||
    Id actionId;
 | 
			
		||||
    Context context{Constants::C_GLOBAL};
 | 
			
		||||
    Command *command = nullptr;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Action::Action()
 | 
			
		||||
    : d(new ActionPrivate)
 | 
			
		||||
ActionBuilder::ActionBuilder(QObject *contextActionParent, const Id actionId)
 | 
			
		||||
    : d(new ActionBuilderPrivate(contextActionParent, actionId))
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Action::~Action()
 | 
			
		||||
ActionBuilder::~ActionBuilder()
 | 
			
		||||
{
 | 
			
		||||
    delete d;
 | 
			
		||||
    d->registerAction();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setText(const QString &text)
 | 
			
		||||
void ActionBuilder::setText(const QString &text)
 | 
			
		||||
{
 | 
			
		||||
    d->action.setText(text);
 | 
			
		||||
    if (d->command)
 | 
			
		||||
        d->command->action()->setText(text);
 | 
			
		||||
    d->action->setText(text);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setCommandAttribute(Command::CommandAttribute attr)
 | 
			
		||||
void ActionBuilder::setCommandAttribute(Command::CommandAttribute attr)
 | 
			
		||||
{
 | 
			
		||||
    d->ensureCommand();
 | 
			
		||||
    QTC_ASSERT(d->command, return);
 | 
			
		||||
    d->command->setAttribute(attr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setContainer(Utils::Id containerId, Utils::Id groupId)
 | 
			
		||||
void ActionBuilder::setCommandDescription(const QString &desc)
 | 
			
		||||
{
 | 
			
		||||
    d->ensureCommand();
 | 
			
		||||
    QTC_ASSERT(d->command, return);
 | 
			
		||||
    if (containerId.isValid()) {
 | 
			
		||||
        ActionContainer *container = ActionManager::actionContainer(containerId);
 | 
			
		||||
        container->addAction(d->command, groupId);
 | 
			
		||||
    }
 | 
			
		||||
    d->command->setDescription(desc);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setOnTriggered(const std::function<void ()> &func)
 | 
			
		||||
void ActionBuilder::setContainer(Id containerId, Id groupId)
 | 
			
		||||
{
 | 
			
		||||
    QObject::connect(&d->action, &QAction::triggered, &d->action, func);
 | 
			
		||||
    QTC_ASSERT(containerId.isValid(), return);
 | 
			
		||||
    ActionContainer *container = ActionManager::actionContainer(containerId);
 | 
			
		||||
    QTC_ASSERT(container, return);
 | 
			
		||||
    container->addAction(d->command, groupId);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setOnTriggered(QObject *guard, const std::function<void()> &func)
 | 
			
		||||
void ActionBuilder::setOnTriggered(const std::function<void ()> &func)
 | 
			
		||||
{
 | 
			
		||||
    QObject::connect(&d->action, &QAction::triggered, guard, func);
 | 
			
		||||
    QObject::connect(d->action, &QAction::triggered, d->action, func);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setOnTriggered(QObject *guard, const std::function<void(bool)> &func)
 | 
			
		||||
void ActionBuilder::setOnTriggered(QObject *guard, const std::function<void()> &func)
 | 
			
		||||
{
 | 
			
		||||
    QObject::connect(&d->action, &QAction::triggered, guard, func);
 | 
			
		||||
    QObject::connect(d->action, &QAction::triggered, guard, func);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setDefaultKeySequence(const QKeySequence &seq)
 | 
			
		||||
void ActionBuilder::setOnTriggered(QObject *guard, const std::function<void(bool)> &func)
 | 
			
		||||
{
 | 
			
		||||
    QObject::connect(d->action, &QAction::triggered, guard, func);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ActionBuilder::setDefaultKeySequence(const QKeySequence &seq)
 | 
			
		||||
{
 | 
			
		||||
    d->ensureCommand();
 | 
			
		||||
    QTC_ASSERT(d->command, return);
 | 
			
		||||
    d->command->setDefaultKeySequence(seq);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setDefaultKeySequence(const QString &mac, const QString &nonMac)
 | 
			
		||||
void ActionBuilder::setDefaultKeySequences(const QList<QKeySequence> &seqs)
 | 
			
		||||
{
 | 
			
		||||
    d->command->setDefaultKeySequences(seqs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ActionBuilder::setDefaultKeySequence(const QString &mac, const QString &nonMac)
 | 
			
		||||
{
 | 
			
		||||
    d->ensureCommand();
 | 
			
		||||
    QTC_ASSERT(d->command, return);
 | 
			
		||||
    d->command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? mac : nonMac));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setIcon(const QIcon &icon)
 | 
			
		||||
void ActionBuilder::setIcon(const QIcon &icon)
 | 
			
		||||
{
 | 
			
		||||
    d->action.setIcon(icon);
 | 
			
		||||
    if (d->command)
 | 
			
		||||
        d->command->action()->setIcon(icon);
 | 
			
		||||
    d->action->setIcon(icon);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setIconVisibleInMenu(bool on)
 | 
			
		||||
void ActionBuilder::setIconVisibleInMenu(bool on)
 | 
			
		||||
{
 | 
			
		||||
    d->action.setIconVisibleInMenu(on);
 | 
			
		||||
    if (d->command)
 | 
			
		||||
        d->command->action()->setIconVisibleInMenu(on);
 | 
			
		||||
    d->action->setIconVisibleInMenu(on);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setTouchBarIcon(const QIcon &icon)
 | 
			
		||||
void ActionBuilder::setTouchBarIcon(const QIcon &icon)
 | 
			
		||||
{
 | 
			
		||||
    d->ensureCommand();
 | 
			
		||||
    QTC_ASSERT(d->command, return);
 | 
			
		||||
    d->command->setTouchBarIcon(icon);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setEnabled(bool on)
 | 
			
		||||
void ActionBuilder::setEnabled(bool on)
 | 
			
		||||
{
 | 
			
		||||
    d->action.setEnabled(on);
 | 
			
		||||
    // Explicitly not needed, done via context update:
 | 
			
		||||
    // if (d->command)
 | 
			
		||||
    //    d->command->action()->...
 | 
			
		||||
    d->action->setEnabled(on);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setChecked(bool on)
 | 
			
		||||
void ActionBuilder::setChecked(bool on)
 | 
			
		||||
{
 | 
			
		||||
    d->action.setChecked(on);
 | 
			
		||||
    // Explicitly not needed, done via context update:
 | 
			
		||||
    // if (d->command)
 | 
			
		||||
    //    d->command->action()->...
 | 
			
		||||
    d->action->setChecked(on);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setVisible(bool on)
 | 
			
		||||
void ActionBuilder::setVisible(bool on)
 | 
			
		||||
{
 | 
			
		||||
    d->action.setVisible(on);
 | 
			
		||||
    // Explicitly not needed, done via context update:
 | 
			
		||||
    // if (d->command)
 | 
			
		||||
    //    d->command->action()->....
 | 
			
		||||
    d->action->setVisible(on);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setCheckable(bool on)
 | 
			
		||||
void ActionBuilder::setCheckable(bool on)
 | 
			
		||||
{
 | 
			
		||||
    d->action.setCheckable(on);
 | 
			
		||||
    if (d->command)
 | 
			
		||||
        d->command->action()->setCheckable(on);
 | 
			
		||||
    d->action->setCheckable(on);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setMenuRole(QAction::MenuRole role)
 | 
			
		||||
void ActionBuilder::setMenuRole(QAction::MenuRole role)
 | 
			
		||||
{
 | 
			
		||||
    d->action.setMenuRole(role);
 | 
			
		||||
    if (d->command)
 | 
			
		||||
        d->command->action()->setMenuRole(role);
 | 
			
		||||
    d->action->setMenuRole(role);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Command *Action::command() const
 | 
			
		||||
Command *ActionBuilder::command() const
 | 
			
		||||
{
 | 
			
		||||
    d->ensureCommand();
 | 
			
		||||
    QTC_CHECK(d->command);
 | 
			
		||||
    return d->command;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QAction *Action::commandAction() const
 | 
			
		||||
QAction *ActionBuilder::commandAction() const
 | 
			
		||||
{
 | 
			
		||||
    d->ensureCommand();
 | 
			
		||||
    QTC_ASSERT(d->command, return nullptr);
 | 
			
		||||
    return d->command->action();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QAction *Action::contextAction() const
 | 
			
		||||
QAction *ActionBuilder::contextAction() const
 | 
			
		||||
{
 | 
			
		||||
    return &d->action;
 | 
			
		||||
    return d->action;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setId(Id id)
 | 
			
		||||
void ActionBuilder::bindContextAction(QAction **dest)
 | 
			
		||||
{
 | 
			
		||||
    QTC_ASSERT(dest, return);
 | 
			
		||||
    *dest = d->action;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ActionBuilder::setId(Id id)
 | 
			
		||||
{
 | 
			
		||||
    d->actionId = id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setContext(Id id)
 | 
			
		||||
void ActionBuilder::setContext(Id id)
 | 
			
		||||
{
 | 
			
		||||
    d->context = Context(id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Action::setContext(const Context &context)
 | 
			
		||||
void ActionBuilder::setContext(const Context &context)
 | 
			
		||||
{
 | 
			
		||||
    QTC_ASSERT(!context.isEmpty(), return);
 | 
			
		||||
    d->context = context;
 | 
			
		||||
@@ -484,6 +473,21 @@ Command *ActionManager::registerAction(QAction *action, Id id, const Context &co
 | 
			
		||||
    return cmd;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
    Creates a Command or returns an existing Command with the specified \a id.
 | 
			
		||||
 | 
			
		||||
    The created command doesn't have any actions associated with it yet, so
 | 
			
		||||
    it cannot actually be triggered.
 | 
			
		||||
    But the system is aware of it, it appears in the keyboard shortcut
 | 
			
		||||
    settings, and QActions can later be registered for it.
 | 
			
		||||
    If you already have a QAction, ID and Context that you want to register,
 | 
			
		||||
    there is no need to call this. Just directly call registerAction().
 | 
			
		||||
*/
 | 
			
		||||
Command *ActionManager::createCommand(Utils::Id id)
 | 
			
		||||
{
 | 
			
		||||
    return d->overridableAction(id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
    Returns the Command instance that has been created with registerAction()
 | 
			
		||||
    for the specified \a id.
 | 
			
		||||
 
 | 
			
		||||
@@ -26,22 +26,24 @@ class ICorePrivate;
 | 
			
		||||
class MainWindow;
 | 
			
		||||
} // Internal
 | 
			
		||||
 | 
			
		||||
class CORE_EXPORT Action
 | 
			
		||||
class CORE_EXPORT ActionBuilder
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    Action();
 | 
			
		||||
    ~Action();
 | 
			
		||||
    ActionBuilder(QObject *contextActionParent, const Utils::Id actionId = {});
 | 
			
		||||
    ~ActionBuilder();
 | 
			
		||||
 | 
			
		||||
    void setId(Utils::Id id);
 | 
			
		||||
    void setContext(const Utils::Id id);
 | 
			
		||||
    void setContext(const Core::Context &context);
 | 
			
		||||
    void setText(const QString &text);
 | 
			
		||||
    void setCommandAttribute(Core::Command::CommandAttribute attr);
 | 
			
		||||
    void setCommandDescription(const QString &desc);
 | 
			
		||||
    void setContainer(Utils::Id containerId, Utils::Id groupId = {});
 | 
			
		||||
    void setOnTriggered(const std::function<void()> &func);
 | 
			
		||||
    void setOnTriggered(QObject *guard, const std::function<void()> &func);
 | 
			
		||||
    void setOnTriggered(QObject *guard, const std::function<void(bool)> &func);
 | 
			
		||||
    void setDefaultKeySequence(const QKeySequence &seq);
 | 
			
		||||
    void setDefaultKeySequences(const QList<QKeySequence> &seqs);
 | 
			
		||||
    void setDefaultKeySequence(const QString &mac, const QString &nonMac);
 | 
			
		||||
    void setIcon(const QIcon &icon);
 | 
			
		||||
    void setIconVisibleInMenu(bool on);
 | 
			
		||||
@@ -55,9 +57,10 @@ public:
 | 
			
		||||
    Command *command() const;
 | 
			
		||||
    QAction *commandAction() const;
 | 
			
		||||
    QAction *contextAction() const;
 | 
			
		||||
    void bindContextAction(QAction **dest);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    class ActionPrivate *d = nullptr;
 | 
			
		||||
    class ActionBuilderPrivate *d = nullptr;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class CORE_EXPORT Menu
 | 
			
		||||
@@ -96,6 +99,7 @@ public:
 | 
			
		||||
                                   const Context &context = Context(Constants::C_GLOBAL),
 | 
			
		||||
                                   bool scriptable = false);
 | 
			
		||||
 | 
			
		||||
    static Command *createCommand(Utils::Id id);
 | 
			
		||||
    static Command *command(Utils::Id id);
 | 
			
		||||
    static ActionContainer *actionContainer(Utils::Id id);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -321,15 +321,7 @@ public:
 | 
			
		||||
    SystemEditor *m_systemEditor = nullptr;
 | 
			
		||||
 | 
			
		||||
    // actions
 | 
			
		||||
    QAction *m_focusToEditor = nullptr;
 | 
			
		||||
    QAction *m_newAction = nullptr;
 | 
			
		||||
    QAction *m_openAction = nullptr;
 | 
			
		||||
    QAction *m_openWithAction = nullptr;
 | 
			
		||||
    QAction *m_openFromDeviceAction = nullptr;
 | 
			
		||||
    QAction *m_saveAllAction = nullptr;
 | 
			
		||||
    QAction *m_exitAction = nullptr;
 | 
			
		||||
    QAction *m_optionsAction = nullptr;
 | 
			
		||||
    QAction *m_loggerAction = nullptr;
 | 
			
		||||
    QAction *m_toggleLeftSideBarAction = nullptr;
 | 
			
		||||
    QAction *m_toggleRightSideBarAction = nullptr;
 | 
			
		||||
    QAction *m_toggleMenubarAction = nullptr;
 | 
			
		||||
@@ -338,11 +330,6 @@ public:
 | 
			
		||||
    QAction *m_setModeSelectorStyleHiddenAction = nullptr;
 | 
			
		||||
    QAction *m_setModeSelectorStyleIconsOnlyAction = nullptr;
 | 
			
		||||
 | 
			
		||||
    Action m_aboutIdeAction;
 | 
			
		||||
    Action m_aboutPluginsAction;
 | 
			
		||||
    Action m_changeLogAction;
 | 
			
		||||
    Action m_contactAction;
 | 
			
		||||
 | 
			
		||||
    QToolButton *m_toggleLeftSideBarButton = nullptr;
 | 
			
		||||
    QToolButton *m_toggleRightSideBarButton = nullptr;
 | 
			
		||||
    QList<std::function<bool()>> m_preCloseListeners;
 | 
			
		||||
@@ -1569,19 +1556,18 @@ void ICorePrivate::registerDefaultActions()
 | 
			
		||||
 | 
			
		||||
    // Return to editor shortcut: Note this requires Qt to fix up
 | 
			
		||||
    // handling of shortcut overrides in menus, item views, combos....
 | 
			
		||||
    m_focusToEditor = new QAction(Tr::tr("Return to Editor"), this);
 | 
			
		||||
    Command *cmd = ActionManager::registerAction(m_focusToEditor, Constants::S_RETURNTOEDITOR);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(Qt::Key_Escape));
 | 
			
		||||
    connect(m_focusToEditor, &QAction::triggered, this, &ICorePrivate::setFocusToEditor);
 | 
			
		||||
    ActionBuilder focusToEditor(this, Constants::S_RETURNTOEDITOR);
 | 
			
		||||
    focusToEditor.setText(Tr::tr("Return to Editor"));
 | 
			
		||||
    focusToEditor.setDefaultKeySequence(QKeySequence(Qt::Key_Escape));
 | 
			
		||||
    focusToEditor.setOnTriggered(this, [] { setFocusToEditor(); });
 | 
			
		||||
 | 
			
		||||
    // New File Action
 | 
			
		||||
    QIcon icon = Icon::fromTheme("document-new");
 | 
			
		||||
 | 
			
		||||
    m_newAction = new QAction(icon, Tr::tr("&New Project..."), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(m_newAction, Constants::NEW);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+N"));
 | 
			
		||||
    mfile->addAction(cmd, Constants::G_FILE_NEW);
 | 
			
		||||
    connect(m_newAction, &QAction::triggered, this, [] {
 | 
			
		||||
    // New Project Action
 | 
			
		||||
    ActionBuilder newProjectAction(this, Constants::NEW);
 | 
			
		||||
    newProjectAction.setText(Tr::tr("&New Project..."));
 | 
			
		||||
    newProjectAction.setIcon(Icon::fromTheme("document-new"));
 | 
			
		||||
    newProjectAction.setDefaultKeySequence(QKeySequence("Ctrl+Shift+N"));
 | 
			
		||||
    newProjectAction.setContainer(Constants::M_FILE, Constants::G_FILE_NEW);
 | 
			
		||||
    newProjectAction.setOnTriggered(this, [] {
 | 
			
		||||
        if (!ICore::isNewItemDialogRunning()) {
 | 
			
		||||
            ICore::showNewItemDialog(
 | 
			
		||||
                Tr::tr("New Project", "Title of dialog"),
 | 
			
		||||
@@ -1594,42 +1580,45 @@ void ICorePrivate::registerDefaultActions()
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    auto action = new QAction(icon, Tr::tr("New File..."), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(action, Constants::NEW_FILE);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::New);
 | 
			
		||||
    mfile->addAction(cmd, Constants::G_FILE_NEW);
 | 
			
		||||
    connect(action, &QAction::triggered, this, [] {
 | 
			
		||||
    // New File Action
 | 
			
		||||
    ActionBuilder newFileAction(this, Constants::NEW_FILE);
 | 
			
		||||
    newFileAction.setText(Tr::tr("New File..."));
 | 
			
		||||
    newFileAction.setIcon(Icon::fromTheme("document-new"));
 | 
			
		||||
    newFileAction.setDefaultKeySequence(QKeySequence::New);
 | 
			
		||||
    newFileAction.setContainer(Constants::M_FILE, Constants::G_FILE_NEW);
 | 
			
		||||
    newFileAction.setOnTriggered(this, [] {
 | 
			
		||||
        if (!ICore::isNewItemDialogRunning()) {
 | 
			
		||||
            ICore::showNewItemDialog(Tr::tr("New File", "Title of dialog"),
 | 
			
		||||
                                     Utils::filtered(Core::IWizardFactory::allWizardFactories(),
 | 
			
		||||
                                                     Utils::equal(&Core::IWizardFactory::kind,
 | 
			
		||||
                                                                  Core::IWizardFactory::FileWizard)),
 | 
			
		||||
                                     FilePath());
 | 
			
		||||
            ICore::showNewItemDialog(
 | 
			
		||||
                Tr::tr("New File", "Title of dialog"),
 | 
			
		||||
                Utils::filtered(Core::IWizardFactory::allWizardFactories(),
 | 
			
		||||
                                Utils::equal(&Core::IWizardFactory::kind,
 | 
			
		||||
                                             Core::IWizardFactory::FileWizard)),
 | 
			
		||||
                FilePath());
 | 
			
		||||
        } else {
 | 
			
		||||
            ICore::raiseWindow(ICore::newItemDialog());
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Open Action
 | 
			
		||||
    icon = Icon::fromTheme("document-open");
 | 
			
		||||
    m_openAction = new QAction(icon, Tr::tr("&Open File or Project..."), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(m_openAction, Constants::OPEN);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Open);
 | 
			
		||||
    mfile->addAction(cmd, Constants::G_FILE_OPEN);
 | 
			
		||||
    connect(m_openAction, &QAction::triggered, this, &ICorePrivate::openFile);
 | 
			
		||||
    ActionBuilder openAction(this, Constants::OPEN);
 | 
			
		||||
    openAction.setText(Tr::tr("&Open File or Project..."));
 | 
			
		||||
    openAction.setIcon(Icon::fromTheme("document-open"));
 | 
			
		||||
    openAction.setDefaultKeySequence(QKeySequence::Open);
 | 
			
		||||
    openAction.setContainer(Constants::M_FILE, Constants::G_FILE_OPEN);
 | 
			
		||||
    openAction.setOnTriggered(this, [] { openFile(); });
 | 
			
		||||
 | 
			
		||||
    // Open With Action
 | 
			
		||||
    m_openWithAction = new QAction(Tr::tr("Open File &With..."), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(m_openWithAction, Constants::OPEN_WITH);
 | 
			
		||||
    mfile->addAction(cmd, Constants::G_FILE_OPEN);
 | 
			
		||||
    connect(m_openWithAction, &QAction::triggered, m_core, &ICore::openFileWith);
 | 
			
		||||
    ActionBuilder openWithAction(this, Constants::OPEN_WITH);
 | 
			
		||||
    openWithAction.setText(Tr::tr("Open File &With..."));
 | 
			
		||||
    openWithAction.setContainer(Constants::M_FILE, Constants::G_FILE_OPEN);
 | 
			
		||||
    openWithAction.setOnTriggered(this, &ICore::openFileWith);
 | 
			
		||||
 | 
			
		||||
    if (FSEngine::isAvailable()) {
 | 
			
		||||
        // Open From Device Action
 | 
			
		||||
        m_openFromDeviceAction = new QAction(Tr::tr("Open From Device..."), this);
 | 
			
		||||
        cmd = ActionManager::registerAction(m_openFromDeviceAction, Constants::OPEN_FROM_DEVICE);
 | 
			
		||||
        mfile->addAction(cmd, Constants::G_FILE_OPEN);
 | 
			
		||||
        connect(m_openFromDeviceAction, &QAction::triggered, this, &ICorePrivate::openFileFromDevice);
 | 
			
		||||
        ActionBuilder openFromDeviceAction(this, Constants::OPEN_FROM_DEVICE);
 | 
			
		||||
        openFromDeviceAction.setText(Tr::tr("Open From Device..."));
 | 
			
		||||
        openFromDeviceAction.setContainer(Constants::M_FILE, Constants::G_FILE_OPEN);
 | 
			
		||||
        openFromDeviceAction.setOnTriggered(this, [this] { openFileFromDevice(); });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // File->Recent Files Menu
 | 
			
		||||
@@ -1639,128 +1628,128 @@ void ICorePrivate::registerDefaultActions()
 | 
			
		||||
    ac->setOnAllDisabledBehavior(ActionContainer::Show);
 | 
			
		||||
 | 
			
		||||
    // Save Action
 | 
			
		||||
    icon = Icon::fromTheme("document-save");
 | 
			
		||||
    QAction *tmpaction = new QAction(icon, Tr::tr("&Save"), this);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::SAVE);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Save);
 | 
			
		||||
    cmd->setAttribute(Command::CA_UpdateText);
 | 
			
		||||
    cmd->setDescription(Tr::tr("Save"));
 | 
			
		||||
    mfile->addAction(cmd, Constants::G_FILE_SAVE);
 | 
			
		||||
    ActionBuilder saveAction(this, Constants::SAVE);
 | 
			
		||||
    saveAction.setText(Tr::tr("&Save"));
 | 
			
		||||
    saveAction.setIcon(Icon::fromTheme("document-save"));
 | 
			
		||||
    saveAction.setEnabled(false);
 | 
			
		||||
    saveAction.setDefaultKeySequence(QKeySequence::Save);
 | 
			
		||||
    saveAction.setCommandAttribute(Command::CA_UpdateText);
 | 
			
		||||
    saveAction.setCommandDescription(Tr::tr("Save"));
 | 
			
		||||
    saveAction.setContainer(Constants::M_FILE, Constants::G_FILE_SAVE);
 | 
			
		||||
 | 
			
		||||
    // Save As Action
 | 
			
		||||
    icon = Icon::fromTheme("document-save-as");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("Save &As..."), this);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::SAVEAS);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Shift+S") : QString()));
 | 
			
		||||
    cmd->setAttribute(Command::CA_UpdateText);
 | 
			
		||||
    cmd->setDescription(Tr::tr("Save As..."));
 | 
			
		||||
    mfile->addAction(cmd, Constants::G_FILE_SAVE);
 | 
			
		||||
    ActionBuilder saveAsAction(this, Constants::SAVEAS);
 | 
			
		||||
    saveAsAction.setText(Tr::tr("Save &As..."));
 | 
			
		||||
    saveAsAction.setIcon(Icon::fromTheme("document-save-as"));
 | 
			
		||||
    saveAsAction.setEnabled(false);
 | 
			
		||||
    saveAsAction.setDefaultKeySequence(Tr::tr("Ctrl+Shift+S"), QString());
 | 
			
		||||
    saveAsAction.setCommandAttribute(Command::CA_UpdateText);
 | 
			
		||||
    saveAsAction.setCommandDescription(Tr::tr("Save As..."));
 | 
			
		||||
    saveAsAction.setContainer(Constants::M_FILE, Constants::G_FILE_SAVE);
 | 
			
		||||
 | 
			
		||||
    // SaveAll Action
 | 
			
		||||
    DocumentManager::registerSaveAllAction();
 | 
			
		||||
 | 
			
		||||
    // Print Action
 | 
			
		||||
    icon = Icon::fromTheme("document-print");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("&Print..."), this);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::PRINT);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Print);
 | 
			
		||||
    mfile->addAction(cmd, Constants::G_FILE_PRINT);
 | 
			
		||||
    ActionBuilder printAction(this, Constants::PRINT);
 | 
			
		||||
    printAction.setText(Tr::tr("&Print..."));
 | 
			
		||||
    printAction.setIcon(Icon::fromTheme("document-print"));
 | 
			
		||||
    printAction.setEnabled(false);
 | 
			
		||||
    printAction.setDefaultKeySequence(QKeySequence::Print);
 | 
			
		||||
    printAction.setContainer(Constants::M_FILE, Constants::G_FILE_PRINT);
 | 
			
		||||
 | 
			
		||||
    // Exit Action
 | 
			
		||||
    icon = Icon::fromTheme("application-exit");
 | 
			
		||||
    m_exitAction = new QAction(icon, Tr::tr("E&xit"), this);
 | 
			
		||||
    m_exitAction->setMenuRole(QAction::QuitRole);
 | 
			
		||||
    cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+Q")));
 | 
			
		||||
    mfile->addAction(cmd, Constants::G_FILE_OTHER);
 | 
			
		||||
    connect(m_exitAction, &QAction::triggered, m_core, &ICore::exit);
 | 
			
		||||
    ActionBuilder exitAction(this, Constants::EXIT);
 | 
			
		||||
    exitAction.setText(Tr::tr("E&xit"));
 | 
			
		||||
    exitAction.setIcon(Icon::fromTheme("application-exit"));
 | 
			
		||||
    exitAction.setMenuRole(QAction::QuitRole);
 | 
			
		||||
    exitAction.setDefaultKeySequence(Tr::tr("Ctrl+Q"));
 | 
			
		||||
    exitAction.setContainer(Constants::M_FILE, Constants::G_FILE_OTHER);
 | 
			
		||||
    exitAction.setOnTriggered(this, &ICore::exit);
 | 
			
		||||
 | 
			
		||||
    // Undo Action
 | 
			
		||||
    icon = Icon::fromTheme("edit-undo");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("&Undo"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::UNDO);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Undo);
 | 
			
		||||
    cmd->setAttribute(Command::CA_UpdateText);
 | 
			
		||||
    cmd->setDescription(Tr::tr("Undo"));
 | 
			
		||||
    medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder undoAction(this, Constants::UNDO);
 | 
			
		||||
    undoAction.setText(Tr::tr("&Undo"));
 | 
			
		||||
    undoAction.setIcon(Icon::fromTheme("edit-undo"));
 | 
			
		||||
    undoAction.setDefaultKeySequence(QKeySequence::Undo);
 | 
			
		||||
    undoAction.setCommandAttribute(Command::CA_UpdateText);
 | 
			
		||||
    undoAction.setCommandDescription(Tr::tr("Undo"));
 | 
			
		||||
    undoAction.setContainer(Constants::M_EDIT, Constants::G_EDIT_UNDOREDO);
 | 
			
		||||
    undoAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Redo Action
 | 
			
		||||
    icon = Icon::fromTheme("edit-redo");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("&Redo"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::REDO);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Redo);
 | 
			
		||||
    cmd->setAttribute(Command::CA_UpdateText);
 | 
			
		||||
    cmd->setDescription(Tr::tr("Redo"));
 | 
			
		||||
    medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder redoAction(this, Constants::REDO);
 | 
			
		||||
    redoAction.setIcon(Icon::fromTheme("edit-redo"));
 | 
			
		||||
    redoAction.setText(Tr::tr("&Redo"));
 | 
			
		||||
    redoAction.setDefaultKeySequence(QKeySequence::Redo);
 | 
			
		||||
    redoAction.setCommandAttribute(Command::CA_UpdateText);
 | 
			
		||||
    redoAction.setCommandDescription(Tr::tr("Redo"));
 | 
			
		||||
    redoAction.setContainer(Constants::M_EDIT, Constants::G_EDIT_UNDOREDO);
 | 
			
		||||
    redoAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Cut Action
 | 
			
		||||
    icon = Icon::fromTheme("edit-cut");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("Cu&t"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::CUT);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Cut);
 | 
			
		||||
    medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder cutAction(this, Constants::CUT);
 | 
			
		||||
    cutAction.setText(Tr::tr("Cu&t"));
 | 
			
		||||
    cutAction.setIcon(Icon::fromTheme("edit-cut"));
 | 
			
		||||
    cutAction.setDefaultKeySequence(QKeySequence::Cut);
 | 
			
		||||
    cutAction.setContainer(Constants::M_EDIT, Constants::G_EDIT_COPYPASTE);
 | 
			
		||||
    cutAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Copy Action
 | 
			
		||||
    icon = Icon::fromTheme("edit-copy");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("&Copy"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::COPY);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Copy);
 | 
			
		||||
    medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder copyAction(this, Constants::COPY);
 | 
			
		||||
    copyAction.setText(Tr::tr("&Copy"));
 | 
			
		||||
    copyAction.setIcon(Icon::fromTheme("edit-copy"));
 | 
			
		||||
    copyAction.setDefaultKeySequence(QKeySequence::Copy);
 | 
			
		||||
    copyAction.setContainer(Constants::M_EDIT, Constants::G_EDIT_COPYPASTE);
 | 
			
		||||
    copyAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Paste Action
 | 
			
		||||
    icon = Icon::fromTheme("edit-paste");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("&Paste"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::PASTE);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Paste);
 | 
			
		||||
    medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder pasteAction(this, Constants::PASTE);
 | 
			
		||||
    pasteAction.setText(Tr::tr("&Paste"));
 | 
			
		||||
    pasteAction.setIcon(Icon::fromTheme("edit-paste"));
 | 
			
		||||
    pasteAction.setDefaultKeySequence(QKeySequence::Paste);
 | 
			
		||||
    pasteAction.setContainer(Constants::M_EDIT, Constants::G_EDIT_COPYPASTE);
 | 
			
		||||
    pasteAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Select All
 | 
			
		||||
    icon = Icon::fromTheme("edit-select-all");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("Select &All"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::SELECTALL);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::SelectAll);
 | 
			
		||||
    medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder selectAllAction(this, Constants::SELECTALL);
 | 
			
		||||
    selectAllAction.setText(Tr::tr("Select &All"));
 | 
			
		||||
    selectAllAction.setIcon(Icon::fromTheme("edit-select-all"));
 | 
			
		||||
    selectAllAction.setDefaultKeySequence(QKeySequence::SelectAll);
 | 
			
		||||
    selectAllAction.setContainer(Constants::M_EDIT, Constants::G_EDIT_SELECTALL);
 | 
			
		||||
    selectAllAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Goto Action
 | 
			
		||||
    icon = Icon::fromTheme("go-jump");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("&Go to Line..."), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::GOTO);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+L")));
 | 
			
		||||
    medit->addAction(cmd, Constants::G_EDIT_OTHER);
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder gotoLineAction(this, Constants::GOTO);
 | 
			
		||||
    gotoLineAction.setText(Tr::tr("&Go to Line..."));
 | 
			
		||||
    gotoLineAction.setIcon(Icon::fromTheme("go-jump"));
 | 
			
		||||
    gotoLineAction.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+L")));
 | 
			
		||||
    gotoLineAction.setContainer(Constants::M_EDIT, Constants::G_EDIT_OTHER);
 | 
			
		||||
    gotoLineAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Zoom In Action
 | 
			
		||||
    icon = Icon::fromTheme("zoom-in");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("Zoom In"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_IN);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl++")));
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder zoomInAction(this, Constants::ZOOM_IN);
 | 
			
		||||
    zoomInAction.setText(Tr::tr("Zoom In"));
 | 
			
		||||
    zoomInAction.setIcon(Icon::fromTheme("zoom-in"));
 | 
			
		||||
    zoomInAction.setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl++")));
 | 
			
		||||
    zoomInAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Zoom Out Action
 | 
			
		||||
    icon = Icon::fromTheme("zoom-out");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("Zoom Out"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_OUT);
 | 
			
		||||
    ActionBuilder zoomOutAction(this, Constants::ZOOM_OUT);
 | 
			
		||||
    zoomOutAction.setText(Tr::tr("Zoom Out"));
 | 
			
		||||
    zoomOutAction.setIcon(Icon::fromTheme("zoom-out"));
 | 
			
		||||
    if (useMacShortcuts)
 | 
			
		||||
        cmd->setDefaultKeySequences({QKeySequence(Tr::tr("Ctrl+-")), QKeySequence(Tr::tr("Ctrl+Shift+-"))});
 | 
			
		||||
        zoomOutAction.setDefaultKeySequences({QKeySequence(Tr::tr("Ctrl+-")), QKeySequence(Tr::tr("Ctrl+Shift+-"))});
 | 
			
		||||
    else
 | 
			
		||||
        cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+-")));
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
        zoomOutAction.setDefaultKeySequence(Tr::tr("Ctrl+-"));
 | 
			
		||||
    zoomOutAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Zoom Reset Action
 | 
			
		||||
    icon = Icon::fromTheme("zoom-original");
 | 
			
		||||
    tmpaction = new QAction(icon, Tr::tr("Original Size"), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(tmpaction, Constants::ZOOM_RESET);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+0") : Tr::tr("Ctrl+0")));
 | 
			
		||||
    tmpaction->setEnabled(false);
 | 
			
		||||
    ActionBuilder zoomOriginalAction(this, Constants::ZOOM_RESET);
 | 
			
		||||
    zoomOriginalAction.setText(Tr::tr("Original Size"));
 | 
			
		||||
    zoomOriginalAction.setIcon(Icon::fromTheme("zoom-original"));
 | 
			
		||||
    zoomOriginalAction.setDefaultKeySequence(Tr::tr("Meta+0"), Tr::tr("Ctrl+0"));
 | 
			
		||||
    zoomOriginalAction.setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Debug Qt Creator menu
 | 
			
		||||
    mtools->appendGroup(Constants::G_TOOLS_DEBUG);
 | 
			
		||||
@@ -1768,21 +1757,21 @@ void ICorePrivate::registerDefaultActions()
 | 
			
		||||
    mtoolsdebug->menu()->setTitle(Tr::tr("Debug %1").arg(QGuiApplication::applicationDisplayName()));
 | 
			
		||||
    mtools->addMenu(mtoolsdebug, Constants::G_TOOLS_DEBUG);
 | 
			
		||||
 | 
			
		||||
    m_loggerAction = new QAction(Tr::tr("Show Logs..."), this);
 | 
			
		||||
    cmd = ActionManager::registerAction(m_loggerAction, Constants::LOGGER);
 | 
			
		||||
    mtoolsdebug->addAction(cmd);
 | 
			
		||||
    connect(m_loggerAction, &QAction::triggered, this, [] { LoggingViewer::showLoggingView(); });
 | 
			
		||||
    ActionBuilder loggerAction(this, Constants::LOGGER);
 | 
			
		||||
    loggerAction.setText(Tr::tr("Show Logs..."));
 | 
			
		||||
    loggerAction.setContainer(Constants::M_TOOLS_DEBUG);
 | 
			
		||||
    loggerAction.setOnTriggered(this, &LoggingViewer::showLoggingView);
 | 
			
		||||
 | 
			
		||||
    // Options Action
 | 
			
		||||
    medit->appendGroup(Constants::G_EDIT_PREFERENCES);
 | 
			
		||||
    medit->addSeparator(Constants::G_EDIT_PREFERENCES);
 | 
			
		||||
 | 
			
		||||
    m_optionsAction = new QAction(Tr::tr("Pr&eferences..."), this);
 | 
			
		||||
    m_optionsAction->setMenuRole(QAction::PreferencesRole);
 | 
			
		||||
    cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence::Preferences);
 | 
			
		||||
    medit->addAction(cmd, Constants::G_EDIT_PREFERENCES);
 | 
			
		||||
    connect(m_optionsAction, &QAction::triggered, this, [] { ICore::showOptionsDialog(Id()); });
 | 
			
		||||
    ActionBuilder optionsAction(this, Constants::OPTIONS);
 | 
			
		||||
    optionsAction.setText(Tr::tr("Pr&eferences..."));
 | 
			
		||||
    optionsAction.setMenuRole(QAction::PreferencesRole);
 | 
			
		||||
    optionsAction.setDefaultKeySequence(QKeySequence::Preferences);
 | 
			
		||||
    optionsAction.setContainer(Constants::M_EDIT, Constants::G_EDIT_PREFERENCES);
 | 
			
		||||
    optionsAction.setOnTriggered(this, [] { ICore::showOptionsDialog(Id()); });
 | 
			
		||||
 | 
			
		||||
    mwindow->addSeparator(Constants::G_WINDOW_LIST);
 | 
			
		||||
 | 
			
		||||
@@ -1790,7 +1779,7 @@ void ICorePrivate::registerDefaultActions()
 | 
			
		||||
        // Minimize Action
 | 
			
		||||
        QAction *minimizeAction = new QAction(Tr::tr("Minimize"), this);
 | 
			
		||||
        minimizeAction->setEnabled(false); // actual implementation in WindowSupport
 | 
			
		||||
        cmd = ActionManager::registerAction(minimizeAction, Constants::MINIMIZE_WINDOW);
 | 
			
		||||
        Command *cmd = ActionManager::registerAction(minimizeAction, Constants::MINIMIZE_WINDOW);
 | 
			
		||||
        cmd->setDefaultKeySequence(QKeySequence(Tr::tr("Ctrl+M")));
 | 
			
		||||
        mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
 | 
			
		||||
 | 
			
		||||
@@ -1805,7 +1794,7 @@ void ICorePrivate::registerDefaultActions()
 | 
			
		||||
    QAction *toggleFullScreenAction = new QAction(Tr::tr("Full Screen"), this);
 | 
			
		||||
    toggleFullScreenAction->setCheckable(!HostOsInfo::isMacHost());
 | 
			
		||||
    toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport
 | 
			
		||||
    cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN);
 | 
			
		||||
    Command *cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Meta+F") : Tr::tr("Ctrl+Shift+F11")));
 | 
			
		||||
    if (HostOsInfo::isMacHost())
 | 
			
		||||
        cmd->setAttribute(Command::CA_UpdateText);
 | 
			
		||||
@@ -1824,36 +1813,36 @@ void ICorePrivate::registerDefaultActions()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Show Left Sidebar Action
 | 
			
		||||
    m_toggleLeftSideBarAction = new QAction(Utils::Icons::TOGGLE_LEFT_SIDEBAR.icon(),
 | 
			
		||||
                                            Tr::tr(Constants::TR_SHOW_LEFT_SIDEBAR),
 | 
			
		||||
                                            this);
 | 
			
		||||
    m_toggleLeftSideBarAction->setCheckable(true);
 | 
			
		||||
    cmd = ActionManager::registerAction(m_toggleLeftSideBarAction, Constants::TOGGLE_LEFT_SIDEBAR);
 | 
			
		||||
    cmd->setAttribute(Command::CA_UpdateText);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+0") : Tr::tr("Alt+0")));
 | 
			
		||||
    connect(m_toggleLeftSideBarAction, &QAction::triggered,
 | 
			
		||||
            this, [this](bool visible) { setSidebarVisible(visible, Side::Left); });
 | 
			
		||||
    ProxyAction *toggleLeftSideBarProxyAction =
 | 
			
		||||
            ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::TOGGLE_LEFT_SIDEBAR_TOOLBAR.icon());
 | 
			
		||||
    m_toggleLeftSideBarButton->setDefaultAction(toggleLeftSideBarProxyAction);
 | 
			
		||||
    mview->addAction(cmd, Constants::G_VIEW_VIEWS);
 | 
			
		||||
    m_toggleLeftSideBarAction->setEnabled(false);
 | 
			
		||||
    ActionBuilder toggleLeftSideBarAction(this, Constants::TOGGLE_LEFT_SIDEBAR);
 | 
			
		||||
    toggleLeftSideBarAction.setIcon(Utils::Icons::TOGGLE_LEFT_SIDEBAR.icon());
 | 
			
		||||
    toggleLeftSideBarAction.setText(Tr::tr(Constants::TR_SHOW_LEFT_SIDEBAR));
 | 
			
		||||
    toggleLeftSideBarAction.setCheckable(true);
 | 
			
		||||
    toggleLeftSideBarAction.setCommandAttribute(Command::CA_UpdateText);
 | 
			
		||||
    toggleLeftSideBarAction.setDefaultKeySequence(Tr::tr("Ctrl+0"), Tr::tr("Alt+0"));
 | 
			
		||||
    toggleLeftSideBarAction.setContainer(Constants::M_VIEW, Constants::G_VIEW_VIEWS);
 | 
			
		||||
    toggleLeftSideBarAction.setOnTriggered(this,
 | 
			
		||||
        [this](bool visible) { setSidebarVisible(visible, Side::Left); });
 | 
			
		||||
 | 
			
		||||
    m_toggleLeftSideBarAction = toggleLeftSideBarAction.contextAction();
 | 
			
		||||
    m_toggleLeftSideBarButton->setDefaultAction(ProxyAction::proxyActionWithIcon(
 | 
			
		||||
        toggleLeftSideBarAction.commandAction(), Utils::Icons::TOGGLE_LEFT_SIDEBAR_TOOLBAR.icon()));
 | 
			
		||||
    m_toggleLeftSideBarButton->setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    // Show Right Sidebar Action
 | 
			
		||||
    m_toggleRightSideBarAction = new QAction(Utils::Icons::TOGGLE_RIGHT_SIDEBAR.icon(),
 | 
			
		||||
                                             Tr::tr(Constants::TR_SHOW_RIGHT_SIDEBAR),
 | 
			
		||||
                                             this);
 | 
			
		||||
    m_toggleRightSideBarAction->setCheckable(true);
 | 
			
		||||
    cmd = ActionManager::registerAction(m_toggleRightSideBarAction, Constants::TOGGLE_RIGHT_SIDEBAR);
 | 
			
		||||
    cmd->setAttribute(Command::CA_UpdateText);
 | 
			
		||||
    cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Ctrl+Shift+0") : Tr::tr("Alt+Shift+0")));
 | 
			
		||||
    connect(m_toggleRightSideBarAction, &QAction::triggered,
 | 
			
		||||
            this, [this](bool visible) { setSidebarVisible(visible, Side::Right); });
 | 
			
		||||
    ProxyAction *toggleRightSideBarProxyAction =
 | 
			
		||||
            ProxyAction::proxyActionWithIcon(cmd->action(), Utils::Icons::TOGGLE_RIGHT_SIDEBAR_TOOLBAR.icon());
 | 
			
		||||
    m_toggleRightSideBarButton->setDefaultAction(toggleRightSideBarProxyAction);
 | 
			
		||||
    mview->addAction(cmd, Constants::G_VIEW_VIEWS);
 | 
			
		||||
    m_toggleRightSideBarButton->setEnabled(false);
 | 
			
		||||
    ActionBuilder toggleRightSideBarAction(this, Constants::TOGGLE_RIGHT_SIDEBAR);
 | 
			
		||||
    toggleRightSideBarAction.setIcon(Utils::Icons::TOGGLE_RIGHT_SIDEBAR.icon());
 | 
			
		||||
    toggleRightSideBarAction.setText(Tr::tr(Constants::TR_SHOW_RIGHT_SIDEBAR));
 | 
			
		||||
    toggleRightSideBarAction.setCheckable(true);
 | 
			
		||||
    toggleRightSideBarAction.setCommandAttribute(Command::CA_UpdateText);
 | 
			
		||||
    toggleRightSideBarAction.setDefaultKeySequence(Tr::tr("Ctrl+Shift+0"), Tr::tr("Alt+Shift+0"));
 | 
			
		||||
    toggleRightSideBarAction.setContainer(Constants::M_VIEW, Constants::G_VIEW_VIEWS);
 | 
			
		||||
    toggleRightSideBarAction.setEnabled(false);
 | 
			
		||||
    toggleRightSideBarAction.setOnTriggered(this,
 | 
			
		||||
        [this](bool visible) { setSidebarVisible(visible, Side::Right); });
 | 
			
		||||
 | 
			
		||||
    m_toggleRightSideBarAction = toggleRightSideBarAction.contextAction();
 | 
			
		||||
    m_toggleRightSideBarButton->setDefaultAction(ProxyAction::proxyActionWithIcon(
 | 
			
		||||
        toggleRightSideBarAction.commandAction(), Utils::Icons::TOGGLE_RIGHT_SIDEBAR_TOOLBAR.icon()));
 | 
			
		||||
 | 
			
		||||
    // Show Menubar Action
 | 
			
		||||
    if (globalMenuBar() && !globalMenuBar()->isNativeMenuBar()) {
 | 
			
		||||
@@ -1889,49 +1878,49 @@ void ICorePrivate::registerDefaultActions()
 | 
			
		||||
        mhelp->addSeparator(Constants::G_HELP_ABOUT);
 | 
			
		||||
 | 
			
		||||
    // About IDE Action
 | 
			
		||||
    m_aboutIdeAction.setId(Constants::ABOUT_QTCREATOR);
 | 
			
		||||
    m_aboutIdeAction.setIcon(Icon::fromTheme("help-about"));
 | 
			
		||||
    m_aboutIdeAction.setText(
 | 
			
		||||
        (HostOsInfo::isMacHost() ? Tr::tr("About &%1") : Tr::tr("About &%1..."))
 | 
			
		||||
            .arg(QGuiApplication::applicationDisplayName()));
 | 
			
		||||
    m_aboutIdeAction.setMenuRole(QAction::AboutRole);
 | 
			
		||||
    m_aboutIdeAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    m_aboutIdeAction.setEnabled(true);
 | 
			
		||||
    m_aboutIdeAction.setOnTriggered(this, [this] { aboutQtCreator(); });
 | 
			
		||||
    ActionBuilder aboutIdeAction(this, Constants::ABOUT_QTCREATOR);
 | 
			
		||||
    aboutIdeAction.setIcon(Icon::fromTheme("help-about"));
 | 
			
		||||
    aboutIdeAction.setText(
 | 
			
		||||
      (HostOsInfo::isMacHost() ? Tr::tr("About &%1") : Tr::tr("About &%1..."))
 | 
			
		||||
          .arg(QGuiApplication::applicationDisplayName()));
 | 
			
		||||
    aboutIdeAction.setMenuRole(QAction::AboutRole);
 | 
			
		||||
    aboutIdeAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    aboutIdeAction.setEnabled(true);
 | 
			
		||||
    aboutIdeAction.setOnTriggered(this, [this] { aboutQtCreator(); });
 | 
			
		||||
 | 
			
		||||
    // About Plugins Action
 | 
			
		||||
    m_aboutPluginsAction.setId(Constants::ABOUT_PLUGINS);
 | 
			
		||||
    m_aboutPluginsAction.setText(Tr::tr("About &Plugins..."));
 | 
			
		||||
    m_aboutPluginsAction.setMenuRole(QAction::ApplicationSpecificRole);
 | 
			
		||||
    m_aboutPluginsAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    m_aboutPluginsAction.setEnabled(true);
 | 
			
		||||
    m_aboutPluginsAction.setOnTriggered(this, [this] { aboutPlugins(); });
 | 
			
		||||
    ActionBuilder aboutPluginsAction(this, Constants::ABOUT_PLUGINS);
 | 
			
		||||
    aboutPluginsAction.setText(Tr::tr("About &Plugins..."));
 | 
			
		||||
    aboutPluginsAction.setMenuRole(QAction::ApplicationSpecificRole);
 | 
			
		||||
    aboutPluginsAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    aboutPluginsAction.setEnabled(true);
 | 
			
		||||
    aboutPluginsAction.setOnTriggered(this, [this] { aboutPlugins(); });
 | 
			
		||||
 | 
			
		||||
    // About Qt Action
 | 
			
		||||
    //    aboutQtAction.setId(Constants:: ABOUT_QT);
 | 
			
		||||
    //    ActionBuilder aboutQtAction(this, Constants:: ABOUT_QT);
 | 
			
		||||
    //    aboutQtAction.setText(Tr::tr("About &Qt..."), this);
 | 
			
		||||
    //    aboutQtAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    //    aboutQtAction.setEnabled(true);
 | 
			
		||||
    //    aboutQtAction.setOnTriggered(this, &QApplication::aboutQt);
 | 
			
		||||
 | 
			
		||||
    // Change Log Action
 | 
			
		||||
    m_changeLogAction.setId(Constants::CHANGE_LOG);
 | 
			
		||||
    m_changeLogAction.setText(Tr::tr("Change Log..."));
 | 
			
		||||
    m_changeLogAction.setMenuRole(QAction::ApplicationSpecificRole);
 | 
			
		||||
    m_changeLogAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    m_changeLogAction.setEnabled(true);
 | 
			
		||||
    m_changeLogAction.setOnTriggered(this, [this] { changeLog(); });
 | 
			
		||||
    ActionBuilder changeLogAction(this, Constants::CHANGE_LOG);
 | 
			
		||||
    changeLogAction.setText(Tr::tr("Change Log..."));
 | 
			
		||||
    changeLogAction.setMenuRole(QAction::ApplicationSpecificRole);
 | 
			
		||||
    changeLogAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    changeLogAction.setEnabled(true);
 | 
			
		||||
    changeLogAction.setOnTriggered(this, [this] { changeLog(); });
 | 
			
		||||
 | 
			
		||||
    // Contact
 | 
			
		||||
    m_contactAction.setId("QtCreator.Contact");
 | 
			
		||||
    m_contactAction.setText(Tr::tr("Contact..."));
 | 
			
		||||
    m_contactAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    m_contactAction.setEnabled(true);
 | 
			
		||||
    m_contactAction.setOnTriggered(this, [this] { contact(); });
 | 
			
		||||
    ActionBuilder contactAction(this, "QtCreator.Contact");
 | 
			
		||||
    contactAction.setText(Tr::tr("Contact..."));
 | 
			
		||||
    contactAction.setContainer(Constants::M_HELP, Constants::G_HELP_ABOUT);
 | 
			
		||||
    contactAction.setEnabled(true);
 | 
			
		||||
    contactAction.setOnTriggered(this, [this] { contact(); });
 | 
			
		||||
 | 
			
		||||
    // About sep
 | 
			
		||||
    if (!HostOsInfo::isMacHost()) { // doesn't have the "About" actions in the Help menu
 | 
			
		||||
        tmpaction = new QAction(this);
 | 
			
		||||
        auto tmpaction = new QAction(this);
 | 
			
		||||
        tmpaction->setSeparator(true);
 | 
			
		||||
        cmd = ActionManager::registerAction(tmpaction, "QtCreator.Help.Sep.About");
 | 
			
		||||
        mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,6 @@ public:
 | 
			
		||||
    ProjectFilesFactory projectFilesFactory;
 | 
			
		||||
    GenericMakeStepFactory makeStepFactory;
 | 
			
		||||
    GenericBuildConfigurationFactory buildConfigFactory;
 | 
			
		||||
    Action editAction;
 | 
			
		||||
    Action removeDirAction;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GenericProjectPlugin::~GenericProjectPlugin()
 | 
			
		||||
@@ -59,7 +57,7 @@ GenericProjectPluginPrivate::GenericProjectPluginPrivate()
 | 
			
		||||
 | 
			
		||||
    IWizardFactory::registerFactoryCreator([] { return new GenericProjectWizard; });
 | 
			
		||||
 | 
			
		||||
    editAction.setId("GenericProjectManager.EditFiles");
 | 
			
		||||
    ActionBuilder editAction(this, "GenericProjectManager.EditFiles");
 | 
			
		||||
    editAction.setContext(Constants::GENERICPROJECT_ID);
 | 
			
		||||
    editAction.setText(Tr::tr("Edit Files..."));
 | 
			
		||||
    editAction.setCommandAttribute(Command::CA_Hide);
 | 
			
		||||
@@ -69,7 +67,7 @@ GenericProjectPluginPrivate::GenericProjectPluginPrivate()
 | 
			
		||||
            genericProject->editFilesTriggered();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    removeDirAction.setId("GenericProject.RemoveDir");
 | 
			
		||||
    ActionBuilder removeDirAction(this, "GenericProject.RemoveDir");
 | 
			
		||||
    removeDirAction.setContext(PEC::C_PROJECT_TREE);
 | 
			
		||||
    removeDirAction.setText(Tr::tr("Remove Directory"));
 | 
			
		||||
    removeDirAction.setContainer(PEC::M_FOLDERCONTEXT, PEC::G_FOLDER_OTHER);
 | 
			
		||||
 
 | 
			
		||||
@@ -87,12 +87,12 @@ public:
 | 
			
		||||
    BookmarkViewFactory m_bookmarkViewFactory{&m_bookmarkManager};
 | 
			
		||||
 | 
			
		||||
    Menu m_bookmarkMenu;
 | 
			
		||||
    Action m_toggleAction;
 | 
			
		||||
    Action m_editAction;
 | 
			
		||||
    Action m_prevAction;
 | 
			
		||||
    Action m_nextAction;
 | 
			
		||||
    Action m_docPrevAction;
 | 
			
		||||
    Action m_docNextAction;
 | 
			
		||||
    QAction *m_toggleAction = nullptr;
 | 
			
		||||
    QAction *m_editAction = nullptr;
 | 
			
		||||
    QAction *m_prevAction = nullptr;
 | 
			
		||||
    QAction *m_nextAction = nullptr;
 | 
			
		||||
    QAction *m_docPrevAction = nullptr;
 | 
			
		||||
    QAction *m_docNextAction = nullptr;
 | 
			
		||||
 | 
			
		||||
    QAction m_editBookmarkAction{Tr::tr("Edit Bookmark")};
 | 
			
		||||
    QAction m_bookmarkMarginAction{Tr::tr("Toggle Bookmark")};
 | 
			
		||||
@@ -122,25 +122,27 @@ TextEditorPluginPrivate::TextEditorPluginPrivate()
 | 
			
		||||
    m_bookmarkMenu.setTitle(Tr::tr("&Bookmarks"));
 | 
			
		||||
    m_bookmarkMenu.setContainer(Core::Constants::M_TOOLS);
 | 
			
		||||
 | 
			
		||||
    m_toggleAction.setId("Bookmarks.Toggle");
 | 
			
		||||
    m_toggleAction.setContext(editorManagerContext);
 | 
			
		||||
    m_toggleAction.setText(Tr::tr("Toggle Bookmark"));
 | 
			
		||||
    m_toggleAction.setDefaultKeySequence(Tr::tr("Meta+M"), Tr::tr("Ctrl+M"));
 | 
			
		||||
    m_toggleAction.setTouchBarIcon(Icons::MACOS_TOUCHBAR_BOOKMARK.icon());
 | 
			
		||||
    m_toggleAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    m_toggleAction.setOnTriggered(this, [this] {
 | 
			
		||||
    ActionBuilder toggleAction(this, "Bookmarks.Toggle");
 | 
			
		||||
    toggleAction.setContext(editorManagerContext);
 | 
			
		||||
    toggleAction.setText(Tr::tr("Toggle Bookmark"));
 | 
			
		||||
    toggleAction.setDefaultKeySequence(Tr::tr("Meta+M"), Tr::tr("Ctrl+M"));
 | 
			
		||||
    toggleAction.setTouchBarIcon(Icons::MACOS_TOUCHBAR_BOOKMARK.icon());
 | 
			
		||||
    toggleAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    toggleAction.bindContextAction(&m_toggleAction);
 | 
			
		||||
    toggleAction.setOnTriggered(this, [this] {
 | 
			
		||||
        IEditor *editor = EditorManager::currentEditor();
 | 
			
		||||
        auto widget = TextEditorWidget::fromEditor(editor);
 | 
			
		||||
        if (widget && editor && !editor->document()->isTemporary())
 | 
			
		||||
            m_bookmarkManager.toggleBookmark(editor->document()->filePath(), editor->currentLine());
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    m_editAction.setId("Bookmarks.Edit");
 | 
			
		||||
    m_editAction.setContext(editorManagerContext);
 | 
			
		||||
    m_editAction.setText(Tr::tr("Edit Bookmark"));
 | 
			
		||||
    m_editAction.setDefaultKeySequence(Tr::tr("Meta+Shift+M"), Tr::tr("Ctrl+Shift+M"));
 | 
			
		||||
    m_editAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    m_editAction.setOnTriggered(this, [this] {
 | 
			
		||||
    ActionBuilder editAction(this, "Bookmarks.Edit");
 | 
			
		||||
    editAction.setContext(editorManagerContext);
 | 
			
		||||
    editAction.setText(Tr::tr("Edit Bookmark"));
 | 
			
		||||
    editAction.setDefaultKeySequence(Tr::tr("Meta+Shift+M"), Tr::tr("Ctrl+Shift+M"));
 | 
			
		||||
    editAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    editAction.bindContextAction(&m_editAction);
 | 
			
		||||
    editAction.setOnTriggered(this, [this] {
 | 
			
		||||
        IEditor *editor = EditorManager::currentEditor();
 | 
			
		||||
        auto widget = TextEditorWidget::fromEditor(editor);
 | 
			
		||||
        if (widget && editor && !editor->document()->isTemporary()) {
 | 
			
		||||
@@ -154,37 +156,41 @@ TextEditorPluginPrivate::TextEditorPluginPrivate()
 | 
			
		||||
 | 
			
		||||
    m_bookmarkMenu.addSeparator();
 | 
			
		||||
 | 
			
		||||
    m_prevAction.setId(BOOKMARKS_PREV_ACTION);
 | 
			
		||||
    m_prevAction.setContext(editorManagerContext);
 | 
			
		||||
    m_prevAction.setText(Tr::tr("Previous Bookmark"));
 | 
			
		||||
    m_prevAction.setDefaultKeySequence(Tr::tr("Meta+,"), Tr::tr("Ctrl+,"));
 | 
			
		||||
    m_prevAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    m_prevAction.setIcon(Icons::PREV_TOOLBAR.icon());
 | 
			
		||||
    m_prevAction.setIconVisibleInMenu(false);
 | 
			
		||||
    m_prevAction.setOnTriggered(this, [this] { m_bookmarkManager.prev(); });
 | 
			
		||||
    ActionBuilder prevAction(this, BOOKMARKS_PREV_ACTION);
 | 
			
		||||
    prevAction.setContext(editorManagerContext);
 | 
			
		||||
    prevAction.setText(Tr::tr("Previous Bookmark"));
 | 
			
		||||
    prevAction.setDefaultKeySequence(Tr::tr("Meta+,"), Tr::tr("Ctrl+,"));
 | 
			
		||||
    prevAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    prevAction.setIcon(Icons::PREV_TOOLBAR.icon());
 | 
			
		||||
    prevAction.setIconVisibleInMenu(false);
 | 
			
		||||
    prevAction.bindContextAction(&m_prevAction);
 | 
			
		||||
    prevAction.setOnTriggered(this, [this] { m_bookmarkManager.prev(); });
 | 
			
		||||
 | 
			
		||||
    m_nextAction.setId(BOOKMARKS_NEXT_ACTION);
 | 
			
		||||
    m_nextAction.setContext(editorManagerContext);
 | 
			
		||||
    m_nextAction.setText(Tr::tr("Next Bookmark"));
 | 
			
		||||
    m_nextAction.setIcon(Icons::NEXT_TOOLBAR.icon());
 | 
			
		||||
    m_nextAction.setIconVisibleInMenu(false);
 | 
			
		||||
    m_nextAction.setDefaultKeySequence(Tr::tr("Meta+."), Tr::tr("Ctrl+."));
 | 
			
		||||
    m_nextAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    m_nextAction.setOnTriggered(this, [this] { m_bookmarkManager.next(); });
 | 
			
		||||
    ActionBuilder nextAction(this, BOOKMARKS_NEXT_ACTION);
 | 
			
		||||
    nextAction.setContext(editorManagerContext);
 | 
			
		||||
    nextAction.setText(Tr::tr("Next Bookmark"));
 | 
			
		||||
    nextAction.setIcon(Icons::NEXT_TOOLBAR.icon());
 | 
			
		||||
    nextAction.setIconVisibleInMenu(false);
 | 
			
		||||
    nextAction.setDefaultKeySequence(Tr::tr("Meta+."), Tr::tr("Ctrl+."));
 | 
			
		||||
    nextAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    nextAction.bindContextAction(&m_nextAction);
 | 
			
		||||
    nextAction.setOnTriggered(this, [this] { m_bookmarkManager.next(); });
 | 
			
		||||
 | 
			
		||||
    m_bookmarkMenu.addSeparator();
 | 
			
		||||
 | 
			
		||||
    m_docPrevAction.setId("Bookmarks.PreviousDocument");
 | 
			
		||||
    m_docPrevAction.setContext(editorManagerContext);
 | 
			
		||||
    m_docPrevAction.setText(Tr::tr("Previous Bookmark in Document"));
 | 
			
		||||
    m_docPrevAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    m_docPrevAction.setOnTriggered(this, [this] { m_bookmarkManager.prevInDocument(); });
 | 
			
		||||
    ActionBuilder docPrevAction(this, "Bookmarks.PreviousDocument");
 | 
			
		||||
    docPrevAction.setContext(editorManagerContext);
 | 
			
		||||
    docPrevAction.setText(Tr::tr("Previous Bookmark in Document"));
 | 
			
		||||
    docPrevAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    docPrevAction.bindContextAction(&m_docPrevAction);
 | 
			
		||||
    docPrevAction.setOnTriggered(this, [this] { m_bookmarkManager.prevInDocument(); });
 | 
			
		||||
 | 
			
		||||
    m_docNextAction.setId("Bookmarks.NextDocument");
 | 
			
		||||
    m_docNextAction.setContext(Core::Constants::C_EDITORMANAGER);
 | 
			
		||||
    m_docNextAction.setText(Tr::tr("Next Bookmark in Document"));
 | 
			
		||||
    m_docNextAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    m_docNextAction.setOnTriggered(this, [this] { m_bookmarkManager.nextInDocument(); });
 | 
			
		||||
    ActionBuilder docNextAction(this, "Bookmarks.NextDocument");
 | 
			
		||||
    docNextAction.setContext(Core::Constants::C_EDITORMANAGER);
 | 
			
		||||
    docNextAction.setText(Tr::tr("Next Bookmark in Document"));
 | 
			
		||||
    docNextAction.setContainer(bookmarkMenuId);
 | 
			
		||||
    docNextAction.bindContextAction(&m_docNextAction);
 | 
			
		||||
    docNextAction.setOnTriggered(this, [this] { m_bookmarkManager.nextInDocument(); });
 | 
			
		||||
 | 
			
		||||
    connect(&m_editBookmarkAction, &QAction::triggered, this, [this] {
 | 
			
		||||
            m_bookmarkManager.editByFileAndLine(m_marginActionFileName, m_marginActionLineNumber);
 | 
			
		||||
@@ -199,7 +205,7 @@ TextEditorPluginPrivate::TextEditorPluginPrivate()
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    ActionContainer *touchBar = ActionManager::actionContainer(Core::Constants::TOUCH_BAR);
 | 
			
		||||
    touchBar->addAction(m_toggleAction.command(), Core::Constants::G_TOUCHBAR_EDITOR);
 | 
			
		||||
    touchBar->addAction(toggleAction.command(), Core::Constants::G_TOUCHBAR_EDITOR);
 | 
			
		||||
 | 
			
		||||
    // EditorManager
 | 
			
		||||
    connect(EditorManager::instance(), &EditorManager::editorAboutToClose,
 | 
			
		||||
@@ -213,12 +219,12 @@ void TextEditorPluginPrivate::updateActions(bool enableToggle, int state)
 | 
			
		||||
    const bool hasbm    = state >= BookmarkManager::HasBookMarks;
 | 
			
		||||
    const bool hasdocbm = state == BookmarkManager::HasBookmarksInDocument;
 | 
			
		||||
 | 
			
		||||
    m_toggleAction.setEnabled(enableToggle);
 | 
			
		||||
    m_editAction.setEnabled(enableToggle);
 | 
			
		||||
    m_prevAction.setEnabled(hasbm);
 | 
			
		||||
    m_nextAction.setEnabled(hasbm);
 | 
			
		||||
    m_docPrevAction.setEnabled(hasdocbm);
 | 
			
		||||
    m_docNextAction.setEnabled(hasdocbm);
 | 
			
		||||
    m_toggleAction->setEnabled(enableToggle);
 | 
			
		||||
    m_editAction->setEnabled(enableToggle);
 | 
			
		||||
    m_prevAction->setEnabled(hasbm);
 | 
			
		||||
    m_nextAction->setEnabled(hasbm);
 | 
			
		||||
    m_docPrevAction->setEnabled(hasdocbm);
 | 
			
		||||
    m_docNextAction->setEnabled(hasdocbm);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TextEditorPluginPrivate::editorOpened(IEditor *editor)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user