diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index af61f7275b23eb8a3af4d9cb5f9c92eec3901a6c..dfc0cc5b3a522dffcc8757e8320562c0683f7187 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -5031,6 +5031,15 @@ void BaseTextEditorWidget::cutLine() cut(); } +// control+shift+insert +void BaseTextEditorWidget::copyLine() +{ + QTextCursor prevCursor = textCursor(); + maybeSelectLine(); + copy(); + setTextCursor(prevCursor); +} + void BaseTextEditorWidget::deleteLine() { maybeSelectLine(); diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 4cb13bf7e11071b7c17bad08144cbbe580032e48..a304110bfbd1adfb5d21b8bf669482fd3bf56c8c 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -247,6 +247,7 @@ public slots: void zoomReset(); void cutLine(); + void copyLine(); void deleteLine(); void unfoldAll(); void fold(); diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index 35445b163888cb107fe27814728a9ff2b42f38f2..73819d41bed0d7adb9fc03fa6a95c98670adb71e 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -77,6 +77,7 @@ TextEditorActionHandler::TextEditorActionHandler(const char *context, m_foldAction(0), m_unfoldAction(0), m_cutLineAction(0), + m_copyLineAction(0), m_deleteLineAction(0), m_selectEncodingAction(0), m_increaseFontSizeAction(0), @@ -201,6 +202,11 @@ void TextEditorActionHandler::createActions() command->setDefaultKeySequence(QKeySequence(tr("Shift+Del"))); connect(m_cutLineAction, SIGNAL(triggered()), this, SLOT(cutLine())); + m_copyLineAction = new QAction(tr("Copy &Line"), this); + command = am->registerAction(m_copyLineAction, Constants::COPY_LINE, m_contextId); + command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Ins"))); + connect(m_copyLineAction, SIGNAL(triggered()), this, SLOT(copyLine())); + m_deleteLineAction = new QAction(tr("Delete &Line"), this); command = am->registerAction(m_deleteLineAction, Constants::DELETE_LINE, m_contextId, true); connect(m_deleteLineAction, SIGNAL(triggered()), this, SLOT(deleteLine())); @@ -527,6 +533,7 @@ FUNCTION2(selectAllAction, selectAll) FUNCTION(cleanWhitespace) FUNCTION(unCommentSelection) FUNCTION(cutLine) +FUNCTION(copyLine) FUNCTION(deleteLine) FUNCTION(unfoldAll) FUNCTION(fold) diff --git a/src/plugins/texteditor/texteditoractionhandler.h b/src/plugins/texteditor/texteditoractionhandler.h index fb7789a17f1c6a453ed1d75e72c136c8b069535c..f2a7839b2f8645ddc88370a64b0d31e59992f55f 100644 --- a/src/plugins/texteditor/texteditoractionhandler.h +++ b/src/plugins/texteditor/texteditoractionhandler.h @@ -102,6 +102,7 @@ private slots: void fold(); void unfold(); void cutLine(); + void copyLine(); void deleteLine(); void selectEncoding(); void increaseFontSize(); @@ -165,6 +166,7 @@ private: QAction *m_foldAction; QAction *m_unfoldAction; QAction *m_cutLineAction; + QAction *m_copyLineAction; QAction *m_deleteLineAction; QAction *m_selectEncodingAction; QAction *m_increaseFontSizeAction; diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index a32921ca406095f8b34e8c49a7508796faac833d..82209f52dbe761f999eb4f4898209246d5b83614 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -70,6 +70,7 @@ const char * const INSERT_LINE_BELOW = "TextEditor.InsertLineBelowCurrentLin const char * const UPPERCASE_SELECTION = "TextEditor.UppercaseSelection"; const char * const LOWERCASE_SELECTION = "TextEditor.LowercaseSelection"; const char * const CUT_LINE = "TextEditor.CutLine"; +const char * const COPY_LINE = "TextEditor.CopyLine"; const char * const DELETE_LINE = "TextEditor.DeleteLine"; const char * const DELETE_WORD = "TextEditor.DeleteWord"; const char * const SELECT_ENCODING = "TextEditor.SelectEncoding";