Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7783e7dc authored by C. Boemann's avatar C. Boemann

Implement review comment suggestions

parent 2acd2f9a
......@@ -24,8 +24,6 @@
#include <klocale.h>
#include <KDebug>
class KoShapeDeleteCommand::Private
{
public:
......
......@@ -59,7 +59,7 @@ const QUrl KoTextDocument::LayoutTextPageUrl = QUrl("kotext://layoutTextPage");
const QUrl KoTextDocument::ParaTableSpacingAtStartUrl = QUrl("kotext://spacingAtStart");
const QUrl KoTextDocument::IndexGeneratorManagerUrl = QUrl("kotext://indexGeneratorManager");
const QUrl KoTextDocument::FrameCharFormatUrl = QUrl("kotext://frameCharFormat");
const QUrl KoTextDocument::ShapeControllerURL = QUrl("kotext://shapeController");
const QUrl KoTextDocument::ShapeControllerUrl = QUrl("kotext://shapeController");
KoTextDocument::KoTextDocument(QTextDocument *document)
: m_document(document)
......@@ -147,12 +147,12 @@ void KoTextDocument::setShapeController(KoShapeController *controller)
{
QVariant v;
v.setValue(controller);
m_document->addResource(KoTextDocument::ShapeController, ShapeControllerURL, v);
m_document->addResource(KoTextDocument::ShapeController, ShapeControllerUrl, v);
}
KoShapeController *KoTextDocument::shapeController() const
{
QVariant resource = m_document->resource(KoTextDocument::ShapeController, ShapeControllerURL);
QVariant resource = m_document->resource(KoTextDocument::ShapeController, ShapeControllerUrl);
if (resource.isValid()) {
return resource.value<KoShapeController *>();
}
......
......@@ -196,7 +196,7 @@ public:
LayoutTextPage, /// this is used for setting the correct page variable on the first resize and should not be used for other purposes
ParaTableSpacingAtStart, /// this is used during layouting to specify if at the first paragraph margin-top should be applied.
IndexGeneratorManager ,
FrameCharFormat ,
FrameCharFormat,
ShapeController
};
......@@ -216,7 +216,7 @@ public:
static const QUrl ParaTableSpacingAtStartUrl;
static const QUrl IndexGeneratorManagerUrl;
static const QUrl FrameCharFormatUrl;
static const QUrl ShapeControllerURL;
static const QUrl ShapeControllerUrl;
private:
QTextDocument *m_document;
......
......@@ -97,7 +97,7 @@ KoTextEditor::Private::Private(KoTextEditor *qq, QTextDocument *document)
, document (document)
, addNewCommand(true)
, dummyMacroAdded(false)
, inCustomCommand(0)
, customCommandCount(0)
, editProtectionCached(false)
{
caret = QTextCursor(document);
......@@ -732,8 +732,7 @@ void KoTextEditor::deleteChar(bool previous, KUndo2Command *parent)
addCommand(new ChangeTrackedDeleteCommand(ChangeTrackedDeleteCommand::PreviousChar,
d->document,
shapeController, parent));
}
else {
} else {
addCommand(new ChangeTrackedDeleteCommand(ChangeTrackedDeleteCommand::NextChar,
d->document,
shapeController, parent));
......@@ -744,8 +743,7 @@ void KoTextEditor::deleteChar(bool previous, KUndo2Command *parent)
addCommand(new DeleteCommand(DeleteCommand::PreviousChar,
d->document,
shapeController, parent));
}
else {
} else {
addCommand(new DeleteCommand(DeleteCommand::NextChar,
d->document,
shapeController, parent));
......@@ -975,8 +973,7 @@ void KoTextEditor::insertTable(int rows, int columns)
bool hasSelection = d->caret.hasSelection();
if (!hasSelection) {
d->updateState(KoTextEditor::Private::Custom, i18nc("(qtundo-format)", "Insert Table"));
}
else {
} else {
KUndo2Command *topCommand = beginEditBlock(i18nc("(qtundo-format)", "Insert Table"));
deleteChar(false, topCommand);
d->caret.beginEditBlock();
......@@ -1201,8 +1198,7 @@ KoInlineNote *KoTextEditor::insertFootNote()
bool hasSelection = d->caret.hasSelection();
if (!hasSelection) {
d->updateState(KoTextEditor::Private::Custom, i18nc("(qtundo-format)", "Insert Footnote"));
}
else {
} else {
KUndo2Command *topCommand = beginEditBlock(i18nc("(qtundo-format)", "Insert Footnote"));
deleteChar(false, topCommand);
d->caret.beginEditBlock();
......@@ -1234,8 +1230,7 @@ KoInlineNote *KoTextEditor::insertEndNote()
bool hasSelection = d->caret.hasSelection();
if (!hasSelection) {
d->updateState(KoTextEditor::Private::Custom, i18nc("(qtundo-format)", "Insert Endnote"));
}
else {
} else {
KUndo2Command *topCommand = beginEditBlock(i18nc("(qtundo-format)", "Insert Endnote"));
deleteChar(false, topCommand);
d->caret.beginEditBlock();
......@@ -1267,8 +1262,7 @@ void KoTextEditor::insertTableOfContents(KoTableOfContentsGeneratorInfo *info)
bool hasSelection = d->caret.hasSelection();
if (!hasSelection) {
d->updateState(KoTextEditor::Private::Custom, i18nc("(qtundo-format)", "Insert Table Of Contents"));
}
else {
} else {
KUndo2Command *topCommand = beginEditBlock(i18nc("(qtundo-format)", "Insert Table Of Contents"));
deleteChar(false, topCommand);
d->caret.beginEditBlock();
......@@ -1339,8 +1333,7 @@ void KoTextEditor::insertBibliography()
bool hasSelection = d->caret.hasSelection();
if (!hasSelection) {
d->updateState(KoTextEditor::Private::Custom, i18nc("(qtundo-format)", "Insert Bibliography"));
}
else {
} else {
KUndo2Command *topCommand = beginEditBlock(i18nc("(qtundo-format)", "Insert Bibliography"));
deleteChar(false, topCommand);
d->caret.beginEditBlock();
......@@ -1394,8 +1387,7 @@ KoInlineCite *KoTextEditor::insertCitation()
bool hasSelection = d->caret.hasSelection();
if (!hasSelection) {
d->updateState(KoTextEditor::Private::KeyPress, i18nc("(qtundo-format)", "Add Citation"));
}
else {
} else {
KUndo2Command *topCommand = beginEditBlock(i18nc("(qtundo-format)", "Add Citation"));
deleteChar(false, topCommand);
d->caret.beginEditBlock();
......@@ -1424,8 +1416,7 @@ void KoTextEditor::insertText(const QString &text)
bool hasSelection = d->caret.hasSelection();
if (!hasSelection) {
d->updateState(KoTextEditor::Private::KeyPress, i18nc("(qtundo-format)", "Typing"));
}
else {
} else {
KUndo2Command *topCommand = beginEditBlock(i18nc("(qtundo-format)", "Typing"));
deleteChar(false, topCommand);
d->caret.beginEditBlock();
......@@ -1564,8 +1555,7 @@ void KoTextEditor::newLine()
bool hasSelection = d->caret.hasSelection();
if (!hasSelection) {
d->updateState(KoTextEditor::Private::Custom, i18nc("(qtundo-format)", "New Paragraph"));
}
else {
} else {
KUndo2Command *topCommand = beginEditBlock(i18nc("(qtundo-format)", "New Paragraph"));
deleteChar(false, topCommand);
d->caret.beginEditBlock();
......
......@@ -67,7 +67,7 @@ public:
QStack<KUndo2Command*> commandStack;
bool addNewCommand;
bool dummyMacroAdded;
int inCustomCommand;
int customCommandCount;
QString commandTitle;
State editorState;
......
......@@ -249,7 +249,7 @@ void KoTextEditor::addCommand(KUndo2Command *command)
//When we reach that point, the command has been executed. We first need to clean up all the automatically generated headCommand on our commandStack, which could potentially have been created during the editing. When we reach our pushed command, the commandStack is clean. We can then call a state update to NoOp and decrease the inCustomCommand counter.
kDebug(32500) << "the command has been executed. we need to clean up the commandStack of the auto generated headCommands";
kDebug(32500) << "before cleaning. commandStack count: " << d->commandStack.count();
while(d->commandStack.top() != command) {
while (d->commandStack.top() != command) {
d->commandStack.pop();
}
kDebug(32500) << "after cleaning. commandStack count: " << d->commandStack.count() << " will set NoOp";
......
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