summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-12-28 20:45:45 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-12-28 20:45:45 +0900
commit82b07f1a3cc29b9785c292174343b464a774a722 (patch)
tree7a3501a01cf6e6d645929063ac601f4d3eb91edb /gui
parent416bed9bc124e24cc1351c7d8e5810ca7570a023 (diff)
downloadpolkit-tqt-82b07f1a3cc29b9785c292174343b464a774a722.tar.gz
polkit-tqt-82b07f1a3cc29b9785c292174343b464a774a722.zip
Code improvements based on c++11 standard (ranged for loops and nullptr).
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'gui')
-rw-r--r--gui/polkit-tqt-gui-action.h2
-rw-r--r--gui/polkit-tqt-gui-actionbutton.cpp8
-rw-r--r--gui/polkit-tqt-gui-actionbutton.h4
-rw-r--r--gui/polkit-tqt-gui-actionbuttons.cpp10
-rw-r--r--gui/polkit-tqt-gui-actionbuttons.h6
5 files changed, 12 insertions, 18 deletions
diff --git a/gui/polkit-tqt-gui-action.h b/gui/polkit-tqt-gui-action.h
index 4f5bb2e2d..21c10100b 100644
--- a/gui/polkit-tqt-gui-action.h
+++ b/gui/polkit-tqt-gui-action.h
@@ -77,7 +77,7 @@ class POLKIT_TQT_EXPORT Action : public TQAction
* \param actionId the PolicyKit action Id (e.g.: org.freedesktop.policykit.read)
* \param parent the object parent
*/
- explicit Action(const TQString& actionId = TQString::null, TQObject *parent = 0);
+ explicit Action(const TQString& actionId = TQString::null, TQObject *parent = nullptr);
~Action();
diff --git a/gui/polkit-tqt-gui-actionbutton.cpp b/gui/polkit-tqt-gui-actionbutton.cpp
index ffcdc2f28..48a0d1494 100644
--- a/gui/polkit-tqt-gui-actionbutton.cpp
+++ b/gui/polkit-tqt-gui-actionbutton.cpp
@@ -92,10 +92,8 @@ void ActionButton::streamClicked()
void ActionButton::updateButton()
{
- TQValueList<TQButton*>::iterator butIt;
- for (butIt = d->buttons.begin(); butIt != d->buttons.end(); ++butIt)
+ for (TQButton *&ent : d->buttons)
{
- TQButton *ent = *butIt;
if (isVisible())
{
ent->show();
@@ -128,10 +126,8 @@ void ActionButton::updateButton()
bool ActionButton::activate()
{
bool tg = false;
- TQValueList<TQButton*>::iterator butIt;
- for (butIt = d->buttons.begin(); butIt != d->buttons.end(); ++butIt)
+ for (TQButton *&ent : d->buttons)
{
- TQButton *ent = *butIt;
if (ent->isToggleButton())
{
// we set the the current Action state
diff --git a/gui/polkit-tqt-gui-actionbutton.h b/gui/polkit-tqt-gui-actionbutton.h
index 7ec45f296..6ab25577c 100644
--- a/gui/polkit-tqt-gui-actionbutton.h
+++ b/gui/polkit-tqt-gui-actionbutton.h
@@ -72,7 +72,7 @@ class POLKIT_TQT_EXPORT ActionButton : public Action
* \param parent the parent object
*/
explicit ActionButton(TQButton *button, const TQString &actionId = TQString::null,
- TQObject *parent = 0);
+ TQObject *parent = nullptr);
virtual ~ActionButton();
/**
@@ -131,7 +131,7 @@ class POLKIT_TQT_EXPORT ActionButton : public Action
void clicked(TQButton *button, bool checked = false);
protected:
- ActionButton(ActionButtonPrivate &dd, const TQString &actionId, TQObject *parent = 0);
+ ActionButton(ActionButtonPrivate &dd, const TQString &actionId, TQObject *parent = nullptr);
ActionButtonPrivate *const d;
diff --git a/gui/polkit-tqt-gui-actionbuttons.cpp b/gui/polkit-tqt-gui-actionbuttons.cpp
index 78aced5d6..f4e72d54f 100644
--- a/gui/polkit-tqt-gui-actionbuttons.cpp
+++ b/gui/polkit-tqt-gui-actionbuttons.cpp
@@ -32,7 +32,7 @@ namespace PolkitTQt
namespace Gui
{
-ActionButtons::ActionButtons(const TQValueList<TQButton*> &buttons, const TQString &actionId,
+ActionButtons::ActionButtons(TQValueList<TQButton*> &buttons, const TQString &actionId,
TQObject *parent) : ActionButton(*new ActionButtonPrivate(), actionId, parent)
{
setButtons(buttons);
@@ -42,17 +42,15 @@ ActionButtons::~ActionButtons()
{
}
-void ActionButtons::setButtons(const TQValueList<TQButton*> &buttons)
+void ActionButtons::setButtons(TQValueList<TQButton*> &buttons)
{
- TQValueList<TQButton*>::iterator butIt;
- for (butIt = d->buttons.begin(); butIt != d->buttons.end(); ++butIt)
+ for (TQButton *&ent : buttons)
{
- TQButton *ent = *butIt;
addButton(ent);
}
}
-TQValueList<TQButton *> ActionButtons::buttons() const
+TQValueList<TQButton*> ActionButtons::buttons() const
{
return d->buttons;
}
diff --git a/gui/polkit-tqt-gui-actionbuttons.h b/gui/polkit-tqt-gui-actionbuttons.h
index b85b632be..43b80bb93 100644
--- a/gui/polkit-tqt-gui-actionbuttons.h
+++ b/gui/polkit-tqt-gui-actionbuttons.h
@@ -62,8 +62,8 @@ class ActionButtons : public ActionButton
* \param actionId the action Id to create the underlying Action
* \param parent the parent object
*/
- explicit ActionButtons(const TQValueList<TQButton*> &buttons,
- const TQString &actionId = TQString::null, TQObject *parent = 0);
+ explicit ActionButtons(TQValueList<TQButton*> &buttons,
+ const TQString &actionId = TQString::null, TQObject *parent = nullptr);
virtual ~ActionButtons();
/**
@@ -80,7 +80,7 @@ class ActionButtons : public ActionButton
*
* \param buttons the new buttons associated with the underlying action
*/
- void setButtons(const TQValueList<TQButton*> &buttons);
+ void setButtons(TQValueList<TQButton*> &buttons);
/**
* Returns the current buttons list