Commit 9879de29 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove unused method + cons't'ify

parent a69e8837
......@@ -169,7 +169,7 @@ void NestedListHelper::processList(QTextList *list)
block = block.next();
QTextList *nextList = block.textList();
int nextItemIndent = nextList->format().indent();
const int nextItemIndent = nextList->format().indent();
if (nextItemIndent < thisListIndent) {
return;
} else if (nextItemIndent > thisListIndent) {
......@@ -190,7 +190,7 @@ void NestedListHelper::processList(QTextList *list)
void NestedListHelper::reformatList(QTextBlock block)
{
if (block.textList()) {
int minimumIndent = block.textList()->format().indent();
const int minimumIndent = block.textList()->format().indent();
// Start at the top of the list
while (block.previous().textList() != nullptr) {
......@@ -268,8 +268,7 @@ void NestedListHelper::handleOnIndentLess()
if (!currentList) {
return;
}
QTextListFormat listFmt;
listFmt = currentList->format();
QTextListFormat listFmt = currentList->format();
if (listFmt.indent() > 1) {
listFmt.setIndent(listFmt.indent() - 1);
cursor.createList(listFmt);
......
......@@ -118,7 +118,8 @@ QVector<QAction *> RichTextComposer::richTextActionList() const
void RichTextComposer::setEnableActions(bool state)
{
for (QAction *act : richTextActionList()) {
const QVector<QAction *> richAction = richTextActionList();
for (QAction *act : richAction) {
act->setEnabled(state);
}
}
......@@ -282,8 +283,8 @@ void RichTextComposer::activateRichText()
if (d->undoHtmlVersion.isValid() && (toPlainText() == d->undoHtmlVersion.plainText)) {
setHtml(d->undoHtmlVersion.originalHtml);
d->undoHtmlVersion.clear();
} else {
#if 0 //Need to investigate it
} else {
//try to import markdown
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
document()->setMarkdown(toPlainText(), QTextDocument::MarkdownDialectCommonMark);
......@@ -335,8 +336,8 @@ void RichTextComposer::evaluateReturnKeySupport(QKeyEvent *event)
{
if (event->key() == Qt::Key_Return) {
QTextCursor cursor = textCursor();
int oldPos = cursor.position();
int blockPos = cursor.block().position();
const int oldPos = cursor.position();
const int blockPos = cursor.block().position();
//selection all the line.
cursor.movePosition(QTextCursor::StartOfBlock);
......
......@@ -69,7 +69,7 @@ public:
void selectLinkText(QTextCursor *cursor) const;
void fixupTextEditString(QString &text) const;
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
QString addQuotesToText(const QString &inputText, const QString &defaultQuoteSign);
Q_REQUIRED_RESULT QString addQuotesToText(const QString &inputText, const QString &defaultQuoteSign);
void updateLink(const QString &linkUrl, const QString &linkText);
QFont saveFont;
QColor mLinkColor;
......@@ -649,43 +649,6 @@ void RichTextComposerControler::insertLink(const QString &url)
}
}
void RichTextComposerControler::insertShareLink(const QString &url)
{
if (url.isEmpty()) {
return;
}
const QString msg = i18n("I've linked 1 file to this email:");
if (richTextComposer()->textMode() == RichTextComposer::Rich) {
QTextCursor cursor = richTextComposer()->textCursor();
cursor.beginEditBlock();
cursor.insertText(QLatin1Char('\n') + msg + QLatin1Char('\n'));
QTextCharFormat format = cursor.charFormat();
// Save original format to create an extra space with the existing char
// format for the block
const QTextCharFormat originalFormat = format;
// Add link details
format.setAnchor(true);
format.setAnchorHref(url);
// Workaround for QTBUG-1814:
// Link formatting does not get applied immediately when setAnchor(true)
// is called. So the formatting needs to be applied manually.
format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
format.setUnderlineColor(d->linkColor());
format.setForeground(d->linkColor());
// Insert link text specified in dialog, otherwise write out url.
cursor.insertText(url, format);
cursor.setPosition(cursor.selectionEnd());
cursor.setCharFormat(originalFormat);
cursor.insertText(QStringLiteral(" \n"));
cursor.endEditBlock();
} else {
richTextComposer()->textCursor().insertText(QLatin1Char('\n') + msg + QLatin1Char('\n') + url + QLatin1Char('\n'));
}
}
void RichTextComposerControler::setCursorPositionFromStart(unsigned int pos)
{
if (pos > 0) {
......
......@@ -50,7 +50,6 @@ public:
Q_REQUIRED_RESULT bool canDedentList() const;
Q_REQUIRED_RESULT NestedListHelper *nestedListHelper() const;
void insertShareLink(const QString &url);
void insertLink(const QString &url);
void setCursorPositionFromStart(unsigned int pos);
void ensureCursorVisible();
......
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