TextEditor: Add sortSelectedLines action

Change-Id: Ifdc82766bac3cfe2e9c287b4ef04902a943c8f72
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Serhii Moroz
2017-08-13 20:38:08 +03:00
parent b506fce0fe
commit bb58ab34c1
4 changed files with 52 additions and 0 deletions

View File

@@ -176,6 +176,7 @@ public:
QAction *m_insertLineBelowAction = nullptr;
QAction *m_upperCaseSelectionAction = nullptr;
QAction *m_lowerCaseSelectionAction = nullptr;
QAction *m_sortSelectedLinesAction = nullptr;
QAction *m_indentAction = nullptr;
QAction *m_unindentAction = nullptr;
QAction *m_followSymbolAction = nullptr;
@@ -382,6 +383,10 @@ void TextEditorActionHandlerPrivate::createActions()
[] (TextEditorWidget *w) { w->lowercaseSelection(); }, true, tr("Lowercase Selection"),
QKeySequence(Core::UseMacShortcuts ? tr("Meta+U") : tr("Alt+U")),
G_EDIT_TEXT, advancedEditMenu);
m_sortSelectedLinesAction = registerAction(SORT_SELECTED_LINES,
[this] (TextEditorWidget *w) { w->sortSelectedLines(); }, false, tr("&Sort Selected Lines"),
QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+S") : tr("Alt+Shift+S")),
G_EDIT_TEXT, advancedEditMenu);
m_foldAction = registerAction(FOLD,
[] (TextEditorWidget *w) { w->fold(); }, true, tr("Fold"),
QKeySequence(tr("Ctrl+<")),
@@ -500,6 +505,7 @@ void TextEditorActionHandlerPrivate::createActions()
m_modifyingActions << m_unCommentSelectionAction;
m_modifyingActions << m_unindentAction;
m_modifyingActions << m_upperCaseSelectionAction;
m_modifyingActions << m_sortSelectedLinesAction;
// set enabled state of optional actions
m_followSymbolAction->setEnabled(m_optionalActions & TextEditorActionHandler::FollowSymbolUnderCursor);