Commit 87b3755b authored by mae's avatar mae

Missing actions in keyboard options

Task-number: QTCREATORBUG-61
parent 283f86bd
......@@ -739,6 +739,89 @@ void BaseTextEditor::gotoBlockEndWithSelection()
}
}
void BaseTextEditor::gotoLineStart()
{
handleHomeKey(false);
}
void BaseTextEditor::gotoLineStartWithSelection()
{
handleHomeKey(true);
}
void BaseTextEditor::gotoLineEnd()
{
moveCursor(QTextCursor::EndOfLine);
}
void BaseTextEditor::gotoLineEndWithSelection()
{
moveCursor(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
}
void BaseTextEditor::gotoNextLine()
{
moveCursor(QTextCursor::NextRow);
}
void BaseTextEditor::gotoNextLineWithSelection()
{
moveCursor(QTextCursor::NextRow, QTextCursor::KeepAnchor);
}
void BaseTextEditor::gotoPreviousLine()
{
moveCursor(QTextCursor::PreviousRow);
}
void BaseTextEditor::gotoPreviousLineWithSelection()
{
moveCursor(QTextCursor::PreviousRow, QTextCursor::KeepAnchor);
}
void BaseTextEditor::gotoPreviousCharacter()
{
moveCursor(QTextCursor::PreviousCharacter);
}
void BaseTextEditor::gotoPreviousCharacterWithSelection()
{
moveCursor(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
}
void BaseTextEditor::gotoNextCharacter()
{
moveCursor(QTextCursor::NextCharacter);
}
void BaseTextEditor::gotoNextCharacterWithSelection()
{
moveCursor(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
}
void BaseTextEditor::gotoPreviousWord()
{
moveCursor(QTextCursor::PreviousWord);
}
void BaseTextEditor::gotoPreviousWordWithSelection()
{
moveCursor(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
}
void BaseTextEditor::gotoNextWord()
{
moveCursor(QTextCursor::NextWord);
}
void BaseTextEditor::gotoNextWordWithSelection()
{
moveCursor(QTextCursor::NextWord, QTextCursor::KeepAnchor);
}
static QTextCursor flippedCursor(const QTextCursor &cursor)
{
QTextCursor flipped = cursor;
......
......@@ -231,6 +231,23 @@ public slots:
void gotoBlockStartWithSelection();
void gotoBlockEndWithSelection();
void gotoLineStart();
void gotoLineStartWithSelection();
void gotoLineEnd();
void gotoLineEndWithSelection();
void gotoNextLine();
void gotoNextLineWithSelection();
void gotoPreviousLine();
void gotoPreviousLineWithSelection();
void gotoPreviousCharacter();
void gotoPreviousCharacterWithSelection();
void gotoNextCharacter();
void gotoNextCharacterWithSelection();
void gotoPreviousWord();
void gotoPreviousWordWithSelection();
void gotoNextWord();
void gotoNextWordWithSelection();
void selectBlockUp();
void selectBlockDown();
......
......@@ -292,6 +292,59 @@ void TextEditorActionHandler::createActions()
command = am->registerAction(m_joinLinesAction, Constants::JOIN_LINES, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+J")));
connect(m_joinLinesAction, SIGNAL(triggered()), this, SLOT(joinLines()));
QAction *a = 0;
a = new QAction(tr("Goto Line Start"), this);
command = am->registerAction(a, Constants::GOTO_LINE_START, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStart()));
a = new QAction(tr("Goto Line End"), this);
command = am->registerAction(a, Constants::GOTO_LINE_END, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEnd()));
a = new QAction(tr("Goto Next Line"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_LINE, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLine()));
a = new QAction(tr("Goto Previous Line"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_LINE, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLine()));
a = new QAction(tr("Goto Previous Character"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacter()));
a = new QAction(tr("Goto Next Character"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_CHARACTER, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacter()));
a = new QAction(tr("Goto Previous Word"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWord()));
a = new QAction(tr("Goto Next Word"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_WORD, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWord()));
a = new QAction(tr("Goto Line Start With Selection"), this);
command = am->registerAction(a, Constants::GOTO_LINE_START_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStartWithSelection()));
a = new QAction(tr("Goto Line End With Selection"), this);
command = am->registerAction(a, Constants::GOTO_LINE_END_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEndWithSelection()));
a = new QAction(tr("Goto Next Line With Selection"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_LINE_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLineWithSelection()));
a = new QAction(tr("Goto Previous Line With Selection"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_LINE_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLineWithSelection()));
a = new QAction(tr("Goto Previous Character With Selection"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacterWithSelection()));
a = new QAction(tr("Goto Next Character With Selection"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_CHARACTER_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacterWithSelection()));
a = new QAction(tr("Goto Previous Word With Selection"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordWithSelection()));
a = new QAction(tr("Goto Next Word With Selection"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_WORD_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordWithSelection()));
}
bool TextEditorActionHandler::supportsAction(const QString & /*id */) const
......@@ -455,6 +508,24 @@ FUNCTION(copyLineUp)
FUNCTION(copyLineDown)
FUNCTION(joinLines)
FUNCTION(gotoLineStart)
FUNCTION(gotoLineStartWithSelection)
FUNCTION(gotoLineEnd)
FUNCTION(gotoLineEndWithSelection)
FUNCTION(gotoNextLine)
FUNCTION(gotoNextLineWithSelection)
FUNCTION(gotoPreviousLine)
FUNCTION(gotoPreviousLineWithSelection)
FUNCTION(gotoPreviousCharacter)
FUNCTION(gotoPreviousCharacterWithSelection)
FUNCTION(gotoNextCharacter)
FUNCTION(gotoNextCharacterWithSelection)
FUNCTION(gotoPreviousWord)
FUNCTION(gotoPreviousWordWithSelection)
FUNCTION(gotoNextWord)
FUNCTION(gotoNextWordWithSelection)
void TextEditorActionHandler::updateCurrentEditor(Core::IEditor *editor)
{
m_currentEditor = 0;
......
......@@ -118,6 +118,24 @@ private slots:
void joinLines();
void updateCurrentEditor(Core::IEditor *editor);
void gotoLineStart();
void gotoLineStartWithSelection();
void gotoLineEnd();
void gotoLineEndWithSelection();
void gotoNextLine();
void gotoNextLineWithSelection();
void gotoPreviousLine();
void gotoPreviousLineWithSelection();
void gotoPreviousCharacter();
void gotoPreviousCharacterWithSelection();
void gotoNextCharacter();
void gotoNextCharacterWithSelection();
void gotoPreviousWord();
void gotoPreviousWordWithSelection();
void gotoNextWord();
void gotoNextWordWithSelection();
private:
QAction *m_undoAction;
QAction *m_redoAction;
......
......@@ -68,6 +68,22 @@ const char * const SELECT_ENCODING = "TextEditor.SelectEncoding";
const char * const REWRAP_PARAGRAPH = "TextEditor.RewrapParagraph";
const char * const GOTO_OPENING_PARENTHESIS = "TextEditor.GotoOpeningParenthesis";
const char * const GOTO_CLOSING_PARENTHESIS = "TextEditor.GotoClosingParenthesis";
const char * const GOTO_LINE_START = "TextEditor.GotoLineStart";
const char * const GOTO_LINE_END = "TextEditor.GotoLineEnd";
const char * const GOTO_NEXT_LINE = "TextEditor.GotoNextLine";
const char * const GOTO_PREVIOUS_LINE = "TextEditor.GotoPreviousLine";
const char * const GOTO_PREVIOUS_CHARACTER = "TextEditor.GotoPreviousCharacter";
const char * const GOTO_NEXT_CHARACTER = "TextEditor.GotoNextCharacter";
const char * const GOTO_PREVIOUS_WORD = "TextEditor.GotoPreviousWord";
const char * const GOTO_NEXT_WORD = "TextEditor.GotoNextWord";
const char * const GOTO_LINE_START_WITH_SELECTION = "TextEditor.GotoLineStartWithSelection";
const char * const GOTO_LINE_END_WITH_SELECTION = "TextEditor.GotoLineEndWithSelection";
const char * const GOTO_NEXT_LINE_WITH_SELECTION = "TextEditor.GotoNextLineWithSelection";
const char * const GOTO_PREVIOUS_LINE_WITH_SELECTION = "TextEditor.GotoPreviousLineWithSelection";
const char * const GOTO_PREVIOUS_CHARACTER_WITH_SELECTION = "TextEditor.GotoPreviousCharacterWithSelection";
const char * const GOTO_NEXT_CHARACTER_WITH_SELECTION = "TextEditor.GotoNextCharacterWithSelection";
const char * const GOTO_PREVIOUS_WORD_WITH_SELECTION = "TextEditor.GotoPreviousWordWithSelection";
const char * const GOTO_NEXT_WORD_WITH_SELECTION = "TextEditor.GotoNextWordWithSelection";
const char * const C_TEXTEDITOR_MIMETYPE_TEXT = "text/plain";
const char * const C_TEXTEDITOR_MIMETYPE_XML = "application/xml";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment