Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b368bd1b authored by Kevin Funk's avatar Kevin Funk

clang-tidy: use-modernize-nullptr run

parent 52bf6bec
......@@ -255,7 +255,7 @@ bool ComputerModel::trigger(int row, const QString &actionId, const QVariant &ar
const QUrl &url = m_filteredPlacesModel->url(sourceIndex);
if (url.isValid()) {
new KRun(url, 0);
new KRun(url, nullptr);
return true;
}
......@@ -297,5 +297,5 @@ void ComputerModel::onSetupDone(Solid::ErrorType error, QVariant errorData, cons
Q_ASSERT(access);
new KRun(QUrl::fromLocalFile(access->filePath()), 0);
new KRun(QUrl::fromLocalFile(access->filePath()), nullptr);
}
......@@ -108,7 +108,7 @@ bool FileEntry::run(const QString& actionId, const QVariant &argument)
}
if (actionId.isEmpty()) {
new KRun(m_fileItem->url(), 0);
new KRun(m_fileItem->url(), nullptr);
return true;
} else {
......
......@@ -159,13 +159,13 @@ QString ForwardingModel::labelForRow(int row)
AbstractModel* ForwardingModel::modelForRow(int row)
{
if (!m_sourceModel) {
return 0;
return nullptr;
}
AbstractModel *abstractModel = qobject_cast<AbstractModel *>(m_sourceModel);
if (!abstractModel) {
return 0;
return nullptr;
}
return abstractModel->modelForRow(row);
......@@ -261,5 +261,5 @@ void ForwardingModel::disconnectSignals()
return;
}
disconnect(m_sourceModel, 0, this, 0);
disconnect(m_sourceModel, nullptr, this, nullptr);
}
......@@ -51,7 +51,7 @@ void MenuEntryEditor::edit(const QString& entryPath, const QString& menuId)
const QString &fileName = entryUrl.fileName();
if (appsDir.exists(fileName)) {
KPropertiesDialog::showDialog(entryUrl, 0, false);
KPropertiesDialog::showDialog(entryUrl, nullptr, false);
} else {
if (!appsDir.exists()) {
if (!QDir::root().mkpath(appsPath)) {
......
......@@ -228,7 +228,7 @@ AbstractModel* PlaceholderModel::modelForRow(int row)
return abstractModel->modelForRow(rowToSourceRow(row));
} else {
return 0;
return nullptr;
}
}
......@@ -361,7 +361,7 @@ void PlaceholderModel::disconnectSignals()
return;
}
disconnect(m_sourceModel, 0, this, 0);
disconnect(m_sourceModel, nullptr, this, nullptr);
}
int PlaceholderModel::dropPlaceholderIndex() const
......
......@@ -182,10 +182,10 @@ App::App(int &argc, char* argv[]): QGuiApplication(argc, argv)
,m_eventFilter(new XcbEventFilter)
,m_init(false)
,m_bus(ibus_bus_new ())
,m_impanel(0)
,m_impanel(nullptr)
,m_keyboardGrabbed(false)
,m_doGrab(false)
,m_syms(0)
,m_syms(nullptr)
,m_watcher(new QDBusServiceWatcher(this))
{
m_syms = xcb_key_symbols_alloc(QX11Info::connection());
......@@ -268,7 +268,7 @@ void App::keyRelease(const xcb_key_release_event_t* event)
release = true;
else {
auto cookie = xcb_get_modifier_mapping(QX11Info::connection());
auto reply = xcb_get_modifier_mapping_reply(QX11Info::connection(), cookie, NULL);
auto reply = xcb_get_modifier_mapping_reply(QX11Info::connection(), cookie, nullptr);
if (reply) {
auto keycodes = xcb_get_modifier_mapping_keycodes(reply);
for (int i = 0; i < reply->keycodes_per_modifier; i++) {
......@@ -308,7 +308,7 @@ void App::init()
"NameAcquired",
"/org/freedesktop/DBus",
IBUS_SERVICE_PANEL, G_DBUS_SIGNAL_FLAGS_NONE,
name_acquired_cb, this, NULL);
name_acquired_cb, this, nullptr);
g_dbus_connection_signal_subscribe (connection,
"org.freedesktop.DBus",
......@@ -316,7 +316,7 @@ void App::init()
"NameLost",
"/org/freedesktop/DBus",
IBUS_SERVICE_PANEL, G_DBUS_SIGNAL_FLAGS_NONE,
name_lost_cb, this, NULL);
name_lost_cb, this, nullptr);
ibus_bus_request_name (m_bus, IBUS_SERVICE_PANEL, IBUS_BUS_NAME_FLAG_ALLOW_REPLACEMENT | IBUS_BUS_NAME_FLAG_REPLACE_EXISTING);
m_init = true;
......@@ -338,7 +338,7 @@ void App::nameLost()
if (m_impanel) {
g_object_unref(m_impanel);
}
m_impanel = NULL;
m_impanel = nullptr;
}
QByteArray App::normalizeIconName(const QByteArray& icon) const
......@@ -418,7 +418,7 @@ bool App::grabXKeyboard() {
auto w = QX11Info::appRootWindow();
auto cookie = xcb_grab_keyboard(QX11Info::connection(), false, w, XCB_CURRENT_TIME,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
auto reply = xcb_grab_keyboard_reply(QX11Info::connection(), cookie, NULL);
auto reply = xcb_grab_keyboard_reply(QX11Info::connection(), cookie, nullptr);
if (reply && reply->status == XCB_GRAB_STATUS_SUCCESS) {
m_keyboardGrabbed = true;
......@@ -456,14 +456,14 @@ void App::clean()
{
if (m_impanel) {
g_object_unref(m_impanel);
m_impanel = 0;
m_impanel = nullptr;
}
if (m_bus) {
g_signal_handlers_disconnect_by_func(m_bus, (gpointer) ibus_disconnected_cb, this);
g_signal_handlers_disconnect_by_func(m_bus, (gpointer) ibus_connected_cb, this);
g_object_unref(m_bus);
m_bus = 0;
m_bus = nullptr;
}
ungrabKey();
}
......
......@@ -22,7 +22,7 @@
#define THRESHOLD 256
EngineManager::EngineManager() : m_engines(0), m_length(0)
EngineManager::EngineManager() : m_engines(nullptr), m_length(0)
{
}
......
......@@ -20,7 +20,7 @@
#include "propertymanager.h"
#include <QByteArray>
PropertyManager::PropertyManager() : m_props(0)
PropertyManager::PropertyManager() : m_props(nullptr)
{
}
......@@ -43,7 +43,7 @@ void PropertyManager::setProperties(IBusPropList* props)
IBusProperty* PropertyManager::property(const QByteArray& key)
{
if (!m_props)
return NULL;
return nullptr;
return searchList(key, m_props);
}
......@@ -51,7 +51,7 @@ IBusProperty* PropertyManager::property(const QByteArray& key)
IBusProperty* PropertyManager::searchList(const QByteArray& key, IBusPropList* props)
{
if (!props)
return NULL;
return nullptr;
int i = 0;
while (true) {
......@@ -67,7 +67,7 @@ IBusProperty* PropertyManager::searchList(const QByteArray& key, IBusPropList* p
}
i++;
}
return NULL;
return nullptr;
}
void PropertyManager::updateProperty(IBusProperty* prop)
......
......@@ -477,7 +477,7 @@ void PagerModel::moveWindow(int window, double x, double y, int targetItemId, in
dest = QPointF(qMax(dest.x(), qreal(0.0)), qMax(dest.y(), qreal(0.0)));
// Use _NET_MOVERESIZE_WINDOW rather than plain move, so that the WM knows this is a pager request.
NETRootInfo info(QX11Info::connection(), 0);
NETRootInfo info(QX11Info::connection(), nullptr);
const int flags = (0x20 << 12) | (0x03 << 8) | 1; // From tool, x/y, northwest gravity.
if (!KWindowSystem::mapViewport()) {
......@@ -591,7 +591,7 @@ void PagerModel::drop(QMimeData *mimeData, int itemId)
}
for (const auto &id : ids) {
QStringList activities = KWindowInfo(id, 0, NET::WM2Activities).activities();
QStringList activities = KWindowInfo(id, nullptr, NET::WM2Activities).activities();
if (!activities.contains(newActivity)) {
KWindowSystem::setOnActivities(id, activities << newActivity);
......
......@@ -65,7 +65,7 @@ void FolderModelTest::init()
void FolderModelTest::cleanup()
{
delete m_folderDir;
m_folderDir = 0;
m_folderDir = nullptr;
delete m_folderModel;
m_folderModel = nullptr;
}
......
......@@ -53,7 +53,7 @@ void LabelGenerator::setFolderModel(FolderModel *folderModel)
{
if (m_folderModel.data() != folderModel) {
if (m_folderModel.data()) {
disconnect(m_folderModel.data(), 0, this, 0);
disconnect(m_folderModel.data(), nullptr, this, nullptr);
}
m_folderModel = folderModel;
......
......@@ -443,7 +443,7 @@ void SortedActivitiesModel::onBackgroundsUpdated(const QStringList &activities)
void SortedActivitiesModel::onWindowAdded(WId window)
{
KWindowInfo info(window, 0, NET::WM2Activities);
KWindowInfo info(window, nullptr, NET::WM2Activities);
const QStringList activities = info.activities();
if (activities.isEmpty() || activities.contains("00000000-0000-0000-0000-000000000000")) return;
......
......@@ -982,9 +982,9 @@ void KAccessApp::noClicked()
void KAccessApp::dialogClosed()
{
if (dialog != 0)
if (dialog != nullptr)
dialog->deleteLater();
dialog = 0;
dialog = nullptr;
requestedFeatures = features;
}
......
......@@ -117,7 +117,7 @@ class VisualBell : public QWidget
public:
VisualBell(int pause)
: QWidget((QWidget*)0, Qt::X11BypassWindowManagerHint), _pause(pause)
: QWidget((QWidget*)nullptr, Qt::X11BypassWindowManagerHint), _pause(pause)
{}
......
......@@ -451,10 +451,10 @@ void Autostart::slotChangeStartup( ScriptStartItem* item, int index )
void Autostart::slotSelectionChanged()
{
const bool hasItems = ( dynamic_cast<AutoStartItem*>( widget->listCMD->currentItem() )!=0 ) ;
const bool hasItems = ( dynamic_cast<AutoStartItem*>( widget->listCMD->currentItem() )!=nullptr ) ;
widget->btnRemove->setEnabled(hasItems);
const bool isDesktopItem = (dynamic_cast<DesktopStartItem*>(widget->listCMD->currentItem() ) != 0) ;
const bool isDesktopItem = (dynamic_cast<DesktopStartItem*>(widget->listCMD->currentItem() ) != nullptr) ;
widget->btnProperties->setEnabled(isDesktopItem);
widget->btnAdvanced->setEnabled(isDesktopItem) ;
}
......
......@@ -71,7 +71,7 @@ const char* const s_defaultFileExcludeFilters[] = {
"*.elc", // Emacs Lisp
// end of list
0
nullptr
};
const int s_defaultFileExcludeFiltersVersion = 2;
......@@ -101,7 +101,7 @@ const char* const s_defaultFolderExcludeFilters[] = {
"lost+found",
// end of list
0
nullptr
};
const int s_defaultFolderExcludeFiltersVersion = 1;
......@@ -135,7 +135,7 @@ const char* const s_sourceCodeMimeTypes[] = {
"application/x-tex",
// end of list
0
nullptr
};
const int s_sourceCodeMimeTypesVersion = 1;
}
......
......@@ -273,7 +273,7 @@ void FolderSelectionWidget::slotRemoveButtonClicked()
void FolderSelectionWidget::slotCurrentItemChanged(QListWidgetItem* current, QListWidgetItem*)
{
m_removeButton->setEnabled(current != 0);
m_removeButton->setEnabled(current != nullptr);
}
void FolderSelectionWidget::showMessage(const QString& message)
......
......@@ -30,7 +30,7 @@ class FolderSelectionWidget : public QWidget
{
Q_OBJECT
public:
explicit FolderSelectionWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
explicit FolderSelectionWidget(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
void setDirectoryList(QStringList includeDirs, QStringList exclude);
QStringList includeFolders() const;
......
......@@ -88,7 +88,7 @@ void SchemeEditorColors::setupColorTable()
if (i > 8 && i < 18)
{
// Inactive Text row through Positive Text role all need a varies button
QPushButton * variesButton = new QPushButton(NULL);
QPushButton * variesButton = new QPushButton(nullptr);
variesButton->setText(i18n("Varies"));
variesButton->setObjectName(QString::number(i));
connect(variesButton, &QPushButton::clicked, this, &SchemeEditorColors::variesClicked);
......
......@@ -118,7 +118,7 @@ void CfgComponent::defaults()
ComponentChooser::ComponentChooser(QWidget *parent):
QWidget(parent), Ui::ComponentChooser_UI(), somethingChanged(false), configWidget(0)
QWidget(parent), Ui::ComponentChooser_UI(), somethingChanged(false), configWidget(nullptr)
{
setupUi(this);
static_cast<QGridLayout*>(layout())->setRowStretch(1, 1);
......@@ -156,7 +156,7 @@ void ComponentChooser::slotServiceSelected(QListWidgetItem* it) {
QString cfgType=cfg.group(QByteArray()).readEntry("configurationType");
QWidget *newConfigWidget = 0;
QWidget *newConfigWidget = nullptr;
if (cfgType.isEmpty() || (cfgType==QLatin1String("component")))
{
if (!(configWidget && qobject_cast<CfgComponent*>(configWidget)))
......
......@@ -66,7 +66,7 @@ class ComponentChooser : public QWidget, public Ui::ComponentChooser_UI
Q_OBJECT
public:
ComponentChooser(QWidget *parent=0);
ComponentChooser(QWidget *parent=nullptr);
~ComponentChooser() override;
void load();
void save();
......
......@@ -53,7 +53,7 @@ void CfgBrowser::configChanged()
void CfgBrowser::defaults()
{
load(0);
load(nullptr);
}
void CfgBrowser::load(KConfig *)
......@@ -63,12 +63,12 @@ void CfgBrowser::load(KConfig *)
if (exec.isEmpty()) {
radioKIO->setChecked(true);
m_browserExec = exec;
m_browserService = 0;
m_browserService = nullptr;
} else {
radioExec->setChecked(true);
if (exec.startsWith('!')) {
m_browserExec = exec.mid(1);
m_browserService = 0;
m_browserService = nullptr;
} else {
m_browserService = KService::serviceByStorageId( exec );
if (m_browserService) {
......
......@@ -57,7 +57,7 @@ CfgEmailClient::~CfgEmailClient() {
void CfgEmailClient::defaults()
{
load(0);
load(nullptr);
}
void CfgEmailClient::load(KConfig *)
......
......@@ -47,7 +47,7 @@ void CfgFileManager::configChanged()
void CfgFileManager::defaults()
{
load(0);
load(nullptr);
}
static KService::List appOffers()
......@@ -137,6 +137,6 @@ void CfgFileManager::slotAddFileManager()
proc << QStringLiteral("keditfiletype5");
proc << QStringLiteral("inode/directory");
if (proc.execute() == 0) {
load(0);
load(nullptr);
}
}
......@@ -57,7 +57,7 @@ void CfgTerminalEmulator::configChanged()
void CfgTerminalEmulator::defaults()
{
load(0);
load(nullptr);
}
......
......@@ -70,7 +70,7 @@ class KTimerDialog : public KDialog
*
* For the rest of the arguments, See @see KDialog .
*/
explicit KTimerDialog( int msec, TimerStyle style=CountDown, QWidget *parent=0,
explicit KTimerDialog( int msec, TimerStyle style=CountDown, QWidget *parent=nullptr,
const QString &caption=QString(),
int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
bool separator=false,
......
......@@ -350,7 +350,7 @@ bool CursorThemeConfig::applyTheme(const CursorTheme *theme, const int size)
void CursorThemeConfig::save()
{
const CursorTheme *theme = selectedIndex().isValid() ? m_proxyModel->theme(selectedIndex()) : NULL;
const CursorTheme *theme = selectedIndex().isValid() ? m_proxyModel->theme(selectedIndex()) : nullptr;
KConfig config("kcminputrc");
KConfigGroup c(&config, "Mouse");
......@@ -445,7 +445,7 @@ QModelIndex CursorThemeConfig::selectedIndex() const
void CursorThemeConfig::getNewClicked()
{
KNS3::DownloadDialog dialog("xcursor.knsrc", 0);
KNS3::DownloadDialog dialog("xcursor.knsrc", nullptr);
if (dialog.exec()) {
KNS3::Entry::List list = dialog.changedEntries();
if (list.count() > 0) {
......@@ -522,7 +522,7 @@ void CursorThemeConfig::installThemeFile(const QString &path)
QString question = i18n("A theme named %1 already exists in your icon "
"theme folder. Do you want replace it with this one?", dirName);
int answer = KMessageBox::warningContinueCancel(0, question,
int answer = KMessageBox::warningContinueCancel(nullptr, question,
i18n("Overwrite Theme?"),
KStandardGuiItem::overwrite());
......@@ -565,7 +565,7 @@ void CursorThemeConfig::removeTheme(int row)
// Don't let the user delete the currently configured theme
if (idx == m_appliedIndex) {
KMessageBox::sorry(0, i18n("<qt>You cannot delete the theme you are currently "
KMessageBox::sorry(nullptr, i18n("<qt>You cannot delete the theme you are currently "
"using.<br />You have to switch to another theme first.</qt>"));
return;
}
......@@ -576,7 +576,7 @@ void CursorThemeConfig::removeTheme(int row)
"This will delete all the files installed by this theme.</qt>",
theme->title());
int answer = KMessageBox::warningContinueCancel(0, question,
int answer = KMessageBox::warningContinueCancel(nullptr, question,
i18n("Confirmation"), KStandardGuiItem::del());
if (answer != KMessageBox::Continue) {
......
......@@ -127,7 +127,7 @@ PreviewWidget::PreviewWidget(QQuickItem *parent)
m_currentSize(0)
{
setAcceptHoverEvents(true);
current = NULL;
current = nullptr;
}
......@@ -250,7 +250,7 @@ void PreviewWidget::setTheme(const CursorTheme *theme, const int size)
updateImplicitSize();
}
current = NULL;
current = nullptr;
update();
}
......
......@@ -145,10 +145,10 @@ void CursorThemeModel::sort(int column, Qt::SortOrder order)
const CursorTheme *CursorThemeModel::theme(const QModelIndex &index)
{
if (!index.isValid())
return NULL;
return nullptr;
if (index.row() < 0 || index.row() >= list.count())
return NULL;
return nullptr;
return list.at(index.row());
}
......
......@@ -93,7 +93,7 @@ class Kclock : public QWidget
Q_OBJECT
public:
Kclock( QWidget *parent=0 );
Kclock( QWidget *parent=nullptr );
~Kclock() override;
void setTime(const QTime&);
......
......@@ -100,9 +100,9 @@ int ClockHelper::date( const QString& newdate, const QString& olddate )
{
struct timeval tv;
tv.tv_sec = newdate.toULong() - olddate.toULong() + time(0);
tv.tv_sec = newdate.toULong() - olddate.toULong() + time(nullptr);
tv.tv_usec = 0;
if (settimeofday(&tv, 0)) {
if (settimeofday(&tv, nullptr)) {
return DateError;
}
......
......@@ -105,7 +105,7 @@ bool KclockModule::kauthSave()
qDebug() << "Set date to " << dtime->userTime();
helperargs[QStringLiteral("date")] = true;
helperargs[QStringLiteral("newdate")] = QString::number(newTime.toTime_t());
helperargs[QStringLiteral("olddate")] = QString::number(::time(0));
helperargs[QStringLiteral("olddate")] = QString::number(::time(nullptr));
}
QString selectedTimeZone = dtime->selectedTimeZone();
......
......@@ -273,7 +273,7 @@ bool FontAASettings::save(KXftConfig::AntiAliasing::State aaState)
// TODO: With AASystem the changes already made by this module should be reverted somehow.
#if defined(HAVE_FONTCONFIG) && defined (HAVE_X11)
if (mod || (m_antiAliasing != m_antiAliasingOriginal) || m_dpi != m_dpiOriginal) {
KMessageBox::information(0,
KMessageBox::information(nullptr,
i18n(
"<p>Some changes such as anti-aliasing or DPI will only affect newly started applications.</p>"
), i18n("Font Settings Changed"), "FontSettingsChanged");
......@@ -669,7 +669,7 @@ QFont KFonts::windowTitleFont() const
void KFonts::adjustAllFonts()
{
QFont font = m_generalFont;
KFontChooser::FontDiffFlags fontDiffFlags = 0;
KFontChooser::FontDiffFlags fontDiffFlags = nullptr;
int ret = KFontDialog::getFontDiff(font, fontDiffFlags, KFontChooser::NoDisplayFlags);
if (ret == KDialog::Accepted && fontDiffFlags) {
......
......@@ -823,10 +823,10 @@ void KXftConfig::applyAntiAliasing()
bool KXftConfig::aliasingEnabled()
{
FcPattern *pattern = FcPatternCreate();
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
FcResult result;
FcPattern *f = FcFontMatch(0, pattern, &result);
FcPattern *f = FcFontMatch(nullptr, pattern, &result);
FcBool antialiased = FcTrue;
FcPatternGetBool(f, FC_ANTIALIAS, 0, &antialiased);
FcPatternDestroy(f);
......
......@@ -39,7 +39,7 @@
JoyDevice::JoyDevice(const QString &devicefile)
: devName(devicefile), joyFd(-1), buttons(0), axes(0),
amin(0), amax(0), corr(0), origCorr(0)
amin(nullptr), amax(nullptr), corr(nullptr), origCorr(nullptr)
{
}
......@@ -219,13 +219,13 @@ void JoyDevice::close()
delete [] amin;
delete [] amax;
amin = 0;
amax = 0;
amin = nullptr;
amax = nullptr;
delete [] corr;
corr = 0;
corr = nullptr;
delete [] origCorr;
origCorr = 0;
origCorr = nullptr;
}
//--------------------------------------------------------------
......@@ -341,7 +341,7 @@ bool JoyDevice::getEvent(JoyDevice::EventType &type, int &number, int &value)
timeout.tv_sec = 0;
timeout.tv_usec = 10000;
ret = ::select(joyFd + 1, &readSet, 0, 0, &timeout);
ret = ::select(joyFd + 1, &readSet, nullptr, nullptr, &timeout);
if ( ret == 1 ) // got an event from the joystick
{
......
......@@ -63,7 +63,7 @@ class TableWidget : public QTableWidget
//--------------------------------------------------------------
JoyWidget::JoyWidget(QWidget *parent)
: QWidget(parent), idle(0), joydev(0)
: QWidget(parent), idle(nullptr), joydev(nullptr)
{
QVBoxLayout *mainVbox = new QVBoxLayout(this);
mainVbox->setSpacing(KDialog::spacingHint());
......
......@@ -215,7 +215,7 @@ void KDEDConfig::load()
_lvStartup->clear();
_lvLoD->clear();
QTreeWidgetItem* treeitem = 0L;
QTreeWidgetItem* treeitem = nullptr;
const auto modules = availableModules();
for (const KPluginMetaData &mod : modules) {
QString servicePath = mod.metaDataFileName();
......@@ -420,7 +420,7 @@ void KDEDConfig::slotStartupItemSelected()
}
// Deselect a currently selected element in the "load on demand" treeview