Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KPimTextEdit
Commits
c6fa90c5
Commit
c6fa90c5
authored
Nov 01, 2020
by
Laurent Montel
😁
Browse files
Modernize code
parent
514469e2
Pipeline
#39255
passed with stage
in 13 minutes and 14 seconds
Changes
47
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/editorutiltest.cpp
View file @
c6fa90c5
...
...
@@ -35,7 +35,7 @@ void EditorUtilTest::testUpperCase()
QFETCH
(
QString
,
result
);
QFETCH
(
int
,
startcursorposition
);
QFETCH
(
int
,
endcursorposition
);
QTextDocument
*
document
=
new
QTextDocument
(
this
);
auto
*
document
=
new
QTextDocument
(
this
);
document
->
setPlainText
(
input
);
QTextCursor
textCursor
(
document
);
if
(
startcursorposition
!=
-
1
&&
endcursorposition
!=
-
1
)
{
...
...
@@ -65,7 +65,7 @@ void EditorUtilTest::testLowerCase()
QFETCH
(
QString
,
result
);
QFETCH
(
int
,
startcursorposition
);
QFETCH
(
int
,
endcursorposition
);
QTextDocument
*
document
=
new
QTextDocument
(
this
);
auto
*
document
=
new
QTextDocument
(
this
);
document
->
setPlainText
(
input
);
QTextCursor
textCursor
(
document
);
if
(
startcursorposition
!=
-
1
&&
endcursorposition
!=
-
1
)
{
...
...
@@ -95,7 +95,7 @@ void EditorUtilTest::testSentenceCase()
QFETCH
(
QString
,
result
);
QFETCH
(
int
,
startcursorposition
);
QFETCH
(
int
,
endcursorposition
);
QTextDocument
*
document
=
new
QTextDocument
(
this
);
auto
*
document
=
new
QTextDocument
(
this
);
document
->
setPlainText
(
input
);
QTextCursor
textCursor
(
document
);
if
(
startcursorposition
!=
-
1
&&
endcursorposition
!=
-
1
)
{
...
...
@@ -127,7 +127,7 @@ void EditorUtilTest::testReverseCase()
QFETCH
(
int
,
startcursorposition
);
QFETCH
(
int
,
endcursorposition
);
QTextDocument
*
document
=
new
QTextDocument
(
this
);
auto
*
document
=
new
QTextDocument
(
this
);
document
->
setPlainText
(
input
);
QTextCursor
textCursor
(
document
);
if
(
startcursorposition
!=
-
1
&&
endcursorposition
!=
-
1
)
{
...
...
autotests/slidecontainertest.cpp
View file @
c6fa90c5
...
...
@@ -27,7 +27,7 @@ struct TestWindow : public QWidget {
createContent
();
mMainWidget
=
new
QTextEdit
();
QVBoxLayo
ut
*
layout
=
new
QVBoxLayout
(
this
);
a
ut
o
*
layout
=
new
QVBoxLayout
(
this
);
layout
->
setSpacing
(
0
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
addWidget
(
mMainWidget
);
...
...
src/composer-ng/autotests/richtextcomposerwidgettest.cpp
View file @
c6fa90c5
...
...
@@ -21,7 +21,7 @@ RichTextComposerWidgetTest::~RichTextComposerWidgetTest()
void
RichTextComposerWidgetTest
::
shouldHaveDefaultValue
()
{
KPIMTextEdit
::
RichTextComposerWidget
w
;
KPIMTextEdit
::
RichTextComposer
*
composer
=
w
.
findChild
<
KPIMTextEdit
::
RichTextComposer
*>
(
QStringLiteral
(
"richtextcomposer"
));
auto
*
composer
=
w
.
findChild
<
KPIMTextEdit
::
RichTextComposer
*>
(
QStringLiteral
(
"richtextcomposer"
));
QVERIFY
(
composer
);
QVERIFY
(
w
.
richTextComposer
());
}
...
...
src/composer-ng/klinkdialog.cpp
View file @
c6fa90c5
...
...
@@ -25,9 +25,9 @@ KLinkDialog::KLinkDialog(QWidget *parent)
setWindowTitle
(
i18nc
(
"@title:window"
,
"Manage Link"
));
setModal
(
true
);
QVBoxLayo
ut
*
layout
=
new
QVBoxLayout
(
this
);
a
ut
o
*
layout
=
new
QVBoxLayout
(
this
);
QGridLayo
ut
*
grid
=
new
QGridLayout
;
a
ut
o
*
grid
=
new
QGridLayout
;
textLabel
=
new
QLabel
(
i18n
(
"Link Text:"
),
this
);
textLineEdit
=
new
QLineEdit
(
this
);
...
...
src/composer-ng/nestedlisthelper.cpp
View file @
c6fa90c5
...
...
@@ -272,7 +272,7 @@ void NestedListHelper::handleOnBulletType(int styleIndex)
{
QTextCursor
cursor
=
textEdit
->
textCursor
();
if
(
styleIndex
!=
0
)
{
QTextListFormat
::
Style
style
=
static_cast
<
QTextListFormat
::
Style
>
(
styleIndex
);
auto
style
=
static_cast
<
QTextListFormat
::
Style
>
(
styleIndex
);
QTextList
*
currentList
=
cursor
.
currentList
();
QTextListFormat
listFmt
;
...
...
src/composer-ng/richtextcomposer.cpp
View file @
c6fa90c5
...
...
@@ -118,7 +118,7 @@ void RichTextComposer::createActions(KActionCollection *ac)
void
RichTextComposer
::
updateHighLighter
()
{
KPIMTextEdit
::
RichTextComposerEmailQuoteHighlighter
*
hlighter
=
qobject_cast
<
KPIMTextEdit
::
RichTextComposerEmailQuoteHighlighter
*>
(
highlighter
());
auto
*
hlighter
=
qobject_cast
<
KPIMTextEdit
::
RichTextComposerEmailQuoteHighlighter
*>
(
highlighter
());
if
(
hlighter
)
{
hlighter
->
toggleSpellHighlighting
(
checkSpellingEnabled
());
}
...
...
@@ -243,9 +243,9 @@ void RichTextComposer::forcePlainTextMarkup(bool force)
void
RichTextComposer
::
insertPlainTextImplementation
()
{
if
(
d
->
forcePlainTextMarkup
)
{
KPIMTextEdit
::
PlainTextMarkupBuilder
*
pb
=
new
KPIMTextEdit
::
PlainTextMarkupBuilder
();
auto
*
pb
=
new
KPIMTextEdit
::
PlainTextMarkupBuilder
();
pb
->
setQuotePrefix
(
defaultQuoteSign
());
KPIMTextEdit
::
MarkupDirec
to
r
*
pmd
=
new
KPIMTextEdit
::
MarkupDirector
(
pb
);
au
to
*
pmd
=
new
KPIMTextEdit
::
MarkupDirector
(
pb
);
pmd
->
processDocument
(
document
());
const
QString
plainText
=
pb
->
getResult
();
document
()
->
setPlainText
(
plainText
);
...
...
src/composer-ng/richtextcomposeractions.cpp
View file @
c6fa90c5
...
...
@@ -145,7 +145,7 @@ void RichTextComposerActions::createActions(KActionCollection *ac)
ac
->
addAction
(
QStringLiteral
(
"format_align_justify"
),
d
->
action_align_justify
);
}
QActionGroup
*
alignmentGroup
=
new
QActionGroup
(
this
);
auto
*
alignmentGroup
=
new
QActionGroup
(
this
);
alignmentGroup
->
addAction
(
d
->
action_align_left
);
alignmentGroup
->
addAction
(
d
->
action_align_center
);
alignmentGroup
->
addAction
(
d
->
action_align_right
);
...
...
@@ -174,7 +174,7 @@ void RichTextComposerActions::createActions(KActionCollection *ac)
ac
->
addAction
(
QStringLiteral
(
"direction_rtl"
),
d
->
action_direction_rtl
);
}
QActionGroup
*
directionGroup
=
new
QActionGroup
(
this
);
auto
*
directionGroup
=
new
QActionGroup
(
this
);
directionGroup
->
addAction
(
d
->
action_direction_ltr
);
directionGroup
->
addAction
(
d
->
action_direction_rtl
);
...
...
src/composer-ng/richtextcomposerwidget.cpp
View file @
c6fa90c5
...
...
@@ -25,11 +25,11 @@ RichTextComposerWidget::RichTextComposerWidget(QWidget *parent)
:
QWidget
(
parent
)
,
d
(
new
KPIMTextEdit
::
RichTextComposerWidgetPrivate
)
{
QHBoxLayo
ut
*
layout
=
new
QHBoxLayout
(
this
);
a
ut
o
*
layout
=
new
QHBoxLayout
(
this
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
d
->
richTextComposer
=
new
KPIMTextEdit
::
RichTextComposer
(
this
);
d
->
richTextComposer
->
setObjectName
(
QStringLiteral
(
"richtextcomposer"
));
RichTextEditorWidget
*
editorWidget
=
new
RichTextEditorWidget
(
d
->
richTextComposer
,
this
);
auto
*
editorWidget
=
new
RichTextEditorWidget
(
d
->
richTextComposer
,
this
);
layout
->
addWidget
(
editorWidget
);
}
...
...
src/composer-ng/tests/richtextcomposerwidget_gui.cpp
View file @
c6fa90c5
...
...
@@ -23,10 +23,10 @@ int main(int argc, char **argv)
parser
.
addVersionOption
();
parser
.
addHelpOption
();
parser
.
process
(
app
);
KPIMTextEdit
::
RichTextComposer
*
richtextcomposerwidget
=
new
KPIMTextEdit
::
RichTextComposer
;
auto
*
richtextcomposerwidget
=
new
KPIMTextEdit
::
RichTextComposer
;
KActionCollection
*
ac
=
new
KActionCollection
(
richtextcomposerwidget
);
richtextcomposerwidget
->
createActions
(
ac
);
KPIMTextEdit
::
RichTextEditorWidget
*
editor
=
new
KPIMTextEdit
::
RichTextEditorWidget
(
richtextcomposerwidget
);
auto
*
editor
=
new
KPIMTextEdit
::
RichTextEditorWidget
(
richtextcomposerwidget
);
editor
->
resize
(
800
,
600
);
editor
->
show
();
...
...
src/emoticon/emoticonlistwidgetselector.cpp
View file @
c6fa90c5
...
...
@@ -68,7 +68,7 @@ void EmoticonListWidgetSelector::slotEmoticonClicked(QListWidgetItem *item)
if
(
!
item
)
{
return
;
}
EmoticonTextEditItem
*
itemEmoticon
=
static_cast
<
EmoticonTextEditItem
*>
(
item
);
auto
*
itemEmoticon
=
static_cast
<
EmoticonTextEditItem
*>
(
item
);
Q_EMIT
itemSelected
(
itemEmoticon
->
text
());
}
src/emoticon/emoticontexteditaction.cpp
View file @
c6fa90c5
...
...
@@ -22,7 +22,7 @@ public:
:
emoticonMenu
(
new
QMenu
())
{
selector
=
new
EmoticonTextEditSelector
(
emoticonMenu
);
QWidgetAction
*
action
=
new
QWidgetAction
(
emoticonMenu
);
auto
*
action
=
new
QWidgetAction
(
emoticonMenu
);
action
->
setDefaultWidget
(
selector
);
emoticonMenu
->
addAction
(
action
);
connect
(
emoticonMenu
,
&
QMenu
::
aboutToShow
,
selector
,
&
EmoticonTextEditSelector
::
loadEmoticons
);
...
...
src/emoticon/emoticontexteditselector.cpp
View file @
c6fa90c5
...
...
@@ -16,7 +16,7 @@ using namespace KPIMTextEdit;
EmoticonTextEditSelector
::
EmoticonTextEditSelector
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
QHBoxLayo
ut
*
lay
=
new
QHBoxLayout
(
this
);
a
ut
o
*
lay
=
new
QHBoxLayout
(
this
);
lay
->
setSpacing
(
0
);
lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
mUnicodeTab
=
new
EmoticonUnicodeTab
(
this
);
...
...
src/emoticon/emoticonunicodetab.cpp
View file @
c6fa90c5
...
...
@@ -65,7 +65,7 @@ void EmoticonUnicodeTab::loadEmoticons()
void
EmoticonUnicodeTab
::
createPlainTextEmoticonTab
(
const
QString
&
str
,
const
QVector
<
EmoticonUnicodeUtils
::
EmoticonStruct
>
&
emoticons
)
{
if
(
!
emoticons
.
isEmpty
())
{
EmoticonListWidgetSelec
to
r
*
selector
=
new
EmoticonListWidgetSelector
(
this
);
au
to
*
selector
=
new
EmoticonListWidgetSelector
(
this
);
connect
(
selector
,
&
KPIMTextEdit
::
EmoticonListWidgetSelector
::
itemSelected
,
this
,
&
EmoticonUnicodeTab
::
itemSelected
);
QStringList
lst
;
lst
.
reserve
(
emoticons
.
count
());
...
...
src/inserthtmldialog.cpp
View file @
c6fa90c5
...
...
@@ -24,12 +24,12 @@ public:
:
q
(
qq
)
{
q
->
setWindowTitle
(
i18nc
(
"@title:window"
,
"Insert HTML"
));
QVBoxLayo
ut
*
lay
=
new
QVBoxLayout
(
q
);
a
ut
o
*
lay
=
new
QVBoxLayout
(
q
);
QLabel
*
label
=
new
QLabel
(
i18n
(
"Insert HTML tags and texts:"
));
lay
->
addWidget
(
label
);
editor
=
new
InsertHtmlEditor
;
editor
->
setSpellCheckingSupport
(
false
);
KPIMTextEdit
::
PlainTextEditorWidget
*
editorWidget
=
new
KPIMTextEdit
::
PlainTextEditorWidget
(
editor
);
auto
*
editorWidget
=
new
KPIMTextEdit
::
PlainTextEditorWidget
(
editor
);
lay
->
addWidget
(
editorWidget
);
label
=
new
QLabel
(
i18n
(
"Example: <i> Hello word </i>"
));
QFont
font
=
label
->
font
();
...
...
src/inserthtmleditor.cpp
View file @
c6fa90c5
...
...
@@ -27,7 +27,7 @@ InsertHtmlEditor::InsertHtmlEditor(QWidget *parent)
qCWarning
(
KPIMTEXTEDIT_LOG
)
<<
"Invalid definition name"
;
}
KSyntaxHighlighting
::
SyntaxHighlighter
*
hl
=
new
KSyntaxHighlighting
::
SyntaxHighlighter
(
document
());
auto
*
hl
=
new
KSyntaxHighlighting
::
SyntaxHighlighter
(
document
());
hl
->
setTheme
((
palette
().
color
(
QPalette
::
Base
).
lightness
()
<
128
)
?
mRepo
.
defaultTheme
(
KSyntaxHighlighting
::
Repository
::
DarkTheme
)
:
mRepo
.
defaultTheme
(
KSyntaxHighlighting
::
Repository
::
LightTheme
));
...
...
src/insertimagedialog.cpp
View file @
c6fa90c5
...
...
@@ -22,7 +22,7 @@ public:
InsertImageDialogPrivate
(
InsertImageDialog
*
qq
)
:
q
(
qq
)
{
QVBoxLayo
ut
*
vbox
=
new
QVBoxLayout
(
q
);
a
ut
o
*
vbox
=
new
QVBoxLayout
(
q
);
q
->
setWindowTitle
(
i18nc
(
"@title:window"
,
"Insert Image"
));
imageWidget
=
new
InsertImageWidget
(
q
);
...
...
src/insertimagewidget.cpp
View file @
c6fa90c5
...
...
@@ -33,9 +33,9 @@ public:
InsertImageWidgetPrivate
(
InsertImageWidget
*
qq
)
:
q
(
qq
)
{
QVBoxLayo
ut
*
lay
=
new
QVBoxLayout
(
q
);
a
ut
o
*
lay
=
new
QVBoxLayout
(
q
);
lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
QHBoxLayo
ut
*
hbox
=
new
QHBoxLayout
;
a
ut
o
*
hbox
=
new
QHBoxLayout
;
QLabel
*
lab
=
new
QLabel
(
i18n
(
"Image Location:"
));
imageUrlRequester
=
new
KUrlRequester
;
...
...
src/inserttabledialog.cpp
View file @
c6fa90c5
...
...
@@ -24,7 +24,7 @@ public:
:
q
(
qq
)
{
q
->
setWindowTitle
(
i18nc
(
"@title:window"
,
"Insert Table"
));
QVBoxLayo
ut
*
mainLayout
=
new
QVBoxLayout
(
q
);
a
ut
o
*
mainLayout
=
new
QVBoxLayout
(
q
);
insertTableWidget
=
new
InsertTableWidget
(
q
);
mainLayout
->
addWidget
(
insertTableWidget
);
...
...
src/inserttablewidget.cpp
View file @
c6fa90c5
...
...
@@ -35,7 +35,7 @@ public:
mBorder
->
setValue
(
1
);
mBorder
->
setSuffix
(
i18n
(
" px"
));
QGridLayo
ut
*
gridLayout
=
new
QGridLayout
;
a
ut
o
*
gridLayout
=
new
QGridLayout
;
gridLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
gridLayout
->
addWidget
(
new
QLabel
(
i18n
(
"Rows:"
)),
0
,
0
);
gridLayout
->
addWidget
(
mRows
,
0
,
1
);
...
...
src/selectspecialchardialog.cpp
View file @
c6fa90c5
...
...
@@ -22,7 +22,7 @@ public:
{
q
->
setWindowTitle
(
i18nc
(
"@title:window"
,
"Select Special Characters"
));
QVBoxLayo
ut
*
lay
=
new
QVBoxLayout
(
q
);
a
ut
o
*
lay
=
new
QVBoxLayout
(
q
);
mCharSelect
=
new
KCharSelect
(
q
,
nullptr
,
KCharSelect
::
CharacterTable
|
KCharSelect
::
BlockCombos
);
q
->
connect
(
mCharSelect
,
&
KCharSelect
::
charSelected
,
...
...
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment