Skip to content
Snippets Groups Projects
Commit 4e1e21da authored by con's avatar con
Browse files

Fixes: - Don't add editor context by default if focus is elsewhere

RevBy:    - dt
Details:  - This made it impossible to e.g. copy from the output
windows. We'll see if adding the editor by default had some
user-interation purpose.
parent fadcd2a9
No related branches found
No related tags found
No related merge requests found
...@@ -612,6 +612,7 @@ void MainWindow::registerDefaultActions() ...@@ -612,6 +612,7 @@ void MainWindow::registerDefaultActions()
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultText(tr("&Undo")); cmd->setDefaultText(tr("&Undo"));
medit->addAction(cmd, Constants::G_EDIT_UNDOREDO); medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
tmpaction->setEnabled(false);
// Redo Action // Redo Action
tmpaction = new QAction(QIcon(Constants::ICON_REDO), tr("&Redo"), this); tmpaction = new QAction(QIcon(Constants::ICON_REDO), tr("&Redo"), this);
...@@ -620,36 +621,42 @@ void MainWindow::registerDefaultActions() ...@@ -620,36 +621,42 @@ void MainWindow::registerDefaultActions()
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultText(tr("&Redo")); cmd->setDefaultText(tr("&Redo"));
medit->addAction(cmd, Constants::G_EDIT_UNDOREDO); medit->addAction(cmd, Constants::G_EDIT_UNDOREDO);
tmpaction->setEnabled(false);
// Cut Action // Cut Action
tmpaction = new QAction(QIcon(Constants::ICON_CUT), tr("Cu&t"), this); tmpaction = new QAction(QIcon(Constants::ICON_CUT), tr("Cu&t"), this);
cmd = am->registerAction(tmpaction, Constants::CUT, m_globalContext); cmd = am->registerAction(tmpaction, Constants::CUT, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Cut); cmd->setDefaultKeySequence(QKeySequence::Cut);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
tmpaction->setEnabled(false);
// Copy Action // Copy Action
tmpaction = new QAction(QIcon(Constants::ICON_COPY), tr("&Copy"), this); tmpaction = new QAction(QIcon(Constants::ICON_COPY), tr("&Copy"), this);
cmd = am->registerAction(tmpaction, Constants::COPY, m_globalContext); cmd = am->registerAction(tmpaction, Constants::COPY, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Copy); cmd->setDefaultKeySequence(QKeySequence::Copy);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
tmpaction->setEnabled(false);
// Paste Action // Paste Action
tmpaction = new QAction(QIcon(Constants::ICON_PASTE), tr("&Paste"), this); tmpaction = new QAction(QIcon(Constants::ICON_PASTE), tr("&Paste"), this);
cmd = am->registerAction(tmpaction, Constants::PASTE, m_globalContext); cmd = am->registerAction(tmpaction, Constants::PASTE, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::Paste); cmd->setDefaultKeySequence(QKeySequence::Paste);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
tmpaction->setEnabled(false);
// Select All // Select All
tmpaction = new QAction(tr("&Select All"), this); tmpaction = new QAction(tr("&Select All"), this);
cmd = am->registerAction(tmpaction, Constants::SELECTALL, m_globalContext); cmd = am->registerAction(tmpaction, Constants::SELECTALL, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence::SelectAll); cmd->setDefaultKeySequence(QKeySequence::SelectAll);
medit->addAction(cmd, Constants::G_EDIT_SELECTALL); medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
tmpaction->setEnabled(false);
// Goto Action // Goto Action
tmpaction = new QAction(tr("&Go To Line..."), this); tmpaction = new QAction(tr("&Go To Line..."), this);
cmd = am->registerAction(tmpaction, Constants::GOTO, m_globalContext); cmd = am->registerAction(tmpaction, Constants::GOTO, m_globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L")));
medit->addAction(cmd, Constants::G_EDIT_OTHER); medit->addAction(cmd, Constants::G_EDIT_OTHER);
tmpaction->setEnabled(false);
// Options Action // Options Action
m_optionsAction = new QAction(tr("&Options..."), this); m_optionsAction = new QAction(tr("&Options..."), this);
...@@ -993,23 +1000,26 @@ void MainWindow::updateFocusWidget(QWidget *old, QWidget *now) ...@@ -993,23 +1000,26 @@ void MainWindow::updateFocusWidget(QWidget *old, QWidget *now)
{ {
Q_UNUSED(old) Q_UNUSED(old)
Q_UNUSED(now) Q_UNUSED(now)
IContext *newContext = 0;
if (focusWidget()) { if (focusWidget()) {
IContext *context = 0; IContext *context = 0;
QWidget *p = focusWidget(); QWidget *p = focusWidget();
while (p) { while (p) {
context = m_contextWidgets.value(p); context = m_contextWidgets.value(p);
if (context) { if (context) {
if (m_activeContext != context) newContext = context;
updateContextObject(context);
break; break;
} }
p = p->parentWidget(); p = p->parentWidget();
} }
} }
updateContextObject(newContext);
} }
void MainWindow::updateContextObject(IContext *context) void MainWindow::updateContextObject(IContext *context)
{ {
if (context == m_activeContext)
return;
IContext *oldContext = m_activeContext; IContext *oldContext = m_activeContext;
m_activeContext = context; m_activeContext = context;
if (!context || oldContext != m_activeContext) { if (!context || oldContext != m_activeContext) {
...@@ -1101,10 +1111,6 @@ void MainWindow::updateContext() ...@@ -1101,10 +1111,6 @@ void MainWindow::updateContext()
if (m_activeContext) if (m_activeContext)
contexts += m_activeContext->context(); contexts += m_activeContext->context();
IEditor *editor = m_editorManager->currentEditor();
if (editor && (EditorManagerPlaceHolder::current() != 0)) {
contexts += editor->context();
}
contexts += m_additionalContexts; contexts += m_additionalContexts;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment