Commit 61c14ab9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some cppcheck warning

parent 07d2d52a
Pipeline #83711 passed with stage
in 46 minutes and 50 seconds
......@@ -24,7 +24,7 @@ using namespace MessageComposer;
class MessageComposer::RichTextComposerNgPrivate
{
public:
RichTextComposerNgPrivate(RichTextComposerNg *q)
explicit RichTextComposerNgPrivate(RichTextComposerNg *q)
: richtextComposer(q)
{
richTextComposerSignatures = new MessageComposer::RichTextComposerSignatures(richtextComposer, richtextComposer);
......
......@@ -34,7 +34,7 @@ using MessageCore::AttachmentPart;
class MessageComposer::ComposerPrivate : public JobBasePrivate
{
public:
ComposerPrivate(Composer *qq)
explicit ComposerPrivate(Composer *qq)
: JobBasePrivate(qq)
{
}
......@@ -428,8 +428,8 @@ void ComposerPrivate::composeWithLateAttachments(KMime::Message *headers,
multiJob->appendSubjob(eJob);
} else {
qCDebug(MESSAGECOMPOSER_LOG) << "attaching plain non-crypto attachment";
auto attachJob = new AttachmentJob(attachment, q);
multiJob->appendSubjob(attachJob);
auto attachSecondJob = new AttachmentJob(attachment, q);
multiJob->appendSubjob(attachSecondJob);
}
}
......@@ -569,7 +569,7 @@ void Composer::setMessageCryptoFormat(Kleo::CryptoMessageFormat format)
d->format = format;
}
void Composer::setSigningKeys(std::vector<GpgME::Key> &signers)
void Composer::setSigningKeys(const std::vector<GpgME::Key> &signers)
{
Q_D(Composer);
......
......@@ -52,7 +52,7 @@ public:
void setNoCrypto(bool noCrypto);
void setSignAndEncrypt(const bool doSign, const bool doEncrypt);
void setMessageCryptoFormat(Kleo::CryptoMessageFormat format);
void setSigningKeys(std::vector<GpgME::Key> &signers);
void setSigningKeys(const std::vector<GpgME::Key> &signers);
void setEncryptionKeys(const QVector<QPair<QStringList, std::vector<GpgME::Key>>> &data);
void setAutocryptEnabled(bool autocryptEnabled);
......
......@@ -206,7 +206,7 @@ public:
{
}
SplitInfo(const QStringList &r)
explicit SplitInfo(const QStringList &r)
: recipients(r)
{
}
......
......@@ -81,8 +81,8 @@ void SaveContactPreferenceJob::slotSearchContact(KJob *job)
Akonadi::Item item(KContacts::Addressee::mimeType());
item.setPayload<KContacts::Addressee>(contact);
auto job = new Akonadi::ItemCreateJob(item, targetCollection);
connect(job, &Akonadi::ContactSearchJob::result, this, &SaveContactPreferenceJob::slotModifyCreateItem);
auto createJob = new Akonadi::ItemCreateJob(item, targetCollection);
connect(createJob, &Akonadi::ContactSearchJob::result, this, &SaveContactPreferenceJob::slotModifyCreateItem);
} else {
Akonadi::Item item = items.first();
......
......@@ -40,7 +40,7 @@ QString pluginVersion()
class MessageComposer::PluginEditorCheckBeforeSendManagerPrivate
{
public:
PluginEditorCheckBeforeSendManagerPrivate(PluginEditorCheckBeforeSendManager *qq)
explicit PluginEditorCheckBeforeSendManagerPrivate(PluginEditorCheckBeforeSendManager *qq)
: q(qq)
{
initializePlugins();
......
......@@ -240,9 +240,9 @@ QString ConvertSnippetVariablesJob::getNameFromEmail(const QString &address)
const QStringList lst = address.split(QStringLiteral(", "));
QStringList resultName;
for (const QString &str : lst) {
KMime::Types::Mailbox address;
address.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(str));
const QString firstName = address.name();
KMime::Types::Mailbox mailBoxAddress;
mailBoxAddress.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(str));
const QString firstName = mailBoxAddress.name();
if (!firstName.isEmpty()) {
resultName << firstName;
}
......@@ -257,9 +257,9 @@ QString ConvertSnippetVariablesJob::getFirstNameFromEmail(const QString &address
const QStringList lst = address.split(QStringLiteral(", "));
QStringList resultName;
for (const QString &str : lst) {
KMime::Types::Mailbox address;
address.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(str));
const QString firstName = TemplateParser::Util::getFirstNameFromEmail(address.name());
KMime::Types::Mailbox mailBoxAddress;
mailBoxAddress.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(str));
const QString firstName = TemplateParser::Util::getFirstNameFromEmail(mailBoxAddress.name());
if (!firstName.isEmpty()) {
resultName << firstName;
}
......
......@@ -182,14 +182,8 @@ SortOrder SortOrder::defaultForAggregation(const Aggregation *aggregation, SortO
bool messageSortingOk = optionListHasOption(messageSortings, oldSortOrder.messageSorting(), SortOrder().messageSorting());
bool messageSortDirectionOk = false;
if (messageSortingOk) {
OptionList messageSortDirections = enumerateMessageSortDirectionOptions(oldSortOrder.messageSorting());
const OptionList messageSortDirections = enumerateMessageSortDirectionOptions(oldSortOrder.messageSorting());
messageSortDirectionOk = optionListHasOption(messageSortDirections, oldSortOrder.messageSortDirection(), SortOrder().messageSortDirection());
}
//
// Ok, if we can partly adopt the old sort order, set the values now.
//
if (messageSortingOk) {
newSortOrder.setMessageSorting(oldSortOrder.messageSorting());
} else {
newSortOrder.setMessageSorting(SortMessagesByDateTime);
......
......@@ -1363,8 +1363,6 @@ void View::growOrShrinkExistingSelection(const QModelIndex &newSelectedIndex, bo
int topVisualCoordinate = 0xfffffff; // huuuuuge number
int bottomVisualCoordinate = -(0xfffffff);
int candidate;
QModelIndex bottomIndex;
QModelIndex topIndex;
......@@ -1388,7 +1386,7 @@ void View::growOrShrinkExistingSelection(const QModelIndex &newSelectedIndex, bo
top = bottom;
}
}
candidate = visualRect(bottom).bottom();
int candidate = visualRect(bottom).bottom();
if (candidate > bottomVisualCoordinate) {
bottomVisualCoordinate = candidate;
bottomIndex = range.bottomRight();
......
......@@ -18,7 +18,7 @@ using namespace MessageList::Utils;
class MessageList::Utils::ThemeConfigButtonPrivate
{
public:
ThemeConfigButtonPrivate(ThemeConfigButton *owner)
explicit ThemeConfigButtonPrivate(ThemeConfigButton *owner)
: q(owner)
{
}
......
......@@ -90,16 +90,16 @@ void ContactDisplayMessageMemento::slotSearchJobFinished(KJob *job)
if (mPhoto.isEmpty() && mPhoto.url().isEmpty()) {
// No url, no photo => search gravatar
if (Gravatar::GravatarSettings::self()->gravatarSupportEnabled()) {
auto job = new Gravatar::GravatarResolvUrlJob(this);
job->setEmail(mEmailAddress);
job->setUseDefaultPixmap(Gravatar::GravatarSettings::self()->gravatarUseDefaultImage());
job->setFallbackGravatar(Gravatar::GravatarSettings::self()->fallbackToGravatar());
job->setUseLibravatar(Gravatar::GravatarSettings::self()->libravatarSupportEnabled());
if (job->canStart()) {
connect(job, &Gravatar::GravatarResolvUrlJob::finished, this, &ContactDisplayMessageMemento::slotGravatarResolvUrlFinished);
job->start();
auto resolvUrljob = new Gravatar::GravatarResolvUrlJob(this);
resolvUrljob->setEmail(mEmailAddress);
resolvUrljob->setUseDefaultPixmap(Gravatar::GravatarSettings::self()->gravatarUseDefaultImage());
resolvUrljob->setFallbackGravatar(Gravatar::GravatarSettings::self()->fallbackToGravatar());
resolvUrljob->setUseLibravatar(Gravatar::GravatarSettings::self()->libravatarSupportEnabled());
if (resolvUrljob->canStart()) {
connect(resolvUrljob, &Gravatar::GravatarResolvUrlJob::finished, this, &ContactDisplayMessageMemento::slotGravatarResolvUrlFinished);
resolvUrljob->start();
} else {
job->deleteLater();
resolvUrljob->deleteLater();
}
}
}
......
......@@ -22,8 +22,8 @@ class WebEngineViewer::BackOffModeManagerPrivate
public:
BackOffModeManagerPrivate(BackOffModeManager *qq)
: q(qq)
, mTimer(new QTimer(q))
{
mTimer = new QTimer(q);
mTimer->setSingleShot(true);
q->connect(mTimer, &QTimer::timeout, q, &BackOffModeManager::slotTimerFinished);
load();
......@@ -38,7 +38,7 @@ public:
void slotTimerFinished();
BackOffModeManager *const q;
QTimer *mTimer = nullptr;
QTimer *const mTimer;
int mNumberOfHttpFailed = 0;
bool isInOffMode = false;
};
......
......@@ -18,7 +18,7 @@ using namespace WebEngineViewer;
class WebEngineViewer::CreateDatabaseFileJobPrivate
{
public:
CreateDatabaseFileJobPrivate(CreateDatabaseFileJob *qq)
explicit CreateDatabaseFileJobPrivate(CreateDatabaseFileJob *qq)
: q(qq)
{
}
......
......@@ -126,11 +126,11 @@ QByteArray LocalDataBaseFile::searchHash(const QByteArray &hashToSearch)
*/
int posListOffset = 12;
const int numHash = getUint64(4);
int begin = 0;
int end = numHash - 1;
QByteArray previousValue;
if (end > 0) {
QByteArray currentValue;
int begin = 0;
do {
previousValue = currentValue;
const int medium = (begin + end) / 2;
......
......@@ -42,7 +42,7 @@ QString pluginVersion()
class WebEngineViewer::NetworkUrlInterceptorPluginManagerPrivate
{
public:
NetworkUrlInterceptorPluginManagerPrivate(NetworkUrlInterceptorPluginManager *qq)
explicit NetworkUrlInterceptorPluginManagerPrivate(NetworkUrlInterceptorPluginManager *qq)
: q(qq)
{
}
......
......@@ -20,7 +20,7 @@ constexpr qreal zoomBy()
class WebEngineViewer::ZoomActionMenuPrivate
{
public:
ZoomActionMenuPrivate(KActionMenu *qq)
explicit ZoomActionMenuPrivate(KActionMenu *qq)
: q(qq)
{
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment