kdeui: format and indent

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-06 22:21:26 +03:00
parent 4f55f6b021
commit afd9c69c7b
2 changed files with 432 additions and 400 deletions

View file

@ -50,6 +50,13 @@
#include <kspellhighlighter.h> #include <kspellhighlighter.h>
#include <QDebug> #include <QDebug>
static void deleteWord(QTextCursor cursor, const QTextCursor::MoveOperation op)
{
cursor.clearSelection();
cursor.movePosition(op, QTextCursor::KeepAnchor);
cursor.removeSelectedText();
}
class KTextEdit::Private class KTextEdit::Private
{ {
public: public:
@ -59,7 +66,13 @@ class KTextEdit::Private
checkSpellingEnabled(false), checkSpellingEnabled(false),
findReplaceEnabled(true), findReplaceEnabled(true),
showTabAction(true), showTabAction(true),
highlighter( 0 ), findDlg(0),find(0),repDlg(0),replace(0), findIndex(0), repIndex(0), highlighter(nullptr),
findDlg(nullptr),
find(nullptr),
repDlg(nullptr),
replace(nullptr),
findIndex(0),
repIndex(0),
lastReplacedPosition(-1) lastReplacedPosition(-1)
{ {
//Check the default settings to see if spellchecking should be enabled. //Check the default settings to see if spellchecking should be enabled.
@ -117,12 +130,12 @@ class KTextEdit::Private
QAction *autoSpellCheckAction; QAction *autoSpellCheckAction;
QAction *allowTab; QAction *allowTab;
QString clickMessage; QString clickMessage;
bool italicizePlaceholder : 1; bool italicizePlaceholder;
bool customPalette : 1; bool customPalette;
bool checkSpellingEnabled : 1; bool checkSpellingEnabled;
bool findReplaceEnabled: 1; bool findReplaceEnabled;
bool showTabAction: 1; bool showTabAction;
QTextDocumentFragment originalDoc; QTextDocumentFragment originalDoc;
QString spellCheckingLanguage; QString spellCheckingLanguage;
KSpellHighlighter *highlighter; KSpellHighlighter *highlighter;
@ -156,12 +169,12 @@ void KTextEdit::Private::slotAllowTab()
void KTextEdit::Private::menuActivated(QAction *action) void KTextEdit::Private::menuActivated(QAction *action)
{ {
if ( action == autoSpellCheckAction ) if (action == autoSpellCheckAction) {
toggleAutoSpellCheck(); toggleAutoSpellCheck();
else if ( action == allowTab ) } else if (action == allowTab) {
slotAllowTab(); slotAllowTab();
} }
}
void KTextEdit::Private::slotFindHighlight(const QString &text, int matchingIndex, int matchingLength) void KTextEdit::Private::slotFindHighlight(const QString &text, int matchingIndex, int matchingLength)
{ {
@ -174,8 +187,8 @@ void KTextEdit::Private::slotFindHighlight(const QString& text, int matchingInde
parent->ensureCursorVisible(); parent->ensureCursorVisible();
} }
void KTextEdit::Private::slotReplaceText(const QString &text, int replacementIndex, int replacedLength, int matchedLength)
void KTextEdit::Private::slotReplaceText(const QString &text, int replacementIndex, int replacedLength, int matchedLength) { {
// kDebug() << "Replace: [" << text << "] ri:" << replacementIndex << " rl:" << replacedLength << " ml:" << matchedLength; // kDebug() << "Replace: [" << text << "] ri:" << replacementIndex << " rl:" << replacedLength << " ml:" << matchedLength;
QTextCursor tc = parent->textCursor(); QTextCursor tc = parent->textCursor();
tc.setPosition(replacementIndex); tc.setPosition(replacementIndex);
@ -199,18 +212,22 @@ QRect KTextEdit::Private::clickMessageRect() const
void KTextEdit::Private::init() void KTextEdit::Private::init()
{ {
KCursor::setAutoHideCursor(parent, true, false); KCursor::setAutoHideCursor(parent, true, false);
parent->connect(parent, SIGNAL(languageChanged(QString)), parent->connect(
parent, SLOT(setSpellCheckingLanguage(QString))); parent, SIGNAL(languageChanged(QString)),
parent, SLOT(setSpellCheckingLanguage(QString))
);
} }
KTextEdit::KTextEdit(const QString &text, QWidget *parent) KTextEdit::KTextEdit(const QString &text, QWidget *parent)
: QTextEdit( text, parent ), d( new Private( this ) ) : QTextEdit(text, parent),
d( new Private(this))
{ {
d->init(); d->init();
} }
KTextEdit::KTextEdit(QWidget *parent) KTextEdit::KTextEdit(QWidget *parent)
: QTextEdit( parent ), d( new Private( this ) ) : QTextEdit(parent),
d(new Private(this))
{ {
d->init(); d->init();
} }
@ -252,7 +269,7 @@ bool KTextEdit::event(QEvent* ev)
bool KTextEdit::Private::handleShortcut(const QKeyEvent *event) bool KTextEdit::Private::handleShortcut(const QKeyEvent *event)
{ {
const int key = event->key() | event->modifiers(); const int key = (event->key() | event->modifiers());
if (KStandardShortcut::copy().contains(key)) { if (KStandardShortcut::copy().contains(key)) {
parent->copy(); parent->copy();
@ -264,20 +281,24 @@ bool KTextEdit::Private::handleShortcut(const QKeyEvent* event)
parent->cut(); parent->cut();
return true; return true;
} else if (KStandardShortcut::undo().contains(key)) { } else if (KStandardShortcut::undo().contains(key)) {
if(!parent->isReadOnly()) if (!parent->isReadOnly()) {
parent->undo(); parent->undo();
}
return true; return true;
} else if (KStandardShortcut::redo().contains(key)) { } else if (KStandardShortcut::redo().contains(key)) {
if(!parent->isReadOnly()) if (!parent->isReadOnly()) {
parent->redo(); parent->redo();
}
return true; return true;
} else if (KStandardShortcut::deleteWordBack().contains(key)) { } else if (KStandardShortcut::deleteWordBack().contains(key)) {
if (!parent->isReadOnly()) if (!parent->isReadOnly()) {
parent->deleteWordBack(); parent->deleteWordBack();
}
return true; return true;
} else if ( KStandardShortcut::deleteWordForward().contains(key)) { } else if ( KStandardShortcut::deleteWordForward().contains(key)) {
if (!parent->isReadOnly()) if (!parent->isReadOnly()) {
parent->deleteWordForward(); parent->deleteWordForward();
}
return true; return true;
} else if ( KStandardShortcut::backwardWord().contains(key)) { } else if ( KStandardShortcut::backwardWord().contains(key)) {
QTextCursor cursor = parent->textCursor(); QTextCursor cursor = parent->textCursor();
@ -352,25 +373,21 @@ bool KTextEdit::Private::handleShortcut(const QKeyEvent* event)
parent->slotFindNext(); parent->slotFindNext();
return true; return true;
} else if (findReplaceEnabled && KStandardShortcut::replace().contains(key)) { } else if (findReplaceEnabled && KStandardShortcut::replace().contains(key)) {
if (!parent->isReadOnly()) if (!parent->isReadOnly()) {
parent->slotReplace(); parent->slotReplace();
}
return true; return true;
} else if (KStandardShortcut::pasteSelection().contains(key)) { } else if (KStandardShortcut::pasteSelection().contains(key)) {
QString text = QApplication::clipboard()->text(QClipboard::Selection); QString text = QApplication::clipboard()->text(QClipboard::Selection);
if ( !text.isEmpty() ) if (!text.isEmpty()) {
parent->insertPlainText( text ); // TODO: check if this is html? (MiB) // TODO: check if this is html? (MiB)
parent->insertPlainText(text);
}
return true; return true;
} }
return false; return false;
} }
static void deleteWord(QTextCursor cursor, QTextCursor::MoveOperation op)
{
cursor.clearSelection();
cursor.movePosition( op, QTextCursor::KeepAnchor );
cursor.removeSelectedText();
}
void KTextEdit::deleteWordBack() void KTextEdit::deleteWordBack()
{ {
deleteWord(textCursor(), QTextCursor::PreviousWord); deleteWord(textCursor(), QTextCursor::PreviousWord);
@ -384,14 +401,17 @@ void KTextEdit::deleteWordForward()
QMenu *KTextEdit::mousePopupMenu() QMenu *KTextEdit::mousePopupMenu()
{ {
QMenu *popup = createStandardContextMenu(); QMenu *popup = createStandardContextMenu();
if (!popup) return 0; if (!popup) {
connect( popup, SIGNAL(triggered(QAction*)), return nullptr;
this, SLOT(menuActivated(QAction*)) ); }
connect(
popup, SIGNAL(triggered(QAction*)),
this, SLOT(menuActivated(QAction*))
);
const bool emptyDocument = document()->isEmpty(); const bool emptyDocument = document()->isEmpty();
if( !isReadOnly() ) if (!isReadOnly()) {
{
popup->addSeparator(); popup->addSeparator();
d->autoSpellCheckAction = popup->addAction(i18n("Auto Spell Check")); d->autoSpellCheckAction = popup->addAction(i18n("Auto Spell Check"));
d->autoSpellCheckAction->setCheckable( true ); d->autoSpellCheckAction->setCheckable( true );
@ -436,9 +456,11 @@ void KTextEdit::contextMenuEvent(QContextMenuEvent *event)
QTextCursor cursor = textCursor(); QTextCursor cursor = textCursor();
// Check if the user clicked a selected word // Check if the user clicked a selected word
const bool selectedWordClicked = cursor.hasSelection() && const bool selectedWordClicked = (
cursor.hasSelection() &&
mousePos >= cursor.selectionStart() && mousePos >= cursor.selectionStart() &&
mousePos <= cursor.selectionEnd(); mousePos <= cursor.selectionEnd()
);
// Get the word under the (mouse-)cursor and see if it is misspelled. // Get the word under the (mouse-)cursor and see if it is misspelled.
// Don't include apostrophes at the start/end of the word in the selection. // Don't include apostrophes at the start/end of the word in the selection.
@ -460,27 +482,33 @@ void KTextEdit::contextMenuEvent(QContextMenuEvent *event)
selectedWord = selectedWord.right(selectedWord.size() - 1); selectedWord = selectedWord.right(selectedWord.size() - 1);
wordSelectCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor); wordSelectCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor);
} }
if (selectedWord.endsWith('\'') || selectedWord.endsWith('\"')) if (selectedWord.endsWith('\'') || selectedWord.endsWith('\"')) {
selectedWord.chop(1); selectedWord.chop(1);
}
wordSelectCursor.movePosition(QTextCursor::NextCharacter, wordSelectCursor.movePosition(
QTextCursor::KeepAnchor, selectedWord.size()); QTextCursor::NextCharacter,
QTextCursor::KeepAnchor, selectedWord.size()
);
const bool wordIsMisspelled = isMouseCursorInsideWord && const bool wordIsMisspelled = (
isMouseCursorInsideWord &&
checkSpellingEnabled() && checkSpellingEnabled() &&
!selectedWord.isEmpty() && !selectedWord.isEmpty() &&
highlighter() && highlighter() &&
highlighter()->isWordMisspelled(selectedWord); highlighter()->isWordMisspelled(selectedWord)
);
// If the user clicked a selected word, do nothing. // If the user clicked a selected word, do nothing.
// If the user clicked somewhere else, move the cursor there. // If the user clicked somewhere else, move the cursor there.
// If the user clicked on a misspelled word, select that word. // If the user clicked on a misspelled word, select that word.
// Same behavior as in OpenOffice Writer. // Same behavior as in OpenOffice Writer.
if (!selectedWordClicked) { if (!selectedWordClicked) {
if (wordIsMisspelled) if (wordIsMisspelled) {
setTextCursor(wordSelectCursor); setTextCursor(wordSelectCursor);
else } else {
setTextCursor(cursorAtMouse); setTextCursor(cursorAtMouse);
}
cursor = textCursor(); cursor = textCursor();
} }
@ -501,8 +529,7 @@ void KTextEdit::contextMenuEvent(QContextMenuEvent *event)
if (reps.isEmpty()) { if (reps.isEmpty()) {
QAction *suggestionsAction = menu.addAction(i18n("No suggestions for %1", selectedWord)); QAction *suggestionsAction = menu.addAction(i18n("No suggestions for %1", selectedWord));
suggestionsAction->setEnabled(false); suggestionsAction->setEnabled(false);
} } else {
else {
QStringList::const_iterator end(reps.constEnd()); QStringList::const_iterator end(reps.constEnd());
for (QStringList::const_iterator it = reps.constBegin(); it != end; ++it) { for (QStringList::const_iterator it = reps.constBegin(); it != end; ++it) {
menu.addAction(*it); menu.addAction(*it);
@ -522,14 +549,11 @@ void KTextEdit::contextMenuEvent(QContextMenuEvent *event)
if (selectedAction == ignoreAction) { if (selectedAction == ignoreAction) {
highlighter()->ignoreWord(selectedWord); highlighter()->ignoreWord(selectedWord);
highlighter()->rehighlight(); highlighter()->rehighlight();
} } else if (selectedAction == addToDictAction) {
else if (selectedAction == addToDictAction) {
highlighter()->addWordToDictionary(selectedWord); highlighter()->addWordToDictionary(selectedWord);
highlighter()->rehighlight(); highlighter()->rehighlight();
} } else {
// Other actions can only be one of the suggested words // Other actions can only be one of the suggested words
else {
const QString replacement = selectedAction->text(); const QString replacement = selectedAction->text();
Q_ASSERT(reps.contains(replacement)); Q_ASSERT(reps.contains(replacement));
cursor.insertText(replacement); cursor.insertText(replacement);
@ -558,33 +582,33 @@ void KTextEdit::setHighlighter(KSpellHighlighter *highLighter)
void KTextEdit::setCheckSpellingEnabled(bool check) void KTextEdit::setCheckSpellingEnabled(bool check)
{ {
emit checkSpellingChanged(check); emit checkSpellingChanged(check);
if ( check == d->checkSpellingEnabled ) if (check == d->checkSpellingEnabled) {
return; return;
}
// From the above statment we know know that if we're turning checking // From the above statment we know know that if we're turning checking
// on that we need to create a new highlighter and if we're turning it // on that we need to create a new highlighter and if we're turning it
// off we should remove the old one. // off we should remove the old one.
d->checkSpellingEnabled = check; d->checkSpellingEnabled = check;
if ( check ) if (check) {
{
if (hasFocus()) { if (hasFocus()) {
createHighlighter(); createHighlighter();
if (!spellCheckingLanguage().isEmpty()) if (!spellCheckingLanguage().isEmpty()) {
setSpellCheckingLanguage(spellCheckingLanguage()); setSpellCheckingLanguage(spellCheckingLanguage());
} }
} }
else } else {
{
delete d->highlighter; delete d->highlighter;
d->highlighter = 0; d->highlighter = nullptr;
} }
} }
void KTextEdit::focusInEvent(QFocusEvent *event) void KTextEdit::focusInEvent(QFocusEvent *event)
{ {
if ( d->checkSpellingEnabled && !isReadOnly() && !d->highlighter ) if (d->checkSpellingEnabled && !isReadOnly() && !d->highlighter) {
createHighlighter(); createHighlighter();
}
QTextEdit::focusInEvent(event); QTextEdit::focusInEvent(event);
} }
@ -596,15 +620,17 @@ bool KTextEdit::checkSpellingEnabled() const
void KTextEdit::setReadOnly(bool readOnly) void KTextEdit::setReadOnly(bool readOnly)
{ {
if ( !readOnly && hasFocus() && d->checkSpellingEnabled && !d->highlighter ) if (!readOnly && hasFocus() && d->checkSpellingEnabled && !d->highlighter) {
createHighlighter(); createHighlighter();
}
if ( readOnly == isReadOnly() ) if (readOnly == isReadOnly()) {
return; return;
}
if (readOnly) { if (readOnly) {
delete d->highlighter; delete d->highlighter;
d->highlighter = 0; d->highlighter = nullptr;
d->customPalette = testAttribute(Qt::WA_SetPalette); d->customPalette = testAttribute(Qt::WA_SetPalette);
QPalette p = palette(); QPalette p = palette();
@ -619,9 +645,10 @@ void KTextEdit::setReadOnly( bool readOnly )
p.setColor(QPalette::Base, color); p.setColor(QPalette::Base, color);
p.setColor(QPalette::Background, color); p.setColor(QPalette::Background, color);
setPalette(p); setPalette(p);
} else } else {
setPalette(QPalette()); setPalette(QPalette());
} }
}
QTextEdit::setReadOnly(readOnly); QTextEdit::setReadOnly(readOnly);
} }
@ -637,14 +664,14 @@ void KTextEdit::highlightWord( int length, int pos )
void KTextEdit::replace() void KTextEdit::replace()
{ {
if ( document()->isEmpty() ) // saves having to track the text changes if (document()->isEmpty()) {
// saves having to track the text changes
return; return;
}
if (d->repDlg) { if (d->repDlg) {
KWindowSystem::activateWindow(d->repDlg->winId()); KWindowSystem::activateWindow(d->repDlg->winId());
} else { } else {
d->repDlg = new KReplaceDialog(this, 0, d->repDlg = new KReplaceDialog(this, 0, QStringList(), QStringList(), false);
QStringList(), QStringList(), false);
connect(d->repDlg, SIGNAL(okClicked()), this, SLOT(slotDoReplace())); connect(d->repDlg, SIGNAL(okClicked()), this, SLOT(slotDoReplace()));
} }
d->repDlg->show(); d->repDlg->show();
@ -673,21 +700,25 @@ void KTextEdit::slotDoReplace()
// Connect highlight signal to code which handles highlighting // Connect highlight signal to code which handles highlighting
// of found text. // of found text.
connect(d->replace, SIGNAL(highlight(QString,int,int)), connect(
this, SLOT(slotFindHighlight(QString,int,int))); d->replace, SIGNAL(highlight(QString,int,int)),
this, SLOT(slotFindHighlight(QString,int,int))
);
connect(d->replace, SIGNAL(findNext()), this, SLOT(slotReplaceNext())); connect(d->replace, SIGNAL(findNext()), this, SLOT(slotReplaceNext()));
connect(d->replace, SIGNAL(replace(QString,int,int,int)), connect(
this, SLOT(slotReplaceText(QString,int,int,int))); d->replace, SIGNAL(replace(QString,int,int,int)),
this, SLOT(slotReplaceText(QString,int,int,int))
);
d->repDlg->close(); d->repDlg->close();
slotReplaceNext(); slotReplaceNext();
} }
void KTextEdit::slotReplaceNext() void KTextEdit::slotReplaceNext()
{ {
if (!d->replace) if (!d->replace) {
return; return;
}
d->lastReplacedPosition = -1; d->lastReplacedPosition = -1;
if (!(d->replace->options() & KReplaceDialog::PromptOnReplace)) { if (!(d->replace->options() & KReplaceDialog::PromptOnReplace)) {
@ -697,8 +728,9 @@ void KTextEdit::slotReplaceNext()
KFind::Result res = KFind::NoMatch; KFind::Result res = KFind::NoMatch;
if (d->replace->needData()) if (d->replace->needData()) {
d->replace->setData(toPlainText(), d->repIndex); d->replace->setData(toPlainText(), d->repIndex);
}
res = d->replace->replace(); res = d->replace->replace();
if (!(d->replace->options() & KReplaceDialog::PromptOnReplace)) { if (!(d->replace->options() & KReplaceDialog::PromptOnReplace)) {
textCursor().endEditBlock(); // #48541 textCursor().endEditBlock(); // #48541
@ -716,7 +748,7 @@ void KTextEdit::slotReplaceNext()
if (res == KFind::NoMatch) { if (res == KFind::NoMatch) {
d->replace->displayFinalDialog(); d->replace->displayFinalDialog();
d->replace->disconnect(this); d->replace->disconnect(this);
d->replace->deleteLater(); // we are in a slot connected to m_replace, don't delete it right away d->replace->deleteLater(); // in a slot connected to m_replace, don't delete it right away
d->replace = 0; d->replace = 0;
ensureCursorVisible(); ensureCursorVisible();
// or if ( m_replace->shouldRestart() ) { reinit (w/o FromCursor) and call slotReplaceNext(); } // or if ( m_replace->shouldRestart() ) { reinit (w/o FromCursor) and call slotReplaceNext(); }
@ -725,17 +757,15 @@ void KTextEdit::slotReplaceNext()
} }
} }
void KTextEdit::slotDoFind() void KTextEdit::slotDoFind()
{ {
if (!d->findDlg) { if (!d->findDlg) {
// Should really assert() // Should really assert()
return; return;
} }
if( d->findDlg->pattern().isEmpty()) if (d->findDlg->pattern().isEmpty()) {
{
delete d->find; delete d->find;
d->find = 0; d->find = nullptr;
return; return;
} }
delete d->find; delete d->find;
@ -747,8 +777,10 @@ void KTextEdit::slotDoFind()
// Connect highlight signal to code which handles highlighting // Connect highlight signal to code which handles highlighting
// of found text. // of found text.
connect(d->find, SIGNAL(highlight(QString,int,int)), connect(
this, SLOT(slotFindHighlight(QString,int,int))); d->find, SIGNAL(highlight(QString,int,int)),
this, SLOT(slotFindHighlight(QString,int,int))
);
connect(d->find, SIGNAL(findNext()), this, SLOT(slotFindNext())); connect(d->find, SIGNAL(findNext()), this, SLOT(slotFindNext()));
d->findDlg->close(); d->findDlg->close();
@ -756,41 +788,41 @@ void KTextEdit::slotDoFind()
slotFindNext(); slotFindNext();
} }
void KTextEdit::slotFindNext() void KTextEdit::slotFindNext()
{ {
if (!d->find) if (!d->find) {
return; return;
if(document()->isEmpty()) }
{ if (document()->isEmpty()) {
d->find->disconnect(this); d->find->disconnect(this);
d->find->deleteLater(); // we are in a slot connected to m_find, don't delete right away d->find->deleteLater(); // in a slot connected to m_find, don't delete right away
d->find = 0; d->find = nullptr;
return; return;
} }
KFind::Result res = KFind::NoMatch; KFind::Result res = KFind::NoMatch;
if (d->find->needData()) if (d->find->needData()) {
d->find->setData(toPlainText(), d->findIndex); d->find->setData(toPlainText(), d->findIndex);
}
res = d->find->find(); res = d->find->find();
if (res == KFind::NoMatch) { if (res == KFind::NoMatch) {
d->find->displayFinalDialog(); d->find->displayFinalDialog();
d->find->disconnect(this); d->find->disconnect(this);
d->find->deleteLater(); // we are in a slot connected to m_find, don't delete right away d->find->deleteLater(); // in a slot connected to m_find, don't delete right away
d->find = 0; d->find = nullptr;
// or if ( m_find->shouldRestart() ) { reinit (w/o FromCursor) and call slotFindNext(); } // or if ( m_find->shouldRestart() ) { reinit (w/o FromCursor) and call slotFindNext(); }
} else { } else {
// m_find->closeFindNextDialog(); // m_find->closeFindNextDialog();
} }
} }
void KTextEdit::slotFind() void KTextEdit::slotFind()
{ {
if ( document()->isEmpty() ) // saves having to track the text changes if (document()->isEmpty()) {
// saves having to track the text changes
return; return;
}
if (d->findDlg) { if (d->findDlg) {
KWindowSystem::activateWindow(d->findDlg->winId()); KWindowSystem::activateWindow(d->findDlg->winId());
} else { } else {
@ -803,14 +835,14 @@ void KTextEdit::slotFind()
void KTextEdit::slotReplace() void KTextEdit::slotReplace()
{ {
if ( document()->isEmpty() ) // saves having to track the text changes if (document()->isEmpty()) {
// saves having to track the text changes
return; return;
}
if (d->repDlg) { if (d->repDlg) {
KWindowSystem::activateWindow(d->repDlg->winId()); KWindowSystem::activateWindow(d->repDlg->winId());
} else { } else {
d->repDlg = new KReplaceDialog(this, 0, d->repDlg = new KReplaceDialog(this, 0, QStringList(), QStringList(), false);
QStringList(), QStringList(), false);
connect( d->repDlg, SIGNAL(okClicked()), this, SLOT(slotDoReplace())); connect( d->repDlg, SIGNAL(okClicked()), this, SLOT(slotDoReplace()));
} }
d->repDlg->show(); d->repDlg->show();
@ -828,7 +860,7 @@ void KTextEdit::showTabAction( bool show )
bool KTextEdit::Private::overrideShortcut(const QKeyEvent *event) bool KTextEdit::Private::overrideShortcut(const QKeyEvent *event)
{ {
const int key = event->key() | event->modifiers(); const int key = (event->key() | event->modifiers());
if (KStandardShortcut::copy().contains(key)) { if (KStandardShortcut::copy().contains(key)) {
return true; return true;

View file

@ -1,4 +1,5 @@
/* This file is part of the KDE libraries /*
This file is part of the KDE libraries
Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
@ -43,7 +44,7 @@
* @see QTextEdit * @see QTextEdit
* @author Carsten Pfeiffer <pfeiffer@kde.org> * @author Carsten Pfeiffer <pfeiffer@kde.org>
*/ */
class KDEUI_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses class KDEUI_EXPORT KTextEdit : public QTextEdit
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString clickMessage READ clickMessage WRITE setClickMessage) Q_PROPERTY(QString clickMessage READ clickMessage WRITE setClickMessage)
@ -55,13 +56,13 @@ class KDEUI_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses
* Constructs a KTextEdit object. See QTextEdit::QTextEdit * Constructs a KTextEdit object. See QTextEdit::QTextEdit
* for details. * for details.
*/ */
explicit KTextEdit( const QString& text, QWidget *parent = 0 ); explicit KTextEdit(const QString &text, QWidget *parent = nullptr);
/** /**
* Constructs a KTextEdit object. See QTextEdit::QTextEdit * Constructs a KTextEdit object. See QTextEdit::QTextEdit
* for details. * for details.
*/ */
explicit KTextEdit( QWidget *parent = 0 ); explicit KTextEdit(QWidget *parent = nullptr);
/** /**
* Destroys the KTextEdit object. * Destroys the KTextEdit object.
@ -180,7 +181,6 @@ class KDEUI_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses
*/ */
QString clickMessage() const; QString clickMessage() const;
/** /**
* @since 4.10 * @since 4.10
*/ */