summaryrefslogtreecommitdiffstats
path: root/examples/PkExampleHelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/PkExampleHelper.cpp')
-rw-r--r--examples/PkExampleHelper.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/examples/PkExampleHelper.cpp b/examples/PkExampleHelper.cpp
index 0258e700f..d6ecfdc7f 100644
--- a/examples/PkExampleHelper.cpp
+++ b/examples/PkExampleHelper.cpp
@@ -24,45 +24,45 @@
#include "polkitqt1-authority.h"
-#include <QtDBus/QDBusConnection>
-#include <QtCore/QTimer>
-#include <QtCore/QDebug>
-#include <QtXml/QDomDocument>
+#include <TQtDBus/TQDBusConnection>
+#include <TQtCore/TQTimer>
+#include <TQtCore/TQDebug>
+#include <TQtXml/TQDomDocument>
#define MINUTE 60000
-using namespace PolkitQt1;
+using namespace PolkitTQt1;
PkExampleHelper::PkExampleHelper(int &argc, char **argv)
- : QCoreApplication(argc, argv)
+ : TQCoreApplication(argc, argv)
{
- qDebug() << "Creating Helper";
+ tqDebug() << "Creating Helper";
(void) new ExamplesAdaptor(this);
// Register the DBus service
- if (!QDBusConnection::systemBus().registerService("org.qt.policykit.examples")) {
- qDebug() << QDBusConnection::systemBus().lastError().message();;
- QTimer::singleShot(0, this, SLOT(quit()));
+ if (!TQDBusConnection::systemBus().registerService("org.qt.policykit.examples")) {
+ tqDebug() << TQDBusConnection::systemBus().lastError().message();;
+ TQTimer::singleShot(0, this, SLOT(quit()));
return;
}
- if (!QDBusConnection::systemBus().registerObject("/", this)) {
- qDebug() << "unable to register service interface to dbus";
- QTimer::singleShot(0, this, SLOT(quit()));
+ if (!TQDBusConnection::systemBus().registerObject("/", this)) {
+ tqDebug() << "unable to register service interface to dbus";
+ TQTimer::singleShot(0, this, SLOT(quit()));
return;
}
// Normally you will set a timeout so your application can
// free some resources of the poor client machine ;)
- QTimer::singleShot(MINUTE, this, SLOT(quit()));
+ TQTimer::singleShot(MINUTE, this, SLOT(quit()));
}
PkExampleHelper::~PkExampleHelper()
{
- qDebug() << "Destroying Helper";
+ tqDebug() << "Destroying Helper";
}
-bool PkExampleHelper::set(const QString &action)
+bool PkExampleHelper::set(const TQString &action)
{
- qDebug() << "PkExampleHelper::set" << action;
+ tqDebug() << "PkExampleHelper::set" << action;
// message().service() is the service name of the caller
// We can check if the caller is authorized to the following action
Authority::Result result;
@@ -71,29 +71,29 @@ bool PkExampleHelper::set(const QString &action)
result = Authority::instance()->checkAuthorizationSync("org.qt.policykit.examples.set",
subject , Authority::AllowUserInteraction);
if (result == Authority::Yes) {
- qDebug() << message().service() << QString("Implicit authorization set to") << action;
+ tqDebug() << message().service() << TQString("Implicit authorization set to") << action;
// Caller is authorized so we can perform the action
return setValue(action);
} else {
- qDebug() << message().service() << QString("Can't set the implicit authorization");
+ tqDebug() << message().service() << TQString("Can't set the implicit authorization");
// Caller is not authorized so the action can't be performed
return false;
}
}
-bool PkExampleHelper::setValue(const QString &action)
+bool PkExampleHelper::setValue(const TQString &action)
{
// This action must be authorized first. It will set the implicit
// authorization for the Shout action by editing the .policy file
- QDomDocument doc = QDomDocument("policy");
- QFile file("/usr/share/polkit-1/actions/org.qt.policykit.examples.policy");
- if (!file.open(QIODevice::ReadOnly))
+ TQDomDocument doc = TQDomDocument("policy");
+ TQFile file("/usr/share/polkit-1/actions/org.qt.policykit.examples.policy");
+ if (!file.open(TQIODevice::ReadOnly))
return false;
doc.setContent(&file);
file.close();
- QDomElement el = doc.firstChildElement("policyconfig").
+ TQDomElement el = doc.firstChildElement("policyconfig").
firstChildElement("action");
- while (!el.isNull() && el.attribute("id", QString()) != "org.qt.policykit.examples.shout") {
+ while (!el.isNull() && el.attribute("id", TQString()) != "org.qt.policykit.examples.shout") {
el = el.nextSiblingElement("action");
}
el = el.firstChildElement("defaults");
@@ -101,9 +101,9 @@ bool PkExampleHelper::setValue(const QString &action)
if (el.isNull())
return false;
el.firstChild().toText().setData(action);
- if (!file.open(QIODevice::WriteOnly))
+ if (!file.open(TQIODevice::WriteOnly))
return false;
- QTextStream stream(&file);
+ TQTextStream stream(&file);
doc.save(stream, 2);
file.close();
return true;