2014-08-22 08:42:04 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2014-08-22 08:42:04 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-15 14:46:23 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2014-08-22 08:42:04 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-15 14:46:23 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2014-08-22 08:42:04 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2014-08-22 08:42:04 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2013-01-23 12:31:22 +01:00
|
|
|
#include "shortcutmanager.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
|
|
|
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
|
|
|
|
#include <coreplugin/icore.h>
|
2013-07-05 16:08:38 +02:00
|
|
|
#include <coreplugin/editormanager/documentmodel.h>
|
2013-01-23 12:31:22 +01:00
|
|
|
#include <coreplugin/coreconstants.h>
|
|
|
|
|
#include <utils/hostosinfo.h>
|
|
|
|
|
|
|
|
|
|
#include "qmldesignerconstants.h"
|
|
|
|
|
#include "qmldesignerplugin.h"
|
|
|
|
|
#include "designmodewidget.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace QmlDesigner {
|
|
|
|
|
|
|
|
|
|
ShortCutManager::ShortCutManager()
|
|
|
|
|
: QObject(),
|
|
|
|
|
m_revertToSavedAction(0),
|
|
|
|
|
m_saveAction(0),
|
|
|
|
|
m_saveAsAction(0),
|
|
|
|
|
m_closeCurrentEditorAction(0),
|
|
|
|
|
m_closeAllEditorsAction(0),
|
|
|
|
|
m_closeOtherEditorsAction(0),
|
|
|
|
|
m_undoAction(tr("&Undo"), 0),
|
|
|
|
|
m_redoAction(tr("&Redo"), 0),
|
|
|
|
|
m_deleteAction(tr("Delete"), tr("Delete \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
|
|
|
|
m_cutAction(tr("Cu&t"), tr("Cut \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
|
|
|
|
m_copyAction(tr("&Copy"), tr("Copy \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
|
|
|
|
m_pasteAction(tr("&Paste"), tr("Paste \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
|
|
|
|
m_selectAllAction(tr("Select &All"), tr("Select All \"%1\""), Utils::ParameterAction::EnabledWithParameter),
|
2014-03-25 15:17:49 +01:00
|
|
|
m_hideSidebarsAction(tr("Toggle Sidebars"), 0),
|
2013-01-23 12:31:22 +01:00
|
|
|
m_restoreDefaultViewAction(tr("&Restore Default View"), 0),
|
|
|
|
|
m_toggleLeftSidebarAction(tr("Toggle &Left Sidebar"), 0),
|
|
|
|
|
m_toggleRightSidebarAction(tr("Toggle &Right Sidebar"), 0),
|
|
|
|
|
m_goIntoComponentAction (tr("&Go into Component"), 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-11 13:28:59 +01:00
|
|
|
void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContext,
|
|
|
|
|
const Core::Context &qmlDesignerFormEditorContext,
|
|
|
|
|
const Core::Context &qmlDesignerNavigatorContext)
|
2013-01-23 12:31:22 +01:00
|
|
|
{
|
|
|
|
|
Core::ActionContainer *editMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT);
|
|
|
|
|
|
|
|
|
|
connect(&m_undoAction, SIGNAL(triggered()), this, SLOT(undo()));
|
|
|
|
|
|
|
|
|
|
connect(&m_redoAction, SIGNAL(triggered()), this, SLOT(redo()));
|
|
|
|
|
|
|
|
|
|
connect(&m_deleteAction, SIGNAL(triggered()), this, SLOT(deleteSelected()));
|
|
|
|
|
|
|
|
|
|
connect(&m_cutAction, SIGNAL(triggered()), this, SLOT(cutSelected()));
|
|
|
|
|
|
|
|
|
|
connect(&m_copyAction, SIGNAL(triggered()), this, SLOT(copySelected()));
|
|
|
|
|
|
|
|
|
|
connect(&m_pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
|
|
|
|
|
|
|
|
|
|
connect(&m_selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));
|
|
|
|
|
|
|
|
|
|
connect(&m_hideSidebarsAction, SIGNAL(triggered()), this, SLOT(toggleSidebars()));
|
|
|
|
|
|
|
|
|
|
connect(&m_restoreDefaultViewAction,
|
|
|
|
|
SIGNAL(triggered()),
|
|
|
|
|
QmlDesignerPlugin::instance()->mainWidget(),
|
|
|
|
|
SLOT(restoreDefaultView()));
|
|
|
|
|
|
|
|
|
|
connect(&m_goIntoComponentAction, SIGNAL(triggered()), SLOT(goIntoComponent()));
|
|
|
|
|
|
|
|
|
|
connect(&m_toggleLeftSidebarAction,
|
|
|
|
|
SIGNAL(triggered()),
|
|
|
|
|
QmlDesignerPlugin::instance()->mainWidget(),
|
|
|
|
|
SLOT(toggleLeftSidebar()));
|
|
|
|
|
|
|
|
|
|
connect(&m_toggleRightSidebarAction,
|
|
|
|
|
SIGNAL(triggered()),
|
|
|
|
|
QmlDesignerPlugin::instance()->mainWidget(),
|
|
|
|
|
SLOT(toggleRightSidebar()));
|
|
|
|
|
|
|
|
|
|
// Revert to saved
|
2013-08-29 17:17:24 +02:00
|
|
|
QObject *em = Core::EditorManager::instance();
|
2013-01-23 12:31:22 +01:00
|
|
|
Core::ActionManager::registerAction(&m_revertToSavedAction,Core::Constants::REVERTTOSAVED, qmlDesignerMainContext);
|
2013-08-29 17:17:24 +02:00
|
|
|
connect(&m_revertToSavedAction, SIGNAL(triggered()), em, SLOT(revertToSaved()));
|
2013-01-23 12:31:22 +01:00
|
|
|
|
|
|
|
|
//Save
|
|
|
|
|
Core::ActionManager::registerAction(&m_saveAction, Core::Constants::SAVE, qmlDesignerMainContext);
|
2013-08-29 17:17:24 +02:00
|
|
|
connect(&m_saveAction, SIGNAL(triggered()), em, SLOT(saveDocument()));
|
2013-01-23 12:31:22 +01:00
|
|
|
|
|
|
|
|
//Save As
|
|
|
|
|
Core::ActionManager::registerAction(&m_saveAsAction, Core::Constants::SAVEAS, qmlDesignerMainContext);
|
2013-08-29 17:17:24 +02:00
|
|
|
connect(&m_saveAsAction, SIGNAL(triggered()), em, SLOT(saveDocumentAs()));
|
2013-01-23 12:31:22 +01:00
|
|
|
|
|
|
|
|
//Close Editor
|
|
|
|
|
Core::ActionManager::registerAction(&m_closeCurrentEditorAction, Core::Constants::CLOSE, qmlDesignerMainContext);
|
2014-08-19 16:15:57 +02:00
|
|
|
connect(&m_closeCurrentEditorAction, SIGNAL(triggered()), em, SLOT(slotCloseCurrentEditorOrDocument()));
|
2013-01-23 12:31:22 +01:00
|
|
|
|
|
|
|
|
//Close All
|
|
|
|
|
Core::ActionManager::registerAction(&m_closeAllEditorsAction, Core::Constants::CLOSEALL, qmlDesignerMainContext);
|
2013-08-29 17:17:24 +02:00
|
|
|
connect(&m_closeAllEditorsAction, SIGNAL(triggered()), em, SLOT(closeAllEditors()));
|
2013-01-23 12:31:22 +01:00
|
|
|
|
|
|
|
|
//Close All Others Action
|
|
|
|
|
Core::ActionManager::registerAction(&m_closeOtherEditorsAction, Core::Constants::CLOSEOTHERS, qmlDesignerMainContext);
|
2014-08-15 09:50:42 +02:00
|
|
|
connect(&m_closeOtherEditorsAction, SIGNAL(triggered()), em, SLOT(closeOtherDocuments()));
|
2013-01-23 12:31:22 +01:00
|
|
|
|
|
|
|
|
// Undo / Redo
|
|
|
|
|
Core::ActionManager::registerAction(&m_undoAction, Core::Constants::UNDO, qmlDesignerMainContext);
|
|
|
|
|
Core::ActionManager::registerAction(&m_redoAction, Core::Constants::REDO, qmlDesignerMainContext);
|
|
|
|
|
|
|
|
|
|
Core::Command *command;
|
|
|
|
|
|
|
|
|
|
//GoIntoComponent
|
|
|
|
|
command = Core::ActionManager::registerAction(&m_goIntoComponentAction,
|
|
|
|
|
Constants::GO_INTO_COMPONENT, qmlDesignerMainContext);
|
|
|
|
|
command->setDefaultKeySequence(QKeySequence(Qt::Key_F2));
|
|
|
|
|
|
|
|
|
|
//Edit Menu
|
|
|
|
|
|
2014-08-04 14:19:07 +02:00
|
|
|
Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_BACKSPACE, qmlDesignerFormEditorContext);
|
2014-04-09 13:27:47 +02:00
|
|
|
command = Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_BACKSPACE, qmlDesignerNavigatorContext);
|
|
|
|
|
command->setDefaultKeySequence(QKeySequence(Qt::Key_Backspace));
|
|
|
|
|
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
|
|
|
|
|
if (Utils::HostOsInfo::isMacHost())
|
|
|
|
|
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
|
|
|
|
|
2014-08-04 14:19:07 +02:00
|
|
|
Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_DELETE, qmlDesignerFormEditorContext);
|
2013-08-09 16:32:00 +02:00
|
|
|
command = Core::ActionManager::registerAction(&m_deleteAction, QmlDesigner::Constants::C_DELETE, qmlDesignerNavigatorContext);
|
2013-01-23 12:31:22 +01:00
|
|
|
command->setDefaultKeySequence(QKeySequence::Delete);
|
|
|
|
|
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
|
2014-04-09 13:27:47 +02:00
|
|
|
if (!Utils::HostOsInfo::isMacHost())
|
|
|
|
|
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
2013-01-23 12:31:22 +01:00
|
|
|
|
2014-08-04 14:19:07 +02:00
|
|
|
Core::ActionManager::registerAction(&m_cutAction, Core::Constants::CUT, qmlDesignerFormEditorContext);
|
2013-01-23 12:31:22 +01:00
|
|
|
command = Core::ActionManager::registerAction(&m_cutAction, Core::Constants::CUT, qmlDesignerNavigatorContext);
|
|
|
|
|
command->setDefaultKeySequence(QKeySequence::Cut);
|
|
|
|
|
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
|
|
|
|
|
2014-08-04 14:19:07 +02:00
|
|
|
Core::ActionManager::registerAction(&m_copyAction, Core::Constants::COPY, qmlDesignerFormEditorContext);
|
2013-01-23 12:31:22 +01:00
|
|
|
command = Core::ActionManager::registerAction(&m_copyAction, Core::Constants::COPY, qmlDesignerNavigatorContext);
|
|
|
|
|
command->setDefaultKeySequence(QKeySequence::Copy);
|
|
|
|
|
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
|
|
|
|
|
2014-08-04 14:19:07 +02:00
|
|
|
Core::ActionManager::registerAction(&m_pasteAction, Core::Constants::PASTE, qmlDesignerFormEditorContext);
|
2013-01-23 12:31:22 +01:00
|
|
|
command = Core::ActionManager::registerAction(&m_pasteAction, Core::Constants::PASTE, qmlDesignerNavigatorContext);
|
|
|
|
|
command->setDefaultKeySequence(QKeySequence::Paste);
|
|
|
|
|
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
|
|
|
|
|
|
2014-08-04 14:19:07 +02:00
|
|
|
Core::ActionManager::registerAction(&m_selectAllAction, Core::Constants::SELECTALL, qmlDesignerFormEditorContext);
|
2013-01-23 12:31:22 +01:00
|
|
|
command = Core::ActionManager::registerAction(&m_selectAllAction, Core::Constants::SELECTALL, qmlDesignerNavigatorContext);
|
|
|
|
|
|
|
|
|
|
command->setDefaultKeySequence(QKeySequence::SelectAll);
|
|
|
|
|
editMenu->addAction(command, Core::Constants::G_EDIT_SELECTALL);
|
|
|
|
|
|
|
|
|
|
Core::ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS);
|
|
|
|
|
|
|
|
|
|
command = Core::ActionManager::registerAction(&m_toggleLeftSidebarAction, Constants::TOGGLE_LEFT_SIDEBAR, qmlDesignerMainContext);
|
|
|
|
|
command->setAttribute(Core::Command::CA_Hide);
|
|
|
|
|
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+0"));
|
|
|
|
|
viewsMenu->addAction(command);
|
|
|
|
|
|
|
|
|
|
command = Core::ActionManager::registerAction(&m_toggleRightSidebarAction, Constants::TOGGLE_RIGHT_SIDEBAR, qmlDesignerMainContext);
|
|
|
|
|
command->setAttribute(Core::Command::CA_Hide);
|
|
|
|
|
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+Shift+0"));
|
|
|
|
|
viewsMenu->addAction(command);
|
|
|
|
|
|
|
|
|
|
command = Core::ActionManager::registerAction(&m_restoreDefaultViewAction, Constants::RESTORE_DEFAULT_VIEW, qmlDesignerMainContext);
|
|
|
|
|
command->setAttribute(Core::Command::CA_Hide);
|
|
|
|
|
viewsMenu->addAction(command);
|
|
|
|
|
|
2014-08-04 14:19:07 +02:00
|
|
|
Core::ActionManager::registerAction(&m_hideSidebarsAction, Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext);
|
2013-01-23 12:31:22 +01:00
|
|
|
}
|
|
|
|
|
|
2013-02-04 18:49:56 +01:00
|
|
|
void ShortCutManager::updateActions(Core::IEditor* currentEditor)
|
2013-01-23 12:31:22 +01:00
|
|
|
{
|
2014-06-13 16:21:25 +02:00
|
|
|
int openedCount = Core::DocumentModel::entryCount();
|
2013-01-23 12:31:22 +01:00
|
|
|
|
2014-05-21 20:21:52 +03:00
|
|
|
Core::IDocument *document = 0;
|
|
|
|
|
if (currentEditor)
|
|
|
|
|
document = currentEditor->document();
|
|
|
|
|
m_saveAction.setEnabled(document && document->isModified());
|
|
|
|
|
m_saveAsAction.setEnabled(document && document->isSaveAsAllowed());
|
|
|
|
|
m_revertToSavedAction.setEnabled(document
|
|
|
|
|
&& !document->filePath().isEmpty()
|
|
|
|
|
&& document->isModified());
|
2013-01-23 12:31:22 +01:00
|
|
|
|
|
|
|
|
QString quotedName;
|
2014-09-11 11:05:45 +02:00
|
|
|
if (currentEditor && document)
|
2014-05-21 20:21:52 +03:00
|
|
|
quotedName = '"' + document->displayName() + '"';
|
2013-01-23 12:31:22 +01:00
|
|
|
|
|
|
|
|
m_saveAsAction.setText(tr("Save %1 As...").arg(quotedName));
|
|
|
|
|
m_saveAction.setText(tr("&Save %1").arg(quotedName));
|
|
|
|
|
m_revertToSavedAction.setText(tr("Revert %1 to Saved").arg(quotedName));
|
|
|
|
|
|
|
|
|
|
m_closeCurrentEditorAction.setEnabled(currentEditor != 0);
|
|
|
|
|
m_closeCurrentEditorAction.setText(tr("Close %1").arg(quotedName));
|
|
|
|
|
m_closeAllEditorsAction.setEnabled(openedCount > 0);
|
|
|
|
|
m_closeOtherEditorsAction.setEnabled(openedCount > 1);
|
|
|
|
|
m_closeOtherEditorsAction.setText((openedCount > 1 ? tr("Close All Except %1").arg(quotedName) : tr("Close Others")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::undo()
|
|
|
|
|
{
|
|
|
|
|
if (currentDesignDocument())
|
|
|
|
|
currentDesignDocument()->undo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::redo()
|
|
|
|
|
{
|
|
|
|
|
if (currentDesignDocument())
|
|
|
|
|
currentDesignDocument()->redo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::deleteSelected()
|
|
|
|
|
{
|
|
|
|
|
if (currentDesignDocument())
|
|
|
|
|
currentDesignDocument()->deleteSelected();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::cutSelected()
|
|
|
|
|
{
|
|
|
|
|
if (currentDesignDocument())
|
|
|
|
|
currentDesignDocument()->cutSelected();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::copySelected()
|
|
|
|
|
{
|
|
|
|
|
if (currentDesignDocument())
|
|
|
|
|
currentDesignDocument()->copySelected();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::paste()
|
|
|
|
|
{
|
|
|
|
|
if (currentDesignDocument())
|
|
|
|
|
currentDesignDocument()->paste();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::selectAll()
|
|
|
|
|
{
|
|
|
|
|
if (currentDesignDocument())
|
|
|
|
|
currentDesignDocument()->selectAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::toggleSidebars()
|
|
|
|
|
{
|
|
|
|
|
QmlDesignerPlugin::instance()->mainWidget()->toggleSidebars();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::toggleLeftSidebar()
|
|
|
|
|
{
|
|
|
|
|
QmlDesignerPlugin::instance()->mainWidget()->toggleLeftSidebar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::toggleRightSidebar()
|
|
|
|
|
{
|
|
|
|
|
QmlDesignerPlugin::instance()->mainWidget()->toggleRightSidebar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::connectUndoActions(DesignDocument *designDocument)
|
|
|
|
|
{
|
|
|
|
|
if (designDocument) {
|
|
|
|
|
connect(designDocument, SIGNAL(undoAvailable(bool)), this, SLOT(undoAvailable(bool)));
|
|
|
|
|
connect(designDocument, SIGNAL(redoAvailable(bool)), this, SLOT(redoAvailable(bool)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::disconnectUndoActions(DesignDocument *designDocument)
|
|
|
|
|
{
|
|
|
|
|
if (currentDesignDocument()) {
|
|
|
|
|
disconnect(designDocument, SIGNAL(undoAvailable(bool)), this, SLOT(undoAvailable(bool)));
|
|
|
|
|
disconnect(designDocument, SIGNAL(redoAvailable(bool)), this, SLOT(redoAvailable(bool)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::updateUndoActions(DesignDocument *designDocument)
|
|
|
|
|
{
|
|
|
|
|
if (designDocument) {
|
|
|
|
|
m_undoAction.setEnabled(designDocument->isUndoAvailable());
|
|
|
|
|
m_redoAction.setEnabled(designDocument->isRedoAvailable());
|
|
|
|
|
} else {
|
|
|
|
|
m_undoAction.setEnabled(false);
|
|
|
|
|
m_redoAction.setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DesignDocument *ShortCutManager::currentDesignDocument() const
|
|
|
|
|
{
|
|
|
|
|
return QmlDesignerPlugin::instance()->currentDesignDocument();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::undoAvailable(bool isAvailable)
|
|
|
|
|
{
|
|
|
|
|
DesignDocument *documentController = qobject_cast<DesignDocument*>(sender());
|
|
|
|
|
if (currentDesignDocument() &&
|
|
|
|
|
currentDesignDocument() == documentController) {
|
|
|
|
|
m_undoAction.setEnabled(isAvailable);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::redoAvailable(bool isAvailable)
|
|
|
|
|
{
|
|
|
|
|
DesignDocument *documentController = qobject_cast<DesignDocument*>(sender());
|
|
|
|
|
if (currentDesignDocument() &&
|
|
|
|
|
currentDesignDocument() == documentController) {
|
|
|
|
|
m_redoAction.setEnabled(isAvailable);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShortCutManager::goIntoComponent()
|
|
|
|
|
{
|
2013-08-05 16:07:31 +02:00
|
|
|
if (currentDesignDocument()
|
|
|
|
|
&& currentDesignDocument()->currentModel()
|
|
|
|
|
&& currentDesignDocument()->rewriterView()
|
|
|
|
|
&& currentDesignDocument()->rewriterView()->hasSingleSelectedModelNode()) {
|
|
|
|
|
DocumentManager::goIntoComponent(currentDesignDocument()->rewriterView()->singleSelectedModelNode());
|
|
|
|
|
}
|
2013-01-23 12:31:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace QmlDesigner
|