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
libkdepim
Commits
652ed8f6
Commit
652ed8f6
authored
Nov 05, 2020
by
Laurent Montel
😁
Browse files
Modernize code
parent
bb75452c
Pipeline
#40762
canceled with stage
Changes
13
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/libkdepim/misc/lineeditcatchreturnkey.cpp
View file @
652ed8f6
...
...
@@ -26,7 +26,7 @@ bool LineEditCatchReturnKey::eventFilter(QObject *obj, QEvent *event)
{
if
(
obj
==
mLineEdit
)
{
if
(
event
->
type
()
==
QEvent
::
KeyPress
)
{
QKeyEvent
*
e
=
static_cast
<
QKeyEvent
*>
(
event
);
auto
*
e
=
static_cast
<
QKeyEvent
*>
(
event
);
if
(
e
->
key
()
==
Qt
::
Key_Return
||
e
->
key
()
==
Qt
::
Key_Enter
)
{
const
bool
stopEvent
=
(
e
->
modifiers
()
==
Qt
::
NoButton
||
e
->
modifiers
()
==
Qt
::
KeypadModifier
);
...
...
src/libkdepim/multiplyingline/multiplyingline.h
View file @
652ed8f6
...
...
@@ -26,7 +26,7 @@ namespace KPIM {
class
KDEPIM_EXPORT
MultiplyingLineData
{
public:
typedef
QSharedPointer
<
MultiplyingLineData
>
Ptr
;
using
Ptr
=
QSharedPointer
<
MultiplyingLineData
>
;
virtual
~
MultiplyingLineData
()
{
}
...
...
src/libkdepim/multiplyingline/multiplyinglineview_p.cpp
View file @
652ed8f6
...
...
@@ -227,7 +227,7 @@ void MultiplyingLineView::resizeEvent(QResizeEvent *ev)
QSize
MultiplyingLineView
::
sizeHint
()
const
{
if
(
mDynamicSizeHint
)
{
return
QSize
(
200
,
mLineHeight
*
mLines
.
count
()
)
;
return
{
200
,
mLineHeight
*
mLines
.
count
()
}
;
}
else
{
return
QScrollArea
::
sizeHint
();
}
...
...
@@ -243,7 +243,7 @@ QSize MultiplyingLineView::minimumSizeHint() const
}
else
{
height
=
mLineHeight
*
numLines
;
}
return
QSize
(
200
,
height
)
;
return
{
200
,
height
}
;
}
else
{
return
QScrollArea
::
minimumSizeHint
();
}
...
...
src/libkdepim/progresswidget/autotests/progressstatusbarwidgettest.cpp
View file @
652ed8f6
...
...
@@ -22,11 +22,11 @@ void ProgressStatusBarWidgetTest::shouldHaveDefaultValue()
KPIM
::
ProgressStatusBarWidget
w
(
widget
,
widget
);
widget
->
show
();
KPIM
::
ProgressDialog
*
progressDialog
=
widget
->
findChild
<
KPIM
::
ProgressDialog
*>
(
QStringLiteral
(
"progressDialog"
));
auto
*
progressDialog
=
widget
->
findChild
<
KPIM
::
ProgressDialog
*>
(
QStringLiteral
(
"progressDialog"
));
QVERIFY
(
progressDialog
);
QVERIFY
(
progressDialog
->
isHidden
());
KPIM
::
StatusbarProgressWidget
*
mLittleProgress
=
widget
->
findChild
<
KPIM
::
StatusbarProgressWidget
*>
(
QStringLiteral
(
"littleprogress"
));
auto
*
mLittleProgress
=
widget
->
findChild
<
KPIM
::
StatusbarProgressWidget
*>
(
QStringLiteral
(
"littleprogress"
));
QVERIFY
(
mLittleProgress
);
QVERIFY
(
mLittleProgress
->
isVisible
());
...
...
src/libkdepim/progresswidget/autotests/statusbarprogresswidgettest.cpp
View file @
652ed8f6
...
...
@@ -26,27 +26,27 @@ StatusbarProgressWidgetTest::StatusbarProgressWidgetTest(QObject *parent)
void
StatusbarProgressWidgetTest
::
shouldHaveDefaultValue
()
{
QWidget
*
widget
=
new
QWidget
;
KPIM
::
ProgressDialog
*
progress
=
new
KPIM
::
ProgressDialog
(
widget
,
widget
);
auto
*
progress
=
new
KPIM
::
ProgressDialog
(
widget
,
widget
);
KPIM
::
StatusbarProgressWidget
w
(
progress
,
widget
);
QHBoxLayo
ut
*
boxLayout
=
w
.
findChild
<
QHBoxLayout
*>
(
QStringLiteral
(
"boxLayout"
));
a
ut
o
*
boxLayout
=
w
.
findChild
<
QHBoxLayout
*>
(
QStringLiteral
(
"boxLayout"
));
QVERIFY
(
boxLayout
);
QCOMPARE
(
boxLayout
->
contentsMargins
(),
QMargins
(
0
,
0
,
0
,
0
));
QCOMPARE
(
boxLayout
->
spacing
(),
0
);
QPushBut
to
n
*
mButton
=
w
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"button"
));
au
to
*
mButton
=
w
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"button"
));
QVERIFY
(
mButton
);
QVERIFY
(
mButton
->
text
().
isEmpty
());
QStackedWidget
*
mStackedWidget
=
w
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
*
mStackedWidget
=
w
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
QVERIFY
(
mStackedWidget
);
KPIM
::
SSLLabel
*
mSslLabel
=
w
.
findChild
<
KPIM
::
SSLLabel
*>
(
QStringLiteral
(
"ssllabel"
));
auto
*
mSslLabel
=
w
.
findChild
<
KPIM
::
SSLLabel
*>
(
QStringLiteral
(
"ssllabel"
));
QVERIFY
(
mSslLabel
);
QProgressBar
*
mProgressBar
=
w
.
findChild
<
QProgressBar
*>
(
QStringLiteral
(
"progressbar"
));
auto
*
mProgressBar
=
w
.
findChild
<
QProgressBar
*>
(
QStringLiteral
(
"progressbar"
));
QVERIFY
(
mProgressBar
);
QLabel
*
mLabel
=
w
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"emptylabel"
));
auto
*
mLabel
=
w
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"emptylabel"
));
QVERIFY
(
mLabel
);
}
...
...
src/libkdepim/progresswidget/progressdialog.cpp
View file @
652ed8f6
...
...
@@ -117,7 +117,7 @@ TransactionItemView::TransactionItemView(QWidget *parent, const QString &name)
setObjectName
(
name
);
setFrameStyle
(
NoFrame
);
mBigBox
=
new
QWidget
(
this
);
QVBoxLayo
ut
*
mBigBoxVBoxLayout
=
new
QVBoxLayout
(
mBigBox
);
a
ut
o
*
mBigBoxVBoxLayout
=
new
QVBoxLayout
(
mBigBox
);
mBigBoxVBoxLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
setWidget
(
mBigBox
);
setWidgetResizable
(
true
);
...
...
@@ -126,7 +126,7 @@ TransactionItemView::TransactionItemView(QWidget *parent, const QString &name)
TransactionItem
*
TransactionItemView
::
addTransactionItem
(
ProgressItem
*
item
,
bool
first
)
{
TransactionItem
*
ti
=
new
TransactionItem
(
mBigBox
,
item
,
first
);
auto
*
ti
=
new
TransactionItem
(
mBigBox
,
item
,
first
);
mBigBox
->
layout
()
->
addWidget
(
ti
);
resize
(
mBigBox
->
width
(),
mBigBox
->
height
());
...
...
@@ -185,7 +185,7 @@ void TransactionItemView::slotLayoutFirstItem()
be the first item very shortly. That's the one we want to remove the
hline for.
*/
TransactionItem
*
ti
=
mBigBox
->
findChild
<
KPIM
::
TransactionItem
*>
(
QStringLiteral
(
"TransactionItem"
));
auto
*
ti
=
mBigBox
->
findChild
<
KPIM
::
TransactionItem
*>
(
QStringLiteral
(
"TransactionItem"
));
if
(
ti
)
{
ti
->
hideHLine
();
}
...
...
@@ -197,7 +197,7 @@ TransactionItem::TransactionItem(QWidget *parent, ProgressItem *item, bool first
:
QWidget
(
parent
)
,
mItem
(
item
)
{
QVBoxLayo
ut
*
vboxLayout
=
new
QVBoxLayout
(
this
);
a
ut
o
*
vboxLayout
=
new
QVBoxLayout
(
this
);
vboxLayout
->
setSpacing
(
2
);
vboxLayout
->
setContentsMargins
(
2
,
2
,
2
,
2
);
setSizePolicy
(
QSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Fixed
));
...
...
@@ -209,7 +209,7 @@ TransactionItem::TransactionItem(QWidget *parent, ProgressItem *item, bool first
layout
()
->
addWidget
(
mFrame
);
QWidget
*
h
=
new
QWidget
(
this
);
QHBoxLayo
ut
*
hHBoxLayout
=
new
QHBoxLayout
(
h
);
a
ut
o
*
hHBoxLayout
=
new
QHBoxLayout
(
h
);
hHBoxLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
hHBoxLayout
->
setSpacing
(
5
);
layout
()
->
addWidget
(
h
);
...
...
src/libkdepim/progresswidget/progressstatusbarwidget.cpp
View file @
652ed8f6
...
...
@@ -23,7 +23,7 @@ ProgressStatusBarWidget::ProgressStatusBarWidget(QWidget *alignWidget, QWidget *
:
QObject
(
parent
)
,
d
(
new
KPIM
::
ProgressStatusBarWidgetPrivate
)
{
KPIM
::
ProgressDialog
*
progressDialog
=
new
KPIM
::
ProgressDialog
(
alignWidget
,
parent
);
auto
*
progressDialog
=
new
KPIM
::
ProgressDialog
(
alignWidget
,
parent
);
progressDialog
->
setObjectName
(
QStringLiteral
(
"progressDialog"
));
progressDialog
->
setShowTypeProgressItem
(
showTypeProgressItem
);
progressDialog
->
hide
();
...
...
src/libkdepim/progresswidget/statusbarprogresswidget.cpp
View file @
652ed8f6
...
...
@@ -39,7 +39,7 @@ StatusbarProgressWidget::StatusbarProgressWidget(ProgressDialog *progressDialog,
,
mProgressDialog
(
progressDialog
)
{
int
w
=
fontMetrics
().
boundingRect
(
QStringLiteral
(
" 999.9 kB/s 00:00:01 "
)).
width
()
+
8
;
QHBoxLayo
ut
*
boxLayout
=
new
QHBoxLayout
(
this
);
a
ut
o
*
boxLayout
=
new
QHBoxLayout
(
this
);
boxLayout
->
setObjectName
(
QStringLiteral
(
"boxLayout"
));
boxLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
boxLayout
->
setSpacing
(
0
);
...
...
@@ -256,7 +256,7 @@ void StatusbarProgressWidget::slotClean()
bool
StatusbarProgressWidget
::
eventFilter
(
QObject
*
obj
,
QEvent
*
ev
)
{
if
(
ev
->
type
()
==
QEvent
::
MouseButtonPress
)
{
QMouseEvent
*
e
=
static_cast
<
QMouseEvent
*>
(
ev
);
auto
*
e
=
static_cast
<
QMouseEvent
*>
(
ev
);
if
(
e
->
button
()
==
Qt
::
LeftButton
&&
mMode
==
Progress
)
{
// toggle view on left mouse button
// Consensus seems to be that we should show/hide the fancy dialog when the user
...
...
src/libkdepim/progresswidget/tests/statusbarprogresswidget_gui.cpp
View file @
652ed8f6
...
...
@@ -23,7 +23,7 @@ int main(int argc, char **argv)
parser
.
addVersionOption
();
parser
.
addHelpOption
();
parser
.
process
(
app
);
StatusbarProgressWidget_Gui
*
w
=
new
StatusbarProgressWidget_Gui
;
auto
*
w
=
new
StatusbarProgressWidget_Gui
;
w
->
resize
(
800
,
600
);
w
->
show
();
app
.
exec
();
...
...
src/libkdepim/tests/kcheckcomboboxtest_gui.cpp
View file @
652ed8f6
...
...
@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
parser
.
addHelpOption
();
parser
.
process
(
app
);
KPIM
::
KCheckComboBox
*
combo
=
new
KPIM
::
KCheckComboBox
(
nullptr
);
auto
*
combo
=
new
KPIM
::
KCheckComboBox
(
nullptr
);
combo
->
addItems
(
QStringList
()
<<
QStringLiteral
(
"KDE"
)
<<
QStringLiteral
(
"Mac OSX"
)
<<
QStringLiteral
(
"Windows"
)
<<
QStringLiteral
(
"XFCE"
)
<<
QStringLiteral
(
"FVWM"
)
<<
QStringLiteral
(
"TWM"
));
combo
->
setCheckedItems
(
QStringList
()
<<
QStringLiteral
(
"KDE"
)
<<
QStringLiteral
(
"Mac OSX"
)
<<
QStringLiteral
(
"Windows"
));
combo
->
resize
(
400
,
20
);
...
...
src/libkdepim/widgets/kcheckcombobox.cpp
View file @
652ed8f6
...
...
@@ -50,7 +50,7 @@ private:
void
KCheckComboBox
::
Private
::
makeInsertedItemsCheckable
(
const
QModelIndex
&
parent
,
int
start
,
int
end
)
{
Q_UNUSED
(
parent
);
QStandardItemModel
*
model
=
qobject_cast
<
QStandardItemModel
*>
(
q
->
model
());
auto
*
model
=
qobject_cast
<
QStandardItemModel
*>
(
q
->
model
());
if
(
model
)
{
for
(
int
r
=
start
;
r
<=
end
;
++
r
)
{
QStandardItem
*
item
=
model
->
item
(
r
,
0
);
...
...
@@ -106,7 +106,7 @@ void KCheckComboBox::Private::toggleCheckState()
const
QModelIndex
index
=
q
->
view
()
->
currentIndex
();
QVariant
value
=
index
.
data
(
Qt
::
CheckStateRole
);
if
(
value
.
isValid
())
{
Qt
::
CheckState
state
=
static_cast
<
Qt
::
CheckState
>
(
value
.
toInt
());
auto
state
=
static_cast
<
Qt
::
CheckState
>
(
value
.
toInt
());
q
->
model
()
->
setData
(
index
,
state
==
Qt
::
Unchecked
?
Qt
::
Checked
:
Qt
::
Unchecked
,
Qt
::
CheckStateRole
);
}
...
...
@@ -229,7 +229,7 @@ bool KCheckComboBox::itemEnabled(int index)
{
Q_ASSERT
(
index
>=
0
&&
index
<=
count
());
QStandardItemModel
*
itemModel
=
qobject_cast
<
QStandardItemModel
*>
(
model
());
auto
*
itemModel
=
qobject_cast
<
QStandardItemModel
*>
(
model
());
Q_ASSERT
(
itemModel
);
QStandardItem
*
item
=
itemModel
->
item
(
index
,
0
);
...
...
@@ -240,7 +240,7 @@ void KCheckComboBox::setItemEnabled(int index, bool enabled)
{
Q_ASSERT
(
index
>=
0
&&
index
<=
count
());
QStandardItemModel
*
itemModel
=
qobject_cast
<
QStandardItemModel
*>
(
model
());
auto
*
itemModel
=
qobject_cast
<
QStandardItemModel
*>
(
model
());
Q_ASSERT
(
itemModel
);
QStandardItem
*
item
=
itemModel
->
item
(
index
,
0
);
...
...
src/libkdepim/widgets/kwidgetlister.cpp
View file @
652ed8f6
...
...
@@ -84,7 +84,7 @@ void KWidgetLister::init(bool fewerMoreButton)
d
->
mLayout
->
setSpacing
(
4
);
d
->
mButtonBox
=
new
QWidget
(
this
);
QHBoxLayo
ut
*
mButtonBoxHBoxLayout
=
new
QHBoxLayout
(
d
->
mButtonBox
);
a
ut
o
*
mButtonBoxHBoxLayout
=
new
QHBoxLayout
(
d
->
mButtonBox
);
mButtonBoxHBoxLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
d
->
mLayout
->
addWidget
(
d
->
mButtonBox
);
...
...
src/libkdepim/widgets/progressindicatorlabel.cpp
View file @
652ed8f6
...
...
@@ -18,7 +18,7 @@ public:
:
labelStr
(
_label
)
,
q
(
qq
)
{
QHBoxLayo
ut
*
lay
=
new
QHBoxLayout
(
q
);
a
ut
o
*
lay
=
new
QHBoxLayout
(
q
);
lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
indicator
=
new
KBusyIndicatorWidget
;
lay
->
addWidget
(
indicator
);
...
...
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