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

Use nullptr

parent 80fc4988
......@@ -38,7 +38,7 @@ using namespace KHotKeys;
KHotKeysModule::KHotKeysModule(QObject* parent, const QList<QVariant>&)
: KDEDModule(parent)
, actions_root(NULL)
, actions_root(nullptr)
, _settingsDirty(false)
, _settings()
,_initialized(false)
......@@ -83,7 +83,7 @@ void KHotKeysModule::initialize()
KHotKeysModule::~KHotKeysModule()
{
// actions_root belongs to _settings.
actions_root = NULL;
actions_root = nullptr;
}
......@@ -92,7 +92,7 @@ void KHotKeysModule::reread_configuration()
qDebug() << "Reloading the khotkeys configuration";
// Stop listening
actions_root = NULL; // Disables the dbus interface effectively
actions_root = nullptr; // Disables the dbus interface effectively
KHotKeys::khotkeys_set_active( false );
// Load the settings
......@@ -132,7 +132,7 @@ SimpleActionData* KHotKeysModule::menuentry_action(const QString &storageId)
}
}
return NULL;
return nullptr;
}
......@@ -141,13 +141,13 @@ QString KHotKeysModule::get_menuentry_shortcut(const QString &storageId)
SimpleActionData* actionData = menuentry_action(storageId);
// No action found
if (actionData == NULL) return "";
if (actionData == nullptr) return "";
// The action must have a shortcut trigger. but don't assume to much
ShortcutTrigger* shortcutTrigger = dynamic_cast<ShortcutTrigger*>(actionData->trigger());
Q_ASSERT(shortcutTrigger);
if (shortcutTrigger == NULL) return "";
if (shortcutTrigger == nullptr) return "";
qDebug() << shortcutTrigger->primaryShortcut();
......@@ -174,7 +174,7 @@ QString KHotKeysModule::register_menuentry_shortcut(
SimpleActionData* actionData = menuentry_action(storageId);
// No action found. Create on if sequence is != ""
if (actionData == NULL)
if (actionData == nullptr)
{
qDebug() << "No action found";
......@@ -219,7 +219,7 @@ QString KHotKeysModule::register_menuentry_shortcut(
ShortcutTrigger* shortcutTrigger =
dynamic_cast<ShortcutTrigger*>(actionData->trigger());
Q_ASSERT(shortcutTrigger);
if (shortcutTrigger == NULL) return "";
if (shortcutTrigger == nullptr) return "";
// Change the actionData
shortcutTrigger->set_key_sequence(sequence);
......
......@@ -35,7 +35,7 @@ ActionGroupWidget::ActionGroupWidget( QWidget *parent )
ActionGroupWidget::~ActionGroupWidget()
{
_conditions = NULL;
_conditions = nullptr;
}
......
......@@ -39,7 +39,7 @@ public:
/**
* Default constructor
*/
ActionGroupWidget( QWidget *parent = 0 );
ActionGroupWidget( QWidget *parent = nullptr );
/**
* Destructor
......
......@@ -44,7 +44,7 @@ public:
protected:
ActionWidgetBase( KHotKeys::Action *action, QWidget *parent = 0 );
ActionWidgetBase( KHotKeys::Action *action, QWidget *parent = nullptr );
KHotKeys::Action *_action;
......
......@@ -37,7 +37,7 @@ public:
/**
* Default constructor
*/
CommandUrlActionWidget( KHotKeys::CommandUrlAction *action, QWidget *parent = 0 );
CommandUrlActionWidget( KHotKeys::CommandUrlAction *action, QWidget *parent = nullptr );
/**
* Destructor
......
......@@ -39,7 +39,7 @@ public:
/**
* Default constructor
*/
DbusActionWidget( KHotKeys::DBusAction *action, QWidget *parent = 0 );
DbusActionWidget( KHotKeys::DBusAction *action, QWidget *parent = nullptr );
/**
* Destructor
......
......@@ -39,7 +39,7 @@ public:
*/
KeyboardInputActionWidget(
KHotKeys::KeyboardInputAction *action,
QWidget *parent = NULL);
QWidget *parent = nullptr);
/**
* Destructor
......
......@@ -39,7 +39,7 @@ public:
/**
* Default constructor
*/
MenuentryActionWidget( KHotKeys::MenuEntryAction *action, QWidget *parent = 0 );
MenuentryActionWidget( KHotKeys::MenuEntryAction *action, QWidget *parent = nullptr );
/**
* Destructor
......
......@@ -34,7 +34,7 @@ public:
/**
* Default constructor
*/
ConditionTypeMenu(QWidget *parent = NULL);
ConditionTypeMenu(QWidget *parent = nullptr);
/**
* Destructor
......
......@@ -117,7 +117,7 @@ void BuildTree::visitConditionsListBase(KHotKeys::Condition_list_base *list)
ConditionsWidget::ConditionsWidget(QWidget *parent)
: QWidget(parent)
,_working(NULL)
,_working(nullptr)
,_changed(false)
{
ui.setupUi(this);
......@@ -136,7 +136,7 @@ ConditionsWidget::ConditionsWidget(QWidget *parent)
ConditionsWidget::~ConditionsWidget()
{
delete _working; _working = NULL;
delete _working; _working = nullptr;
}
......
......@@ -45,7 +45,7 @@ public:
/**
* Default constructor
*/
ConditionsWidget(QWidget *parent = NULL);
ConditionsWidget(QWidget *parent = nullptr);
/**
* Destructor
......
......@@ -33,7 +33,7 @@
GlobalSettingsWidget::GlobalSettingsWidget( QWidget *parent )
: HotkeysWidgetIFace( parent )
,_model(NULL)
,_model(nullptr)
{
ui.setupUi(this);
......
......@@ -41,7 +41,7 @@ public:
/**
* Default constructor
*/
GlobalSettingsWidget(QWidget *parent = NULL);
GlobalSettingsWidget(QWidget *parent = nullptr);
/**
* Destructor
......
......@@ -40,7 +40,7 @@ public:
/**
* Default constructor
*/
EditGestureDialog(const KHotKeys::StrokePoints &pointData, QWidget *parent=NULL);
EditGestureDialog(const KHotKeys::StrokePoints &pointData, QWidget *parent=nullptr);
/**
* Destructor
......
......@@ -33,7 +33,7 @@ class GestureDrawer : public QFrame
public:
GestureDrawer(QWidget *parent, const char *name = 0);
GestureDrawer(QWidget *parent, const char *name = nullptr);
~GestureDrawer();
void setPointData(const KHotKeys::StrokePoints &data);
......
......@@ -38,7 +38,7 @@ public:
/**
* Default constructor
*/
GestureWidget(QWidget *parent = NULL);
GestureWidget(QWidget *parent = nullptr);
/**
* Destructor
......
......@@ -24,8 +24,8 @@
WindowDefinitionListWidget::WindowDefinitionListWidget(QWidget *parent)
: HotkeysWidgetIFace(parent)
,_windowdefs(NULL)
,_working(NULL)
,_windowdefs(nullptr)
,_working(nullptr)
,_changed(false)
{
ui.setupUi(this);
......@@ -50,8 +50,8 @@ WindowDefinitionListWidget::WindowDefinitionListWidget(QWidget *parent)
WindowDefinitionListWidget::WindowDefinitionListWidget(KHotKeys::Windowdef_list *windowdef, QWidget *parent)
: HotkeysWidgetIFace(parent)
,_windowdefs(NULL)
,_working(NULL)
,_windowdefs(nullptr)
,_working(nullptr)
,_changed(false)
{
ui.setupUi(this);
......
......@@ -41,7 +41,7 @@ public:
*/
WindowDefinitionListWidget(
KHotKeys::Windowdef_list *windowdef_list,
QWidget *parent = NULL);
QWidget *parent = nullptr);
WindowDefinitionListWidget(QWidget *parent);
......@@ -92,9 +92,9 @@ public:
WindowDefinitionListDialog(
KHotKeys::Windowdef_list *list,
QWidget *parent=NULL)
QWidget *parent=nullptr)
: KDialog(parent)
,def(NULL)
,def(nullptr)
{
def = new WindowDefinitionListWidget(list, this);
setMainWidget(def);
......@@ -104,7 +104,7 @@ public:
~WindowDefinitionListDialog()
{
def = NULL;
def = nullptr;
}
......
......@@ -46,7 +46,7 @@ public:
/**
* Default constructor
*/
WindowDefinitionWidget(KHotKeys::Windowdef_simple *windowdef, QWidget *parent = NULL);
WindowDefinitionWidget(KHotKeys::Windowdef_simple *windowdef, QWidget *parent = nullptr);
/**
* Destructor
......@@ -83,9 +83,9 @@ class WindowDefinitionDialog : public KDialog
public:
WindowDefinitionDialog( KHotKeys::Windowdef_simple *windowdef, QWidget *parent=NULL)
WindowDefinitionDialog( KHotKeys::Windowdef_simple *windowdef, QWidget *parent=nullptr)
: KDialog(parent)
,def(NULL)
,def(nullptr)
{
def = new WindowDefinitionWidget(windowdef, this);
setMainWidget(def);
......@@ -95,7 +95,7 @@ public:
~WindowDefinitionDialog()
{
def = NULL;
def = nullptr;
}
......
......@@ -74,7 +74,7 @@ WId WindowSelector::findRealWindow( WId w, int depth )
if( XGetWindowProperty( QX11Info::display(), w, wm_state, 0, 0, False, AnyPropertyType,
&type, &format, &nitems, &after, &prop ) == Success )
{
if( prop != NULL )
if( prop != nullptr )
XFree( prop );
if( type != None )
return w;
......@@ -89,7 +89,7 @@ WId WindowSelector::findRealWindow( WId w, int depth )
i < nchildren && ret == None;
++i )
ret = findRealWindow( children[ i ], depth + 1 );
if( children != NULL )
if( children != nullptr )
XFree( children );
}
return ret;
......
......@@ -69,7 +69,7 @@ HotkeysTreeViewContextMenu::createActionFromType(
KHotKeys::SimpleActionData* data
) const
{
KHotKeys::Action *action = NULL;
KHotKeys::Action *action = nullptr;
switch (actionType)
{
case KHotKeys::Action::CommandUrlActionType:
......@@ -90,7 +90,7 @@ HotkeysTreeViewContextMenu::createActionFromType(
default:
Q_ASSERT(false);
return NULL;
return nullptr;
}
data->set_action(action);
......
......@@ -36,9 +36,9 @@ static KHotKeys::ActionDataBase *findElement(
,KHotKeys::ActionDataGroup *root)
{
Q_ASSERT(root);
if (!root) return NULL;
if (!root) return nullptr;
KHotKeys::ActionDataBase *match = NULL;
KHotKeys::ActionDataBase *match = nullptr;
Q_FOREACH( KHotKeys::ActionDataBase *element, root->children())
{
......
......@@ -44,7 +44,7 @@ public:
/**
* Default constructor
*/
HotkeysTreeView( QWidget *parent = 0 );
HotkeysTreeView( QWidget *parent = nullptr );
/**
* Destructor
......
......@@ -41,7 +41,7 @@ public:
/**
* Default constructor
*/
HotkeysWidgetBase( QWidget *parent = 0 );
HotkeysWidgetBase( QWidget *parent = nullptr );
/**
* Destructor
......
......@@ -38,7 +38,7 @@ public:
/**
* Default constructor
*/
HotkeysWidgetIFace( QWidget *parent = 0 );
HotkeysWidgetIFace( QWidget *parent = nullptr );
/**
* Destructor
......
......@@ -265,9 +265,9 @@ void KCMHotkeys::save()
KCMHotkeysPrivate::KCMHotkeysPrivate( KCMHotkeys *host )
: Ui::KCMHotkeysWidget()
,model(NULL)
,model(nullptr)
,q(host)
,current(NULL)
,current(nullptr)
{
setupUi(q);
......
......@@ -32,8 +32,8 @@
SimpleActionDataWidget::SimpleActionDataWidget( QWidget *parent )
: HotkeysWidgetBase( parent )
,currentTrigger(NULL)
,currentAction(NULL)
,currentTrigger(nullptr)
,currentAction(nullptr)
{}
......@@ -90,7 +90,7 @@ void SimpleActionDataWidget::setActionData( KHotKeys::SimpleActionData* pData )
_data = pData;
// Now go and work on the trigger
delete currentTrigger; currentTrigger = NULL;
delete currentTrigger; currentTrigger = nullptr;
if ( KHotKeys::Trigger *trg = data()->trigger() )
{
......@@ -125,7 +125,7 @@ void SimpleActionDataWidget::setActionData( KHotKeys::SimpleActionData* pData )
}
// Now go and work on the action
delete currentAction; currentAction = NULL;
delete currentAction; currentAction = nullptr;
if ( KHotKeys::Action *act = data()->action() )
{
......
......@@ -40,7 +40,7 @@ public:
/**
* Default constructor
*/
SimpleActionDataWidget( QWidget *parent = 0 );
SimpleActionDataWidget( QWidget *parent = nullptr );
/**
......
......@@ -41,7 +41,7 @@ public:
/**
* Default constructor
*/
GestureTriggerWidget(KHotKeys::GestureTrigger *trigger, QWidget *parent = NULL);
GestureTriggerWidget(KHotKeys::GestureTrigger *trigger, QWidget *parent = nullptr);
/**
* Destructor
......
......@@ -38,7 +38,7 @@ public:
/**
* Default constructor
*/
ShortcutTriggerWidget(KHotKeys::ShortcutTrigger *trigger, QWidget *parent = NULL);
ShortcutTriggerWidget(KHotKeys::ShortcutTrigger *trigger, QWidget *parent = nullptr);
/**
* Destructor
......
......@@ -48,7 +48,7 @@ public:
protected:
TriggerWidgetBase( KHotKeys::Trigger *trigger, QWidget *parent = 0 );
TriggerWidgetBase( KHotKeys::Trigger *trigger, QWidget *parent = nullptr );
KHotKeys::Trigger *_trigger;
......
......@@ -29,7 +29,7 @@
WindowTriggerWidget::WindowTriggerWidget( KHotKeys::WindowTrigger *trigger, QWidget *parent )
: TriggerWidgetBase(trigger, parent)
,_windowdef_widget(NULL)
,_windowdef_widget(nullptr)
{
window_trigger_ui.setupUi(this);
......
......@@ -40,7 +40,7 @@ public:
/**
* Default constructor
*/
WindowTriggerWidget( KHotKeys::WindowTrigger *trigger, QWidget *parent = 0 );
WindowTriggerWidget( KHotKeys::WindowTrigger *trigger, QWidget *parent = nullptr );
/**
* Destructor
......
......@@ -49,8 +49,8 @@ void ActionData::accept(ActionDataConstVisitor *visitor) const
ActionData::~ActionData()
{
delete _triggers; _triggers = NULL;
delete _actions; _actions = NULL;
delete _triggers; _triggers = nullptr;
delete _actions; _actions = nullptr;
}
......
......@@ -161,7 +161,7 @@ class Q_DECL_EXPORT ActionDataBase : public QObject
friend class ActionDataGroup;
//! The parent or NULL
//! The parent or nullptr
ActionDataGroup* _parent;
//! List of conditions for this element
......
......@@ -169,7 +169,7 @@ void ActionDataGroup::doEnable()
void ActionDataGroup::remove_child( ActionDataBase* child_P )
{
child_P->_parent = NULL;
child_P->_parent = nullptr;
_list.removeAll( child_P ); // is not auto-delete
}
......
......@@ -60,7 +60,7 @@ class Q_DECL_EXPORT ActionDataGroup
ActionDataGroup* parent_P,
const QString& name_P = QString(),
const QString& comment_P = QString(),
Condition_list* conditions_P = NULL,
Condition_list* conditions_P = nullptr,
system_group_t system_group_P = SYSTEM_NONE);
virtual ~ActionDataGroup();
......
......@@ -29,9 +29,9 @@ class Q_DECL_EXPORT Generic_action_data
ActionDataGroup* parent_P,
const QString& name_P = QString(),
const QString& comment_P = QString(),
Trigger_list* triggers_P = NULL,
Condition_list* conditions_P = NULL,
ActionList* actions_P = NULL);
Trigger_list* triggers_P = nullptr,
Condition_list* conditions_P = nullptr,
ActionList* actions_P = nullptr);
~Generic_action_data();
......
......@@ -110,7 +110,7 @@ Action* SimpleActionData::action()
const Trigger* SimpleActionData::trigger() const
{
if( triggers() == 0 || triggers()->isEmpty() )
return NULL;
return nullptr;
return triggers()->first();
}
......@@ -119,7 +119,7 @@ const Trigger* SimpleActionData::trigger() const
Trigger* SimpleActionData::trigger()
{
if( triggers() == 0 || triggers()->isEmpty() )
return NULL;
return nullptr;
return triggers()->first();
}
......
......@@ -296,7 +296,7 @@ class Q_DECL_EXPORT KeyboardInputAction
KeyboardInputAction(
ActionData* data_P,
const QString& input_P = QString(),
Windowdef_list* dest_window_P = NULL,
Windowdef_list* dest_window_P = nullptr,
bool active_window_P = true);
virtual ~KeyboardInputAction();
......@@ -307,9 +307,9 @@ class Q_DECL_EXPORT KeyboardInputAction
const QString& input() const;
void setInput(const QString &input);
// send to specific window: dest_window != NULL
// send to active window: dest_window == NULL && activeWindow() == true
// send to action window: dest_window == NULL && activeWindow() == false
// send to specific window: dest_window != nullptr
// send to active window: dest_window == nullptr && activeWindow() == true
// send to action window: dest_window == nullptr && activeWindow() == false
//
DestinationWindow destination() const;
......@@ -354,7 +354,7 @@ class Q_DECL_EXPORT ActivateWindowAction
public:
ActivateWindowAction(
ActionData* data_P,
const Windowdef_list* window = NULL);
const Windowdef_list* window = nullptr);
virtual ~ActivateWindowAction();
void cfg_write( KConfigGroup& cfg_P ) const Q_DECL_OVERRIDE;
......
......@@ -123,7 +123,7 @@ void CommandUrlAction::execute()
KService::Ptr service = KService::serviceByDesktopName( cmd );
if( service )
{
KRun::run( *service, KUrl::List(), NULL );
KRun::run( *service, KUrl::List(), nullptr );
break;
}
}
......@@ -135,7 +135,7 @@ void CommandUrlAction::execute()
return;
if( !KRun::runCommand(
cmd + ( uri.hasArgsAndOptions() ? uri.argsAndOptions() : "" ),
cmd, uri.iconName(), NULL )) {
cmd, uri.iconName(), nullptr )) {
// CHECKME ?
}
break;
......
......@@ -130,7 +130,7 @@ void KeyboardInputAction::cfg_write( KConfigGroup& cfg_P ) const
cfg_P.writeEntry( "DestinationWindow", int(_destination) );
if( _destination == SpecificWindow && dest_window() != NULL )
if( _destination == SpecificWindow && dest_window() != nullptr )
{
KConfigGroup windowGroup( cfg_P.config(), cfg_P.name() + "DestinationWindow" );
dest_window()->cfg_write( windowGroup );
......@@ -199,7 +199,7 @@ Action* KeyboardInputAction::copy( ActionData* data_P ) const
return new KeyboardInputAction(
data_P,
input(),
dest_window() ? dest_window()->copy() : NULL,
dest_window() ? dest_window()->copy() : nullptr,
_destination == ActiveWindow);
}
......
......@@ -87,7 +87,7 @@ void MenuEntryAction::execute()