Commit 7063bba5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use nullptr. Initialize variables. Don't use 0 for QString()

parent 76f9fb05
......@@ -33,9 +33,7 @@
#include <Plasma/PluginLoader>
PlasmaWindowedCorona::PlasmaWindowedCorona(QObject *parent)
: Plasma::Corona(parent),
m_containment(0),
m_hasStatusNotifier(false)
: Plasma::Corona(parent)
{
KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/Shell"));
package.setPath(QStringLiteral("org.kde.plasma.desktop"));
......
......@@ -29,7 +29,7 @@ class PlasmaWindowedCorona : public Plasma::Corona
Q_OBJECT
public:
explicit PlasmaWindowedCorona(QObject * parent = 0);
explicit PlasmaWindowedCorona(QObject * parent = nullptr);
QRect screenGeometry(int id) const override;
void setHasStatusNotifier(bool stay);
......@@ -40,8 +40,8 @@ public Q_SLOTS:
void activateRequested(const QStringList &arguments, const QString &workingDirectory);
private:
Plasma::Containment *m_containment;
bool m_hasStatusNotifier;
Plasma::Containment *m_containment = nullptr;
bool m_hasStatusNotifier = false;
};
#endif
......@@ -34,7 +34,7 @@ class PlasmaWindowedView : public QQuickView
Q_OBJECT
public:
PlasmaWindowedView(QWindow *parent = 0);
explicit PlasmaWindowedView(QWindow *parent = nullptr);
~PlasmaWindowedView() override;
void setApplet(Plasma::Applet *applet);
......
......@@ -33,10 +33,10 @@ class HolidaysEventsPlugin : public CalendarEvents::CalendarEventsPlugin
Q_INTERFACES(CalendarEvents::CalendarEventsPlugin)
public:
HolidaysEventsPlugin(QObject *parent = 0);
explicit HolidaysEventsPlugin(QObject *parent = nullptr);
~HolidaysEventsPlugin();
virtual void loadEventsForDateRange(const QDate &startDate, const QDate &endDate) Q_DECL_OVERRIDE;
void loadEventsForDateRange(const QDate &startDate, const QDate &endDate) Q_DECL_OVERRIDE;
private:
QDate m_lastStartDate;
......
......@@ -31,7 +31,7 @@ class QmlConfigHelper : public QObject
Q_PROPERTY(QStringList selectedRegions READ selectedRegions NOTIFY selectedRegionsChanged)
public:
QmlConfigHelper(QObject *parent = 0) : QObject(parent)
explicit QmlConfigHelper(QObject *parent = nullptr) : QObject(parent)
{
KSharedConfig::Ptr config = KSharedConfig::openConfig("plasma_calendar_holiday_regions");
m_configGroup = config->group("General");
......
......@@ -26,8 +26,8 @@ K_EXPORT_PLASMA_RUNNER(activities, ActivityRunner)
ActivityRunner::ActivityRunner(QObject *parent, const QVariantList &args)
: Plasma::AbstractRunner(parent, args),
m_activities(0),
m_consumer(0),
m_activities(nullptr),
m_consumer(nullptr),
m_keywordi18n(i18nc("KRunner keyword", "activity")),
m_keyword(QStringLiteral("activity")),
m_enabled(false)
......@@ -58,7 +58,7 @@ void ActivityRunner::prep()
void ActivityRunner::down()
{
delete m_activities;
m_activities = 0;
m_activities = nullptr;
}
void ActivityRunner::serviceStatusChanged(KActivities::Consumer::ServiceStatus status)
......
......@@ -36,7 +36,7 @@ class SearchRunner : public QObject, protected QDBusContext
Q_OBJECT
public:
SearchRunner(QObject* parent=0);
explicit SearchRunner(QObject* parent=nullptr);
~SearchRunner() override;
RemoteActions Actions();
......@@ -50,7 +50,7 @@ private:
QDBusMessage m_lastRequest;
QString m_searchTerm;
QTimer *m_timer;
QTimer *m_timer = nullptr;
};
#endif // _BALOO_SEARCH_RUNNER_H_
......@@ -74,8 +74,8 @@ inline const QDBusArgument &operator>>(const QDBusArgument &argument, RemoteActi
return argument;
}
Q_DECLARE_METATYPE(RemoteMatch);
Q_DECLARE_METATYPE(RemoteMatches);
Q_DECLARE_METATYPE(RemoteAction);
Q_DECLARE_METATYPE(RemoteActions);
Q_DECLARE_METATYPE(RemoteMatch)
Q_DECLARE_METATYPE(RemoteMatches)
Q_DECLARE_METATYPE(RemoteAction)
Q_DECLARE_METATYPE(RemoteActions)
......@@ -41,7 +41,7 @@ K_EXPORT_PLASMA_RUNNER(bookmarksrunner, BookmarksRunner)
BookmarksRunner::BookmarksRunner( QObject* parent, const QVariantList &args )
: Plasma::AbstractRunner(parent, args), m_browser(0), m_browserFactory(new BrowserFactory(this))
: Plasma::AbstractRunner(parent, args), m_browser(nullptr), m_browserFactory(new BrowserFactory(this))
{
Q_UNUSED(args)
//qDebug() << "Creating BookmarksRunner";
......
......@@ -29,7 +29,7 @@
Browser *BrowserFactory::find(const QString& browserName, QObject* parent)
{
if(m_previousBrowserName == browserName) {
return m_previousBrowser;
return m_previousBrowser;
}
delete m_previousBrowser;
m_previousBrowserName = browserName;
......@@ -50,7 +50,7 @@ Browser *BrowserFactory::find(const QString& browserName, QObject* parent)
BrowserFactory::BrowserFactory(QObject *parent)
: QObject(parent), m_previousBrowser(0), m_previousBrowserName(QStringLiteral("invalid"))
: QObject(parent), m_previousBrowser(nullptr), m_previousBrowserName(QStringLiteral("invalid"))
{
}
......@@ -28,8 +28,8 @@ class BrowserFactory : public QObject
{
Q_OBJECT
public:
BrowserFactory(QObject *parent =0);
Browser *find(const QString &browserName, QObject *parent = 0);
explicit BrowserFactory(QObject *parent = nullptr);
Browser *find(const QString &browserName, QObject *parent = nullptr);
private:
Browser *m_previousBrowser;
QString m_previousBrowserName;
......
......@@ -96,7 +96,7 @@ void Chrome::prepare()
QFile bookmarksFile(profile.path());
if (!bookmarksFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
continue;
};
}
QJsonDocument jdoc = QJsonDocument::fromJson(bookmarksFile.readAll());
if (jdoc.isNull()) {
continue;
......
......@@ -37,7 +37,7 @@ class Chrome : public QObject, public Browser
{
Q_OBJECT
public:
Chrome(FindProfile *findProfile, QObject* parent = 0);
Chrome(FindProfile *findProfile, QObject* parent = nullptr);
~Chrome() override;
QList<BookmarkMatch> match(const QString &term, bool addEveryThing) override;
public Q_SLOTS:
......@@ -47,7 +47,7 @@ private:
void parseFolder(const QVariantMap &entry, ProfileBookmarks *profile);
virtual QList<BookmarkMatch> match(const QString &term, bool addEveryThing, ProfileBookmarks *profileBookmarks);
QList<ProfileBookmarks*> m_profileBookmarks;
KDirWatch* m_watcher;
KDirWatch* m_watcher = nullptr;
bool m_dirty;
};
......
......@@ -30,11 +30,11 @@ class FindChromeProfile : public QObject, public FindProfile
{
public:
explicit FindChromeProfile (const QString& applicationName, const QString &homeDirectory = QDir::homePath(), QObject* parent = 0 );
explicit FindChromeProfile (const QString& applicationName, const QString &homeDirectory = QDir::homePath(), QObject* parent = nullptr );
QList<Profile> find() override;
private:
QString const m_applicationName;
QString const m_homeDirectory;
QString const m_applicationName;
QString const m_homeDirectory;
};
#endif // CHROMEFINDPROFILE_H
......@@ -34,7 +34,7 @@
Firefox::Firefox(QObject *parent) :
QObject(parent),
m_favicon(new FallbackFavicon(this)),
m_fetchsqlite(0)
m_fetchsqlite(nullptr)
{
reloadConfiguration();
//qDebug() << "Loading Firefox Bookmarks Browser";
......@@ -62,7 +62,7 @@ void Firefox::prepare()
m_fetchsqlite->prepare();
delete m_favicon;
m_favicon = 0;
m_favicon = nullptr;
m_favicon = FaviconFromBlob::firefox(m_fetchsqlite, this);
}
......@@ -113,7 +113,7 @@ void Firefox::teardown()
if(m_fetchsqlite) {
m_fetchsqlite->teardown();
delete m_favicon;
m_favicon = 0;
m_favicon = nullptr;
}
}
......
......@@ -31,7 +31,7 @@ class Firefox : public QObject, public Browser
{
Q_OBJECT
public:
explicit Firefox(QObject *parent = 0);
explicit Firefox(QObject *parent = nullptr);
~Firefox() override;
QList<BookmarkMatch> match(const QString& term, bool addEverything) override;
public Q_SLOTS:
......
......@@ -29,7 +29,7 @@ class Favicon;
class KDEFavicon : public Favicon {
Q_OBJECT
public:
KDEFavicon(QObject *parent = 0);
explicit KDEFavicon(QObject *parent = nullptr);
QIcon iconFor(const QString &url) override;
};
......@@ -38,7 +38,7 @@ class KDEBrowser : public QObject, public Browser
{
Q_OBJECT
public:
explicit KDEBrowser(QObject *parent = 0);
explicit KDEBrowser(QObject *parent = nullptr);
QList<BookmarkMatch> match(const QString& term, bool addEverything) override;
public Q_SLOTS:
......
......@@ -29,7 +29,7 @@ class Favicon : public QObject
{
Q_OBJECT
public:
explicit Favicon(QObject *parent = 0);
explicit Favicon(QObject *parent = nullptr);
virtual QIcon iconFor(const QString &url) = 0;
protected:
......@@ -47,7 +47,7 @@ public Q_SLOTS:
class FallbackFavicon : public Favicon {
Q_OBJECT
public:
FallbackFavicon(QObject *parent = 0) : Favicon(parent) {}
FallbackFavicon(QObject *parent = nullptr) : Favicon(parent) {}
QIcon iconFor(const QString &) override { return defaultIcon(); }
};
......
......@@ -36,7 +36,7 @@ K_EXPORT_PLASMA_RUNNER(kill, KillRunner)
KillRunner::KillRunner(QObject *parent, const QVariantList& args)
: Plasma::AbstractRunner(parent, args),
m_processes(0)
m_processes(nullptr)
{
Q_UNUSED(args);
setObjectName( QLatin1String("Kill Runner") );
......@@ -83,7 +83,7 @@ void KillRunner::cleanup()
if (m_prepLock.tryLockForWrite()) {
delete m_processes;
m_processes = 0;
m_processes = nullptr;
m_prepLock.unlock();
} else {
......
......@@ -91,4 +91,4 @@ void KillRunnerConfig::defaults()
emit changed(true);
}
#include "killrunner_config.moc"
\ No newline at end of file
#include "killrunner_config.moc"
Supports Markdown
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