Commit 7cd5e62a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix warning found by clazy

parent 8bc72432
......@@ -91,9 +91,6 @@ void TestLDAPClient::testIntevation()
qDebug();
mClient = new KLDAP::LdapClient(0, this);
#ifdef __GNUC__
#warning TODO!
#endif
#if 0
mClient->setHost("ca.intevation.de");
mClient->setPort("389");
......
......@@ -887,7 +887,8 @@ KLDAP::LdapClientSearch *AddresseeLineEdit::ldapSearch() const
void AddresseeLineEdit::slotEditingFinished()
{
for (KJob *job : d->mightBeGroupJobs()) {
const QList<KJob *> listJob = d->mightBeGroupJobs();
for (KJob *job : listJob) {
disconnect(job);
job->deleteLater();
}
......
......@@ -22,9 +22,7 @@
using namespace KPIM;
AddresseeLineEditAkonadi::AddresseeLineEditAkonadi(AddresseeLineEditManager *addressLineStatic)
: m_akonadiSession(nullptr)
, mAddressLineStatic(addressLineStatic)
AddresseeLineEditAkonadi::AddresseeLineEditAkonadi()
{
}
......
......@@ -33,14 +33,13 @@ class AddresseeLineEditManager;
class AddresseeLineEditAkonadi
{
public:
explicit AddresseeLineEditAkonadi(AddresseeLineEditManager *addressLineStatic);
explicit AddresseeLineEditAkonadi();
~AddresseeLineEditAkonadi();
Akonadi::Session *akonadiSession() const;
private:
mutable Akonadi::Session *m_akonadiSession = nullptr;
AddresseeLineEditManager *mAddressLineStatic = nullptr;
};
}
......
......@@ -24,9 +24,8 @@
using namespace KPIM;
AddresseeLineEditBaloo::AddresseeLineEditBaloo(AddresseeLineEditManager *addressLineStatic)
AddresseeLineEditBaloo::AddresseeLineEditBaloo()
: mBalooCompletionSource(0)
, mAddressLineStatic(addressLineStatic)
{
loadBalooBlackList();
}
......
......@@ -23,11 +23,10 @@
#include <QStringList>
namespace KPIM {
class AddresseeLineEditManager;
class AddresseeLineEditBaloo
{
public:
explicit AddresseeLineEditBaloo(AddresseeLineEditManager *addressLineStatic);
AddresseeLineEditBaloo();
~AddresseeLineEditBaloo();
int balooCompletionSource() const;
......@@ -43,7 +42,6 @@ private:
QStringList mDomainExcludeList;
int mBalooCompletionSource = 0;
AddresseeLineEditManager *mAddressLineStatic = nullptr;
};
}
......
......@@ -42,7 +42,8 @@ void AddresseeLineEditLdap::updateLDAPWeights()
* that they map to the LdapClient::clientNumber() */
mLdapSearch->updateCompletionWeights();
int clientIndex = 0;
for (const KLDAP::LdapClient *client : mLdapSearch->clients()) {
const QList<KLDAP::LdapClient *> lstClients = mLdapSearch->clients();
for (const KLDAP::LdapClient *client : lstClients) {
const int sourceIndex
= mAddressLineStatic->addCompletionSource(i18n("LDAP server: %1", client->server().host()),
client->completionWeight());
......
......@@ -39,9 +39,9 @@ AddresseeLineEditManager::AddresseeLineEditManager()
: mShowOU(false)
, mAutoGroupExpand(false)
, mCompletion(new KMailCompletion)
, mAddresseeLineEditAkonadi(new AddresseeLineEditAkonadi(this))
, mAddresseeLineEditAkonadi(new AddresseeLineEditAkonadi)
, mAddressessLineEditLdap(new AddresseeLineEditLdap(this))
, mAddressessLineEditBaloo(new AddresseeLineEditBaloo(this))
, mAddressessLineEditBaloo(new AddresseeLineEditBaloo)
, mNetworkConfigMgr(new QNetworkConfigurationManager(QCoreApplication::instance()))
{
KConfigGroup group(KSharedConfig::openConfig(), "AddressLineEdit");
......
......@@ -124,7 +124,7 @@ void BlackListBalooEmailCompletionWidgetTest::shouldChangeEnableSelectUnSelectBu
QVERIFY(!unselectButton->isEnabled());
KPIM::BlackListBalooEmailList *emailList = widget.findChild<KPIM::BlackListBalooEmailList *>(QStringLiteral("email_list"));
emailList->setEmailFound(QStringList() << QStringLiteral("foo") << QStringLiteral("bla") << QStringLiteral("bli"));
QVERIFY((emailList->setEmailFound(QStringList() << QStringLiteral("foo") << QStringLiteral("bla") << QStringLiteral("bli")) > 0));
emailList->selectAll();
QVERIFY(unselectButton->isEnabled());
......
......@@ -196,7 +196,9 @@ void BlackListBalooEmailCompletionWidget::slotSearch()
job->setSearchEmail(searchEmail);
job->setLimit(mLimit);
connect(job, &BlackListBalooEmailSearchJob::emailsFound, this, &BlackListBalooEmailCompletionWidget::slotEmailFound);
job->start();
if (!job->start()) {
qCWarning(LIBKDEPIMAKONADI_LOG) << "Impossible to start search job";
}
}
}
......
......@@ -345,7 +345,8 @@ void CompletionOrderWidget::loadCompletionItems()
{
if (mLdapSearch) {
// The first step is to gather all the data, creating CompletionItem objects
for (KLDAP::LdapClient *client : mLdapSearch->clients()) {
const QList<KLDAP::LdapClient *> listClients = mLdapSearch->clients();
for (KLDAP::LdapClient *client : listClients) {
new CompletionViewItem(mListView, new LDAPCompletionItem(client));
}
}
......
......@@ -145,8 +145,10 @@ QVector<KPIM::AddressessLineEditAbstractPlugin *> AddressessLineEditPluginManage
KPIM::AddressessLineEditAbstractPlugin *AddressessLineEditPluginManager::plugin(const QString &identifier)
{
for (KPIM::AddressessLineEditAbstractPlugin *p : pluginsList()) {
for (const AddressessLineEditAbstractPluginInfo &info : p->names()) {
const QVector<KPIM::AddressessLineEditAbstractPlugin *> lstPlugins = pluginsList();
for (KPIM::AddressessLineEditAbstractPlugin *p : lstPlugins) {
const QVector<AddressessLineEditAbstractPluginInfo> lstPluginsInfo = p->names();
for (const AddressessLineEditAbstractPluginInfo &info : lstPluginsInfo) {
if (info.identifier == identifier) {
return p;
}
......
......@@ -90,7 +90,7 @@ public:
Akonadi::ItemModifyJob *job = new Akonadi::ItemModifyJob(item);
q->connect(job, &Akonadi::ItemModifyJob::result, q, [this](KJob *job) {
Akonadi::ItemModifyJob *modifiedJob = static_cast<Akonadi::ItemModifyJob *>(job);
q->contactUpdated(modifiedJob->item(), messageId);
Q_EMIT q->contactUpdated(modifiedJob->item(), messageId);
slotAddModifyContactDone(job);
});
} else {
......@@ -121,7 +121,7 @@ public:
Akonadi::ItemModifyJob *job = new Akonadi::ItemModifyJob(item);
q->connect(job, &Akonadi::ItemModifyJob::result, q, [this](KJob *job) {
Akonadi::ItemModifyJob *modifiedJob = static_cast<Akonadi::ItemModifyJob *>(job);
q->contactUpdated(modifiedJob->item(), messageId);
Q_EMIT q->contactUpdated(modifiedJob->item(), messageId);
slotAddModifyContactDone(job);
});
}
......@@ -245,7 +245,7 @@ public:
Akonadi::ItemCreateJob *createJob = new Akonadi::ItemCreateJob(item, addressBook, q);
q->connect(createJob, &Akonadi::ItemCreateJob::result, q, [this](KJob *job) {
Akonadi::ItemCreateJob *modifiedJob = static_cast<Akonadi::ItemCreateJob *>(job);
q->contactUpdated(modifiedJob->item(), messageId);
Q_EMIT q->contactUpdated(modifiedJob->item(), messageId);
slotAddModifyContactDone(job);
});
}
......
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