Commit f2d0709d authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Rolf Eike Beer
Browse files

use nullptr directly

parent 2ee7b9a1
......@@ -250,7 +250,7 @@ KGpgCaffPrivate::slotSigningFinished(int result)
int index = 1;
removeMode = KGpgDelUid::RemoveAllOther;
while ( (otherUid = key->getUid(index++)) != Q_NULLPTR) {
while ( (otherUid = key->getUid(index++)) != nullptr) {
if (otherUid == uid) {
removeMode = KGpgDelUid::RemoveWithEmail;
break;
......@@ -319,7 +319,7 @@ KGpgCaffPrivate::slotExportFinished(int result)
const KGpgKeyNode *key = uid->getKeyNode();
KGpgExport *exp = qobject_cast<KGpgExport *>(sender());
Q_ASSERT(exp != Q_NULLPTR);
Q_ASSERT(exp != nullptr);
QString body = KGpgSettings::emailTemplate();
body.replace(QLatin1Char( '%' ) + i18nc("Email template placeholder for key id", "KEYID") + QLatin1Char( '%' ), key->getId());
......@@ -346,7 +346,7 @@ KGpgCaffPrivate::slotTextEncrypted(int result)
switch (result) {
case KGpgTransaction::TS_OK: {
KGpgEncrypt *enc = qobject_cast<KGpgEncrypt *>(sender());
Q_ASSERT(enc != Q_NULLPTR);
Q_ASSERT(enc != nullptr);
const QString text = enc->encryptedText().join(QLatin1String("\n"));
......
......@@ -23,7 +23,7 @@ class Encryption : public QWidget, public Ui_Encryption
{
public:
explicit Encryption(QWidget* parent = Q_NULLPTR);
explicit Encryption(QWidget* parent = nullptr);
public:
virtual void encrypt_to_always_toggled( bool );
......
......@@ -25,7 +25,7 @@
KGpgExpandableNode::KGpgExpandableNode(KGpgExpandableNode *parent)
: KGpgNode(parent)
{
if (parent != Q_NULLPTR)
if (parent != nullptr)
parent->children.append(this);
}
......
......@@ -47,7 +47,7 @@ protected:
*/
virtual void readChildren() = 0;
explicit KGpgExpandableNode(KGpgExpandableNode *parent = Q_NULLPTR);
explicit KGpgExpandableNode(KGpgExpandableNode *parent = nullptr);
public:
virtual ~KGpgExpandableNode();
......
......@@ -40,7 +40,7 @@ KGpgGroupMemberNode::~KGpgGroupMemberNode()
KgpgKeyTrust
KGpgGroupMemberNode::getTrust() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getTrust();
return KgpgCore::TRUST_NOKEY;
}
......@@ -48,7 +48,7 @@ KGpgGroupMemberNode::getTrust() const
KgpgItemType
KGpgGroupMemberNode::getType() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getType() | KgpgCore::ITYPE_GROUP;
return KgpgCore::ITYPE_PUBLIC | KgpgCore::ITYPE_GROUP;
}
......@@ -56,7 +56,7 @@ KGpgGroupMemberNode::getType() const
QString
KGpgGroupMemberNode::getSize() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getSize();
return QString();
}
......@@ -64,7 +64,7 @@ KGpgGroupMemberNode::getSize() const
QDateTime
KGpgGroupMemberNode::getExpiration() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getExpiration();
return QDateTime();
}
......@@ -72,7 +72,7 @@ KGpgGroupMemberNode::getExpiration() const
QDateTime
KGpgGroupMemberNode::getCreation() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getCreation();
return QDateTime();
}
......@@ -80,7 +80,7 @@ KGpgGroupMemberNode::getCreation() const
unsigned int
KGpgGroupMemberNode::getSignKeySize() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getSignKeySize();
return 0;
}
......@@ -88,7 +88,7 @@ KGpgGroupMemberNode::getSignKeySize() const
unsigned int
KGpgGroupMemberNode::getEncryptionKeySize() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getEncryptionKeySize();
return 0;
}
......
......@@ -143,7 +143,7 @@ KGpgGroupNode::KGpgGroupNode(KGpgRootNode *parent, const QString &name, const KG
KGpgGroupNode::~KGpgGroupNode()
{
if (parent() != Q_NULLPTR)
if (parent() != nullptr)
m_parent->toRootNode()->m_groups--;
}
......
......@@ -40,7 +40,7 @@ KGpgKeyNode::KGpgKeyNode(KGpgRootNode *parent, const KgpgCore::KgpgKey &k)
KGpgKeyNode::~KGpgKeyNode()
{
// do not try to access the root node if we are being deleted from there
KGpgRootNode * const root = parent() != Q_NULLPTR ? m_parent->toRootNode() : Q_NULLPTR;
KGpgRootNode * const root = parent() != nullptr ? m_parent->toRootNode() : nullptr;
foreach (KGpgRefNode *nd, m_refs) {
nd->unRef(root);
}
......@@ -334,7 +334,7 @@ KGpgKeyNode::getUid(const unsigned int index) const
}
}
return Q_NULLPTR;
return nullptr;
}
bool
......
......@@ -131,7 +131,7 @@ public:
* @param node node that no longer has the reference
*
* Note that this must not be called as reply when this object
* emits updated(Q_NULLPTR)
* emits updated(nullptr)
*/
void delRef(KGpgRefNode *node);
/**
......@@ -154,7 +154,7 @@ public:
/**
* @brief get the user id or user attribute with the given number
* @param index the index of the user id to return
* @return the requested subitem or Q_NULLPTR if that is not present
* @return the requested subitem or nullptr if that is not present
*
* User ids indexes are 1-based, so 0 is not a valid index. Passing
* 1 as index will return the object itself, representing the primary
......
......@@ -32,8 +32,8 @@
KGpgNode::KGpgNode(KGpgExpandableNode *parent)
: QObject(), m_parent(parent)
{
if (parent == Q_NULLPTR)
m_model = Q_NULLPTR;
if (parent == nullptr)
m_model = nullptr;
else
m_model = parent->m_model;
}
......@@ -43,7 +43,7 @@ KGpgNode::~KGpgNode()
Q_ASSERT(m_model);
m_model->invalidateIndexes(this);
if (m_parent != Q_NULLPTR)
if (m_parent != nullptr)
m_parent->deleteChild(this);
}
......@@ -111,7 +111,7 @@ KGpgNode::toKeyNode() const
KGpgRootNode *
KGpgNode::toRootNode()
{
Q_ASSERT((m_parent == Q_NULLPTR) && (getType() == 0));
Q_ASSERT((m_parent == nullptr) && (getType() == 0));
return static_cast<KGpgRootNode *>(this);
}
......@@ -119,7 +119,7 @@ KGpgNode::toRootNode()
const KGpgRootNode *
KGpgNode::toRootNode() const
{
Q_ASSERT((m_parent == Q_NULLPTR) && (getType() == 0));
Q_ASSERT((m_parent == nullptr) && (getType() == 0));
return static_cast<const KGpgRootNode *>(this);
}
......@@ -268,7 +268,7 @@ KGpgNode *
KGpgNode::getChild(const int index) const
{
Q_UNUSED(index);
return Q_NULLPTR;
return nullptr;
}
int
......
......@@ -121,8 +121,8 @@ public:
*
* For all "primary" items like keys and key groups this will
* return the (invisible) root node. Calling this function for
* the root node will return %Q_NULLPTR. No other node but the root
* node has a %Q_NULLPTR parent.
* the root node will return %nullptr. No other node but the root
* node has a %nullptr parent.
*/
KGpgExpandableNode *getParentKeyNode() const;
......
......@@ -47,7 +47,7 @@ KGpgRefNode::KGpgRefNode(KGpgExpandableNode *parent, const QString &keyid)
if (!m_selfsig) {
m_keynode = root->findKey(keyid);
if (m_keynode != Q_NULLPTR) {
if (m_keynode != nullptr) {
m_keynode->addRef(this);
} else {
m_updateConnection = connect(root, &KGpgRootNode::newKeyNode, this, &KGpgRefNode::keyUpdated);
......@@ -62,8 +62,8 @@ KGpgRefNode::KGpgRefNode(KGpgExpandableNode *parent, KGpgKeyNode *key)
m_id(key->getId()),
m_keynode(key)
{
Q_ASSERT(key != Q_NULLPTR);
Q_ASSERT(parent != Q_NULLPTR);
Q_ASSERT(key != nullptr);
Q_ASSERT(parent != nullptr);
m_keynode->addRef(this);
parent->children.append(this);
......@@ -84,7 +84,7 @@ KGpgRefNode::getRootNode() const
do {
root = pt;
pt = pt->getParentKeyNode();
} while (pt != Q_NULLPTR);
} while (pt != nullptr);
return root->toRootNode();
}
......@@ -92,8 +92,8 @@ KGpgRefNode::getRootNode() const
void
KGpgRefNode::keyUpdated(KGpgKeyNode *nkey)
{
Q_ASSERT(m_keynode == Q_NULLPTR);
Q_ASSERT(nkey != Q_NULLPTR);
Q_ASSERT(m_keynode == nullptr);
Q_ASSERT(nkey != nullptr);
if (nkey->compareId(m_id)) {
disconnect(m_updateConnection);
......@@ -105,16 +105,16 @@ KGpgRefNode::keyUpdated(KGpgKeyNode *nkey)
void
KGpgRefNode::unRef(KGpgRootNode *root)
{
if (root != Q_NULLPTR)
if (root != nullptr)
m_updateConnection = connect(root, &KGpgRootNode::newKeyNode, this, &KGpgRefNode::keyUpdated);
m_keynode = Q_NULLPTR;
m_keynode = nullptr;
}
QString
KGpgRefNode::getId() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getFingerprint();
else
return m_id;
......@@ -123,7 +123,7 @@ KGpgRefNode::getId() const
QString
KGpgRefNode::getName() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getName();
return i18n("[No user id found]");
}
......@@ -131,7 +131,7 @@ KGpgRefNode::getName() const
QString
KGpgRefNode::getEmail() const
{
if (m_keynode != Q_NULLPTR)
if (m_keynode != nullptr)
return m_keynode->getEmail();
return QString();
}
......@@ -139,7 +139,7 @@ KGpgRefNode::getEmail() const
bool
KGpgRefNode::isUnknown() const
{
return (m_keynode == Q_NULLPTR);
return (m_keynode == nullptr);
}
KGpgKeyNode *
......
......@@ -63,17 +63,17 @@ public:
* Get the node of the primary key this node references to
*
* This will return the key node of the primary key this node
* references. This may be %Q_NULLPTR if the primary key is not in the key
* references. This may be %nullptr if the primary key is not in the key
* ring, e.g. if this is a signature of an unknown key.
*
* @return the node of the primary key or %Q_NULLPTR
* @return the node of the primary key or %nullptr
*/
virtual KGpgKeyNode *getRefNode() const;
/**
* Check if the referenced key exists
*
* @return if getRefNode() will return %Q_NULLPTR or not
* @return if getRefNode() will return %nullptr or not
*/
bool isUnknown() const;
......
......@@ -27,7 +27,7 @@
#include <QStringList>
KGpgRootNode::KGpgRootNode(KGpgItemModel *model)
: KGpgExpandableNode(Q_NULLPTR),
: KGpgExpandableNode(nullptr),
m_groups(0)
{
m_model = model;
......@@ -38,7 +38,7 @@ KGpgRootNode::~KGpgRootNode()
// clear the parents in all children to signal them not to do any
// update signalling
for (KGpgNode *child: children)
child->setParent(Q_NULLPTR);
child->setParent(nullptr);
}
void
......@@ -126,7 +126,7 @@ KGpgRootNode::findKey(const QString &keyId)
return children[i]->toKeyNode();
}
return Q_NULLPTR;
return nullptr;
}
int
......
......@@ -32,7 +32,7 @@ class QString;
*
* This object is invisible to the user but acts as the internal base object for
* everything in the keyring. It is anchestor of all other KGpgNode objects and
* the only one that will ever return Q_NULLPTR when calling getParentKeyNode() on it.
* the only one that will ever return nullptr when calling getParentKeyNode() on it.
*
* There is only one object of this type around at any time.
*/
......@@ -77,7 +77,7 @@ public:
* the complete fingerprint whenever possible.
*
* @param keyId the key id to find, any length is permitted
* @return pointer to key node or %Q_NULLPTR if no such key
* @return pointer to key node or %nullptr if no such key
*/
KGpgKeyNode *findKey(const QString &keyId);
/**
......
......@@ -36,7 +36,7 @@ public:
typedef QList<KGpgSignableNode *> List;
typedef QList<const KGpgSignableNode *> const_List;
explicit KGpgSignableNode(KGpgExpandableNode *parent = Q_NULLPTR);
explicit KGpgSignableNode(KGpgExpandableNode *parent = nullptr);
virtual ~KGpgSignableNode();
KGpgSignNode::List getSignatures(void) const;
......
......@@ -27,7 +27,7 @@ KGpgSubkeyNode::KGpgSubkeyNode(KGpgKeyNode *parent, const KgpgKeySub &k)
: KGpgSignableNode(parent),
m_skey(k)
{
Q_ASSERT(parent != Q_NULLPTR);
Q_ASSERT(parent != nullptr);
}
KGpgSubkeyNode::~KGpgSubkeyNode()
{
......
......@@ -29,7 +29,7 @@ namespace KgpgCore
class EmailValidator : public QValidator
{
public:
explicit EmailValidator(QObject *parent = Q_NULLPTR) : QValidator(parent) { }
explicit EmailValidator(QObject *parent = nullptr) : QValidator(parent) { }
virtual QValidator::State validate(QString &input, int &pos) const;
};
......
......@@ -303,7 +303,7 @@ QString KgpgKey::strength() const
uint KgpgKey::encryptionSize() const
{
const KgpgKeySub *enc = Q_NULLPTR;
const KgpgKeySub *enc = nullptr;
// Get the first encryption subkey
foreach (const KgpgKeySub &k, *d->gpgsublist) {
if (k.type() & SKT_ENCRYPTION) {
......@@ -311,18 +311,18 @@ uint KgpgKey::encryptionSize() const
// check if there is one that is not
if (k.trust() > TRUST_EXPIRED)
return k.size();
if (enc == Q_NULLPTR)
if (enc == nullptr)
enc = &k;
}
}
if (enc != Q_NULLPTR)
if (enc != nullptr)
return enc->size();
return 0;
}
QString KgpgKey::encryptionStrength() const
{
const KgpgKeySub *enc = Q_NULLPTR;
const KgpgKeySub *enc = nullptr;
// Get the first encryption subkey
foreach (const KgpgKeySub &k, *d->gpgsublist) {
if (k.type() & SKT_ENCRYPTION) {
......@@ -330,11 +330,11 @@ QString KgpgKey::encryptionStrength() const
// check if there is one that is not
if (k.trust() > TRUST_EXPIRED)
return _describe_key_strength(k.algorithm(), k.size(), k.curve());
if (enc == Q_NULLPTR)
if (enc == nullptr)
enc = &k;
}
}
if (enc != Q_NULLPTR)
if (enc != nullptr)
return _describe_key_strength(enc->algorithm(), enc->size(), enc->curve());
return QString("");
}
......
......@@ -49,5 +49,5 @@ KgpgDetailedInfo::KgpgDetailedInfo(QWidget *parent, const QString &boxLabel, con
connect(buttonBox, &QDialogButtonBox::rejected, this, &KgpgDetailedInfo::reject);
okButton->setDefault(true);
setModal(true);
KMessageBox::createKMessageBox(this, buttonBox, QMessageBox::Information, boxLabel, keysList, QString(), Q_NULLPTR, 0, errormessage);
KMessageBox::createKMessageBox(this, buttonBox, QMessageBox::Information, boxLabel, keysList, QString(), nullptr, 0, errormessage);
}
......@@ -23,7 +23,7 @@
class KgpgDetailedInfo : public QDialog
{
public:
explicit KgpgDetailedInfo(QWidget *parent = Q_NULLPTR, const QString &boxLabel = QString(),
explicit KgpgDetailedInfo(QWidget *parent = nullptr, const QString &boxLabel = QString(),
const QString &errormessage = QString(), const QStringList &keysList = QStringList(),
const QString &caption = QString());
};
......
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