summaryrefslogtreecommitdiffstats
path: root/examples
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 /examples
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 'examples')
-rw-r--r--examples/PkExample.cpp4
-rw-r--r--examples/agent/tqtlistener.cpp11
-rw-r--r--examples/agent/tqtlistener.h2
3 files changed, 7 insertions, 10 deletions
diff --git a/examples/PkExample.cpp b/examples/PkExample.cpp
index 4491dadd3..99c0e641f 100644
--- a/examples/PkExample.cpp
+++ b/examples/PkExample.cpp
@@ -48,12 +48,12 @@ using namespace PolkitTQt;
using namespace PolkitTQt::Gui;
-PkExample::PkExample() : TQMainWindow(0, "Polkit tqt example application", WDestructiveClose)
+PkExample::PkExample() : TQMainWindow(nullptr, "Polkit tqt example application", WDestructiveClose)
{
TQWidget *privateLayoutWidget = new TQWidget(this, "qt_central_widget");
setCentralWidget(privateLayoutWidget);
- grid = new TQGridLayout(0, 9, 1, 0, 6, "grid");
+ grid = new TQGridLayout(nullptr, 9, 1, 0, 6, "grid");
grid->setColSpacing(0, 700);
grid->setColSpacing(1, 200);
diff --git a/examples/agent/tqtlistener.cpp b/examples/agent/tqtlistener.cpp
index e915eabce..59cfd40f2 100644
--- a/examples/agent/tqtlistener.cpp
+++ b/examples/agent/tqtlistener.cpp
@@ -42,17 +42,14 @@ void TQtListener::initiateAuthentication(const TQString &actionId, const TQStrin
tqDebug("Initiate authentication for " + actionId + " with message " + message);
tqDebug(" iconName " + iconName);
TQStringList dkeys = details.keys();
- TQStringList::Iterator dkIt;
- for (dkIt = dkeys.begin(); dkIt != dkeys.end(); ++dkIt)
+ for (const TQString &dkey : dkeys)
{
- tqDebug(" key " + (*dkIt));
+ tqDebug(" key " + dkey);
}
tqDebug(" cookie " + cookie);
- PolkitTQt::Identity::List::ConstIterator iIt;
- for (iIt = identities.begin(); iIt != identities.end(); ++iIt)
+ for (const PolkitTQt::Identity &identity : identities)
{
- PolkitTQt::Identity identity = *iIt;
tqDebug(identity.toString());
Session *session = new Session(identity, cookie, result);
connect(session, TQT_SIGNAL(request(const TQString&, bool)), this,
@@ -83,7 +80,7 @@ void TQtListener::request(const TQString &request, bool echo)
Session *session = (Session*)sender();
bool ok;
TQString text = TQInputDialog::getText("TQt Agent", "Enter authorization password:",
- TQLineEdit::Password, TQString::null, &ok, NULL );
+ TQLineEdit::Password, TQString::null, &ok, nullptr );
if (ok && !text.isEmpty())
{
session->setResponse(text);
diff --git a/examples/agent/tqtlistener.h b/examples/agent/tqtlistener.h
index 202efa278..420915839 100644
--- a/examples/agent/tqtlistener.h
+++ b/examples/agent/tqtlistener.h
@@ -40,7 +40,7 @@ class TQtListener : public PolkitTQt::Agent::Listener
Q_OBJECT
public:
- TQtListener(TQObject *parent = 0);
+ TQtListener(TQObject *parent = nullptr);
public slots:
void initiateAuthentication(const TQString &actionId, const TQString &message,