Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KMime
Commits
7f87a49e
Commit
7f87a49e
authored
Nov 25, 2021
by
Laurent Montel
Browse files
Modernize code
parent
c11600fc
Pipeline
#100781
passed with stage
in 5 minutes and 9 seconds
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/kmime_codecs.cpp
View file @
7f87a49e
...
...
@@ -181,7 +181,7 @@ QByteArray encodeRFC2047Sentence(const QString &src, const QByteArray &charset)
QByteArray
encodeRFC2231String
(
const
QString
&
str
,
const
QByteArray
&
charset
)
{
if
(
str
.
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
const
QTextCodec
*
codec
=
KCharsets
::
charsets
()
->
codecForName
(
QString
::
fromLatin1
(
charset
));
...
...
src/kmime_content.cpp
View file @
7f87a49e
...
...
@@ -364,7 +364,7 @@ QByteArray Content::decodedContent()
QString
Content
::
decodedText
(
bool
trimText
,
bool
removeTrailingNewlines
)
{
if
(
!
d_ptr
->
decodeText
(
this
))
{
//this is not a text content !!
return
QString
()
;
return
{}
;
}
bool
ok
=
true
;
...
...
@@ -792,7 +792,7 @@ ContentIndex KMime::Content::indexForContent(Content *content) const
return
ci
;
}
}
return
ContentIndex
()
;
// not found
return
{}
;
// not found
}
bool
Content
::
isTopLevel
()
const
...
...
@@ -850,7 +850,7 @@ Message::Ptr Content::bodyAsMessage() const
if
(
bodyIsMessage
()
&&
d_ptr
->
bodyAsMessage
)
{
return
d_ptr
->
bodyAsMessage
;
}
else
{
return
Message
::
Ptr
()
;
return
{}
;
}
}
...
...
src/kmime_content_p.h
View file @
7f87a49e
...
...
@@ -13,7 +13,7 @@
namespace
KMime
{
class
Message
;
typedef
QSharedPointer
<
Message
>
MessagePtr
;
using
MessagePtr
=
QSharedPointer
<
Message
>
;
}
namespace
KMime
...
...
src/kmime_contentindex.cpp
View file @
7f87a49e
...
...
@@ -26,13 +26,10 @@ using namespace KMime;
class
ContentIndex
::
Private
:
public
QSharedData
{
public:
Private
()
{}
Private
(
const
Private
&
other
)
:
QSharedData
(
other
)
{
index
=
other
.
index
;
}
Private
()
=
default
;
Private
(
const
Private
&
other
)
:
QSharedData
(
other
)
{
index
=
other
.
index
;
}
QVector
<
unsigned
int
>
index
;
QVector
<
unsigned
int
>
index
;
};
KMime
::
ContentIndex
::
ContentIndex
()
:
d
(
new
Private
)
...
...
@@ -53,13 +50,9 @@ KMime::ContentIndex::ContentIndex(const QString &index) : d(new Private)
}
}
ContentIndex
::
ContentIndex
(
const
ContentIndex
&
other
)
:
d
(
other
.
d
)
{
}
ContentIndex
::
ContentIndex
(
const
ContentIndex
&
other
)
=
default
;
ContentIndex
::~
ContentIndex
()
{
}
ContentIndex
::~
ContentIndex
()
=
default
;
bool
KMime
::
ContentIndex
::
isValid
()
const
{
...
...
src/kmime_dateformatter.cpp
View file @
7f87a49e
...
...
@@ -134,7 +134,7 @@ QString DateFormatter::dateString(time_t t, const QString &lang, bool shortForma
case
Custom
:
return
d
->
custom
(
t
);
}
return
QString
()
;
return
{}
;
}
QString
DateFormatter
::
dateString
(
const
QDateTime
&
dt
,
const
QString
&
lang
,
bool
shortFormat
)
const
...
...
@@ -158,7 +158,7 @@ QString DateFormatterPrivate::rfc2822(time_t t)
QString
DateFormatterPrivate
::
custom
(
time_t
t
)
const
{
if
(
mCustomFormat
.
isEmpty
())
{
return
QString
()
;
return
{}
;
}
int
z
=
mCustomFormat
.
indexOf
(
QLatin1Char
(
'Z'
));
...
...
src/kmime_dateformatter.h
View file @
7f87a49e
...
...
@@ -33,10 +33,10 @@
#pragma once
#include
<time
.h
>
#include
"kmime_export
.h
"
#include
<QDateTime>
#include
<QString>
#include
"kmime_export.h"
#include
<ctime>
#include
<memory>
namespace
KMime
...
...
src/kmime_header_parsing.cpp
View file @
7f87a49e
...
...
@@ -25,8 +25,8 @@
#include
<QTextCodec>
#include
<QMap>
#include
<ctype.h>
// for isdigit
#include
<cassert>
#include
<cctype>
// for isdigit
using
namespace
KMime
;
using
namespace
KMime
::
Types
;
...
...
src/kmime_headers.cpp
View file @
7f87a49e
...
...
@@ -38,9 +38,8 @@
#include
<KCharsets>
#include
<KCodecs>
#include
<assert.h>
#include
<ctype.h>
#include
<cassert>
#include
<cctype>
// macro to generate a default constructor implementation
#define kmime_mk_trivial_ctor( subclass, baseclass ) \
...
...
@@ -272,9 +271,7 @@ Address::Address() : Structured(new AddressPrivate)
kmime_mk_dptr_ctor
(
Address
,
Structured
)
Address
::
~
Address
()
{
}
Address
::~
Address
()
=
default
;
// helper method used in AddressList and MailboxList
static
bool
stringToMailbox
(
const
QByteArray
&
address
,
...
...
@@ -304,7 +301,7 @@ QByteArray MailboxList::as7BitString(bool withHeaderType) const
{
const
Q_D
(
MailboxList
);
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -470,7 +467,7 @@ QByteArray AddressList::as7BitString(bool withHeaderType) const
{
const
Q_D
(
AddressList
);
if
(
d
->
addressList
.
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -614,7 +611,7 @@ kmime_mk_dptr_ctor(Token, Structured)
QByteArray
Token
::
as7BitString
(
bool
withHeaderType
)
const
{
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
if
(
withHeaderType
)
{
return
typeIntro
()
+
d_func
()
->
token
;
...
...
@@ -682,7 +679,7 @@ QByteArray PhraseList::as7BitString(bool withHeaderType) const
{
const
Q_D
(
PhraseList
);
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -770,7 +767,7 @@ kmime_mk_trivial_ctor_with_dptr(DotAtom, Structured)
QByteArray
DotAtom
::
as7BitString
(
bool
withHeaderType
)
const
{
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -831,7 +828,7 @@ QByteArray Parametrized::as7BitString(bool withHeaderType) const
{
const
Q_D
(
Parametrized
);
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -920,7 +917,7 @@ QByteArray Ident::as7BitString(bool withHeaderType) const
{
const
Q_D
(
Ident
);
if
(
d
->
msgIdList
.
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -1052,7 +1049,7 @@ kmime_mk_dptr_ctor(SingleIdent, Ident)
QByteArray
SingleIdent
::
identifier
()
const
{
if
(
d_func
()
->
msgIdList
.
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
if
(
d_func
()
->
cachedIdentifier
.
isEmpty
())
{
...
...
@@ -1105,7 +1102,7 @@ kmime_mk_trivial_ctor_with_name_and_dptr(ReturnPath, Generics::Address, Return-P
QByteArray
ReturnPath
::
as7BitString
(
bool
withHeaderType
)
const
{
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -1257,7 +1254,7 @@ QByteArray Control::as7BitString(bool withHeaderType) const
{
const
Q_D
(
Control
);
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -1362,7 +1359,7 @@ QString MailCopiesTo::asUnicodeString() const
if
(
d_func
()
->
neverCopy
)
{
return
QStringLiteral
(
"nobody"
);
}
return
QString
()
;
return
{}
;
}
void
MailCopiesTo
::
clear
()
...
...
@@ -1437,7 +1434,7 @@ kmime_mk_trivial_ctor_with_name_and_dptr(Date, Generics::Structured, Date)
QByteArray
Date
::
as7BitString
(
bool
withHeaderType
)
const
{
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -1492,7 +1489,7 @@ kmime_mk_trivial_ctor_with_name(FollowUpTo, Newsgroups, Followup-To)
QByteArray
Newsgroups
::
as7BitString
(
bool
withHeaderType
)
const
{
const
Q_D
(
Newsgroups
);
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -1574,7 +1571,7 @@ kmime_mk_trivial_ctor_with_name_and_dptr(Lines, Generics::Structured, Lines)
QByteArray
Lines
::
as7BitString
(
bool
withHeaderType
)
const
{
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
num
;
...
...
@@ -1588,7 +1585,7 @@ QByteArray Lines::as7BitString(bool withHeaderType) const {
QString
Lines
::
asUnicodeString
()
const
{
if
(
isEmpty
())
{
return
QString
()
;
return
{}
;
}
return
QString
::
number
(
d_func
()
->
lines
);
}
...
...
@@ -1643,7 +1640,7 @@ void ContentType::clear() {
QByteArray
ContentType
::
as7BitString
(
bool
withHeaderType
)
const
{
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -1678,7 +1675,7 @@ QByteArray ContentType::subType() const {
Q_D
(
const
ContentType
);
const
int
pos
=
d
->
mimeType
.
indexOf
(
'/'
);
if
(
pos
<
0
)
{
return
QByteArray
()
;
return
{}
;
}
else
{
return
d
->
mimeType
.
mid
(
pos
+
1
);
}
...
...
@@ -2037,7 +2034,7 @@ kmime_mk_trivial_ctor_with_name_and_dptr(ContentDisposition,
QByteArray
ContentDisposition
::
as7BitString
(
bool
withHeaderType
)
const
{
if
(
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
QByteArray
rv
;
...
...
@@ -2050,7 +2047,7 @@ QByteArray ContentDisposition::as7BitString(bool withHeaderType) const {
}
else
if
(
d_func
()
->
disposition
==
CDinline
)
{
rv
+=
"inline"
;
}
else
{
return
QByteArray
()
;
return
{}
;
}
if
(
!
Parametrized
::
isEmpty
())
{
...
...
src/kmime_mdn.cpp
View file @
7f87a49e
...
...
@@ -213,7 +213,7 @@ static QByteArray dispositionField(DispositionType d, ActionMode a, SendingMode
static
QByteArray
finalRecipient
(
const
QString
&
recipient
)
{
if
(
recipient
.
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
else
{
return
"Final-Recipient: rfc822; "
+
encodeRFC2047String
(
recipient
,
"utf-8"
)
+
'\n'
;
...
...
@@ -223,7 +223,7 @@ static QByteArray finalRecipient(const QString &recipient)
static
QByteArray
orginalRecipient
(
const
QByteArray
&
recipient
)
{
if
(
recipient
.
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
else
{
return
"Original-Recipient: "
+
recipient
+
'\n'
;
}
...
...
@@ -232,7 +232,7 @@ static QByteArray orginalRecipient(const QByteArray &recipient)
static
QByteArray
originalMessageID
(
const
QByteArray
&
msgid
)
{
if
(
msgid
.
isEmpty
())
{
return
QByteArray
()
;
return
{}
;
}
else
{
return
"Original-Message-ID: "
+
msgid
+
'\n'
;
}
...
...
@@ -300,7 +300,7 @@ QString descriptionFor(DispositionType d,
}
qCWarning
(
KMIME_LOG
)
<<
"KMime::MDN::descriptionFor(): No such disposition type:"
<<
static_cast
<
int
>
(
d
);
return
QString
()
;
return
{}
;
}
}
// namespace MDN
...
...
src/kmime_message.cpp
View file @
7f87a49e
...
...
@@ -20,9 +20,7 @@ Message::Message() : Content()
{
}
Message
::~
Message
()
{
}
Message
::~
Message
()
=
default
;
QByteArray
Message
::
assembleHeaders
()
{
...
...
src/kmime_newsarticle.cpp
View file @
7f87a49e
...
...
@@ -20,9 +20,7 @@ NewsArticle::NewsArticle() : Message()
{
}
NewsArticle
::~
NewsArticle
()
{
}
NewsArticle
::~
NewsArticle
()
=
default
;
QByteArray
NewsArticle
::
assembleHeaders
()
{
...
...
src/kmime_parsers.cpp
View file @
7f87a49e
...
...
@@ -104,7 +104,7 @@ NonMimeParser::NonMimeParser(const QByteArray &src) :
{
}
NonMimeParser
::~
NonMimeParser
()
{}
NonMimeParser
::~
NonMimeParser
()
=
default
;
/**
* try to guess the mimetype from the file-extension
...
...
src/kmime_types.cpp
View file @
7f87a49e
...
...
@@ -40,7 +40,7 @@ static inline QString QUrl_fromAce_wrapper(const QString &domain)
static
QString
addr_spec_as_string
(
const
AddrSpec
&
as
,
bool
pretty
)
{
if
(
as
.
isEmpty
())
{
return
QString
()
;
return
{}
;
}
static
const
QChar
dotChar
=
QLatin1Char
(
'.'
);
...
...
src/kmime_types.h
View file @
7f87a49e
...
...
@@ -28,7 +28,7 @@ struct KMIME_EXPORT AddrSpec {
QString
localPart
;
QString
domain
;
};
typedef
QVector
<
AddrSpec
>
AddrSpecList
;
using
AddrSpecList
=
QVector
<
AddrSpec
>
;
/**
Represents an (email address, display name) pair according RFC 2822,
...
...
src/kmime_util.cpp
View file @
7f87a49e
...
...
@@ -23,10 +23,9 @@
#include
<KCharsets>
#include
<QCoreApplication>
#include
<ctype.h>
#include
<time.h>
#include
<stdlib.h>
#include
<cctype>
#include
<cstdlib>
#include
<ctime>
using
namespace
KMime
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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