Commit 91a492a5 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Reverted a change which introduced a duplicate action for

(re-)formatting.
parent 20b9258d
......@@ -737,11 +737,6 @@ TextEditor::BaseTextEditor::Link ScriptEditor::findLinkAt(const QTextCursor &cur
return link;
}
void ScriptEditor::reformat(QTextDocument *, QTextBlock)
{
// TODO (EV)
}
void ScriptEditor::contextMenuEvent(QContextMenuEvent *e)
{
QMenu *menu = createStandardContextMenu();
......
......@@ -131,7 +131,6 @@ protected:
TextEditor::BaseTextEditorEditable *createEditableInterface();
void createToolBar(ScriptEditorEditable *editable);
TextEditor::BaseTextEditor::Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true);
virtual void reformat(QTextDocument *doc, QTextBlock block);
private:
virtual bool isElectricCharacter(const QChar &ch) const;
......
......@@ -110,7 +110,6 @@ bool DuiEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
m_actionHandler = new TextEditor::TextEditorActionHandler(DuiEditor::Constants::C_DUIEDITOR,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::Reformat
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll);
m_actionHandler->initializeActions();
......
......@@ -3307,10 +3307,6 @@ void BaseTextEditor::indentBlock(QTextDocument *, QTextBlock, QChar)
{
}
void BaseTextEditor::reformatBlock(QTextDocument *, QTextBlock)
{
}
void BaseTextEditor::indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar)
{
if (cursor.hasSelection()) {
......@@ -3325,20 +3321,6 @@ void BaseTextEditor::indent(QTextDocument *doc, const QTextCursor &cursor, QChar
}
}
void BaseTextEditor::reformat(QTextDocument *doc, const QTextCursor &cursor)
{
if (cursor.hasSelection()) {
QTextBlock block = doc->findBlock(qMin(cursor.selectionStart(), cursor.selectionEnd()));
const QTextBlock end = doc->findBlock(qMax(cursor.selectionStart(), cursor.selectionEnd())).next();
do {
reformatBlock(doc, block);
block = block.next();
} while (block.isValid() && block != end);
} else {
reformatBlock(doc, cursor.block());
}
}
BaseTextEditor::Link BaseTextEditor::findLinkAt(const QTextCursor &, bool)
{
return Link();
......@@ -4074,14 +4056,6 @@ void BaseTextEditor::format()
cursor.endEditBlock();
}
void BaseTextEditor::reformat()
{
QTextCursor cursor = textCursor();
cursor.beginEditBlock();
reformat(document(), cursor);
cursor.endEditBlock();
}
void BaseTextEditor::rewrapParagraph()
{
const int paragraphWidth = displaySettings().m_wrapColumn;
......
......@@ -484,7 +484,6 @@ public:
public slots:
virtual void format();
virtual void reformat();
virtual void rewrapParagraph();
virtual void unCommentSelection();
virtual void setFontSettings(const TextEditor::FontSettings &);
......@@ -518,11 +517,6 @@ protected:
// Indent at cursor. Calls indentBlock for selection or current line.
virtual void indent(QTextDocument *doc, const QTextCursor &cursor, QChar typedChar);
// Reformats/prettyprints a text block based on previous line. Default does nothing
virtual void reformatBlock(QTextDocument *doc, QTextBlock block);
// Reformat/prettyprint the current document.
virtual void reformat(QTextDocument *doc, const QTextCursor &cursor);
struct Link
{
Link(const QString &fileName = QString(),
......
......@@ -65,7 +65,6 @@ TextEditorActionHandler::TextEditorActionHandler(const QString &context,
m_cleanWhitespaceAction(0),
m_textWrappingAction(0),
m_unCommentSelectionAction(0),
m_reformatAction(0),
m_unCollapseAllAction(0),
m_collapseAction(0),
m_expandAction(0),
......@@ -184,12 +183,6 @@ void TextEditorActionHandler::createActions()
connect(m_unCommentSelectionAction, SIGNAL(triggered()), this, SLOT(unCommentSelection()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT);
m_reformatAction = new QAction(tr("&Reformat"), this);
command = am->registerAction(m_reformatAction, Constants::REFORMAT, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+F")));
connect(m_reformatAction, SIGNAL(triggered()), this, SLOT(reformatAction()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT);
m_cutLineAction = new QAction(tr("Cut &Line"), this);
command = am->registerAction(m_cutLineAction, Constants::CUT_LINE, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Shift+Del")));
......@@ -329,7 +322,6 @@ void TextEditorActionHandler::updateActions(UpdateMode um)
m_pasteAction->setEnabled(um != ReadOnlyMode);
m_formatAction->setEnabled((m_optionalActions & Format) && um != ReadOnlyMode);
m_unCommentSelectionAction->setEnabled((m_optionalActions & UnCommentSelection) && um != ReadOnlyMode);
m_reformatAction->setEnabled((m_optionalActions & Reformat) && um != ReadOnlyMode);
m_moveLineUpAction->setEnabled(um != ReadOnlyMode);
m_moveLineDownAction->setEnabled(um != ReadOnlyMode);
......@@ -418,7 +410,6 @@ FUNCTION2(copyAction, copy)
FUNCTION2(cutAction, cut)
FUNCTION2(pasteAction, paste)
FUNCTION2(formatAction, format)
FUNCTION2(reformatAction, reformat)
FUNCTION2(rewrapParagraphAction, rewrapParagraph)
FUNCTION2(selectAllAction, selectAll)
FUNCTION(cleanWhitespace)
......
......@@ -54,8 +54,7 @@ public:
None = 0,
Format = 1,
UnCommentSelection = 2,
UnCollapseAll = 4,
Reformat = 8
UnCollapseAll = 4
};
TextEditorActionHandler(const QString &context, uint optionalActions = None);
......@@ -92,7 +91,6 @@ private slots:
void gotoAction();
void printAction();
void formatAction();
void reformatAction();
void rewrapParagraphAction();
void setVisualizeWhitespace(bool);
void cleanWhitespace();
......@@ -133,7 +131,6 @@ private:
QAction *m_cleanWhitespaceAction;
QAction *m_textWrappingAction;
QAction *m_unCommentSelectionAction;
QAction *m_reformatAction;
QAction *m_unCollapseAllAction;
QAction *m_collapseAction;
QAction *m_expandAction;
......
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