get rid of a memory leak and an unused/unuseful method in the private class

This commit is contained in:
Aaron Seigo 2011-05-24 11:16:38 +02:00
parent 5a9373ae0d
commit 4766f0e63e
2 changed files with 12 additions and 12 deletions

View File

@ -48,8 +48,9 @@
namespace Plasma namespace Plasma
{ {
SigningPrivate::SigningPrivate(Signing *auth, const QString &keystorePath = 0) SigningPrivate::SigningPrivate(Signing *auth, const QString &path)
: q(auth) : q(auth),
m_keystorePath(path)
{ {
GpgME::initializeLibrary(); GpgME::initializeLibrary();
GpgME::Error error = GpgME::checkEngine(GpgME::OpenPGP); GpgME::Error error = GpgME::checkEngine(GpgME::OpenPGP);
@ -61,7 +62,7 @@ SigningPrivate::SigningPrivate(Signing *auth, const QString &keystorePath = 0)
m_gpgContext = GpgME::Context::createForProtocol(GpgME::OpenPGP); m_gpgContext = GpgME::Context::createForProtocol(GpgME::OpenPGP);
m_gpgContext->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL | GPGME_KEYLIST_MODE_SIGS); m_gpgContext->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL | GPGME_KEYLIST_MODE_SIGS);
m_keystorePath = keystorePath; m_keystorePath = path;
if (m_keystorePath.isEmpty()) { if (m_keystorePath.isEmpty()) {
// From the gpgme doc: if the homeDirectory() is null, it means we are using the standard dir, // From the gpgme doc: if the homeDirectory() is null, it means we are using the standard dir,
@ -93,6 +94,11 @@ SigningPrivate::SigningPrivate(Signing *auth, const QString &keystorePath = 0)
q->connect(m_KdeKeysDir, SIGNAL(deleted(const QString &)), q, SLOT(slotKDEKeyRemoved(const QString &))); q->connect(m_KdeKeysDir, SIGNAL(deleted(const QString &)), q, SLOT(slotKDEKeyRemoved(const QString &)));
} }
SigningPrivate::~SigningPrivate()
{
delete m_keystoreDir;
delete m_KdeKeysDir;
}
void SigningPrivate::importKdeKeysToKeystore() void SigningPrivate::importKdeKeysToKeystore()
{ {
@ -135,7 +141,6 @@ void SigningPrivate::importKdeKeysToKeystore()
// Restore scanning folders // Restore scanning folders
m_keystoreDir->startScan(true, true); m_keystoreDir->startScan(true, true);
m_KdeKeysDir->startScan(true, true); m_KdeKeysDir->startScan(true, true);
} }
void SigningPrivate::splitKeysByTrustLevel() void SigningPrivate::splitKeysByTrustLevel()
@ -387,11 +392,6 @@ QString SigningPrivate::descriptiveString(const QString &keyID) const
return result; return result;
} }
QString SigningPrivate::keystorePath() const
{
return m_keystorePath;
}
void SigningPrivate::slotProcessKeystore() void SigningPrivate::slotProcessKeystore()
{ {
QMap<TrustLevel, QList<QByteArray> > tmpMap = keys; QMap<TrustLevel, QList<QByteArray> > tmpMap = keys;
@ -641,7 +641,7 @@ QString Signing::signerOf(const KUrl &plasmoidPath, const KUrl &plasmoidSignatur
QString Signing::keyStorePath() const QString Signing::keyStorePath() const
{ {
return d->keystorePath(); return d->m_keystorePath;
} }
QString Signing::descriptiveString(const QString &keyID) const QString Signing::descriptiveString(const QString &keyID) const

View File

@ -41,6 +41,7 @@ class SigningPrivate
public: public:
SigningPrivate(Signing *auth, const QString &keystorePath); SigningPrivate(Signing *auth, const QString &keystorePath);
~SigningPrivate();
Signing *q; Signing *q;
// Save all the keys in a single object, splitted by their SigningLevel // Save all the keys in a single object, splitted by their SigningLevel
@ -52,7 +53,6 @@ public:
QStringList keysID(const bool returnPrivate) const; QStringList keysID(const bool returnPrivate) const;
QString signerOf(const QString &messagePath, const QString &signaturePath) const; QString signerOf(const QString &messagePath, const QString &signaturePath) const;
QString descriptiveString(const QString &keyID) const; QString descriptiveString(const QString &keyID) const;
QString keystorePath() const;
void slotProcessKeystore(); void slotProcessKeystore();
void slotKDEKeyAdded(const QString path); void slotKDEKeyAdded(const QString path);