Commit 7c51dc11 authored by Laurent Montel's avatar Laurent Montel 😁

Use c++11 style

parent bd05e300
......@@ -29,21 +29,6 @@
#include <KPluginFactory>
using namespace MessageComposer;
class PluginEditorManagerInstancePrivate
{
public:
PluginEditorManagerInstancePrivate()
: pluginManager(new PluginEditorManager)
{
}
~PluginEditorManagerInstancePrivate()
{
delete pluginManager;
}
PluginEditorManager *pluginManager;
};
class PluginEditorInfo
{
public:
......@@ -62,8 +47,6 @@ public:
bool isEnabled;
};
Q_GLOBAL_STATIC(PluginEditorManagerInstancePrivate, sInstance)
namespace
{
QString pluginVersion()
......@@ -204,7 +187,8 @@ PluginEditorManager::~PluginEditorManager()
PluginEditorManager *PluginEditorManager::self()
{
return sInstance->pluginManager;
static PluginEditorManager s_self;
return &s_self;
}
QVector<PluginEditor *> PluginEditorManager::pluginsList() const
......
......@@ -28,21 +28,6 @@
using namespace MessageComposer;
class PluginEditorCheckBeforeSendManagerInstancePrivate
{
public:
PluginEditorCheckBeforeSendManagerInstancePrivate()
: pluginManager(new PluginEditorCheckBeforeSendManager)
{
}
~PluginEditorCheckBeforeSendManagerInstancePrivate()
{
delete pluginManager;
}
PluginEditorCheckBeforeSendManager *pluginManager;
};
class PluginEditorCheckBeforeSendInfo
{
public:
......@@ -59,8 +44,6 @@ public:
bool isEnabled;
};
Q_GLOBAL_STATIC(PluginEditorCheckBeforeSendManagerInstancePrivate, sInstance)
namespace
{
QString pluginVersion()
......@@ -193,7 +176,8 @@ PluginEditorCheckBeforeSendManager::~PluginEditorCheckBeforeSendManager()
PluginEditorCheckBeforeSendManager *PluginEditorCheckBeforeSendManager::self()
{
return sInstance->pluginManager;
static PluginEditorCheckBeforeSendManager s_self;
return &s_self;
}
QVector<PluginEditorCheckBeforeSend *> PluginEditorCheckBeforeSendManager::pluginsList() const
......
......@@ -28,21 +28,7 @@
using namespace MessageComposer;
class PluginEditorInitManagerInstancePrivate
{
public:
PluginEditorInitManagerInstancePrivate()
: pluginManager(new PluginEditorInitManager)
{
}
~PluginEditorInitManagerInstancePrivate()
{
delete pluginManager;
}
PluginEditorInitManager *pluginManager;
};
class PluginEditorInitInfo
{
......@@ -60,8 +46,6 @@ public:
bool isEnabled;
};
Q_GLOBAL_STATIC(PluginEditorInitManagerInstancePrivate, sInstance)
namespace {
QString pluginVersion()
{
......@@ -194,7 +178,8 @@ PluginEditorInitManager::~PluginEditorInitManager()
PluginEditorInitManager *PluginEditorInitManager::self()
{
return sInstance->pluginManager;
static PluginEditorInitManager s_self;
return &s_self;
}
QVector<PluginEditorInit *> PluginEditorInitManager::pluginsList() const
......
......@@ -23,19 +23,6 @@
using namespace MessageComposer;
class RecipientsEditorManagerPrivate
{
public:
RecipientsEditorManagerPrivate()
: manager(new RecipientsEditorManager)
{
}
RecipientsEditorManager *manager;
};
Q_GLOBAL_STATIC(RecipientsEditorManagerPrivate, sInstance)
RecipientsEditorManager::RecipientsEditorManager(QObject *parent)
: QObject(parent),
mModel(nullptr)
......@@ -49,7 +36,8 @@ RecipientsEditorManager::~RecipientsEditorManager()
RecipientsEditorManager *RecipientsEditorManager::self()
{
return sInstance->manager;
static RecipientsEditorManager s_self;
return &s_self;
}
Akonadi::EmailAddressSelectionModel *RecipientsEditorManager::model()
......
......@@ -38,21 +38,10 @@
using namespace MessageViewer;
class MessageViewer::AntiSpamConfigSingletonProvider
{
public:
AntiSpamConfig instance;
};
Q_GLOBAL_STATIC(MessageViewer::AntiSpamConfigSingletonProvider, theAntiSpamConfigSingletonProvider)
AntiSpamConfig *AntiSpamConfig::instance()
{
// better safe than sorry; check whether the global static has already been destroyed
if (theAntiSpamConfigSingletonProvider.isDestroyed()) {
return nullptr;
}
return &theAntiSpamConfigSingletonProvider->instance;
static AntiSpamConfig s_self;
return &s_self;
}
const SpamAgents AntiSpamConfig::agents() const
......
......@@ -28,24 +28,6 @@
using namespace MessageViewer;
class HeaderStylePluginManagerInstancePrivate
{
public:
HeaderStylePluginManagerInstancePrivate()
: headerStylePluginManager(new HeaderStylePluginManager)
{
}
~HeaderStylePluginManagerInstancePrivate()
{
delete headerStylePluginManager;
}
HeaderStylePluginManager *headerStylePluginManager;
};
Q_GLOBAL_STATIC(HeaderStylePluginManagerInstancePrivate, sInstance)
class HeaderStylePluginInfo
{
public:
......@@ -211,7 +193,8 @@ MessageViewer::HeaderStylePlugin *HeaderStylePluginManagerPrivate::pluginFromIde
HeaderStylePluginManager *HeaderStylePluginManager::self()
{
return sInstance->headerStylePluginManager;
static HeaderStylePluginManager s_self;
return &s_self;
}
HeaderStylePluginManager::HeaderStylePluginManager(QObject *parent)
......
......@@ -19,24 +19,6 @@
using namespace MessageViewer;
class WebEngineEmbedPartInstancePrivate
{
public:
WebEngineEmbedPartInstancePrivate()
: webEngineEmbedPart(new WebEngineEmbedPart)
{
}
~WebEngineEmbedPartInstancePrivate()
{
delete webEngineEmbedPart;
}
WebEngineEmbedPart *webEngineEmbedPart;
};
Q_GLOBAL_STATIC(WebEngineEmbedPartInstancePrivate, sInstance)
WebEngineEmbedPart::WebEngineEmbedPart(QObject *parent)
: QObject(parent)
{
......@@ -48,7 +30,8 @@ WebEngineEmbedPart::~WebEngineEmbedPart()
WebEngineEmbedPart *WebEngineEmbedPart::self()
{
return sInstance->webEngineEmbedPart;
static WebEngineEmbedPart s_self;
return &s_self;
}
QString WebEngineEmbedPart::contentUrl(const QString &contentId) const
......
......@@ -60,24 +60,6 @@ inline QVariant TypeAccessor<const QGpgME::Protocol *>::lookUp(const QGpgME::Pro
using namespace MessageViewer;
class MessagePartRendererManagerInstancePrivate
{
public:
MessagePartRendererManagerInstancePrivate()
: manager(new MessagePartRendererManager)
{
}
~MessagePartRendererManagerInstancePrivate()
{
delete manager;
}
MessagePartRendererManager *manager;
};
Q_GLOBAL_STATIC(MessagePartRendererManagerInstancePrivate, sInstance)
MessagePartRendererManager::MessagePartRendererManager(QObject *parent)
: QObject(parent)
, m_engine(nullptr)
......@@ -90,9 +72,10 @@ MessagePartRendererManager::~MessagePartRendererManager()
delete m_engine;
}
MessageViewer::MessagePartRendererManager *MessagePartRendererManager::self()
MessagePartRendererManager *MessagePartRendererManager::self()
{
return sInstance->manager;
static MessagePartRendererManager s_self;
return &s_self;
}
void MessagePartRendererManager::initializeRenderer()
......
......@@ -23,24 +23,6 @@
using namespace MessageViewer;
class ScamCheckShortUrlManagerInstancePrivate
{
public:
ScamCheckShortUrlManagerInstancePrivate()
: scamCheckShortUrlManager(new ScamCheckShortUrlManager)
{
}
~ScamCheckShortUrlManagerInstancePrivate()
{
delete scamCheckShortUrlManager;
}
ScamCheckShortUrlManager *scamCheckShortUrlManager;
};
Q_GLOBAL_STATIC(ScamCheckShortUrlManagerInstancePrivate, sInstance)
class MessageViewer::ScamCheckShortUrlManagerPrivate
{
public:
......@@ -66,7 +48,8 @@ ScamCheckShortUrlManager::~ScamCheckShortUrlManager()
ScamCheckShortUrlManager *ScamCheckShortUrlManager::self()
{
return sInstance->scamCheckShortUrlManager;
static ScamCheckShortUrlManager s_self;
return &s_self;
}
ScamCheckShortUrl *ScamCheckShortUrlManager::scamCheckShortUrl() const
......
......@@ -31,24 +31,6 @@
using namespace MessageViewer;
class ViewerPluginManagerPrivateInstancePrivate
{
public:
ViewerPluginManagerPrivateInstancePrivate()
: viewerPluginManager(new ViewerPluginManager)
{
}
~ViewerPluginManagerPrivateInstancePrivate()
{
delete viewerPluginManager;
}
ViewerPluginManager *viewerPluginManager;
};
Q_GLOBAL_STATIC(ViewerPluginManagerPrivateInstancePrivate, sInstance)
class ViewerPluginInfo
{
public:
......@@ -228,7 +210,8 @@ bool ViewerPluginManager::initializePluginList()
ViewerPluginManager *ViewerPluginManager::self()
{
return sInstance->viewerPluginManager;
static ViewerPluginManager s_self;
return &s_self;
}
QVector<MessageViewer::ViewerPlugin *> ViewerPluginManager::pluginsList() const
......
......@@ -26,8 +26,6 @@
using namespace WebEngineViewer;
Q_GLOBAL_STATIC(CheckPhishingUrlCache, s_checkPhishingUrlCache)
struct UrlCacheInfo {
UrlCacheInfo()
: status(CheckPhishingUrlCache::Unknown),
......@@ -176,6 +174,7 @@ void CheckPhishingUrlCache::clearCache()
CheckPhishingUrlCache *CheckPhishingUrlCache::self()
{
return s_checkPhishingUrlCache;
static CheckPhishingUrlCache s_self;
return &s_self;
}
......@@ -25,8 +25,6 @@
using namespace WebEngineViewer;
Q_GLOBAL_STATIC(HashCacheManager, s_hashCacheManager)
struct HashCacheInfo {
HashCacheInfo()
: status(HashCacheManager::Unknown),
......@@ -187,7 +185,8 @@ void HashCacheManagerPrivate::addHashStatus(const QByteArray &hash, HashCacheMan
HashCacheManager *HashCacheManager::self()
{
return s_hashCacheManager;
static HashCacheManager s_self;
return &s_self;
}
HashCacheManager::HashCacheManager(QObject *parent)
......
......@@ -30,24 +30,6 @@
using namespace WebEngineViewer;
class MailNetworkUrlInterceptorPluginManagerInstancePrivate
{
public:
MailNetworkUrlInterceptorPluginManagerInstancePrivate()
: mailNetworkUrlInterceptorPluginManager(new NetworkUrlInterceptorPluginManager)
{
}
~MailNetworkUrlInterceptorPluginManagerInstancePrivate()
{
delete mailNetworkUrlInterceptorPluginManager;
}
NetworkUrlInterceptorPluginManager *mailNetworkUrlInterceptorPluginManager;
};
Q_GLOBAL_STATIC(MailNetworkUrlInterceptorPluginManagerInstancePrivate, sInstance)
class MailNetworkUrlInterceptorPluginInfo
{
public:
......@@ -187,7 +169,8 @@ WebEngineViewer::NetworkPluginUrlInterceptor *NetworkUrlInterceptorPluginManager
NetworkUrlInterceptorPluginManager *NetworkUrlInterceptorPluginManager::self()
{
return sInstance->mailNetworkUrlInterceptorPluginManager;
static NetworkUrlInterceptorPluginManager s_self;
return &s_self;
}
NetworkUrlInterceptorPluginManager::NetworkUrlInterceptorPluginManager(QObject *parent)
......
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