Commit d8795cbb authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix cppcheck warning

parent b6a3dbcc
......@@ -185,9 +185,8 @@ void CSVImportExportPluginInterface::exportCSV()
if (QFileInfo::exists(url.isLocalFile() ? url.toLocalFile() : url.path())) {
if (url.isLocalFile() && QFileInfo::exists(url.toLocalFile())) {
PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE;
PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget());
result = static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dialog->exec());
PimCommon::RenameFileDialog::RenameFileDialogResult result = static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dialog->exec());
if (result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME) {
url = dialog->newName();
} else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) {
......
......@@ -34,11 +34,7 @@ class QCsvReader::Private
public:
Private(QCsvBuilderInterface *builder)
: mBuilder(builder)
, mNotTerminated(true)
{
mTextQuote = QLatin1Char('"');
mDelimiter = QLatin1Char(' ');
mStartRow = 0;
mCodec = QTextCodec::codecForLocale();
}
......@@ -48,8 +44,8 @@ public:
QCsvBuilderInterface *mBuilder = nullptr;
QTextCodec *mCodec = nullptr;
QChar mTextQuote;
QChar mDelimiter;
QChar mTextQuote = QLatin1Char('"');
QChar mDelimiter = QLatin1Char(' ');
uint mStartRow = 0;
bool mNotTerminated = true;
......
......@@ -178,9 +178,8 @@ void LDifImportExportPluginInterface::exportLdif()
if (QFileInfo::exists(fileName)) {
if (url.isLocalFile() && QFileInfo::exists(url.toLocalFile())) {
PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE;
PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget());
result = static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dialog->exec());
PimCommon::RenameFileDialog::RenameFileDialogResult result = static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dialog->exec());
if (result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME) {
fileName = dialog->newName().toLocalFile();
} else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) {
......
......@@ -71,13 +71,13 @@ void MailSenderJob::start()
for (unsigned int i = 0; i < nbContactReference; ++i) {
KContacts::ContactGroup::ContactReference reference = group.contactReference(i);
Akonadi::Item item;
Akonadi::Item newItem;
if (reference.gid().isEmpty()) {
item.setId(reference.uid().toLongLong());
newItem.setId(reference.uid().toLongLong());
} else {
item.setGid(reference.gid());
newItem.setGid(reference.gid());
}
mItemToFetch << item;
mItemToFetch << newItem;
}
}
}
......
......@@ -27,7 +27,7 @@ class QTextStream;
class MarkdownHighlighter : public KSyntaxHighlighting::AbstractHighlighter
{
public:
MarkdownHighlighter(QTextStream *stream);
explicit MarkdownHighlighter(QTextStream *stream);
~MarkdownHighlighter() override;
void highlight(const QString &str);
......
......@@ -44,7 +44,7 @@ public:
class ShortUrlEnginePluginManagerPrivate
{
public:
ShortUrlEnginePluginManagerPrivate(ShortUrlEnginePluginManager *qq)
explicit ShortUrlEnginePluginManagerPrivate(ShortUrlEnginePluginManager *qq)
: q(qq)
{
}
......
......@@ -92,12 +92,13 @@ using namespace MailTransport;
namespace {
static bool hasMyWritableEventsFolders(const QString &family)
{
Q_UNUSED(family)
#if 0 // TODO port to Akonadi
QString myfamily = family;
if (family.isEmpty()) {
myfamily = QStringLiteral("calendar");
}
#if 0 // TODO port to Akonadi
#ifndef KDEPIM_NO_KRESOURCES
CalendarResourceManager manager(myfamily);
manager.readConfig();
......@@ -318,7 +319,6 @@ public:
// We are the current one, and even the receiver, note
// this and quit searching.
return i;
break;
}
}
return -1;
......
......@@ -44,7 +44,7 @@ public:
ConfirmationResponse
};
GnuPGWKSMessagePart(MimeTreeParser::Interface::BodyPart *part);
explicit GnuPGWKSMessagePart(MimeTreeParser::Interface::BodyPart *part);
virtual ~GnuPGWKSMessagePart() = default;
......
......@@ -27,7 +27,7 @@ class QTextStream;
class Highlighter : public KSyntaxHighlighting::AbstractHighlighter
{
public:
Highlighter(QTextStream *stream);
explicit Highlighter(QTextStream *stream);
~Highlighter() override;
void highlight(const QString &str);
......
......@@ -102,7 +102,6 @@ MimeTreeParser::MessagePart::Ptr ItineraryProcessor::process(MimeTreeParser::Int
}
memento->setParsed(part.content()->index());
std::vector<const Extractor *> extractors;
std::unique_ptr<KPkPass::Pass> pass;
bool isPdf = false;
......
......@@ -53,7 +53,7 @@ void AdBlockSearchTree::clear()
m_root = new Node;
}
bool AdBlockSearchTree::add(const AdBlockRule *rule)
bool AdBlockSearchTree::add(const AdBlockRule *rule) const
{
if (rule->m_type != AdBlockRule::StringContainsMatchRule) {
return false;
......
......@@ -47,7 +47,7 @@ public:
void clear();
bool add(const AdBlockRule *rule);
Q_REQUIRED_RESULT bool add(const AdBlockRule *rule) const;
const AdBlockRule *find(const QWebEngineUrlRequestInfo &request, const QString &domain, const QString &urlString) const;
private:
......
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