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

Remove extra ';'

Remove unused virtual keyword
Use nullptr
Fix mem leak
parent 3a85ff45
......@@ -50,7 +50,9 @@ public:
bool serviceEnabled() const;
void setServiceEnabled(bool serviceEnabled);
Q_SIGNAL void serviceEnabledChanged();
Q_SIGNALS:
void serviceEnabledChanged();
private:
class Private;
Private* d;
......
......@@ -61,8 +61,8 @@ class KACCOUNTS_EXPORT AccountsModel : public QAbstractListModel
virtual ~AccountsModel();
QHash< int, QByteArray > roleNames() const override;
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
private:
class Private;
......
......@@ -44,10 +44,6 @@ CreateAccountJob::CreateAccountJob(const QString &providerName, QObject* parent)
: KJob(parent)
, m_providerName(providerName)
, m_manager(new Accounts::Manager(this))
, m_account(nullptr)
, m_accInfo(nullptr)
, m_identity(nullptr)
, m_done(false)
{
}
......
......@@ -70,10 +70,10 @@ private:
QString m_providerName;
QStringList m_disabledServices;
Accounts::Manager *m_manager;
Accounts::Account *m_account;
Accounts::AccountService *m_accInfo;
SignOn::Identity *m_identity;
bool m_done;
Accounts::Manager *m_manager = nullptr;
Accounts::Account *m_account = nullptr;
Accounts::AccountService *m_accInfo = nullptr;
SignOn::Identity *m_identity = nullptr;
bool m_done = false;
};
#endif //CREATE_ACCOUNT_JOB_H
......@@ -131,6 +131,11 @@ GetCredentialsJob::GetCredentialsJob(const Accounts::AccountId &id, const QStrin
d->serviceType = QString();
}
GetCredentialsJob::~GetCredentialsJob()
{
delete d;
}
void GetCredentialsJob::start()
{
QMetaObject::invokeMethod(this, "getCredentials", Qt::QueuedConnection);
......
......@@ -59,6 +59,7 @@ public:
*/
GetCredentialsJob(const Accounts::AccountId &id, const QString &authMethod = QString(), const QString &authMechanism = QString(), QObject *parent = nullptr);
~GetCredentialsJob();
/**
* Starts the credentials job
*/
......
......@@ -53,8 +53,8 @@ class KACCOUNTS_EXPORT ProvidersModel : public QAbstractListModel
virtual ~ProvidersModel();
QHash< int, QByteArray > roleNames() const override;
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
private:
class Private;
......
......@@ -35,9 +35,9 @@ class ServicesModel::Private : public QObject
public:
Private(ServicesModel *model)
: q(model)
{ };
{ }
virtual ~Private()
{ };
{ }
Accounts::ServiceList services;
Accounts::Account* account{nullptr};
......
......@@ -82,8 +82,8 @@ class KACCOUNTS_EXPORT ServicesModel : public QAbstractListModel
virtual ~ServicesModel();
QHash< int, QByteArray > roleNames() const override;
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
void setAccount(QObject* account);
QObject* account() const;
......@@ -91,7 +91,8 @@ class KACCOUNTS_EXPORT ServicesModel : public QAbstractListModel
QString accountDisplayName() const;
QString accountProviderName() const;
QString accountIconName() const;
Q_SIGNAL void accountChanged();
Q_SIGNALS:
void accountChanged();
private:
class Private;
......
......@@ -78,8 +78,8 @@ void CreateKioService::gotCredentials(KJob *job)
netJob->setUsername(username);
netJob->setPassword(data[QStringLiteral("Secret")].toString());
netJob->setIcon(service.iconName());
netJob->setUniqueId(QString::number(m_accountId) + QStringLiteral("_") + m_serviceName);
netJob->setName(m_manager->provider(service.provider()).displayName() + QStringLiteral(" ") + service.displayName());
netJob->setUniqueId(QString::number(m_accountId) + QLatin1Char('_') + m_serviceName);
netJob->setName(m_manager->provider(service.provider()).displayName() + QLatin1Char(' ') + service.displayName());
netJob->start();
}
......
......@@ -25,11 +25,11 @@
namespace Accounts {
class Manager;
};
}
namespace KWallet {
class Wallet;
};
}
class CreateKioService : public KJob
{
......@@ -58,8 +58,8 @@ private Q_SLOTS:
private:
void createDesktopFile();
Accounts::Manager *m_manager;
Accounts::Account *m_account;
Accounts::Manager *m_manager = nullptr;
Accounts::Account *m_account = nullptr;
Accounts::AccountId m_accountId;
QString m_serviceName;
QString m_serviceType;
......
......@@ -36,7 +36,6 @@ using namespace KWallet;
CreateNetAttachJob::CreateNetAttachJob(QObject *parent)
: KJob(parent)
, m_wallet(0)
{
}
......@@ -95,7 +94,7 @@ void CreateNetAttachJob::getRealm()
KIO::MetaData data;
data.insert(QStringLiteral("PropagateHttpHeader"), QStringLiteral("true"));
job->setMetaData(data);
job->setUiDelegate(0);
job->setUiDelegate(nullptr);
job->start();
}
......
......@@ -24,7 +24,7 @@
namespace KWallet {
class Wallet;
};
}
class CreateNetAttachJob : public KJob
{
......@@ -78,7 +78,7 @@ private:
QString m_uniqueId;
QString m_icon;
KWallet::Wallet *m_wallet;
KWallet::Wallet *m_wallet = nullptr;
};
#endif //CREATE_NETATTACH_H
......@@ -44,10 +44,10 @@ public:
~KIOServices() override;
public Q_SLOTS:
void onAccountCreated(const Accounts::AccountId accId, const Accounts::ServiceList &serviceList);
void onAccountRemoved(const Accounts::AccountId accId);
void onServiceEnabled(const Accounts::AccountId accId, const Accounts::Service &service);
void onServiceDisabled(const Accounts::AccountId accId, const Accounts::Service &service);
void onAccountCreated(const Accounts::AccountId accId, const Accounts::ServiceList &serviceList) override;
void onAccountRemoved(const Accounts::AccountId accId) override;
void onServiceEnabled(const Accounts::AccountId accId, const Accounts::Service &service) override;
void onServiceDisabled(const Accounts::AccountId accId, const Accounts::Service &service) override;
private:
void enableService(const Accounts::AccountId accId, const Accounts::Service &service);
......
......@@ -27,11 +27,11 @@
#include <KWallet/KWallet>
#include <KDirNotify>
#include <KConfig>
#include <KLocalizedString>
using namespace KWallet;
RemoveNetAttachJob::RemoveNetAttachJob(QObject *parent)
: KJob(parent)
, m_wallet(0)
{
}
......@@ -60,7 +60,7 @@ void RemoveNetAttachJob::walletOpened(bool opened)
qDebug();
if (!opened) {
setError(-1);
setErrorText(QStringLiteral("Can't open wallet"));
setErrorText(i18n("Can't open wallet"));
emitResult();
return;
}
......
......@@ -24,7 +24,7 @@
namespace KWallet {
class Wallet;
};
}
class RemoveNetAttachJob : public KJob
{
Q_OBJECT
......@@ -46,7 +46,7 @@ private Q_SLOTS:
private:
QString m_uniqueId;
KWallet::Wallet *m_wallet;
KWallet::Wallet *m_wallet = nullptr;
};
#endif //REMOVENETATTACHJOB_H
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