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

Use std::unique_ptr

parent 449d14b9
Pipeline #87396 passed with stage
in 4 minutes and 10 seconds
......@@ -32,15 +32,15 @@ const char kDisableInProcessStackTraces[] = "--disable-in-process-stack-traces";
}
//@cond PRIVATE
class Q_DECL_HIDDEN KontactInterface::PimUniqueApplication::Private
class Q_DECL_HIDDEN KontactInterface::PimUniqueApplication::PimUniqueApplicationPrivate
{
public:
Private()
PimUniqueApplicationPrivate()
: cmdArgs(new QCommandLineParser())
{
}
~Private()
~PimUniqueApplicationPrivate()
{
delete cmdArgs;
}
......@@ -60,14 +60,11 @@ public:
PimUniqueApplication::PimUniqueApplication(int &argc, char **argv[])
: QApplication(argc, *argv)
, d(new Private())
, d(new PimUniqueApplicationPrivate())
{
}
PimUniqueApplication::~PimUniqueApplication()
{
delete d;
}
PimUniqueApplication::~PimUniqueApplication() = default;
QCommandLineParser *PimUniqueApplication::cmdArgs() const
{
......@@ -139,7 +136,7 @@ bool PimUniqueApplication::start(const QStringList &arguments)
QDBusConnection::sessionBus().registerService(serviceName);
// Make sure we have DrKonqi
Private::disableChromiumCrashHandler();
PimUniqueApplicationPrivate::disableChromiumCrashHandler();
static_cast<PimUniqueApplication *>(qApp)->activate(arguments, QDir::currentPath());
return true;
......
......@@ -9,6 +9,7 @@
#include "kontactinterface_export.h"
#include <QApplication>
#include <memory>
class KAboutData;
class QCommandLineParser;
......@@ -56,8 +57,8 @@ protected:
private:
//@cond PRIVATE
class Private;
Private *const d;
class PimUniqueApplicationPrivate;
std::unique_ptr<PimUniqueApplicationPrivate> const d;
//@endcond
};
......
......@@ -27,11 +27,11 @@
using namespace KontactInterface;
/**
Private class that helps to provide binary compatibility between releases.
PluginPrivate class that helps to provide binary compatibility between releases.
@internal
*/
//@cond PRIVATE
class Q_DECL_HIDDEN Plugin::Private
class Q_DECL_HIDDEN Plugin::PluginPrivate
{
public:
void partDestroyed();
......@@ -57,7 +57,7 @@ public:
Plugin::Plugin(Core *core, QObject *parent, const char *appName, const char *pluginName)
: KXMLGUIClient(core)
, QObject(parent)
, d(new Private)
, d(new PluginPrivate)
{
setObjectName(QLatin1String(appName));
core->factory()->addClient(this);
......@@ -72,7 +72,6 @@ Plugin::Plugin(Core *core, QObject *parent, const char *appName, const char *plu
Plugin::~Plugin()
{
delete d->part;
delete d;
}
void Plugin::setIdentifier(const QString &identifier)
......@@ -234,12 +233,12 @@ void Plugin::configUpdated()
}
//@cond PRIVATE
void Plugin::Private::partDestroyed()
void Plugin::PluginPrivate::partDestroyed()
{
part = nullptr;
}
void Plugin::Private::removeInvisibleToolbarActions(Plugin *plugin)
void Plugin::PluginPrivate::removeInvisibleToolbarActions(Plugin *plugin)
{
if (pluginName.isEmpty()) {
return;
......@@ -294,7 +293,7 @@ void Plugin::Private::removeInvisibleToolbarActions(Plugin *plugin)
setXmlFiles();
}
void Plugin::Private::setXmlFiles()
void Plugin::PluginPrivate::setXmlFiles()
{
if (pluginName.isEmpty()) {
return;
......
......@@ -321,8 +321,8 @@ protected:
private:
//@cond PRIVATE
class Private;
Private *const d;
class PluginPrivate;
std::unique_ptr<PluginPrivate> const d;
//@endcond
};
......
......@@ -41,7 +41,7 @@ public:
//@endcond
//@cond PRIVATE
class Q_DECL_HIDDEN Summary::Private
class Q_DECL_HIDDEN Summary::SummaryPrivate
{
public:
QPoint mDragStartPoint;
......@@ -50,16 +50,13 @@ public:
Summary::Summary(QWidget *parent)
: QWidget(parent)
, d(new Private)
, d(new SummaryPrivate)
{
setFont(QFontDatabase::systemFont(QFontDatabase::GeneralFont));
setAcceptDrops(true);
}
Summary::~Summary()
{
delete d;
}
Summary::~Summary() = default;
int Summary::summaryHeight() const
{
......
......@@ -100,8 +100,8 @@ protected:
private:
//@cond PRIVATE
class Private;
Private *const d;
class SummaryPrivate;
std::unique_ptr<SummaryPrivate> const d;
//@endcond
};
......
......@@ -65,7 +65,7 @@
using namespace KontactInterface;
//@cond PRIVATE
class UniqueAppHandler::Private
class UniqueAppHandler::UniqueAppHandlerPrivate
{
public:
Plugin *mPlugin;
......@@ -74,7 +74,7 @@ public:
UniqueAppHandler::UniqueAppHandler(Plugin *plugin)
: QObject(plugin)
, d(new Private)
, d(new UniqueAppHandlerPrivate)
{
qCDebug(KONTACTINTERFACE_LOG) << "plugin->objectName():" << plugin->objectName();
......@@ -91,7 +91,6 @@ UniqueAppHandler::~UniqueAppHandler()
QDBusConnection session = QDBusConnection::sessionBus();
const QString appName = parent()->objectName();
session.unregisterService(QLatin1String("org.kde.") + appName);
delete d;
}
// DBUS call
......@@ -141,7 +140,7 @@ bool KontactInterface::UniqueAppHandler::load()
}
//@cond PRIVATE
class Q_DECL_HIDDEN UniqueAppWatcher::Private
class Q_DECL_HIDDEN UniqueAppWatcher::UniqueAppWatcherPrivate
{
public:
UniqueAppHandlerFactoryBase *mFactory = nullptr;
......@@ -152,7 +151,7 @@ public:
UniqueAppWatcher::UniqueAppWatcher(UniqueAppHandlerFactoryBase *factory, Plugin *plugin)
: QObject(plugin)
, d(new Private)
, d(new UniqueAppWatcherPrivate)
{
d->mFactory = factory;
d->mPlugin = plugin;
......@@ -200,7 +199,6 @@ UniqueAppWatcher::UniqueAppWatcher(UniqueAppHandlerFactoryBase *factory, Plugin
UniqueAppWatcher::~UniqueAppWatcher()
{
delete d->mFactory;
delete d;
}
bool UniqueAppWatcher::isRunningStandalone() const
......
......@@ -10,7 +10,7 @@
#include "kontactinterface_export.h"
#include "plugin.h"
#include <memory>
class QCommandLineParser;
namespace KontactInterface
......@@ -57,8 +57,8 @@ protected:
virtual int activate(const QStringList &args, const QString &workingDirectory);
private:
class Private;
Private *const d;
class UniqueAppHandlerPrivate;
std::unique_ptr<UniqueAppHandlerPrivate> const d;
};
/// Base class for UniqueAppHandler
......@@ -118,8 +118,8 @@ private Q_SLOTS:
void slotApplicationRemoved(const QString &name, const QString &oldOwner, const QString &newOwner);
private:
class Private;
Private *const d;
class UniqueAppWatcherPrivate;
std::unique_ptr<UniqueAppWatcherPrivate> const d;
};
} // namespace
......
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