diff options
author | Michele Calgaro <[email protected]> | 2021-10-30 13:47:29 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2021-10-30 13:47:29 +0900 |
commit | e8494e60efeb94c67c813d1c1c038031915e8c17 (patch) | |
tree | 3238b3e8ceeb577a8eda00da66704c7e5fc6f9f5 /examples/PkExampleHelper.cpp | |
parent | 28de2ff84f59ac0b173670aa9c5331bc77c1e63f (diff) | |
download | polkit-tqt-e8494e60efeb94c67c813d1c1c038031915e8c17.tar.gz polkit-tqt-e8494e60efeb94c67c813d1c1c038031915e8c17.zip |
Raw Qt->TQt conversion using tde/scripts/conversions/qt3-tqt3/convert_existing_qt3_app_to_tqt3.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'examples/PkExampleHelper.cpp')
-rw-r--r-- | examples/PkExampleHelper.cpp | 54 |
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; |