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
Akonadi Contacts
Commits
8b2cb605
Commit
8b2cb605
authored
Aug 13, 2021
by
Laurent Montel
😁
Browse files
Modernize code + use QStringLiteral multi arg etc.
parent
6f278659
Pipeline
#74653
passed with stage
in 11 minutes and 27 seconds
Changes
35
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/akonadi-contacts/contacteditor.cpp
View file @
8b2cb605
...
...
@@ -47,7 +47,7 @@ public:
}
auto
layout
=
new
QVBoxLayout
(
mParent
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
layout
->
setSpacing
(
0
);
layout
->
addWidget
(
mEditorWidget
);
}
...
...
src/akonadi-contacts/contacteditordialog.cpp
View file @
8b2cb605
...
...
@@ -54,7 +54,7 @@ public:
mainLayout
->
addWidget
(
buttonBox
);
auto
layout
=
new
QGridLayout
(
mainWidget
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
if
(
editorWidget
)
{
mEditor
=
new
AkonadiContactEditor
(
mode
==
ContactEditorDialog
::
CreateMode
?
AkonadiContactEditor
::
CreateMode
:
AkonadiContactEditor
::
EditMode
,
...
...
src/akonadi-contacts/contactgroupeditordialog.cpp
View file @
8b2cb605
...
...
@@ -91,7 +91,7 @@ ContactGroupEditorDialog::ContactGroupEditorDialog(Mode mode, QWidget *parent)
auto
mainWidget
=
new
QWidget
(
this
);
auto
layout
=
new
QGridLayout
(
mainWidget
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
d
->
mEditor
=
new
Akonadi
::
ContactGroupEditor
(
mode
==
CreateMode
?
Akonadi
::
ContactGroupEditor
::
CreateMode
:
Akonadi
::
ContactGroupEditor
::
EditMode
,
this
);
...
...
src/akonadi-contacts/contactgroupviewer.cpp
View file @
8b2cb605
...
...
@@ -142,7 +142,7 @@ ContactGroupViewer::ContactGroupViewer(QWidget *parent)
,
d
(
new
Private
(
this
))
{
auto
layout
=
new
QVBoxLayout
(
this
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
connect
(
d
->
mBrowser
,
&
TextBrowser
::
anchorClicked
,
this
,
[
this
](
const
QUrl
&
url
)
{
d
->
slotMailClicked
(
url
);
...
...
src/akonadi-contacts/contactviewer.cpp
View file @
8b2cb605
...
...
@@ -221,7 +221,7 @@ ContactViewer::ContactViewer(QWidget *parent)
,
d
(
new
Private
(
this
))
{
auto
layout
=
new
QVBoxLayout
(
this
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
d
->
mBrowser
=
new
TextBrowser
;
...
...
src/akonadi-contacts/emailaddressrequester.cpp
View file @
8b2cb605
...
...
@@ -67,7 +67,7 @@ EmailAddressRequester::EmailAddressRequester(QWidget *parent)
{
auto
layout
=
new
QHBoxLayout
(
this
);
layout
->
setSpacing
(
4
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
d
->
mLineEdit
=
new
KLineEdit
(
this
);
d
->
mLineEdit
->
setClearButtonEnabled
(
true
);
...
...
src/akonadi-contacts/emailaddressselectionwidget.cpp
View file @
8b2cb605
...
...
@@ -114,14 +114,14 @@ void EmailAddressSelectionWidget::Private::init()
// setup ui
auto
layout
=
new
QVBoxLayout
(
q
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
mDescriptionLabel
=
new
QLabel
;
mDescriptionLabel
->
hide
();
layout
->
addWidget
(
mDescriptionLabel
);
auto
searchLayout
=
new
QHBoxLayout
;
searchLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
searchLayout
->
setContentsMargins
(
{}
);
layout
->
addLayout
(
searchLayout
);
mView
=
new
Akonadi
::
EntityTreeView
;
...
...
src/akonadi-contacts/grantlee/contactgrantleewrapper.cpp
View file @
8b2cb605
...
...
@@ -69,7 +69,7 @@ QString ContactGrantleeWrapper::addressBookName() const
int
ContactGrantleeWrapper
::
age
()
const
{
QDate
now
=
QDate
::
currentDate
();
const
QDate
now
=
QDate
::
currentDate
();
int
age
=
now
.
year
()
-
birthday
().
date
().
year
();
if
(
birthday
().
date
()
>
now
.
addYears
(
-
age
))
{
age
--
;
...
...
src/akonadi-contacts/job/contactgroupexpandjob.cpp
View file @
8b2cb605
...
...
@@ -115,7 +115,7 @@ public:
}
}
ContactGroupExpandJob
*
mParent
=
nullptr
;
ContactGroupExpandJob
*
const
mParent
;
KContacts
::
ContactGroup
mGroup
;
QString
mName
;
KContacts
::
Addressee
::
List
mContacts
;
...
...
src/akonadi-contacts/job/openemailaddressjob.cpp
View file @
8b2cb605
...
...
@@ -80,7 +80,7 @@ public:
}
OpenEmailAddressJob
*
const
q
;
QString
mCompleteAddress
;
const
QString
mCompleteAddress
;
QString
mEmail
;
QString
mName
;
QWidget
*
const
mParentWidget
;
...
...
src/akonadi-contacts/plugins/categorieseditwidget.cpp
View file @
8b2cb605
...
...
@@ -21,7 +21,7 @@ CategoriesEditWidget::CategoriesEditWidget(QWidget *parent, const QList<QVariant
,
mTagWidget
(
new
Akonadi
::
TagWidget
(
this
))
{
auto
layout
=
new
QHBoxLayout
(
this
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
layout
->
addWidget
(
mTagWidget
);
}
...
...
src/akonadi-contacts/recipientspicker/recipientspickerwidget.cpp
View file @
8b2cb605
...
...
@@ -18,7 +18,7 @@ RecipientsPickerWidget::RecipientsPickerWidget(bool onlyShowEmailWithAddress, QA
:
QWidget
(
parent
)
{
auto
layout
=
new
QHBoxLayout
(
this
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
mView
=
new
Akonadi
::
EmailAddressSelectionWidget
(
onlyShowEmailWithAddress
,
model
?
model
:
Akonadi
::
RecipientsEditorManager
::
self
()
->
model
()
->
model
(),
this
);
...
...
src/akonadi-contacts/standardcontactformatter.cpp
View file @
8b2cb605
...
...
@@ -40,7 +40,7 @@ StandardContactFormatter::~StandardContactFormatter()
static
int
contactAge
(
const
QDate
&
date
)
{
QDate
now
=
QDate
::
currentDate
();
const
QDate
now
=
QDate
::
currentDate
();
int
age
=
now
.
year
()
-
date
.
year
();
if
(
date
>
now
.
addYears
(
-
age
))
{
age
--
;
...
...
@@ -93,8 +93,8 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
const
int
years
=
contactAge
(
date
);
if
(
date
.
isValid
())
{
dynamicPart
+=
rowFmtStr1
.
arg
(
KContacts
::
Addressee
::
birthdayLabel
()
)
.
arg
(
QLocale
().
toString
(
date
)
+
QLatin1String
(
" "
)
+
i18np
(
"(One year old)"
,
"(%1 years old)"
,
years
));
dynamicPart
+=
rowFmtStr1
.
arg
(
KContacts
::
Addressee
::
birthdayLabel
()
,
QLocale
().
toString
(
date
)
+
QLatin1String
(
" "
)
+
i18np
(
"(One year old)"
,
"(%1 years old)"
,
years
));
}
// Phone Numbers
...
...
@@ -122,7 +122,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
const
QString
fullEmail
=
QString
::
fromLatin1
(
QUrl
::
toPercentEncoding
(
rawContact
.
fullEmail
(
email
)));
dynamicPart
+=
rowFmtStr1
.
arg
(
type
).
arg
(
QStringLiteral
(
"<a href=
\"
mailto:%1
\"
>%2</a>"
).
arg
(
fullEmail
,
email
));
dynamicPart
+=
rowFmtStr1
.
arg
(
type
,
QStringLiteral
(
"<a href=
\"
mailto:%1
\"
>%2</a>"
).
arg
(
fullEmail
,
email
));
}
// Homepage
...
...
@@ -139,7 +139,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
// Blog Feed
const
QString
blog
=
rawContact
.
custom
(
QStringLiteral
(
"KADDRESSBOOK"
),
QStringLiteral
(
"BlogFeed"
));
if
(
!
blog
.
isEmpty
())
{
dynamicPart
+=
rowFmtStr1
.
arg
(
i18n
(
"Blog Feed"
)
).
arg
(
KStringHandler
::
tagUrls
(
blog
.
toHtmlEscaped
()));
dynamicPart
+=
rowFmtStr1
.
arg
(
i18n
(
"Blog Feed"
)
,
KStringHandler
::
tagUrls
(
blog
.
toHtmlEscaped
()));
}
// Addresses
...
...
@@ -167,7 +167,7 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
// Note
QString
notes
;
if
(
!
rawContact
.
note
().
isEmpty
())
{
notes
=
rowFmtStr1
.
arg
(
i18n
(
"Notes"
)
).
arg
(
rawContact
.
note
().
toHtmlEscaped
().
replace
(
QLatin1Char
(
'\n'
),
QLatin1String
(
"<br>"
)));
notes
=
rowFmtStr1
.
arg
(
i18n
(
"Notes"
)
,
rawContact
.
note
().
toHtmlEscaped
().
replace
(
QLatin1Char
(
'\n'
),
QLatin1String
(
"<br>"
)));
}
// Custom Data
...
...
@@ -278,25 +278,23 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
role
=
rawContact
.
custom
(
QStringLiteral
(
"KADDRESSBOOK"
),
QStringLiteral
(
"X-Profession"
));
}
QString
strAddr
=
QStringLiteral
(
"<div align=
\"
center
\"
>"
"<table cellpadding=
\"
3
\"
cellspacing=
\"
1
\"
>"
"<tr>"
"<td align=
\"
right
\"
valign=
\"
top
\"
width=
\"
30%
\"
rowspan=
\"
3
\"
>"
"<img src=
\"
%1
\"
width=
\"
100
\"
vspace=
\"
1
\"
/>"
// image
"</td>"
"<td colspan=
\"
2
\"
align=
\"
left
\"
width=
\"
70%
\"
><font size=
\"
+2
\"
><b>%2</b></font></td>"
// name
"</tr>"
"<tr>"
"<td colspan=
\"
2
\"
align=
\"
left
\"
width=
\"
70%
\"
>%3</td>"
// role
"</tr>"
"<tr>"
"<td colspan=
\"
2
\"
align=
\"
left
\"
width=
\"
70%
\"
>%4</td>"
// organization
"</tr>"
)
.
arg
(
QStringLiteral
(
"contact_photo"
))
.
arg
(
rawContact
.
realName
().
toHtmlEscaped
())
.
arg
(
role
.
toHtmlEscaped
())
.
arg
(
rawContact
.
organization
().
toHtmlEscaped
());
QString
strAddr
=
QStringLiteral
(
"<div align=
\"
center
\"
>"
"<table cellpadding=
\"
3
\"
cellspacing=
\"
1
\"
>"
"<tr>"
"<td align=
\"
right
\"
valign=
\"
top
\"
width=
\"
30%
\"
rowspan=
\"
3
\"
>"
"<img src=
\"
%1
\"
width=
\"
100
\"
vspace=
\"
1
\"
/>"
// image
"</td>"
"<td colspan=
\"
2
\"
align=
\"
left
\"
width=
\"
70%
\"
><font size=
\"
+2
\"
><b>%2</b></font></td>"
// name
"</tr>"
"<tr>"
"<td colspan=
\"
2
\"
align=
\"
left
\"
width=
\"
70%
\"
>%3</td>"
// role
"</tr>"
"<tr>"
"<td colspan=
\"
2
\"
align=
\"
left
\"
width=
\"
70%
\"
>%4</td>"
// organization
"</tr>"
)
.
arg
(
QStringLiteral
(
"contact_photo"
),
rawContact
.
realName
().
toHtmlEscaped
(),
role
.
toHtmlEscaped
(),
rawContact
.
organization
().
toHtmlEscaped
());
strAddr
.
append
(
dynamicPart
);
strAddr
.
append
(
notes
);
...
...
@@ -331,9 +329,9 @@ QString StandardContactFormatter::toHtml(HtmlForm form) const
"%3"
// contact part
"</body>"
"</html>"
)
.
arg
(
KColorScheme
(
QPalette
::
Active
,
KColorScheme
::
View
).
foreground
().
color
().
name
()
)
.
arg
(
KColorScheme
(
QPalette
::
Active
,
KColorScheme
::
View
).
background
().
color
().
name
()
)
.
arg
(
strAddr
);
.
arg
(
KColorScheme
(
QPalette
::
Active
,
KColorScheme
::
View
).
foreground
().
color
().
name
()
,
KColorScheme
(
QPalette
::
Active
,
KColorScheme
::
View
).
background
().
color
().
name
()
,
strAddr
);
return
document
;
}
...
...
src/contact-editor/editor/addresseditor/addresslocationwidget.cpp
View file @
8b2cb605
...
...
@@ -113,7 +113,7 @@ AddressLocationWidget::AddressLocationWidget(QWidget *parent)
auto
addButtonWidget
=
new
QWidget
(
this
);
auto
addButtonWidgetLayout
=
new
QHBoxLayout
(
addButtonWidget
);
addButtonWidgetLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
addButtonWidgetLayout
->
setContentsMargins
(
{}
);
mAddAddress
=
new
QPushButton
(
i18n
(
"Add Address"
),
this
);
mAddAddress
->
setObjectName
(
QStringLiteral
(
"addbuttonaddress"
));
connect
(
mAddAddress
,
&
QPushButton
::
clicked
,
this
,
&
AddressLocationWidget
::
slotAddAddress
);
...
...
@@ -123,7 +123,7 @@ AddressLocationWidget::AddressLocationWidget(QWidget *parent)
auto
modifyButtonWidget
=
new
QWidget
(
this
);
auto
modifyButtonWidgetLayout
=
new
QHBoxLayout
(
modifyButtonWidget
);
modifyButtonWidgetLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
modifyButtonWidgetLayout
->
setContentsMargins
(
{}
);
mButtonStack
->
addWidget
(
modifyButtonWidget
);
mRemoveAddress
=
new
QPushButton
(
i18n
(
"Remove Address"
),
this
);
...
...
src/contact-editor/editor/addresseditor/addresstypedialog.cpp
View file @
8b2cb605
...
...
@@ -33,7 +33,7 @@ AddressTypeDialog::AddressTypeDialog(KContacts::Address::Type type, QWidget *par
mainLayout
->
addWidget
(
page
);
mainLayout
->
addWidget
(
buttonBox
);
auto
layout
=
new
QVBoxLayout
(
page
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
auto
box
=
new
QGroupBox
(
i18nc
(
"street/postal"
,
"Address Types"
),
page
);
mainLayout
->
addWidget
(
box
);
...
...
src/contact-editor/editor/businesseditor/freebusyeditwidget.cpp
View file @
8b2cb605
...
...
@@ -21,7 +21,7 @@ FreeBusyEditWidget::FreeBusyEditWidget(QWidget *parent)
:
QWidget
(
parent
)
{
auto
layout
=
new
QHBoxLayout
(
this
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
mURL
=
new
KUrlRequester
(
this
);
mURL
->
lineEdit
()
->
setTrapReturnKey
(
true
);
...
...
src/contact-editor/editor/contacteditorwidget.cpp
View file @
8b2cb605
...
...
@@ -74,7 +74,7 @@ public:
void
ContactEditorWidget
::
Private
::
initGui
()
{
auto
layout
=
new
QVBoxLayout
(
mParent
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
mTabWidget
=
new
QTabWidget
(
mParent
);
layout
->
addWidget
(
mTabWidget
);
...
...
src/contact-editor/editor/customfieldeditor/customfieldswidget.cpp
View file @
8b2cb605
...
...
@@ -19,7 +19,7 @@ CustomFieldsWidget::CustomFieldsWidget(QWidget *parent)
:
QWidget
(
parent
)
{
auto
topLayout
=
new
QVBoxLayout
(
this
);
topLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
topLayout
->
setContentsMargins
(
{}
);
mCustomFieldEditorWidget
=
new
ContactEditor
::
CustomFieldEditorWidget
(
this
);
mCustomFieldEditorWidget
->
setObjectName
(
QStringLiteral
(
"customfieldeditorwidget"
));
topLayout
->
addWidget
(
mCustomFieldEditorWidget
);
...
...
src/contact-editor/editor/generalinfoeditor/blogfeedwidget.cpp
View file @
8b2cb605
...
...
@@ -19,7 +19,7 @@ BlogfeedWidget::BlogfeedWidget(QWidget *parent)
:
QWidget
(
parent
)
{
auto
topLayout
=
new
QVBoxLayout
(
this
);
topLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
topLayout
->
setContentsMargins
(
{}
);
topLayout
->
setObjectName
(
QStringLiteral
(
"mainlayout"
));
auto
blogFeedLabel
=
new
QLabel
(
i18n
(
"Blog Feed"
),
this
);
blogFeedLabel
->
setObjectName
(
QStringLiteral
(
"blogFeedLabel"
));
...
...
src/contact-editor/editor/generalinfoeditor/categorieseditwidget.cpp
View file @
8b2cb605
...
...
@@ -14,7 +14,7 @@ CategoriesEditWidget::CategoriesEditWidget(QWidget *parent)
:
ContactEditor
::
CategoriesEditAbstractWidget
(
parent
)
{
auto
layout
=
new
QHBoxLayout
(
this
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
layout
->
setContentsMargins
(
{}
);
}
CategoriesEditWidget
::~
CategoriesEditWidget
()
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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