OS X: Add action for closing external windows

E.g. editor windows and help windows. There is no automatic system
shortcut for this on OS X.

Change-Id: I27f1208cde0a6f4b1a6952a7988d00a8481a08a4
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Eike Ziller
2014-07-18 10:35:17 +02:00
parent febdfeb92f
commit 7dfb7df471
4 changed files with 25 additions and 1 deletions

View File

@@ -330,6 +330,7 @@ bool MainWindow::init(QString *errorMessage)
void MainWindow::extensionsInitialized()
{
m_windowSupport = new WindowSupport(this, Context("Core.MainWindow"));
m_windowSupport->setCloseActionEnabled(false);
m_editorManager->init();
m_statusBarManager->extensionsInitalized();
OutputPaneManager::instance()->init();
@@ -654,9 +655,18 @@ void MainWindow::registerDefaultActions()
cmd->setAttribute(Command::CA_UpdateText);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
if (UseMacShortcuts)
if (UseMacShortcuts) {
mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE);
QAction *closeAction = new QAction(tr("Close Window"), this);
closeAction->setEnabled(false);
cmd = ActionManager::registerAction(closeAction, Constants::CLOSE_WINDOW, globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Meta+W")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE);
}
// Show Sidebar Action
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
tr("Show Sidebar"), this);